github.com/goharbor/go-client@v0.210.0/pkg/sdk/v2.0/client/replication/replication_client.go (about) 1 // Code generated by go-swagger; DO NOT EDIT. 2 3 package replication 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 replication client 19 type API interface { 20 /* 21 CreateReplicationPolicy creates a replication policy 22 23 Create a replication policy*/ 24 CreateReplicationPolicy(ctx context.Context, params *CreateReplicationPolicyParams) (*CreateReplicationPolicyCreated, error) 25 /* 26 DeleteReplicationPolicy deletes the specific replication policy 27 28 Delete the specific replication policy*/ 29 DeleteReplicationPolicy(ctx context.Context, params *DeleteReplicationPolicyParams) (*DeleteReplicationPolicyOK, error) 30 /* 31 GetReplicationExecution gets the specific replication execution 32 33 Get the replication execution specified by ID*/ 34 GetReplicationExecution(ctx context.Context, params *GetReplicationExecutionParams) (*GetReplicationExecutionOK, error) 35 /* 36 GetReplicationLog gets the log of the specific replication task 37 38 Get the log of the specific replication task*/ 39 GetReplicationLog(ctx context.Context, params *GetReplicationLogParams) (*GetReplicationLogOK, error) 40 /* 41 GetReplicationPolicy gets the specific replication policy 42 43 Get the specific replication policy*/ 44 GetReplicationPolicy(ctx context.Context, params *GetReplicationPolicyParams) (*GetReplicationPolicyOK, error) 45 /* 46 ListReplicationExecutions lists replication executions 47 48 List replication executions*/ 49 ListReplicationExecutions(ctx context.Context, params *ListReplicationExecutionsParams) (*ListReplicationExecutionsOK, error) 50 /* 51 ListReplicationPolicies lists replication policies 52 53 List replication policies*/ 54 ListReplicationPolicies(ctx context.Context, params *ListReplicationPoliciesParams) (*ListReplicationPoliciesOK, error) 55 /* 56 ListReplicationTasks lists replication tasks for a specific execution 57 58 List replication tasks for a specific execution*/ 59 ListReplicationTasks(ctx context.Context, params *ListReplicationTasksParams) (*ListReplicationTasksOK, error) 60 /* 61 StartReplication starts one replication execution 62 63 Start one replication execution according to the policy*/ 64 StartReplication(ctx context.Context, params *StartReplicationParams) (*StartReplicationCreated, error) 65 /* 66 StopReplication stops the specific replication execution 67 68 Stop the replication execution specified by ID*/ 69 StopReplication(ctx context.Context, params *StopReplicationParams) (*StopReplicationOK, error) 70 /* 71 UpdateReplicationPolicy updates the replication policy 72 73 Update the replication policy*/ 74 UpdateReplicationPolicy(ctx context.Context, params *UpdateReplicationPolicyParams) (*UpdateReplicationPolicyOK, error) 75 } 76 77 // New creates a new replication API client. 78 func New(transport runtime.ClientTransport, formats strfmt.Registry, authInfo runtime.ClientAuthInfoWriter) *Client { 79 return &Client{ 80 transport: transport, 81 formats: formats, 82 authInfo: authInfo, 83 } 84 } 85 86 /* 87 Client for replication API 88 */ 89 type Client struct { 90 transport runtime.ClientTransport 91 formats strfmt.Registry 92 authInfo runtime.ClientAuthInfoWriter 93 } 94 95 /* 96 CreateReplicationPolicy creates a replication policy 97 98 Create a replication policy 99 */ 100 func (a *Client) CreateReplicationPolicy(ctx context.Context, params *CreateReplicationPolicyParams) (*CreateReplicationPolicyCreated, error) { 101 102 result, err := a.transport.Submit(&runtime.ClientOperation{ 103 ID: "createReplicationPolicy", 104 Method: "POST", 105 PathPattern: "/replication/policies", 106 ProducesMediaTypes: []string{"application/json"}, 107 ConsumesMediaTypes: []string{"application/json"}, 108 Schemes: []string{"http", "https"}, 109 Params: params, 110 Reader: &CreateReplicationPolicyReader{formats: a.formats}, 111 AuthInfo: a.authInfo, 112 Context: ctx, 113 Client: params.HTTPClient, 114 }) 115 if err != nil { 116 return nil, err 117 } 118 return result.(*CreateReplicationPolicyCreated), nil 119 120 } 121 122 /* 123 DeleteReplicationPolicy deletes the specific replication policy 124 125 Delete the specific replication policy 126 */ 127 func (a *Client) DeleteReplicationPolicy(ctx context.Context, params *DeleteReplicationPolicyParams) (*DeleteReplicationPolicyOK, error) { 128 129 result, err := a.transport.Submit(&runtime.ClientOperation{ 130 ID: "deleteReplicationPolicy", 131 Method: "DELETE", 132 PathPattern: "/replication/policies/{id}", 133 ProducesMediaTypes: []string{"application/json"}, 134 ConsumesMediaTypes: []string{"application/json"}, 135 Schemes: []string{"http", "https"}, 136 Params: params, 137 Reader: &DeleteReplicationPolicyReader{formats: a.formats}, 138 AuthInfo: a.authInfo, 139 Context: ctx, 140 Client: params.HTTPClient, 141 }) 142 if err != nil { 143 return nil, err 144 } 145 return result.(*DeleteReplicationPolicyOK), nil 146 147 } 148 149 /* 150 GetReplicationExecution gets the specific replication execution 151 152 Get the replication execution specified by ID 153 */ 154 func (a *Client) GetReplicationExecution(ctx context.Context, params *GetReplicationExecutionParams) (*GetReplicationExecutionOK, error) { 155 156 result, err := a.transport.Submit(&runtime.ClientOperation{ 157 ID: "getReplicationExecution", 158 Method: "GET", 159 PathPattern: "/replication/executions/{id}", 160 ProducesMediaTypes: []string{"application/json"}, 161 ConsumesMediaTypes: []string{"application/json"}, 162 Schemes: []string{"http", "https"}, 163 Params: params, 164 Reader: &GetReplicationExecutionReader{formats: a.formats}, 165 AuthInfo: a.authInfo, 166 Context: ctx, 167 Client: params.HTTPClient, 168 }) 169 if err != nil { 170 return nil, err 171 } 172 return result.(*GetReplicationExecutionOK), nil 173 174 } 175 176 /* 177 GetReplicationLog gets the log of the specific replication task 178 179 Get the log of the specific replication task 180 */ 181 func (a *Client) GetReplicationLog(ctx context.Context, params *GetReplicationLogParams) (*GetReplicationLogOK, error) { 182 183 result, err := a.transport.Submit(&runtime.ClientOperation{ 184 ID: "getReplicationLog", 185 Method: "GET", 186 PathPattern: "/replication/executions/{id}/tasks/{task_id}/log", 187 ProducesMediaTypes: []string{"text/plain"}, 188 ConsumesMediaTypes: []string{"application/json"}, 189 Schemes: []string{"http", "https"}, 190 Params: params, 191 Reader: &GetReplicationLogReader{formats: a.formats}, 192 AuthInfo: a.authInfo, 193 Context: ctx, 194 Client: params.HTTPClient, 195 }) 196 if err != nil { 197 return nil, err 198 } 199 return result.(*GetReplicationLogOK), nil 200 201 } 202 203 /* 204 GetReplicationPolicy gets the specific replication policy 205 206 Get the specific replication policy 207 */ 208 func (a *Client) GetReplicationPolicy(ctx context.Context, params *GetReplicationPolicyParams) (*GetReplicationPolicyOK, error) { 209 210 result, err := a.transport.Submit(&runtime.ClientOperation{ 211 ID: "getReplicationPolicy", 212 Method: "GET", 213 PathPattern: "/replication/policies/{id}", 214 ProducesMediaTypes: []string{"application/json"}, 215 ConsumesMediaTypes: []string{"application/json"}, 216 Schemes: []string{"http", "https"}, 217 Params: params, 218 Reader: &GetReplicationPolicyReader{formats: a.formats}, 219 AuthInfo: a.authInfo, 220 Context: ctx, 221 Client: params.HTTPClient, 222 }) 223 if err != nil { 224 return nil, err 225 } 226 return result.(*GetReplicationPolicyOK), nil 227 228 } 229 230 /* 231 ListReplicationExecutions lists replication executions 232 233 List replication executions 234 */ 235 func (a *Client) ListReplicationExecutions(ctx context.Context, params *ListReplicationExecutionsParams) (*ListReplicationExecutionsOK, error) { 236 237 result, err := a.transport.Submit(&runtime.ClientOperation{ 238 ID: "listReplicationExecutions", 239 Method: "GET", 240 PathPattern: "/replication/executions", 241 ProducesMediaTypes: []string{"application/json"}, 242 ConsumesMediaTypes: []string{"application/json"}, 243 Schemes: []string{"http", "https"}, 244 Params: params, 245 Reader: &ListReplicationExecutionsReader{formats: a.formats}, 246 AuthInfo: a.authInfo, 247 Context: ctx, 248 Client: params.HTTPClient, 249 }) 250 if err != nil { 251 return nil, err 252 } 253 return result.(*ListReplicationExecutionsOK), nil 254 255 } 256 257 /* 258 ListReplicationPolicies lists replication policies 259 260 List replication policies 261 */ 262 func (a *Client) ListReplicationPolicies(ctx context.Context, params *ListReplicationPoliciesParams) (*ListReplicationPoliciesOK, error) { 263 264 result, err := a.transport.Submit(&runtime.ClientOperation{ 265 ID: "listReplicationPolicies", 266 Method: "GET", 267 PathPattern: "/replication/policies", 268 ProducesMediaTypes: []string{"application/json"}, 269 ConsumesMediaTypes: []string{"application/json"}, 270 Schemes: []string{"http", "https"}, 271 Params: params, 272 Reader: &ListReplicationPoliciesReader{formats: a.formats}, 273 AuthInfo: a.authInfo, 274 Context: ctx, 275 Client: params.HTTPClient, 276 }) 277 if err != nil { 278 return nil, err 279 } 280 return result.(*ListReplicationPoliciesOK), nil 281 282 } 283 284 /* 285 ListReplicationTasks lists replication tasks for a specific execution 286 287 List replication tasks for a specific execution 288 */ 289 func (a *Client) ListReplicationTasks(ctx context.Context, params *ListReplicationTasksParams) (*ListReplicationTasksOK, error) { 290 291 result, err := a.transport.Submit(&runtime.ClientOperation{ 292 ID: "listReplicationTasks", 293 Method: "GET", 294 PathPattern: "/replication/executions/{id}/tasks", 295 ProducesMediaTypes: []string{"application/json"}, 296 ConsumesMediaTypes: []string{"application/json"}, 297 Schemes: []string{"http", "https"}, 298 Params: params, 299 Reader: &ListReplicationTasksReader{formats: a.formats}, 300 AuthInfo: a.authInfo, 301 Context: ctx, 302 Client: params.HTTPClient, 303 }) 304 if err != nil { 305 return nil, err 306 } 307 return result.(*ListReplicationTasksOK), nil 308 309 } 310 311 /* 312 StartReplication starts one replication execution 313 314 Start one replication execution according to the policy 315 */ 316 func (a *Client) StartReplication(ctx context.Context, params *StartReplicationParams) (*StartReplicationCreated, error) { 317 318 result, err := a.transport.Submit(&runtime.ClientOperation{ 319 ID: "startReplication", 320 Method: "POST", 321 PathPattern: "/replication/executions", 322 ProducesMediaTypes: []string{"application/json"}, 323 ConsumesMediaTypes: []string{"application/json"}, 324 Schemes: []string{"http", "https"}, 325 Params: params, 326 Reader: &StartReplicationReader{formats: a.formats}, 327 AuthInfo: a.authInfo, 328 Context: ctx, 329 Client: params.HTTPClient, 330 }) 331 if err != nil { 332 return nil, err 333 } 334 return result.(*StartReplicationCreated), nil 335 336 } 337 338 /* 339 StopReplication stops the specific replication execution 340 341 Stop the replication execution specified by ID 342 */ 343 func (a *Client) StopReplication(ctx context.Context, params *StopReplicationParams) (*StopReplicationOK, error) { 344 345 result, err := a.transport.Submit(&runtime.ClientOperation{ 346 ID: "stopReplication", 347 Method: "PUT", 348 PathPattern: "/replication/executions/{id}", 349 ProducesMediaTypes: []string{"application/json"}, 350 ConsumesMediaTypes: []string{"application/json"}, 351 Schemes: []string{"http", "https"}, 352 Params: params, 353 Reader: &StopReplicationReader{formats: a.formats}, 354 AuthInfo: a.authInfo, 355 Context: ctx, 356 Client: params.HTTPClient, 357 }) 358 if err != nil { 359 return nil, err 360 } 361 return result.(*StopReplicationOK), nil 362 363 } 364 365 /* 366 UpdateReplicationPolicy updates the replication policy 367 368 Update the replication policy 369 */ 370 func (a *Client) UpdateReplicationPolicy(ctx context.Context, params *UpdateReplicationPolicyParams) (*UpdateReplicationPolicyOK, error) { 371 372 result, err := a.transport.Submit(&runtime.ClientOperation{ 373 ID: "updateReplicationPolicy", 374 Method: "PUT", 375 PathPattern: "/replication/policies/{id}", 376 ProducesMediaTypes: []string{"application/json"}, 377 ConsumesMediaTypes: []string{"application/json"}, 378 Schemes: []string{"http", "https"}, 379 Params: params, 380 Reader: &UpdateReplicationPolicyReader{formats: a.formats}, 381 AuthInfo: a.authInfo, 382 Context: ctx, 383 Client: params.HTTPClient, 384 }) 385 if err != nil { 386 return nil, err 387 } 388 return result.(*UpdateReplicationPolicyOK), nil 389 390 }