Class: OCI::UsageApi::UsageapiClient

Inherits:
Object
  • Object
show all
Defined in:
lib/oci/usage_api/usageapi_client.rb

Overview

Use the Usage API to view your Oracle Cloud usage and costs. The API allows you to request data that meets the specified filter criteria, and to group that data by the dimension of your choosing. The Usage API is used by the Cost Analysis tool in the Console. Also see Using the Usage API for more information.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config: nil, region: nil, endpoint: nil, signer: nil, proxy_settings: nil, retry_config: nil) ⇒ UsageapiClient

Creates a new UsageapiClient. 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.

Parameters:

  • config (Config) (defaults to: nil)

    A Config object.

  • region (String) (defaults to: nil)

    A region used to determine the service endpoint. This will usually correspond to a value in Regions::REGION_ENUM, but may be an arbitrary string.

  • endpoint (String) (defaults to: nil)

    The fully qualified endpoint URL

  • signer (OCI::BaseSigner) (defaults to: nil)

    A signer implementation which can be used by this client. If this is not provided then a signer will be constructed via the provided config. One use case of this parameter is instance principals authentication, so that the instance principals signer can be provided to the client

  • proxy_settings (OCI::ApiClientProxySettings) (defaults to: nil)

    If your environment requires you to use a proxy server for outgoing HTTP requests the details for the proxy can be provided in this parameter

  • retry_config (OCI::Retry::RetryConfig) (defaults to: nil)

    The retry configuration for this service client. This represents the default retry configuration to apply across all operations. 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



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/usage_api/usageapi_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 + '/20200107'
  else
    region ||= config.region
    region ||= signer.region if signer.respond_to?(:region)
    self.region = region
  end
  logger.info "UsageapiClient endpoint set to '#{@endpoint}'." if logger
end

Instance Attribute Details

#api_clientOCI::ApiClient (readonly)

Client used to make HTTP requests.

Returns:



15
16
17
# File 'lib/oci/usage_api/usageapi_client.rb', line 15

def api_client
  @api_client
end

#endpointString (readonly)

Fully qualified endpoint URL

Returns:

  • (String)


19
20
21
# File 'lib/oci/usage_api/usageapi_client.rb', line 19

def endpoint
  @endpoint
end

#regionString

The region, which will usually correspond to a value in Regions::REGION_ENUM.

Returns:

  • (String)


29
30
31
# File 'lib/oci/usage_api/usageapi_client.rb', line 29

def region
  @region
end

#retry_configOCI::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/usage_api/usageapi_client.rb', line 25

def retry_config
  @retry_config
end

Instance Method Details

#create_custom_table(create_custom_table_details, opts = {}) ⇒ Response

Note:

Click here to see an example of how to use create_custom_table API.

Returns the created custom table.

Parameters:

Options Hash (opts):

  • :retry_config (OCI::Retry::RetryConfig)

    The retry configuration to apply to this operation. If no key is provided then the service-level retry configuration defined by #retry_config will be used. If an explicit nil value is provided then the operation will not retry

  • :opc_request_id (String)

    Unique Oracle-assigned identifier for the request. If you need to contact Oracle about a particular request, please provide the request ID.

  • :opc_retry_token (String)

    A token that uniquely identifies a request so it can be retried in case of a timeout or server error, without risk of executing that same action again. Retry tokens expire after 24 hours, but can be invalidated before then due to conflicting operations. For example, if a resource has been deleted and purged from the system, then a retry of the original creation request might be rejected.

Returns:



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
156
157
# File 'lib/oci/usage_api/usageapi_client.rb', line 120

def create_custom_table(create_custom_table_details, opts = {})
  logger.debug 'Calling operation UsageapiClient#create_custom_table.' if logger

  raise "Missing the required parameter 'create_custom_table_details' when calling create_custom_table." if create_custom_table_details.nil?

  path = '/customTables'
  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_custom_table_details)

  # rubocop:disable Metrics/BlockLength
  OCI::Retry.make_retrying_call(applicable_retry_config(opts), call_name: 'UsageapiClient#create_custom_table') 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::UsageApi::Models::CustomTable'
    )
  end
  # rubocop:enable Metrics/BlockLength
end

#create_query(create_query_details, opts = {}) ⇒ Response

Note:

Click here to see an example of how to use create_query API.

Returns the created query.

Parameters:

Options Hash (opts):

  • :retry_config (OCI::Retry::RetryConfig)

    The retry configuration to apply to this operation. If no key is provided then the service-level retry configuration defined by #retry_config will be used. If an explicit nil value is provided then the operation will not retry

  • :opc_request_id (String)

    Unique Oracle-assigned identifier for the request. If you need to contact Oracle about a particular request, please provide the request ID.

  • :opc_retry_token (String)

    A token that uniquely identifies a request so it can be retried in case of a timeout or server error, without risk of executing that same action again. Retry tokens expire after 24 hours, but can be invalidated before then due to conflicting operations. For example, if a resource has been deleted and purged from the system, then a retry of the original creation request might be rejected.

Returns:



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
218
219
220
221
# File 'lib/oci/usage_api/usageapi_client.rb', line 184

def create_query(create_query_details, opts = {})
  logger.debug 'Calling operation UsageapiClient#create_query.' if logger

  raise "Missing the required parameter 'create_query_details' when calling create_query." if create_query_details.nil?

  path = '/queries'
  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_query_details)

  # rubocop:disable Metrics/BlockLength
  OCI::Retry.make_retrying_call(applicable_retry_config(opts), call_name: 'UsageapiClient#create_query') 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::UsageApi::Models::Query'
    )
  end
  # rubocop:enable Metrics/BlockLength
end

#create_schedule(create_schedule_details, opts = {}) ⇒ Response

Note:

Click here to see an example of how to use create_schedule API.

Returns the created schedule.

Parameters:

Options Hash (opts):

  • :retry_config (OCI::Retry::RetryConfig)

    The retry configuration to apply to this operation. If no key is provided then the service-level retry configuration defined by #retry_config will be used. If an explicit nil value is provided then the operation will not retry

  • :opc_request_id (String)

    Unique Oracle-assigned identifier for the request. If you need to contact Oracle about a particular request, please provide the request ID.

  • :opc_retry_token (String)

    A token that uniquely identifies a request so it can be retried in case of a timeout or server error, without risk of executing that same action again. Retry tokens expire after 24 hours, but can be invalidated before then due to conflicting operations. For example, if a resource has been deleted and purged from the system, then a retry of the original creation request might be rejected.

Returns:



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
278
279
280
281
282
283
284
285
# File 'lib/oci/usage_api/usageapi_client.rb', line 248

def create_schedule(create_schedule_details, opts = {})
  logger.debug 'Calling operation UsageapiClient#create_schedule.' if logger

  raise "Missing the required parameter 'create_schedule_details' when calling create_schedule." if create_schedule_details.nil?

  path = '/schedules'
  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_schedule_details)

  # rubocop:disable Metrics/BlockLength
  OCI::Retry.make_retrying_call(applicable_retry_config(opts), call_name: 'UsageapiClient#create_schedule') 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::UsageApi::Models::Schedule'
    )
  end
  # rubocop:enable Metrics/BlockLength
end

#delete_custom_table(custom_table_id, opts = {}) ⇒ Response

Note:

Click here to see an example of how to use delete_custom_table API.

Delete a saved custom table by the OCID.

Parameters:

  • custom_table_id (String)

    The custom table unique OCID.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :retry_config (OCI::Retry::RetryConfig)

    The retry configuration to apply to this operation. If no key is provided then the service-level retry configuration defined by #retry_config will be used. If an explicit nil value is provided then the operation will not retry

  • :opc_request_id (String)

    Unique Oracle-assigned identifier for the request. If you need to contact Oracle about a particular request, please provide the request ID.

  • :if_match (String)

    For optimistic concurrency control. In the PUT or DELETE call for a resource, set the if-match parameter to the value of the etag from a previous GET or POST response for that resource. The resource will be updated or deleted, only if the etag you provide matches the resource's current etag value.

Returns:

  • (Response)

    A Response object with data of type nil



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
338
339
340
341
342
343
344
345
346
347
348
# File 'lib/oci/usage_api/usageapi_client.rb', line 312

def delete_custom_table(custom_table_id, opts = {})
  logger.debug 'Calling operation UsageapiClient#delete_custom_table.' if logger

  raise "Missing the required parameter 'custom_table_id' when calling delete_custom_table." if custom_table_id.nil?
  raise "Parameter value for 'custom_table_id' must not be blank" if OCI::Internal::Util.blank_string?(custom_table_id)

  path = '/customTables/{customTableId}'.sub('{customTableId}', custom_table_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.make_retrying_call(applicable_retry_config(opts), call_name: 'UsageapiClient#delete_custom_table') 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_query(query_id, opts = {}) ⇒ Response

Note:

Click here to see an example of how to use delete_query API.

Delete a saved query by the OCID.

Parameters:

  • query_id (String)

    The query unique OCID.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :retry_config (OCI::Retry::RetryConfig)

    The retry configuration to apply to this operation. If no key is provided then the service-level retry configuration defined by #retry_config will be used. If an explicit nil value is provided then the operation will not retry

  • :opc_request_id (String)

    Unique Oracle-assigned identifier for the request. If you need to contact Oracle about a particular request, please provide the request ID.

  • :if_match (String)

    For optimistic concurrency control. In the PUT or DELETE call for a resource, set the if-match parameter to the value of the etag from a previous GET or POST response for that resource. The resource will be updated or deleted, only if the etag you provide matches the resource's current etag value.

Returns:

  • (Response)

    A Response object with data of type nil



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
407
408
409
410
411
# File 'lib/oci/usage_api/usageapi_client.rb', line 375

def delete_query(query_id, opts = {})
  logger.debug 'Calling operation UsageapiClient#delete_query.' if logger

  raise "Missing the required parameter 'query_id' when calling delete_query." if query_id.nil?
  raise "Parameter value for 'query_id' must not be blank" if OCI::Internal::Util.blank_string?(query_id)

  path = '/queries/{queryId}'.sub('{queryId}', query_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.make_retrying_call(applicable_retry_config(opts), call_name: 'UsageapiClient#delete_query') 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_schedule(schedule_id, opts = {}) ⇒ Response

Note:

Click here to see an example of how to use delete_schedule API.

Delete a saved scheduled report by the OCID.

Parameters:

  • schedule_id (String)

    The schedule unique OCID.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :retry_config (OCI::Retry::RetryConfig)

    The retry configuration to apply to this operation. If no key is provided then the service-level retry configuration defined by #retry_config will be used. If an explicit nil value is provided then the operation will not retry

  • :opc_request_id (String)

    Unique Oracle-assigned identifier for the request. If you need to contact Oracle about a particular request, please provide the request ID.

  • :if_match (String)

    For optimistic concurrency control. In the PUT or DELETE call for a resource, set the if-match parameter to the value of the etag from a previous GET or POST response for that resource. The resource will be updated or deleted, only if the etag you provide matches the resource's current etag value.

Returns:

  • (Response)

    A Response object with data of type nil



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
# File 'lib/oci/usage_api/usageapi_client.rb', line 438

def delete_schedule(schedule_id, opts = {})
  logger.debug 'Calling operation UsageapiClient#delete_schedule.' if logger

  raise "Missing the required parameter 'schedule_id' when calling delete_schedule." if schedule_id.nil?
  raise "Parameter value for 'schedule_id' must not be blank" if OCI::Internal::Util.blank_string?(schedule_id)

  path = '/schedules/{scheduleId}'.sub('{scheduleId}', schedule_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.make_retrying_call(applicable_retry_config(opts), call_name: 'UsageapiClient#delete_schedule') 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_custom_table(custom_table_id, opts = {}) ⇒ Response

Note:

Click here to see an example of how to use get_custom_table API.

Returns the saved custom table.

Parameters:

  • custom_table_id (String)

    The custom table unique OCID.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :retry_config (OCI::Retry::RetryConfig)

    The retry configuration to apply to this operation. If no key is provided then the service-level retry configuration defined by #retry_config will be used. If an explicit nil value is provided then the operation will not retry

  • :opc_request_id (String)

    Unique Oracle-assigned identifier for the request. If you need to contact Oracle about a particular request, please provide the request ID.

Returns:



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
530
531
# File 'lib/oci/usage_api/usageapi_client.rb', line 495

def get_custom_table(custom_table_id, opts = {})
  logger.debug 'Calling operation UsageapiClient#get_custom_table.' if logger

  raise "Missing the required parameter 'custom_table_id' when calling get_custom_table." if custom_table_id.nil?
  raise "Parameter value for 'custom_table_id' must not be blank" if OCI::Internal::Util.blank_string?(custom_table_id)

  path = '/customTables/{customTableId}'.sub('{customTableId}', custom_table_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.make_retrying_call(applicable_retry_config(opts), call_name: 'UsageapiClient#get_custom_table') 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::UsageApi::Models::CustomTable'
    )
  end
  # rubocop:enable Metrics/BlockLength
end

#get_query(query_id, opts = {}) ⇒ Response

Note:

Click here to see an example of how to use get_query API.

Returns the saved query.

Parameters:

  • query_id (String)

    The query unique OCID.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :retry_config (OCI::Retry::RetryConfig)

    The retry configuration to apply to this operation. If no key is provided then the service-level retry configuration defined by #retry_config will be used. If an explicit nil value is provided then the operation will not retry

  • :opc_request_id (String)

    Unique Oracle-assigned identifier for the request. If you need to contact Oracle about a particular request, please provide the request ID.

Returns:



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
584
585
586
587
588
# File 'lib/oci/usage_api/usageapi_client.rb', line 552

def get_query(query_id, opts = {})
  logger.debug 'Calling operation UsageapiClient#get_query.' if logger

  raise "Missing the required parameter 'query_id' when calling get_query." if query_id.nil?
  raise "Parameter value for 'query_id' must not be blank" if OCI::Internal::Util.blank_string?(query_id)

  path = '/queries/{queryId}'.sub('{queryId}', query_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.make_retrying_call(applicable_retry_config(opts), call_name: 'UsageapiClient#get_query') 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::UsageApi::Models::Query'
    )
  end
  # rubocop:enable Metrics/BlockLength
end

#get_schedule(schedule_id, opts = {}) ⇒ Response

Note:

Click here to see an example of how to use get_schedule API.

Returns the saved schedule.

Parameters:

  • schedule_id (String)

    The schedule unique OCID.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :retry_config (OCI::Retry::RetryConfig)

    The retry configuration to apply to this operation. If no key is provided then the service-level retry configuration defined by #retry_config will be used. If an explicit nil value is provided then the operation will not retry

  • :opc_request_id (String)

    Unique Oracle-assigned identifier for the request. If you need to contact Oracle about a particular request, please provide the request ID.

Returns:



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
638
639
640
641
642
643
644
645
# File 'lib/oci/usage_api/usageapi_client.rb', line 609

def get_schedule(schedule_id, opts = {})
  logger.debug 'Calling operation UsageapiClient#get_schedule.' if logger

  raise "Missing the required parameter 'schedule_id' when calling get_schedule." if schedule_id.nil?
  raise "Parameter value for 'schedule_id' must not be blank" if OCI::Internal::Util.blank_string?(schedule_id)

  path = '/schedules/{scheduleId}'.sub('{scheduleId}', schedule_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.make_retrying_call(applicable_retry_config(opts), call_name: 'UsageapiClient#get_schedule') 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::UsageApi::Models::Schedule'
    )
  end
  # rubocop:enable Metrics/BlockLength
end

#get_scheduled_run(scheduled_run_id, opts = {}) ⇒ Response

Note:

Click here to see an example of how to use get_scheduled_run API.

Returns the saved schedule run.

Parameters:

  • scheduled_run_id (String)

    The scheduledRun unique OCID.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :retry_config (OCI::Retry::RetryConfig)

    The retry configuration to apply to this operation. If no key is provided then the service-level retry configuration defined by #retry_config will be used. If an explicit nil value is provided then the operation will not retry

  • :opc_request_id (String)

    Unique Oracle-assigned identifier for the request. If you need to contact Oracle about a particular request, please provide the request ID.

Returns:



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
# File 'lib/oci/usage_api/usageapi_client.rb', line 666

def get_scheduled_run(scheduled_run_id, opts = {})
  logger.debug 'Calling operation UsageapiClient#get_scheduled_run.' if logger

  raise "Missing the required parameter 'scheduled_run_id' when calling get_scheduled_run." if scheduled_run_id.nil?
  raise "Parameter value for 'scheduled_run_id' must not be blank" if OCI::Internal::Util.blank_string?(scheduled_run_id)

  path = '/scheduledRuns/{scheduledRunId}'.sub('{scheduledRunId}', scheduled_run_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.make_retrying_call(applicable_retry_config(opts), call_name: 'UsageapiClient#get_scheduled_run') 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::UsageApi::Models::ScheduledRun'
    )
  end
  # rubocop:enable Metrics/BlockLength
end

#list_custom_tables(compartment_id, saved_report_id, opts = {}) ⇒ Response

Note:

Click here to see an example of how to use list_custom_tables API.

Returns the saved custom table list.

Allowed values are: displayName

Parameters:

  • compartment_id (String)

    The compartment ID in which to list resources.

  • saved_report_id (String)

    The saved report ID in which to list resources.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :retry_config (OCI::Retry::RetryConfig)

    The retry configuration to apply to this operation. If no key is provided then the service-level retry configuration defined by #retry_config will be used. If an explicit nil value is provided then the operation will not retry

  • :opc_request_id (String)

    Unique Oracle-assigned identifier for the request. If you need to contact Oracle about a particular request, please provide the request ID.

  • :limit (Integer)

    The maximumimum number of items to return. (default to 25)

  • :page (String)

    The page token representing the page at which to start retrieving results. This is usually retrieved from a previous list call.

  • :sort_by (String)

    The field to sort by. If not specified, the default is displayName. (default to displayName)

  • :sort_order (String)

    The sort order to use, whether 'asc' or 'desc'. (default to ASC) Allowed values are: ASC, DESC

Returns:



733
734
735
736
737
738
739
740
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
# File 'lib/oci/usage_api/usageapi_client.rb', line 733

def list_custom_tables(compartment_id, saved_report_id, opts = {})
  logger.debug 'Calling operation UsageapiClient#list_custom_tables.' if logger

  raise "Missing the required parameter 'compartment_id' when calling list_custom_tables." if compartment_id.nil?
  raise "Missing the required parameter 'saved_report_id' when calling list_custom_tables." if saved_report_id.nil?

  if opts[:sort_by] && !%w[displayName].include?(opts[:sort_by])
    raise 'Invalid value for "sort_by", must be one of 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 = '/customTables'
  operation_signing_strategy = :standard

  # rubocop:disable Style/NegatedIf
  # Query Params
  query_params = {}
  query_params[:compartmentId] = compartment_id
  query_params[:savedReportId] = saved_report_id
  query_params[:limit] = opts[:limit] if opts[:limit]
  query_params[:page] = opts[:page] if opts[:page]
  query_params[:sortBy] = opts[:sort_by] if opts[:sort_by]
  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.make_retrying_call(applicable_retry_config(opts), call_name: 'UsageapiClient#list_custom_tables') 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::UsageApi::Models::CustomTableCollection'
    )
  end
  # rubocop:enable Metrics/BlockLength
end

#list_queries(compartment_id, opts = {}) ⇒ Response

Note:

Click here to see an example of how to use list_queries API.

Returns the saved query list.

Allowed values are: displayName

Parameters:

  • compartment_id (String)

    The compartment ID in which to list resources.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :retry_config (OCI::Retry::RetryConfig)

    The retry configuration to apply to this operation. If no key is provided then the service-level retry configuration defined by #retry_config will be used. If an explicit nil value is provided then the operation will not retry

  • :opc_request_id (String)

    Unique Oracle-assigned identifier for the request. If you need to contact Oracle about a particular request, please provide the request ID.

  • :limit (Integer)

    The maximumimum number of items to return. (default to 25)

  • :page (String)

    The page token representing the page at which to start retrieving results. This is usually retrieved from a previous list call.

  • :sort_by (String)

    The field to sort by. If not specified, the default is displayName. (default to displayName)

  • :sort_order (String)

    The sort order to use, whether 'asc' or 'desc'. (default to ASC) Allowed values are: ASC, DESC

Returns:



813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
# File 'lib/oci/usage_api/usageapi_client.rb', line 813

def list_queries(compartment_id, opts = {})
  logger.debug 'Calling operation UsageapiClient#list_queries.' if logger

  raise "Missing the required parameter 'compartment_id' when calling list_queries." if compartment_id.nil?

  if opts[:sort_by] && !%w[displayName].include?(opts[:sort_by])
    raise 'Invalid value for "sort_by", must be one of 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 = '/queries'
  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[:sortBy] = opts[:sort_by] if opts[:sort_by]
  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.make_retrying_call(applicable_retry_config(opts), call_name: 'UsageapiClient#list_queries') 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::UsageApi::Models::QueryCollection'
    )
  end
  # rubocop:enable Metrics/BlockLength
end

#list_scheduled_runs(schedule_id, opts = {}) ⇒ Response

Note:

Click here to see an example of how to use list_scheduled_runs API.

Returns schedule history list.

Allowed values are: timeCreated

Parameters:

  • schedule_id (String)

    The unique ID of a schedule.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :retry_config (OCI::Retry::RetryConfig)

    The retry configuration to apply to this operation. If no key is provided then the service-level retry configuration defined by #retry_config will be used. If an explicit nil value is provided then the operation will not retry

  • :opc_request_id (String)

    Unique Oracle-assigned identifier for the request. If you need to contact Oracle about a particular request, please provide the request ID.

  • :page (String)

    The page token representing the page at which to start retrieving results. This is usually retrieved from a previous list call.

  • :limit (Integer)

    The maximumimum number of items to return. (default to 25)

  • :sort_by (String)

    The field to sort by. If not specified, the default is timeCreated. (default to timeCreated)

  • :sort_order (String)

    The sort order to use, whether 'asc' or 'desc'. (default to ASC) Allowed values are: ASC, DESC

Returns:



891
892
893
894
895
896
897
898
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
# File 'lib/oci/usage_api/usageapi_client.rb', line 891

def list_scheduled_runs(schedule_id, opts = {})
  logger.debug 'Calling operation UsageapiClient#list_scheduled_runs.' if logger

  raise "Missing the required parameter 'schedule_id' when calling list_scheduled_runs." if schedule_id.nil?

  if opts[:sort_by] && !%w[timeCreated].include?(opts[:sort_by])
    raise 'Invalid value for "sort_by", must be one of timeCreated.'
  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 = '/scheduledRuns'
  operation_signing_strategy = :standard

  # rubocop:disable Style/NegatedIf
  # Query Params
  query_params = {}
  query_params[:scheduleId] = schedule_id
  query_params[:page] = opts[:page] if opts[:page]
  query_params[:limit] = opts[:limit] if opts[:limit]
  query_params[:sortBy] = opts[:sort_by] if opts[:sort_by]
  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.make_retrying_call(applicable_retry_config(opts), call_name: 'UsageapiClient#list_scheduled_runs') 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::UsageApi::Models::ScheduledRunCollection'
    )
  end
  # rubocop:enable Metrics/BlockLength
end

#list_schedules(compartment_id, opts = {}) ⇒ Response

Note:

Click here to see an example of how to use list_schedules API.

Returns the saved schedule list.

Allowed values are: name, timeCreated

Parameters:

  • compartment_id (String)

    The compartment ID in which to list resources.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :retry_config (OCI::Retry::RetryConfig)

    The retry configuration to apply to this operation. If no key is provided then the service-level retry configuration defined by #retry_config will be used. If an explicit nil value is provided then the operation will not retry

  • :opc_request_id (String)

    Unique Oracle-assigned identifier for the request. If you need to contact Oracle about a particular request, please provide the request ID.

  • :page (String)

    The page token representing the page at which to start retrieving results. This is usually retrieved from a previous list call.

  • :limit (Integer)

    The maximumimum number of items to return. (default to 25)

  • :sort_by (String)

    The field to sort by. If not specified, the default is timeCreated. (default to timeCreated)

  • :sort_order (String)

    The sort order to use, whether 'asc' or 'desc'. (default to ASC) Allowed values are: ASC, DESC

  • :name (String)

    Query parameter for filtering by name

Returns:



971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
# File 'lib/oci/usage_api/usageapi_client.rb', line 971

def list_schedules(compartment_id, opts = {})
  logger.debug 'Calling operation UsageapiClient#list_schedules.' if logger

  raise "Missing the required parameter 'compartment_id' when calling list_schedules." if compartment_id.nil?

  if opts[:sort_by] && !%w[name timeCreated].include?(opts[:sort_by])
    raise 'Invalid value for "sort_by", must be one of name, timeCreated.'
  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 = '/schedules'
  operation_signing_strategy = :standard

  # rubocop:disable Style/NegatedIf
  # Query Params
  query_params = {}
  query_params[:compartmentId] = compartment_id
  query_params[:page] = opts[:page] if opts[:page]
  query_params[:limit] = opts[:limit] if opts[:limit]
  query_params[:sortBy] = opts[:sort_by] if opts[:sort_by]
  query_params[:sortOrder] = opts[:sort_order] if opts[:sort_order]
  query_params[:name] = opts[:name] if opts[:name]

  # 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.make_retrying_call(applicable_retry_config(opts), call_name: 'UsageapiClient#list_schedules') 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::UsageApi::Models::ScheduleCollection'
    )
  end
  # rubocop:enable Metrics/BlockLength
end

#loggerLogger

Returns The logger for this client. May be nil.

Returns:

  • (Logger)

    The logger for this client. May be nil.



94
95
96
# File 'lib/oci/usage_api/usageapi_client.rb', line 94

def logger
  @api_client.config.logger
end

#request_summarized_configurations(tenant_id, opts = {}) ⇒ Response

Note:

Click here to see an example of how to use request_summarized_configurations API.

Returns the configurations list for the UI drop-down list.

Parameters:

  • tenant_id (String)

    tenant id

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :retry_config (OCI::Retry::RetryConfig)

    The retry configuration to apply to this operation. If no key is provided then the service-level retry configuration defined by #retry_config will be used. If an explicit nil value is provided then the operation will not retry

  • :opc_request_id (String)

    Unique Oracle-assigned identifier for the request. If you need to contact Oracle about a particular request, please provide the request ID.

Returns:



1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
# File 'lib/oci/usage_api/usageapi_client.rb', line 1041

def request_summarized_configurations(tenant_id, opts = {})
  logger.debug 'Calling operation UsageapiClient#request_summarized_configurations.' if logger

  raise "Missing the required parameter 'tenant_id' when calling request_summarized_configurations." if tenant_id.nil?

  path = '/configuration'
  operation_signing_strategy = :standard

  # rubocop:disable Style/NegatedIf
  # Query Params
  query_params = {}
  query_params[:tenantId] = tenant_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.make_retrying_call(applicable_retry_config(opts), call_name: 'UsageapiClient#request_summarized_configurations') 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::UsageApi::Models::ConfigurationAggregation'
    )
  end
  # rubocop:enable Metrics/BlockLength
end

#request_summarized_usages(request_summarized_usages_details, opts = {}) ⇒ Response

Note:

Click here to see an example of how to use request_summarized_usages API.

Returns usage for the given account.

Parameters:

Options Hash (opts):

  • :retry_config (OCI::Retry::RetryConfig)

    The retry configuration to apply to this operation. If no key is provided then the service-level retry configuration defined by #retry_config will be used. If an explicit nil value is provided then the operation will not retry

  • :opc_request_id (String)

    Unique Oracle-assigned identifier for the request. If you need to contact Oracle about a particular request, please provide the request ID.

  • :page (String)

    The page token representing the page at which to start retrieving results. This is usually retrieved from a previous list call.

  • :limit (Integer)

    The maximumimum number of items to return. (default to 25)

Returns:



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
# File 'lib/oci/usage_api/usageapi_client.rb', line 1103

def request_summarized_usages(request_summarized_usages_details, opts = {})
  logger.debug 'Calling operation UsageapiClient#request_summarized_usages.' if logger

  raise "Missing the required parameter 'request_summarized_usages_details' when calling request_summarized_usages." if request_summarized_usages_details.nil?

  path = '/usage'
  operation_signing_strategy = :standard

  # rubocop:disable Style/NegatedIf
  # Query Params
  query_params = {}
  query_params[:page] = opts[:page] if opts[:page]
  query_params[:limit] = opts[:limit] if opts[:limit]

  # 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 = @api_client.object_to_http_body(request_summarized_usages_details)

  # rubocop:disable Metrics/BlockLength
  OCI::Retry.make_retrying_call(applicable_retry_config(opts), call_name: 'UsageapiClient#request_summarized_usages') 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::UsageApi::Models::UsageAggregation'
    )
  end
  # rubocop:enable Metrics/BlockLength
end

#update_custom_table(update_custom_table_details, custom_table_id, opts = {}) ⇒ Response

Note:

Click here to see an example of how to use update_custom_table API.

Update a saved custom table by table id.

Parameters:

Options Hash (opts):

  • :retry_config (OCI::Retry::RetryConfig)

    The retry configuration to apply to this operation. If no key is provided then the service-level retry configuration defined by #retry_config will be used. If an explicit nil value is provided then the operation will not retry

  • :opc_request_id (String)

    Unique Oracle-assigned identifier for the request. If you need to contact Oracle about a particular request, please provide the request ID.

  • :if_match (String)

    For optimistic concurrency control. In the PUT or DELETE call for a resource, set the if-match parameter to the value of the etag from a previous GET or POST response for that resource. The resource will be updated or deleted, only if the etag you provide matches the resource's current etag value.

Returns:



1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
# File 'lib/oci/usage_api/usageapi_client.rb', line 1168

def update_custom_table(update_custom_table_details, custom_table_id, opts = {})
  logger.debug 'Calling operation UsageapiClient#update_custom_table.' if logger

  raise "Missing the required parameter 'update_custom_table_details' when calling update_custom_table." if update_custom_table_details.nil?
  raise "Missing the required parameter 'custom_table_id' when calling update_custom_table." if custom_table_id.nil?
  raise "Parameter value for 'custom_table_id' must not be blank" if OCI::Internal::Util.blank_string?(custom_table_id)

  path = '/customTables/{customTableId}'.sub('{customTableId}', custom_table_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_custom_table_details)

  # rubocop:disable Metrics/BlockLength
  OCI::Retry.make_retrying_call(applicable_retry_config(opts), call_name: 'UsageapiClient#update_custom_table') 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::UsageApi::Models::CustomTable'
    )
  end
  # rubocop:enable Metrics/BlockLength
end

#update_query(update_query_details, query_id, opts = {}) ⇒ Response

Note:

Click here to see an example of how to use update_query API.

Update a saved query by the OCID.

Parameters:

Options Hash (opts):

  • :retry_config (OCI::Retry::RetryConfig)

    The retry configuration to apply to this operation. If no key is provided then the service-level retry configuration defined by #retry_config will be used. If an explicit nil value is provided then the operation will not retry

  • :opc_request_id (String)

    Unique Oracle-assigned identifier for the request. If you need to contact Oracle about a particular request, please provide the request ID.

  • :if_match (String)

    For optimistic concurrency control. In the PUT or DELETE call for a resource, set the if-match parameter to the value of the etag from a previous GET or POST response for that resource. The resource will be updated or deleted, only if the etag you provide matches the resource's current etag value.

Returns:



1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
# File 'lib/oci/usage_api/usageapi_client.rb', line 1234

def update_query(update_query_details, query_id, opts = {})
  logger.debug 'Calling operation UsageapiClient#update_query.' if logger

  raise "Missing the required parameter 'update_query_details' when calling update_query." if update_query_details.nil?
  raise "Missing the required parameter 'query_id' when calling update_query." if query_id.nil?
  raise "Parameter value for 'query_id' must not be blank" if OCI::Internal::Util.blank_string?(query_id)

  path = '/queries/{queryId}'.sub('{queryId}', query_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_query_details)

  # rubocop:disable Metrics/BlockLength
  OCI::Retry.make_retrying_call(applicable_retry_config(opts), call_name: 'UsageapiClient#update_query') 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::UsageApi::Models::Query'
    )
  end
  # rubocop:enable Metrics/BlockLength
end

#update_schedule(update_schedule_details, schedule_id, opts = {}) ⇒ Response

Note:

Click here to see an example of how to use update_schedule API.

Update a saved schedule

Parameters:

  • update_schedule_details (OCI::UsageApi::Models::UpdateScheduleDetails)

    The information to be updated. Currently supports only tags

  • schedule_id (String)

    The schedule unique OCID.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :retry_config (OCI::Retry::RetryConfig)

    The retry configuration to apply to this operation. If no key is provided then the service-level retry configuration defined by #retry_config will be used. If an explicit nil value is provided then the operation will not retry

  • :opc_request_id (String)

    Unique Oracle-assigned identifier for the request. If you need to contact Oracle about a particular request, please provide the request ID.

  • :if_match (String)

    For optimistic concurrency control. In the PUT or DELETE call for a resource, set the if-match parameter to the value of the etag from a previous GET or POST response for that resource. The resource will be updated or deleted, only if the etag you provide matches the resource's current etag value.

Returns:



1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
# File 'lib/oci/usage_api/usageapi_client.rb', line 1300

def update_schedule(update_schedule_details, schedule_id, opts = {})
  logger.debug 'Calling operation UsageapiClient#update_schedule.' if logger

  raise "Missing the required parameter 'update_schedule_details' when calling update_schedule." if update_schedule_details.nil?
  raise "Missing the required parameter 'schedule_id' when calling update_schedule." if schedule_id.nil?
  raise "Parameter value for 'schedule_id' must not be blank" if OCI::Internal::Util.blank_string?(schedule_id)

  path = '/schedules/{scheduleId}'.sub('{scheduleId}', schedule_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_schedule_details)

  # rubocop:disable Metrics/BlockLength
  OCI::Retry.make_retrying_call(applicable_retry_config(opts), call_name: 'UsageapiClient#update_schedule') 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::UsageApi::Models::Schedule'
    )
  end
  # rubocop:enable Metrics/BlockLength
end