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