jkawamoto/roadie

View on GitHub
cloud/azure/batch/client/files/file_list_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"
)

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

        requestTimeout: cr.DefaultTimeout,
    }
}

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

        requestTimeout: timeout,
    }
}

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

        Context: ctx,
    }
}

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

    /*NrDollarFilter
      An OData $filter clause.

    */
    DollarFilter *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
    /*JobID
      The ID of the job that contains the task.

    */
    JobID string
    /*Maxresults
      The maximum number of items to return in the response. A maximum of 1000 files can be returned.

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

    */
    OcpDate *string
    /*Recursive
      Whether to list children of a directory. This parameter can be used in combination with the filter parameter to list specific type of files.

    */
    Recursive *bool
    /*ReturnClientRequestID
      Whether the server should return the client-request-id in the response.

    */
    ReturnClientRequestID *bool
    /*TaskID
      The ID of the task whose files you want to list.

    */
    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 list from task params
func (o *FileListFromTaskParams) WithRequestTimeout(timeout time.Duration) *FileListFromTaskParams {
    o.SetRequestTimeout(timeout)
    return o
}

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

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

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

// WithDollarFilter adds the dollarFilter to the file list from task params
func (o *FileListFromTaskParams) WithDollarFilter(dollarFilter *string) *FileListFromTaskParams {
    o.SetDollarFilter(dollarFilter)
    return o
}

// SetDollarFilter adds the dollarFilter to the file list from task params
func (o *FileListFromTaskParams) SetDollarFilter(dollarFilter *string) {
    o.DollarFilter = dollarFilter
}

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

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

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

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

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

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

// WithMaxresults adds the maxresults to the file list from task params
func (o *FileListFromTaskParams) WithMaxresults(maxresults *int32) *FileListFromTaskParams {
    o.SetMaxresults(maxresults)
    return o
}

// SetMaxresults adds the maxresults to the file list from task params
func (o *FileListFromTaskParams) SetMaxresults(maxresults *int32) {
    o.Maxresults = maxresults
}

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

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

// WithRecursive adds the recursive to the file list from task params
func (o *FileListFromTaskParams) WithRecursive(recursive *bool) *FileListFromTaskParams {
    o.SetRecursive(recursive)
    return o
}

// SetRecursive adds the recursive to the file list from task params
func (o *FileListFromTaskParams) SetRecursive(recursive *bool) {
    o.Recursive = recursive
}

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

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

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

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

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

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

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

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

    if o.DollarFilter != nil {

        // query param $filter
        var qrNrDollarFilter string
        if o.DollarFilter != nil {
            qrNrDollarFilter = *o.DollarFilter
        }
        qNrDollarFilter := qrNrDollarFilter
        if qNrDollarFilter != "" {
            if err := r.SetQueryParam("$filter", qNrDollarFilter); 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 jobId
    if err := r.SetPathParam("jobId", o.JobID); err != nil {
        return err
    }

    if o.Maxresults != nil {

        // query param maxresults
        var qrMaxresults int32
        if o.Maxresults != nil {
            qrMaxresults = *o.Maxresults
        }
        qMaxresults := swag.FormatInt32(qrMaxresults)
        if qMaxresults != "" {
            if err := r.SetQueryParam("maxresults", qMaxresults); 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.Recursive != nil {

        // query param recursive
        var qrRecursive bool
        if o.Recursive != nil {
            qrRecursive = *o.Recursive
        }
        qRecursive := swag.FormatBool(qrRecursive)
        if qRecursive != "" {
            if err := r.SetQueryParam("recursive", qRecursive); 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
}