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