github.com/sap/cf-mta-plugin@v2.6.3+incompatible/clients/mtaclient/operations/get_mta_operations_parameters.go (about)

     1  // Code generated by go-swagger; DO NOT EDIT.
     2  
     3  package operations
     4  
     5  // This file was generated by the swagger tool.
     6  // Editing this file might prove futile when you re-run the swagger generate command
     7  
     8  import (
     9  	"net/http"
    10  	"time"
    11  
    12  	"golang.org/x/net/context"
    13  
    14  	"github.com/go-openapi/errors"
    15  	"github.com/go-openapi/runtime"
    16  	cr "github.com/go-openapi/runtime/client"
    17  	"github.com/go-openapi/swag"
    18  
    19  	strfmt "github.com/go-openapi/strfmt"
    20  )
    21  
    22  // NewGetMtaOperationsParams creates a new GetMtaOperationsParams object
    23  // with the default values initialized.
    24  func NewGetMtaOperationsParams() *GetMtaOperationsParams {
    25  	var ()
    26  	return &GetMtaOperationsParams{
    27  
    28  		timeout: cr.DefaultTimeout,
    29  	}
    30  }
    31  
    32  // NewGetMtaOperationsParamsWithTimeout creates a new GetMtaOperationsParams object
    33  // with the default values initialized, and the ability to set a timeout on a request
    34  func NewGetMtaOperationsParamsWithTimeout(timeout time.Duration) *GetMtaOperationsParams {
    35  	var ()
    36  	return &GetMtaOperationsParams{
    37  
    38  		timeout: timeout,
    39  	}
    40  }
    41  
    42  // NewGetMtaOperationsParamsWithContext creates a new GetMtaOperationsParams object
    43  // with the default values initialized, and the ability to set a context for a request
    44  func NewGetMtaOperationsParamsWithContext(ctx context.Context) *GetMtaOperationsParams {
    45  	var ()
    46  	return &GetMtaOperationsParams{
    47  
    48  		Context: ctx,
    49  	}
    50  }
    51  
    52  // NewGetMtaOperationsParamsWithHTTPClient creates a new GetMtaOperationsParams object
    53  // with the default values initialized, and the ability to set a custom HTTPClient for a request
    54  func NewGetMtaOperationsParamsWithHTTPClient(client *http.Client) *GetMtaOperationsParams {
    55  	var ()
    56  	return &GetMtaOperationsParams{
    57  		HTTPClient: client,
    58  	}
    59  }
    60  
    61  /*GetMtaOperationsParams contains all the parameters to send to the API endpoint
    62  for the get mta operations operation typically these are written to a http.Request
    63  */
    64  type GetMtaOperationsParams struct {
    65  
    66  	/*Last*/
    67  	Last *int64
    68  	/*MtaID*/
    69  	MtaID *string
    70  	/*State*/
    71  	State []string
    72  
    73  	timeout    time.Duration
    74  	Context    context.Context
    75  	HTTPClient *http.Client
    76  }
    77  
    78  // WithTimeout adds the timeout to the get mta operations params
    79  func (o *GetMtaOperationsParams) WithTimeout(timeout time.Duration) *GetMtaOperationsParams {
    80  	o.SetTimeout(timeout)
    81  	return o
    82  }
    83  
    84  // SetTimeout adds the timeout to the get mta operations params
    85  func (o *GetMtaOperationsParams) SetTimeout(timeout time.Duration) {
    86  	o.timeout = timeout
    87  }
    88  
    89  // WithContext adds the context to the get mta operations params
    90  func (o *GetMtaOperationsParams) WithContext(ctx context.Context) *GetMtaOperationsParams {
    91  	o.SetContext(ctx)
    92  	return o
    93  }
    94  
    95  // SetContext adds the context to the get mta operations params
    96  func (o *GetMtaOperationsParams) SetContext(ctx context.Context) {
    97  	o.Context = ctx
    98  }
    99  
   100  // WithHTTPClient adds the HTTPClient to the get mta operations params
   101  func (o *GetMtaOperationsParams) WithHTTPClient(client *http.Client) *GetMtaOperationsParams {
   102  	o.SetHTTPClient(client)
   103  	return o
   104  }
   105  
   106  // SetHTTPClient adds the HTTPClient to the get mta operations params
   107  func (o *GetMtaOperationsParams) SetHTTPClient(client *http.Client) {
   108  	o.HTTPClient = client
   109  }
   110  
   111  // WithLast adds the last to the get mta operations params
   112  func (o *GetMtaOperationsParams) WithLast(last *int64) *GetMtaOperationsParams {
   113  	o.SetLast(last)
   114  	return o
   115  }
   116  
   117  // SetLast adds the last to the get mta operations params
   118  func (o *GetMtaOperationsParams) SetLast(last *int64) {
   119  	o.Last = last
   120  }
   121  
   122  // WithMtaID adds the mtaID to the get operations params
   123  func (o *GetMtaOperationsParams) WithMtaID(mtaID *string) *GetMtaOperationsParams {
   124  	o.SetMtaID(mtaID)
   125  	return o
   126  }
   127  
   128  // SetMtaID adds the mtaId to the get operations params
   129  func (o *GetMtaOperationsParams) SetMtaID(mtaID *string) {
   130  	o.MtaID = mtaID
   131  }
   132  
   133  // WithState adds the state to the get mta operations params
   134  func (o *GetMtaOperationsParams) WithState(state []string) *GetMtaOperationsParams {
   135  	o.SetState(state)
   136  	return o
   137  }
   138  
   139  // SetState adds the state to the get mta operations params
   140  func (o *GetMtaOperationsParams) SetState(state []string) {
   141  	o.State = state
   142  }
   143  
   144  // WriteToRequest writes these params to a swagger request
   145  func (o *GetMtaOperationsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
   146  
   147  	if err := r.SetTimeout(o.timeout); err != nil {
   148  		return err
   149  	}
   150  	var res []error
   151  
   152  	if o.Last != nil {
   153  
   154  		// query param last
   155  		var qrLast int64
   156  		if o.Last != nil {
   157  			qrLast = *o.Last
   158  		}
   159  		qLast := swag.FormatInt64(qrLast)
   160  		if qLast != "" {
   161  			if err := r.SetQueryParam("last", qLast); err != nil {
   162  				return err
   163  			}
   164  		}
   165  
   166  	}
   167  
   168  	if o.MtaID != nil {
   169  
   170  		// query param mtaId
   171  		var qrMtaID string
   172  		if o.MtaID != nil {
   173  			qrMtaID = *o.MtaID
   174  		}
   175  		qMtaID := qrMtaID
   176  		if qMtaID != "" {
   177  			if err := r.SetQueryParam("mtaId", qMtaID); err != nil {
   178  				return err
   179  			}
   180  		}
   181  
   182  	}
   183  
   184  	valuesState := o.State
   185  
   186  	joinedState := swag.JoinByFormat(valuesState, "multi")
   187  	// query array param state
   188  	if err := r.SetQueryParam("state", joinedState...); err != nil {
   189  		return err
   190  	}
   191  
   192  	if len(res) > 0 {
   193  		return errors.CompositeValidationError(res...)
   194  	}
   195  	return nil
   196  }