jkawamoto/roadie

View on GitHub
cloud/azure/resource/client/resources/resources_get_by_id_responses.go

Summary

Maintainability
B
5 hrs
Test Coverage
package resources

// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command

import (
    "fmt"
    "io"

    "github.com/go-openapi/runtime"

    strfmt "github.com/go-openapi/strfmt"

    "github.com/jkawamoto/roadie/cloud/azure/resource/models"
)

// ResourcesGetByIDReader is a Reader for the ResourcesGetByID structure.
type ResourcesGetByIDReader struct {
    formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *ResourcesGetByIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
    switch response.Code() {

    case 200:
        result := NewResourcesGetByIDOK()
        if err := result.readResponse(response, consumer, o.formats); err != nil {
            return nil, err
        }
        return result, nil

    default:
        return nil, runtime.NewAPIError("unknown error", response, response.Code())
    }
}

// NewResourcesGetByIDOK creates a ResourcesGetByIDOK with default headers values
func NewResourcesGetByIDOK() *ResourcesGetByIDOK {
    return &ResourcesGetByIDOK{}
}

/*ResourcesGetByIDOK handles this case with default header values.

OK - Returns information about the resource.
*/
type ResourcesGetByIDOK struct {
    Payload *models.GenericResource
}

func (o *ResourcesGetByIDOK) Error() string {
    return fmt.Sprintf("[GET /{resourceId}][%d] resourcesGetByIdOK  %+v", 200, o.Payload)
}

func (o *ResourcesGetByIDOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {

    o.Payload = new(models.GenericResource)

    // response payload
    if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
        return err
    }

    return nil
}