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

     1  // Code generated by go-swagger; DO NOT EDIT.
     2  
     3  package project
     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  	"github.com/go-openapi/swag"
    18  )
    19  
    20  // NewGetProjectParams creates a new GetProjectParams object,
    21  // with the default timeout for this client.
    22  //
    23  // Default values are not hydrated, since defaults are normally applied by the API server side.
    24  //
    25  // To enforce default values in parameter, use SetDefaults or WithDefaults.
    26  func NewGetProjectParams() *GetProjectParams {
    27  	return &GetProjectParams{
    28  		timeout: cr.DefaultTimeout,
    29  	}
    30  }
    31  
    32  // NewGetProjectParamsWithTimeout creates a new GetProjectParams object
    33  // with the ability to set a timeout on a request.
    34  func NewGetProjectParamsWithTimeout(timeout time.Duration) *GetProjectParams {
    35  	return &GetProjectParams{
    36  		timeout: timeout,
    37  	}
    38  }
    39  
    40  // NewGetProjectParamsWithContext creates a new GetProjectParams object
    41  // with the ability to set a context for a request.
    42  func NewGetProjectParamsWithContext(ctx context.Context) *GetProjectParams {
    43  	return &GetProjectParams{
    44  		Context: ctx,
    45  	}
    46  }
    47  
    48  // NewGetProjectParamsWithHTTPClient creates a new GetProjectParams object
    49  // with the ability to set a custom HTTPClient for a request.
    50  func NewGetProjectParamsWithHTTPClient(client *http.Client) *GetProjectParams {
    51  	return &GetProjectParams{
    52  		HTTPClient: client,
    53  	}
    54  }
    55  
    56  /*
    57  GetProjectParams contains all the parameters to send to the API endpoint
    58  
    59  	for the get project operation.
    60  
    61  	Typically these are written to a http.Request.
    62  */
    63  type GetProjectParams struct {
    64  
    65  	/* XIsResourceName.
    66  
    67  	   The flag to indicate whether the parameter which supports both name and id in the path is the name of the resource. When the X-Is-Resource-Name is false and the parameter can be converted to an integer, the parameter will be as an id, otherwise, it will be as a name.
    68  	*/
    69  	XIsResourceName *bool
    70  
    71  	/* XRequestID.
    72  
    73  	   An unique ID for the request
    74  	*/
    75  	XRequestID *string
    76  
    77  	/* ProjectNameOrID.
    78  
    79  	   The name or id of the project
    80  	*/
    81  	ProjectNameOrID string
    82  
    83  	timeout    time.Duration
    84  	Context    context.Context
    85  	HTTPClient *http.Client
    86  }
    87  
    88  // WithDefaults hydrates default values in the get project params (not the query body).
    89  //
    90  // All values with no default are reset to their zero value.
    91  func (o *GetProjectParams) WithDefaults() *GetProjectParams {
    92  	o.SetDefaults()
    93  	return o
    94  }
    95  
    96  // SetDefaults hydrates default values in the get project params (not the query body).
    97  //
    98  // All values with no default are reset to their zero value.
    99  func (o *GetProjectParams) SetDefaults() {
   100  	var (
   101  		xIsResourceNameDefault = bool(false)
   102  	)
   103  
   104  	val := GetProjectParams{
   105  		XIsResourceName: &xIsResourceNameDefault,
   106  	}
   107  
   108  	val.timeout = o.timeout
   109  	val.Context = o.Context
   110  	val.HTTPClient = o.HTTPClient
   111  	*o = val
   112  }
   113  
   114  // WithTimeout adds the timeout to the get project params
   115  func (o *GetProjectParams) WithTimeout(timeout time.Duration) *GetProjectParams {
   116  	o.SetTimeout(timeout)
   117  	return o
   118  }
   119  
   120  // SetTimeout adds the timeout to the get project params
   121  func (o *GetProjectParams) SetTimeout(timeout time.Duration) {
   122  	o.timeout = timeout
   123  }
   124  
   125  // WithContext adds the context to the get project params
   126  func (o *GetProjectParams) WithContext(ctx context.Context) *GetProjectParams {
   127  	o.SetContext(ctx)
   128  	return o
   129  }
   130  
   131  // SetContext adds the context to the get project params
   132  func (o *GetProjectParams) SetContext(ctx context.Context) {
   133  	o.Context = ctx
   134  }
   135  
   136  // WithHTTPClient adds the HTTPClient to the get project params
   137  func (o *GetProjectParams) WithHTTPClient(client *http.Client) *GetProjectParams {
   138  	o.SetHTTPClient(client)
   139  	return o
   140  }
   141  
   142  // SetHTTPClient adds the HTTPClient to the get project params
   143  func (o *GetProjectParams) SetHTTPClient(client *http.Client) {
   144  	o.HTTPClient = client
   145  }
   146  
   147  // WithXIsResourceName adds the xIsResourceName to the get project params
   148  func (o *GetProjectParams) WithXIsResourceName(xIsResourceName *bool) *GetProjectParams {
   149  	o.SetXIsResourceName(xIsResourceName)
   150  	return o
   151  }
   152  
   153  // SetXIsResourceName adds the xIsResourceName to the get project params
   154  func (o *GetProjectParams) SetXIsResourceName(xIsResourceName *bool) {
   155  	o.XIsResourceName = xIsResourceName
   156  }
   157  
   158  // WithXRequestID adds the xRequestID to the get project params
   159  func (o *GetProjectParams) WithXRequestID(xRequestID *string) *GetProjectParams {
   160  	o.SetXRequestID(xRequestID)
   161  	return o
   162  }
   163  
   164  // SetXRequestID adds the xRequestId to the get project params
   165  func (o *GetProjectParams) SetXRequestID(xRequestID *string) {
   166  	o.XRequestID = xRequestID
   167  }
   168  
   169  // WithProjectNameOrID adds the projectNameOrID to the get project params
   170  func (o *GetProjectParams) WithProjectNameOrID(projectNameOrID string) *GetProjectParams {
   171  	o.SetProjectNameOrID(projectNameOrID)
   172  	return o
   173  }
   174  
   175  // SetProjectNameOrID adds the projectNameOrId to the get project params
   176  func (o *GetProjectParams) SetProjectNameOrID(projectNameOrID string) {
   177  	o.ProjectNameOrID = projectNameOrID
   178  }
   179  
   180  // WriteToRequest writes these params to a swagger request
   181  func (o *GetProjectParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
   182  
   183  	if err := r.SetTimeout(o.timeout); err != nil {
   184  		return err
   185  	}
   186  	var res []error
   187  
   188  	if o.XIsResourceName != nil {
   189  
   190  		// header param X-Is-Resource-Name
   191  		if err := r.SetHeaderParam("X-Is-Resource-Name", swag.FormatBool(*o.XIsResourceName)); err != nil {
   192  			return err
   193  		}
   194  	}
   195  
   196  	if o.XRequestID != nil {
   197  
   198  		// header param X-Request-Id
   199  		if err := r.SetHeaderParam("X-Request-Id", *o.XRequestID); err != nil {
   200  			return err
   201  		}
   202  	}
   203  
   204  	// path param project_name_or_id
   205  	if err := r.SetPathParam("project_name_or_id", o.ProjectNameOrID); err != nil {
   206  		return err
   207  	}
   208  
   209  	if len(res) > 0 {
   210  		return errors.CompositeValidationError(res...)
   211  	}
   212  	return nil
   213  }