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