github.com/goharbor/go-client@v0.210.0/pkg/sdk/v2.0/client/immutable/delete_immu_rule_parameters.go (about) 1 // Code generated by go-swagger; DO NOT EDIT. 2 3 package immutable 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 // NewDeleteImmuRuleParams creates a new DeleteImmuRuleParams 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 NewDeleteImmuRuleParams() *DeleteImmuRuleParams { 27 return &DeleteImmuRuleParams{ 28 timeout: cr.DefaultTimeout, 29 } 30 } 31 32 // NewDeleteImmuRuleParamsWithTimeout creates a new DeleteImmuRuleParams object 33 // with the ability to set a timeout on a request. 34 func NewDeleteImmuRuleParamsWithTimeout(timeout time.Duration) *DeleteImmuRuleParams { 35 return &DeleteImmuRuleParams{ 36 timeout: timeout, 37 } 38 } 39 40 // NewDeleteImmuRuleParamsWithContext creates a new DeleteImmuRuleParams object 41 // with the ability to set a context for a request. 42 func NewDeleteImmuRuleParamsWithContext(ctx context.Context) *DeleteImmuRuleParams { 43 return &DeleteImmuRuleParams{ 44 Context: ctx, 45 } 46 } 47 48 // NewDeleteImmuRuleParamsWithHTTPClient creates a new DeleteImmuRuleParams object 49 // with the ability to set a custom HTTPClient for a request. 50 func NewDeleteImmuRuleParamsWithHTTPClient(client *http.Client) *DeleteImmuRuleParams { 51 return &DeleteImmuRuleParams{ 52 HTTPClient: client, 53 } 54 } 55 56 /* 57 DeleteImmuRuleParams contains all the parameters to send to the API endpoint 58 59 for the delete immu rule operation. 60 61 Typically these are written to a http.Request. 62 */ 63 type DeleteImmuRuleParams 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 /* ImmutableRuleID. 78 79 The ID of the immutable rule 80 81 Format: int64 82 */ 83 ImmutableRuleID int64 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 delete immu rule params (not the query body). 97 // 98 // All values with no default are reset to their zero value. 99 func (o *DeleteImmuRuleParams) WithDefaults() *DeleteImmuRuleParams { 100 o.SetDefaults() 101 return o 102 } 103 104 // SetDefaults hydrates default values in the delete immu rule params (not the query body). 105 // 106 // All values with no default are reset to their zero value. 107 func (o *DeleteImmuRuleParams) SetDefaults() { 108 var ( 109 xIsResourceNameDefault = bool(false) 110 ) 111 112 val := DeleteImmuRuleParams{ 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 delete immu rule params 123 func (o *DeleteImmuRuleParams) WithTimeout(timeout time.Duration) *DeleteImmuRuleParams { 124 o.SetTimeout(timeout) 125 return o 126 } 127 128 // SetTimeout adds the timeout to the delete immu rule params 129 func (o *DeleteImmuRuleParams) SetTimeout(timeout time.Duration) { 130 o.timeout = timeout 131 } 132 133 // WithContext adds the context to the delete immu rule params 134 func (o *DeleteImmuRuleParams) WithContext(ctx context.Context) *DeleteImmuRuleParams { 135 o.SetContext(ctx) 136 return o 137 } 138 139 // SetContext adds the context to the delete immu rule params 140 func (o *DeleteImmuRuleParams) SetContext(ctx context.Context) { 141 o.Context = ctx 142 } 143 144 // WithHTTPClient adds the HTTPClient to the delete immu rule params 145 func (o *DeleteImmuRuleParams) WithHTTPClient(client *http.Client) *DeleteImmuRuleParams { 146 o.SetHTTPClient(client) 147 return o 148 } 149 150 // SetHTTPClient adds the HTTPClient to the delete immu rule params 151 func (o *DeleteImmuRuleParams) SetHTTPClient(client *http.Client) { 152 o.HTTPClient = client 153 } 154 155 // WithXIsResourceName adds the xIsResourceName to the delete immu rule params 156 func (o *DeleteImmuRuleParams) WithXIsResourceName(xIsResourceName *bool) *DeleteImmuRuleParams { 157 o.SetXIsResourceName(xIsResourceName) 158 return o 159 } 160 161 // SetXIsResourceName adds the xIsResourceName to the delete immu rule params 162 func (o *DeleteImmuRuleParams) SetXIsResourceName(xIsResourceName *bool) { 163 o.XIsResourceName = xIsResourceName 164 } 165 166 // WithXRequestID adds the xRequestID to the delete immu rule params 167 func (o *DeleteImmuRuleParams) WithXRequestID(xRequestID *string) *DeleteImmuRuleParams { 168 o.SetXRequestID(xRequestID) 169 return o 170 } 171 172 // SetXRequestID adds the xRequestId to the delete immu rule params 173 func (o *DeleteImmuRuleParams) SetXRequestID(xRequestID *string) { 174 o.XRequestID = xRequestID 175 } 176 177 // WithImmutableRuleID adds the immutableRuleID to the delete immu rule params 178 func (o *DeleteImmuRuleParams) WithImmutableRuleID(immutableRuleID int64) *DeleteImmuRuleParams { 179 o.SetImmutableRuleID(immutableRuleID) 180 return o 181 } 182 183 // SetImmutableRuleID adds the immutableRuleId to the delete immu rule params 184 func (o *DeleteImmuRuleParams) SetImmutableRuleID(immutableRuleID int64) { 185 o.ImmutableRuleID = immutableRuleID 186 } 187 188 // WithProjectNameOrID adds the projectNameOrID to the delete immu rule params 189 func (o *DeleteImmuRuleParams) WithProjectNameOrID(projectNameOrID string) *DeleteImmuRuleParams { 190 o.SetProjectNameOrID(projectNameOrID) 191 return o 192 } 193 194 // SetProjectNameOrID adds the projectNameOrId to the delete immu rule params 195 func (o *DeleteImmuRuleParams) SetProjectNameOrID(projectNameOrID string) { 196 o.ProjectNameOrID = projectNameOrID 197 } 198 199 // WriteToRequest writes these params to a swagger request 200 func (o *DeleteImmuRuleParams) 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 223 // path param immutable_rule_id 224 if err := r.SetPathParam("immutable_rule_id", swag.FormatInt64(o.ImmutableRuleID)); err != nil { 225 return err 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 }