Class: OCI::Costad::CostAdClient
- Inherits:
-
Object
- Object
- OCI::Costad::CostAdClient
- Defined in:
- lib/oci/costad/cost_ad_client.rb
Overview
Use the CostAd API to manage cost monitor, cost anomaly events and subscription list. For more information, see Cost Anomaly Detection Overview.
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
-
#create_cost_alert_subscription(create_cost_alert_subscription_details, opts = {}) ⇒ Response
Creates a new CostAlert Subscription.
-
#create_cost_anomaly_monitor(create_cost_anomaly_monitor_details, opts = {}) ⇒ Response
Creates a new costAnomaly Monitor.
-
#delete_cost_alert_subscription(cost_alert_subscription_id, opts = {}) ⇒ Response
Deletes a specified CostAlertSubscription resource.
-
#delete_cost_anomaly_monitor(cost_anomaly_monitor_id, opts = {}) ⇒ Response
Deletes a specified CostAnomalyMonitor resource.
-
#disable_cost_anomaly_monitor(cost_anomaly_monitor_id, opts = {}) ⇒ Response
Disables the cost anomaly monitor.
-
#enable_cost_anomaly_monitor(cost_anomaly_monitor_id, opts = {}) ⇒ Response
Enables the cost anomaly monitor.
-
#get_cost_alert_subscription(cost_alert_subscription_id, opts = {}) ⇒ Response
Gets a CostAlertSubscription by the identifier.
-
#get_cost_anomaly_event(cost_anomaly_event_id, opts = {}) ⇒ Response
Gets a CostAnomalyEvent by the identifier.
-
#get_cost_anomaly_monitor(cost_anomaly_monitor_id, opts = {}) ⇒ Response
Gets a CostAnomalyMonitor by the identifier.
-
#initialize(config: nil, region: nil, endpoint: nil, signer: nil, proxy_settings: nil, retry_config: nil) ⇒ CostAdClient
constructor
Creates a new CostAdClient.
-
#list_cost_alert_subscriptions(compartment_id, opts = {}) ⇒ Response
Gets a list of Cost Alert Subscription in a compartment.
-
#list_cost_anomaly_events(compartment_id, opts = {}) ⇒ Response
Gets a list of Cost Anomaly Event in a compartment.
-
#list_cost_anomaly_monitors(compartment_id, opts = {}) ⇒ Response
Gets a list of Cost Anomaly Monitors in a compartment.
-
#logger ⇒ Logger
The logger for this client.
-
#summarize_cost_anomaly_event_analytics(compartment_id, opts = {}) ⇒ Response
Gets a list of Cost Anomaly Events analytics summary - aggregated metrics for a given time period.
-
#update_cost_alert_subscription(cost_alert_subscription_id, update_cost_alert_subscription_details, opts = {}) ⇒ Response
Update a CostAlertSubscription identified by the OCID.
-
#update_cost_anomaly_event(cost_anomaly_event_id, update_cost_anomaly_event_details, opts = {}) ⇒ Response
Update a CostAnomalyEvent identified by the OCID.
-
#update_cost_anomaly_monitor(cost_anomaly_monitor_id, update_cost_anomaly_monitor_details, opts = {}) ⇒ Response
Update a CostAnomalyMonitor identified by the OCID.
Constructor Details
#initialize(config: nil, region: nil, endpoint: nil, signer: nil, proxy_settings: nil, retry_config: nil) ⇒ CostAdClient
Creates a new CostAdClient. 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/costad/cost_ad_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 + '/20190111' else region ||= config.region region ||= signer.region if signer.respond_to?(:region) self.region = region end logger.info "CostAdClient 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/costad/cost_ad_client.rb', line 15 def api_client @api_client end |
#endpoint ⇒ String (readonly)
Fully qualified endpoint URL
19 20 21 |
# File 'lib/oci/costad/cost_ad_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/costad/cost_ad_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/costad/cost_ad_client.rb', line 25 def retry_config @retry_config end |
Instance Method Details
#create_cost_alert_subscription(create_cost_alert_subscription_details, opts = {}) ⇒ Response
Click here to see an example of how to use create_cost_alert_subscription API.
Creates a new CostAlert Subscription.
118 119 120 121 122 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 |
# File 'lib/oci/costad/cost_ad_client.rb', line 118 def create_cost_alert_subscription(create_cost_alert_subscription_details, opts = {}) logger.debug 'Calling operation CostAdClient#create_cost_alert_subscription.' if logger raise "Missing the required parameter 'create_cost_alert_subscription_details' when calling create_cost_alert_subscription." if create_cost_alert_subscription_details.nil? path = '/costAlertSubscriptions' 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(create_cost_alert_subscription_details) # rubocop:disable Metrics/BlockLength OCI::Retry.(applicable_retry_config(opts), call_name: 'CostAdClient#create_cost_alert_subscription') 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::Costad::Models::CostAlertSubscription' ) end # rubocop:enable Metrics/BlockLength end |
#create_cost_anomaly_monitor(create_cost_anomaly_monitor_details, opts = {}) ⇒ Response
Click here to see an example of how to use create_cost_anomaly_monitor API.
Creates a new costAnomaly Monitor.
180 181 182 183 184 185 186 187 188 189 190 191 192 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 |
# File 'lib/oci/costad/cost_ad_client.rb', line 180 def create_cost_anomaly_monitor(create_cost_anomaly_monitor_details, opts = {}) logger.debug 'Calling operation CostAdClient#create_cost_anomaly_monitor.' if logger raise "Missing the required parameter 'create_cost_anomaly_monitor_details' when calling create_cost_anomaly_monitor." if create_cost_anomaly_monitor_details.nil? path = '/costAnomalyMonitors' 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(create_cost_anomaly_monitor_details) # rubocop:disable Metrics/BlockLength OCI::Retry.(applicable_retry_config(opts), call_name: 'CostAdClient#create_cost_anomaly_monitor') 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::Costad::Models::CostAnomalyMonitor' ) end # rubocop:enable Metrics/BlockLength end |
#delete_cost_alert_subscription(cost_alert_subscription_id, opts = {}) ⇒ Response
Click here to see an example of how to use delete_cost_alert_subscription API.
Deletes a specified CostAlertSubscription resource.
241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 |
# File 'lib/oci/costad/cost_ad_client.rb', line 241 def delete_cost_alert_subscription(cost_alert_subscription_id, opts = {}) logger.debug 'Calling operation CostAdClient#delete_cost_alert_subscription.' if logger raise "Missing the required parameter 'cost_alert_subscription_id' when calling delete_cost_alert_subscription." if cost_alert_subscription_id.nil? raise "Parameter value for 'cost_alert_subscription_id' must not be blank" if OCI::Internal::Util.blank_string?(cost_alert_subscription_id) path = '/costAlertSubscriptions/{costAlertSubscriptionId}'.sub('{costAlertSubscriptionId}', cost_alert_subscription_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: 'CostAdClient#delete_cost_alert_subscription') 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_cost_anomaly_monitor(cost_anomaly_monitor_id, opts = {}) ⇒ Response
Click here to see an example of how to use delete_cost_anomaly_monitor API.
Deletes a specified CostAnomalyMonitor resource.
301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 |
# File 'lib/oci/costad/cost_ad_client.rb', line 301 def delete_cost_anomaly_monitor(cost_anomaly_monitor_id, opts = {}) logger.debug 'Calling operation CostAdClient#delete_cost_anomaly_monitor.' if logger raise "Missing the required parameter 'cost_anomaly_monitor_id' when calling delete_cost_anomaly_monitor." if cost_anomaly_monitor_id.nil? raise "Parameter value for 'cost_anomaly_monitor_id' must not be blank" if OCI::Internal::Util.blank_string?(cost_anomaly_monitor_id) path = '/costAnomalyMonitors/{costAnomalyMonitorId}'.sub('{costAnomalyMonitorId}', cost_anomaly_monitor_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: 'CostAdClient#delete_cost_anomaly_monitor') 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 |
#disable_cost_anomaly_monitor(cost_anomaly_monitor_id, opts = {}) ⇒ Response
Click here to see an example of how to use disable_cost_anomaly_monitor API.
Disables the cost anomaly monitor. This stops cost anomaly detection for targeted resource(s).
367 368 369 370 371 372 373 374 375 376 377 378 379 380 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 |
# File 'lib/oci/costad/cost_ad_client.rb', line 367 def disable_cost_anomaly_monitor(cost_anomaly_monitor_id, opts = {}) logger.debug 'Calling operation CostAdClient#disable_cost_anomaly_monitor.' if logger raise "Missing the required parameter 'cost_anomaly_monitor_id' when calling disable_cost_anomaly_monitor." if cost_anomaly_monitor_id.nil? raise "Parameter value for 'cost_anomaly_monitor_id' must not be blank" if OCI::Internal::Util.blank_string?(cost_anomaly_monitor_id) path = '/costAnomalyMonitors/{costAnomalyMonitorId}/actions/disable'.sub('{costAnomalyMonitorId}', cost_anomaly_monitor_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 = nil # rubocop:disable Metrics/BlockLength OCI::Retry.(applicable_retry_config(opts), call_name: 'CostAdClient#disable_cost_anomaly_monitor') 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::Costad::Models::CostAnomalyMonitor' ) end # rubocop:enable Metrics/BlockLength end |
#enable_cost_anomaly_monitor(cost_anomaly_monitor_id, opts = {}) ⇒ Response
Click here to see an example of how to use enable_cost_anomaly_monitor API.
Enables the cost anomaly monitor. This (re)starts the cost anomaly detection for targeted resource(s).
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 473 474 475 |
# File 'lib/oci/costad/cost_ad_client.rb', line 436 def enable_cost_anomaly_monitor(cost_anomaly_monitor_id, opts = {}) logger.debug 'Calling operation CostAdClient#enable_cost_anomaly_monitor.' if logger raise "Missing the required parameter 'cost_anomaly_monitor_id' when calling enable_cost_anomaly_monitor." if cost_anomaly_monitor_id.nil? raise "Parameter value for 'cost_anomaly_monitor_id' must not be blank" if OCI::Internal::Util.blank_string?(cost_anomaly_monitor_id) path = '/costAnomalyMonitors/{costAnomalyMonitorId}/actions/enable'.sub('{costAnomalyMonitorId}', cost_anomaly_monitor_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 = nil # rubocop:disable Metrics/BlockLength OCI::Retry.(applicable_retry_config(opts), call_name: 'CostAdClient#enable_cost_anomaly_monitor') 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::Costad::Models::CostAnomalyMonitor' ) end # rubocop:enable Metrics/BlockLength end |
#get_cost_alert_subscription(cost_alert_subscription_id, opts = {}) ⇒ Response
Click here to see an example of how to use get_cost_alert_subscription API.
Gets a CostAlertSubscription by the identifier.
493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 |
# File 'lib/oci/costad/cost_ad_client.rb', line 493 def get_cost_alert_subscription(cost_alert_subscription_id, opts = {}) logger.debug 'Calling operation CostAdClient#get_cost_alert_subscription.' if logger raise "Missing the required parameter 'cost_alert_subscription_id' when calling get_cost_alert_subscription." if cost_alert_subscription_id.nil? raise "Parameter value for 'cost_alert_subscription_id' must not be blank" if OCI::Internal::Util.blank_string?(cost_alert_subscription_id) path = '/costAlertSubscriptions/{costAlertSubscriptionId}'.sub('{costAlertSubscriptionId}', cost_alert_subscription_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: 'CostAdClient#get_cost_alert_subscription') 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::Costad::Models::CostAlertSubscription' ) end # rubocop:enable Metrics/BlockLength end |
#get_cost_anomaly_event(cost_anomaly_event_id, opts = {}) ⇒ Response
Click here to see an example of how to use get_cost_anomaly_event API.
Gets a CostAnomalyEvent by the identifier.
547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 |
# File 'lib/oci/costad/cost_ad_client.rb', line 547 def get_cost_anomaly_event(cost_anomaly_event_id, opts = {}) logger.debug 'Calling operation CostAdClient#get_cost_anomaly_event.' if logger raise "Missing the required parameter 'cost_anomaly_event_id' when calling get_cost_anomaly_event." if cost_anomaly_event_id.nil? raise "Parameter value for 'cost_anomaly_event_id' must not be blank" if OCI::Internal::Util.blank_string?(cost_anomaly_event_id) path = '/costAnomalyEvents/{costAnomalyEventId}'.sub('{costAnomalyEventId}', cost_anomaly_event_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: 'CostAdClient#get_cost_anomaly_event') 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::Costad::Models::CostAnomalyEvent' ) end # rubocop:enable Metrics/BlockLength end |
#get_cost_anomaly_monitor(cost_anomaly_monitor_id, opts = {}) ⇒ Response
Click here to see an example of how to use get_cost_anomaly_monitor API.
Gets a CostAnomalyMonitor by the identifier.
601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 |
# File 'lib/oci/costad/cost_ad_client.rb', line 601 def get_cost_anomaly_monitor(cost_anomaly_monitor_id, opts = {}) logger.debug 'Calling operation CostAdClient#get_cost_anomaly_monitor.' if logger raise "Missing the required parameter 'cost_anomaly_monitor_id' when calling get_cost_anomaly_monitor." if cost_anomaly_monitor_id.nil? raise "Parameter value for 'cost_anomaly_monitor_id' must not be blank" if OCI::Internal::Util.blank_string?(cost_anomaly_monitor_id) path = '/costAnomalyMonitors/{costAnomalyMonitorId}'.sub('{costAnomalyMonitorId}', cost_anomaly_monitor_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: 'CostAdClient#get_cost_anomaly_monitor') 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::Costad::Models::CostAnomalyMonitor' ) end # rubocop:enable Metrics/BlockLength end |
#list_cost_alert_subscriptions(compartment_id, opts = {}) ⇒ Response
Click here to see an example of how to use list_cost_alert_subscriptions API.
Gets a list of Cost Alert Subscription in a compartment.
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/costad/cost_ad_client.rb', line 666 def list_cost_alert_subscriptions(compartment_id, opts = {}) logger.debug 'Calling operation CostAdClient#list_cost_alert_subscriptions.' if logger raise "Missing the required parameter 'compartment_id' when calling list_cost_alert_subscriptions." if compartment_id.nil? if opts[:sort_order] && !OCI::Costad::Models::SORT_ORDER_ENUM.include?(opts[:sort_order]) raise 'Invalid value for "sort_order", must be one of the values in OCI::Costad::Models::SORT_ORDER_ENUM.' end if opts[:sort_by] && !OCI::Costad::Models::SORT_BY_FOR_COST_AD_ENUM.include?(opts[:sort_by]) raise 'Invalid value for "sort_by", must be one of the values in OCI::Costad::Models::SORT_BY_FOR_COST_AD_ENUM.' end if opts[:lifecycle_state] && !OCI::Costad::Models::CostAlertSubscription::LIFECYCLE_STATE_ENUM.include?(opts[:lifecycle_state]) raise 'Invalid value for "lifecycle_state", must be one of the values in OCI::Costad::Models::CostAlertSubscription::LIFECYCLE_STATE_ENUM.' end path = '/costAlertSubscriptions' 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[:sortOrder] = opts[:sort_order] if opts[:sort_order] query_params[:sortBy] = opts[:sort_by] if opts[:sort_by] query_params[:name] = opts[:name] if opts[:name] 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: 'CostAdClient#list_cost_alert_subscriptions') 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::Costad::Models::CostAlertSubscriptionCollection' ) end # rubocop:enable Metrics/BlockLength end |
#list_cost_anomaly_events(compartment_id, opts = {}) ⇒ Response
Click here to see an example of how to use list_cost_anomaly_events API.
Gets a list of Cost Anomaly Event in a compartment.
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 |
# File 'lib/oci/costad/cost_ad_client.rb', line 755 def list_cost_anomaly_events(compartment_id, opts = {}) logger.debug 'Calling operation CostAdClient#list_cost_anomaly_events.' if logger raise "Missing the required parameter 'compartment_id' when calling list_cost_anomaly_events." if compartment_id.nil? if opts[:sort_order] && !OCI::Costad::Models::SORT_ORDER_ENUM.include?(opts[:sort_order]) raise 'Invalid value for "sort_order", must be one of the values in OCI::Costad::Models::SORT_ORDER_ENUM.' end if opts[:sort_by] && !OCI::Costad::Models::SORT_BY_FOR_COST_ANOMALY_EVENT_ENUM.include?(opts[:sort_by]) raise 'Invalid value for "sort_by", must be one of the values in OCI::Costad::Models::SORT_BY_FOR_COST_ANOMALY_EVENT_ENUM.' end path = '/costAnomalyEvents' 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[:sortOrder] = opts[:sort_order] if opts[:sort_order] query_params[:sortBy] = opts[:sort_by] if opts[:sort_by] query_params[:name] = opts[:name] if opts[:name] query_params[:costAnomalyMonitorId] = opts[:cost_anomaly_monitor_id] if opts[:cost_anomaly_monitor_id] query_params[:targetTenantId] = OCI::ApiClient.build_collection_params(opts[:target_tenant_id], :csv) if opts[:target_tenant_id] && !opts[:target_tenant_id].empty? query_params[:timeAnomalyEventStartDate] = opts[:time_anomaly_event_start_date] if opts[:time_anomaly_event_start_date] query_params[:timeAnomalyEventEndDate] = opts[:time_anomaly_event_end_date] if opts[:time_anomaly_event_end_date] query_params[:region] = OCI::ApiClient.build_collection_params(opts[:region], :csv) if opts[:region] && !opts[:region].empty? query_params[:costImpact] = opts[:cost_impact] if opts[:cost_impact] query_params[:costImpactPercentage] = opts[:cost_impact_percentage] if opts[:cost_impact_percentage] # 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: 'CostAdClient#list_cost_anomaly_events') 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::Costad::Models::CostAnomalyEventCollection' ) end # rubocop:enable Metrics/BlockLength end |
#list_cost_anomaly_monitors(compartment_id, opts = {}) ⇒ Response
Click here to see an example of how to use list_cost_anomaly_monitors API.
Gets a list of Cost Anomaly Monitors in a compartment.
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 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 |
# File 'lib/oci/costad/cost_ad_client.rb', line 842 def list_cost_anomaly_monitors(compartment_id, opts = {}) logger.debug 'Calling operation CostAdClient#list_cost_anomaly_monitors.' if logger raise "Missing the required parameter 'compartment_id' when calling list_cost_anomaly_monitors." if compartment_id.nil? if opts[:sort_order] && !OCI::Costad::Models::SORT_ORDER_ENUM.include?(opts[:sort_order]) raise 'Invalid value for "sort_order", must be one of the values in OCI::Costad::Models::SORT_ORDER_ENUM.' end if opts[:sort_by] && !OCI::Costad::Models::SORT_BY_FOR_COST_AD_ENUM.include?(opts[:sort_by]) raise 'Invalid value for "sort_by", must be one of the values in OCI::Costad::Models::SORT_BY_FOR_COST_AD_ENUM.' end if opts[:lifecycle_state] && !OCI::Costad::Models::CostAnomalyMonitor::LIFECYCLE_STATE_ENUM.include?(opts[:lifecycle_state]) raise 'Invalid value for "lifecycle_state", must be one of the values in OCI::Costad::Models::CostAnomalyMonitor::LIFECYCLE_STATE_ENUM.' end path = '/costAnomalyMonitors' 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[:sortOrder] = opts[:sort_order] if opts[:sort_order] query_params[:sortBy] = opts[:sort_by] if opts[:sort_by] query_params[:lifecycleState] = opts[:lifecycle_state] if opts[:lifecycle_state] query_params[:name] = opts[:name] if opts[:name] query_params[:targetTenantId] = OCI::ApiClient.build_collection_params(opts[:target_tenant_id], :csv) if opts[:target_tenant_id] && !opts[:target_tenant_id].empty? query_params[:region] = OCI::ApiClient.build_collection_params(opts[:region], :csv) if opts[:region] && !opts[:region].empty? # 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: 'CostAdClient#list_cost_anomaly_monitors') 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::Costad::Models::CostAnomalyMonitorCollection' ) end # rubocop:enable Metrics/BlockLength end |
#logger ⇒ Logger
Returns The logger for this client. May be nil.
94 95 96 |
# File 'lib/oci/costad/cost_ad_client.rb', line 94 def logger @api_client.config.logger end |
#summarize_cost_anomaly_event_analytics(compartment_id, opts = {}) ⇒ Response
Click here to see an example of how to use summarize_cost_anomaly_event_analytics API.
Gets a list of Cost Anomaly Events analytics summary - aggregated metrics for a given time period.
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 982 983 984 985 986 987 988 989 |
# File 'lib/oci/costad/cost_ad_client.rb', line 933 def summarize_cost_anomaly_event_analytics(compartment_id, opts = {}) logger.debug 'Calling operation CostAdClient#summarize_cost_anomaly_event_analytics.' if logger raise "Missing the required parameter 'compartment_id' when calling summarize_cost_anomaly_event_analytics." if compartment_id.nil? if opts[:sort_order] && !OCI::Costad::Models::SORT_ORDER_ENUM.include?(opts[:sort_order]) raise 'Invalid value for "sort_order", must be one of the values in OCI::Costad::Models::SORT_ORDER_ENUM.' end if opts[:sort_by] && !OCI::Costad::Models::SORT_BY_FOR_COST_ANOMALY_EVENT_ENUM.include?(opts[:sort_by]) raise 'Invalid value for "sort_by", must be one of the values in OCI::Costad::Models::SORT_BY_FOR_COST_ANOMALY_EVENT_ENUM.' end path = '/costAnomalyEventAnalytics' 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[:sortOrder] = opts[:sort_order] if opts[:sort_order] query_params[:sortBy] = opts[:sort_by] if opts[:sort_by] query_params[:name] = opts[:name] if opts[:name] query_params[:costAnomalyMonitorId] = opts[:cost_anomaly_monitor_id] if opts[:cost_anomaly_monitor_id] query_params[:targetTenantId] = OCI::ApiClient.build_collection_params(opts[:target_tenant_id], :csv) if opts[:target_tenant_id] && !opts[:target_tenant_id].empty? query_params[:timeAnomalyEventStartDate] = opts[:time_anomaly_event_start_date] if opts[:time_anomaly_event_start_date] query_params[:timeAnomalyEventEndDate] = opts[:time_anomaly_event_end_date] if opts[:time_anomaly_event_end_date] query_params[:region] = OCI::ApiClient.build_collection_params(opts[:region], :csv) if opts[:region] && !opts[:region].empty? query_params[:costImpact] = opts[:cost_impact] if opts[:cost_impact] query_params[:costImpactPercentage] = opts[:cost_impact_percentage] if opts[:cost_impact_percentage] # 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: 'CostAdClient#summarize_cost_anomaly_event_analytics') 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::Costad::Models::CostAnomalyEventAnalyticCollection' ) end # rubocop:enable Metrics/BlockLength end |
#update_cost_alert_subscription(cost_alert_subscription_id, update_cost_alert_subscription_details, opts = {}) ⇒ Response
Click here to see an example of how to use update_cost_alert_subscription API.
Update a CostAlertSubscription identified by the OCID.
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 1045 1046 1047 1048 1049 1050 1051 1052 |
# File 'lib/oci/costad/cost_ad_client.rb', line 1014 def update_cost_alert_subscription(cost_alert_subscription_id, update_cost_alert_subscription_details, opts = {}) logger.debug 'Calling operation CostAdClient#update_cost_alert_subscription.' if logger raise "Missing the required parameter 'cost_alert_subscription_id' when calling update_cost_alert_subscription." if cost_alert_subscription_id.nil? raise "Missing the required parameter 'update_cost_alert_subscription_details' when calling update_cost_alert_subscription." if update_cost_alert_subscription_details.nil? raise "Parameter value for 'cost_alert_subscription_id' must not be blank" if OCI::Internal::Util.blank_string?(cost_alert_subscription_id) path = '/costAlertSubscriptions/{costAlertSubscriptionId}'.sub('{costAlertSubscriptionId}', cost_alert_subscription_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_cost_alert_subscription_details) # rubocop:disable Metrics/BlockLength OCI::Retry.(applicable_retry_config(opts), call_name: 'CostAdClient#update_cost_alert_subscription') 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::Costad::Models::CostAlertSubscription' ) end # rubocop:enable Metrics/BlockLength end |
#update_cost_anomaly_event(cost_anomaly_event_id, update_cost_anomaly_event_details, opts = {}) ⇒ Response
Click here to see an example of how to use update_cost_anomaly_event API.
Update a CostAnomalyEvent identified by the OCID.
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 1108 1109 1110 1111 1112 1113 1114 1115 |
# File 'lib/oci/costad/cost_ad_client.rb', line 1077 def update_cost_anomaly_event(cost_anomaly_event_id, update_cost_anomaly_event_details, opts = {}) logger.debug 'Calling operation CostAdClient#update_cost_anomaly_event.' if logger raise "Missing the required parameter 'cost_anomaly_event_id' when calling update_cost_anomaly_event." if cost_anomaly_event_id.nil? raise "Missing the required parameter 'update_cost_anomaly_event_details' when calling update_cost_anomaly_event." if update_cost_anomaly_event_details.nil? raise "Parameter value for 'cost_anomaly_event_id' must not be blank" if OCI::Internal::Util.blank_string?(cost_anomaly_event_id) path = '/costAnomalyEvents/{costAnomalyEventId}'.sub('{costAnomalyEventId}', cost_anomaly_event_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_cost_anomaly_event_details) # rubocop:disable Metrics/BlockLength OCI::Retry.(applicable_retry_config(opts), call_name: 'CostAdClient#update_cost_anomaly_event') 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::Costad::Models::CostAnomalyEvent' ) end # rubocop:enable Metrics/BlockLength end |
#update_cost_anomaly_monitor(cost_anomaly_monitor_id, update_cost_anomaly_monitor_details, opts = {}) ⇒ Response
Click here to see an example of how to use update_cost_anomaly_monitor API.
Update a CostAnomalyMonitor identified by the OCID.
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 1171 1172 1173 1174 1175 1176 1177 1178 |
# File 'lib/oci/costad/cost_ad_client.rb', line 1140 def update_cost_anomaly_monitor(cost_anomaly_monitor_id, update_cost_anomaly_monitor_details, opts = {}) logger.debug 'Calling operation CostAdClient#update_cost_anomaly_monitor.' if logger raise "Missing the required parameter 'cost_anomaly_monitor_id' when calling update_cost_anomaly_monitor." if cost_anomaly_monitor_id.nil? raise "Missing the required parameter 'update_cost_anomaly_monitor_details' when calling update_cost_anomaly_monitor." if update_cost_anomaly_monitor_details.nil? raise "Parameter value for 'cost_anomaly_monitor_id' must not be blank" if OCI::Internal::Util.blank_string?(cost_anomaly_monitor_id) path = '/costAnomalyMonitors/{costAnomalyMonitorId}'.sub('{costAnomalyMonitorId}', cost_anomaly_monitor_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_cost_anomaly_monitor_details) # rubocop:disable Metrics/BlockLength OCI::Retry.(applicable_retry_config(opts), call_name: 'CostAdClient#update_cost_anomaly_monitor') 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::Costad::Models::CostAnomalyMonitor' ) end # rubocop:enable Metrics/BlockLength end |