github.com/goharbor/go-client@v0.210.0/pkg/sdk/v2.0/client/jobservice/action_pending_jobs_parameters.go (about)

     1  // Code generated by go-swagger; DO NOT EDIT.
     2  
     3  package jobservice
     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  	"context"
    10  	"net/http"
    11  	"time"
    12  
    13  	"github.com/go-openapi/errors"
    14  	"github.com/go-openapi/runtime"
    15  	cr "github.com/go-openapi/runtime/client"
    16  	"github.com/go-openapi/strfmt"
    17  
    18  	"github.com/goharbor/go-client/pkg/sdk/v2.0/models"
    19  )
    20  
    21  // NewActionPendingJobsParams creates a new ActionPendingJobsParams object,
    22  // with the default timeout for this client.
    23  //
    24  // Default values are not hydrated, since defaults are normally applied by the API server side.
    25  //
    26  // To enforce default values in parameter, use SetDefaults or WithDefaults.
    27  func NewActionPendingJobsParams() *ActionPendingJobsParams {
    28  	return &ActionPendingJobsParams{
    29  		timeout: cr.DefaultTimeout,
    30  	}
    31  }
    32  
    33  // NewActionPendingJobsParamsWithTimeout creates a new ActionPendingJobsParams object
    34  // with the ability to set a timeout on a request.
    35  func NewActionPendingJobsParamsWithTimeout(timeout time.Duration) *ActionPendingJobsParams {
    36  	return &ActionPendingJobsParams{
    37  		timeout: timeout,
    38  	}
    39  }
    40  
    41  // NewActionPendingJobsParamsWithContext creates a new ActionPendingJobsParams object
    42  // with the ability to set a context for a request.
    43  func NewActionPendingJobsParamsWithContext(ctx context.Context) *ActionPendingJobsParams {
    44  	return &ActionPendingJobsParams{
    45  		Context: ctx,
    46  	}
    47  }
    48  
    49  // NewActionPendingJobsParamsWithHTTPClient creates a new ActionPendingJobsParams object
    50  // with the ability to set a custom HTTPClient for a request.
    51  func NewActionPendingJobsParamsWithHTTPClient(client *http.Client) *ActionPendingJobsParams {
    52  	return &ActionPendingJobsParams{
    53  		HTTPClient: client,
    54  	}
    55  }
    56  
    57  /*
    58  ActionPendingJobsParams contains all the parameters to send to the API endpoint
    59  
    60  	for the action pending jobs operation.
    61  
    62  	Typically these are written to a http.Request.
    63  */
    64  type ActionPendingJobsParams struct {
    65  
    66  	/* XRequestID.
    67  
    68  	   An unique ID for the request
    69  	*/
    70  	XRequestID *string
    71  
    72  	// ActionRequest.
    73  	ActionRequest *models.ActionRequest
    74  
    75  	/* JobType.
    76  
    77  	   The type of the job. 'all' stands for all job types
    78  	*/
    79  	JobType string
    80  
    81  	timeout    time.Duration
    82  	Context    context.Context
    83  	HTTPClient *http.Client
    84  }
    85  
    86  // WithDefaults hydrates default values in the action pending jobs params (not the query body).
    87  //
    88  // All values with no default are reset to their zero value.
    89  func (o *ActionPendingJobsParams) WithDefaults() *ActionPendingJobsParams {
    90  	o.SetDefaults()
    91  	return o
    92  }
    93  
    94  // SetDefaults hydrates default values in the action pending jobs params (not the query body).
    95  //
    96  // All values with no default are reset to their zero value.
    97  func (o *ActionPendingJobsParams) SetDefaults() {
    98  	// no default values defined for this parameter
    99  }
   100  
   101  // WithTimeout adds the timeout to the action pending jobs params
   102  func (o *ActionPendingJobsParams) WithTimeout(timeout time.Duration) *ActionPendingJobsParams {
   103  	o.SetTimeout(timeout)
   104  	return o
   105  }
   106  
   107  // SetTimeout adds the timeout to the action pending jobs params
   108  func (o *ActionPendingJobsParams) SetTimeout(timeout time.Duration) {
   109  	o.timeout = timeout
   110  }
   111  
   112  // WithContext adds the context to the action pending jobs params
   113  func (o *ActionPendingJobsParams) WithContext(ctx context.Context) *ActionPendingJobsParams {
   114  	o.SetContext(ctx)
   115  	return o
   116  }
   117  
   118  // SetContext adds the context to the action pending jobs params
   119  func (o *ActionPendingJobsParams) SetContext(ctx context.Context) {
   120  	o.Context = ctx
   121  }
   122  
   123  // WithHTTPClient adds the HTTPClient to the action pending jobs params
   124  func (o *ActionPendingJobsParams) WithHTTPClient(client *http.Client) *ActionPendingJobsParams {
   125  	o.SetHTTPClient(client)
   126  	return o
   127  }
   128  
   129  // SetHTTPClient adds the HTTPClient to the action pending jobs params
   130  func (o *ActionPendingJobsParams) SetHTTPClient(client *http.Client) {
   131  	o.HTTPClient = client
   132  }
   133  
   134  // WithXRequestID adds the xRequestID to the action pending jobs params
   135  func (o *ActionPendingJobsParams) WithXRequestID(xRequestID *string) *ActionPendingJobsParams {
   136  	o.SetXRequestID(xRequestID)
   137  	return o
   138  }
   139  
   140  // SetXRequestID adds the xRequestId to the action pending jobs params
   141  func (o *ActionPendingJobsParams) SetXRequestID(xRequestID *string) {
   142  	o.XRequestID = xRequestID
   143  }
   144  
   145  // WithActionRequest adds the actionRequest to the action pending jobs params
   146  func (o *ActionPendingJobsParams) WithActionRequest(actionRequest *models.ActionRequest) *ActionPendingJobsParams {
   147  	o.SetActionRequest(actionRequest)
   148  	return o
   149  }
   150  
   151  // SetActionRequest adds the actionRequest to the action pending jobs params
   152  func (o *ActionPendingJobsParams) SetActionRequest(actionRequest *models.ActionRequest) {
   153  	o.ActionRequest = actionRequest
   154  }
   155  
   156  // WithJobType adds the jobType to the action pending jobs params
   157  func (o *ActionPendingJobsParams) WithJobType(jobType string) *ActionPendingJobsParams {
   158  	o.SetJobType(jobType)
   159  	return o
   160  }
   161  
   162  // SetJobType adds the jobType to the action pending jobs params
   163  func (o *ActionPendingJobsParams) SetJobType(jobType string) {
   164  	o.JobType = jobType
   165  }
   166  
   167  // WriteToRequest writes these params to a swagger request
   168  func (o *ActionPendingJobsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
   169  
   170  	if err := r.SetTimeout(o.timeout); err != nil {
   171  		return err
   172  	}
   173  	var res []error
   174  
   175  	if o.XRequestID != nil {
   176  
   177  		// header param X-Request-Id
   178  		if err := r.SetHeaderParam("X-Request-Id", *o.XRequestID); err != nil {
   179  			return err
   180  		}
   181  	}
   182  	if o.ActionRequest != nil {
   183  		if err := r.SetBodyParam(o.ActionRequest); err != nil {
   184  			return err
   185  		}
   186  	}
   187  
   188  	// path param job_type
   189  	if err := r.SetPathParam("job_type", o.JobType); err != nil {
   190  		return err
   191  	}
   192  
   193  	if len(res) > 0 {
   194  		return errors.CompositeValidationError(res...)
   195  	}
   196  	return nil
   197  }