bunnyshell.com/sdk@v0.16.0/api_environment.go (about) 1 /* 2 API Bunnyshell Environments 3 4 Interact with Bunnyshell Platform 5 6 API version: 1.1.0 7 Contact: osi+support@bunnyshell.com 8 */ 9 10 // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. 11 12 package sdk 13 14 import ( 15 "bytes" 16 "context" 17 "io" 18 "net/http" 19 "net/url" 20 "strings" 21 ) 22 23 // EnvironmentAPIService EnvironmentAPI service 24 type EnvironmentAPIService service 25 26 type ApiEnvironmentCloneRequest struct { 27 ctx context.Context 28 ApiService *EnvironmentAPIService 29 id string 30 environmentCloneAction *EnvironmentCloneAction 31 } 32 33 // The new environment resource 34 func (r ApiEnvironmentCloneRequest) EnvironmentCloneAction(environmentCloneAction EnvironmentCloneAction) ApiEnvironmentCloneRequest { 35 r.environmentCloneAction = &environmentCloneAction 36 return r 37 } 38 39 func (r ApiEnvironmentCloneRequest) Execute() (*EnvironmentItem, *http.Response, error) { 40 return r.ApiService.EnvironmentCloneExecute(r) 41 } 42 43 /* 44 EnvironmentClone Clone an environment. 45 46 Clone an environment. 47 48 @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). 49 @param id Resource identifier 50 @return ApiEnvironmentCloneRequest 51 */ 52 func (a *EnvironmentAPIService) EnvironmentClone(ctx context.Context, id string) ApiEnvironmentCloneRequest { 53 return ApiEnvironmentCloneRequest{ 54 ApiService: a, 55 ctx: ctx, 56 id: id, 57 } 58 } 59 60 // Execute executes the request 61 // 62 // @return EnvironmentItem 63 func (a *EnvironmentAPIService) EnvironmentCloneExecute(r ApiEnvironmentCloneRequest) (*EnvironmentItem, *http.Response, error) { 64 var ( 65 localVarHTTPMethod = http.MethodPost 66 localVarPostBody interface{} 67 formFiles []formFile 68 localVarReturnValue *EnvironmentItem 69 ) 70 71 localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "EnvironmentAPIService.EnvironmentClone") 72 if err != nil { 73 return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} 74 } 75 76 localVarPath := localBasePath + "/v1/environments/{id}/clone" 77 localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) 78 79 localVarHeaderParams := make(map[string]string) 80 localVarQueryParams := url.Values{} 81 localVarFormParams := url.Values{} 82 if r.environmentCloneAction == nil { 83 return localVarReturnValue, nil, reportError("environmentCloneAction is required and must be specified") 84 } 85 86 // to determine the Content-Type header 87 localVarHTTPContentTypes := []string{"application/json"} 88 89 // set Content-Type header 90 localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) 91 if localVarHTTPContentType != "" { 92 localVarHeaderParams["Content-Type"] = localVarHTTPContentType 93 } 94 95 // to determine the Accept header 96 localVarHTTPHeaderAccepts := []string{"application/hal+json", "application/problem+json"} 97 98 // set Accept header 99 localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) 100 if localVarHTTPHeaderAccept != "" { 101 localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept 102 } 103 // body params 104 localVarPostBody = r.environmentCloneAction 105 if r.ctx != nil { 106 // API Key Authentication 107 if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { 108 if apiKey, ok := auth["JWT"]; ok { 109 var key string 110 if apiKey.Prefix != "" { 111 key = apiKey.Prefix + " " + apiKey.Key 112 } else { 113 key = apiKey.Key 114 } 115 localVarHeaderParams["Authorization"] = key 116 } 117 } 118 } 119 if r.ctx != nil { 120 // API Key Authentication 121 if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { 122 if apiKey, ok := auth["ApiKeyAuth"]; ok { 123 var key string 124 if apiKey.Prefix != "" { 125 key = apiKey.Prefix + " " + apiKey.Key 126 } else { 127 key = apiKey.Key 128 } 129 localVarHeaderParams["X-Auth-Token"] = key 130 } 131 } 132 } 133 req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) 134 if err != nil { 135 return localVarReturnValue, nil, err 136 } 137 138 localVarHTTPResponse, err := a.client.callAPI(req) 139 if err != nil || localVarHTTPResponse == nil { 140 return localVarReturnValue, localVarHTTPResponse, err 141 } 142 143 localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) 144 localVarHTTPResponse.Body.Close() 145 localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) 146 if err != nil { 147 return localVarReturnValue, localVarHTTPResponse, err 148 } 149 150 if localVarHTTPResponse.StatusCode >= 300 { 151 newErr := &GenericOpenAPIError{ 152 body: localVarBody, 153 error: localVarHTTPResponse.Status, 154 } 155 if localVarHTTPResponse.StatusCode >= 400 && localVarHTTPResponse.StatusCode < 500 { 156 var v ProblemGeneric 157 err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) 158 if err != nil { 159 newErr.error = err.Error() 160 return localVarReturnValue, localVarHTTPResponse, newErr 161 } 162 newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) 163 newErr.model = v 164 } 165 return localVarReturnValue, localVarHTTPResponse, newErr 166 } 167 168 err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) 169 if err != nil { 170 newErr := &GenericOpenAPIError{ 171 body: localVarBody, 172 error: err.Error(), 173 } 174 return localVarReturnValue, localVarHTTPResponse, newErr 175 } 176 177 return localVarReturnValue, localVarHTTPResponse, nil 178 } 179 180 type ApiEnvironmentCreateRequest struct { 181 ctx context.Context 182 ApiService *EnvironmentAPIService 183 environmentCreateAction *EnvironmentCreateAction 184 } 185 186 // The new environment resource 187 func (r ApiEnvironmentCreateRequest) EnvironmentCreateAction(environmentCreateAction EnvironmentCreateAction) ApiEnvironmentCreateRequest { 188 r.environmentCreateAction = &environmentCreateAction 189 return r 190 } 191 192 func (r ApiEnvironmentCreateRequest) Execute() (*EnvironmentItem, *http.Response, error) { 193 return r.ApiService.EnvironmentCreateExecute(r) 194 } 195 196 /* 197 EnvironmentCreate Creates a new environment. 198 199 Creates a new environment. 200 201 @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). 202 @return ApiEnvironmentCreateRequest 203 */ 204 func (a *EnvironmentAPIService) EnvironmentCreate(ctx context.Context) ApiEnvironmentCreateRequest { 205 return ApiEnvironmentCreateRequest{ 206 ApiService: a, 207 ctx: ctx, 208 } 209 } 210 211 // Execute executes the request 212 // 213 // @return EnvironmentItem 214 func (a *EnvironmentAPIService) EnvironmentCreateExecute(r ApiEnvironmentCreateRequest) (*EnvironmentItem, *http.Response, error) { 215 var ( 216 localVarHTTPMethod = http.MethodPost 217 localVarPostBody interface{} 218 formFiles []formFile 219 localVarReturnValue *EnvironmentItem 220 ) 221 222 localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "EnvironmentAPIService.EnvironmentCreate") 223 if err != nil { 224 return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} 225 } 226 227 localVarPath := localBasePath + "/v1/environments" 228 229 localVarHeaderParams := make(map[string]string) 230 localVarQueryParams := url.Values{} 231 localVarFormParams := url.Values{} 232 if r.environmentCreateAction == nil { 233 return localVarReturnValue, nil, reportError("environmentCreateAction is required and must be specified") 234 } 235 236 // to determine the Content-Type header 237 localVarHTTPContentTypes := []string{"application/json"} 238 239 // set Content-Type header 240 localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) 241 if localVarHTTPContentType != "" { 242 localVarHeaderParams["Content-Type"] = localVarHTTPContentType 243 } 244 245 // to determine the Accept header 246 localVarHTTPHeaderAccepts := []string{"application/hal+json", "application/problem+json"} 247 248 // set Accept header 249 localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) 250 if localVarHTTPHeaderAccept != "" { 251 localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept 252 } 253 // body params 254 localVarPostBody = r.environmentCreateAction 255 if r.ctx != nil { 256 // API Key Authentication 257 if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { 258 if apiKey, ok := auth["JWT"]; ok { 259 var key string 260 if apiKey.Prefix != "" { 261 key = apiKey.Prefix + " " + apiKey.Key 262 } else { 263 key = apiKey.Key 264 } 265 localVarHeaderParams["Authorization"] = key 266 } 267 } 268 } 269 if r.ctx != nil { 270 // API Key Authentication 271 if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { 272 if apiKey, ok := auth["ApiKeyAuth"]; ok { 273 var key string 274 if apiKey.Prefix != "" { 275 key = apiKey.Prefix + " " + apiKey.Key 276 } else { 277 key = apiKey.Key 278 } 279 localVarHeaderParams["X-Auth-Token"] = key 280 } 281 } 282 } 283 req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) 284 if err != nil { 285 return localVarReturnValue, nil, err 286 } 287 288 localVarHTTPResponse, err := a.client.callAPI(req) 289 if err != nil || localVarHTTPResponse == nil { 290 return localVarReturnValue, localVarHTTPResponse, err 291 } 292 293 localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) 294 localVarHTTPResponse.Body.Close() 295 localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) 296 if err != nil { 297 return localVarReturnValue, localVarHTTPResponse, err 298 } 299 300 if localVarHTTPResponse.StatusCode >= 300 { 301 newErr := &GenericOpenAPIError{ 302 body: localVarBody, 303 error: localVarHTTPResponse.Status, 304 } 305 if localVarHTTPResponse.StatusCode >= 400 && localVarHTTPResponse.StatusCode < 500 { 306 var v ProblemGeneric 307 err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) 308 if err != nil { 309 newErr.error = err.Error() 310 return localVarReturnValue, localVarHTTPResponse, newErr 311 } 312 newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) 313 newErr.model = v 314 } 315 return localVarReturnValue, localVarHTTPResponse, newErr 316 } 317 318 err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) 319 if err != nil { 320 newErr := &GenericOpenAPIError{ 321 body: localVarBody, 322 error: err.Error(), 323 } 324 return localVarReturnValue, localVarHTTPResponse, newErr 325 } 326 327 return localVarReturnValue, localVarHTTPResponse, nil 328 } 329 330 type ApiEnvironmentDefinitionRequest struct { 331 ctx context.Context 332 ApiService *EnvironmentAPIService 333 id string 334 } 335 336 func (r ApiEnvironmentDefinitionRequest) Execute() (map[string]interface{}, *http.Response, error) { 337 return r.ApiService.EnvironmentDefinitionExecute(r) 338 } 339 340 /* 341 EnvironmentDefinition View the bunnyshell manifest for the environment 342 343 View the bunnyshell manifest for the environment 344 345 @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). 346 @param id Resource identifier 347 @return ApiEnvironmentDefinitionRequest 348 */ 349 func (a *EnvironmentAPIService) EnvironmentDefinition(ctx context.Context, id string) ApiEnvironmentDefinitionRequest { 350 return ApiEnvironmentDefinitionRequest{ 351 ApiService: a, 352 ctx: ctx, 353 id: id, 354 } 355 } 356 357 // Execute executes the request 358 // 359 // @return map[string]interface{} 360 func (a *EnvironmentAPIService) EnvironmentDefinitionExecute(r ApiEnvironmentDefinitionRequest) (map[string]interface{}, *http.Response, error) { 361 var ( 362 localVarHTTPMethod = http.MethodGet 363 localVarPostBody interface{} 364 formFiles []formFile 365 localVarReturnValue map[string]interface{} 366 ) 367 368 localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "EnvironmentAPIService.EnvironmentDefinition") 369 if err != nil { 370 return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} 371 } 372 373 localVarPath := localBasePath + "/v1/environments/{id}/definition" 374 localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) 375 376 localVarHeaderParams := make(map[string]string) 377 localVarQueryParams := url.Values{} 378 localVarFormParams := url.Values{} 379 380 // to determine the Content-Type header 381 localVarHTTPContentTypes := []string{} 382 383 // set Content-Type header 384 localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) 385 if localVarHTTPContentType != "" { 386 localVarHeaderParams["Content-Type"] = localVarHTTPContentType 387 } 388 389 // to determine the Accept header 390 localVarHTTPHeaderAccepts := []string{"application/x+yaml", "application/problem+json"} 391 392 // set Accept header 393 localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) 394 if localVarHTTPHeaderAccept != "" { 395 localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept 396 } 397 if r.ctx != nil { 398 // API Key Authentication 399 if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { 400 if apiKey, ok := auth["JWT"]; ok { 401 var key string 402 if apiKey.Prefix != "" { 403 key = apiKey.Prefix + " " + apiKey.Key 404 } else { 405 key = apiKey.Key 406 } 407 localVarHeaderParams["Authorization"] = key 408 } 409 } 410 } 411 if r.ctx != nil { 412 // API Key Authentication 413 if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { 414 if apiKey, ok := auth["ApiKeyAuth"]; ok { 415 var key string 416 if apiKey.Prefix != "" { 417 key = apiKey.Prefix + " " + apiKey.Key 418 } else { 419 key = apiKey.Key 420 } 421 localVarHeaderParams["X-Auth-Token"] = key 422 } 423 } 424 } 425 req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) 426 if err != nil { 427 return localVarReturnValue, nil, err 428 } 429 430 localVarHTTPResponse, err := a.client.callAPI(req) 431 if err != nil || localVarHTTPResponse == nil { 432 return localVarReturnValue, localVarHTTPResponse, err 433 } 434 435 localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) 436 localVarHTTPResponse.Body.Close() 437 localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) 438 if err != nil { 439 return localVarReturnValue, localVarHTTPResponse, err 440 } 441 442 if localVarHTTPResponse.StatusCode >= 300 { 443 newErr := &GenericOpenAPIError{ 444 body: localVarBody, 445 error: localVarHTTPResponse.Status, 446 } 447 if localVarHTTPResponse.StatusCode >= 400 && localVarHTTPResponse.StatusCode < 500 { 448 var v ProblemGeneric 449 err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) 450 if err != nil { 451 newErr.error = err.Error() 452 return localVarReturnValue, localVarHTTPResponse, newErr 453 } 454 newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) 455 newErr.model = v 456 } 457 return localVarReturnValue, localVarHTTPResponse, newErr 458 } 459 460 err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) 461 if err != nil { 462 newErr := &GenericOpenAPIError{ 463 body: localVarBody, 464 error: err.Error(), 465 } 466 return localVarReturnValue, localVarHTTPResponse, newErr 467 } 468 469 return localVarReturnValue, localVarHTTPResponse, nil 470 } 471 472 type ApiEnvironmentDeleteRequest struct { 473 ctx context.Context 474 ApiService *EnvironmentAPIService 475 id string 476 body *interface{} 477 } 478 479 // No Request Body 480 func (r ApiEnvironmentDeleteRequest) Body(body interface{}) ApiEnvironmentDeleteRequest { 481 r.body = &body 482 return r 483 } 484 485 func (r ApiEnvironmentDeleteRequest) Execute() (*EventItem, *http.Response, error) { 486 return r.ApiService.EnvironmentDeleteExecute(r) 487 } 488 489 /* 490 EnvironmentDelete Delete a specific environment. 491 492 Delete a specific environment. 493 494 @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). 495 @param id Resource identifier 496 @return ApiEnvironmentDeleteRequest 497 */ 498 func (a *EnvironmentAPIService) EnvironmentDelete(ctx context.Context, id string) ApiEnvironmentDeleteRequest { 499 return ApiEnvironmentDeleteRequest{ 500 ApiService: a, 501 ctx: ctx, 502 id: id, 503 } 504 } 505 506 // Execute executes the request 507 // 508 // @return EventItem 509 func (a *EnvironmentAPIService) EnvironmentDeleteExecute(r ApiEnvironmentDeleteRequest) (*EventItem, *http.Response, error) { 510 var ( 511 localVarHTTPMethod = http.MethodPost 512 localVarPostBody interface{} 513 formFiles []formFile 514 localVarReturnValue *EventItem 515 ) 516 517 localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "EnvironmentAPIService.EnvironmentDelete") 518 if err != nil { 519 return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} 520 } 521 522 localVarPath := localBasePath + "/v1/environments/{id}/delete" 523 localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) 524 525 localVarHeaderParams := make(map[string]string) 526 localVarQueryParams := url.Values{} 527 localVarFormParams := url.Values{} 528 529 // to determine the Content-Type header 530 localVarHTTPContentTypes := []string{"application/json"} 531 532 // set Content-Type header 533 localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) 534 if localVarHTTPContentType != "" { 535 localVarHeaderParams["Content-Type"] = localVarHTTPContentType 536 } 537 538 // to determine the Accept header 539 localVarHTTPHeaderAccepts := []string{"application/hal+json", "application/problem+json"} 540 541 // set Accept header 542 localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) 543 if localVarHTTPHeaderAccept != "" { 544 localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept 545 } 546 // body params 547 localVarPostBody = r.body 548 if r.ctx != nil { 549 // API Key Authentication 550 if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { 551 if apiKey, ok := auth["JWT"]; ok { 552 var key string 553 if apiKey.Prefix != "" { 554 key = apiKey.Prefix + " " + apiKey.Key 555 } else { 556 key = apiKey.Key 557 } 558 localVarHeaderParams["Authorization"] = key 559 } 560 } 561 } 562 if r.ctx != nil { 563 // API Key Authentication 564 if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { 565 if apiKey, ok := auth["ApiKeyAuth"]; ok { 566 var key string 567 if apiKey.Prefix != "" { 568 key = apiKey.Prefix + " " + apiKey.Key 569 } else { 570 key = apiKey.Key 571 } 572 localVarHeaderParams["X-Auth-Token"] = key 573 } 574 } 575 } 576 req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) 577 if err != nil { 578 return localVarReturnValue, nil, err 579 } 580 581 localVarHTTPResponse, err := a.client.callAPI(req) 582 if err != nil || localVarHTTPResponse == nil { 583 return localVarReturnValue, localVarHTTPResponse, err 584 } 585 586 localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) 587 localVarHTTPResponse.Body.Close() 588 localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) 589 if err != nil { 590 return localVarReturnValue, localVarHTTPResponse, err 591 } 592 593 if localVarHTTPResponse.StatusCode >= 300 { 594 newErr := &GenericOpenAPIError{ 595 body: localVarBody, 596 error: localVarHTTPResponse.Status, 597 } 598 if localVarHTTPResponse.StatusCode >= 400 && localVarHTTPResponse.StatusCode < 500 { 599 var v ProblemGeneric 600 err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) 601 if err != nil { 602 newErr.error = err.Error() 603 return localVarReturnValue, localVarHTTPResponse, newErr 604 } 605 newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) 606 newErr.model = v 607 } 608 return localVarReturnValue, localVarHTTPResponse, newErr 609 } 610 611 err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) 612 if err != nil { 613 newErr := &GenericOpenAPIError{ 614 body: localVarBody, 615 error: err.Error(), 616 } 617 return localVarReturnValue, localVarHTTPResponse, newErr 618 } 619 620 return localVarReturnValue, localVarHTTPResponse, nil 621 } 622 623 type ApiEnvironmentDeployRequest struct { 624 ctx context.Context 625 ApiService *EnvironmentAPIService 626 id string 627 environmentPartialDeployAction *EnvironmentPartialDeployAction 628 } 629 630 // The new environment resource 631 func (r ApiEnvironmentDeployRequest) EnvironmentPartialDeployAction(environmentPartialDeployAction EnvironmentPartialDeployAction) ApiEnvironmentDeployRequest { 632 r.environmentPartialDeployAction = &environmentPartialDeployAction 633 return r 634 } 635 636 func (r ApiEnvironmentDeployRequest) Execute() (*EventItem, *http.Response, error) { 637 return r.ApiService.EnvironmentDeployExecute(r) 638 } 639 640 /* 641 EnvironmentDeploy Deploy an environment. 642 643 Deploy an environment. 644 645 @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). 646 @param id Resource identifier 647 @return ApiEnvironmentDeployRequest 648 */ 649 func (a *EnvironmentAPIService) EnvironmentDeploy(ctx context.Context, id string) ApiEnvironmentDeployRequest { 650 return ApiEnvironmentDeployRequest{ 651 ApiService: a, 652 ctx: ctx, 653 id: id, 654 } 655 } 656 657 // Execute executes the request 658 // 659 // @return EventItem 660 func (a *EnvironmentAPIService) EnvironmentDeployExecute(r ApiEnvironmentDeployRequest) (*EventItem, *http.Response, error) { 661 var ( 662 localVarHTTPMethod = http.MethodPost 663 localVarPostBody interface{} 664 formFiles []formFile 665 localVarReturnValue *EventItem 666 ) 667 668 localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "EnvironmentAPIService.EnvironmentDeploy") 669 if err != nil { 670 return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} 671 } 672 673 localVarPath := localBasePath + "/v1/environments/{id}/deploy" 674 localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) 675 676 localVarHeaderParams := make(map[string]string) 677 localVarQueryParams := url.Values{} 678 localVarFormParams := url.Values{} 679 if r.environmentPartialDeployAction == nil { 680 return localVarReturnValue, nil, reportError("environmentPartialDeployAction is required and must be specified") 681 } 682 683 // to determine the Content-Type header 684 localVarHTTPContentTypes := []string{"application/json"} 685 686 // set Content-Type header 687 localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) 688 if localVarHTTPContentType != "" { 689 localVarHeaderParams["Content-Type"] = localVarHTTPContentType 690 } 691 692 // to determine the Accept header 693 localVarHTTPHeaderAccepts := []string{"application/hal+json", "application/problem+json"} 694 695 // set Accept header 696 localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) 697 if localVarHTTPHeaderAccept != "" { 698 localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept 699 } 700 // body params 701 localVarPostBody = r.environmentPartialDeployAction 702 if r.ctx != nil { 703 // API Key Authentication 704 if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { 705 if apiKey, ok := auth["JWT"]; ok { 706 var key string 707 if apiKey.Prefix != "" { 708 key = apiKey.Prefix + " " + apiKey.Key 709 } else { 710 key = apiKey.Key 711 } 712 localVarHeaderParams["Authorization"] = key 713 } 714 } 715 } 716 if r.ctx != nil { 717 // API Key Authentication 718 if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { 719 if apiKey, ok := auth["ApiKeyAuth"]; ok { 720 var key string 721 if apiKey.Prefix != "" { 722 key = apiKey.Prefix + " " + apiKey.Key 723 } else { 724 key = apiKey.Key 725 } 726 localVarHeaderParams["X-Auth-Token"] = key 727 } 728 } 729 } 730 req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) 731 if err != nil { 732 return localVarReturnValue, nil, err 733 } 734 735 localVarHTTPResponse, err := a.client.callAPI(req) 736 if err != nil || localVarHTTPResponse == nil { 737 return localVarReturnValue, localVarHTTPResponse, err 738 } 739 740 localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) 741 localVarHTTPResponse.Body.Close() 742 localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) 743 if err != nil { 744 return localVarReturnValue, localVarHTTPResponse, err 745 } 746 747 if localVarHTTPResponse.StatusCode >= 300 { 748 newErr := &GenericOpenAPIError{ 749 body: localVarBody, 750 error: localVarHTTPResponse.Status, 751 } 752 if localVarHTTPResponse.StatusCode >= 400 && localVarHTTPResponse.StatusCode < 500 { 753 var v ProblemGeneric 754 err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) 755 if err != nil { 756 newErr.error = err.Error() 757 return localVarReturnValue, localVarHTTPResponse, newErr 758 } 759 newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) 760 newErr.model = v 761 } 762 return localVarReturnValue, localVarHTTPResponse, newErr 763 } 764 765 err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) 766 if err != nil { 767 newErr := &GenericOpenAPIError{ 768 body: localVarBody, 769 error: err.Error(), 770 } 771 return localVarReturnValue, localVarHTTPResponse, newErr 772 } 773 774 return localVarReturnValue, localVarHTTPResponse, nil 775 } 776 777 type ApiEnvironmentEditBuildSettingsRequest struct { 778 ctx context.Context 779 ApiService *EnvironmentAPIService 780 id string 781 environmentEditBuildSettingsAction *EnvironmentEditBuildSettingsAction 782 } 783 784 // The updated environment resource 785 func (r ApiEnvironmentEditBuildSettingsRequest) EnvironmentEditBuildSettingsAction(environmentEditBuildSettingsAction EnvironmentEditBuildSettingsAction) ApiEnvironmentEditBuildSettingsRequest { 786 r.environmentEditBuildSettingsAction = &environmentEditBuildSettingsAction 787 return r 788 } 789 790 func (r ApiEnvironmentEditBuildSettingsRequest) Execute() (*EnvironmentItem, *http.Response, error) { 791 return r.ApiService.EnvironmentEditBuildSettingsExecute(r) 792 } 793 794 /* 795 EnvironmentEditBuildSettings Edit the build settings of an environment. 796 797 Edit the build settings of an environment. 798 799 @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). 800 @param id Resource identifier 801 @return ApiEnvironmentEditBuildSettingsRequest 802 */ 803 func (a *EnvironmentAPIService) EnvironmentEditBuildSettings(ctx context.Context, id string) ApiEnvironmentEditBuildSettingsRequest { 804 return ApiEnvironmentEditBuildSettingsRequest{ 805 ApiService: a, 806 ctx: ctx, 807 id: id, 808 } 809 } 810 811 // Execute executes the request 812 // 813 // @return EnvironmentItem 814 func (a *EnvironmentAPIService) EnvironmentEditBuildSettingsExecute(r ApiEnvironmentEditBuildSettingsRequest) (*EnvironmentItem, *http.Response, error) { 815 var ( 816 localVarHTTPMethod = http.MethodPatch 817 localVarPostBody interface{} 818 formFiles []formFile 819 localVarReturnValue *EnvironmentItem 820 ) 821 822 localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "EnvironmentAPIService.EnvironmentEditBuildSettings") 823 if err != nil { 824 return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} 825 } 826 827 localVarPath := localBasePath + "/v1/environments/{id}/build-settings" 828 localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) 829 830 localVarHeaderParams := make(map[string]string) 831 localVarQueryParams := url.Values{} 832 localVarFormParams := url.Values{} 833 if r.environmentEditBuildSettingsAction == nil { 834 return localVarReturnValue, nil, reportError("environmentEditBuildSettingsAction is required and must be specified") 835 } 836 837 // to determine the Content-Type header 838 localVarHTTPContentTypes := []string{"application/json"} 839 840 // set Content-Type header 841 localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) 842 if localVarHTTPContentType != "" { 843 localVarHeaderParams["Content-Type"] = localVarHTTPContentType 844 } 845 846 // to determine the Accept header 847 localVarHTTPHeaderAccepts := []string{"application/hal+json", "application/problem+json"} 848 849 // set Accept header 850 localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) 851 if localVarHTTPHeaderAccept != "" { 852 localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept 853 } 854 // body params 855 localVarPostBody = r.environmentEditBuildSettingsAction 856 if r.ctx != nil { 857 // API Key Authentication 858 if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { 859 if apiKey, ok := auth["JWT"]; ok { 860 var key string 861 if apiKey.Prefix != "" { 862 key = apiKey.Prefix + " " + apiKey.Key 863 } else { 864 key = apiKey.Key 865 } 866 localVarHeaderParams["Authorization"] = key 867 } 868 } 869 } 870 if r.ctx != nil { 871 // API Key Authentication 872 if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { 873 if apiKey, ok := auth["ApiKeyAuth"]; ok { 874 var key string 875 if apiKey.Prefix != "" { 876 key = apiKey.Prefix + " " + apiKey.Key 877 } else { 878 key = apiKey.Key 879 } 880 localVarHeaderParams["X-Auth-Token"] = key 881 } 882 } 883 } 884 req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) 885 if err != nil { 886 return localVarReturnValue, nil, err 887 } 888 889 localVarHTTPResponse, err := a.client.callAPI(req) 890 if err != nil || localVarHTTPResponse == nil { 891 return localVarReturnValue, localVarHTTPResponse, err 892 } 893 894 localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) 895 localVarHTTPResponse.Body.Close() 896 localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) 897 if err != nil { 898 return localVarReturnValue, localVarHTTPResponse, err 899 } 900 901 if localVarHTTPResponse.StatusCode >= 300 { 902 newErr := &GenericOpenAPIError{ 903 body: localVarBody, 904 error: localVarHTTPResponse.Status, 905 } 906 if localVarHTTPResponse.StatusCode >= 400 && localVarHTTPResponse.StatusCode < 500 { 907 var v ProblemGeneric 908 err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) 909 if err != nil { 910 newErr.error = err.Error() 911 return localVarReturnValue, localVarHTTPResponse, newErr 912 } 913 newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) 914 newErr.model = v 915 } 916 return localVarReturnValue, localVarHTTPResponse, newErr 917 } 918 919 err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) 920 if err != nil { 921 newErr := &GenericOpenAPIError{ 922 body: localVarBody, 923 error: err.Error(), 924 } 925 return localVarReturnValue, localVarHTTPResponse, newErr 926 } 927 928 return localVarReturnValue, localVarHTTPResponse, nil 929 } 930 931 type ApiEnvironmentEditComponentsRequest struct { 932 ctx context.Context 933 ApiService *EnvironmentAPIService 934 id string 935 environmentEditComponentsAction *EnvironmentEditComponentsAction 936 } 937 938 // The updated environment resource 939 func (r ApiEnvironmentEditComponentsRequest) EnvironmentEditComponentsAction(environmentEditComponentsAction EnvironmentEditComponentsAction) ApiEnvironmentEditComponentsRequest { 940 r.environmentEditComponentsAction = &environmentEditComponentsAction 941 return r 942 } 943 944 func (r ApiEnvironmentEditComponentsRequest) Execute() (*EnvironmentItem, *http.Response, error) { 945 return r.ApiService.EnvironmentEditComponentsExecute(r) 946 } 947 948 /* 949 EnvironmentEditComponents Edit the components of an environment. 950 951 Edit the components of an environment. 952 953 @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). 954 @param id Resource identifier 955 @return ApiEnvironmentEditComponentsRequest 956 */ 957 func (a *EnvironmentAPIService) EnvironmentEditComponents(ctx context.Context, id string) ApiEnvironmentEditComponentsRequest { 958 return ApiEnvironmentEditComponentsRequest{ 959 ApiService: a, 960 ctx: ctx, 961 id: id, 962 } 963 } 964 965 // Execute executes the request 966 // 967 // @return EnvironmentItem 968 func (a *EnvironmentAPIService) EnvironmentEditComponentsExecute(r ApiEnvironmentEditComponentsRequest) (*EnvironmentItem, *http.Response, error) { 969 var ( 970 localVarHTTPMethod = http.MethodPut 971 localVarPostBody interface{} 972 formFiles []formFile 973 localVarReturnValue *EnvironmentItem 974 ) 975 976 localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "EnvironmentAPIService.EnvironmentEditComponents") 977 if err != nil { 978 return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} 979 } 980 981 localVarPath := localBasePath + "/v1/environments/{id}/components" 982 localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) 983 984 localVarHeaderParams := make(map[string]string) 985 localVarQueryParams := url.Values{} 986 localVarFormParams := url.Values{} 987 if r.environmentEditComponentsAction == nil { 988 return localVarReturnValue, nil, reportError("environmentEditComponentsAction is required and must be specified") 989 } 990 991 // to determine the Content-Type header 992 localVarHTTPContentTypes := []string{"application/json"} 993 994 // set Content-Type header 995 localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) 996 if localVarHTTPContentType != "" { 997 localVarHeaderParams["Content-Type"] = localVarHTTPContentType 998 } 999 1000 // to determine the Accept header 1001 localVarHTTPHeaderAccepts := []string{"application/hal+json", "application/problem+json"} 1002 1003 // set Accept header 1004 localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) 1005 if localVarHTTPHeaderAccept != "" { 1006 localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept 1007 } 1008 // body params 1009 localVarPostBody = r.environmentEditComponentsAction 1010 if r.ctx != nil { 1011 // API Key Authentication 1012 if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { 1013 if apiKey, ok := auth["JWT"]; ok { 1014 var key string 1015 if apiKey.Prefix != "" { 1016 key = apiKey.Prefix + " " + apiKey.Key 1017 } else { 1018 key = apiKey.Key 1019 } 1020 localVarHeaderParams["Authorization"] = key 1021 } 1022 } 1023 } 1024 if r.ctx != nil { 1025 // API Key Authentication 1026 if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { 1027 if apiKey, ok := auth["ApiKeyAuth"]; ok { 1028 var key string 1029 if apiKey.Prefix != "" { 1030 key = apiKey.Prefix + " " + apiKey.Key 1031 } else { 1032 key = apiKey.Key 1033 } 1034 localVarHeaderParams["X-Auth-Token"] = key 1035 } 1036 } 1037 } 1038 req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) 1039 if err != nil { 1040 return localVarReturnValue, nil, err 1041 } 1042 1043 localVarHTTPResponse, err := a.client.callAPI(req) 1044 if err != nil || localVarHTTPResponse == nil { 1045 return localVarReturnValue, localVarHTTPResponse, err 1046 } 1047 1048 localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) 1049 localVarHTTPResponse.Body.Close() 1050 localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) 1051 if err != nil { 1052 return localVarReturnValue, localVarHTTPResponse, err 1053 } 1054 1055 if localVarHTTPResponse.StatusCode >= 300 { 1056 newErr := &GenericOpenAPIError{ 1057 body: localVarBody, 1058 error: localVarHTTPResponse.Status, 1059 } 1060 if localVarHTTPResponse.StatusCode >= 400 && localVarHTTPResponse.StatusCode < 500 { 1061 var v ProblemGeneric 1062 err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) 1063 if err != nil { 1064 newErr.error = err.Error() 1065 return localVarReturnValue, localVarHTTPResponse, newErr 1066 } 1067 newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) 1068 newErr.model = v 1069 } 1070 return localVarReturnValue, localVarHTTPResponse, newErr 1071 } 1072 1073 err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) 1074 if err != nil { 1075 newErr := &GenericOpenAPIError{ 1076 body: localVarBody, 1077 error: err.Error(), 1078 } 1079 return localVarReturnValue, localVarHTTPResponse, newErr 1080 } 1081 1082 return localVarReturnValue, localVarHTTPResponse, nil 1083 } 1084 1085 type ApiEnvironmentEditConfigurationRequest struct { 1086 ctx context.Context 1087 ApiService *EnvironmentAPIService 1088 id string 1089 environmentEditConfiguration *EnvironmentEditConfiguration 1090 } 1091 1092 // The updated environment resource 1093 func (r ApiEnvironmentEditConfigurationRequest) EnvironmentEditConfiguration(environmentEditConfiguration EnvironmentEditConfiguration) ApiEnvironmentEditConfigurationRequest { 1094 r.environmentEditConfiguration = &environmentEditConfiguration 1095 return r 1096 } 1097 1098 func (r ApiEnvironmentEditConfigurationRequest) Execute() (*EnvironmentItem, *http.Response, error) { 1099 return r.ApiService.EnvironmentEditConfigurationExecute(r) 1100 } 1101 1102 /* 1103 EnvironmentEditConfiguration Edit an environment. 1104 1105 Edit an environment. 1106 1107 @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). 1108 @param id Resource identifier 1109 @return ApiEnvironmentEditConfigurationRequest 1110 */ 1111 func (a *EnvironmentAPIService) EnvironmentEditConfiguration(ctx context.Context, id string) ApiEnvironmentEditConfigurationRequest { 1112 return ApiEnvironmentEditConfigurationRequest{ 1113 ApiService: a, 1114 ctx: ctx, 1115 id: id, 1116 } 1117 } 1118 1119 // Execute executes the request 1120 // 1121 // @return EnvironmentItem 1122 func (a *EnvironmentAPIService) EnvironmentEditConfigurationExecute(r ApiEnvironmentEditConfigurationRequest) (*EnvironmentItem, *http.Response, error) { 1123 var ( 1124 localVarHTTPMethod = http.MethodPut 1125 localVarPostBody interface{} 1126 formFiles []formFile 1127 localVarReturnValue *EnvironmentItem 1128 ) 1129 1130 localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "EnvironmentAPIService.EnvironmentEditConfiguration") 1131 if err != nil { 1132 return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} 1133 } 1134 1135 localVarPath := localBasePath + "/v1/environments/{id}/configuration" 1136 localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) 1137 1138 localVarHeaderParams := make(map[string]string) 1139 localVarQueryParams := url.Values{} 1140 localVarFormParams := url.Values{} 1141 if r.environmentEditConfiguration == nil { 1142 return localVarReturnValue, nil, reportError("environmentEditConfiguration is required and must be specified") 1143 } 1144 1145 // to determine the Content-Type header 1146 localVarHTTPContentTypes := []string{"application/json"} 1147 1148 // set Content-Type header 1149 localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) 1150 if localVarHTTPContentType != "" { 1151 localVarHeaderParams["Content-Type"] = localVarHTTPContentType 1152 } 1153 1154 // to determine the Accept header 1155 localVarHTTPHeaderAccepts := []string{"application/hal+json", "application/problem+json"} 1156 1157 // set Accept header 1158 localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) 1159 if localVarHTTPHeaderAccept != "" { 1160 localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept 1161 } 1162 // body params 1163 localVarPostBody = r.environmentEditConfiguration 1164 if r.ctx != nil { 1165 // API Key Authentication 1166 if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { 1167 if apiKey, ok := auth["JWT"]; ok { 1168 var key string 1169 if apiKey.Prefix != "" { 1170 key = apiKey.Prefix + " " + apiKey.Key 1171 } else { 1172 key = apiKey.Key 1173 } 1174 localVarHeaderParams["Authorization"] = key 1175 } 1176 } 1177 } 1178 if r.ctx != nil { 1179 // API Key Authentication 1180 if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { 1181 if apiKey, ok := auth["ApiKeyAuth"]; ok { 1182 var key string 1183 if apiKey.Prefix != "" { 1184 key = apiKey.Prefix + " " + apiKey.Key 1185 } else { 1186 key = apiKey.Key 1187 } 1188 localVarHeaderParams["X-Auth-Token"] = key 1189 } 1190 } 1191 } 1192 req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) 1193 if err != nil { 1194 return localVarReturnValue, nil, err 1195 } 1196 1197 localVarHTTPResponse, err := a.client.callAPI(req) 1198 if err != nil || localVarHTTPResponse == nil { 1199 return localVarReturnValue, localVarHTTPResponse, err 1200 } 1201 1202 localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) 1203 localVarHTTPResponse.Body.Close() 1204 localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) 1205 if err != nil { 1206 return localVarReturnValue, localVarHTTPResponse, err 1207 } 1208 1209 if localVarHTTPResponse.StatusCode >= 300 { 1210 newErr := &GenericOpenAPIError{ 1211 body: localVarBody, 1212 error: localVarHTTPResponse.Status, 1213 } 1214 if localVarHTTPResponse.StatusCode >= 400 && localVarHTTPResponse.StatusCode < 500 { 1215 var v ProblemGeneric 1216 err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) 1217 if err != nil { 1218 newErr.error = err.Error() 1219 return localVarReturnValue, localVarHTTPResponse, newErr 1220 } 1221 newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) 1222 newErr.model = v 1223 } 1224 return localVarReturnValue, localVarHTTPResponse, newErr 1225 } 1226 1227 err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) 1228 if err != nil { 1229 newErr := &GenericOpenAPIError{ 1230 body: localVarBody, 1231 error: err.Error(), 1232 } 1233 return localVarReturnValue, localVarHTTPResponse, newErr 1234 } 1235 1236 return localVarReturnValue, localVarHTTPResponse, nil 1237 } 1238 1239 type ApiEnvironmentEditSettingsRequest struct { 1240 ctx context.Context 1241 ApiService *EnvironmentAPIService 1242 id string 1243 environmentEditSettings *EnvironmentEditSettings 1244 } 1245 1246 // The updated environment resource 1247 func (r ApiEnvironmentEditSettingsRequest) EnvironmentEditSettings(environmentEditSettings EnvironmentEditSettings) ApiEnvironmentEditSettingsRequest { 1248 r.environmentEditSettings = &environmentEditSettings 1249 return r 1250 } 1251 1252 func (r ApiEnvironmentEditSettingsRequest) Execute() (*EnvironmentItem, *http.Response, error) { 1253 return r.ApiService.EnvironmentEditSettingsExecute(r) 1254 } 1255 1256 /* 1257 EnvironmentEditSettings Edit an environment. 1258 1259 Edit an environment. 1260 1261 @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). 1262 @param id Resource identifier 1263 @return ApiEnvironmentEditSettingsRequest 1264 */ 1265 func (a *EnvironmentAPIService) EnvironmentEditSettings(ctx context.Context, id string) ApiEnvironmentEditSettingsRequest { 1266 return ApiEnvironmentEditSettingsRequest{ 1267 ApiService: a, 1268 ctx: ctx, 1269 id: id, 1270 } 1271 } 1272 1273 // Execute executes the request 1274 // 1275 // @return EnvironmentItem 1276 func (a *EnvironmentAPIService) EnvironmentEditSettingsExecute(r ApiEnvironmentEditSettingsRequest) (*EnvironmentItem, *http.Response, error) { 1277 var ( 1278 localVarHTTPMethod = http.MethodPut 1279 localVarPostBody interface{} 1280 formFiles []formFile 1281 localVarReturnValue *EnvironmentItem 1282 ) 1283 1284 localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "EnvironmentAPIService.EnvironmentEditSettings") 1285 if err != nil { 1286 return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} 1287 } 1288 1289 localVarPath := localBasePath + "/v1/environments/{id}/settings" 1290 localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) 1291 1292 localVarHeaderParams := make(map[string]string) 1293 localVarQueryParams := url.Values{} 1294 localVarFormParams := url.Values{} 1295 if r.environmentEditSettings == nil { 1296 return localVarReturnValue, nil, reportError("environmentEditSettings is required and must be specified") 1297 } 1298 1299 // to determine the Content-Type header 1300 localVarHTTPContentTypes := []string{"application/json"} 1301 1302 // set Content-Type header 1303 localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) 1304 if localVarHTTPContentType != "" { 1305 localVarHeaderParams["Content-Type"] = localVarHTTPContentType 1306 } 1307 1308 // to determine the Accept header 1309 localVarHTTPHeaderAccepts := []string{"application/hal+json", "application/problem+json"} 1310 1311 // set Accept header 1312 localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) 1313 if localVarHTTPHeaderAccept != "" { 1314 localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept 1315 } 1316 // body params 1317 localVarPostBody = r.environmentEditSettings 1318 if r.ctx != nil { 1319 // API Key Authentication 1320 if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { 1321 if apiKey, ok := auth["JWT"]; ok { 1322 var key string 1323 if apiKey.Prefix != "" { 1324 key = apiKey.Prefix + " " + apiKey.Key 1325 } else { 1326 key = apiKey.Key 1327 } 1328 localVarHeaderParams["Authorization"] = key 1329 } 1330 } 1331 } 1332 if r.ctx != nil { 1333 // API Key Authentication 1334 if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { 1335 if apiKey, ok := auth["ApiKeyAuth"]; ok { 1336 var key string 1337 if apiKey.Prefix != "" { 1338 key = apiKey.Prefix + " " + apiKey.Key 1339 } else { 1340 key = apiKey.Key 1341 } 1342 localVarHeaderParams["X-Auth-Token"] = key 1343 } 1344 } 1345 } 1346 req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) 1347 if err != nil { 1348 return localVarReturnValue, nil, err 1349 } 1350 1351 localVarHTTPResponse, err := a.client.callAPI(req) 1352 if err != nil || localVarHTTPResponse == nil { 1353 return localVarReturnValue, localVarHTTPResponse, err 1354 } 1355 1356 localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) 1357 localVarHTTPResponse.Body.Close() 1358 localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) 1359 if err != nil { 1360 return localVarReturnValue, localVarHTTPResponse, err 1361 } 1362 1363 if localVarHTTPResponse.StatusCode >= 300 { 1364 newErr := &GenericOpenAPIError{ 1365 body: localVarBody, 1366 error: localVarHTTPResponse.Status, 1367 } 1368 if localVarHTTPResponse.StatusCode >= 400 && localVarHTTPResponse.StatusCode < 500 { 1369 var v ProblemGeneric 1370 err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) 1371 if err != nil { 1372 newErr.error = err.Error() 1373 return localVarReturnValue, localVarHTTPResponse, newErr 1374 } 1375 newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) 1376 newErr.model = v 1377 } 1378 return localVarReturnValue, localVarHTTPResponse, newErr 1379 } 1380 1381 err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) 1382 if err != nil { 1383 newErr := &GenericOpenAPIError{ 1384 body: localVarBody, 1385 error: err.Error(), 1386 } 1387 return localVarReturnValue, localVarHTTPResponse, newErr 1388 } 1389 1390 return localVarReturnValue, localVarHTTPResponse, nil 1391 } 1392 1393 type ApiEnvironmentKubeConfigRequest struct { 1394 ctx context.Context 1395 ApiService *EnvironmentAPIService 1396 id string 1397 } 1398 1399 func (r ApiEnvironmentKubeConfigRequest) Execute() (*EnvironmentKubeConfigKubeConfigRead, *http.Response, error) { 1400 return r.ApiService.EnvironmentKubeConfigExecute(r) 1401 } 1402 1403 /* 1404 EnvironmentKubeConfig Download Kubernetes Config File 1405 1406 Download Kubernetes Config File 1407 1408 @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). 1409 @param id Resource identifier 1410 @return ApiEnvironmentKubeConfigRequest 1411 */ 1412 func (a *EnvironmentAPIService) EnvironmentKubeConfig(ctx context.Context, id string) ApiEnvironmentKubeConfigRequest { 1413 return ApiEnvironmentKubeConfigRequest{ 1414 ApiService: a, 1415 ctx: ctx, 1416 id: id, 1417 } 1418 } 1419 1420 // Execute executes the request 1421 // 1422 // @return EnvironmentKubeConfigKubeConfigRead 1423 func (a *EnvironmentAPIService) EnvironmentKubeConfigExecute(r ApiEnvironmentKubeConfigRequest) (*EnvironmentKubeConfigKubeConfigRead, *http.Response, error) { 1424 var ( 1425 localVarHTTPMethod = http.MethodGet 1426 localVarPostBody interface{} 1427 formFiles []formFile 1428 localVarReturnValue *EnvironmentKubeConfigKubeConfigRead 1429 ) 1430 1431 localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "EnvironmentAPIService.EnvironmentKubeConfig") 1432 if err != nil { 1433 return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} 1434 } 1435 1436 localVarPath := localBasePath + "/v1/environments/{id}/kube-config" 1437 localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) 1438 1439 localVarHeaderParams := make(map[string]string) 1440 localVarQueryParams := url.Values{} 1441 localVarFormParams := url.Values{} 1442 1443 // to determine the Content-Type header 1444 localVarHTTPContentTypes := []string{} 1445 1446 // set Content-Type header 1447 localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) 1448 if localVarHTTPContentType != "" { 1449 localVarHeaderParams["Content-Type"] = localVarHTTPContentType 1450 } 1451 1452 // to determine the Accept header 1453 localVarHTTPHeaderAccepts := []string{"application/x+yaml", "application/problem+json"} 1454 1455 // set Accept header 1456 localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) 1457 if localVarHTTPHeaderAccept != "" { 1458 localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept 1459 } 1460 if r.ctx != nil { 1461 // API Key Authentication 1462 if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { 1463 if apiKey, ok := auth["JWT"]; ok { 1464 var key string 1465 if apiKey.Prefix != "" { 1466 key = apiKey.Prefix + " " + apiKey.Key 1467 } else { 1468 key = apiKey.Key 1469 } 1470 localVarHeaderParams["Authorization"] = key 1471 } 1472 } 1473 } 1474 if r.ctx != nil { 1475 // API Key Authentication 1476 if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { 1477 if apiKey, ok := auth["ApiKeyAuth"]; ok { 1478 var key string 1479 if apiKey.Prefix != "" { 1480 key = apiKey.Prefix + " " + apiKey.Key 1481 } else { 1482 key = apiKey.Key 1483 } 1484 localVarHeaderParams["X-Auth-Token"] = key 1485 } 1486 } 1487 } 1488 req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) 1489 if err != nil { 1490 return localVarReturnValue, nil, err 1491 } 1492 1493 localVarHTTPResponse, err := a.client.callAPI(req) 1494 if err != nil || localVarHTTPResponse == nil { 1495 return localVarReturnValue, localVarHTTPResponse, err 1496 } 1497 1498 localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) 1499 localVarHTTPResponse.Body.Close() 1500 localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) 1501 if err != nil { 1502 return localVarReturnValue, localVarHTTPResponse, err 1503 } 1504 1505 if localVarHTTPResponse.StatusCode >= 300 { 1506 newErr := &GenericOpenAPIError{ 1507 body: localVarBody, 1508 error: localVarHTTPResponse.Status, 1509 } 1510 if localVarHTTPResponse.StatusCode >= 400 && localVarHTTPResponse.StatusCode < 500 { 1511 var v ProblemGeneric 1512 err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) 1513 if err != nil { 1514 newErr.error = err.Error() 1515 return localVarReturnValue, localVarHTTPResponse, newErr 1516 } 1517 newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) 1518 newErr.model = v 1519 } 1520 return localVarReturnValue, localVarHTTPResponse, newErr 1521 } 1522 1523 err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) 1524 if err != nil { 1525 newErr := &GenericOpenAPIError{ 1526 body: localVarBody, 1527 error: err.Error(), 1528 } 1529 return localVarReturnValue, localVarHTTPResponse, newErr 1530 } 1531 1532 return localVarReturnValue, localVarHTTPResponse, nil 1533 } 1534 1535 type ApiEnvironmentListRequest struct { 1536 ctx context.Context 1537 ApiService *EnvironmentAPIService 1538 page *int32 1539 organization *string 1540 kubernetesIntegration *string 1541 type_ *string 1542 operationStatus *string 1543 clusterStatus *string 1544 search *string 1545 project *string 1546 labels *map[string]string 1547 } 1548 1549 // The collection page number 1550 func (r ApiEnvironmentListRequest) Page(page int32) ApiEnvironmentListRequest { 1551 r.page = &page 1552 return r 1553 } 1554 1555 // Filter by organization 1556 func (r ApiEnvironmentListRequest) Organization(organization string) ApiEnvironmentListRequest { 1557 r.organization = &organization 1558 return r 1559 } 1560 1561 // Filter by kubernetesIntegration 1562 func (r ApiEnvironmentListRequest) KubernetesIntegration(kubernetesIntegration string) ApiEnvironmentListRequest { 1563 r.kubernetesIntegration = &kubernetesIntegration 1564 return r 1565 } 1566 1567 // Filter by type 1568 func (r ApiEnvironmentListRequest) Type_(type_ string) ApiEnvironmentListRequest { 1569 r.type_ = &type_ 1570 return r 1571 } 1572 1573 // Filter by operationStatus 1574 func (r ApiEnvironmentListRequest) OperationStatus(operationStatus string) ApiEnvironmentListRequest { 1575 r.operationStatus = &operationStatus 1576 return r 1577 } 1578 1579 // Filter by clusterStatus 1580 func (r ApiEnvironmentListRequest) ClusterStatus(clusterStatus string) ApiEnvironmentListRequest { 1581 r.clusterStatus = &clusterStatus 1582 return r 1583 } 1584 1585 // Filter by search 1586 func (r ApiEnvironmentListRequest) Search(search string) ApiEnvironmentListRequest { 1587 r.search = &search 1588 return r 1589 } 1590 1591 // Filter by project 1592 func (r ApiEnvironmentListRequest) Project(project string) ApiEnvironmentListRequest { 1593 r.project = &project 1594 return r 1595 } 1596 1597 // Filter by label key-value pair. 1598 func (r ApiEnvironmentListRequest) Labels(labels map[string]string) ApiEnvironmentListRequest { 1599 r.labels = &labels 1600 return r 1601 } 1602 1603 func (r ApiEnvironmentListRequest) Execute() (*PaginatedEnvironmentCollection, *http.Response, error) { 1604 return r.ApiService.EnvironmentListExecute(r) 1605 } 1606 1607 /* 1608 EnvironmentList List environments matching any selected filters. 1609 1610 List environments matching any selected filters. 1611 1612 @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). 1613 @return ApiEnvironmentListRequest 1614 */ 1615 func (a *EnvironmentAPIService) EnvironmentList(ctx context.Context) ApiEnvironmentListRequest { 1616 return ApiEnvironmentListRequest{ 1617 ApiService: a, 1618 ctx: ctx, 1619 } 1620 } 1621 1622 // Execute executes the request 1623 // 1624 // @return PaginatedEnvironmentCollection 1625 func (a *EnvironmentAPIService) EnvironmentListExecute(r ApiEnvironmentListRequest) (*PaginatedEnvironmentCollection, *http.Response, error) { 1626 var ( 1627 localVarHTTPMethod = http.MethodGet 1628 localVarPostBody interface{} 1629 formFiles []formFile 1630 localVarReturnValue *PaginatedEnvironmentCollection 1631 ) 1632 1633 localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "EnvironmentAPIService.EnvironmentList") 1634 if err != nil { 1635 return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} 1636 } 1637 1638 localVarPath := localBasePath + "/v1/environments" 1639 1640 localVarHeaderParams := make(map[string]string) 1641 localVarQueryParams := url.Values{} 1642 localVarFormParams := url.Values{} 1643 1644 if r.page != nil { 1645 parameterAddToHeaderOrQuery(localVarQueryParams, "page", r.page, "") 1646 } else { 1647 var defaultValue int32 = 1 1648 r.page = &defaultValue 1649 } 1650 if r.organization != nil { 1651 parameterAddToHeaderOrQuery(localVarQueryParams, "organization", r.organization, "") 1652 } 1653 if r.kubernetesIntegration != nil { 1654 parameterAddToHeaderOrQuery(localVarQueryParams, "kubernetesIntegration", r.kubernetesIntegration, "") 1655 } 1656 if r.type_ != nil { 1657 parameterAddToHeaderOrQuery(localVarQueryParams, "type", r.type_, "") 1658 } 1659 if r.operationStatus != nil { 1660 parameterAddToHeaderOrQuery(localVarQueryParams, "operationStatus", r.operationStatus, "") 1661 } 1662 if r.clusterStatus != nil { 1663 parameterAddToHeaderOrQuery(localVarQueryParams, "clusterStatus", r.clusterStatus, "") 1664 } 1665 if r.search != nil { 1666 parameterAddToHeaderOrQuery(localVarQueryParams, "search", r.search, "") 1667 } 1668 if r.project != nil { 1669 parameterAddToHeaderOrQuery(localVarQueryParams, "project", r.project, "") 1670 } 1671 if r.labels != nil { 1672 parameterAddToHeaderOrQuery(localVarQueryParams, "labels", r.labels, "") 1673 } 1674 // to determine the Content-Type header 1675 localVarHTTPContentTypes := []string{} 1676 1677 // set Content-Type header 1678 localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) 1679 if localVarHTTPContentType != "" { 1680 localVarHeaderParams["Content-Type"] = localVarHTTPContentType 1681 } 1682 1683 // to determine the Accept header 1684 localVarHTTPHeaderAccepts := []string{"application/hal+json", "application/problem+json"} 1685 1686 // set Accept header 1687 localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) 1688 if localVarHTTPHeaderAccept != "" { 1689 localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept 1690 } 1691 if r.ctx != nil { 1692 // API Key Authentication 1693 if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { 1694 if apiKey, ok := auth["JWT"]; ok { 1695 var key string 1696 if apiKey.Prefix != "" { 1697 key = apiKey.Prefix + " " + apiKey.Key 1698 } else { 1699 key = apiKey.Key 1700 } 1701 localVarHeaderParams["Authorization"] = key 1702 } 1703 } 1704 } 1705 if r.ctx != nil { 1706 // API Key Authentication 1707 if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { 1708 if apiKey, ok := auth["ApiKeyAuth"]; ok { 1709 var key string 1710 if apiKey.Prefix != "" { 1711 key = apiKey.Prefix + " " + apiKey.Key 1712 } else { 1713 key = apiKey.Key 1714 } 1715 localVarHeaderParams["X-Auth-Token"] = key 1716 } 1717 } 1718 } 1719 req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) 1720 if err != nil { 1721 return localVarReturnValue, nil, err 1722 } 1723 1724 localVarHTTPResponse, err := a.client.callAPI(req) 1725 if err != nil || localVarHTTPResponse == nil { 1726 return localVarReturnValue, localVarHTTPResponse, err 1727 } 1728 1729 localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) 1730 localVarHTTPResponse.Body.Close() 1731 localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) 1732 if err != nil { 1733 return localVarReturnValue, localVarHTTPResponse, err 1734 } 1735 1736 if localVarHTTPResponse.StatusCode >= 300 { 1737 newErr := &GenericOpenAPIError{ 1738 body: localVarBody, 1739 error: localVarHTTPResponse.Status, 1740 } 1741 if localVarHTTPResponse.StatusCode >= 400 && localVarHTTPResponse.StatusCode < 500 { 1742 var v ProblemGeneric 1743 err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) 1744 if err != nil { 1745 newErr.error = err.Error() 1746 return localVarReturnValue, localVarHTTPResponse, newErr 1747 } 1748 newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) 1749 newErr.model = v 1750 } 1751 return localVarReturnValue, localVarHTTPResponse, newErr 1752 } 1753 1754 err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) 1755 if err != nil { 1756 newErr := &GenericOpenAPIError{ 1757 body: localVarBody, 1758 error: err.Error(), 1759 } 1760 return localVarReturnValue, localVarHTTPResponse, newErr 1761 } 1762 1763 return localVarReturnValue, localVarHTTPResponse, nil 1764 } 1765 1766 type ApiEnvironmentStartRequest struct { 1767 ctx context.Context 1768 ApiService *EnvironmentAPIService 1769 id string 1770 environmentPartialStartAction *EnvironmentPartialStartAction 1771 } 1772 1773 // The new environment resource 1774 func (r ApiEnvironmentStartRequest) EnvironmentPartialStartAction(environmentPartialStartAction EnvironmentPartialStartAction) ApiEnvironmentStartRequest { 1775 r.environmentPartialStartAction = &environmentPartialStartAction 1776 return r 1777 } 1778 1779 func (r ApiEnvironmentStartRequest) Execute() (*EventItem, *http.Response, error) { 1780 return r.ApiService.EnvironmentStartExecute(r) 1781 } 1782 1783 /* 1784 EnvironmentStart Start an environment. 1785 1786 Start an environment. 1787 1788 @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). 1789 @param id Resource identifier 1790 @return ApiEnvironmentStartRequest 1791 */ 1792 func (a *EnvironmentAPIService) EnvironmentStart(ctx context.Context, id string) ApiEnvironmentStartRequest { 1793 return ApiEnvironmentStartRequest{ 1794 ApiService: a, 1795 ctx: ctx, 1796 id: id, 1797 } 1798 } 1799 1800 // Execute executes the request 1801 // 1802 // @return EventItem 1803 func (a *EnvironmentAPIService) EnvironmentStartExecute(r ApiEnvironmentStartRequest) (*EventItem, *http.Response, error) { 1804 var ( 1805 localVarHTTPMethod = http.MethodPost 1806 localVarPostBody interface{} 1807 formFiles []formFile 1808 localVarReturnValue *EventItem 1809 ) 1810 1811 localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "EnvironmentAPIService.EnvironmentStart") 1812 if err != nil { 1813 return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} 1814 } 1815 1816 localVarPath := localBasePath + "/v1/environments/{id}/start" 1817 localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) 1818 1819 localVarHeaderParams := make(map[string]string) 1820 localVarQueryParams := url.Values{} 1821 localVarFormParams := url.Values{} 1822 if r.environmentPartialStartAction == nil { 1823 return localVarReturnValue, nil, reportError("environmentPartialStartAction is required and must be specified") 1824 } 1825 1826 // to determine the Content-Type header 1827 localVarHTTPContentTypes := []string{"application/json"} 1828 1829 // set Content-Type header 1830 localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) 1831 if localVarHTTPContentType != "" { 1832 localVarHeaderParams["Content-Type"] = localVarHTTPContentType 1833 } 1834 1835 // to determine the Accept header 1836 localVarHTTPHeaderAccepts := []string{"application/hal+json", "application/problem+json"} 1837 1838 // set Accept header 1839 localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) 1840 if localVarHTTPHeaderAccept != "" { 1841 localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept 1842 } 1843 // body params 1844 localVarPostBody = r.environmentPartialStartAction 1845 if r.ctx != nil { 1846 // API Key Authentication 1847 if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { 1848 if apiKey, ok := auth["JWT"]; ok { 1849 var key string 1850 if apiKey.Prefix != "" { 1851 key = apiKey.Prefix + " " + apiKey.Key 1852 } else { 1853 key = apiKey.Key 1854 } 1855 localVarHeaderParams["Authorization"] = key 1856 } 1857 } 1858 } 1859 if r.ctx != nil { 1860 // API Key Authentication 1861 if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { 1862 if apiKey, ok := auth["ApiKeyAuth"]; ok { 1863 var key string 1864 if apiKey.Prefix != "" { 1865 key = apiKey.Prefix + " " + apiKey.Key 1866 } else { 1867 key = apiKey.Key 1868 } 1869 localVarHeaderParams["X-Auth-Token"] = key 1870 } 1871 } 1872 } 1873 req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) 1874 if err != nil { 1875 return localVarReturnValue, nil, err 1876 } 1877 1878 localVarHTTPResponse, err := a.client.callAPI(req) 1879 if err != nil || localVarHTTPResponse == nil { 1880 return localVarReturnValue, localVarHTTPResponse, err 1881 } 1882 1883 localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) 1884 localVarHTTPResponse.Body.Close() 1885 localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) 1886 if err != nil { 1887 return localVarReturnValue, localVarHTTPResponse, err 1888 } 1889 1890 if localVarHTTPResponse.StatusCode >= 300 { 1891 newErr := &GenericOpenAPIError{ 1892 body: localVarBody, 1893 error: localVarHTTPResponse.Status, 1894 } 1895 if localVarHTTPResponse.StatusCode >= 400 && localVarHTTPResponse.StatusCode < 500 { 1896 var v ProblemGeneric 1897 err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) 1898 if err != nil { 1899 newErr.error = err.Error() 1900 return localVarReturnValue, localVarHTTPResponse, newErr 1901 } 1902 newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) 1903 newErr.model = v 1904 } 1905 return localVarReturnValue, localVarHTTPResponse, newErr 1906 } 1907 1908 err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) 1909 if err != nil { 1910 newErr := &GenericOpenAPIError{ 1911 body: localVarBody, 1912 error: err.Error(), 1913 } 1914 return localVarReturnValue, localVarHTTPResponse, newErr 1915 } 1916 1917 return localVarReturnValue, localVarHTTPResponse, nil 1918 } 1919 1920 type ApiEnvironmentStopRequest struct { 1921 ctx context.Context 1922 ApiService *EnvironmentAPIService 1923 id string 1924 environmentPartialAction *EnvironmentPartialAction 1925 } 1926 1927 // The new environment resource 1928 func (r ApiEnvironmentStopRequest) EnvironmentPartialAction(environmentPartialAction EnvironmentPartialAction) ApiEnvironmentStopRequest { 1929 r.environmentPartialAction = &environmentPartialAction 1930 return r 1931 } 1932 1933 func (r ApiEnvironmentStopRequest) Execute() (*EventItem, *http.Response, error) { 1934 return r.ApiService.EnvironmentStopExecute(r) 1935 } 1936 1937 /* 1938 EnvironmentStop Stop an environment. 1939 1940 Stop an environment. 1941 1942 @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). 1943 @param id Resource identifier 1944 @return ApiEnvironmentStopRequest 1945 */ 1946 func (a *EnvironmentAPIService) EnvironmentStop(ctx context.Context, id string) ApiEnvironmentStopRequest { 1947 return ApiEnvironmentStopRequest{ 1948 ApiService: a, 1949 ctx: ctx, 1950 id: id, 1951 } 1952 } 1953 1954 // Execute executes the request 1955 // 1956 // @return EventItem 1957 func (a *EnvironmentAPIService) EnvironmentStopExecute(r ApiEnvironmentStopRequest) (*EventItem, *http.Response, error) { 1958 var ( 1959 localVarHTTPMethod = http.MethodPost 1960 localVarPostBody interface{} 1961 formFiles []formFile 1962 localVarReturnValue *EventItem 1963 ) 1964 1965 localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "EnvironmentAPIService.EnvironmentStop") 1966 if err != nil { 1967 return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} 1968 } 1969 1970 localVarPath := localBasePath + "/v1/environments/{id}/stop" 1971 localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) 1972 1973 localVarHeaderParams := make(map[string]string) 1974 localVarQueryParams := url.Values{} 1975 localVarFormParams := url.Values{} 1976 if r.environmentPartialAction == nil { 1977 return localVarReturnValue, nil, reportError("environmentPartialAction is required and must be specified") 1978 } 1979 1980 // to determine the Content-Type header 1981 localVarHTTPContentTypes := []string{"application/json"} 1982 1983 // set Content-Type header 1984 localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) 1985 if localVarHTTPContentType != "" { 1986 localVarHeaderParams["Content-Type"] = localVarHTTPContentType 1987 } 1988 1989 // to determine the Accept header 1990 localVarHTTPHeaderAccepts := []string{"application/hal+json", "application/problem+json"} 1991 1992 // set Accept header 1993 localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) 1994 if localVarHTTPHeaderAccept != "" { 1995 localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept 1996 } 1997 // body params 1998 localVarPostBody = r.environmentPartialAction 1999 if r.ctx != nil { 2000 // API Key Authentication 2001 if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { 2002 if apiKey, ok := auth["JWT"]; ok { 2003 var key string 2004 if apiKey.Prefix != "" { 2005 key = apiKey.Prefix + " " + apiKey.Key 2006 } else { 2007 key = apiKey.Key 2008 } 2009 localVarHeaderParams["Authorization"] = key 2010 } 2011 } 2012 } 2013 if r.ctx != nil { 2014 // API Key Authentication 2015 if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { 2016 if apiKey, ok := auth["ApiKeyAuth"]; ok { 2017 var key string 2018 if apiKey.Prefix != "" { 2019 key = apiKey.Prefix + " " + apiKey.Key 2020 } else { 2021 key = apiKey.Key 2022 } 2023 localVarHeaderParams["X-Auth-Token"] = key 2024 } 2025 } 2026 } 2027 req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) 2028 if err != nil { 2029 return localVarReturnValue, nil, err 2030 } 2031 2032 localVarHTTPResponse, err := a.client.callAPI(req) 2033 if err != nil || localVarHTTPResponse == nil { 2034 return localVarReturnValue, localVarHTTPResponse, err 2035 } 2036 2037 localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) 2038 localVarHTTPResponse.Body.Close() 2039 localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) 2040 if err != nil { 2041 return localVarReturnValue, localVarHTTPResponse, err 2042 } 2043 2044 if localVarHTTPResponse.StatusCode >= 300 { 2045 newErr := &GenericOpenAPIError{ 2046 body: localVarBody, 2047 error: localVarHTTPResponse.Status, 2048 } 2049 if localVarHTTPResponse.StatusCode >= 400 && localVarHTTPResponse.StatusCode < 500 { 2050 var v ProblemGeneric 2051 err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) 2052 if err != nil { 2053 newErr.error = err.Error() 2054 return localVarReturnValue, localVarHTTPResponse, newErr 2055 } 2056 newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) 2057 newErr.model = v 2058 } 2059 return localVarReturnValue, localVarHTTPResponse, newErr 2060 } 2061 2062 err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) 2063 if err != nil { 2064 newErr := &GenericOpenAPIError{ 2065 body: localVarBody, 2066 error: err.Error(), 2067 } 2068 return localVarReturnValue, localVarHTTPResponse, newErr 2069 } 2070 2071 return localVarReturnValue, localVarHTTPResponse, nil 2072 } 2073 2074 type ApiEnvironmentViewRequest struct { 2075 ctx context.Context 2076 ApiService *EnvironmentAPIService 2077 id string 2078 } 2079 2080 func (r ApiEnvironmentViewRequest) Execute() (*EnvironmentItem, *http.Response, error) { 2081 return r.ApiService.EnvironmentViewExecute(r) 2082 } 2083 2084 /* 2085 EnvironmentView View a specific environment. 2086 2087 View a specific environment. 2088 2089 @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). 2090 @param id Resource identifier 2091 @return ApiEnvironmentViewRequest 2092 */ 2093 func (a *EnvironmentAPIService) EnvironmentView(ctx context.Context, id string) ApiEnvironmentViewRequest { 2094 return ApiEnvironmentViewRequest{ 2095 ApiService: a, 2096 ctx: ctx, 2097 id: id, 2098 } 2099 } 2100 2101 // Execute executes the request 2102 // 2103 // @return EnvironmentItem 2104 func (a *EnvironmentAPIService) EnvironmentViewExecute(r ApiEnvironmentViewRequest) (*EnvironmentItem, *http.Response, error) { 2105 var ( 2106 localVarHTTPMethod = http.MethodGet 2107 localVarPostBody interface{} 2108 formFiles []formFile 2109 localVarReturnValue *EnvironmentItem 2110 ) 2111 2112 localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "EnvironmentAPIService.EnvironmentView") 2113 if err != nil { 2114 return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} 2115 } 2116 2117 localVarPath := localBasePath + "/v1/environments/{id}" 2118 localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) 2119 2120 localVarHeaderParams := make(map[string]string) 2121 localVarQueryParams := url.Values{} 2122 localVarFormParams := url.Values{} 2123 2124 // to determine the Content-Type header 2125 localVarHTTPContentTypes := []string{} 2126 2127 // set Content-Type header 2128 localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) 2129 if localVarHTTPContentType != "" { 2130 localVarHeaderParams["Content-Type"] = localVarHTTPContentType 2131 } 2132 2133 // to determine the Accept header 2134 localVarHTTPHeaderAccepts := []string{"application/hal+json", "application/problem+json"} 2135 2136 // set Accept header 2137 localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) 2138 if localVarHTTPHeaderAccept != "" { 2139 localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept 2140 } 2141 if r.ctx != nil { 2142 // API Key Authentication 2143 if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { 2144 if apiKey, ok := auth["JWT"]; ok { 2145 var key string 2146 if apiKey.Prefix != "" { 2147 key = apiKey.Prefix + " " + apiKey.Key 2148 } else { 2149 key = apiKey.Key 2150 } 2151 localVarHeaderParams["Authorization"] = key 2152 } 2153 } 2154 } 2155 if r.ctx != nil { 2156 // API Key Authentication 2157 if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { 2158 if apiKey, ok := auth["ApiKeyAuth"]; ok { 2159 var key string 2160 if apiKey.Prefix != "" { 2161 key = apiKey.Prefix + " " + apiKey.Key 2162 } else { 2163 key = apiKey.Key 2164 } 2165 localVarHeaderParams["X-Auth-Token"] = key 2166 } 2167 } 2168 } 2169 req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) 2170 if err != nil { 2171 return localVarReturnValue, nil, err 2172 } 2173 2174 localVarHTTPResponse, err := a.client.callAPI(req) 2175 if err != nil || localVarHTTPResponse == nil { 2176 return localVarReturnValue, localVarHTTPResponse, err 2177 } 2178 2179 localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) 2180 localVarHTTPResponse.Body.Close() 2181 localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) 2182 if err != nil { 2183 return localVarReturnValue, localVarHTTPResponse, err 2184 } 2185 2186 if localVarHTTPResponse.StatusCode >= 300 { 2187 newErr := &GenericOpenAPIError{ 2188 body: localVarBody, 2189 error: localVarHTTPResponse.Status, 2190 } 2191 if localVarHTTPResponse.StatusCode >= 400 && localVarHTTPResponse.StatusCode < 500 { 2192 var v ProblemGeneric 2193 err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) 2194 if err != nil { 2195 newErr.error = err.Error() 2196 return localVarReturnValue, localVarHTTPResponse, newErr 2197 } 2198 newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) 2199 newErr.model = v 2200 } 2201 return localVarReturnValue, localVarHTTPResponse, newErr 2202 } 2203 2204 err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) 2205 if err != nil { 2206 newErr := &GenericOpenAPIError{ 2207 body: localVarBody, 2208 error: err.Error(), 2209 } 2210 return localVarReturnValue, localVarHTTPResponse, newErr 2211 } 2212 2213 return localVarReturnValue, localVarHTTPResponse, nil 2214 }