Class: OCI::Optimizer::OptimizerClient

Inherits:
Object
  • Object
show all
Defined in:
lib/oci/optimizer/optimizer_client.rb

Overview

APIs for managing Cloud Advisor. Cloud Advisor provides recommendations that help you maximize cost savings and improve the security posture of your tenancy.

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) ⇒ OptimizerClient

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



53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# File 'lib/oci/optimizer/optimizer_client.rb', line 53

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

Instance Attribute Details

#api_clientOCI::ApiClient (readonly)

Client used to make HTTP requests.

Returns:



13
14
15
# File 'lib/oci/optimizer/optimizer_client.rb', line 13

def api_client
  @api_client
end

#endpointString (readonly)

Fully qualified endpoint URL

Returns:

  • (String)


17
18
19
# File 'lib/oci/optimizer/optimizer_client.rb', line 17

def endpoint
  @endpoint
end

#regionString

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

Returns:

  • (String)


27
28
29
# File 'lib/oci/optimizer/optimizer_client.rb', line 27

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



23
24
25
# File 'lib/oci/optimizer/optimizer_client.rb', line 23

def retry_config
  @retry_config
end

Instance Method Details

#bulk_apply_recommendations(recommendation_id, bulk_apply_recommendations_details, opts = {}) ⇒ Response

Note:

Click [here](docs.cloud.oracle.com/en-us/iaas/tools/ruby-sdk-examples/latest/optimizer/bulk_apply_recommendations.rb.html) to see an example of how to use bulk_apply_recommendations API.

Applies the specified recommendations to the resources.

Parameters:

  • recommendation_id (String)

    The unique OCID associated with the recommendation.

  • bulk_apply_recommendations_details (OCI::Optimizer::Models::BulkApplyRecommendationsDetails)

    Details about bulk recommendation actions.

  • 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.

  • :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 may be rejected).

Returns:

  • (Response)

    A Response object with data of type nil



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
156
157
# File 'lib/oci/optimizer/optimizer_client.rb', line 119

def bulk_apply_recommendations(recommendation_id, bulk_apply_recommendations_details, opts = {})
  logger.debug 'Calling operation OptimizerClient#bulk_apply_recommendations.' if logger

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

  path = '/recommendations/{recommendationId}/actions/bulkApplyRecommendations'.sub('{recommendationId}', recommendation_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[:'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(bulk_apply_recommendations_details)

  # rubocop:disable Metrics/BlockLength
  OCI::Retry.make_retrying_call(applicable_retry_config(opts), call_name: 'OptimizerClient#bulk_apply_recommendations') do
    @api_client.call_api(
      :POST,
      path,
      endpoint,
      header_params: header_params,
      query_params: query_params,
      operation_signing_strategy: operation_signing_strategy,
      body: post_body
    )
  end
  # rubocop:enable Metrics/BlockLength
end

#create_profile(create_profile_details, opts = {}) ⇒ Response

Note:

Click [here](docs.cloud.oracle.com/en-us/iaas/tools/ruby-sdk-examples/latest/optimizer/create_profile.rb.html) to see an example of how to use create_profile API.

Creates a new profile.

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 may 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/optimizer/optimizer_client.rb', line 184

def create_profile(create_profile_details, opts = {})
  logger.debug 'Calling operation OptimizerClient#create_profile.' if logger

  raise "Missing the required parameter 'create_profile_details' when calling create_profile." if create_profile_details.nil?

  path = '/profiles'
  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_profile_details)

  # rubocop:disable Metrics/BlockLength
  OCI::Retry.make_retrying_call(applicable_retry_config(opts), call_name: 'OptimizerClient#create_profile') 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::Optimizer::Models::Profile'
    )
  end
  # rubocop:enable Metrics/BlockLength
end

#delete_profile(profile_id, opts = {}) ⇒ Response

Note:

Click [here](docs.cloud.oracle.com/en-us/iaas/tools/ruby-sdk-examples/latest/optimizer/delete_profile.rb.html) to see an example of how to use delete_profile API.

Deletes the specified profile. Uses the profile’s OCID to determine which profile to delete.

Parameters:

  • profile_id (String)

    The unique OCID of the profile.

  • 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

  • :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.

  • :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:

  • (Response)

    A Response object with data of type nil



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
# File 'lib/oci/optimizer/optimizer_client.rb', line 248

def delete_profile(profile_id, opts = {})
  logger.debug 'Calling operation OptimizerClient#delete_profile.' if logger

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

  path = '/profiles/{profileId}'.sub('{profileId}', profile_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.make_retrying_call(applicable_retry_config(opts), call_name: 'OptimizerClient#delete_profile') 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_category(category_id, opts = {}) ⇒ Response

Note:

Click [here](docs.cloud.oracle.com/en-us/iaas/tools/ruby-sdk-examples/latest/optimizer/get_category.rb.html) to see an example of how to use get_category API.

Gets the category that corresponds to the specified OCID.

Parameters:

  • category_id (String)

    The unique OCID associated with the category.

  • 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:



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
338
339
340
341
# File 'lib/oci/optimizer/optimizer_client.rb', line 305

def get_category(category_id, opts = {})
  logger.debug 'Calling operation OptimizerClient#get_category.' if logger

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

  path = '/categories/{categoryId}'.sub('{categoryId}', category_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: 'OptimizerClient#get_category') 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::Optimizer::Models::Category'
    )
  end
  # rubocop:enable Metrics/BlockLength
end

#get_enrollment_status(enrollment_status_id, opts = {}) ⇒ Response

Note:

Click [here](docs.cloud.oracle.com/en-us/iaas/tools/ruby-sdk-examples/latest/optimizer/get_enrollment_status.rb.html) to see an example of how to use get_enrollment_status API.

Gets the Cloud Advisor enrollment status.

Parameters:

  • enrollment_status_id (String)

    The unique OCID associated with the enrollment status.

  • 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:



362
363
364
365
366
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
# File 'lib/oci/optimizer/optimizer_client.rb', line 362

def get_enrollment_status(enrollment_status_id, opts = {})
  logger.debug 'Calling operation OptimizerClient#get_enrollment_status.' if logger

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

  path = '/enrollmentStatus/{enrollmentStatusId}'.sub('{enrollmentStatusId}', enrollment_status_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: 'OptimizerClient#get_enrollment_status') 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::Optimizer::Models::EnrollmentStatus'
    )
  end
  # rubocop:enable Metrics/BlockLength
end

#get_profile(profile_id, opts = {}) ⇒ Response

Note:

Click [here](docs.cloud.oracle.com/en-us/iaas/tools/ruby-sdk-examples/latest/optimizer/get_profile.rb.html) to see an example of how to use get_profile API.

Gets the specified profile’s information. Uses the profile’s OCID to determine which profile to retrieve.

Parameters:

  • profile_id (String)

    The unique OCID of the profile.

  • 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:



419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
# File 'lib/oci/optimizer/optimizer_client.rb', line 419

def get_profile(profile_id, opts = {})
  logger.debug 'Calling operation OptimizerClient#get_profile.' if logger

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

  path = '/profiles/{profileId}'.sub('{profileId}', profile_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: 'OptimizerClient#get_profile') 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::Optimizer::Models::Profile'
    )
  end
  # rubocop:enable Metrics/BlockLength
end

#get_recommendation(recommendation_id, opts = {}) ⇒ Response

Note:

Click [here](docs.cloud.oracle.com/en-us/iaas/tools/ruby-sdk-examples/latest/optimizer/get_recommendation.rb.html) to see an example of how to use get_recommendation API.

Gets the recommendation for the specified OCID.

Parameters:

  • recommendation_id (String)

    The unique OCID associated with the recommendation.

  • 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:



476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
# File 'lib/oci/optimizer/optimizer_client.rb', line 476

def get_recommendation(recommendation_id, opts = {})
  logger.debug 'Calling operation OptimizerClient#get_recommendation.' if logger

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

  path = '/recommendations/{recommendationId}'.sub('{recommendationId}', recommendation_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: 'OptimizerClient#get_recommendation') 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::Optimizer::Models::Recommendation'
    )
  end
  # rubocop:enable Metrics/BlockLength
end

#get_resource_action(resource_action_id, opts = {}) ⇒ Response

Note:

Click [here](docs.cloud.oracle.com/en-us/iaas/tools/ruby-sdk-examples/latest/optimizer/get_resource_action.rb.html) to see an example of how to use get_resource_action API.

Gets the resource action that corresponds to the specified OCID.

Parameters:

  • resource_action_id (String)

    The unique OCID associated with the resource action.

  • 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:



533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
# File 'lib/oci/optimizer/optimizer_client.rb', line 533

def get_resource_action(resource_action_id, opts = {})
  logger.debug 'Calling operation OptimizerClient#get_resource_action.' if logger

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

  path = '/resourceActions/{resourceActionId}'.sub('{resourceActionId}', resource_action_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: 'OptimizerClient#get_resource_action') 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::Optimizer::Models::ResourceAction'
    )
  end
  # rubocop:enable Metrics/BlockLength
end

#get_work_request(work_request_id, opts = {}) ⇒ Response

Note:

Click [here](docs.cloud.oracle.com/en-us/iaas/tools/ruby-sdk-examples/latest/optimizer/get_work_request.rb.html) to see an example of how to use get_work_request API.

Gets the status of the work request associated with the specified ID.

Parameters:

  • work_request_id (String)

    The OCID of the work request.

  • 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:



589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
# File 'lib/oci/optimizer/optimizer_client.rb', line 589

def get_work_request(work_request_id, opts = {})
  logger.debug 'Calling operation OptimizerClient#get_work_request.' if logger

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

  path = '/workRequests/{workRequestId}'.sub('{workRequestId}', work_request_id.to_s)
  operation_signing_strategy = :standard

  # rubocop:disable Style/NegatedIf
  # Query Params
  query_params = {}

  # Header Params
  header_params = {}
  header_params[:accept] = 'application/json'
  header_params[:'content-type'] = 'application/json'
  header_params[:'opc-request-id'] = opts[:opc_request_id] if opts[:opc_request_id]
  # rubocop:enable Style/NegatedIf

  post_body = nil

  # rubocop:disable Metrics/BlockLength
  OCI::Retry.make_retrying_call(applicable_retry_config(opts), call_name: 'OptimizerClient#get_work_request') do
    @api_client.call_api(
      :GET,
      path,
      endpoint,
      header_params: header_params,
      query_params: query_params,
      operation_signing_strategy: operation_signing_strategy,
      body: post_body,
      return_type: 'OCI::Optimizer::Models::WorkRequest'
    )
  end
  # rubocop:enable Metrics/BlockLength
end

#list_categories(compartment_id, compartment_id_in_subtree, opts = {}) ⇒ Response

Note:

Click [here](docs.cloud.oracle.com/en-us/iaas/tools/ruby-sdk-examples/latest/optimizer/list_categories.rb.html) to see an example of how to use list_categories API.

Lists the supported Cloud Advisor categories.

Parameters:

  • compartment_id (String)

    The OCID of the compartment.

  • compartment_id_in_subtree (BOOLEAN)

    When set to true, the hierarchy of compartments is traversed and all compartments and subcompartments in the tenancy are returned depending on the the setting of accessLevel.

    Can only be set to true when performing ListCompartments on the tenancy (root compartment).

  • 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

  • :name (String)

    Optional. A filter that returns results that match the name specified.

  • :limit (Integer)

    The maximum number of items to return in a paginated "List" call. (default to 10)

  • :page (String)

    The value of the opc-next-page response header from the previous "List" call.

  • :sort_order (String)

    The sort order to use, either ascending (ASC) or descending (DESC).

  • :sort_by (String)

    The field to sort by. You can provide one sort order (sortOrder). Default order for TIMECREATED is descending. Default order for NAME is ascending. The NAME sort order is case sensitive.

    Allowed values are: NAME, TIMECREATED

  • :lifecycle_state (String)

    A filter that returns results that match the lifecycle state specified.

  • :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:



660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
# File 'lib/oci/optimizer/optimizer_client.rb', line 660

def list_categories(compartment_id, compartment_id_in_subtree, opts = {})
  logger.debug 'Calling operation OptimizerClient#list_categories.' if logger

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

  if opts[:sort_order] && !OCI::Optimizer::Models::SORT_ORDER_ENUM.include?(opts[:sort_order])
    raise 'Invalid value for "sort_order", must be one of the values in OCI::Optimizer::Models::SORT_ORDER_ENUM.'
  end

  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[:lifecycle_state] && !OCI::Optimizer::Models::LIFECYCLE_STATE_ENUM.include?(opts[:lifecycle_state])
    raise 'Invalid value for "lifecycle_state", must be one of the values in OCI::Optimizer::Models::LIFECYCLE_STATE_ENUM.'
  end

  path = '/categories'
  operation_signing_strategy = :standard

  # rubocop:disable Style/NegatedIf
  # Query Params
  query_params = {}
  query_params[:compartmentId] = compartment_id
  query_params[:compartmentIdInSubtree] = compartment_id_in_subtree
  query_params[:name] = opts[:name] if opts[:name]
  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]

  # 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: 'OptimizerClient#list_categories') 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::Optimizer::Models::CategoryCollection'
    )
  end
  # rubocop:enable Metrics/BlockLength
end

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

Note:

Click [here](docs.cloud.oracle.com/en-us/iaas/tools/ruby-sdk-examples/latest/optimizer/list_enrollment_statuses.rb.html) to see an example of how to use list_enrollment_statuses API.

Lists the Cloud Advisor enrollment statuses.

Parameters:

  • compartment_id (String)

    The OCID of the compartment.

  • 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

  • :limit (Integer)

    The maximum number of items to return in a paginated "List" call. (default to 10)

  • :page (String)

    The value of the opc-next-page response header from the previous "List" call.

  • :sort_order (String)

    The sort order to use, either ascending (ASC) or descending (DESC).

  • :sort_by (String)

    The field to sort by. You can provide one sort order (sortOrder). Default order for TIMECREATED is descending. Default order for NAME is ascending. The NAME sort order is case sensitive.

    Allowed values are: NAME, TIMECREATED

  • :lifecycle_state (String)

    A filter that returns results that match the lifecycle state specified.

  • :status (String)

    A filter that returns results that match the Cloud Advisor enrollment status specified.

  • :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:



748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
# File 'lib/oci/optimizer/optimizer_client.rb', line 748

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

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

  if opts[:sort_order] && !OCI::Optimizer::Models::SORT_ORDER_ENUM.include?(opts[:sort_order])
    raise 'Invalid value for "sort_order", must be one of the values in OCI::Optimizer::Models::SORT_ORDER_ENUM.'
  end

  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[:lifecycle_state] && !OCI::Optimizer::Models::LIFECYCLE_STATE_ENUM.include?(opts[:lifecycle_state])
    raise 'Invalid value for "lifecycle_state", must be one of the values in OCI::Optimizer::Models::LIFECYCLE_STATE_ENUM.'
  end

  if opts[:status] && !OCI::Optimizer::Models::OPTIMIZER_ENROLLMENT_STATUS_ENUM.include?(opts[:status])
    raise 'Invalid value for "status", must be one of the values in OCI::Optimizer::Models::OPTIMIZER_ENROLLMENT_STATUS_ENUM.'
  end

  path = '/enrollmentStatus'
  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[:status] = opts[:status] if opts[:status]

  # 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: 'OptimizerClient#list_enrollment_statuses') 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::Optimizer::Models::EnrollmentStatusCollection'
    )
  end
  # rubocop:enable Metrics/BlockLength
end

#list_histories(compartment_id, compartment_id_in_subtree, opts = {}) ⇒ Response

Note:

Click [here](docs.cloud.oracle.com/en-us/iaas/tools/ruby-sdk-examples/latest/optimizer/list_histories.rb.html) to see an example of how to use list_histories API.

Lists changes to the recommendations based on user activity. For example, lists when recommendations have been implemented, dismissed, postponed, or reactivated.

Parameters:

  • compartment_id (String)

    The OCID of the compartment.

  • compartment_id_in_subtree (BOOLEAN)

    When set to true, the hierarchy of compartments is traversed and all compartments and subcompartments in the tenancy are returned depending on the the setting of accessLevel.

    Can only be set to true when performing ListCompartments on the tenancy (root compartment).

  • 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

  • :name (String)

    Optional. A filter that returns results that match the name specified.

  • :recommendation_name (String)

    Optional. A filter that returns results that match the recommendation name specified.

  • :recommendation_id (String)

    The unique OCID associated with the recommendation.

  • :resource_type (String)

    Optional. A filter that returns results that match the resource type specified.

  • :limit (Integer)

    The maximum number of items to return in a paginated "List" call. (default to 10)

  • :page (String)

    The value of the opc-next-page response header from the previous "List" call.

  • :sort_order (String)

    The sort order to use, either ascending (ASC) or descending (DESC).

  • :sort_by (String)

    The field to sort by. You can provide one sort order (sortOrder). Default order for TIMECREATED is descending. Default order for NAME is ascending. The NAME sort order is case sensitive.

    Allowed values are: NAME, TIMECREATED

  • :lifecycle_state (String)

    A filter that returns results that match the lifecycle state specified.

  • :status (String)

    A filter that returns recommendations that match the status specified.

  • :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:



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
899
900
901
902
903
904
905
906
907
908
909
910
911
# File 'lib/oci/optimizer/optimizer_client.rb', line 847

def list_histories(compartment_id, compartment_id_in_subtree, opts = {})
  logger.debug 'Calling operation OptimizerClient#list_histories.' if logger

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

  if opts[:sort_order] && !OCI::Optimizer::Models::SORT_ORDER_ENUM.include?(opts[:sort_order])
    raise 'Invalid value for "sort_order", must be one of the values in OCI::Optimizer::Models::SORT_ORDER_ENUM.'
  end

  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[:lifecycle_state] && !OCI::Optimizer::Models::LIFECYCLE_STATE_ENUM.include?(opts[:lifecycle_state])
    raise 'Invalid value for "lifecycle_state", must be one of the values in OCI::Optimizer::Models::LIFECYCLE_STATE_ENUM.'
  end

  if opts[:status] && !OCI::Optimizer::Models::STATUS_ENUM.include?(opts[:status])
    raise 'Invalid value for "status", must be one of the values in OCI::Optimizer::Models::STATUS_ENUM.'
  end

  path = '/histories'
  operation_signing_strategy = :standard

  # rubocop:disable Style/NegatedIf
  # Query Params
  query_params = {}
  query_params[:compartmentId] = compartment_id
  query_params[:compartmentIdInSubtree] = compartment_id_in_subtree
  query_params[:name] = opts[:name] if opts[:name]
  query_params[:recommendationName] = opts[:recommendation_name] if opts[:recommendation_name]
  query_params[:recommendationId] = opts[:recommendation_id] if opts[:recommendation_id]
  query_params[:resourceType] = opts[:resource_type] if opts[:resource_type]
  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[:status] = opts[:status] if opts[:status]

  # 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: 'OptimizerClient#list_histories') 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::Optimizer::Models::HistoryCollection'
    )
  end
  # rubocop:enable Metrics/BlockLength
end

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

Note:

Click [here](docs.cloud.oracle.com/en-us/iaas/tools/ruby-sdk-examples/latest/optimizer/list_profiles.rb.html) to see an example of how to use list_profiles API.

Lists the existing profiles.

Parameters:

  • compartment_id (String)

    The OCID of the compartment.

  • 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

  • :name (String)

    Optional. A filter that returns results that match the name specified.

  • :limit (Integer)

    The maximum number of items to return in a paginated "List" call. (default to 10)

  • :page (String)

    The value of the opc-next-page response header from the previous "List" call.

  • :sort_order (String)

    The sort order to use, either ascending (ASC) or descending (DESC).

  • :sort_by (String)

    The field to sort by. You can provide one sort order (sortOrder). Default order for TIMECREATED is descending. Default order for NAME is ascending. The NAME sort order is case sensitive.

    Allowed values are: NAME, TIMECREATED

  • :lifecycle_state (String)

    A filter that returns results that match the lifecycle state specified.

  • :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:



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
990
991
992
993
994
995
996
# File 'lib/oci/optimizer/optimizer_client.rb', line 942

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

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

  if opts[:sort_order] && !OCI::Optimizer::Models::SORT_ORDER_ENUM.include?(opts[:sort_order])
    raise 'Invalid value for "sort_order", must be one of the values in OCI::Optimizer::Models::SORT_ORDER_ENUM.'
  end

  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[:lifecycle_state] && !OCI::Optimizer::Models::LIFECYCLE_STATE_ENUM.include?(opts[:lifecycle_state])
    raise 'Invalid value for "lifecycle_state", must be one of the values in OCI::Optimizer::Models::LIFECYCLE_STATE_ENUM.'
  end

  path = '/profiles'
  operation_signing_strategy = :standard

  # rubocop:disable Style/NegatedIf
  # Query Params
  query_params = {}
  query_params[:compartmentId] = compartment_id
  query_params[:name] = opts[:name] if opts[:name]
  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]

  # 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: 'OptimizerClient#list_profiles') 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::Optimizer::Models::ProfileCollection'
    )
  end
  # rubocop:enable Metrics/BlockLength
end

#list_recommendation_strategies(compartment_id, compartment_id_in_subtree, opts = {}) ⇒ Response

Note:

Click [here](docs.cloud.oracle.com/en-us/iaas/tools/ruby-sdk-examples/latest/optimizer/list_recommendation_strategies.rb.html) to see an example of how to use list_recommendation_strategies API.

Lists the existing strategies.

Parameters:

  • compartment_id (String)

    The OCID of the compartment.

  • compartment_id_in_subtree (BOOLEAN)

    When set to true, the hierarchy of compartments is traversed and all compartments and subcompartments in the tenancy are returned depending on the the setting of accessLevel.

    Can only be set to true when performing ListCompartments on the tenancy (root compartment).

  • 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

  • :name (String)

    Optional. A filter that returns results that match the name specified.

  • :recommendation_name (String)

    Optional. A filter that returns results that match the recommendation name specified.

  • :limit (Integer)

    The maximum number of items to return in a paginated "List" call. (default to 10)

  • :page (String)

    The value of the opc-next-page response header from the previous "List" call.

  • :sort_order (String)

    The sort order to use, either ascending (ASC) or descending (DESC).

  • :sort_by (String)

    The field to sort by. You can provide one sort order (sortOrder). Default order for TIMECREATED is descending. Default order for NAME is ascending. The NAME sort order is case sensitive.

    Allowed values are: NAME, TIMECREATED

  • :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:



1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
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
1078
1079
1080
1081
1082
# File 'lib/oci/optimizer/optimizer_client.rb', line 1030

def list_recommendation_strategies(compartment_id, compartment_id_in_subtree, opts = {})
  logger.debug 'Calling operation OptimizerClient#list_recommendation_strategies.' if logger

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

  if opts[:sort_order] && !OCI::Optimizer::Models::SORT_ORDER_ENUM.include?(opts[:sort_order])
    raise 'Invalid value for "sort_order", must be one of the values in OCI::Optimizer::Models::SORT_ORDER_ENUM.'
  end

  if opts[:sort_by] && !%w[NAME TIMECREATED].include?(opts[:sort_by])
    raise 'Invalid value for "sort_by", must be one of NAME, TIMECREATED.'
  end

  path = '/recommendationStrategies'
  operation_signing_strategy = :standard

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

  # Header Params
  header_params = {}
  header_params[:accept] = 'application/json'
  header_params[:'content-type'] = 'application/json'
  header_params[:'opc-request-id'] = opts[:opc_request_id] if opts[:opc_request_id]
  # rubocop:enable Style/NegatedIf

  post_body = nil

  # rubocop:disable Metrics/BlockLength
  OCI::Retry.make_retrying_call(applicable_retry_config(opts), call_name: 'OptimizerClient#list_recommendation_strategies') 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::Optimizer::Models::RecommendationStrategyCollection'
    )
  end
  # rubocop:enable Metrics/BlockLength
end

#list_recommendations(compartment_id, compartment_id_in_subtree, category_id, opts = {}) ⇒ Response

Note:

Click [here](docs.cloud.oracle.com/en-us/iaas/tools/ruby-sdk-examples/latest/optimizer/list_recommendations.rb.html) to see an example of how to use list_recommendations API.

Lists the Cloud Advisor recommendations that are currently supported in the specified category.

Parameters:

  • compartment_id (String)

    The OCID of the compartment.

  • compartment_id_in_subtree (BOOLEAN)

    When set to true, the hierarchy of compartments is traversed and all compartments and subcompartments in the tenancy are returned depending on the the setting of accessLevel.

    Can only be set to true when performing ListCompartments on the tenancy (root compartment).

  • category_id (String)

    The unique OCID associated with the category.

  • 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

  • :name (String)

    Optional. A filter that returns results that match the name specified.

  • :limit (Integer)

    The maximum number of items to return in a paginated "List" call. (default to 10)

  • :page (String)

    The value of the opc-next-page response header from the previous "List" call.

  • :sort_order (String)

    The sort order to use, either ascending (ASC) or descending (DESC).

  • :sort_by (String)

    The field to sort by. You can provide one sort order (sortOrder). Default order for TIMECREATED is descending. Default order for NAME is ascending. The NAME sort order is case sensitive.

    Allowed values are: NAME, TIMECREATED

  • :lifecycle_state (String)

    A filter that returns results that match the lifecycle state specified.

  • :status (String)

    A filter that returns recommendations that match the status specified.

  • :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:



1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
# File 'lib/oci/optimizer/optimizer_client.rb', line 1120

def list_recommendations(compartment_id, compartment_id_in_subtree, category_id, opts = {})
  logger.debug 'Calling operation OptimizerClient#list_recommendations.' if logger

  raise "Missing the required parameter 'compartment_id' when calling list_recommendations." if compartment_id.nil?
  raise "Missing the required parameter 'compartment_id_in_subtree' when calling list_recommendations." if compartment_id_in_subtree.nil?
  raise "Missing the required parameter 'category_id' when calling list_recommendations." if category_id.nil?

  if opts[:sort_order] && !OCI::Optimizer::Models::SORT_ORDER_ENUM.include?(opts[:sort_order])
    raise 'Invalid value for "sort_order", must be one of the values in OCI::Optimizer::Models::SORT_ORDER_ENUM.'
  end

  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[:lifecycle_state] && !OCI::Optimizer::Models::LIFECYCLE_STATE_ENUM.include?(opts[:lifecycle_state])
    raise 'Invalid value for "lifecycle_state", must be one of the values in OCI::Optimizer::Models::LIFECYCLE_STATE_ENUM.'
  end

  if opts[:status] && !OCI::Optimizer::Models::STATUS_ENUM.include?(opts[:status])
    raise 'Invalid value for "status", must be one of the values in OCI::Optimizer::Models::STATUS_ENUM.'
  end

  path = '/recommendations'
  operation_signing_strategy = :standard

  # rubocop:disable Style/NegatedIf
  # Query Params
  query_params = {}
  query_params[:compartmentId] = compartment_id
  query_params[:compartmentIdInSubtree] = compartment_id_in_subtree
  query_params[:categoryId] = category_id
  query_params[:name] = opts[:name] if opts[:name]
  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[:status] = opts[:status] if opts[:status]

  # 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: 'OptimizerClient#list_recommendations') 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::Optimizer::Models::RecommendationCollection'
    )
  end
  # rubocop:enable Metrics/BlockLength
end

#list_resource_actions(compartment_id, compartment_id_in_subtree, recommendation_id, opts = {}) ⇒ Response

Note:

Click [here](docs.cloud.oracle.com/en-us/iaas/tools/ruby-sdk-examples/latest/optimizer/list_resource_actions.rb.html) to see an example of how to use list_resource_actions API.

Lists the Cloud Advisor resource actions that are supported by the specified recommendation.

Parameters:

  • compartment_id (String)

    The OCID of the compartment.

  • compartment_id_in_subtree (BOOLEAN)

    When set to true, the hierarchy of compartments is traversed and all compartments and subcompartments in the tenancy are returned depending on the the setting of accessLevel.

    Can only be set to true when performing ListCompartments on the tenancy (root compartment).

  • recommendation_id (String)

    The unique OCID associated with the recommendation.

  • 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

  • :name (String)

    Optional. A filter that returns results that match the name specified.

  • :resource_type (String)

    Optional. A filter that returns results that match the resource type specified.

  • :limit (Integer)

    The maximum number of items to return in a paginated "List" call. (default to 10)

  • :page (String)

    The value of the opc-next-page response header from the previous "List" call.

  • :sort_order (String)

    The sort order to use, either ascending (ASC) or descending (DESC).

  • :sort_by (String)

    The field to sort by. You can provide one sort order (sortOrder). Default order for TIMECREATED is descending. Default order for NAME is ascending. The NAME sort order is case sensitive.

    Allowed values are: NAME, TIMECREATED

  • :lifecycle_state (String)

    A filter that returns results that match the lifecycle state specified.

  • :status (String)

    A filter that returns recommendations that match the status specified.

  • :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:



1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
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
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
# File 'lib/oci/optimizer/optimizer_client.rb', line 1222

def list_resource_actions(compartment_id, compartment_id_in_subtree, recommendation_id, opts = {})
  logger.debug 'Calling operation OptimizerClient#list_resource_actions.' if logger

  raise "Missing the required parameter 'compartment_id' when calling list_resource_actions." if compartment_id.nil?
  raise "Missing the required parameter 'compartment_id_in_subtree' when calling list_resource_actions." if compartment_id_in_subtree.nil?
  raise "Missing the required parameter 'recommendation_id' when calling list_resource_actions." if recommendation_id.nil?

  if opts[:sort_order] && !OCI::Optimizer::Models::SORT_ORDER_ENUM.include?(opts[:sort_order])
    raise 'Invalid value for "sort_order", must be one of the values in OCI::Optimizer::Models::SORT_ORDER_ENUM.'
  end

  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[:lifecycle_state] && !OCI::Optimizer::Models::LIFECYCLE_STATE_ENUM.include?(opts[:lifecycle_state])
    raise 'Invalid value for "lifecycle_state", must be one of the values in OCI::Optimizer::Models::LIFECYCLE_STATE_ENUM.'
  end

  if opts[:status] && !OCI::Optimizer::Models::STATUS_ENUM.include?(opts[:status])
    raise 'Invalid value for "status", must be one of the values in OCI::Optimizer::Models::STATUS_ENUM.'
  end

  path = '/resourceActions'
  operation_signing_strategy = :standard

  # rubocop:disable Style/NegatedIf
  # Query Params
  query_params = {}
  query_params[:compartmentId] = compartment_id
  query_params[:compartmentIdInSubtree] = compartment_id_in_subtree
  query_params[:recommendationId] = recommendation_id
  query_params[:name] = opts[:name] if opts[:name]
  query_params[:resourceType] = opts[:resource_type] if opts[:resource_type]
  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[:status] = opts[:status] if opts[:status]

  # 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: 'OptimizerClient#list_resource_actions') 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::Optimizer::Models::ResourceActionCollection'
    )
  end
  # rubocop:enable Metrics/BlockLength
end

#list_work_request_errors(work_request_id, opts = {}) ⇒ Response

Note:

Click [here](docs.cloud.oracle.com/en-us/iaas/tools/ruby-sdk-examples/latest/optimizer/list_work_request_errors.rb.html) to see an example of how to use list_work_request_errors API.

Lists errors associated with the specified work request.

Parameters:

  • work_request_id (String)

    The OCID of the work request.

  • 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

  • :page (String)

    The value of the opc-next-page response header from the previous "List" call.

  • :limit (Integer)

    The maximum number of items to return in a paginated "List" call. (default to 10)

  • :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:



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
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
# File 'lib/oci/optimizer/optimizer_client.rb', line 1310

def list_work_request_errors(work_request_id, opts = {})
  logger.debug 'Calling operation OptimizerClient#list_work_request_errors.' if logger

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

  path = '/workRequests/{workRequestId}/errors'.sub('{workRequestId}', work_request_id.to_s)
  operation_signing_strategy = :standard

  # rubocop:disable Style/NegatedIf
  # Query Params
  query_params = {}
  query_params[: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 = nil

  # rubocop:disable Metrics/BlockLength
  OCI::Retry.make_retrying_call(applicable_retry_config(opts), call_name: 'OptimizerClient#list_work_request_errors') do
    @api_client.call_api(
      :GET,
      path,
      endpoint,
      header_params: header_params,
      query_params: query_params,
      operation_signing_strategy: operation_signing_strategy,
      body: post_body,
      return_type: 'OCI::Optimizer::Models::WorkRequestErrorCollection'
    )
  end
  # rubocop:enable Metrics/BlockLength
end

#list_work_request_logs(work_request_id, opts = {}) ⇒ Response

Note:

Click [here](docs.cloud.oracle.com/en-us/iaas/tools/ruby-sdk-examples/latest/optimizer/list_work_request_logs.rb.html) to see an example of how to use list_work_request_logs API.

Lists the logs associated with the specified work request.

Parameters:

  • work_request_id (String)

    The OCID of the work request.

  • 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

  • :page (String)

    The value of the opc-next-page response header from the previous "List" call.

  • :limit (Integer)

    The maximum number of items to return in a paginated "List" call. (default to 10)

  • :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:



1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
# File 'lib/oci/optimizer/optimizer_client.rb', line 1372

def list_work_request_logs(work_request_id, opts = {})
  logger.debug 'Calling operation OptimizerClient#list_work_request_logs.' if logger

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

  path = '/workRequests/{workRequestId}/logs'.sub('{workRequestId}', work_request_id.to_s)
  operation_signing_strategy = :standard

  # rubocop:disable Style/NegatedIf
  # Query Params
  query_params = {}
  query_params[: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 = nil

  # rubocop:disable Metrics/BlockLength
  OCI::Retry.make_retrying_call(applicable_retry_config(opts), call_name: 'OptimizerClient#list_work_request_logs') do
    @api_client.call_api(
      :GET,
      path,
      endpoint,
      header_params: header_params,
      query_params: query_params,
      operation_signing_strategy: operation_signing_strategy,
      body: post_body,
      return_type: 'OCI::Optimizer::Models::WorkRequestLogEntryCollection'
    )
  end
  # rubocop:enable Metrics/BlockLength
end

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

Note:

Click [here](docs.cloud.oracle.com/en-us/iaas/tools/ruby-sdk-examples/latest/optimizer/list_work_requests.rb.html) to see an example of how to use list_work_requests API.

Lists the work requests in the tenancy. The tenancy is the root compartment.

Parameters:

  • compartment_id (String)

    The OCID of the compartment.

  • 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

  • :page (String)

    The value of the opc-next-page response header from the previous "List" call.

  • :limit (Integer)

    The maximum number of items to return in a paginated "List" call. (default to 10)

  • :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:



1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
# File 'lib/oci/optimizer/optimizer_client.rb', line 1434

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

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

  path = '/workRequests'
  operation_signing_strategy = :standard

  # rubocop:disable Style/NegatedIf
  # Query Params
  query_params = {}
  query_params[:compartmentId] = compartment_id
  query_params[: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 = nil

  # rubocop:disable Metrics/BlockLength
  OCI::Retry.make_retrying_call(applicable_retry_config(opts), call_name: 'OptimizerClient#list_work_requests') do
    @api_client.call_api(
      :GET,
      path,
      endpoint,
      header_params: header_params,
      query_params: query_params,
      operation_signing_strategy: operation_signing_strategy,
      body: post_body,
      return_type: 'OCI::Optimizer::Models::WorkRequestCollection'
    )
  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.



92
93
94
# File 'lib/oci/optimizer/optimizer_client.rb', line 92

def logger
  @api_client.config.logger
end

#update_enrollment_status(enrollment_status_id, update_enrollment_status_details, opts = {}) ⇒ Response

Note:

Click [here](docs.cloud.oracle.com/en-us/iaas/tools/ruby-sdk-examples/latest/optimizer/update_enrollment_status.rb.html) to see an example of how to use update_enrollment_status API.

Updates the enrollment status of the tenancy.

Parameters:

  • enrollment_status_id (String)

    The unique OCID associated with the enrollment status.

  • update_enrollment_status_details (OCI::Optimizer::Models::UpdateEnrollmentStatusDetails)

    The request object for updating the enrollment status.

  • 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:



1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
# File 'lib/oci/optimizer/optimizer_client.rb', line 1500

def update_enrollment_status(enrollment_status_id, update_enrollment_status_details, opts = {})
  logger.debug 'Calling operation OptimizerClient#update_enrollment_status.' if logger

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

  path = '/enrollmentStatus/{enrollmentStatusId}'.sub('{enrollmentStatusId}', enrollment_status_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_enrollment_status_details)

  # rubocop:disable Metrics/BlockLength
  OCI::Retry.make_retrying_call(applicable_retry_config(opts), call_name: 'OptimizerClient#update_enrollment_status') 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::Optimizer::Models::EnrollmentStatus'
    )
  end
  # rubocop:enable Metrics/BlockLength
end

#update_profile(profile_id, update_profile_details, opts = {}) ⇒ Response

Note:

Click [here](docs.cloud.oracle.com/en-us/iaas/tools/ruby-sdk-examples/latest/optimizer/update_profile.rb.html) to see an example of how to use update_profile API.

Updates the specified profile. Uses the profile’s OCID to determine which profile to update.

Parameters:

  • profile_id (String)

    The unique OCID of the profile.

  • update_profile_details (OCI::Optimizer::Models::UpdateProfileDetails)

    The profile information to use for the update.

  • 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

  • :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.

  • :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:



1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
# File 'lib/oci/optimizer/optimizer_client.rb', line 1566

def update_profile(profile_id, update_profile_details, opts = {})
  logger.debug 'Calling operation OptimizerClient#update_profile.' if logger

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

  path = '/profiles/{profileId}'.sub('{profileId}', profile_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_profile_details)

  # rubocop:disable Metrics/BlockLength
  OCI::Retry.make_retrying_call(applicable_retry_config(opts), call_name: 'OptimizerClient#update_profile') 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::Optimizer::Models::Profile'
    )
  end
  # rubocop:enable Metrics/BlockLength
end

#update_recommendation(recommendation_id, update_recommendation_details, opts = {}) ⇒ Response

Note:

Click [here](docs.cloud.oracle.com/en-us/iaas/tools/ruby-sdk-examples/latest/optimizer/update_recommendation.rb.html) to see an example of how to use update_recommendation API.

Updates the recommendation that corresponds to the specified OCID. Use this operation to implement the following actions:

* Postpone recommendation
* Dismiss recommendation
* Reactivate recommendation

Parameters:

  • recommendation_id (String)

    The unique OCID associated with the recommendation.

  • update_recommendation_details (OCI::Optimizer::Models::UpdateRecommendationDetails)

    The request object for udpating the recommendation details.

  • 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:



1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
# File 'lib/oci/optimizer/optimizer_client.rb', line 1637

def update_recommendation(recommendation_id, update_recommendation_details, opts = {})
  logger.debug 'Calling operation OptimizerClient#update_recommendation.' if logger

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

  path = '/recommendations/{recommendationId}'.sub('{recommendationId}', recommendation_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_recommendation_details)

  # rubocop:disable Metrics/BlockLength
  OCI::Retry.make_retrying_call(applicable_retry_config(opts), call_name: 'OptimizerClient#update_recommendation') 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::Optimizer::Models::Recommendation'
    )
  end
  # rubocop:enable Metrics/BlockLength
end

#update_resource_action(resource_action_id, update_resource_action_details, opts = {}) ⇒ Response

Note:

Click [here](docs.cloud.oracle.com/en-us/iaas/tools/ruby-sdk-examples/latest/optimizer/update_resource_action.rb.html) to see an example of how to use update_resource_action API.

Updates the resource action that corresponds to the specified OCID. Use this operation to implement the following actions:

* Postpone resource action
* Ignore resource action
* Reactivate resource action

Parameters:

  • resource_action_id (String)

    The unique OCID associated with the resource action.

  • update_resource_action_details (OCI::Optimizer::Models::UpdateResourceActionDetails)

    The resource action information to be updated.

  • 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:



1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
# File 'lib/oci/optimizer/optimizer_client.rb', line 1708

def update_resource_action(resource_action_id, update_resource_action_details, opts = {})
  logger.debug 'Calling operation OptimizerClient#update_resource_action.' if logger

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

  path = '/resourceActions/{resourceActionId}'.sub('{resourceActionId}', resource_action_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_resource_action_details)

  # rubocop:disable Metrics/BlockLength
  OCI::Retry.make_retrying_call(applicable_retry_config(opts), call_name: 'OptimizerClient#update_resource_action') 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::Optimizer::Models::ResourceAction'
    )
  end
  # rubocop:enable Metrics/BlockLength
end