jkawamoto/roadie

View on GitHub
cloud/azure/batch/client/files/file_get_from_task_parameters.go

Summary

Maintainability
C
1 day
Test Coverage
package files

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

import (
    "net/http"
    "time"

    "golang.org/x/net/context"

    "github.com/go-openapi/errors"
    "github.com/go-openapi/runtime"
    cr "github.com/go-openapi/runtime/client"
    "github.com/go-openapi/swag"

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

// NewFileGetFromTaskParams creates a new FileGetFromTaskParams object
// with the default values initialized.
func NewFileGetFromTaskParams() *FileGetFromTaskParams {
    var (
        returnClientRequestIDDefault = bool(false)
        timeoutDefault               = int32(30)
    )
    return &FileGetFromTaskParams{
        ReturnClientRequestID: &returnClientRequestIDDefault,
        Timeout:               &timeoutDefault,

        requestTimeout: cr.DefaultTimeout,
    }
}

// NewFileGetFromTaskParamsWithTimeout creates a new FileGetFromTaskParams object
// with the default values initialized, and the ability to set a timeout on a request
func NewFileGetFromTaskParamsWithTimeout(timeout time.Duration) *FileGetFromTaskParams {
    var (
        returnClientRequestIDDefault = bool(false)
        timeoutDefault               = int32(30)
    )
    return &FileGetFromTaskParams{
        ReturnClientRequestID: &returnClientRequestIDDefault,
        Timeout:               &timeoutDefault,

        requestTimeout: timeout,
    }
}

// NewFileGetFromTaskParamsWithContext creates a new FileGetFromTaskParams object
// with the default values initialized, and the ability to set a context for a request
func NewFileGetFromTaskParamsWithContext(ctx context.Context) *FileGetFromTaskParams {
    var (
        returnClientRequestIdDefault = bool(false)
        timeoutDefault               = int32(30)
    )
    return &FileGetFromTaskParams{
        ReturnClientRequestID: &returnClientRequestIdDefault,
        Timeout:               &timeoutDefault,

        Context: ctx,
    }
}

/*FileGetFromTaskParams contains all the parameters to send to the API endpoint
for the file get from task operation typically these are written to a http.Request
*/
type FileGetFromTaskParams struct {

    /*IfModifiedSince
      Specify this header to perform the operation only if the resource has been modified since the specified date/time.

    */
    IfModifiedSince *string
    /*IfUnmodifiedSince
      Specify this header to perform the operation only if the resource has not been modified since the specified date/time.

    */
    IfUnmodifiedSince *string
    /*APIVersion
      Client API Version.

    */
    APIVersion string
    /*ClientRequestID
      The caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0.

    */
    ClientRequestID *string
    /*FileName
      The path to the task file that you want to get the content of.

    */
    FileName string
    /*JobID
      The ID of the job that contains the task.

    */
    JobID string
    /*OcpDate
      The time the request was issued. If not specified, this header will be automatically populated with the current system clock time.

    */
    OcpDate *string
    /*OcpRange
      The byte range to be retrieved. The default is to retrieve the entire file. The format is bytes=startRange-endRange.

    */
    OcpRange *string
    /*ReturnClientRequestID
      Whether the server should return the client-request-id in the response.

    */
    ReturnClientRequestID *bool
    /*TaskID
      The ID of the task whose file you want to retrieve.

    */
    TaskID string
    /*Timeout
      The maximum time that the server can spend processing the request, in seconds. The default is 30 seconds.

    */
    Timeout *int32

    requestTimeout time.Duration
    Context        context.Context
    HTTPClient     *http.Client
}

// WithRequestTimeout adds the timeout to the file get from task params
func (o *FileGetFromTaskParams) WithRequestTimeout(timeout time.Duration) *FileGetFromTaskParams {
    o.SetRequestTimeout(timeout)
    return o
}

// SetRequestTimeout adds the timeout to the file get from task params
func (o *FileGetFromTaskParams) SetRequestTimeout(timeout time.Duration) {
    o.requestTimeout = timeout
}

// WithContext adds the context to the file get from task params
func (o *FileGetFromTaskParams) WithContext(ctx context.Context) *FileGetFromTaskParams {
    o.SetContext(ctx)
    return o
}

// SetContext adds the context to the file get from task params
func (o *FileGetFromTaskParams) SetContext(ctx context.Context) {
    o.Context = ctx
}

// WithIfModifiedSince adds the ifModifiedSince to the file get from task params
func (o *FileGetFromTaskParams) WithIfModifiedSince(ifModifiedSince *string) *FileGetFromTaskParams {
    o.SetIfModifiedSince(ifModifiedSince)
    return o
}

// SetIfModifiedSince adds the ifModifiedSince to the file get from task params
func (o *FileGetFromTaskParams) SetIfModifiedSince(ifModifiedSince *string) {
    o.IfModifiedSince = ifModifiedSince
}

// WithIfUnmodifiedSince adds the ifUnmodifiedSince to the file get from task params
func (o *FileGetFromTaskParams) WithIfUnmodifiedSince(ifUnmodifiedSince *string) *FileGetFromTaskParams {
    o.SetIfUnmodifiedSince(ifUnmodifiedSince)
    return o
}

// SetIfUnmodifiedSince adds the ifUnmodifiedSince to the file get from task params
func (o *FileGetFromTaskParams) SetIfUnmodifiedSince(ifUnmodifiedSince *string) {
    o.IfUnmodifiedSince = ifUnmodifiedSince
}

// WithAPIVersion adds the aPIVersion to the file get from task params
func (o *FileGetFromTaskParams) WithAPIVersion(aPIVersion string) *FileGetFromTaskParams {
    o.SetAPIVersion(aPIVersion)
    return o
}

// SetAPIVersion adds the apiVersion to the file get from task params
func (o *FileGetFromTaskParams) SetAPIVersion(aPIVersion string) {
    o.APIVersion = aPIVersion
}

// WithClientRequestID adds the clientRequestID to the file get from task params
func (o *FileGetFromTaskParams) WithClientRequestID(clientRequestID *string) *FileGetFromTaskParams {
    o.SetClientRequestID(clientRequestID)
    return o
}

// SetClientRequestID adds the clientRequestId to the file get from task params
func (o *FileGetFromTaskParams) SetClientRequestID(clientRequestID *string) {
    o.ClientRequestID = clientRequestID
}

// WithFileName adds the fileName to the file get from task params
func (o *FileGetFromTaskParams) WithFileName(fileName string) *FileGetFromTaskParams {
    o.SetFileName(fileName)
    return o
}

// SetFileName adds the fileName to the file get from task params
func (o *FileGetFromTaskParams) SetFileName(fileName string) {
    o.FileName = fileName
}

// WithJobID adds the jobID to the file get from task params
func (o *FileGetFromTaskParams) WithJobID(jobID string) *FileGetFromTaskParams {
    o.SetJobID(jobID)
    return o
}

// SetJobID adds the jobId to the file get from task params
func (o *FileGetFromTaskParams) SetJobID(jobID string) {
    o.JobID = jobID
}

// WithOcpDate adds the ocpDate to the file get from task params
func (o *FileGetFromTaskParams) WithOcpDate(ocpDate *string) *FileGetFromTaskParams {
    o.SetOcpDate(ocpDate)
    return o
}

// SetOcpDate adds the ocpDate to the file get from task params
func (o *FileGetFromTaskParams) SetOcpDate(ocpDate *string) {
    o.OcpDate = ocpDate
}

// WithOcpRange adds the ocpRange to the file get from task params
func (o *FileGetFromTaskParams) WithOcpRange(ocpRange *string) *FileGetFromTaskParams {
    o.SetOcpRange(ocpRange)
    return o
}

// SetOcpRange adds the ocpRange to the file get from task params
func (o *FileGetFromTaskParams) SetOcpRange(ocpRange *string) {
    o.OcpRange = ocpRange
}

// WithReturnClientRequestID adds the returnClientRequestID to the file get from task params
func (o *FileGetFromTaskParams) WithReturnClientRequestID(returnClientRequestID *bool) *FileGetFromTaskParams {
    o.SetReturnClientRequestID(returnClientRequestID)
    return o
}

// SetReturnClientRequestID adds the returnClientRequestId to the file get from task params
func (o *FileGetFromTaskParams) SetReturnClientRequestID(returnClientRequestID *bool) {
    o.ReturnClientRequestID = returnClientRequestID
}

// WithTaskID adds the taskID to the file get from task params
func (o *FileGetFromTaskParams) WithTaskID(taskID string) *FileGetFromTaskParams {
    o.SetTaskID(taskID)
    return o
}

// SetTaskID adds the taskId to the file get from task params
func (o *FileGetFromTaskParams) SetTaskID(taskID string) {
    o.TaskID = taskID
}

// WithTimeout adds the timeout to the file get from task params
func (o *FileGetFromTaskParams) WithTimeout(timeout *int32) *FileGetFromTaskParams {
    o.SetTimeout(timeout)
    return o
}

// SetTimeout adds the timeout to the file get from task params
func (o *FileGetFromTaskParams) SetTimeout(timeout *int32) {
    o.Timeout = timeout
}

// WriteToRequest writes these params to a swagger request
func (o *FileGetFromTaskParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {

    r.SetTimeout(o.requestTimeout)
    var res []error

    if o.IfModifiedSince != nil {

        // header param If-Modified-Since
        if err := r.SetHeaderParam("If-Modified-Since", *o.IfModifiedSince); err != nil {
            return err
        }

    }

    if o.IfUnmodifiedSince != nil {

        // header param If-Unmodified-Since
        if err := r.SetHeaderParam("If-Unmodified-Since", *o.IfUnmodifiedSince); err != nil {
            return err
        }

    }

    // query param api-version
    qrAPIVersion := o.APIVersion
    qAPIVersion := qrAPIVersion
    if qAPIVersion != "" {
        if err := r.SetQueryParam("api-version", qAPIVersion); err != nil {
            return err
        }
    }

    if o.ClientRequestID != nil {

        // header param client-request-id
        if err := r.SetHeaderParam("client-request-id", *o.ClientRequestID); err != nil {
            return err
        }

    }

    // path param fileName
    if err := r.SetPathParam("fileName", o.FileName); err != nil {
        return err
    }

    // path param jobId
    if err := r.SetPathParam("jobId", o.JobID); err != nil {
        return err
    }

    if o.OcpDate != nil {

        // header param ocp-date
        if err := r.SetHeaderParam("ocp-date", *o.OcpDate); err != nil {
            return err
        }

    }

    if o.OcpRange != nil {

        // header param ocp-range
        if err := r.SetHeaderParam("ocp-range", *o.OcpRange); err != nil {
            return err
        }

    }

    if o.ReturnClientRequestID != nil {

        // header param return-client-request-id
        if err := r.SetHeaderParam("return-client-request-id", swag.FormatBool(*o.ReturnClientRequestID)); err != nil {
            return err
        }

    }

    // path param taskId
    if err := r.SetPathParam("taskId", o.TaskID); err != nil {
        return err
    }

    if o.Timeout != nil {

        // query param timeout
        var qrTimeout int32
        if o.Timeout != nil {
            qrTimeout = *o.Timeout
        }
        qTimeout := swag.FormatInt32(qrTimeout)
        if qTimeout != "" {
            if err := r.SetQueryParam("timeout", qTimeout); err != nil {
                return err
            }
        }

    }

    if len(res) > 0 {
        return errors.CompositeValidationError(res...)
    }
    return nil
}