Class: OCI::ResourceManager::ResourceManagerClient
- Inherits:
-
Object
- Object
- OCI::ResourceManager::ResourceManagerClient
- Defined in:
- lib/oci/resource_manager/resource_manager_client.rb
Overview
API for the Resource Manager service. Use this API to install, configure, and manage resources via the "infrastructure-as-code" model. For more information, see [Overview of Resource Manager](/iaas/Content/ResourceManager/Concepts/resourcemanager.htm).
Instance Attribute Summary collapse
-
#api_client ⇒ OCI::ApiClient
readonly
Client used to make HTTP requests.
-
#endpoint ⇒ String
readonly
Fully qualified endpoint URL.
-
#region ⇒ String
The region, which will usually correspond to a value in OCI::Regions::REGION_ENUM.
-
#retry_config ⇒ OCI::Retry::RetryConfig
readonly
The default retry configuration to apply to all operations in this service client.
Instance Method Summary collapse
-
#cancel_job(job_id, opts = {}) ⇒ Response
Indicates the intention to cancel the specified job.
-
#change_stack_compartment(stack_id, change_stack_compartment_details, opts = {}) ⇒ Response
Moves a Stack and it’s associated Jobs into a different compartment.
-
#create_job(create_job_details, opts = {}) ⇒ Response
Creates a job.
-
#create_stack(create_stack_details, opts = {}) ⇒ Response
Creates a stack in the specified comparment.
-
#delete_stack(stack_id, opts = {}) ⇒ Response
Deletes the specified stack object.
-
#get_job(job_id, opts = {}) ⇒ Response
Returns the specified job along with the job details.
-
#get_job_logs(job_id, opts = {}) ⇒ Response
Returns log entries for the specified job in JSON format.
-
#get_job_logs_content(job_id, opts = {}) ⇒ Response
Returns raw log file for the specified job in text format.
-
#get_job_tf_config(job_id, opts = {}, &block) ⇒ Response
Returns the Terraform configuration file for the specified job in .zip format.
-
#get_job_tf_state(job_id, opts = {}, &block) ⇒ Response
Returns the Terraform state for the specified job.
-
#get_stack(stack_id, opts = {}) ⇒ Response
Gets a stack using the stack ID.
-
#get_stack_tf_config(stack_id, opts = {}, &block) ⇒ Response
Returns the Terraform configuration file in .zip format for the specified stack.
-
#get_work_request(work_request_id, opts = {}) ⇒ Response
Return the given work request.
-
#initialize(config: nil, region: nil, endpoint: nil, signer: nil, proxy_settings: nil, retry_config: nil) ⇒ ResourceManagerClient
constructor
Creates a new ResourceManagerClient.
-
#list_jobs(opts = {}) ⇒ Response
Returns a list of jobs in a stack or compartment, ordered by time created.
-
#list_stacks(opts = {}) ⇒ Response
Returns a list of stacks.
-
#list_work_request_errors(work_request_id, opts = {}) ⇒ Response
Return a (paginated) list of errors for a given work request.
-
#list_work_request_logs(work_request_id, opts = {}) ⇒ Response
Return a (paginated) list of logs for a given work request.
-
#list_work_requests(compartment_id, opts = {}) ⇒ Response
Lists the work requests in a given compartment or for a given resource.
-
#logger ⇒ Logger
The logger for this client.
-
#update_job(job_id, update_job_details, opts = {}) ⇒ Response
Updates the specified job.
-
#update_stack(stack_id, update_stack_details, opts = {}) ⇒ Response
Updates the specified stack object.
Constructor Details
#initialize(config: nil, region: nil, endpoint: nil, signer: nil, proxy_settings: nil, retry_config: nil) ⇒ ResourceManagerClient
Creates a new ResourceManagerClient. Notes:
If a config is not specified, then the global OCI.config will be used.
This client is not thread-safe
Either a region or an endpoint must be specified. If an endpoint is specified, it will be used instead of the
region. A region may be specified in the config or via or the region parameter. If specified in both, then the
region parameter will be used.
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/oci/resource_manager/resource_manager_client.rb', line 52 def initialize(config: nil, region: nil, endpoint: nil, signer: nil, proxy_settings: nil, retry_config: nil) # If the signer is an InstancePrincipalsSecurityTokenSigner and no config was supplied (which is valid for instance principals) # then create a dummy config to pass to the ApiClient constructor. If customers wish to create a client which uses instance principals # and has config (either populated programmatically or loaded from a file), they must construct that config themselves and then # pass it to this constructor. # # If there is no signer (or the signer is not an instance principals signer) and no config was supplied, this is not valid # so try and load the config from the default file. config ||= OCI.config unless signer.is_a?(OCI::Auth::Signers::InstancePrincipalsSecurityTokenSigner) config ||= OCI::Config.new if signer.is_a?(OCI::Auth::Signers::InstancePrincipalsSecurityTokenSigner) config.validate unless signer.is_a?(OCI::Auth::Signers::InstancePrincipalsSecurityTokenSigner) if signer.nil? signer = OCI::Signer.new( config.user, config.fingerprint, config.tenancy, config.key_file, pass_phrase: config.pass_phrase, private_key_content: config.key_content ) end @api_client = OCI::ApiClient.new(config, signer, proxy_settings: proxy_settings) @retry_config = retry_config if endpoint @endpoint = endpoint + '/20180917' else region ||= config.region region ||= signer.region if signer.respond_to?(:region) self.region = region end logger.info "ResourceManagerClient endpoint set to '#{@endpoint}'." if logger end |
Instance Attribute Details
#api_client ⇒ OCI::ApiClient (readonly)
Client used to make HTTP requests.
12 13 14 |
# File 'lib/oci/resource_manager/resource_manager_client.rb', line 12 def api_client @api_client end |
#endpoint ⇒ String (readonly)
Fully qualified endpoint URL
16 17 18 |
# File 'lib/oci/resource_manager/resource_manager_client.rb', line 16 def endpoint @endpoint end |
#region ⇒ String
The region, which will usually correspond to a value in OCI::Regions::REGION_ENUM.
26 27 28 |
# File 'lib/oci/resource_manager/resource_manager_client.rb', line 26 def region @region end |
#retry_config ⇒ OCI::Retry::RetryConfig (readonly)
The default retry configuration to apply to all operations in this service client. This can be overridden on a per-operation basis. The default retry configuration value is nil, which means that an operation will not perform any retries
22 23 24 |
# File 'lib/oci/resource_manager/resource_manager_client.rb', line 22 def retry_config @retry_config end |
Instance Method Details
#cancel_job(job_id, opts = {}) ⇒ Response
Indicates the intention to cancel the specified job. Cancellation of the job is not immediate, and may be delayed, or may not happen at all.
127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 |
# File 'lib/oci/resource_manager/resource_manager_client.rb', line 127 def cancel_job(job_id, opts = {}) logger.debug 'Calling operation ResourceManagerClient#cancel_job.' if logger raise "Missing the required parameter 'job_id' when calling cancel_job." if job_id.nil? raise "Parameter value for 'job_id' must not be blank" if OCI::Internal::Util.blank_string?(job_id) path = '/jobs/{jobId}'.sub('{jobId}', job_id.to_s) operation_signing_strategy = :standard # rubocop:disable Style/NegatedIf # Query Params query_params = {} # Header Params header_params = {} header_params[:accept] = 'application/json' header_params[:'content-type'] = 'application/json' header_params[:'opc-request-id'] = opts[:opc_request_id] if opts[:opc_request_id] header_params[:'if-match'] = opts[:if_match] if opts[:if_match] # rubocop:enable Style/NegatedIf post_body = nil # rubocop:disable Metrics/BlockLength OCI::Retry.(applicable_retry_config(opts), call_name: 'ResourceManagerClient#cancel_job') do @api_client.call_api( :DELETE, path, endpoint, header_params: header_params, query_params: query_params, operation_signing_strategy: operation_signing_strategy, body: post_body ) end # rubocop:enable Metrics/BlockLength end |
#change_stack_compartment(stack_id, change_stack_compartment_details, opts = {}) ⇒ Response
Moves a Stack and it’s associated Jobs into a different compartment.
193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 |
# File 'lib/oci/resource_manager/resource_manager_client.rb', line 193 def change_stack_compartment(stack_id, change_stack_compartment_details, opts = {}) logger.debug 'Calling operation ResourceManagerClient#change_stack_compartment.' if logger raise "Missing the required parameter 'stack_id' when calling change_stack_compartment." if stack_id.nil? raise "Missing the required parameter 'change_stack_compartment_details' when calling change_stack_compartment." if change_stack_compartment_details.nil? raise "Parameter value for 'stack_id' must not be blank" if OCI::Internal::Util.blank_string?(stack_id) path = '/stacks/{stackId}/actions/changeCompartment'.sub('{stackId}', stack_id.to_s) operation_signing_strategy = :standard # rubocop:disable Style/NegatedIf # Query Params query_params = {} # Header Params header_params = {} header_params[:accept] = 'application/json' header_params[:'content-type'] = 'application/json' header_params[:'if-match'] = opts[:if_match] if opts[:if_match] header_params[:'opc-request-id'] = opts[:opc_request_id] if opts[:opc_request_id] header_params[:'opc-retry-token'] = opts[:opc_retry_token] if opts[:opc_retry_token] # rubocop:enable Style/NegatedIf header_params[:'opc-retry-token'] ||= OCI::Retry.generate_opc_retry_token post_body = @api_client.object_to_http_body(change_stack_compartment_details) # rubocop:disable Metrics/BlockLength OCI::Retry.(applicable_retry_config(opts), call_name: 'ResourceManagerClient#change_stack_compartment') do @api_client.call_api( :POST, path, endpoint, header_params: header_params, query_params: query_params, operation_signing_strategy: operation_signing_strategy, body: post_body ) end # rubocop:enable Metrics/BlockLength end |
#create_job(create_job_details, opts = {}) ⇒ Response
Creates a job.
257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 |
# File 'lib/oci/resource_manager/resource_manager_client.rb', line 257 def create_job(create_job_details, opts = {}) logger.debug 'Calling operation ResourceManagerClient#create_job.' if logger raise "Missing the required parameter 'create_job_details' when calling create_job." if create_job_details.nil? path = '/jobs' operation_signing_strategy = :standard # rubocop:disable Style/NegatedIf # Query Params query_params = {} # Header Params header_params = {} header_params[:accept] = 'application/json' header_params[:'content-type'] = 'application/json' header_params[:'opc-request-id'] = opts[:opc_request_id] if opts[:opc_request_id] header_params[:'opc-retry-token'] = opts[:opc_retry_token] if opts[:opc_retry_token] # rubocop:enable Style/NegatedIf header_params[:'opc-retry-token'] ||= OCI::Retry.generate_opc_retry_token post_body = @api_client.object_to_http_body(create_job_details) # rubocop:disable Metrics/BlockLength OCI::Retry.(applicable_retry_config(opts), call_name: 'ResourceManagerClient#create_job') do @api_client.call_api( :POST, path, endpoint, header_params: header_params, query_params: query_params, operation_signing_strategy: operation_signing_strategy, body: post_body, return_type: 'OCI::ResourceManager::Models::Job' ) end # rubocop:enable Metrics/BlockLength end |
#create_stack(create_stack_details, opts = {}) ⇒ Response
Creates a stack in the specified comparment. Specify the compartment using the compartment ID.
321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 |
# File 'lib/oci/resource_manager/resource_manager_client.rb', line 321 def create_stack(create_stack_details, opts = {}) logger.debug 'Calling operation ResourceManagerClient#create_stack.' if logger raise "Missing the required parameter 'create_stack_details' when calling create_stack." if create_stack_details.nil? path = '/stacks' operation_signing_strategy = :standard # rubocop:disable Style/NegatedIf # Query Params query_params = {} # Header Params header_params = {} header_params[:accept] = 'application/json' header_params[:'content-type'] = 'application/json' header_params[:'opc-request-id'] = opts[:opc_request_id] if opts[:opc_request_id] header_params[:'opc-retry-token'] = opts[:opc_retry_token] if opts[:opc_retry_token] # rubocop:enable Style/NegatedIf header_params[:'opc-retry-token'] ||= OCI::Retry.generate_opc_retry_token post_body = @api_client.object_to_http_body(create_stack_details) # rubocop:disable Metrics/BlockLength OCI::Retry.(applicable_retry_config(opts), call_name: 'ResourceManagerClient#create_stack') do @api_client.call_api( :POST, path, endpoint, header_params: header_params, query_params: query_params, operation_signing_strategy: operation_signing_strategy, body: post_body, return_type: 'OCI::ResourceManager::Models::Stack' ) end # rubocop:enable Metrics/BlockLength end |
#delete_stack(stack_id, opts = {}) ⇒ Response
Deletes the specified stack object.
381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 |
# File 'lib/oci/resource_manager/resource_manager_client.rb', line 381 def delete_stack(stack_id, opts = {}) logger.debug 'Calling operation ResourceManagerClient#delete_stack.' if logger raise "Missing the required parameter 'stack_id' when calling delete_stack." if stack_id.nil? raise "Parameter value for 'stack_id' must not be blank" if OCI::Internal::Util.blank_string?(stack_id) path = '/stacks/{stackId}'.sub('{stackId}', stack_id.to_s) operation_signing_strategy = :standard # rubocop:disable Style/NegatedIf # Query Params query_params = {} # Header Params header_params = {} header_params[:accept] = 'application/json' header_params[:'content-type'] = 'application/json' header_params[:'opc-request-id'] = opts[:opc_request_id] if opts[:opc_request_id] header_params[:'if-match'] = opts[:if_match] if opts[:if_match] # rubocop:enable Style/NegatedIf post_body = nil # rubocop:disable Metrics/BlockLength OCI::Retry.(applicable_retry_config(opts), call_name: 'ResourceManagerClient#delete_stack') do @api_client.call_api( :DELETE, path, endpoint, header_params: header_params, query_params: query_params, operation_signing_strategy: operation_signing_strategy, body: post_body ) end # rubocop:enable Metrics/BlockLength end |
#get_job(job_id, opts = {}) ⇒ Response
Returns the specified job along with the job details.
436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 |
# File 'lib/oci/resource_manager/resource_manager_client.rb', line 436 def get_job(job_id, opts = {}) logger.debug 'Calling operation ResourceManagerClient#get_job.' if logger raise "Missing the required parameter 'job_id' when calling get_job." if job_id.nil? raise "Parameter value for 'job_id' must not be blank" if OCI::Internal::Util.blank_string?(job_id) path = '/jobs/{jobId}'.sub('{jobId}', job_id.to_s) operation_signing_strategy = :standard # rubocop:disable Style/NegatedIf # Query Params query_params = {} # Header Params header_params = {} header_params[:accept] = 'application/json' header_params[:'content-type'] = 'application/json' header_params[:'opc-request-id'] = opts[:opc_request_id] if opts[:opc_request_id] # rubocop:enable Style/NegatedIf post_body = nil # rubocop:disable Metrics/BlockLength OCI::Retry.(applicable_retry_config(opts), call_name: 'ResourceManagerClient#get_job') do @api_client.call_api( :GET, path, endpoint, header_params: header_params, query_params: query_params, operation_signing_strategy: operation_signing_strategy, body: post_body, return_type: 'OCI::ResourceManager::Models::Job' ) end # rubocop:enable Metrics/BlockLength end |
#get_job_logs(job_id, opts = {}) ⇒ Response
Returns log entries for the specified job in JSON format.
509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 |
# File 'lib/oci/resource_manager/resource_manager_client.rb', line 509 def get_job_logs(job_id, opts = {}) logger.debug 'Calling operation ResourceManagerClient#get_job_logs.' if logger raise "Missing the required parameter 'job_id' when calling get_job_logs." if job_id.nil? if opts[:level_greater_than_or_equal_to] && !OCI::ResourceManager::Models::LogEntry::LEVEL_ENUM.include?(opts[:level_greater_than_or_equal_to]) raise 'Invalid value for "level_greater_than_or_equal_to", must be one of the values in OCI::ResourceManager::Models::LogEntry::LEVEL_ENUM.' end if opts[:sort_order] && !%w[ASC DESC].include?(opts[:sort_order]) raise 'Invalid value for "sort_order", must be one of ASC, DESC.' end raise "Parameter value for 'job_id' must not be blank" if OCI::Internal::Util.blank_string?(job_id) path = '/jobs/{jobId}/logs'.sub('{jobId}', job_id.to_s) operation_signing_strategy = :standard # rubocop:disable Style/NegatedIf # Query Params query_params = {} query_params[:type] = OCI::ApiClient.build_collection_params(opts[:type], :multi) if opts[:type] && !opts[:type].empty? query_params[:levelGreaterThanOrEqualTo] = opts[:level_greater_than_or_equal_to] if opts[:level_greater_than_or_equal_to] query_params[:sortOrder] = opts[:sort_order] if opts[:sort_order] query_params[:limit] = opts[:limit] if opts[:limit] query_params[:page] = opts[:page] if opts[:page] query_params[:timestampGreaterThanOrEqualTo] = opts[:timestamp_greater_than_or_equal_to] if opts[:timestamp_greater_than_or_equal_to] query_params[:timestampLessThanOrEqualTo] = opts[:timestamp_less_than_or_equal_to] if opts[:timestamp_less_than_or_equal_to] # Header Params header_params = {} header_params[:accept] = 'application/json' header_params[:'content-type'] = 'application/json' header_params[:'opc-request-id'] = opts[:opc_request_id] if opts[:opc_request_id] # rubocop:enable Style/NegatedIf post_body = nil # rubocop:disable Metrics/BlockLength OCI::Retry.(applicable_retry_config(opts), call_name: 'ResourceManagerClient#get_job_logs') do @api_client.call_api( :GET, path, endpoint, header_params: header_params, query_params: query_params, operation_signing_strategy: operation_signing_strategy, body: post_body, return_type: 'Array<OCI::ResourceManager::Models::LogEntry>' ) end # rubocop:enable Metrics/BlockLength end |
#get_job_logs_content(job_id, opts = {}) ⇒ Response
Returns raw log file for the specified job in text format. Returns a maximum of 100,000 log entries.
581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 |
# File 'lib/oci/resource_manager/resource_manager_client.rb', line 581 def get_job_logs_content(job_id, opts = {}) logger.debug 'Calling operation ResourceManagerClient#get_job_logs_content.' if logger raise "Missing the required parameter 'job_id' when calling get_job_logs_content." if job_id.nil? raise "Parameter value for 'job_id' must not be blank" if OCI::Internal::Util.blank_string?(job_id) path = '/jobs/{jobId}/logs/content'.sub('{jobId}', job_id.to_s) operation_signing_strategy = :standard # rubocop:disable Style/NegatedIf # Query Params query_params = {} # Header Params header_params = {} header_params[:accept] = 'text/plain; charset=utf-8' header_params[:'content-type'] = 'application/json' header_params[:'opc-request-id'] = opts[:opc_request_id] if opts[:opc_request_id] # rubocop:enable Style/NegatedIf post_body = nil # rubocop:disable Metrics/BlockLength OCI::Retry.(applicable_retry_config(opts), call_name: 'ResourceManagerClient#get_job_logs_content') do @api_client.call_api( :GET, path, endpoint, header_params: header_params, query_params: query_params, operation_signing_strategy: operation_signing_strategy, body: post_body, return_type: 'String' ) end # rubocop:enable Metrics/BlockLength end |
#get_job_tf_config(job_id, opts = {}, &block) ⇒ Response
Returns the Terraform configuration file for the specified job in .zip format. Returns an error if no zip file is found.
640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 |
# File 'lib/oci/resource_manager/resource_manager_client.rb', line 640 def get_job_tf_config(job_id, opts = {}, &block) logger.debug 'Calling operation ResourceManagerClient#get_job_tf_config.' if logger raise "Missing the required parameter 'job_id' when calling get_job_tf_config." if job_id.nil? raise "Parameter value for 'job_id' must not be blank" if OCI::Internal::Util.blank_string?(job_id) path = '/jobs/{jobId}/tfConfig'.sub('{jobId}', job_id.to_s) operation_signing_strategy = :standard # rubocop:disable Style/NegatedIf # Query Params query_params = {} # Header Params header_params = {} header_params[:accept] = opts[:accept] if opts[:accept] header_params[:accept] ||= 'application/zip' header_params[:'accept-encoding'] = opts[:accept_encoding] if opts[:accept_encoding] header_params[:'content-type'] = 'application/json' header_params[:'opc-request-id'] = opts[:opc_request_id] if opts[:opc_request_id] # rubocop:enable Style/NegatedIf post_body = nil # rubocop:disable Metrics/BlockLength OCI::Retry.(applicable_retry_config(opts), call_name: 'ResourceManagerClient#get_job_tf_config') do if !block.nil? @api_client.call_api( :GET, path, endpoint, header_params: header_params, query_params: query_params, operation_signing_strategy: operation_signing_strategy, body: post_body, return_type: 'Stream', &block ) elsif opts[:response_target] if opts[:response_target].respond_to? :write @api_client.call_api( :GET, path, endpoint, header_params: header_params, query_params: query_params, operation_signing_strategy: operation_signing_strategy, body: post_body, return_type: 'Stream', &proc { |chunk, _response| opts[:response_target].write(chunk) } ) elsif opts[:response_target].is_a?(String) File.open(opts[:response_target], 'wb') do |output| return @api_client.call_api( :GET, path, endpoint, header_params: header_params, query_params: query_params, operation_signing_strategy: operation_signing_strategy, body: post_body, return_type: 'Stream', &proc { |chunk, _response| output.write(chunk) } ) end end else @api_client.call_api( :GET, path, endpoint, header_params: header_params, query_params: query_params, operation_signing_strategy: operation_signing_strategy, body: post_body, return_type: 'String' ) end end # rubocop:enable Metrics/BlockLength end |
#get_job_tf_state(job_id, opts = {}, &block) ⇒ Response
Returns the Terraform state for the specified job.
741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 |
# File 'lib/oci/resource_manager/resource_manager_client.rb', line 741 def get_job_tf_state(job_id, opts = {}, &block) logger.debug 'Calling operation ResourceManagerClient#get_job_tf_state.' if logger raise "Missing the required parameter 'job_id' when calling get_job_tf_state." if job_id.nil? raise "Parameter value for 'job_id' must not be blank" if OCI::Internal::Util.blank_string?(job_id) path = '/jobs/{jobId}/tfState'.sub('{jobId}', job_id.to_s) operation_signing_strategy = :standard # rubocop:disable Style/NegatedIf # Query Params query_params = {} # Header Params header_params = {} header_params[:accept] = opts[:accept] if opts[:accept] header_params[:accept] ||= 'application/octet-stream' header_params[:'accept-encoding'] = opts[:accept_encoding] if opts[:accept_encoding] header_params[:'content-type'] = 'application/json' header_params[:'opc-request-id'] = opts[:opc_request_id] if opts[:opc_request_id] # rubocop:enable Style/NegatedIf post_body = nil # rubocop:disable Metrics/BlockLength OCI::Retry.(applicable_retry_config(opts), call_name: 'ResourceManagerClient#get_job_tf_state') do if !block.nil? @api_client.call_api( :GET, path, endpoint, header_params: header_params, query_params: query_params, operation_signing_strategy: operation_signing_strategy, body: post_body, return_type: 'Stream', &block ) elsif opts[:response_target] if opts[:response_target].respond_to? :write @api_client.call_api( :GET, path, endpoint, header_params: header_params, query_params: query_params, operation_signing_strategy: operation_signing_strategy, body: post_body, return_type: 'Stream', &proc { |chunk, _response| opts[:response_target].write(chunk) } ) elsif opts[:response_target].is_a?(String) File.open(opts[:response_target], 'wb') do |output| return @api_client.call_api( :GET, path, endpoint, header_params: header_params, query_params: query_params, operation_signing_strategy: operation_signing_strategy, body: post_body, return_type: 'Stream', &proc { |chunk, _response| output.write(chunk) } ) end end else @api_client.call_api( :GET, path, endpoint, header_params: header_params, query_params: query_params, operation_signing_strategy: operation_signing_strategy, body: post_body, return_type: 'String' ) end end # rubocop:enable Metrics/BlockLength end |
#get_stack(stack_id, opts = {}) ⇒ Response
Gets a stack using the stack ID.
840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 |
# File 'lib/oci/resource_manager/resource_manager_client.rb', line 840 def get_stack(stack_id, opts = {}) logger.debug 'Calling operation ResourceManagerClient#get_stack.' if logger raise "Missing the required parameter 'stack_id' when calling get_stack." if stack_id.nil? raise "Parameter value for 'stack_id' must not be blank" if OCI::Internal::Util.blank_string?(stack_id) path = '/stacks/{stackId}'.sub('{stackId}', stack_id.to_s) operation_signing_strategy = :standard # rubocop:disable Style/NegatedIf # Query Params query_params = {} # Header Params header_params = {} header_params[:accept] = 'application/json' header_params[:'content-type'] = 'application/json' header_params[:'opc-request-id'] = opts[:opc_request_id] if opts[:opc_request_id] # rubocop:enable Style/NegatedIf post_body = nil # rubocop:disable Metrics/BlockLength OCI::Retry.(applicable_retry_config(opts), call_name: 'ResourceManagerClient#get_stack') do @api_client.call_api( :GET, path, endpoint, header_params: header_params, query_params: query_params, operation_signing_strategy: operation_signing_strategy, body: post_body, return_type: 'OCI::ResourceManager::Models::Stack' ) end # rubocop:enable Metrics/BlockLength end |
#get_stack_tf_config(stack_id, opts = {}, &block) ⇒ Response
Returns the Terraform configuration file in .zip format for the specified stack. Returns an error if no zip file is found.
899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 |
# File 'lib/oci/resource_manager/resource_manager_client.rb', line 899 def get_stack_tf_config(stack_id, opts = {}, &block) logger.debug 'Calling operation ResourceManagerClient#get_stack_tf_config.' if logger raise "Missing the required parameter 'stack_id' when calling get_stack_tf_config." if stack_id.nil? raise "Parameter value for 'stack_id' must not be blank" if OCI::Internal::Util.blank_string?(stack_id) path = '/stacks/{stackId}/tfConfig'.sub('{stackId}', stack_id.to_s) operation_signing_strategy = :standard # rubocop:disable Style/NegatedIf # Query Params query_params = {} # Header Params header_params = {} header_params[:accept] = opts[:accept] if opts[:accept] header_params[:accept] ||= 'application/zip' header_params[:'accept-encoding'] = opts[:accept_encoding] if opts[:accept_encoding] header_params[:'content-type'] = 'application/json' header_params[:'opc-request-id'] = opts[:opc_request_id] if opts[:opc_request_id] # rubocop:enable Style/NegatedIf post_body = nil # rubocop:disable Metrics/BlockLength OCI::Retry.(applicable_retry_config(opts), call_name: 'ResourceManagerClient#get_stack_tf_config') do if !block.nil? @api_client.call_api( :GET, path, endpoint, header_params: header_params, query_params: query_params, operation_signing_strategy: operation_signing_strategy, body: post_body, return_type: 'Stream', &block ) elsif opts[:response_target] if opts[:response_target].respond_to? :write @api_client.call_api( :GET, path, endpoint, header_params: header_params, query_params: query_params, operation_signing_strategy: operation_signing_strategy, body: post_body, return_type: 'Stream', &proc { |chunk, _response| opts[:response_target].write(chunk) } ) elsif opts[:response_target].is_a?(String) File.open(opts[:response_target], 'wb') do |output| return @api_client.call_api( :GET, path, endpoint, header_params: header_params, query_params: query_params, operation_signing_strategy: operation_signing_strategy, body: post_body, return_type: 'Stream', &proc { |chunk, _response| output.write(chunk) } ) end end else @api_client.call_api( :GET, path, endpoint, header_params: header_params, query_params: query_params, operation_signing_strategy: operation_signing_strategy, body: post_body, return_type: 'String' ) end end # rubocop:enable Metrics/BlockLength end |
#get_work_request(work_request_id, opts = {}) ⇒ Response
Return the given work request.
998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 |
# File 'lib/oci/resource_manager/resource_manager_client.rb', line 998 def get_work_request(work_request_id, opts = {}) logger.debug 'Calling operation ResourceManagerClient#get_work_request.' if logger raise "Missing the required parameter 'work_request_id' when calling get_work_request." if work_request_id.nil? raise "Parameter value for 'work_request_id' must not be blank" if OCI::Internal::Util.blank_string?(work_request_id) path = '/workRequests/{workRequestId}'.sub('{workRequestId}', work_request_id.to_s) operation_signing_strategy = :standard # rubocop:disable Style/NegatedIf # Query Params query_params = {} # Header Params header_params = {} header_params[:accept] = 'application/json' header_params[:'content-type'] = 'application/json' header_params[:'opc-request-id'] = opts[:opc_request_id] if opts[:opc_request_id] # rubocop:enable Style/NegatedIf post_body = nil # rubocop:disable Metrics/BlockLength OCI::Retry.(applicable_retry_config(opts), call_name: 'ResourceManagerClient#get_work_request') do @api_client.call_api( :GET, path, endpoint, header_params: header_params, query_params: query_params, operation_signing_strategy: operation_signing_strategy, body: post_body, return_type: 'OCI::ResourceManager::Models::WorkRequest' ) end # rubocop:enable Metrics/BlockLength end |
#list_jobs(opts = {}) ⇒ Response
Returns a list of jobs in a stack or compartment, ordered by time created.
-
To list all jobs in a stack, provide the stack OCID.
-
To list all jobs in a compartment, provide the compartment OCID.
-
To return a specific job, provide the job OCID.
1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 |
# File 'lib/oci/resource_manager/resource_manager_client.rb', line 1088 def list_jobs(opts = {}) logger.debug 'Calling operation ResourceManagerClient#list_jobs.' if logger if opts[:lifecycle_state] && !OCI::ResourceManager::Models::Job::LIFECYCLE_STATE_ENUM.include?(opts[:lifecycle_state]) raise 'Invalid value for "lifecycle_state", must be one of the values in OCI::ResourceManager::Models::Job::LIFECYCLE_STATE_ENUM.' end if opts[:sort_by] && !%w[TIMECREATED DISPLAYNAME].include?(opts[:sort_by]) raise 'Invalid value for "sort_by", must be one of TIMECREATED, DISPLAYNAME.' end if opts[:sort_order] && !%w[ASC DESC].include?(opts[:sort_order]) raise 'Invalid value for "sort_order", must be one of ASC, DESC.' end path = '/jobs' operation_signing_strategy = :standard # rubocop:disable Style/NegatedIf # Query Params query_params = {} query_params[:compartmentId] = opts[:compartment_id] if opts[:compartment_id] query_params[:stackId] = opts[:stack_id] if opts[:stack_id] query_params[:id] = opts[:id] if opts[:id] query_params[:lifecycleState] = opts[:lifecycle_state] if opts[:lifecycle_state] query_params[:displayName] = opts[:display_name] if opts[:display_name] query_params[:sortBy] = opts[:sort_by] if opts[:sort_by] query_params[:sortOrder] = opts[:sort_order] if opts[:sort_order] query_params[:limit] = opts[:limit] if opts[:limit] query_params[:page] = opts[:page] if opts[:page] # Header Params header_params = {} header_params[:accept] = 'application/json' header_params[:'content-type'] = 'application/json' header_params[:'opc-request-id'] = opts[:opc_request_id] if opts[:opc_request_id] # rubocop:enable Style/NegatedIf post_body = nil # rubocop:disable Metrics/BlockLength OCI::Retry.(applicable_retry_config(opts), call_name: 'ResourceManagerClient#list_jobs') do @api_client.call_api( :GET, path, endpoint, header_params: header_params, query_params: query_params, operation_signing_strategy: operation_signing_strategy, body: post_body, return_type: 'Array<OCI::ResourceManager::Models::JobSummary>' ) end # rubocop:enable Metrics/BlockLength end |
#list_stacks(opts = {}) ⇒ Response
Returns a list of stacks.
-
If called using the compartment ID, returns all stacks in the specified compartment.
-
If called using the stack ID, returns the specified stack.
1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 |
# File 'lib/oci/resource_manager/resource_manager_client.rb', line 1192 def list_stacks(opts = {}) logger.debug 'Calling operation ResourceManagerClient#list_stacks.' if logger if opts[:lifecycle_state] && !OCI::ResourceManager::Models::Stack::LIFECYCLE_STATE_ENUM.include?(opts[:lifecycle_state]) raise 'Invalid value for "lifecycle_state", must be one of the values in OCI::ResourceManager::Models::Stack::LIFECYCLE_STATE_ENUM.' end if opts[:sort_by] && !%w[TIMECREATED DISPLAYNAME].include?(opts[:sort_by]) raise 'Invalid value for "sort_by", must be one of TIMECREATED, DISPLAYNAME.' end if opts[:sort_order] && !%w[ASC DESC].include?(opts[:sort_order]) raise 'Invalid value for "sort_order", must be one of ASC, DESC.' end path = '/stacks' operation_signing_strategy = :standard # rubocop:disable Style/NegatedIf # Query Params query_params = {} query_params[:compartmentId] = opts[:compartment_id] if opts[:compartment_id] query_params[:id] = opts[:id] if opts[:id] query_params[:lifecycleState] = opts[:lifecycle_state] if opts[:lifecycle_state] query_params[:displayName] = opts[:display_name] if opts[:display_name] query_params[:sortBy] = opts[:sort_by] if opts[:sort_by] query_params[:sortOrder] = opts[:sort_order] if opts[:sort_order] query_params[:limit] = opts[:limit] if opts[:limit] query_params[:page] = opts[:page] if opts[:page] # Header Params header_params = {} header_params[:accept] = 'application/json' header_params[:'content-type'] = 'application/json' header_params[:'opc-request-id'] = opts[:opc_request_id] if opts[:opc_request_id] # rubocop:enable Style/NegatedIf post_body = nil # rubocop:disable Metrics/BlockLength OCI::Retry.(applicable_retry_config(opts), call_name: 'ResourceManagerClient#list_stacks') do @api_client.call_api( :GET, path, endpoint, header_params: header_params, query_params: query_params, operation_signing_strategy: operation_signing_strategy, body: post_body, return_type: 'Array<OCI::ResourceManager::Models::StackSummary>' ) end # rubocop:enable Metrics/BlockLength end |
#list_work_request_errors(work_request_id, opts = {}) ⇒ Response
Return a (paginated) list of errors for a given work request.
1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 |
# File 'lib/oci/resource_manager/resource_manager_client.rb', line 1276 def list_work_request_errors(work_request_id, opts = {}) logger.debug 'Calling operation ResourceManagerClient#list_work_request_errors.' if logger raise "Missing the required parameter 'work_request_id' when calling list_work_request_errors." if work_request_id.nil? if opts[:sort_order] && !%w[ASC DESC].include?(opts[:sort_order]) raise 'Invalid value for "sort_order", must be one of ASC, DESC.' end raise "Parameter value for 'work_request_id' must not be blank" if OCI::Internal::Util.blank_string?(work_request_id) path = '/workRequests/{workRequestId}/errors'.sub('{workRequestId}', work_request_id.to_s) operation_signing_strategy = :standard # rubocop:disable Style/NegatedIf # Query Params query_params = {} query_params[:compartmentId] = opts[:compartment_id] if opts[:compartment_id] query_params[:limit] = opts[:limit] if opts[:limit] query_params[:page] = opts[:page] if opts[:page] query_params[:sortOrder] = opts[:sort_order] if opts[:sort_order] # Header Params header_params = {} header_params[:accept] = 'application/json' header_params[:'content-type'] = 'application/json' header_params[:'opc-request-id'] = opts[:opc_request_id] if opts[:opc_request_id] # rubocop:enable Style/NegatedIf post_body = nil # rubocop:disable Metrics/BlockLength OCI::Retry.(applicable_retry_config(opts), call_name: 'ResourceManagerClient#list_work_request_errors') do @api_client.call_api( :GET, path, endpoint, header_params: header_params, query_params: query_params, operation_signing_strategy: operation_signing_strategy, body: post_body, return_type: 'Array<OCI::ResourceManager::Models::WorkRequestError>' ) end # rubocop:enable Metrics/BlockLength end |
#list_work_request_logs(work_request_id, opts = {}) ⇒ Response
Return a (paginated) list of logs for a given work request.
1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 |
# File 'lib/oci/resource_manager/resource_manager_client.rb', line 1350 def list_work_request_logs(work_request_id, opts = {}) logger.debug 'Calling operation ResourceManagerClient#list_work_request_logs.' if logger raise "Missing the required parameter 'work_request_id' when calling list_work_request_logs." if work_request_id.nil? if opts[:sort_order] && !%w[ASC DESC].include?(opts[:sort_order]) raise 'Invalid value for "sort_order", must be one of ASC, DESC.' end raise "Parameter value for 'work_request_id' must not be blank" if OCI::Internal::Util.blank_string?(work_request_id) path = '/workRequests/{workRequestId}/logs'.sub('{workRequestId}', work_request_id.to_s) operation_signing_strategy = :standard # rubocop:disable Style/NegatedIf # Query Params query_params = {} query_params[:compartmentId] = opts[:compartment_id] if opts[:compartment_id] query_params[:limit] = opts[:limit] if opts[:limit] query_params[:page] = opts[:page] if opts[:page] query_params[:sortOrder] = opts[:sort_order] if opts[:sort_order] # Header Params header_params = {} header_params[:accept] = 'application/json' header_params[:'content-type'] = 'application/json' header_params[:'opc-request-id'] = opts[:opc_request_id] if opts[:opc_request_id] # rubocop:enable Style/NegatedIf post_body = nil # rubocop:disable Metrics/BlockLength OCI::Retry.(applicable_retry_config(opts), call_name: 'ResourceManagerClient#list_work_request_logs') do @api_client.call_api( :GET, path, endpoint, header_params: header_params, query_params: query_params, operation_signing_strategy: operation_signing_strategy, body: post_body, return_type: 'Array<OCI::ResourceManager::Models::WorkRequestLogEntry>' ) end # rubocop:enable Metrics/BlockLength end |
#list_work_requests(compartment_id, opts = {}) ⇒ Response
Lists the work requests in a given compartment or for a given resource.
1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 |
# File 'lib/oci/resource_manager/resource_manager_client.rb', line 1421 def list_work_requests(compartment_id, opts = {}) logger.debug 'Calling operation ResourceManagerClient#list_work_requests.' if logger raise "Missing the required parameter 'compartment_id' when calling list_work_requests." if compartment_id.nil? path = '/workRequests' operation_signing_strategy = :standard # rubocop:disable Style/NegatedIf # Query Params query_params = {} query_params[:compartmentId] = compartment_id query_params[:resourceId] = opts[:resource_id] if opts[:resource_id] query_params[:limit] = opts[:limit] if opts[:limit] query_params[:page] = opts[:page] if opts[:page] # Header Params header_params = {} header_params[:accept] = 'application/json' header_params[:'content-type'] = 'application/json' header_params[:'opc-request-id'] = opts[:opc_request_id] if opts[:opc_request_id] # rubocop:enable Style/NegatedIf post_body = nil # rubocop:disable Metrics/BlockLength OCI::Retry.(applicable_retry_config(opts), call_name: 'ResourceManagerClient#list_work_requests') do @api_client.call_api( :GET, path, endpoint, header_params: header_params, query_params: query_params, operation_signing_strategy: operation_signing_strategy, body: post_body, return_type: 'Array<OCI::ResourceManager::Models::WorkRequestSummary>' ) end # rubocop:enable Metrics/BlockLength end |
#logger ⇒ Logger
Returns The logger for this client. May be nil.
102 103 104 |
# File 'lib/oci/resource_manager/resource_manager_client.rb', line 102 def logger @api_client.config.logger end |
#update_job(job_id, update_job_details, opts = {}) ⇒ Response
Updates the specified job.
1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 |
# File 'lib/oci/resource_manager/resource_manager_client.rb', line 1484 def update_job(job_id, update_job_details, opts = {}) logger.debug 'Calling operation ResourceManagerClient#update_job.' if logger raise "Missing the required parameter 'job_id' when calling update_job." if job_id.nil? raise "Missing the required parameter 'update_job_details' when calling update_job." if update_job_details.nil? raise "Parameter value for 'job_id' must not be blank" if OCI::Internal::Util.blank_string?(job_id) path = '/jobs/{jobId}'.sub('{jobId}', job_id.to_s) operation_signing_strategy = :standard # rubocop:disable Style/NegatedIf # Query Params query_params = {} # Header Params header_params = {} header_params[:accept] = 'application/json' header_params[:'content-type'] = 'application/json' header_params[:'opc-request-id'] = opts[:opc_request_id] if opts[:opc_request_id] header_params[:'if-match'] = opts[:if_match] if opts[:if_match] # rubocop:enable Style/NegatedIf post_body = @api_client.object_to_http_body(update_job_details) # rubocop:disable Metrics/BlockLength OCI::Retry.(applicable_retry_config(opts), call_name: 'ResourceManagerClient#update_job') do @api_client.call_api( :PUT, path, endpoint, header_params: header_params, query_params: query_params, operation_signing_strategy: operation_signing_strategy, body: post_body, return_type: 'OCI::ResourceManager::Models::Job' ) end # rubocop:enable Metrics/BlockLength end |
#update_stack(stack_id, update_stack_details, opts = {}) ⇒ Response
Updates the specified stack object. Use UpdateStack when you update your Terraform configuration and want your changes to be reflected in the execution plan.
1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 |
# File 'lib/oci/resource_manager/resource_manager_client.rb', line 1550 def update_stack(stack_id, update_stack_details, opts = {}) logger.debug 'Calling operation ResourceManagerClient#update_stack.' if logger raise "Missing the required parameter 'stack_id' when calling update_stack." if stack_id.nil? raise "Missing the required parameter 'update_stack_details' when calling update_stack." if update_stack_details.nil? raise "Parameter value for 'stack_id' must not be blank" if OCI::Internal::Util.blank_string?(stack_id) path = '/stacks/{stackId}'.sub('{stackId}', stack_id.to_s) operation_signing_strategy = :standard # rubocop:disable Style/NegatedIf # Query Params query_params = {} # Header Params header_params = {} header_params[:accept] = 'application/json' header_params[:'content-type'] = 'application/json' header_params[:'opc-request-id'] = opts[:opc_request_id] if opts[:opc_request_id] header_params[:'if-match'] = opts[:if_match] if opts[:if_match] # rubocop:enable Style/NegatedIf post_body = @api_client.object_to_http_body(update_stack_details) # rubocop:disable Metrics/BlockLength OCI::Retry.(applicable_retry_config(opts), call_name: 'ResourceManagerClient#update_stack') do @api_client.call_api( :PUT, path, endpoint, header_params: header_params, query_params: query_params, operation_signing_strategy: operation_signing_strategy, body: post_body, return_type: 'OCI::ResourceManager::Models::Stack' ) end # rubocop:enable Metrics/BlockLength end |