jkawamoto/roadie

View on GitHub
cloud/azure/resource/client/resources/resources_create_or_update_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"
)

// ResourcesCreateOrUpdateReader is a Reader for the ResourcesCreateOrUpdate structure.
type ResourcesCreateOrUpdateReader struct {
    formats strfmt.Registry
}

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

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

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

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

// NewResourcesCreateOrUpdateOK creates a ResourcesCreateOrUpdateOK with default headers values
func NewResourcesCreateOrUpdateOK() *ResourcesCreateOrUpdateOK {
    return &ResourcesCreateOrUpdateOK{}
}

/*ResourcesCreateOrUpdateOK handles this case with default header values.

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

func (o *ResourcesCreateOrUpdateOK) Error() string {
    return fmt.Sprintf("[PUT /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}][%d] resourcesCreateOrUpdateOK  %+v", 200, o.Payload)
}

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

// NewResourcesCreateOrUpdateCreated creates a ResourcesCreateOrUpdateCreated with default headers values
func NewResourcesCreateOrUpdateCreated() *ResourcesCreateOrUpdateCreated {
    return &ResourcesCreateOrUpdateCreated{}
}

/*ResourcesCreateOrUpdateCreated handles this case with default header values.

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

func (o *ResourcesCreateOrUpdateCreated) Error() string {
    return fmt.Sprintf("[PUT /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}][%d] resourcesCreateOrUpdateCreated  %+v", 201, o.Payload)
}

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

// NewResourcesCreateOrUpdateAccepted creates a ResourcesCreateOrUpdateAccepted with default headers values
func NewResourcesCreateOrUpdateAccepted() *ResourcesCreateOrUpdateAccepted {
    return &ResourcesCreateOrUpdateAccepted{}
}

/*ResourcesCreateOrUpdateAccepted handles this case with default header values.

Accepted
*/
type ResourcesCreateOrUpdateAccepted struct {
}

func (o *ResourcesCreateOrUpdateAccepted) Error() string {
    return fmt.Sprintf("[PUT /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}][%d] resourcesCreateOrUpdateAccepted ", 202)
}

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

    return nil
}