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

     1  // Code generated by go-swagger; DO NOT EDIT.
     2  
     3  package preheat
     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  // NewManualPreheatParams creates a new ManualPreheatParams 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 NewManualPreheatParams() *ManualPreheatParams {
    28  	return &ManualPreheatParams{
    29  		timeout: cr.DefaultTimeout,
    30  	}
    31  }
    32  
    33  // NewManualPreheatParamsWithTimeout creates a new ManualPreheatParams object
    34  // with the ability to set a timeout on a request.
    35  func NewManualPreheatParamsWithTimeout(timeout time.Duration) *ManualPreheatParams {
    36  	return &ManualPreheatParams{
    37  		timeout: timeout,
    38  	}
    39  }
    40  
    41  // NewManualPreheatParamsWithContext creates a new ManualPreheatParams object
    42  // with the ability to set a context for a request.
    43  func NewManualPreheatParamsWithContext(ctx context.Context) *ManualPreheatParams {
    44  	return &ManualPreheatParams{
    45  		Context: ctx,
    46  	}
    47  }
    48  
    49  // NewManualPreheatParamsWithHTTPClient creates a new ManualPreheatParams object
    50  // with the ability to set a custom HTTPClient for a request.
    51  func NewManualPreheatParamsWithHTTPClient(client *http.Client) *ManualPreheatParams {
    52  	return &ManualPreheatParams{
    53  		HTTPClient: client,
    54  	}
    55  }
    56  
    57  /*
    58  ManualPreheatParams contains all the parameters to send to the API endpoint
    59  
    60  	for the manual preheat operation.
    61  
    62  	Typically these are written to a http.Request.
    63  */
    64  type ManualPreheatParams struct {
    65  
    66  	/* XRequestID.
    67  
    68  	   An unique ID for the request
    69  	*/
    70  	XRequestID *string
    71  
    72  	/* Policy.
    73  
    74  	   The policy schema info
    75  	*/
    76  	Policy *models.PreheatPolicy
    77  
    78  	/* PreheatPolicyName.
    79  
    80  	   Preheat Policy Name
    81  	*/
    82  	PreheatPolicyName string
    83  
    84  	/* ProjectName.
    85  
    86  	   The name of the project
    87  	*/
    88  	ProjectName string
    89  
    90  	timeout    time.Duration
    91  	Context    context.Context
    92  	HTTPClient *http.Client
    93  }
    94  
    95  // WithDefaults hydrates default values in the manual preheat params (not the query body).
    96  //
    97  // All values with no default are reset to their zero value.
    98  func (o *ManualPreheatParams) WithDefaults() *ManualPreheatParams {
    99  	o.SetDefaults()
   100  	return o
   101  }
   102  
   103  // SetDefaults hydrates default values in the manual preheat params (not the query body).
   104  //
   105  // All values with no default are reset to their zero value.
   106  func (o *ManualPreheatParams) SetDefaults() {
   107  	// no default values defined for this parameter
   108  }
   109  
   110  // WithTimeout adds the timeout to the manual preheat params
   111  func (o *ManualPreheatParams) WithTimeout(timeout time.Duration) *ManualPreheatParams {
   112  	o.SetTimeout(timeout)
   113  	return o
   114  }
   115  
   116  // SetTimeout adds the timeout to the manual preheat params
   117  func (o *ManualPreheatParams) SetTimeout(timeout time.Duration) {
   118  	o.timeout = timeout
   119  }
   120  
   121  // WithContext adds the context to the manual preheat params
   122  func (o *ManualPreheatParams) WithContext(ctx context.Context) *ManualPreheatParams {
   123  	o.SetContext(ctx)
   124  	return o
   125  }
   126  
   127  // SetContext adds the context to the manual preheat params
   128  func (o *ManualPreheatParams) SetContext(ctx context.Context) {
   129  	o.Context = ctx
   130  }
   131  
   132  // WithHTTPClient adds the HTTPClient to the manual preheat params
   133  func (o *ManualPreheatParams) WithHTTPClient(client *http.Client) *ManualPreheatParams {
   134  	o.SetHTTPClient(client)
   135  	return o
   136  }
   137  
   138  // SetHTTPClient adds the HTTPClient to the manual preheat params
   139  func (o *ManualPreheatParams) SetHTTPClient(client *http.Client) {
   140  	o.HTTPClient = client
   141  }
   142  
   143  // WithXRequestID adds the xRequestID to the manual preheat params
   144  func (o *ManualPreheatParams) WithXRequestID(xRequestID *string) *ManualPreheatParams {
   145  	o.SetXRequestID(xRequestID)
   146  	return o
   147  }
   148  
   149  // SetXRequestID adds the xRequestId to the manual preheat params
   150  func (o *ManualPreheatParams) SetXRequestID(xRequestID *string) {
   151  	o.XRequestID = xRequestID
   152  }
   153  
   154  // WithPolicy adds the policy to the manual preheat params
   155  func (o *ManualPreheatParams) WithPolicy(policy *models.PreheatPolicy) *ManualPreheatParams {
   156  	o.SetPolicy(policy)
   157  	return o
   158  }
   159  
   160  // SetPolicy adds the policy to the manual preheat params
   161  func (o *ManualPreheatParams) SetPolicy(policy *models.PreheatPolicy) {
   162  	o.Policy = policy
   163  }
   164  
   165  // WithPreheatPolicyName adds the preheatPolicyName to the manual preheat params
   166  func (o *ManualPreheatParams) WithPreheatPolicyName(preheatPolicyName string) *ManualPreheatParams {
   167  	o.SetPreheatPolicyName(preheatPolicyName)
   168  	return o
   169  }
   170  
   171  // SetPreheatPolicyName adds the preheatPolicyName to the manual preheat params
   172  func (o *ManualPreheatParams) SetPreheatPolicyName(preheatPolicyName string) {
   173  	o.PreheatPolicyName = preheatPolicyName
   174  }
   175  
   176  // WithProjectName adds the projectName to the manual preheat params
   177  func (o *ManualPreheatParams) WithProjectName(projectName string) *ManualPreheatParams {
   178  	o.SetProjectName(projectName)
   179  	return o
   180  }
   181  
   182  // SetProjectName adds the projectName to the manual preheat params
   183  func (o *ManualPreheatParams) SetProjectName(projectName string) {
   184  	o.ProjectName = projectName
   185  }
   186  
   187  // WriteToRequest writes these params to a swagger request
   188  func (o *ManualPreheatParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
   189  
   190  	if err := r.SetTimeout(o.timeout); err != nil {
   191  		return err
   192  	}
   193  	var res []error
   194  
   195  	if o.XRequestID != nil {
   196  
   197  		// header param X-Request-Id
   198  		if err := r.SetHeaderParam("X-Request-Id", *o.XRequestID); err != nil {
   199  			return err
   200  		}
   201  	}
   202  	if o.Policy != nil {
   203  		if err := r.SetBodyParam(o.Policy); err != nil {
   204  			return err
   205  		}
   206  	}
   207  
   208  	// path param preheat_policy_name
   209  	if err := r.SetPathParam("preheat_policy_name", o.PreheatPolicyName); err != nil {
   210  		return err
   211  	}
   212  
   213  	// path param project_name
   214  	if err := r.SetPathParam("project_name", o.ProjectName); err != nil {
   215  		return err
   216  	}
   217  
   218  	if len(res) > 0 {
   219  		return errors.CompositeValidationError(res...)
   220  	}
   221  	return nil
   222  }