github.com/goharbor/go-client@v0.210.0/pkg/sdk/v2.0/client/preheat/preheat_client.go (about) 1 // Code generated by go-swagger; DO NOT EDIT. 2 3 package preheat 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 preheat client 19 type API interface { 20 /* 21 CreateInstance creates p2p provider instances 22 23 Create p2p provider instances*/ 24 CreateInstance(ctx context.Context, params *CreateInstanceParams) (*CreateInstanceCreated, error) 25 /* 26 CreatePolicy creates a preheat policy under a project 27 28 Create a preheat policy under a project*/ 29 CreatePolicy(ctx context.Context, params *CreatePolicyParams) (*CreatePolicyCreated, error) 30 /* 31 DeleteInstance deletes the specified p2 p provider instance 32 33 Delete the specified P2P provider instance*/ 34 DeleteInstance(ctx context.Context, params *DeleteInstanceParams) (*DeleteInstanceOK, error) 35 /* 36 DeletePolicy deletes a preheat policy 37 38 Delete a preheat policy*/ 39 DeletePolicy(ctx context.Context, params *DeletePolicyParams) (*DeletePolicyOK, error) 40 /* 41 GetExecution gets a execution detail by id 42 43 Get a execution detail by id*/ 44 GetExecution(ctx context.Context, params *GetExecutionParams) (*GetExecutionOK, error) 45 /* 46 GetInstance gets a p2 p provider instance 47 48 Get a P2P provider instance*/ 49 GetInstance(ctx context.Context, params *GetInstanceParams) (*GetInstanceOK, error) 50 /* 51 GetPolicy gets a preheat policy 52 53 Get a preheat policy*/ 54 GetPolicy(ctx context.Context, params *GetPolicyParams) (*GetPolicyOK, error) 55 /* 56 GetPreheatLog gets the log text stream of the specified task for the given execution 57 58 Get the log text stream of the specified task for the given execution*/ 59 GetPreheatLog(ctx context.Context, params *GetPreheatLogParams) (*GetPreheatLogOK, error) 60 /* 61 ListExecutions lists executions for the given policy 62 63 List executions for the given policy*/ 64 ListExecutions(ctx context.Context, params *ListExecutionsParams) (*ListExecutionsOK, error) 65 /* 66 ListInstances lists p2 p provider instances 67 68 List P2P provider instances*/ 69 ListInstances(ctx context.Context, params *ListInstancesParams) (*ListInstancesOK, error) 70 /* 71 ListPolicies lists preheat policies 72 73 List preheat policies*/ 74 ListPolicies(ctx context.Context, params *ListPoliciesParams) (*ListPoliciesOK, error) 75 /* 76 ListProviders lists p2 p providers 77 78 List P2P providers*/ 79 ListProviders(ctx context.Context, params *ListProvidersParams) (*ListProvidersOK, error) 80 /* 81 ListProvidersUnderProject gets all providers at project level 82 83 Get all providers at project level*/ 84 ListProvidersUnderProject(ctx context.Context, params *ListProvidersUnderProjectParams) (*ListProvidersUnderProjectOK, error) 85 /* 86 ListTasks lists all the related tasks for the given execution 87 88 List all the related tasks for the given execution*/ 89 ListTasks(ctx context.Context, params *ListTasksParams) (*ListTasksOK, error) 90 /* 91 ManualPreheat manuals preheat 92 93 Manual preheat*/ 94 ManualPreheat(ctx context.Context, params *ManualPreheatParams) (*ManualPreheatCreated, error) 95 /* 96 PingInstances pings status of a instance 97 98 This endpoint checks status of a instance, the instance can be given by ID or Endpoint URL (together with credential) 99 */ 100 PingInstances(ctx context.Context, params *PingInstancesParams) (*PingInstancesOK, error) 101 /* 102 StopExecution stops a execution 103 104 Stop a execution*/ 105 StopExecution(ctx context.Context, params *StopExecutionParams) (*StopExecutionOK, error) 106 /* 107 UpdateInstance updates the specified p2 p provider instance 108 109 Update the specified P2P provider instance*/ 110 UpdateInstance(ctx context.Context, params *UpdateInstanceParams) (*UpdateInstanceOK, error) 111 /* 112 UpdatePolicy updates preheat policy 113 114 Update preheat policy*/ 115 UpdatePolicy(ctx context.Context, params *UpdatePolicyParams) (*UpdatePolicyOK, error) 116 } 117 118 // New creates a new preheat API client. 119 func New(transport runtime.ClientTransport, formats strfmt.Registry, authInfo runtime.ClientAuthInfoWriter) *Client { 120 return &Client{ 121 transport: transport, 122 formats: formats, 123 authInfo: authInfo, 124 } 125 } 126 127 /* 128 Client for preheat API 129 */ 130 type Client struct { 131 transport runtime.ClientTransport 132 formats strfmt.Registry 133 authInfo runtime.ClientAuthInfoWriter 134 } 135 136 /* 137 CreateInstance creates p2p provider instances 138 139 Create p2p provider instances 140 */ 141 func (a *Client) CreateInstance(ctx context.Context, params *CreateInstanceParams) (*CreateInstanceCreated, error) { 142 143 result, err := a.transport.Submit(&runtime.ClientOperation{ 144 ID: "CreateInstance", 145 Method: "POST", 146 PathPattern: "/p2p/preheat/instances", 147 ProducesMediaTypes: []string{"application/json"}, 148 ConsumesMediaTypes: []string{"application/json"}, 149 Schemes: []string{"http", "https"}, 150 Params: params, 151 Reader: &CreateInstanceReader{formats: a.formats}, 152 AuthInfo: a.authInfo, 153 Context: ctx, 154 Client: params.HTTPClient, 155 }) 156 if err != nil { 157 return nil, err 158 } 159 return result.(*CreateInstanceCreated), nil 160 161 } 162 163 /* 164 CreatePolicy creates a preheat policy under a project 165 166 Create a preheat policy under a project 167 */ 168 func (a *Client) CreatePolicy(ctx context.Context, params *CreatePolicyParams) (*CreatePolicyCreated, error) { 169 170 result, err := a.transport.Submit(&runtime.ClientOperation{ 171 ID: "CreatePolicy", 172 Method: "POST", 173 PathPattern: "/projects/{project_name}/preheat/policies", 174 ProducesMediaTypes: []string{"application/json"}, 175 ConsumesMediaTypes: []string{"application/json"}, 176 Schemes: []string{"http", "https"}, 177 Params: params, 178 Reader: &CreatePolicyReader{formats: a.formats}, 179 AuthInfo: a.authInfo, 180 Context: ctx, 181 Client: params.HTTPClient, 182 }) 183 if err != nil { 184 return nil, err 185 } 186 return result.(*CreatePolicyCreated), nil 187 188 } 189 190 /* 191 DeleteInstance deletes the specified p2 p provider instance 192 193 Delete the specified P2P provider instance 194 */ 195 func (a *Client) DeleteInstance(ctx context.Context, params *DeleteInstanceParams) (*DeleteInstanceOK, error) { 196 197 result, err := a.transport.Submit(&runtime.ClientOperation{ 198 ID: "DeleteInstance", 199 Method: "DELETE", 200 PathPattern: "/p2p/preheat/instances/{preheat_instance_name}", 201 ProducesMediaTypes: []string{"application/json"}, 202 ConsumesMediaTypes: []string{"application/json"}, 203 Schemes: []string{"http", "https"}, 204 Params: params, 205 Reader: &DeleteInstanceReader{formats: a.formats}, 206 AuthInfo: a.authInfo, 207 Context: ctx, 208 Client: params.HTTPClient, 209 }) 210 if err != nil { 211 return nil, err 212 } 213 return result.(*DeleteInstanceOK), nil 214 215 } 216 217 /* 218 DeletePolicy deletes a preheat policy 219 220 Delete a preheat policy 221 */ 222 func (a *Client) DeletePolicy(ctx context.Context, params *DeletePolicyParams) (*DeletePolicyOK, error) { 223 224 result, err := a.transport.Submit(&runtime.ClientOperation{ 225 ID: "DeletePolicy", 226 Method: "DELETE", 227 PathPattern: "/projects/{project_name}/preheat/policies/{preheat_policy_name}", 228 ProducesMediaTypes: []string{"application/json"}, 229 ConsumesMediaTypes: []string{"application/json"}, 230 Schemes: []string{"http", "https"}, 231 Params: params, 232 Reader: &DeletePolicyReader{formats: a.formats}, 233 AuthInfo: a.authInfo, 234 Context: ctx, 235 Client: params.HTTPClient, 236 }) 237 if err != nil { 238 return nil, err 239 } 240 return result.(*DeletePolicyOK), nil 241 242 } 243 244 /* 245 GetExecution gets a execution detail by id 246 247 Get a execution detail by id 248 */ 249 func (a *Client) GetExecution(ctx context.Context, params *GetExecutionParams) (*GetExecutionOK, error) { 250 251 result, err := a.transport.Submit(&runtime.ClientOperation{ 252 ID: "GetExecution", 253 Method: "GET", 254 PathPattern: "/projects/{project_name}/preheat/policies/{preheat_policy_name}/executions/{execution_id}", 255 ProducesMediaTypes: []string{"application/json"}, 256 ConsumesMediaTypes: []string{"application/json"}, 257 Schemes: []string{"http", "https"}, 258 Params: params, 259 Reader: &GetExecutionReader{formats: a.formats}, 260 AuthInfo: a.authInfo, 261 Context: ctx, 262 Client: params.HTTPClient, 263 }) 264 if err != nil { 265 return nil, err 266 } 267 return result.(*GetExecutionOK), nil 268 269 } 270 271 /* 272 GetInstance gets a p2 p provider instance 273 274 Get a P2P provider instance 275 */ 276 func (a *Client) GetInstance(ctx context.Context, params *GetInstanceParams) (*GetInstanceOK, error) { 277 278 result, err := a.transport.Submit(&runtime.ClientOperation{ 279 ID: "GetInstance", 280 Method: "GET", 281 PathPattern: "/p2p/preheat/instances/{preheat_instance_name}", 282 ProducesMediaTypes: []string{"application/json"}, 283 ConsumesMediaTypes: []string{"application/json"}, 284 Schemes: []string{"http", "https"}, 285 Params: params, 286 Reader: &GetInstanceReader{formats: a.formats}, 287 AuthInfo: a.authInfo, 288 Context: ctx, 289 Client: params.HTTPClient, 290 }) 291 if err != nil { 292 return nil, err 293 } 294 return result.(*GetInstanceOK), nil 295 296 } 297 298 /* 299 GetPolicy gets a preheat policy 300 301 Get a preheat policy 302 */ 303 func (a *Client) GetPolicy(ctx context.Context, params *GetPolicyParams) (*GetPolicyOK, error) { 304 305 result, err := a.transport.Submit(&runtime.ClientOperation{ 306 ID: "GetPolicy", 307 Method: "GET", 308 PathPattern: "/projects/{project_name}/preheat/policies/{preheat_policy_name}", 309 ProducesMediaTypes: []string{"application/json"}, 310 ConsumesMediaTypes: []string{"application/json"}, 311 Schemes: []string{"http", "https"}, 312 Params: params, 313 Reader: &GetPolicyReader{formats: a.formats}, 314 AuthInfo: a.authInfo, 315 Context: ctx, 316 Client: params.HTTPClient, 317 }) 318 if err != nil { 319 return nil, err 320 } 321 return result.(*GetPolicyOK), nil 322 323 } 324 325 /* 326 GetPreheatLog gets the log text stream of the specified task for the given execution 327 328 Get the log text stream of the specified task for the given execution 329 */ 330 func (a *Client) GetPreheatLog(ctx context.Context, params *GetPreheatLogParams) (*GetPreheatLogOK, error) { 331 332 result, err := a.transport.Submit(&runtime.ClientOperation{ 333 ID: "GetPreheatLog", 334 Method: "GET", 335 PathPattern: "/projects/{project_name}/preheat/policies/{preheat_policy_name}/executions/{execution_id}/tasks/{task_id}/logs", 336 ProducesMediaTypes: []string{"text/plain"}, 337 ConsumesMediaTypes: []string{"application/json"}, 338 Schemes: []string{"http", "https"}, 339 Params: params, 340 Reader: &GetPreheatLogReader{formats: a.formats}, 341 AuthInfo: a.authInfo, 342 Context: ctx, 343 Client: params.HTTPClient, 344 }) 345 if err != nil { 346 return nil, err 347 } 348 return result.(*GetPreheatLogOK), nil 349 350 } 351 352 /* 353 ListExecutions lists executions for the given policy 354 355 List executions for the given policy 356 */ 357 func (a *Client) ListExecutions(ctx context.Context, params *ListExecutionsParams) (*ListExecutionsOK, error) { 358 359 result, err := a.transport.Submit(&runtime.ClientOperation{ 360 ID: "ListExecutions", 361 Method: "GET", 362 PathPattern: "/projects/{project_name}/preheat/policies/{preheat_policy_name}/executions", 363 ProducesMediaTypes: []string{"application/json"}, 364 ConsumesMediaTypes: []string{"application/json"}, 365 Schemes: []string{"http", "https"}, 366 Params: params, 367 Reader: &ListExecutionsReader{formats: a.formats}, 368 AuthInfo: a.authInfo, 369 Context: ctx, 370 Client: params.HTTPClient, 371 }) 372 if err != nil { 373 return nil, err 374 } 375 return result.(*ListExecutionsOK), nil 376 377 } 378 379 /* 380 ListInstances lists p2 p provider instances 381 382 List P2P provider instances 383 */ 384 func (a *Client) ListInstances(ctx context.Context, params *ListInstancesParams) (*ListInstancesOK, error) { 385 386 result, err := a.transport.Submit(&runtime.ClientOperation{ 387 ID: "ListInstances", 388 Method: "GET", 389 PathPattern: "/p2p/preheat/instances", 390 ProducesMediaTypes: []string{"application/json"}, 391 ConsumesMediaTypes: []string{"application/json"}, 392 Schemes: []string{"http", "https"}, 393 Params: params, 394 Reader: &ListInstancesReader{formats: a.formats}, 395 AuthInfo: a.authInfo, 396 Context: ctx, 397 Client: params.HTTPClient, 398 }) 399 if err != nil { 400 return nil, err 401 } 402 return result.(*ListInstancesOK), nil 403 404 } 405 406 /* 407 ListPolicies lists preheat policies 408 409 List preheat policies 410 */ 411 func (a *Client) ListPolicies(ctx context.Context, params *ListPoliciesParams) (*ListPoliciesOK, error) { 412 413 result, err := a.transport.Submit(&runtime.ClientOperation{ 414 ID: "ListPolicies", 415 Method: "GET", 416 PathPattern: "/projects/{project_name}/preheat/policies", 417 ProducesMediaTypes: []string{"application/json"}, 418 ConsumesMediaTypes: []string{"application/json"}, 419 Schemes: []string{"http", "https"}, 420 Params: params, 421 Reader: &ListPoliciesReader{formats: a.formats}, 422 AuthInfo: a.authInfo, 423 Context: ctx, 424 Client: params.HTTPClient, 425 }) 426 if err != nil { 427 return nil, err 428 } 429 return result.(*ListPoliciesOK), nil 430 431 } 432 433 /* 434 ListProviders lists p2 p providers 435 436 List P2P providers 437 */ 438 func (a *Client) ListProviders(ctx context.Context, params *ListProvidersParams) (*ListProvidersOK, error) { 439 440 result, err := a.transport.Submit(&runtime.ClientOperation{ 441 ID: "ListProviders", 442 Method: "GET", 443 PathPattern: "/p2p/preheat/providers", 444 ProducesMediaTypes: []string{"application/json"}, 445 ConsumesMediaTypes: []string{"application/json"}, 446 Schemes: []string{"http", "https"}, 447 Params: params, 448 Reader: &ListProvidersReader{formats: a.formats}, 449 AuthInfo: a.authInfo, 450 Context: ctx, 451 Client: params.HTTPClient, 452 }) 453 if err != nil { 454 return nil, err 455 } 456 return result.(*ListProvidersOK), nil 457 458 } 459 460 /* 461 ListProvidersUnderProject gets all providers at project level 462 463 Get all providers at project level 464 */ 465 func (a *Client) ListProvidersUnderProject(ctx context.Context, params *ListProvidersUnderProjectParams) (*ListProvidersUnderProjectOK, error) { 466 467 result, err := a.transport.Submit(&runtime.ClientOperation{ 468 ID: "ListProvidersUnderProject", 469 Method: "GET", 470 PathPattern: "/projects/{project_name}/preheat/providers", 471 ProducesMediaTypes: []string{"application/json"}, 472 ConsumesMediaTypes: []string{"application/json"}, 473 Schemes: []string{"http", "https"}, 474 Params: params, 475 Reader: &ListProvidersUnderProjectReader{formats: a.formats}, 476 AuthInfo: a.authInfo, 477 Context: ctx, 478 Client: params.HTTPClient, 479 }) 480 if err != nil { 481 return nil, err 482 } 483 return result.(*ListProvidersUnderProjectOK), nil 484 485 } 486 487 /* 488 ListTasks lists all the related tasks for the given execution 489 490 List all the related tasks for the given execution 491 */ 492 func (a *Client) ListTasks(ctx context.Context, params *ListTasksParams) (*ListTasksOK, error) { 493 494 result, err := a.transport.Submit(&runtime.ClientOperation{ 495 ID: "ListTasks", 496 Method: "GET", 497 PathPattern: "/projects/{project_name}/preheat/policies/{preheat_policy_name}/executions/{execution_id}/tasks", 498 ProducesMediaTypes: []string{"application/json"}, 499 ConsumesMediaTypes: []string{"application/json"}, 500 Schemes: []string{"http", "https"}, 501 Params: params, 502 Reader: &ListTasksReader{formats: a.formats}, 503 AuthInfo: a.authInfo, 504 Context: ctx, 505 Client: params.HTTPClient, 506 }) 507 if err != nil { 508 return nil, err 509 } 510 return result.(*ListTasksOK), nil 511 512 } 513 514 /* 515 ManualPreheat manuals preheat 516 517 Manual preheat 518 */ 519 func (a *Client) ManualPreheat(ctx context.Context, params *ManualPreheatParams) (*ManualPreheatCreated, error) { 520 521 result, err := a.transport.Submit(&runtime.ClientOperation{ 522 ID: "ManualPreheat", 523 Method: "POST", 524 PathPattern: "/projects/{project_name}/preheat/policies/{preheat_policy_name}", 525 ProducesMediaTypes: []string{"application/json"}, 526 ConsumesMediaTypes: []string{"application/json"}, 527 Schemes: []string{"http", "https"}, 528 Params: params, 529 Reader: &ManualPreheatReader{formats: a.formats}, 530 AuthInfo: a.authInfo, 531 Context: ctx, 532 Client: params.HTTPClient, 533 }) 534 if err != nil { 535 return nil, err 536 } 537 return result.(*ManualPreheatCreated), nil 538 539 } 540 541 /* 542 PingInstances pings status of a instance 543 544 This endpoint checks status of a instance, the instance can be given by ID or Endpoint URL (together with credential) 545 */ 546 func (a *Client) PingInstances(ctx context.Context, params *PingInstancesParams) (*PingInstancesOK, error) { 547 548 result, err := a.transport.Submit(&runtime.ClientOperation{ 549 ID: "PingInstances", 550 Method: "POST", 551 PathPattern: "/p2p/preheat/instances/ping", 552 ProducesMediaTypes: []string{"application/json"}, 553 ConsumesMediaTypes: []string{"application/json"}, 554 Schemes: []string{"http", "https"}, 555 Params: params, 556 Reader: &PingInstancesReader{formats: a.formats}, 557 AuthInfo: a.authInfo, 558 Context: ctx, 559 Client: params.HTTPClient, 560 }) 561 if err != nil { 562 return nil, err 563 } 564 return result.(*PingInstancesOK), nil 565 566 } 567 568 /* 569 StopExecution stops a execution 570 571 Stop a execution 572 */ 573 func (a *Client) StopExecution(ctx context.Context, params *StopExecutionParams) (*StopExecutionOK, error) { 574 575 result, err := a.transport.Submit(&runtime.ClientOperation{ 576 ID: "StopExecution", 577 Method: "PATCH", 578 PathPattern: "/projects/{project_name}/preheat/policies/{preheat_policy_name}/executions/{execution_id}", 579 ProducesMediaTypes: []string{"application/json"}, 580 ConsumesMediaTypes: []string{"application/json"}, 581 Schemes: []string{"http", "https"}, 582 Params: params, 583 Reader: &StopExecutionReader{formats: a.formats}, 584 AuthInfo: a.authInfo, 585 Context: ctx, 586 Client: params.HTTPClient, 587 }) 588 if err != nil { 589 return nil, err 590 } 591 return result.(*StopExecutionOK), nil 592 593 } 594 595 /* 596 UpdateInstance updates the specified p2 p provider instance 597 598 Update the specified P2P provider instance 599 */ 600 func (a *Client) UpdateInstance(ctx context.Context, params *UpdateInstanceParams) (*UpdateInstanceOK, error) { 601 602 result, err := a.transport.Submit(&runtime.ClientOperation{ 603 ID: "UpdateInstance", 604 Method: "PUT", 605 PathPattern: "/p2p/preheat/instances/{preheat_instance_name}", 606 ProducesMediaTypes: []string{"application/json"}, 607 ConsumesMediaTypes: []string{"application/json"}, 608 Schemes: []string{"http", "https"}, 609 Params: params, 610 Reader: &UpdateInstanceReader{formats: a.formats}, 611 AuthInfo: a.authInfo, 612 Context: ctx, 613 Client: params.HTTPClient, 614 }) 615 if err != nil { 616 return nil, err 617 } 618 return result.(*UpdateInstanceOK), nil 619 620 } 621 622 /* 623 UpdatePolicy updates preheat policy 624 625 Update preheat policy 626 */ 627 func (a *Client) UpdatePolicy(ctx context.Context, params *UpdatePolicyParams) (*UpdatePolicyOK, error) { 628 629 result, err := a.transport.Submit(&runtime.ClientOperation{ 630 ID: "UpdatePolicy", 631 Method: "PUT", 632 PathPattern: "/projects/{project_name}/preheat/policies/{preheat_policy_name}", 633 ProducesMediaTypes: []string{"application/json"}, 634 ConsumesMediaTypes: []string{"application/json"}, 635 Schemes: []string{"http", "https"}, 636 Params: params, 637 Reader: &UpdatePolicyReader{formats: a.formats}, 638 AuthInfo: a.authInfo, 639 Context: ctx, 640 Client: params.HTTPClient, 641 }) 642 if err != nil { 643 return nil, err 644 } 645 return result.(*UpdatePolicyOK), nil 646 647 }