github.com/goharbor/go-client@v0.210.0/pkg/sdk/v2.0/client/retention/retention_client.go (about) 1 // Code generated by go-swagger; DO NOT EDIT. 2 3 package retention 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 11 "github.com/go-openapi/runtime" 12 13 strfmt "github.com/go-openapi/strfmt" 14 ) 15 16 //go:generate mockery -name API -inpkg 17 18 // API is the interface of the retention client 19 type API interface { 20 /* 21 CreateRetention creates retention policy 22 23 Create Retention Policy, you can reference metadatas API for the policy model. You can check project metadatas to find whether a retention policy is already binded. This method should only be called when no retention policy binded to project yet.*/ 24 CreateRetention(ctx context.Context, params *CreateRetentionParams) (*CreateRetentionCreated, error) 25 /* 26 DeleteRetention deletes retention policy 27 28 Delete Retention Policy, you can reference metadatas API for the policy model. You can check project metadatas to find whether a retention policy is already binded. This method should only be called when retention policy has already binded to project.*/ 29 DeleteRetention(ctx context.Context, params *DeleteRetentionParams) (*DeleteRetentionOK, error) 30 /* 31 GetRentenitionMetadata gets retention metadatas 32 33 Get Retention Metadatas.*/ 34 GetRentenitionMetadata(ctx context.Context, params *GetRentenitionMetadataParams) (*GetRentenitionMetadataOK, error) 35 /* 36 GetRetention gets retention policy 37 38 Get Retention Policy.*/ 39 GetRetention(ctx context.Context, params *GetRetentionParams) (*GetRetentionOK, error) 40 /* 41 GetRetentionTaskLog gets retention job task log 42 43 Get Retention job task log, tags ratain or deletion detail will be shown in a table.*/ 44 GetRetentionTaskLog(ctx context.Context, params *GetRetentionTaskLogParams) (*GetRetentionTaskLogOK, error) 45 /* 46 ListRetentionExecutions gets retention executions 47 48 Get Retention executions, execution status may be delayed before job service schedule it up.*/ 49 ListRetentionExecutions(ctx context.Context, params *ListRetentionExecutionsParams) (*ListRetentionExecutionsOK, error) 50 /* 51 ListRetentionTasks gets retention tasks 52 53 Get Retention tasks, each repository as a task.*/ 54 ListRetentionTasks(ctx context.Context, params *ListRetentionTasksParams) (*ListRetentionTasksOK, error) 55 /* 56 OperateRetentionExecution stops a retention execution 57 58 Stop a Retention execution, only support "stop" action now.*/ 59 OperateRetentionExecution(ctx context.Context, params *OperateRetentionExecutionParams) (*OperateRetentionExecutionOK, error) 60 /* 61 TriggerRetentionExecution triggers a retention execution 62 63 Trigger a Retention Execution, if dry_run is True, nothing would be deleted actually.*/ 64 TriggerRetentionExecution(ctx context.Context, params *TriggerRetentionExecutionParams) (*TriggerRetentionExecutionOK, *TriggerRetentionExecutionCreated, error) 65 /* 66 UpdateRetention updates retention policy 67 68 Update Retention Policy, you can reference metadatas API for the policy model. You can check project metadatas to find whether a retention policy is already binded. This method should only be called when retention policy has already binded to project.*/ 69 UpdateRetention(ctx context.Context, params *UpdateRetentionParams) (*UpdateRetentionOK, error) 70 } 71 72 // New creates a new retention API client. 73 func New(transport runtime.ClientTransport, formats strfmt.Registry, authInfo runtime.ClientAuthInfoWriter) *Client { 74 return &Client{ 75 transport: transport, 76 formats: formats, 77 authInfo: authInfo, 78 } 79 } 80 81 /* 82 Client for retention API 83 */ 84 type Client struct { 85 transport runtime.ClientTransport 86 formats strfmt.Registry 87 authInfo runtime.ClientAuthInfoWriter 88 } 89 90 /* 91 CreateRetention creates retention policy 92 93 Create Retention Policy, you can reference metadatas API for the policy model. You can check project metadatas to find whether a retention policy is already binded. This method should only be called when no retention policy binded to project yet. 94 */ 95 func (a *Client) CreateRetention(ctx context.Context, params *CreateRetentionParams) (*CreateRetentionCreated, error) { 96 97 result, err := a.transport.Submit(&runtime.ClientOperation{ 98 ID: "createRetention", 99 Method: "POST", 100 PathPattern: "/retentions", 101 ProducesMediaTypes: []string{"application/json"}, 102 ConsumesMediaTypes: []string{"application/json"}, 103 Schemes: []string{"http", "https"}, 104 Params: params, 105 Reader: &CreateRetentionReader{formats: a.formats}, 106 AuthInfo: a.authInfo, 107 Context: ctx, 108 Client: params.HTTPClient, 109 }) 110 if err != nil { 111 return nil, err 112 } 113 return result.(*CreateRetentionCreated), nil 114 115 } 116 117 /* 118 DeleteRetention deletes retention policy 119 120 Delete Retention Policy, you can reference metadatas API for the policy model. You can check project metadatas to find whether a retention policy is already binded. This method should only be called when retention policy has already binded to project. 121 */ 122 func (a *Client) DeleteRetention(ctx context.Context, params *DeleteRetentionParams) (*DeleteRetentionOK, error) { 123 124 result, err := a.transport.Submit(&runtime.ClientOperation{ 125 ID: "deleteRetention", 126 Method: "DELETE", 127 PathPattern: "/retentions/{id}", 128 ProducesMediaTypes: []string{"application/json"}, 129 ConsumesMediaTypes: []string{"application/json"}, 130 Schemes: []string{"http", "https"}, 131 Params: params, 132 Reader: &DeleteRetentionReader{formats: a.formats}, 133 AuthInfo: a.authInfo, 134 Context: ctx, 135 Client: params.HTTPClient, 136 }) 137 if err != nil { 138 return nil, err 139 } 140 return result.(*DeleteRetentionOK), nil 141 142 } 143 144 /* 145 GetRentenitionMetadata gets retention metadatas 146 147 Get Retention Metadatas. 148 */ 149 func (a *Client) GetRentenitionMetadata(ctx context.Context, params *GetRentenitionMetadataParams) (*GetRentenitionMetadataOK, error) { 150 151 result, err := a.transport.Submit(&runtime.ClientOperation{ 152 ID: "getRentenitionMetadata", 153 Method: "GET", 154 PathPattern: "/retentions/metadatas", 155 ProducesMediaTypes: []string{"application/json"}, 156 ConsumesMediaTypes: []string{"application/json"}, 157 Schemes: []string{"http", "https"}, 158 Params: params, 159 Reader: &GetRentenitionMetadataReader{formats: a.formats}, 160 AuthInfo: a.authInfo, 161 Context: ctx, 162 Client: params.HTTPClient, 163 }) 164 if err != nil { 165 return nil, err 166 } 167 return result.(*GetRentenitionMetadataOK), nil 168 169 } 170 171 /* 172 GetRetention gets retention policy 173 174 Get Retention Policy. 175 */ 176 func (a *Client) GetRetention(ctx context.Context, params *GetRetentionParams) (*GetRetentionOK, error) { 177 178 result, err := a.transport.Submit(&runtime.ClientOperation{ 179 ID: "getRetention", 180 Method: "GET", 181 PathPattern: "/retentions/{id}", 182 ProducesMediaTypes: []string{"application/json"}, 183 ConsumesMediaTypes: []string{"application/json"}, 184 Schemes: []string{"http", "https"}, 185 Params: params, 186 Reader: &GetRetentionReader{formats: a.formats}, 187 AuthInfo: a.authInfo, 188 Context: ctx, 189 Client: params.HTTPClient, 190 }) 191 if err != nil { 192 return nil, err 193 } 194 return result.(*GetRetentionOK), nil 195 196 } 197 198 /* 199 GetRetentionTaskLog gets retention job task log 200 201 Get Retention job task log, tags ratain or deletion detail will be shown in a table. 202 */ 203 func (a *Client) GetRetentionTaskLog(ctx context.Context, params *GetRetentionTaskLogParams) (*GetRetentionTaskLogOK, error) { 204 205 result, err := a.transport.Submit(&runtime.ClientOperation{ 206 ID: "getRetentionTaskLog", 207 Method: "GET", 208 PathPattern: "/retentions/{id}/executions/{eid}/tasks/{tid}", 209 ProducesMediaTypes: []string{"text/plain"}, 210 ConsumesMediaTypes: []string{"application/json"}, 211 Schemes: []string{"http", "https"}, 212 Params: params, 213 Reader: &GetRetentionTaskLogReader{formats: a.formats}, 214 AuthInfo: a.authInfo, 215 Context: ctx, 216 Client: params.HTTPClient, 217 }) 218 if err != nil { 219 return nil, err 220 } 221 return result.(*GetRetentionTaskLogOK), nil 222 223 } 224 225 /* 226 ListRetentionExecutions gets retention executions 227 228 Get Retention executions, execution status may be delayed before job service schedule it up. 229 */ 230 func (a *Client) ListRetentionExecutions(ctx context.Context, params *ListRetentionExecutionsParams) (*ListRetentionExecutionsOK, error) { 231 232 result, err := a.transport.Submit(&runtime.ClientOperation{ 233 ID: "listRetentionExecutions", 234 Method: "GET", 235 PathPattern: "/retentions/{id}/executions", 236 ProducesMediaTypes: []string{"application/json"}, 237 ConsumesMediaTypes: []string{"application/json"}, 238 Schemes: []string{"http", "https"}, 239 Params: params, 240 Reader: &ListRetentionExecutionsReader{formats: a.formats}, 241 AuthInfo: a.authInfo, 242 Context: ctx, 243 Client: params.HTTPClient, 244 }) 245 if err != nil { 246 return nil, err 247 } 248 return result.(*ListRetentionExecutionsOK), nil 249 250 } 251 252 /* 253 ListRetentionTasks gets retention tasks 254 255 Get Retention tasks, each repository as a task. 256 */ 257 func (a *Client) ListRetentionTasks(ctx context.Context, params *ListRetentionTasksParams) (*ListRetentionTasksOK, error) { 258 259 result, err := a.transport.Submit(&runtime.ClientOperation{ 260 ID: "listRetentionTasks", 261 Method: "GET", 262 PathPattern: "/retentions/{id}/executions/{eid}/tasks", 263 ProducesMediaTypes: []string{"application/json"}, 264 ConsumesMediaTypes: []string{"application/json"}, 265 Schemes: []string{"http", "https"}, 266 Params: params, 267 Reader: &ListRetentionTasksReader{formats: a.formats}, 268 AuthInfo: a.authInfo, 269 Context: ctx, 270 Client: params.HTTPClient, 271 }) 272 if err != nil { 273 return nil, err 274 } 275 return result.(*ListRetentionTasksOK), nil 276 277 } 278 279 /* 280 OperateRetentionExecution stops a retention execution 281 282 Stop a Retention execution, only support "stop" action now. 283 */ 284 func (a *Client) OperateRetentionExecution(ctx context.Context, params *OperateRetentionExecutionParams) (*OperateRetentionExecutionOK, error) { 285 286 result, err := a.transport.Submit(&runtime.ClientOperation{ 287 ID: "operateRetentionExecution", 288 Method: "PATCH", 289 PathPattern: "/retentions/{id}/executions/{eid}", 290 ProducesMediaTypes: []string{"application/json"}, 291 ConsumesMediaTypes: []string{"application/json"}, 292 Schemes: []string{"http", "https"}, 293 Params: params, 294 Reader: &OperateRetentionExecutionReader{formats: a.formats}, 295 AuthInfo: a.authInfo, 296 Context: ctx, 297 Client: params.HTTPClient, 298 }) 299 if err != nil { 300 return nil, err 301 } 302 return result.(*OperateRetentionExecutionOK), nil 303 304 } 305 306 /* 307 TriggerRetentionExecution triggers a retention execution 308 309 Trigger a Retention Execution, if dry_run is True, nothing would be deleted actually. 310 */ 311 func (a *Client) TriggerRetentionExecution(ctx context.Context, params *TriggerRetentionExecutionParams) (*TriggerRetentionExecutionOK, *TriggerRetentionExecutionCreated, error) { 312 313 result, err := a.transport.Submit(&runtime.ClientOperation{ 314 ID: "triggerRetentionExecution", 315 Method: "POST", 316 PathPattern: "/retentions/{id}/executions", 317 ProducesMediaTypes: []string{"text/plain"}, 318 ConsumesMediaTypes: []string{"application/json"}, 319 Schemes: []string{"http", "https"}, 320 Params: params, 321 Reader: &TriggerRetentionExecutionReader{formats: a.formats}, 322 AuthInfo: a.authInfo, 323 Context: ctx, 324 Client: params.HTTPClient, 325 }) 326 if err != nil { 327 return nil, nil, err 328 } 329 switch value := result.(type) { 330 case *TriggerRetentionExecutionOK: 331 return value, nil, nil 332 case *TriggerRetentionExecutionCreated: 333 return nil, value, nil 334 } 335 return nil, nil, nil 336 337 } 338 339 /* 340 UpdateRetention updates retention policy 341 342 Update Retention Policy, you can reference metadatas API for the policy model. You can check project metadatas to find whether a retention policy is already binded. This method should only be called when retention policy has already binded to project. 343 */ 344 func (a *Client) UpdateRetention(ctx context.Context, params *UpdateRetentionParams) (*UpdateRetentionOK, error) { 345 346 result, err := a.transport.Submit(&runtime.ClientOperation{ 347 ID: "updateRetention", 348 Method: "PUT", 349 PathPattern: "/retentions/{id}", 350 ProducesMediaTypes: []string{"application/json"}, 351 ConsumesMediaTypes: []string{"application/json"}, 352 Schemes: []string{"http", "https"}, 353 Params: params, 354 Reader: &UpdateRetentionReader{formats: a.formats}, 355 AuthInfo: a.authInfo, 356 Context: ctx, 357 Client: params.HTTPClient, 358 }) 359 if err != nil { 360 return nil, err 361 } 362 return result.(*UpdateRetentionOK), nil 363 364 }