Class: OCI::CloudBridge::InventoryClient
- Inherits:
-
Object
- Object
- OCI::CloudBridge::InventoryClient
- Defined in:
- lib/oci/cloud_bridge/inventory_client.rb
Overview
API for Oracle Cloud Bridge service.
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 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
-
#analyze_assets(compartment_id, aggregation_properties, opts = {}) ⇒ Response
Returns an aggregation of assets.
-
#change_asset_compartment(asset_id, change_asset_compartment_details, opts = {}) ⇒ Response
Moves an asset resource from one compartment to another.
-
#change_asset_tags(asset_id, change_asset_tags_details, opts = {}) ⇒ Response
Change an asset's tag.
-
#create_asset(create_asset_details, opts = {}) ⇒ Response
Creates an asset.
-
#create_inventory(create_inventory_details, opts = {}) ⇒ Response
Creates an inventory.
-
#delete_asset(asset_id, opts = {}) ⇒ Response
Deletes an asset resource by identifier.
-
#delete_inventory(inventory_id, opts = {}) ⇒ Response
Deletes an inventory resource by identifier.
-
#get_asset(asset_id, opts = {}) ⇒ Response
Gets an asset by identifier.
-
#get_inventory(inventory_id, opts = {}) ⇒ Response
Gets an inventory by identifier.
-
#import_inventory(import_inventory_details, inventory_id, opts = {}) ⇒ Response
Import resources in inventory.
-
#initialize(config: nil, region: nil, endpoint: nil, signer: nil, proxy_settings: nil, retry_config: nil) ⇒ InventoryClient
constructor
Creates a new InventoryClient.
-
#list_assets(compartment_id, opts = {}) ⇒ Response
Returns a list of assets.
-
#list_historical_metrics(asset_id, opts = {}) ⇒ Response
List asset historical metrics.
-
#list_inventories(compartment_id, opts = {}) ⇒ Response
Returns a list of inventories.
-
#logger ⇒ Logger
The logger for this client.
-
#submit_historical_metrics(submit_historical_metrics_details, asset_id, opts = {}) ⇒ Response
Creates or updates all metrics related to the asset.
-
#update_asset(asset_id, update_asset_details, opts = {}) ⇒ Response
Updates the asset.
-
#update_inventory(inventory_id, update_inventory_details, opts = {}) ⇒ Response
Updates an inventory.
Constructor Details
#initialize(config: nil, region: nil, endpoint: nil, signer: nil, proxy_settings: nil, retry_config: nil) ⇒ InventoryClient
Creates a new InventoryClient. 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.
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/oci/cloud_bridge/inventory_client.rb', line 55 def initialize(config: nil, region: nil, endpoint: nil, signer: nil, proxy_settings: nil, retry_config: nil) # If the signer is an InstancePrincipalsSecurityTokenSigner or SecurityTokenSigner and no config was supplied (they are self-sufficient signers) # 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.validate_and_build_config_with_signer(config, signer) signer = OCI::Signer.config_file_auth_builder(config) if signer.nil? @api_client = OCI::ApiClient.new(config, signer, proxy_settings: proxy_settings) @retry_config = retry_config if endpoint @endpoint = endpoint + '/20220509' else region ||= config.region region ||= signer.region if signer.respond_to?(:region) self.region = region end logger.info "InventoryClient endpoint set to '#{@endpoint}'." if logger end |
Instance Attribute Details
#api_client ⇒ OCI::ApiClient (readonly)
Client used to make HTTP requests.
15 16 17 |
# File 'lib/oci/cloud_bridge/inventory_client.rb', line 15 def api_client @api_client end |
#endpoint ⇒ String (readonly)
Fully qualified endpoint URL
19 20 21 |
# File 'lib/oci/cloud_bridge/inventory_client.rb', line 19 def endpoint @endpoint end |
#region ⇒ String
The region, which will usually correspond to a value in Regions::REGION_ENUM.
29 30 31 |
# File 'lib/oci/cloud_bridge/inventory_client.rb', line 29 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
25 26 27 |
# File 'lib/oci/cloud_bridge/inventory_client.rb', line 25 def retry_config @retry_config end |
Instance Method Details
#analyze_assets(compartment_id, aggregation_properties, opts = {}) ⇒ Response
Click here to see an example of how to use analyze_assets API.
Returns an aggregation of assets. Aggregation groups are sorted by groupBy property. Default sort order is ascending, but can be overridden by the sortOrder parameter.
123 124 125 126 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 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 |
# File 'lib/oci/cloud_bridge/inventory_client.rb', line 123 def analyze_assets(compartment_id, aggregation_properties, opts = {}) logger.debug 'Calling operation InventoryClient#analyze_assets.' if logger raise "Missing the required parameter 'compartment_id' when calling analyze_assets." if compartment_id.nil? raise "Missing the required parameter 'aggregation_properties' when calling analyze_assets." if aggregation_properties.nil? if opts[:lifecycle_state] && !OCI::CloudBridge::Models::Asset::LIFECYCLE_STATE_ENUM.include?(opts[:lifecycle_state]) raise 'Invalid value for "lifecycle_state", must be one of the values in OCI::CloudBridge::Models::Asset::LIFECYCLE_STATE_ENUM.' end if opts[:asset_type] && !OCI::CloudBridge::Models::ASSET_TYPE_ENUM.include?(opts[:asset_type]) raise 'Invalid value for "asset_type", must be one of the values in OCI::CloudBridge::Models::ASSET_TYPE_ENUM.' end if opts[:sort_order] && !OCI::CloudBridge::Models::SORT_ORDERS_ENUM.include?(opts[:sort_order]) raise 'Invalid value for "sort_order", must be one of the values in OCI::CloudBridge::Models::SORT_ORDERS_ENUM.' end path = '/assetAnalytics' operation_signing_strategy = :standard # rubocop:disable Style/NegatedIf # Query Params query_params = {} query_params[:compartmentId] = compartment_id query_params[:aggregationProperties] = OCI::ApiClient.build_collection_params(aggregation_properties, :multi) query_params[:limit] = opts[:limit] if opts[:limit] query_params[:page] = opts[:page] if opts[:page] query_params[:lifecycleState] = opts[:lifecycle_state] if opts[:lifecycle_state] query_params[:sourceKey] = opts[:source_key] if opts[:source_key] query_params[:externalAssetKey] = opts[:external_asset_key] if opts[:external_asset_key] query_params[:assetType] = opts[:asset_type] if opts[:asset_type] query_params[:sortOrder] = opts[:sort_order] if opts[:sort_order] query_params[:groupBy] = OCI::ApiClient.build_collection_params(opts[:group_by], :multi) if opts[:group_by] && !opts[:group_by].empty? query_params[:inventoryId] = opts[:inventory_id] if opts[:inventory_id] # 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: 'InventoryClient#analyze_assets') 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::CloudBridge::Models::AssetAggregationCollection' ) end # rubocop:enable Metrics/BlockLength end |
#change_asset_compartment(asset_id, change_asset_compartment_details, opts = {}) ⇒ Response
Click here to see an example of how to use change_asset_compartment API.
Moves an asset resource from one compartment to another. When provided, If-Match is checked against ETag values of the resource.
213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 |
# File 'lib/oci/cloud_bridge/inventory_client.rb', line 213 def change_asset_compartment(asset_id, change_asset_compartment_details, opts = {}) logger.debug 'Calling operation InventoryClient#change_asset_compartment.' if logger raise "Missing the required parameter 'asset_id' when calling change_asset_compartment." if asset_id.nil? raise "Missing the required parameter 'change_asset_compartment_details' when calling change_asset_compartment." if change_asset_compartment_details.nil? raise "Parameter value for 'asset_id' must not be blank" if OCI::Internal::Util.blank_string?(asset_id) path = '/assets/{assetId}/actions/changeCompartment'.sub('{assetId}', asset_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_asset_compartment_details) # rubocop:disable Metrics/BlockLength OCI::Retry.(applicable_retry_config(opts), call_name: 'InventoryClient#change_asset_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 |
#change_asset_tags(asset_id, change_asset_tags_details, opts = {}) ⇒ Response
Click here to see an example of how to use change_asset_tags API.
Change an asset's tag.
283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 |
# File 'lib/oci/cloud_bridge/inventory_client.rb', line 283 def (asset_id, , opts = {}) logger.debug 'Calling operation InventoryClient#change_asset_tags.' if logger raise "Missing the required parameter 'asset_id' when calling change_asset_tags." if asset_id.nil? raise "Missing the required parameter 'change_asset_tags_details' when calling change_asset_tags." if .nil? raise "Parameter value for 'asset_id' must not be blank" if OCI::Internal::Util.blank_string?(asset_id) path = '/assets/{assetId}/actions/changeTags'.sub('{assetId}', asset_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() # rubocop:disable Metrics/BlockLength OCI::Retry.(applicable_retry_config(opts), call_name: 'InventoryClient#change_asset_tags') 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::CloudBridge::Models::Asset' ) end # rubocop:enable Metrics/BlockLength end |
#create_asset(create_asset_details, opts = {}) ⇒ Response
Click here to see an example of how to use create_asset API.
Creates an asset.
347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 |
# File 'lib/oci/cloud_bridge/inventory_client.rb', line 347 def create_asset(create_asset_details, opts = {}) logger.debug 'Calling operation InventoryClient#create_asset.' if logger raise "Missing the required parameter 'create_asset_details' when calling create_asset." if create_asset_details.nil? path = '/assets' 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_asset_details) # rubocop:disable Metrics/BlockLength OCI::Retry.(applicable_retry_config(opts), call_name: 'InventoryClient#create_asset') 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::CloudBridge::Models::Asset' ) end # rubocop:enable Metrics/BlockLength end |
#create_inventory(create_inventory_details, opts = {}) ⇒ Response
Click here to see an example of how to use create_inventory API.
Creates an inventory.
408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 |
# File 'lib/oci/cloud_bridge/inventory_client.rb', line 408 def create_inventory(create_inventory_details, opts = {}) logger.debug 'Calling operation InventoryClient#create_inventory.' if logger raise "Missing the required parameter 'create_inventory_details' when calling create_inventory." if create_inventory_details.nil? path = '/inventories' 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_inventory_details) # rubocop:disable Metrics/BlockLength OCI::Retry.(applicable_retry_config(opts), call_name: 'InventoryClient#create_inventory') 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 |
#delete_asset(asset_id, opts = {}) ⇒ Response
Click here to see an example of how to use delete_asset API.
Deletes an asset resource by identifier.
468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 |
# File 'lib/oci/cloud_bridge/inventory_client.rb', line 468 def delete_asset(asset_id, opts = {}) logger.debug 'Calling operation InventoryClient#delete_asset.' if logger raise "Missing the required parameter 'asset_id' when calling delete_asset." if asset_id.nil? raise "Parameter value for 'asset_id' must not be blank" if OCI::Internal::Util.blank_string?(asset_id) path = '/assets/{assetId}'.sub('{assetId}', asset_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] # rubocop:enable Style/NegatedIf post_body = nil # rubocop:disable Metrics/BlockLength OCI::Retry.(applicable_retry_config(opts), call_name: 'InventoryClient#delete_asset') 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 |
#delete_inventory(inventory_id, opts = {}) ⇒ Response
Click here to see an example of how to use delete_inventory API.
Deletes an inventory resource by identifier.
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 561 562 563 564 |
# File 'lib/oci/cloud_bridge/inventory_client.rb', line 528 def delete_inventory(inventory_id, opts = {}) logger.debug 'Calling operation InventoryClient#delete_inventory.' if logger raise "Missing the required parameter 'inventory_id' when calling delete_inventory." if inventory_id.nil? raise "Parameter value for 'inventory_id' must not be blank" if OCI::Internal::Util.blank_string?(inventory_id) path = '/inventories/{inventoryId}'.sub('{inventoryId}', inventory_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] # rubocop:enable Style/NegatedIf post_body = nil # rubocop:disable Metrics/BlockLength OCI::Retry.(applicable_retry_config(opts), call_name: 'InventoryClient#delete_inventory') 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_asset(asset_id, opts = {}) ⇒ Response
Click here to see an example of how to use get_asset API.
Gets an asset by identifier.
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 618 |
# File 'lib/oci/cloud_bridge/inventory_client.rb', line 582 def get_asset(asset_id, opts = {}) logger.debug 'Calling operation InventoryClient#get_asset.' if logger raise "Missing the required parameter 'asset_id' when calling get_asset." if asset_id.nil? raise "Parameter value for 'asset_id' must not be blank" if OCI::Internal::Util.blank_string?(asset_id) path = '/assets/{assetId}'.sub('{assetId}', asset_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: 'InventoryClient#get_asset') 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::CloudBridge::Models::Asset' ) end # rubocop:enable Metrics/BlockLength end |
#get_inventory(inventory_id, opts = {}) ⇒ Response
Click here to see an example of how to use get_inventory API.
Gets an inventory by identifier.
636 637 638 639 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 |
# File 'lib/oci/cloud_bridge/inventory_client.rb', line 636 def get_inventory(inventory_id, opts = {}) logger.debug 'Calling operation InventoryClient#get_inventory.' if logger raise "Missing the required parameter 'inventory_id' when calling get_inventory." if inventory_id.nil? raise "Parameter value for 'inventory_id' must not be blank" if OCI::Internal::Util.blank_string?(inventory_id) path = '/inventories/{inventoryId}'.sub('{inventoryId}', inventory_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: 'InventoryClient#get_inventory') 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::CloudBridge::Models::Inventory' ) end # rubocop:enable Metrics/BlockLength end |
#import_inventory(import_inventory_details, inventory_id, opts = {}) ⇒ Response
Click here to see an example of how to use import_inventory API.
Import resources in inventory.
697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 |
# File 'lib/oci/cloud_bridge/inventory_client.rb', line 697 def import_inventory(import_inventory_details, inventory_id, opts = {}) logger.debug 'Calling operation InventoryClient#import_inventory.' if logger raise "Missing the required parameter 'import_inventory_details' when calling import_inventory." if import_inventory_details.nil? raise "Missing the required parameter 'inventory_id' when calling import_inventory." if inventory_id.nil? raise "Parameter value for 'inventory_id' must not be blank" if OCI::Internal::Util.blank_string?(inventory_id) path = '/inventories/{inventoryId}/actions/import'.sub('{inventoryId}', inventory_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-retry-token'] = opts[:opc_retry_token] if opts[:opc_retry_token] header_params[:'opc-request-id'] = opts[:opc_request_id] if opts[:opc_request_id] # rubocop:enable Style/NegatedIf header_params[:'opc-retry-token'] ||= OCI::Retry.generate_opc_retry_token post_body = @api_client.object_to_http_body(import_inventory_details) # rubocop:disable Metrics/BlockLength OCI::Retry.(applicable_retry_config(opts), call_name: 'InventoryClient#import_inventory') 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 |
#list_assets(compartment_id, opts = {}) ⇒ Response
Click here to see an example of how to use list_assets API.
Returns a list of assets.
Allowed values are: timeCreated, timeUpdated, displayName
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 822 823 824 825 826 827 828 829 830 |
# File 'lib/oci/cloud_bridge/inventory_client.rb', line 767 def list_assets(compartment_id, opts = {}) logger.debug 'Calling operation InventoryClient#list_assets.' if logger raise "Missing the required parameter 'compartment_id' when calling list_assets." if compartment_id.nil? if opts[:lifecycle_state] && !OCI::CloudBridge::Models::Asset::LIFECYCLE_STATE_ENUM.include?(opts[:lifecycle_state]) raise 'Invalid value for "lifecycle_state", must be one of the values in OCI::CloudBridge::Models::Asset::LIFECYCLE_STATE_ENUM.' end if opts[:asset_type] && !OCI::CloudBridge::Models::ASSET_TYPE_ENUM.include?(opts[:asset_type]) raise 'Invalid value for "asset_type", must be one of the values in OCI::CloudBridge::Models::ASSET_TYPE_ENUM.' end if opts[:sort_order] && !OCI::CloudBridge::Models::SORT_ORDERS_ENUM.include?(opts[:sort_order]) raise 'Invalid value for "sort_order", must be one of the values in OCI::CloudBridge::Models::SORT_ORDERS_ENUM.' end if opts[:sort_by] && !%w[timeCreated timeUpdated displayName].include?(opts[:sort_by]) raise 'Invalid value for "sort_by", must be one of timeCreated, timeUpdated, displayName.' end path = '/assets' operation_signing_strategy = :standard # rubocop:disable Style/NegatedIf # Query Params query_params = {} query_params[:compartmentId] = compartment_id query_params[:limit] = opts[:limit] if opts[:limit] query_params[:page] = opts[:page] if opts[:page] query_params[:lifecycleState] = opts[:lifecycle_state] if opts[:lifecycle_state] query_params[:sourceKey] = opts[:source_key] if opts[:source_key] query_params[:externalAssetKey] = opts[:external_asset_key] if opts[:external_asset_key] query_params[:assetType] = opts[:asset_type] if opts[:asset_type] query_params[:assetId] = opts[:asset_id] if opts[:asset_id] query_params[:displayName] = opts[:display_name] if opts[:display_name] query_params[:sortOrder] = opts[:sort_order] if opts[:sort_order] query_params[:sortBy] = opts[:sort_by] if opts[:sort_by] query_params[:inventoryId] = opts[:inventory_id] if opts[:inventory_id] # 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: 'InventoryClient#list_assets') 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::CloudBridge::Models::AssetCollection' ) end # rubocop:enable Metrics/BlockLength end |
#list_historical_metrics(asset_id, opts = {}) ⇒ Response
Click here to see an example of how to use list_historical_metrics API.
List asset historical metrics. Allowed values are: timeCreated, timeUpdated, displayName
854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 |
# File 'lib/oci/cloud_bridge/inventory_client.rb', line 854 def list_historical_metrics(asset_id, opts = {}) logger.debug 'Calling operation InventoryClient#list_historical_metrics.' if logger raise "Missing the required parameter 'asset_id' when calling list_historical_metrics." if asset_id.nil? if opts[:sort_order] && !OCI::CloudBridge::Models::SORT_ORDERS_ENUM.include?(opts[:sort_order]) raise 'Invalid value for "sort_order", must be one of the values in OCI::CloudBridge::Models::SORT_ORDERS_ENUM.' end if opts[:sort_by] && !%w[timeCreated timeUpdated displayName].include?(opts[:sort_by]) raise 'Invalid value for "sort_by", must be one of timeCreated, timeUpdated, displayName.' end raise "Parameter value for 'asset_id' must not be blank" if OCI::Internal::Util.blank_string?(asset_id) path = '/assets/{assetId}/historicalMetrics'.sub('{assetId}', asset_id.to_s) operation_signing_strategy = :standard # rubocop:disable Style/NegatedIf # Query Params query_params = {} 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] query_params[:sortBy] = opts[:sort_by] if opts[:sort_by] # 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: 'InventoryClient#list_historical_metrics') 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::CloudBridge::Models::HistoricalMetricCollection' ) end # rubocop:enable Metrics/BlockLength end |
#list_inventories(compartment_id, opts = {}) ⇒ Response
Click here to see an example of how to use list_inventories API.
Returns a list of inventories.
Allowed values are: timeCreated, timeUpdated, displayName
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 980 981 |
# File 'lib/oci/cloud_bridge/inventory_client.rb', line 928 def list_inventories(compartment_id, opts = {}) logger.debug 'Calling operation InventoryClient#list_inventories.' if logger raise "Missing the required parameter 'compartment_id' when calling list_inventories." if compartment_id.nil? if opts[:sort_order] && !OCI::CloudBridge::Models::SORT_ORDERS_ENUM.include?(opts[:sort_order]) raise 'Invalid value for "sort_order", must be one of the values in OCI::CloudBridge::Models::SORT_ORDERS_ENUM.' end if opts[:sort_by] && !%w[timeCreated timeUpdated displayName].include?(opts[:sort_by]) raise 'Invalid value for "sort_by", must be one of timeCreated, timeUpdated, displayName.' end if opts[:lifecycle_state] && !OCI::CloudBridge::Models::Inventory::LIFECYCLE_STATE_ENUM.include?(opts[:lifecycle_state]) raise 'Invalid value for "lifecycle_state", must be one of the values in OCI::CloudBridge::Models::Inventory::LIFECYCLE_STATE_ENUM.' end path = '/inventories' operation_signing_strategy = :standard # rubocop:disable Style/NegatedIf # Query Params query_params = {} query_params[:compartmentId] = compartment_id query_params[:sortOrder] = opts[:sort_order] if opts[:sort_order] query_params[:sortBy] = opts[:sort_by] if opts[:sort_by] query_params[:limit] = opts[:limit] if opts[:limit] query_params[:page] = opts[:page] if opts[:page] query_params[:lifecycleState] = opts[:lifecycle_state] if opts[:lifecycle_state] # 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: 'InventoryClient#list_inventories') 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::CloudBridge::Models::InventoryCollection' ) end # rubocop:enable Metrics/BlockLength end |
#logger ⇒ Logger
Returns The logger for this client. May be nil.
94 95 96 |
# File 'lib/oci/cloud_bridge/inventory_client.rb', line 94 def logger @api_client.config.logger end |
#submit_historical_metrics(submit_historical_metrics_details, asset_id, opts = {}) ⇒ Response
Click here to see an example of how to use submit_historical_metrics API.
Creates or updates all metrics related to the asset.
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 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 |
# File 'lib/oci/cloud_bridge/inventory_client.rb', line 1006 def submit_historical_metrics(submit_historical_metrics_details, asset_id, opts = {}) logger.debug 'Calling operation InventoryClient#submit_historical_metrics.' if logger raise "Missing the required parameter 'submit_historical_metrics_details' when calling submit_historical_metrics." if submit_historical_metrics_details.nil? raise "Missing the required parameter 'asset_id' when calling submit_historical_metrics." if asset_id.nil? raise "Parameter value for 'asset_id' must not be blank" if OCI::Internal::Util.blank_string?(asset_id) path = '/assets/{assetId}/actions/submitHistoricalMetrics'.sub('{assetId}', asset_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] # rubocop:enable Style/NegatedIf post_body = @api_client.object_to_http_body(submit_historical_metrics_details) # rubocop:disable Metrics/BlockLength OCI::Retry.(applicable_retry_config(opts), call_name: 'InventoryClient#submit_historical_metrics') 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::CloudBridge::Models::HistoricalMetricCollection' ) end # rubocop:enable Metrics/BlockLength end |
#update_asset(asset_id, update_asset_details, opts = {}) ⇒ Response
Click here to see an example of how to use update_asset API.
Updates the asset.
1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 |
# File 'lib/oci/cloud_bridge/inventory_client.rb', line 1069 def update_asset(asset_id, update_asset_details, opts = {}) logger.debug 'Calling operation InventoryClient#update_asset.' if logger raise "Missing the required parameter 'asset_id' when calling update_asset." if asset_id.nil? raise "Missing the required parameter 'update_asset_details' when calling update_asset." if update_asset_details.nil? raise "Parameter value for 'asset_id' must not be blank" if OCI::Internal::Util.blank_string?(asset_id) path = '/assets/{assetId}'.sub('{assetId}', asset_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] # rubocop:enable Style/NegatedIf post_body = @api_client.object_to_http_body(update_asset_details) # rubocop:disable Metrics/BlockLength OCI::Retry.(applicable_retry_config(opts), call_name: 'InventoryClient#update_asset') 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::CloudBridge::Models::Asset' ) end # rubocop:enable Metrics/BlockLength end |
#update_inventory(inventory_id, update_inventory_details, opts = {}) ⇒ Response
Click here to see an example of how to use update_inventory API.
Updates an inventory.
1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 |
# File 'lib/oci/cloud_bridge/inventory_client.rb', line 1132 def update_inventory(inventory_id, update_inventory_details, opts = {}) logger.debug 'Calling operation InventoryClient#update_inventory.' if logger raise "Missing the required parameter 'inventory_id' when calling update_inventory." if inventory_id.nil? raise "Missing the required parameter 'update_inventory_details' when calling update_inventory." if update_inventory_details.nil? raise "Parameter value for 'inventory_id' must not be blank" if OCI::Internal::Util.blank_string?(inventory_id) path = '/inventories/{inventoryId}'.sub('{inventoryId}', inventory_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] # rubocop:enable Style/NegatedIf post_body = @api_client.object_to_http_body(update_inventory_details) # rubocop:disable Metrics/BlockLength OCI::Retry.(applicable_retry_config(opts), call_name: 'InventoryClient#update_inventory') 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::CloudBridge::Models::Inventory' ) end # rubocop:enable Metrics/BlockLength end |