oci 2.5.10 → 2.5.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +4 -1
- data/lib/oci.rb +3 -0
- data/lib/oci/budget/budget.rb +1 -0
- data/lib/oci/budget/budget_client.rb +21 -1
- data/lib/oci/budget/models/budget.rb +52 -2
- data/lib/oci/budget/models/budget_summary.rb +52 -2
- data/lib/oci/budget/models/create_budget_details.rb +55 -2
- data/lib/oci/budget/models/target_type.rb +10 -0
- data/lib/oci/core/blockstorage_client.rb +18 -6
- data/lib/oci/core/compute_client.rb +75 -0
- data/lib/oci/core/compute_management_client.rb +4 -1
- data/lib/oci/core/core.rb +12 -0
- data/lib/oci/core/models/add_security_rule_details.rb +2 -2
- data/lib/oci/core/models/boot_volume_backup.rb +19 -1
- data/lib/oci/core/models/change_boot_volume_backup_compartment_details.rb +2 -2
- data/lib/oci/core/models/change_boot_volume_compartment_details.rb +2 -2
- data/lib/oci/core/models/change_cpe_compartment_details.rb +155 -0
- data/lib/oci/core/models/change_cross_connect_compartment_details.rb +155 -0
- data/lib/oci/core/models/change_cross_connect_group_compartment_details.rb +155 -0
- data/lib/oci/core/models/change_instance_compartment_details.rb +154 -0
- data/lib/oci/core/models/change_ip_sec_connection_compartment_details.rb +155 -0
- data/lib/oci/core/models/change_remote_peering_connection_compartment_details.rb +155 -0
- data/lib/oci/core/models/change_virtual_circuit_compartment_details.rb +155 -0
- data/lib/oci/core/models/change_volume_backup_compartment_details.rb +2 -2
- data/lib/oci/core/models/change_volume_compartment_details.rb +2 -2
- data/lib/oci/core/models/change_volume_group_backup_compartment_details.rb +2 -2
- data/lib/oci/core/models/change_volume_group_compartment_details.rb +2 -2
- data/lib/oci/core/models/copy_volume_backup_details.rb +27 -4
- data/lib/oci/core/models/create_cross_connect_details.rb +37 -1
- data/lib/oci/core/models/create_cross_connect_group_details.rb +40 -4
- data/lib/oci/core/models/create_instance_configuration_base.rb +250 -0
- data/lib/oci/core/models/create_instance_configuration_details.rb +15 -57
- data/lib/oci/core/models/create_instance_configuration_from_instance_details.rb +179 -0
- data/lib/oci/core/models/create_ipv6_details.rb +249 -0
- data/lib/oci/core/models/create_remote_peering_connection_details.rb +40 -4
- data/lib/oci/core/models/create_service_gateway_details.rb +23 -1
- data/lib/oci/core/models/create_subnet_details.rb +24 -1
- data/lib/oci/core/models/create_vcn_details.rb +56 -4
- data/lib/oci/core/models/create_virtual_circuit_details.rb +38 -2
- data/lib/oci/core/models/cross_connect.rb +37 -1
- data/lib/oci/core/models/cross_connect_group.rb +37 -1
- data/lib/oci/core/models/cross_connect_mapping.rb +50 -1
- data/lib/oci/core/models/egress_security_rule.rb +10 -7
- data/lib/oci/core/models/ingress_security_rule.rb +10 -7
- data/lib/oci/core/models/instance.rb +1 -0
- data/lib/oci/core/models/ipv6.rb +375 -0
- data/lib/oci/core/models/private_ip.rb +1 -0
- data/lib/oci/core/models/remote_peering_connection.rb +37 -1
- data/lib/oci/core/models/route_rule.rb +4 -1
- data/lib/oci/core/models/security_rule.rb +2 -2
- data/lib/oci/core/models/service_gateway.rb +18 -1
- data/lib/oci/core/models/subnet.rb +56 -1
- data/lib/oci/core/models/update_cross_connect_details.rb +37 -1
- data/lib/oci/core/models/update_cross_connect_group_details.rb +40 -4
- data/lib/oci/core/models/update_ipv6_details.rb +229 -0
- data/lib/oci/core/models/update_remote_peering_connection_details.rb +40 -4
- data/lib/oci/core/models/update_security_rule_details.rb +2 -2
- data/lib/oci/core/models/update_service_gateway_details.rb +18 -1
- data/lib/oci/core/models/update_virtual_circuit_details.rb +37 -1
- data/lib/oci/core/models/vcn.rb +42 -1
- data/lib/oci/core/models/virtual_circuit.rb +37 -1
- data/lib/oci/core/models/volume_backup.rb +19 -1
- data/lib/oci/core/virtual_network_client.rb +744 -10
- data/lib/oci/core/virtual_network_client_composite_operations.rb +119 -0
- data/lib/oci/database/database.rb +3 -0
- data/lib/oci/database/database_client.rb +320 -36
- data/lib/oci/database/models/autonomous_data_warehouse.rb +1 -0
- data/lib/oci/database/models/autonomous_data_warehouse_console_token_details.rb +164 -0
- data/lib/oci/database/models/autonomous_data_warehouse_summary.rb +1 -0
- data/lib/oci/database/models/autonomous_database.rb +5 -3
- data/lib/oci/database/models/autonomous_database_connection_urls.rb +1 -1
- data/lib/oci/database/models/autonomous_database_console_token_details.rb +163 -0
- data/lib/oci/database/models/autonomous_database_summary.rb +5 -3
- data/lib/oci/database/models/autonomous_db_preview_version_summary.rb +1 -3
- data/lib/oci/database/models/change_compartment_details.rb +155 -0
- data/lib/oci/database/models/create_autonomous_database_base.rb +5 -4
- data/lib/oci/database/models/create_data_guard_association_with_new_db_system_details.rb +2 -5
- data/lib/oci/database/models/create_database_details.rb +1 -1
- data/lib/oci/database/models/create_db_home_with_db_system_id_details.rb +2 -1
- data/lib/oci/database/models/create_db_home_with_db_system_id_from_backup_details.rb +2 -1
- data/lib/oci/database/models/db_system.rb +2 -5
- data/lib/oci/database/models/db_system_summary.rb +2 -5
- data/lib/oci/database/models/launch_db_system_base.rb +3 -5
- data/lib/oci/database/models/maintenance_window.rb +2 -1
- data/lib/oci/database/models/update_autonomous_database_details.rb +5 -3
- data/lib/oci/database/models/update_db_system_details.rb +2 -5
- data/lib/oci/dns/dns.rb +2 -0
- data/lib/oci/dns/dns_client.rb +138 -1
- data/lib/oci/dns/models/change_steering_policy_compartment_details.rb +155 -0
- data/lib/oci/dns/models/change_zone_compartment_details.rb +155 -0
- data/lib/oci/events/events.rb +34 -0
- data/lib/oci/events/events_client.rb +537 -0
- data/lib/oci/events/events_client_composite_operations.rb +145 -0
- data/lib/oci/events/models/action.rb +275 -0
- data/lib/oci/events/models/action_details.rb +222 -0
- data/lib/oci/events/models/action_details_list.rb +150 -0
- data/lib/oci/events/models/action_list.rb +151 -0
- data/lib/oci/events/models/change_rule_compartment_details.rb +156 -0
- data/lib/oci/events/models/create_faa_s_action_details.rb +170 -0
- data/lib/oci/events/models/create_notification_service_action_details.rb +170 -0
- data/lib/oci/events/models/create_rule_details.rb +284 -0
- data/lib/oci/events/models/create_streaming_service_action_details.rb +170 -0
- data/lib/oci/events/models/faa_s_action.rb +178 -0
- data/lib/oci/events/models/notification_service_action.rb +179 -0
- data/lib/oci/events/models/rule.rb +372 -0
- data/lib/oci/events/models/rule_summary.rb +321 -0
- data/lib/oci/events/models/streaming_service_action.rb +178 -0
- data/lib/oci/events/models/update_rule_details.rb +266 -0
- data/lib/oci/events/util.rb +2 -0
- data/lib/oci/functions/functions.rb +29 -0
- data/lib/oci/functions/functions_invoke_client.rb +237 -0
- data/lib/oci/functions/functions_invoke_client_composite_operations.rb +24 -0
- data/lib/oci/functions/functions_management_client.rb +851 -0
- data/lib/oci/functions/functions_management_client_composite_operations.rb +266 -0
- data/lib/oci/functions/models/application.rb +322 -0
- data/lib/oci/functions/models/application_summary.rb +281 -0
- data/lib/oci/functions/models/change_application_compartment_details.rb +156 -0
- data/lib/oci/functions/models/create_application_details.rb +236 -0
- data/lib/oci/functions/models/create_function_details.rb +280 -0
- data/lib/oci/functions/models/function.rb +397 -0
- data/lib/oci/functions/models/function_summary.rb +381 -0
- data/lib/oci/functions/models/update_application_details.rb +191 -0
- data/lib/oci/functions/models/update_function_details.rb +250 -0
- data/lib/oci/functions/util.rb +2 -0
- data/lib/oci/healthchecks/health_checks_client.rb +147 -1
- data/lib/oci/healthchecks/healthchecks.rb +2 -0
- data/lib/oci/healthchecks/models/change_http_monitor_compartment_details.rb +155 -0
- data/lib/oci/healthchecks/models/change_ping_monitor_compartment_details.rb +155 -0
- data/lib/oci/healthchecks/models/create_http_monitor_details.rb +2 -1
- data/lib/oci/healthchecks/models/create_on_demand_http_probe_details.rb +2 -1
- data/lib/oci/healthchecks/models/create_on_demand_ping_probe_details.rb +2 -1
- data/lib/oci/healthchecks/models/create_ping_monitor_details.rb +2 -1
- data/lib/oci/healthchecks/models/http_monitor.rb +2 -0
- data/lib/oci/healthchecks/models/http_probe.rb +2 -0
- data/lib/oci/healthchecks/models/ping_monitor.rb +2 -0
- data/lib/oci/healthchecks/models/ping_probe.rb +2 -0
- data/lib/oci/healthchecks/models/update_http_monitor_details.rb +2 -0
- data/lib/oci/healthchecks/models/update_ping_monitor_details.rb +2 -0
- data/lib/oci/identity/identity.rb +1 -0
- data/lib/oci/identity/identity_client.rb +70 -0
- data/lib/oci/identity/identity_client_composite_operations.rb +50 -0
- data/lib/oci/identity/models/move_compartment_details.rb +155 -0
- data/lib/oci/key_management/key_management.rb +2 -0
- data/lib/oci/key_management/kms_management_client.rb +73 -0
- data/lib/oci/key_management/kms_vault_client.rb +73 -0
- data/lib/oci/key_management/models/change_key_compartment_details.rb +153 -0
- data/lib/oci/key_management/models/change_vault_compartment_details.rb +153 -0
- data/lib/oci/key_management/models/key.rb +1 -0
- data/lib/oci/key_management/models/key_summary.rb +1 -0
- data/lib/oci/key_management/models/vault.rb +1 -0
- data/lib/oci/key_management/models/vault_summary.rb +1 -0
- data/lib/oci/limits/limits.rb +23 -0
- data/lib/oci/limits/models/create_quota_details.rb +220 -0
- data/lib/oci/limits/models/quota.rb +287 -0
- data/lib/oci/limits/models/quota_summary.rb +273 -0
- data/lib/oci/limits/models/update_quota_details.rb +194 -0
- data/lib/oci/limits/quotas_client.rb +439 -0
- data/lib/oci/limits/quotas_client_composite_operations.rb +143 -0
- data/lib/oci/limits/util.rb +2 -0
- data/lib/oci/load_balancer/load_balancer.rb +9 -0
- data/lib/oci/load_balancer/load_balancer_client.rb +139 -0
- data/lib/oci/load_balancer/load_balancer_client_composite_operations.rb +50 -0
- data/lib/oci/load_balancer/models/allow_rule.rb +181 -0
- data/lib/oci/load_balancer/models/backend_set.rb +21 -4
- data/lib/oci/load_balancer/models/backend_set_details.rb +21 -4
- data/lib/oci/load_balancer/models/change_load_balancer_compartment_details.rb +156 -0
- data/lib/oci/load_balancer/models/control_access_using_http_methods_rule.rb +205 -0
- data/lib/oci/load_balancer/models/create_backend_set_details.rb +21 -4
- data/lib/oci/load_balancer/models/create_load_balancer_details.rb +37 -1
- data/lib/oci/load_balancer/models/lb_cookie_session_persistence_configuration_details.rb +334 -0
- data/lib/oci/load_balancer/models/listener_rule_summary.rb +166 -0
- data/lib/oci/load_balancer/models/rule.rb +4 -0
- data/lib/oci/load_balancer/models/rule_condition.rb +192 -0
- data/lib/oci/load_balancer/models/session_persistence_configuration_details.rb +6 -0
- data/lib/oci/load_balancer/models/source_ip_address_condition.rb +167 -0
- data/lib/oci/load_balancer/models/source_vcn_id_condition.rb +169 -0
- data/lib/oci/load_balancer/models/source_vcn_ip_address_condition.rb +171 -0
- data/lib/oci/load_balancer/models/update_backend_set_details.rb +21 -4
- data/lib/oci/monitoring/models/alarm.rb +4 -3
- data/lib/oci/monitoring/models/alarm_summary.rb +4 -3
- data/lib/oci/monitoring/models/change_alarm_compartment_details.rb +155 -0
- data/lib/oci/monitoring/models/create_alarm_details.rb +4 -3
- data/lib/oci/monitoring/models/datapoint.rb +1 -1
- data/lib/oci/monitoring/models/list_metrics_details.rb +4 -4
- data/lib/oci/monitoring/models/metric_data.rb +14 -0
- data/lib/oci/monitoring/models/metric_data_details.rb +6 -4
- data/lib/oci/monitoring/models/summarize_metrics_data_details.rb +3 -0
- data/lib/oci/monitoring/models/update_alarm_details.rb +4 -3
- data/lib/oci/monitoring/monitoring.rb +1 -0
- data/lib/oci/monitoring/monitoring_client.rb +140 -5
- data/lib/oci/ons/models/backoff_retry_policy.rb +2 -2
- data/lib/oci/ons/models/change_compartment_details.rb +156 -0
- data/lib/oci/ons/models/confirmation_result.rb +5 -6
- data/lib/oci/ons/models/create_topic_details.rb +1 -1
- data/lib/oci/ons/models/notification_topic.rb +2 -2
- data/lib/oci/ons/models/notification_topic_summary.rb +2 -2
- data/lib/oci/ons/models/subscription.rb +47 -4
- data/lib/oci/ons/models/subscription_summary.rb +19 -3
- data/lib/oci/ons/notification_control_plane_client.rb +95 -8
- data/lib/oci/ons/notification_data_plane_client.rb +109 -8
- data/lib/oci/ons/ons.rb +1 -0
- data/lib/oci/regions.rb +3 -0
- data/lib/oci/streaming/models/change_stream_compartment_details.rb +155 -0
- data/lib/oci/streaming/stream_admin_client.rb +58 -0
- data/lib/oci/streaming/streaming.rb +1 -0
- data/lib/oci/version.rb +1 -1
- data/lib/oci/waas/models/access_rule_criteria.rb +14 -2
- data/lib/oci/waas/models/change_certificate_compartment_details.rb +154 -0
- data/lib/oci/waas/models/change_waas_policy_compartment_details.rb +154 -0
- data/lib/oci/waas/models/create_certificate_details.rb +2 -2
- data/lib/oci/waas/models/protection_rule_exclusion.rb +16 -1
- data/lib/oci/waas/models/protection_settings.rb +9 -5
- data/lib/oci/waas/models/waas_policy.rb +1 -1
- data/lib/oci/waas/models/waf_config_details.rb +8 -8
- data/lib/oci/waas/models/waf_log.rb +40 -19
- data/lib/oci/waas/waas.rb +2 -0
- data/lib/oci/waas/waas_client.rb +155 -27
- data/lib/oci/work_requests/models/work_request.rb +14 -8
- data/lib/oci/work_requests/models/work_request_error.rb +3 -3
- data/lib/oci/work_requests/models/work_request_log_entry.rb +2 -2
- data/lib/oci/work_requests/models/work_request_resource.rb +9 -7
- data/lib/oci/work_requests/models/work_request_summary.rb +12 -6
- data/lib/oci/work_requests/work_request_client.rb +33 -16
- metadata +81 -2
@@ -0,0 +1,439 @@
|
|
1
|
+
# Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
|
2
|
+
|
3
|
+
require 'uri'
|
4
|
+
require 'logger'
|
5
|
+
|
6
|
+
# rubocop:disable Lint/UnneededCopDisableDirective, Metrics/LineLength
|
7
|
+
module OCI
|
8
|
+
# APIs for managing Compartment Resource Quotas.
|
9
|
+
class Limits::QuotasClient
|
10
|
+
# Client used to make HTTP requests.
|
11
|
+
# @return [OCI::ApiClient]
|
12
|
+
attr_reader :api_client
|
13
|
+
|
14
|
+
# Fully qualified endpoint URL
|
15
|
+
# @return [String]
|
16
|
+
attr_reader :endpoint
|
17
|
+
|
18
|
+
# The default retry configuration to apply to all operations in this service client. This can be overridden
|
19
|
+
# on a per-operation basis. The default retry configuration value is `nil`, which means that an operation
|
20
|
+
# will not perform any retries
|
21
|
+
# @return [OCI::Retry::RetryConfig]
|
22
|
+
attr_reader :retry_config
|
23
|
+
|
24
|
+
# The region, which will usually correspond to a value in {OCI::Regions::REGION_ENUM}.
|
25
|
+
# @return [String]
|
26
|
+
attr_reader :region
|
27
|
+
|
28
|
+
# rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Layout/EmptyLines, Metrics/PerceivedComplexity
|
29
|
+
|
30
|
+
|
31
|
+
# Creates a new QuotasClient.
|
32
|
+
# Notes:
|
33
|
+
# If a config is not specified, then the global OCI.config will be used.
|
34
|
+
#
|
35
|
+
# This client is not thread-safe
|
36
|
+
#
|
37
|
+
# Either a region or an endpoint must be specified. If an endpoint is specified, it will be used instead of the
|
38
|
+
# region. A region may be specified in the config or via or the region parameter. If specified in both, then the
|
39
|
+
# region parameter will be used.
|
40
|
+
# @param [Config] config A Config object.
|
41
|
+
# @param [String] region A region used to determine the service endpoint. This will usually
|
42
|
+
# correspond to a value in {OCI::Regions::REGION_ENUM}, but may be an arbitrary string.
|
43
|
+
# @param [String] endpoint The fully qualified endpoint URL
|
44
|
+
# @param [OCI::BaseSigner] signer A signer implementation which can be used by this client. If this is not provided then
|
45
|
+
# a signer will be constructed via the provided config. One use case of this parameter is instance principals authentication,
|
46
|
+
# so that the instance principals signer can be provided to the client
|
47
|
+
# @param [OCI::ApiClientProxySettings] proxy_settings If your environment requires you to use a proxy server for outgoing HTTP requests
|
48
|
+
# the details for the proxy can be provided in this parameter
|
49
|
+
# @param [OCI::Retry::RetryConfig] retry_config The retry configuration for this service client. This represents the default retry configuration to
|
50
|
+
# 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
|
51
|
+
# will not perform any retries
|
52
|
+
def initialize(config: nil, region: nil, endpoint: nil, signer: nil, proxy_settings: nil, retry_config: nil)
|
53
|
+
# If the signer is an InstancePrincipalsSecurityTokenSigner and no config was supplied (which is valid for instance principals)
|
54
|
+
# then create a dummy config to pass to the ApiClient constructor. If customers wish to create a client which uses instance principals
|
55
|
+
# and has config (either populated programmatically or loaded from a file), they must construct that config themselves and then
|
56
|
+
# pass it to this constructor.
|
57
|
+
#
|
58
|
+
# If there is no signer (or the signer is not an instance principals signer) and no config was supplied, this is not valid
|
59
|
+
# so try and load the config from the default file.
|
60
|
+
config ||= OCI.config unless signer.is_a?(OCI::Auth::Signers::InstancePrincipalsSecurityTokenSigner)
|
61
|
+
config ||= OCI::Config.new if signer.is_a?(OCI::Auth::Signers::InstancePrincipalsSecurityTokenSigner)
|
62
|
+
config.validate unless signer.is_a?(OCI::Auth::Signers::InstancePrincipalsSecurityTokenSigner)
|
63
|
+
|
64
|
+
if signer.nil?
|
65
|
+
signer = OCI::Signer.new(
|
66
|
+
config.user,
|
67
|
+
config.fingerprint,
|
68
|
+
config.tenancy,
|
69
|
+
config.key_file,
|
70
|
+
pass_phrase: config.pass_phrase,
|
71
|
+
private_key_content: config.key_content
|
72
|
+
)
|
73
|
+
end
|
74
|
+
|
75
|
+
@api_client = OCI::ApiClient.new(config, signer, proxy_settings: proxy_settings)
|
76
|
+
@retry_config = retry_config
|
77
|
+
|
78
|
+
if endpoint
|
79
|
+
@endpoint = endpoint + '/20181025'
|
80
|
+
else
|
81
|
+
region ||= config.region
|
82
|
+
region ||= signer.region if signer.respond_to?(:region)
|
83
|
+
self.region = region
|
84
|
+
end
|
85
|
+
logger.info "QuotasClient endpoint set to '#{@endpoint}'." if logger
|
86
|
+
end
|
87
|
+
# rubocop:enable Metrics/AbcSize, Metrics/CyclomaticComplexity, Layout/EmptyLines, Metrics/PerceivedComplexity
|
88
|
+
|
89
|
+
# Set the region that will be used to determine the service endpoint.
|
90
|
+
# This will usually correspond to a value in {OCI::Regions::REGION_ENUM},
|
91
|
+
# but may be an arbitrary string.
|
92
|
+
def region=(new_region)
|
93
|
+
@region = new_region
|
94
|
+
|
95
|
+
raise 'A region must be specified.' unless @region
|
96
|
+
|
97
|
+
@endpoint = OCI::Regions.get_service_endpoint_for_template(@region, 'https://limits.{region}.oci.{secondLevelDomain}') + '/20181025'
|
98
|
+
logger.info "QuotasClient endpoint set to '#{@endpoint} from region #{@region}'." if logger
|
99
|
+
end
|
100
|
+
|
101
|
+
# @return [Logger] The logger for this client. May be nil.
|
102
|
+
def logger
|
103
|
+
@api_client.config.logger
|
104
|
+
end
|
105
|
+
|
106
|
+
# rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
|
107
|
+
# rubocop:disable Style/IfUnlessModifier, Metrics/ParameterLists
|
108
|
+
# rubocop:disable Metrics/MethodLength, Layout/EmptyLines
|
109
|
+
|
110
|
+
|
111
|
+
# Creates a new quota with the details supplied.
|
112
|
+
# @param [OCI::Limits::Models::CreateQuotaDetails] create_quota_details Request object for creating a new quota.
|
113
|
+
# @param [Hash] opts the optional parameters
|
114
|
+
# @option opts [OCI::Retry::RetryConfig] :retry_config The retry configuration to apply to this operation. If no key is provided then the service-level
|
115
|
+
# retry configuration defined by {#retry_config} will be used. If an explicit `nil` value is provided then the operation will not retry
|
116
|
+
# @option opts [String] :opc_request_id Unique Oracle-assigned identifier for the request. If you need to contact Oracle about a
|
117
|
+
# particular request, please provide the request ID.
|
118
|
+
#
|
119
|
+
# @option opts [String] :opc_retry_token A token that uniquely identifies a request so it can be retried in case of a timeout or
|
120
|
+
# server error without risk of executing that same action again. Retry tokens expire after 24
|
121
|
+
# hours, but can be invalidated before then due to conflicting operations (e.g., if a resource
|
122
|
+
# has been deleted and purged from the system, then a retry of the original creation request
|
123
|
+
# may be rejected).
|
124
|
+
#
|
125
|
+
# @return [Response] A Response object with data of type {OCI::Limits::Models::Quota Quota}
|
126
|
+
def create_quota(create_quota_details, opts = {})
|
127
|
+
logger.debug 'Calling operation QuotasClient#create_quota.' if logger
|
128
|
+
|
129
|
+
raise "Missing the required parameter 'create_quota_details' when calling create_quota." if create_quota_details.nil?
|
130
|
+
|
131
|
+
path = '/quotas/'
|
132
|
+
operation_signing_strategy = :standard
|
133
|
+
|
134
|
+
# rubocop:disable Style/NegatedIf
|
135
|
+
# Query Params
|
136
|
+
query_params = {}
|
137
|
+
|
138
|
+
# Header Params
|
139
|
+
header_params = {}
|
140
|
+
header_params[:accept] = 'application/json'
|
141
|
+
header_params[:'content-type'] = 'application/json'
|
142
|
+
header_params[:'opc-request-id'] = opts[:opc_request_id] if opts[:opc_request_id]
|
143
|
+
header_params[:'opc-retry-token'] = opts[:opc_retry_token] if opts[:opc_retry_token]
|
144
|
+
# rubocop:enable Style/NegatedIf
|
145
|
+
header_params[:'opc-retry-token'] ||= OCI::Retry.generate_opc_retry_token
|
146
|
+
|
147
|
+
post_body = @api_client.object_to_http_body(create_quota_details)
|
148
|
+
|
149
|
+
# rubocop:disable Metrics/BlockLength
|
150
|
+
OCI::Retry.make_retrying_call(applicable_retry_config(opts), call_name: 'QuotasClient#create_quota') do
|
151
|
+
@api_client.call_api(
|
152
|
+
:POST,
|
153
|
+
path,
|
154
|
+
endpoint,
|
155
|
+
header_params: header_params,
|
156
|
+
query_params: query_params,
|
157
|
+
operation_signing_strategy: operation_signing_strategy,
|
158
|
+
body: post_body,
|
159
|
+
return_type: 'OCI::Limits::Models::Quota'
|
160
|
+
)
|
161
|
+
end
|
162
|
+
# rubocop:enable Metrics/BlockLength
|
163
|
+
end
|
164
|
+
# rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
|
165
|
+
# rubocop:enable Style/IfUnlessModifier, Metrics/ParameterLists
|
166
|
+
# rubocop:enable Metrics/MethodLength, Layout/EmptyLines
|
167
|
+
|
168
|
+
# rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
|
169
|
+
# rubocop:disable Style/IfUnlessModifier, Metrics/ParameterLists
|
170
|
+
# rubocop:disable Metrics/MethodLength, Layout/EmptyLines
|
171
|
+
|
172
|
+
|
173
|
+
# Deletes the quota corresponding to the given OCID.
|
174
|
+
# @param [String] quota_id The OCID of the quota.
|
175
|
+
# @param [Hash] opts the optional parameters
|
176
|
+
# @option opts [OCI::Retry::RetryConfig] :retry_config The retry configuration to apply to this operation. If no key is provided then the service-level
|
177
|
+
# retry configuration defined by {#retry_config} will be used. If an explicit `nil` value is provided then the operation will not retry
|
178
|
+
# @option opts [String] :opc_request_id Unique Oracle-assigned identifier for the request. If you need to contact Oracle about a
|
179
|
+
# particular request, please provide the request ID.
|
180
|
+
#
|
181
|
+
# @option opts [String] :if_match For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match`
|
182
|
+
# parameter to the value of the etag from a previous GET or POST response for that resource. The resource
|
183
|
+
# will be updated or deleted only if the etag you provide matches the resource's current etag value.
|
184
|
+
#
|
185
|
+
# @return [Response] A Response object with data of type nil
|
186
|
+
def delete_quota(quota_id, opts = {})
|
187
|
+
logger.debug 'Calling operation QuotasClient#delete_quota.' if logger
|
188
|
+
|
189
|
+
raise "Missing the required parameter 'quota_id' when calling delete_quota." if quota_id.nil?
|
190
|
+
raise "Parameter value for 'quota_id' must not be blank" if OCI::Internal::Util.blank_string?(quota_id)
|
191
|
+
|
192
|
+
path = '/quotas/{quotaId}'.sub('{quotaId}', quota_id.to_s)
|
193
|
+
operation_signing_strategy = :standard
|
194
|
+
|
195
|
+
# rubocop:disable Style/NegatedIf
|
196
|
+
# Query Params
|
197
|
+
query_params = {}
|
198
|
+
|
199
|
+
# Header Params
|
200
|
+
header_params = {}
|
201
|
+
header_params[:accept] = 'application/json'
|
202
|
+
header_params[:'content-type'] = 'application/json'
|
203
|
+
header_params[:'opc-request-id'] = opts[:opc_request_id] if opts[:opc_request_id]
|
204
|
+
header_params[:'if-match'] = opts[:if_match] if opts[:if_match]
|
205
|
+
# rubocop:enable Style/NegatedIf
|
206
|
+
|
207
|
+
post_body = nil
|
208
|
+
|
209
|
+
# rubocop:disable Metrics/BlockLength
|
210
|
+
OCI::Retry.make_retrying_call(applicable_retry_config(opts), call_name: 'QuotasClient#delete_quota') do
|
211
|
+
@api_client.call_api(
|
212
|
+
:DELETE,
|
213
|
+
path,
|
214
|
+
endpoint,
|
215
|
+
header_params: header_params,
|
216
|
+
query_params: query_params,
|
217
|
+
operation_signing_strategy: operation_signing_strategy,
|
218
|
+
body: post_body
|
219
|
+
)
|
220
|
+
end
|
221
|
+
# rubocop:enable Metrics/BlockLength
|
222
|
+
end
|
223
|
+
# rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
|
224
|
+
# rubocop:enable Style/IfUnlessModifier, Metrics/ParameterLists
|
225
|
+
# rubocop:enable Metrics/MethodLength, Layout/EmptyLines
|
226
|
+
|
227
|
+
# rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
|
228
|
+
# rubocop:disable Style/IfUnlessModifier, Metrics/ParameterLists
|
229
|
+
# rubocop:disable Metrics/MethodLength, Layout/EmptyLines
|
230
|
+
|
231
|
+
|
232
|
+
# Gets the quota for the OCID specified.
|
233
|
+
# @param [String] quota_id The OCID of the quota.
|
234
|
+
# @param [Hash] opts the optional parameters
|
235
|
+
# @option opts [OCI::Retry::RetryConfig] :retry_config The retry configuration to apply to this operation. If no key is provided then the service-level
|
236
|
+
# retry configuration defined by {#retry_config} will be used. If an explicit `nil` value is provided then the operation will not retry
|
237
|
+
# @option opts [String] :opc_request_id Unique Oracle-assigned identifier for the request. If you need to contact Oracle about a
|
238
|
+
# particular request, please provide the request ID.
|
239
|
+
#
|
240
|
+
# @return [Response] A Response object with data of type {OCI::Limits::Models::Quota Quota}
|
241
|
+
def get_quota(quota_id, opts = {})
|
242
|
+
logger.debug 'Calling operation QuotasClient#get_quota.' if logger
|
243
|
+
|
244
|
+
raise "Missing the required parameter 'quota_id' when calling get_quota." if quota_id.nil?
|
245
|
+
raise "Parameter value for 'quota_id' must not be blank" if OCI::Internal::Util.blank_string?(quota_id)
|
246
|
+
|
247
|
+
path = '/quotas/{quotaId}'.sub('{quotaId}', quota_id.to_s)
|
248
|
+
operation_signing_strategy = :standard
|
249
|
+
|
250
|
+
# rubocop:disable Style/NegatedIf
|
251
|
+
# Query Params
|
252
|
+
query_params = {}
|
253
|
+
|
254
|
+
# Header Params
|
255
|
+
header_params = {}
|
256
|
+
header_params[:accept] = 'application/json'
|
257
|
+
header_params[:'content-type'] = 'application/json'
|
258
|
+
header_params[:'opc-request-id'] = opts[:opc_request_id] if opts[:opc_request_id]
|
259
|
+
# rubocop:enable Style/NegatedIf
|
260
|
+
|
261
|
+
post_body = nil
|
262
|
+
|
263
|
+
# rubocop:disable Metrics/BlockLength
|
264
|
+
OCI::Retry.make_retrying_call(applicable_retry_config(opts), call_name: 'QuotasClient#get_quota') do
|
265
|
+
@api_client.call_api(
|
266
|
+
:GET,
|
267
|
+
path,
|
268
|
+
endpoint,
|
269
|
+
header_params: header_params,
|
270
|
+
query_params: query_params,
|
271
|
+
operation_signing_strategy: operation_signing_strategy,
|
272
|
+
body: post_body,
|
273
|
+
return_type: 'OCI::Limits::Models::Quota'
|
274
|
+
)
|
275
|
+
end
|
276
|
+
# rubocop:enable Metrics/BlockLength
|
277
|
+
end
|
278
|
+
# rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
|
279
|
+
# rubocop:enable Style/IfUnlessModifier, Metrics/ParameterLists
|
280
|
+
# rubocop:enable Metrics/MethodLength, Layout/EmptyLines
|
281
|
+
|
282
|
+
# rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
|
283
|
+
# rubocop:disable Style/IfUnlessModifier, Metrics/ParameterLists
|
284
|
+
# rubocop:disable Metrics/MethodLength, Layout/EmptyLines
|
285
|
+
|
286
|
+
|
287
|
+
# Lists all quotas on resources from the given compartment
|
288
|
+
# @param [String] compartment_id The OCID of the parent compartment (remember that the tenancy is simply the root compartment).
|
289
|
+
#
|
290
|
+
# @param [Hash] opts the optional parameters
|
291
|
+
# @option opts [OCI::Retry::RetryConfig] :retry_config The retry configuration to apply to this operation. If no key is provided then the service-level
|
292
|
+
# retry configuration defined by {#retry_config} will be used. If an explicit `nil` value is provided then the operation will not retry
|
293
|
+
# @option opts [String] :page The value of the `opc-next-page` response header from the previous \"List\" call.
|
294
|
+
#
|
295
|
+
# @option opts [Integer] :limit The maximum number of items to return in a paginated \"List\" call.
|
296
|
+
#
|
297
|
+
# @option opts [String] :name name
|
298
|
+
# @option opts [String] :lifecycle_state Filters returned quotas based on whether the given state.
|
299
|
+
# Allowed values are: ACTIVE
|
300
|
+
# @option opts [String] :sort_order The sort order to use, either 'asc' or 'desc'.
|
301
|
+
# Allowed values are: ASC, DESC
|
302
|
+
# @option opts [String] :sort_by The field to sort by. Only one sort order may be provided. Time created is default ordered as descending. Display name is default ordered as ascending.
|
303
|
+
#
|
304
|
+
# Allowed values are: NAME, TIMECREATED
|
305
|
+
# @option opts [String] :opc_request_id Unique Oracle-assigned identifier for the request. If you need to contact Oracle about a
|
306
|
+
# particular request, please provide the request ID.
|
307
|
+
#
|
308
|
+
# @return [Response] A Response object with data of type Array<{OCI::Limits::Models::QuotaSummary QuotaSummary}>
|
309
|
+
def list_quotas(compartment_id, opts = {})
|
310
|
+
logger.debug 'Calling operation QuotasClient#list_quotas.' if logger
|
311
|
+
|
312
|
+
raise "Missing the required parameter 'compartment_id' when calling list_quotas." if compartment_id.nil?
|
313
|
+
|
314
|
+
if opts[:lifecycle_state] && !%w[ACTIVE].include?(opts[:lifecycle_state])
|
315
|
+
raise 'Invalid value for "lifecycle_state", must be one of ACTIVE.'
|
316
|
+
end
|
317
|
+
|
318
|
+
if opts[:sort_order] && !%w[ASC DESC].include?(opts[:sort_order])
|
319
|
+
raise 'Invalid value for "sort_order", must be one of ASC, DESC.'
|
320
|
+
end
|
321
|
+
|
322
|
+
if opts[:sort_by] && !%w[NAME TIMECREATED].include?(opts[:sort_by])
|
323
|
+
raise 'Invalid value for "sort_by", must be one of NAME, TIMECREATED.'
|
324
|
+
end
|
325
|
+
|
326
|
+
path = '/quotas/'
|
327
|
+
operation_signing_strategy = :standard
|
328
|
+
|
329
|
+
# rubocop:disable Style/NegatedIf
|
330
|
+
# Query Params
|
331
|
+
query_params = {}
|
332
|
+
query_params[:compartmentId] = compartment_id
|
333
|
+
query_params[:page] = opts[:page] if opts[:page]
|
334
|
+
query_params[:limit] = opts[:limit] if opts[:limit]
|
335
|
+
query_params[:name] = opts[:name] if opts[:name]
|
336
|
+
query_params[:lifecycleState] = opts[:lifecycle_state] if opts[:lifecycle_state]
|
337
|
+
query_params[:sortOrder] = opts[:sort_order] if opts[:sort_order]
|
338
|
+
query_params[:sortBy] = opts[:sort_by] if opts[:sort_by]
|
339
|
+
|
340
|
+
# Header Params
|
341
|
+
header_params = {}
|
342
|
+
header_params[:accept] = 'application/json'
|
343
|
+
header_params[:'content-type'] = 'application/json'
|
344
|
+
header_params[:'opc-request-id'] = opts[:opc_request_id] if opts[:opc_request_id]
|
345
|
+
# rubocop:enable Style/NegatedIf
|
346
|
+
|
347
|
+
post_body = nil
|
348
|
+
|
349
|
+
# rubocop:disable Metrics/BlockLength
|
350
|
+
OCI::Retry.make_retrying_call(applicable_retry_config(opts), call_name: 'QuotasClient#list_quotas') do
|
351
|
+
@api_client.call_api(
|
352
|
+
:GET,
|
353
|
+
path,
|
354
|
+
endpoint,
|
355
|
+
header_params: header_params,
|
356
|
+
query_params: query_params,
|
357
|
+
operation_signing_strategy: operation_signing_strategy,
|
358
|
+
body: post_body,
|
359
|
+
return_type: 'Array<OCI::Limits::Models::QuotaSummary>'
|
360
|
+
)
|
361
|
+
end
|
362
|
+
# rubocop:enable Metrics/BlockLength
|
363
|
+
end
|
364
|
+
# rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
|
365
|
+
# rubocop:enable Style/IfUnlessModifier, Metrics/ParameterLists
|
366
|
+
# rubocop:enable Metrics/MethodLength, Layout/EmptyLines
|
367
|
+
|
368
|
+
# rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
|
369
|
+
# rubocop:disable Style/IfUnlessModifier, Metrics/ParameterLists
|
370
|
+
# rubocop:disable Metrics/MethodLength, Layout/EmptyLines
|
371
|
+
|
372
|
+
|
373
|
+
# Updates the quota corresponding to given OCID with the details supplied.
|
374
|
+
# @param [String] quota_id The OCID of the quota.
|
375
|
+
# @param [OCI::Limits::Models::UpdateQuotaDetails] update_quota_details Request object for updating a quota.
|
376
|
+
# @param [Hash] opts the optional parameters
|
377
|
+
# @option opts [OCI::Retry::RetryConfig] :retry_config The retry configuration to apply to this operation. If no key is provided then the service-level
|
378
|
+
# retry configuration defined by {#retry_config} will be used. If an explicit `nil` value is provided then the operation will not retry
|
379
|
+
# @option opts [String] :opc_request_id Unique Oracle-assigned identifier for the request. If you need to contact Oracle about a
|
380
|
+
# particular request, please provide the request ID.
|
381
|
+
#
|
382
|
+
# @option opts [String] :if_match For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match`
|
383
|
+
# parameter to the value of the etag from a previous GET or POST response for that resource. The resource
|
384
|
+
# will be updated or deleted only if the etag you provide matches the resource's current etag value.
|
385
|
+
#
|
386
|
+
# @return [Response] A Response object with data of type {OCI::Limits::Models::Quota Quota}
|
387
|
+
def update_quota(quota_id, update_quota_details, opts = {})
|
388
|
+
logger.debug 'Calling operation QuotasClient#update_quota.' if logger
|
389
|
+
|
390
|
+
raise "Missing the required parameter 'quota_id' when calling update_quota." if quota_id.nil?
|
391
|
+
raise "Missing the required parameter 'update_quota_details' when calling update_quota." if update_quota_details.nil?
|
392
|
+
raise "Parameter value for 'quota_id' must not be blank" if OCI::Internal::Util.blank_string?(quota_id)
|
393
|
+
|
394
|
+
path = '/quotas/{quotaId}'.sub('{quotaId}', quota_id.to_s)
|
395
|
+
operation_signing_strategy = :standard
|
396
|
+
|
397
|
+
# rubocop:disable Style/NegatedIf
|
398
|
+
# Query Params
|
399
|
+
query_params = {}
|
400
|
+
|
401
|
+
# Header Params
|
402
|
+
header_params = {}
|
403
|
+
header_params[:accept] = 'application/json'
|
404
|
+
header_params[:'content-type'] = 'application/json'
|
405
|
+
header_params[:'opc-request-id'] = opts[:opc_request_id] if opts[:opc_request_id]
|
406
|
+
header_params[:'if-match'] = opts[:if_match] if opts[:if_match]
|
407
|
+
# rubocop:enable Style/NegatedIf
|
408
|
+
|
409
|
+
post_body = @api_client.object_to_http_body(update_quota_details)
|
410
|
+
|
411
|
+
# rubocop:disable Metrics/BlockLength
|
412
|
+
OCI::Retry.make_retrying_call(applicable_retry_config(opts), call_name: 'QuotasClient#update_quota') do
|
413
|
+
@api_client.call_api(
|
414
|
+
:PUT,
|
415
|
+
path,
|
416
|
+
endpoint,
|
417
|
+
header_params: header_params,
|
418
|
+
query_params: query_params,
|
419
|
+
operation_signing_strategy: operation_signing_strategy,
|
420
|
+
body: post_body,
|
421
|
+
return_type: 'OCI::Limits::Models::Quota'
|
422
|
+
)
|
423
|
+
end
|
424
|
+
# rubocop:enable Metrics/BlockLength
|
425
|
+
end
|
426
|
+
# rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
|
427
|
+
# rubocop:enable Style/IfUnlessModifier, Metrics/ParameterLists
|
428
|
+
# rubocop:enable Metrics/MethodLength, Layout/EmptyLines
|
429
|
+
|
430
|
+
private
|
431
|
+
|
432
|
+
def applicable_retry_config(opts = {})
|
433
|
+
return @retry_config unless opts.key?(:retry_config)
|
434
|
+
|
435
|
+
opts[:retry_config]
|
436
|
+
end
|
437
|
+
end
|
438
|
+
end
|
439
|
+
# rubocop:enable Lint/UnneededCopDisableDirective, Metrics/LineLength
|
@@ -0,0 +1,143 @@
|
|
1
|
+
# Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
|
2
|
+
|
3
|
+
# rubocop:disable Lint/UnneededCopDisableDirective, Metrics/LineLength
|
4
|
+
module OCI
|
5
|
+
# This class provides a wrapper around {OCI::Limits::QuotasClient} and offers convenience methods
|
6
|
+
# for operations that would otherwise need to be chained together. For example, instead of performing an action
|
7
|
+
# on a resource (e.g. launching an instance, creating a load balancer) and then using a waiter to wait for the resource
|
8
|
+
# to enter a given state, you can call a single method in this class to accomplish the same functionality
|
9
|
+
class Limits::QuotasClientCompositeOperations
|
10
|
+
# The {OCI::Limits::QuotasClient} used to communicate with the service_client
|
11
|
+
#
|
12
|
+
# @return [OCI::Limits::QuotasClient]
|
13
|
+
attr_reader :service_client
|
14
|
+
|
15
|
+
# Initializes a new QuotasClientCompositeOperations
|
16
|
+
#
|
17
|
+
# @param [OCI::Limits::QuotasClient] service_client The client used to communicate with the service.
|
18
|
+
# Defaults to a new service client created via {OCI::Limits::QuotasClient#initialize} with no arguments
|
19
|
+
def initialize(service_client = OCI::Limits::QuotasClient.new)
|
20
|
+
@service_client = service_client
|
21
|
+
end
|
22
|
+
|
23
|
+
# rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/ParameterLists, Metrics/PerceivedComplexity
|
24
|
+
# rubocop:disable Layout/EmptyLines
|
25
|
+
|
26
|
+
|
27
|
+
# Calls {OCI::Limits::QuotasClient#create_quota} and then waits for the {OCI::Limits::Models::Quota} acted upon
|
28
|
+
# to enter the given state(s).
|
29
|
+
#
|
30
|
+
# @param [OCI::Limits::Models::CreateQuotaDetails] create_quota_details Request object for creating a new quota.
|
31
|
+
# @param [Array<String>] wait_for_states An array of states to wait on. These should be valid values for {OCI::Limits::Models::Quota#lifecycle_state}
|
32
|
+
# @param [Hash] base_operation_opts Any optional arguments accepted by {OCI::Limits::QuotasClient#create_quota}
|
33
|
+
# @param [Hash] waiter_opts Optional arguments for the waiter. Keys should be symbols, and the following keys are supported:
|
34
|
+
# * max_interval_seconds: The maximum interval between queries, in seconds.
|
35
|
+
# * max_wait_seconds The maximum time to wait, in seconds
|
36
|
+
#
|
37
|
+
# @return [OCI::Response] A {OCI::Response} object with data of type {OCI::Limits::Models::Quota}
|
38
|
+
def create_quota_and_wait_for_state(create_quota_details, wait_for_states = [], base_operation_opts = {}, waiter_opts = {})
|
39
|
+
operation_result = @service_client.create_quota(create_quota_details, base_operation_opts)
|
40
|
+
|
41
|
+
return operation_result if wait_for_states.empty?
|
42
|
+
|
43
|
+
lowered_wait_for_states = wait_for_states.map(&:downcase)
|
44
|
+
wait_for_resource_id = operation_result.data.id
|
45
|
+
|
46
|
+
begin
|
47
|
+
waiter_result = @service_client.get_quota(wait_for_resource_id).wait_until(
|
48
|
+
eval_proc: ->(response) { response.data.respond_to?(:lifecycle_state) && lowered_wait_for_states.include?(response.data.lifecycle_state.downcase) },
|
49
|
+
max_interval_seconds: waiter_opts.key?(:max_interval_seconds) ? waiter_opts[:max_interval_seconds] : 30,
|
50
|
+
max_wait_seconds: waiter_opts.key?(:max_wait_seconds) ? waiter_opts[:max_wait_seconds] : 1200
|
51
|
+
)
|
52
|
+
result_to_return = waiter_result
|
53
|
+
|
54
|
+
return result_to_return
|
55
|
+
rescue StandardError
|
56
|
+
raise OCI::Errors::CompositeOperationError.new(partial_results: [operation_result])
|
57
|
+
end
|
58
|
+
end
|
59
|
+
# rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/ParameterLists, Metrics/PerceivedComplexity
|
60
|
+
# rubocop:enable Layout/EmptyLines
|
61
|
+
|
62
|
+
# rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/ParameterLists, Metrics/PerceivedComplexity
|
63
|
+
# rubocop:disable Layout/EmptyLines
|
64
|
+
|
65
|
+
|
66
|
+
# Calls {OCI::Limits::QuotasClient#delete_quota} and then waits for the {OCI::Limits::Models::Quota} acted upon
|
67
|
+
# to enter the given state(s).
|
68
|
+
#
|
69
|
+
# @param [String] quota_id The OCID of the quota.
|
70
|
+
# @param [Array<String>] wait_for_states An array of states to wait on. These should be valid values for {OCI::Limits::Models::Quota#lifecycle_state}
|
71
|
+
# @param [Hash] base_operation_opts Any optional arguments accepted by {OCI::Limits::QuotasClient#delete_quota}
|
72
|
+
# @param [Hash] waiter_opts Optional arguments for the waiter. Keys should be symbols, and the following keys are supported:
|
73
|
+
# * max_interval_seconds: The maximum interval between queries, in seconds.
|
74
|
+
# * max_wait_seconds The maximum time to wait, in seconds
|
75
|
+
#
|
76
|
+
# @return [OCI::Response] A {OCI::Response} object with data of type nil
|
77
|
+
def delete_quota_and_wait_for_state(quota_id, wait_for_states = [], base_operation_opts = {}, waiter_opts = {})
|
78
|
+
initial_get_result = @service_client.get_quota(quota_id)
|
79
|
+
operation_result = @service_client.delete_quota(quota_id, base_operation_opts)
|
80
|
+
|
81
|
+
return operation_result if wait_for_states.empty?
|
82
|
+
|
83
|
+
lowered_wait_for_states = wait_for_states.map(&:downcase)
|
84
|
+
|
85
|
+
begin
|
86
|
+
waiter_result = initial_get_result.wait_until(
|
87
|
+
eval_proc: ->(response) { response.data.respond_to?(:lifecycle_state) && lowered_wait_for_states.include?(response.data.lifecycle_state.downcase) },
|
88
|
+
max_interval_seconds: waiter_opts.key?(:max_interval_seconds) ? waiter_opts[:max_interval_seconds] : 30,
|
89
|
+
max_wait_seconds: waiter_opts.key?(:max_wait_seconds) ? waiter_opts[:max_wait_seconds] : 1200,
|
90
|
+
succeed_on_not_found: true
|
91
|
+
)
|
92
|
+
result_to_return = waiter_result
|
93
|
+
|
94
|
+
return result_to_return
|
95
|
+
rescue StandardError
|
96
|
+
raise OCI::Errors::CompositeOperationError.new(partial_results: [operation_result])
|
97
|
+
end
|
98
|
+
end
|
99
|
+
# rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/ParameterLists, Metrics/PerceivedComplexity
|
100
|
+
# rubocop:enable Layout/EmptyLines
|
101
|
+
|
102
|
+
# rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/ParameterLists, Metrics/PerceivedComplexity
|
103
|
+
# rubocop:disable Layout/EmptyLines
|
104
|
+
|
105
|
+
|
106
|
+
# Calls {OCI::Limits::QuotasClient#update_quota} and then waits for the {OCI::Limits::Models::Quota} acted upon
|
107
|
+
# to enter the given state(s).
|
108
|
+
#
|
109
|
+
# @param [String] quota_id The OCID of the quota.
|
110
|
+
# @param [OCI::Limits::Models::UpdateQuotaDetails] update_quota_details Request object for updating a quota.
|
111
|
+
# @param [Array<String>] wait_for_states An array of states to wait on. These should be valid values for {OCI::Limits::Models::Quota#lifecycle_state}
|
112
|
+
# @param [Hash] base_operation_opts Any optional arguments accepted by {OCI::Limits::QuotasClient#update_quota}
|
113
|
+
# @param [Hash] waiter_opts Optional arguments for the waiter. Keys should be symbols, and the following keys are supported:
|
114
|
+
# * max_interval_seconds: The maximum interval between queries, in seconds.
|
115
|
+
# * max_wait_seconds The maximum time to wait, in seconds
|
116
|
+
#
|
117
|
+
# @return [OCI::Response] A {OCI::Response} object with data of type {OCI::Limits::Models::Quota}
|
118
|
+
def update_quota_and_wait_for_state(quota_id, update_quota_details, wait_for_states = [], base_operation_opts = {}, waiter_opts = {})
|
119
|
+
operation_result = @service_client.update_quota(quota_id, update_quota_details, base_operation_opts)
|
120
|
+
|
121
|
+
return operation_result if wait_for_states.empty?
|
122
|
+
|
123
|
+
lowered_wait_for_states = wait_for_states.map(&:downcase)
|
124
|
+
wait_for_resource_id = operation_result.data.id
|
125
|
+
|
126
|
+
begin
|
127
|
+
waiter_result = @service_client.get_quota(wait_for_resource_id).wait_until(
|
128
|
+
eval_proc: ->(response) { response.data.respond_to?(:lifecycle_state) && lowered_wait_for_states.include?(response.data.lifecycle_state.downcase) },
|
129
|
+
max_interval_seconds: waiter_opts.key?(:max_interval_seconds) ? waiter_opts[:max_interval_seconds] : 30,
|
130
|
+
max_wait_seconds: waiter_opts.key?(:max_wait_seconds) ? waiter_opts[:max_wait_seconds] : 1200
|
131
|
+
)
|
132
|
+
result_to_return = waiter_result
|
133
|
+
|
134
|
+
return result_to_return
|
135
|
+
rescue StandardError
|
136
|
+
raise OCI::Errors::CompositeOperationError.new(partial_results: [operation_result])
|
137
|
+
end
|
138
|
+
end
|
139
|
+
# rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/ParameterLists, Metrics/PerceivedComplexity
|
140
|
+
# rubocop:enable Layout/EmptyLines
|
141
|
+
end
|
142
|
+
end
|
143
|
+
# rubocop:enable Lint/UnneededCopDisableDirective, Metrics/LineLength
|