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

     1  // Code generated by go-swagger; DO NOT EDIT.
     2  
     3  package project_metadata
     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  // NewUpdateProjectMetadataParams creates a new UpdateProjectMetadataParams 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 NewUpdateProjectMetadataParams() *UpdateProjectMetadataParams {
    27  	return &UpdateProjectMetadataParams{
    28  		timeout: cr.DefaultTimeout,
    29  	}
    30  }
    31  
    32  // NewUpdateProjectMetadataParamsWithTimeout creates a new UpdateProjectMetadataParams object
    33  // with the ability to set a timeout on a request.
    34  func NewUpdateProjectMetadataParamsWithTimeout(timeout time.Duration) *UpdateProjectMetadataParams {
    35  	return &UpdateProjectMetadataParams{
    36  		timeout: timeout,
    37  	}
    38  }
    39  
    40  // NewUpdateProjectMetadataParamsWithContext creates a new UpdateProjectMetadataParams object
    41  // with the ability to set a context for a request.
    42  func NewUpdateProjectMetadataParamsWithContext(ctx context.Context) *UpdateProjectMetadataParams {
    43  	return &UpdateProjectMetadataParams{
    44  		Context: ctx,
    45  	}
    46  }
    47  
    48  // NewUpdateProjectMetadataParamsWithHTTPClient creates a new UpdateProjectMetadataParams object
    49  // with the ability to set a custom HTTPClient for a request.
    50  func NewUpdateProjectMetadataParamsWithHTTPClient(client *http.Client) *UpdateProjectMetadataParams {
    51  	return &UpdateProjectMetadataParams{
    52  		HTTPClient: client,
    53  	}
    54  }
    55  
    56  /*
    57  UpdateProjectMetadataParams contains all the parameters to send to the API endpoint
    58  
    59  	for the update project metadata operation.
    60  
    61  	Typically these are written to a http.Request.
    62  */
    63  type UpdateProjectMetadataParams 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  	/* MetaName.
    78  
    79  	   The name of metadata.
    80  	*/
    81  	MetaName string
    82  
    83  	// Metadata.
    84  	Metadata map[string]string
    85  
    86  	/* ProjectNameOrID.
    87  
    88  	   The name or id of the project
    89  	*/
    90  	ProjectNameOrID string
    91  
    92  	timeout    time.Duration
    93  	Context    context.Context
    94  	HTTPClient *http.Client
    95  }
    96  
    97  // WithDefaults hydrates default values in the update project metadata params (not the query body).
    98  //
    99  // All values with no default are reset to their zero value.
   100  func (o *UpdateProjectMetadataParams) WithDefaults() *UpdateProjectMetadataParams {
   101  	o.SetDefaults()
   102  	return o
   103  }
   104  
   105  // SetDefaults hydrates default values in the update project metadata params (not the query body).
   106  //
   107  // All values with no default are reset to their zero value.
   108  func (o *UpdateProjectMetadataParams) SetDefaults() {
   109  	var (
   110  		xIsResourceNameDefault = bool(false)
   111  	)
   112  
   113  	val := UpdateProjectMetadataParams{
   114  		XIsResourceName: &xIsResourceNameDefault,
   115  	}
   116  
   117  	val.timeout = o.timeout
   118  	val.Context = o.Context
   119  	val.HTTPClient = o.HTTPClient
   120  	*o = val
   121  }
   122  
   123  // WithTimeout adds the timeout to the update project metadata params
   124  func (o *UpdateProjectMetadataParams) WithTimeout(timeout time.Duration) *UpdateProjectMetadataParams {
   125  	o.SetTimeout(timeout)
   126  	return o
   127  }
   128  
   129  // SetTimeout adds the timeout to the update project metadata params
   130  func (o *UpdateProjectMetadataParams) SetTimeout(timeout time.Duration) {
   131  	o.timeout = timeout
   132  }
   133  
   134  // WithContext adds the context to the update project metadata params
   135  func (o *UpdateProjectMetadataParams) WithContext(ctx context.Context) *UpdateProjectMetadataParams {
   136  	o.SetContext(ctx)
   137  	return o
   138  }
   139  
   140  // SetContext adds the context to the update project metadata params
   141  func (o *UpdateProjectMetadataParams) SetContext(ctx context.Context) {
   142  	o.Context = ctx
   143  }
   144  
   145  // WithHTTPClient adds the HTTPClient to the update project metadata params
   146  func (o *UpdateProjectMetadataParams) WithHTTPClient(client *http.Client) *UpdateProjectMetadataParams {
   147  	o.SetHTTPClient(client)
   148  	return o
   149  }
   150  
   151  // SetHTTPClient adds the HTTPClient to the update project metadata params
   152  func (o *UpdateProjectMetadataParams) SetHTTPClient(client *http.Client) {
   153  	o.HTTPClient = client
   154  }
   155  
   156  // WithXIsResourceName adds the xIsResourceName to the update project metadata params
   157  func (o *UpdateProjectMetadataParams) WithXIsResourceName(xIsResourceName *bool) *UpdateProjectMetadataParams {
   158  	o.SetXIsResourceName(xIsResourceName)
   159  	return o
   160  }
   161  
   162  // SetXIsResourceName adds the xIsResourceName to the update project metadata params
   163  func (o *UpdateProjectMetadataParams) SetXIsResourceName(xIsResourceName *bool) {
   164  	o.XIsResourceName = xIsResourceName
   165  }
   166  
   167  // WithXRequestID adds the xRequestID to the update project metadata params
   168  func (o *UpdateProjectMetadataParams) WithXRequestID(xRequestID *string) *UpdateProjectMetadataParams {
   169  	o.SetXRequestID(xRequestID)
   170  	return o
   171  }
   172  
   173  // SetXRequestID adds the xRequestId to the update project metadata params
   174  func (o *UpdateProjectMetadataParams) SetXRequestID(xRequestID *string) {
   175  	o.XRequestID = xRequestID
   176  }
   177  
   178  // WithMetaName adds the metaName to the update project metadata params
   179  func (o *UpdateProjectMetadataParams) WithMetaName(metaName string) *UpdateProjectMetadataParams {
   180  	o.SetMetaName(metaName)
   181  	return o
   182  }
   183  
   184  // SetMetaName adds the metaName to the update project metadata params
   185  func (o *UpdateProjectMetadataParams) SetMetaName(metaName string) {
   186  	o.MetaName = metaName
   187  }
   188  
   189  // WithMetadata adds the metadata to the update project metadata params
   190  func (o *UpdateProjectMetadataParams) WithMetadata(metadata map[string]string) *UpdateProjectMetadataParams {
   191  	o.SetMetadata(metadata)
   192  	return o
   193  }
   194  
   195  // SetMetadata adds the metadata to the update project metadata params
   196  func (o *UpdateProjectMetadataParams) SetMetadata(metadata map[string]string) {
   197  	o.Metadata = metadata
   198  }
   199  
   200  // WithProjectNameOrID adds the projectNameOrID to the update project metadata params
   201  func (o *UpdateProjectMetadataParams) WithProjectNameOrID(projectNameOrID string) *UpdateProjectMetadataParams {
   202  	o.SetProjectNameOrID(projectNameOrID)
   203  	return o
   204  }
   205  
   206  // SetProjectNameOrID adds the projectNameOrId to the update project metadata params
   207  func (o *UpdateProjectMetadataParams) SetProjectNameOrID(projectNameOrID string) {
   208  	o.ProjectNameOrID = projectNameOrID
   209  }
   210  
   211  // WriteToRequest writes these params to a swagger request
   212  func (o *UpdateProjectMetadataParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
   213  
   214  	if err := r.SetTimeout(o.timeout); err != nil {
   215  		return err
   216  	}
   217  	var res []error
   218  
   219  	if o.XIsResourceName != nil {
   220  
   221  		// header param X-Is-Resource-Name
   222  		if err := r.SetHeaderParam("X-Is-Resource-Name", swag.FormatBool(*o.XIsResourceName)); err != nil {
   223  			return err
   224  		}
   225  	}
   226  
   227  	if o.XRequestID != nil {
   228  
   229  		// header param X-Request-Id
   230  		if err := r.SetHeaderParam("X-Request-Id", *o.XRequestID); err != nil {
   231  			return err
   232  		}
   233  	}
   234  
   235  	// path param meta_name
   236  	if err := r.SetPathParam("meta_name", o.MetaName); err != nil {
   237  		return err
   238  	}
   239  	if o.Metadata != nil {
   240  		if err := r.SetBodyParam(o.Metadata); err != nil {
   241  			return err
   242  		}
   243  	}
   244  
   245  	// path param project_name_or_id
   246  	if err := r.SetPathParam("project_name_or_id", o.ProjectNameOrID); err != nil {
   247  		return err
   248  	}
   249  
   250  	if len(res) > 0 {
   251  		return errors.CompositeValidationError(res...)
   252  	}
   253  	return nil
   254  }