github.com/goharbor/go-client@v0.210.0/pkg/sdk/v2.0/client/project/delete_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 // NewDeleteProjectParams creates a new DeleteProjectParams 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 NewDeleteProjectParams() *DeleteProjectParams { 27 return &DeleteProjectParams{ 28 timeout: cr.DefaultTimeout, 29 } 30 } 31 32 // NewDeleteProjectParamsWithTimeout creates a new DeleteProjectParams object 33 // with the ability to set a timeout on a request. 34 func NewDeleteProjectParamsWithTimeout(timeout time.Duration) *DeleteProjectParams { 35 return &DeleteProjectParams{ 36 timeout: timeout, 37 } 38 } 39 40 // NewDeleteProjectParamsWithContext creates a new DeleteProjectParams object 41 // with the ability to set a context for a request. 42 func NewDeleteProjectParamsWithContext(ctx context.Context) *DeleteProjectParams { 43 return &DeleteProjectParams{ 44 Context: ctx, 45 } 46 } 47 48 // NewDeleteProjectParamsWithHTTPClient creates a new DeleteProjectParams object 49 // with the ability to set a custom HTTPClient for a request. 50 func NewDeleteProjectParamsWithHTTPClient(client *http.Client) *DeleteProjectParams { 51 return &DeleteProjectParams{ 52 HTTPClient: client, 53 } 54 } 55 56 /* 57 DeleteProjectParams contains all the parameters to send to the API endpoint 58 59 for the delete project operation. 60 61 Typically these are written to a http.Request. 62 */ 63 type DeleteProjectParams 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 delete project params (not the query body). 89 // 90 // All values with no default are reset to their zero value. 91 func (o *DeleteProjectParams) WithDefaults() *DeleteProjectParams { 92 o.SetDefaults() 93 return o 94 } 95 96 // SetDefaults hydrates default values in the delete project params (not the query body). 97 // 98 // All values with no default are reset to their zero value. 99 func (o *DeleteProjectParams) SetDefaults() { 100 var ( 101 xIsResourceNameDefault = bool(false) 102 ) 103 104 val := DeleteProjectParams{ 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 delete project params 115 func (o *DeleteProjectParams) WithTimeout(timeout time.Duration) *DeleteProjectParams { 116 o.SetTimeout(timeout) 117 return o 118 } 119 120 // SetTimeout adds the timeout to the delete project params 121 func (o *DeleteProjectParams) SetTimeout(timeout time.Duration) { 122 o.timeout = timeout 123 } 124 125 // WithContext adds the context to the delete project params 126 func (o *DeleteProjectParams) WithContext(ctx context.Context) *DeleteProjectParams { 127 o.SetContext(ctx) 128 return o 129 } 130 131 // SetContext adds the context to the delete project params 132 func (o *DeleteProjectParams) SetContext(ctx context.Context) { 133 o.Context = ctx 134 } 135 136 // WithHTTPClient adds the HTTPClient to the delete project params 137 func (o *DeleteProjectParams) WithHTTPClient(client *http.Client) *DeleteProjectParams { 138 o.SetHTTPClient(client) 139 return o 140 } 141 142 // SetHTTPClient adds the HTTPClient to the delete project params 143 func (o *DeleteProjectParams) SetHTTPClient(client *http.Client) { 144 o.HTTPClient = client 145 } 146 147 // WithXIsResourceName adds the xIsResourceName to the delete project params 148 func (o *DeleteProjectParams) WithXIsResourceName(xIsResourceName *bool) *DeleteProjectParams { 149 o.SetXIsResourceName(xIsResourceName) 150 return o 151 } 152 153 // SetXIsResourceName adds the xIsResourceName to the delete project params 154 func (o *DeleteProjectParams) SetXIsResourceName(xIsResourceName *bool) { 155 o.XIsResourceName = xIsResourceName 156 } 157 158 // WithXRequestID adds the xRequestID to the delete project params 159 func (o *DeleteProjectParams) WithXRequestID(xRequestID *string) *DeleteProjectParams { 160 o.SetXRequestID(xRequestID) 161 return o 162 } 163 164 // SetXRequestID adds the xRequestId to the delete project params 165 func (o *DeleteProjectParams) SetXRequestID(xRequestID *string) { 166 o.XRequestID = xRequestID 167 } 168 169 // WithProjectNameOrID adds the projectNameOrID to the delete project params 170 func (o *DeleteProjectParams) WithProjectNameOrID(projectNameOrID string) *DeleteProjectParams { 171 o.SetProjectNameOrID(projectNameOrID) 172 return o 173 } 174 175 // SetProjectNameOrID adds the projectNameOrId to the delete project params 176 func (o *DeleteProjectParams) SetProjectNameOrID(projectNameOrID string) { 177 o.ProjectNameOrID = projectNameOrID 178 } 179 180 // WriteToRequest writes these params to a swagger request 181 func (o *DeleteProjectParams) 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 }