jkawamoto/roadie

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

Summary

Maintainability
D
1 day
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"
)

// ResourcesCreateOrUpdateByIDReader is a Reader for the ResourcesCreateOrUpdateByID structure.
type ResourcesCreateOrUpdateByIDReader struct {
    formats strfmt.Registry
}

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

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

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

    case 202:
        result := NewResourcesCreateOrUpdateByIDAccepted()
        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())
    }
}

// NewResourcesCreateOrUpdateByIDOK creates a ResourcesCreateOrUpdateByIDOK with default headers values
func NewResourcesCreateOrUpdateByIDOK() *ResourcesCreateOrUpdateByIDOK {
    return &ResourcesCreateOrUpdateByIDOK{}
}

/*ResourcesCreateOrUpdateByIDOK handles this case with default header values.

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

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

func (o *ResourcesCreateOrUpdateByIDOK) 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
}

// NewResourcesCreateOrUpdateByIDCreated creates a ResourcesCreateOrUpdateByIDCreated with default headers values
func NewResourcesCreateOrUpdateByIDCreated() *ResourcesCreateOrUpdateByIDCreated {
    return &ResourcesCreateOrUpdateByIDCreated{}
}

/*ResourcesCreateOrUpdateByIDCreated handles this case with default header values.

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

func (o *ResourcesCreateOrUpdateByIDCreated) Error() string {
    return fmt.Sprintf("[PUT /{resourceId}][%d] resourcesCreateOrUpdateByIdCreated  %+v", 201, o.Payload)
}

func (o *ResourcesCreateOrUpdateByIDCreated) 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
}

// NewResourcesCreateOrUpdateByIDAccepted creates a ResourcesCreateOrUpdateByIDAccepted with default headers values
func NewResourcesCreateOrUpdateByIDAccepted() *ResourcesCreateOrUpdateByIDAccepted {
    return &ResourcesCreateOrUpdateByIDAccepted{}
}

/*ResourcesCreateOrUpdateByIDAccepted handles this case with default header values.

Accepted
*/
type ResourcesCreateOrUpdateByIDAccepted struct {
}

func (o *ResourcesCreateOrUpdateByIDAccepted) Error() string {
    return fmt.Sprintf("[PUT /{resourceId}][%d] resourcesCreateOrUpdateByIdAccepted ", 202)
}

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

    return nil
}