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