github.com/goharbor/go-client@v0.210.0/pkg/sdk/v2.0/client/purge/stop_purge_parameters.go (about) 1 // Code generated by go-swagger; DO NOT EDIT. 2 3 package purge 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 // NewStopPurgeParams creates a new StopPurgeParams 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 NewStopPurgeParams() *StopPurgeParams { 27 return &StopPurgeParams{ 28 timeout: cr.DefaultTimeout, 29 } 30 } 31 32 // NewStopPurgeParamsWithTimeout creates a new StopPurgeParams object 33 // with the ability to set a timeout on a request. 34 func NewStopPurgeParamsWithTimeout(timeout time.Duration) *StopPurgeParams { 35 return &StopPurgeParams{ 36 timeout: timeout, 37 } 38 } 39 40 // NewStopPurgeParamsWithContext creates a new StopPurgeParams object 41 // with the ability to set a context for a request. 42 func NewStopPurgeParamsWithContext(ctx context.Context) *StopPurgeParams { 43 return &StopPurgeParams{ 44 Context: ctx, 45 } 46 } 47 48 // NewStopPurgeParamsWithHTTPClient creates a new StopPurgeParams object 49 // with the ability to set a custom HTTPClient for a request. 50 func NewStopPurgeParamsWithHTTPClient(client *http.Client) *StopPurgeParams { 51 return &StopPurgeParams{ 52 HTTPClient: client, 53 } 54 } 55 56 /* 57 StopPurgeParams contains all the parameters to send to the API endpoint 58 59 for the stop purge operation. 60 61 Typically these are written to a http.Request. 62 */ 63 type StopPurgeParams struct { 64 65 /* XRequestID. 66 67 An unique ID for the request 68 */ 69 XRequestID *string 70 71 /* PurgeID. 72 73 The ID of the purge log 74 75 Format: int64 76 */ 77 PurgeID int64 78 79 timeout time.Duration 80 Context context.Context 81 HTTPClient *http.Client 82 } 83 84 // WithDefaults hydrates default values in the stop purge params (not the query body). 85 // 86 // All values with no default are reset to their zero value. 87 func (o *StopPurgeParams) WithDefaults() *StopPurgeParams { 88 o.SetDefaults() 89 return o 90 } 91 92 // SetDefaults hydrates default values in the stop purge params (not the query body). 93 // 94 // All values with no default are reset to their zero value. 95 func (o *StopPurgeParams) SetDefaults() { 96 // no default values defined for this parameter 97 } 98 99 // WithTimeout adds the timeout to the stop purge params 100 func (o *StopPurgeParams) WithTimeout(timeout time.Duration) *StopPurgeParams { 101 o.SetTimeout(timeout) 102 return o 103 } 104 105 // SetTimeout adds the timeout to the stop purge params 106 func (o *StopPurgeParams) SetTimeout(timeout time.Duration) { 107 o.timeout = timeout 108 } 109 110 // WithContext adds the context to the stop purge params 111 func (o *StopPurgeParams) WithContext(ctx context.Context) *StopPurgeParams { 112 o.SetContext(ctx) 113 return o 114 } 115 116 // SetContext adds the context to the stop purge params 117 func (o *StopPurgeParams) SetContext(ctx context.Context) { 118 o.Context = ctx 119 } 120 121 // WithHTTPClient adds the HTTPClient to the stop purge params 122 func (o *StopPurgeParams) WithHTTPClient(client *http.Client) *StopPurgeParams { 123 o.SetHTTPClient(client) 124 return o 125 } 126 127 // SetHTTPClient adds the HTTPClient to the stop purge params 128 func (o *StopPurgeParams) SetHTTPClient(client *http.Client) { 129 o.HTTPClient = client 130 } 131 132 // WithXRequestID adds the xRequestID to the stop purge params 133 func (o *StopPurgeParams) WithXRequestID(xRequestID *string) *StopPurgeParams { 134 o.SetXRequestID(xRequestID) 135 return o 136 } 137 138 // SetXRequestID adds the xRequestId to the stop purge params 139 func (o *StopPurgeParams) SetXRequestID(xRequestID *string) { 140 o.XRequestID = xRequestID 141 } 142 143 // WithPurgeID adds the purgeID to the stop purge params 144 func (o *StopPurgeParams) WithPurgeID(purgeID int64) *StopPurgeParams { 145 o.SetPurgeID(purgeID) 146 return o 147 } 148 149 // SetPurgeID adds the purgeId to the stop purge params 150 func (o *StopPurgeParams) SetPurgeID(purgeID int64) { 151 o.PurgeID = purgeID 152 } 153 154 // WriteToRequest writes these params to a swagger request 155 func (o *StopPurgeParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { 156 157 if err := r.SetTimeout(o.timeout); err != nil { 158 return err 159 } 160 var res []error 161 162 if o.XRequestID != nil { 163 164 // header param X-Request-Id 165 if err := r.SetHeaderParam("X-Request-Id", *o.XRequestID); err != nil { 166 return err 167 } 168 } 169 170 // path param purge_id 171 if err := r.SetPathParam("purge_id", swag.FormatInt64(o.PurgeID)); err != nil { 172 return err 173 } 174 175 if len(res) > 0 { 176 return errors.CompositeValidationError(res...) 177 } 178 return nil 179 }