jkawamoto/roadie

View on GitHub
cloud/azure/batch/client/jobs/job_delete_responses.go

Summary

Maintainability
C
1 day
Test Coverage
package jobs

// 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/batch/models"
)

// JobDeleteReader is a Reader for the JobDelete structure.
type JobDeleteReader struct {
    formats strfmt.Registry
}

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

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

    default:
        result := NewJobDeleteDefault(response.Code())
        if err := result.readResponse(response, consumer, o.formats); err != nil {
            return nil, err
        }
        if response.Code()/100 == 2 {
            return result, nil
        }
        return nil, result
    }
}

// NewJobDeleteAccepted creates a JobDeleteAccepted with default headers values
func NewJobDeleteAccepted() *JobDeleteAccepted {
    return &JobDeleteAccepted{}
}

/*JobDeleteAccepted handles this case with default header values.

The request to the Batch service was successful.
*/
type JobDeleteAccepted struct {
    /*The client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true.
     */
    ClientRequestID string
    /*This header uniquely identifies the request that was made and can be used for troubleshooting the request. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this header, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in.
     */
    RequestID string
}

func (o *JobDeleteAccepted) Error() string {
    return fmt.Sprintf("[DELETE /jobs/{jobId}][%d] jobDeleteAccepted ", 202)
}

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

    // response header client-request-id
    o.ClientRequestID = response.GetHeader("client-request-id")

    // response header request-id
    o.RequestID = response.GetHeader("request-id")

    return nil
}

// NewJobDeleteDefault creates a JobDeleteDefault with default headers values
func NewJobDeleteDefault(code int) *JobDeleteDefault {
    return &JobDeleteDefault{
        _statusCode: code,
    }
}

/*JobDeleteDefault handles this case with default header values.

The error from the Batch service.
*/
type JobDeleteDefault struct {
    _statusCode int

    Payload *models.BatchError
}

// Code gets the status code for the job delete default response
func (o *JobDeleteDefault) Code() int {
    return o._statusCode
}

func (o *JobDeleteDefault) Error() string {
    return fmt.Sprintf("[DELETE /jobs/{jobId}][%d] Job_Delete default  %+v", o._statusCode, o.Payload)
}

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

    o.Payload = new(models.BatchError)

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

    return nil
}