oci 2.3.6 → 2.3.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (76) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +11 -10
  3. data/lib/oci.rb +1 -0
  4. data/lib/oci/api_client.rb +2 -2
  5. data/lib/oci/audit/audit_client.rb +11 -9
  6. data/lib/oci/base_signer.rb +13 -13
  7. data/lib/oci/container_engine/container_engine_client.rb +43 -39
  8. data/lib/oci/container_engine/models/node_error.rb +1 -1
  9. data/lib/oci/container_engine/models/work_request_error.rb +1 -1
  10. data/lib/oci/core/blockstorage_client.rb +421 -75
  11. data/lib/oci/core/compute_client.rb +77 -75
  12. data/lib/oci/core/compute_client_composite_operations.rb +40 -0
  13. data/lib/oci/core/core.rb +4 -0
  14. data/lib/oci/core/models/boot_volume.rb +18 -4
  15. data/lib/oci/core/models/boot_volume_kms_key.rb +152 -0
  16. data/lib/oci/core/models/create_boot_volume_details.rb +15 -1
  17. data/lib/oci/core/models/create_image_details.rb +2 -0
  18. data/lib/oci/core/models/create_volume_details.rb +15 -1
  19. data/lib/oci/core/models/fast_connect_provider_service.rb +1 -1
  20. data/lib/oci/core/models/image.rb +2 -0
  21. data/lib/oci/core/models/instance.rb +2 -0
  22. data/lib/oci/core/models/instance_source_via_image_details.rb +18 -4
  23. data/lib/oci/core/models/launch_options.rb +2 -0
  24. data/lib/oci/core/models/update_boot_volume_kms_key_details.rb +154 -0
  25. data/lib/oci/core/models/update_volume_kms_key_details.rb +154 -0
  26. data/lib/oci/core/models/volume.rb +15 -1
  27. data/lib/oci/core/models/volume_kms_key.rb +152 -0
  28. data/lib/oci/core/virtual_network_client.rb +233 -231
  29. data/lib/oci/core/virtual_network_client_composite_operations.rb +80 -0
  30. data/lib/oci/database/database_client.rb +123 -121
  31. data/lib/oci/database/database_client_composite_operations.rb +399 -0
  32. data/lib/oci/database/models/patch.rb +1 -1
  33. data/lib/oci/database/models/patch_summary.rb +1 -1
  34. data/lib/oci/dns/dns_client.rb +38 -36
  35. data/lib/oci/email/email_client.rb +21 -19
  36. data/lib/oci/email/models/sender.rb +1 -1
  37. data/lib/oci/email/models/suppression.rb +1 -1
  38. data/lib/oci/file_storage/file_storage_client.rb +49 -47
  39. data/lib/oci/identity/identity_client.rb +151 -149
  40. data/lib/oci/identity/identity_client_composite_operations.rb +40 -0
  41. data/lib/oci/key_management/key_management.rb +40 -0
  42. data/lib/oci/key_management/kms_crypto_client.rb +258 -0
  43. data/lib/oci/key_management/kms_crypto_client_composite_operations.rb +24 -0
  44. data/lib/oci/key_management/kms_management_client.rb +716 -0
  45. data/lib/oci/key_management/kms_management_client_composite_operations.rb +181 -0
  46. data/lib/oci/key_management/kms_vault_client.rb +533 -0
  47. data/lib/oci/key_management/kms_vault_client_composite_operations.rb +182 -0
  48. data/lib/oci/key_management/models/create_key_details.rb +180 -0
  49. data/lib/oci/key_management/models/create_vault_details.rb +194 -0
  50. data/lib/oci/key_management/models/decrypt_data_details.rb +177 -0
  51. data/lib/oci/key_management/models/decrypted_data.rb +160 -0
  52. data/lib/oci/key_management/models/encrypt_data_details.rb +177 -0
  53. data/lib/oci/key_management/models/encrypted_data.rb +146 -0
  54. data/lib/oci/key_management/models/generate_key_details.rb +195 -0
  55. data/lib/oci/key_management/models/generated_key.rb +177 -0
  56. data/lib/oci/key_management/models/key.rb +318 -0
  57. data/lib/oci/key_management/models/key_shape.rb +178 -0
  58. data/lib/oci/key_management/models/key_summary.rb +287 -0
  59. data/lib/oci/key_management/models/key_version.rb +205 -0
  60. data/lib/oci/key_management/models/key_version_summary.rb +205 -0
  61. data/lib/oci/key_management/models/schedule_vault_deletion_details.rb +153 -0
  62. data/lib/oci/key_management/models/update_key_details.rb +152 -0
  63. data/lib/oci/key_management/models/update_vault_details.rb +152 -0
  64. data/lib/oci/key_management/models/vault.rb +350 -0
  65. data/lib/oci/key_management/models/vault_summary.rb +334 -0
  66. data/lib/oci/key_management/util.rb +2 -0
  67. data/lib/oci/load_balancer/load_balancer_client.rb +89 -87
  68. data/lib/oci/object_storage/models/bucket.rb +18 -4
  69. data/lib/oci/object_storage/models/create_bucket_details.rb +18 -4
  70. data/lib/oci/object_storage/models/multipart_upload.rb +1 -1
  71. data/lib/oci/object_storage/models/preauthenticated_request.rb +1 -1
  72. data/lib/oci/object_storage/models/update_bucket_details.rb +22 -4
  73. data/lib/oci/object_storage/object_storage_client.rb +63 -58
  74. data/lib/oci/resource_search/resource_search_client.rb +11 -9
  75. data/lib/oci/version.rb +1 -1
  76. metadata +32 -2
@@ -0,0 +1,181 @@
1
+ # Copyright (c) 2016, 2018, 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::KeyManagement::KmsManagementClient} 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 KeyManagement::KmsManagementClientCompositeOperations
10
+ # The {OCI::KeyManagement::KmsManagementClient} used to communicate with the service_client
11
+ #
12
+ # @return [OCI::KeyManagement::KmsManagementClient]
13
+ attr_reader :service_client
14
+
15
+ # Initializes a new KmsManagementClientCompositeOperations
16
+ #
17
+ # @param [OCI::KeyManagement::KmsManagementClient] service_client The client used to communicate with the service.
18
+ # Defaults to a new service client created via {OCI::KeyManagement::KmsManagementClient#initialize} with no arguments
19
+ def initialize(service_client = OCI::KeyManagement::KmsManagementClient.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::KeyManagement::KmsManagementClient#create_key} and then waits for the {OCI::KeyManagement::Models::Key} acted upon
28
+ # to enter the given state(s).
29
+ #
30
+ # @param [OCI::KeyManagement::Models::CreateKeyDetails] create_key_details CreateKeyDetails
31
+ # @param [Array<String>] wait_for_states An array of states to wait on. These should be valid values for {OCI::KeyManagement::Models::Key#lifecycle_state}
32
+ # @param [Hash] base_operation_opts Any optional arguments accepted by {OCI::KeyManagement::KmsManagementClient#create_key}
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::KeyManagement::Models::Key}
38
+ def create_key_and_wait_for_state(create_key_details, wait_for_states = [], base_operation_opts = {}, waiter_opts = {})
39
+ operation_result = @service_client.create_key(create_key_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_key(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::KeyManagement::KmsManagementClient#disable_key} and then waits for the {OCI::KeyManagement::Models::Key} acted upon
67
+ # to enter the given state(s).
68
+ #
69
+ # @param [String] key_id The OCID of the key.
70
+ # @param [Array<String>] wait_for_states An array of states to wait on. These should be valid values for {OCI::KeyManagement::Models::Key#lifecycle_state}
71
+ # @param [Hash] base_operation_opts Any optional arguments accepted by {OCI::KeyManagement::KmsManagementClient#disable_key}
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 {OCI::KeyManagement::Models::Key}
77
+ def disable_key_and_wait_for_state(key_id, wait_for_states = [], base_operation_opts = {}, waiter_opts = {})
78
+ operation_result = @service_client.disable_key(key_id, base_operation_opts)
79
+
80
+ return operation_result if wait_for_states.empty?
81
+
82
+ lowered_wait_for_states = wait_for_states.map(&:downcase)
83
+ wait_for_resource_id = operation_result.data.id
84
+
85
+ begin
86
+ waiter_result = @service_client.get_key(wait_for_resource_id).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
+ )
91
+ result_to_return = waiter_result
92
+
93
+ return result_to_return
94
+ rescue StandardError
95
+ raise OCI::Errors::CompositeOperationError.new(partial_results: [operation_result])
96
+ end
97
+ end
98
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/ParameterLists, Metrics/PerceivedComplexity
99
+ # rubocop:enable Layout/EmptyLines
100
+
101
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/ParameterLists, Metrics/PerceivedComplexity
102
+ # rubocop:disable Layout/EmptyLines
103
+
104
+
105
+ # Calls {OCI::KeyManagement::KmsManagementClient#enable_key} and then waits for the {OCI::KeyManagement::Models::Key} acted upon
106
+ # to enter the given state(s).
107
+ #
108
+ # @param [String] key_id The OCID of the key.
109
+ # @param [Array<String>] wait_for_states An array of states to wait on. These should be valid values for {OCI::KeyManagement::Models::Key#lifecycle_state}
110
+ # @param [Hash] base_operation_opts Any optional arguments accepted by {OCI::KeyManagement::KmsManagementClient#enable_key}
111
+ # @param [Hash] waiter_opts Optional arguments for the waiter. Keys should be symbols, and the following keys are supported:
112
+ # * max_interval_seconds: The maximum interval between queries, in seconds.
113
+ # * max_wait_seconds The maximum time to wait, in seconds
114
+ #
115
+ # @return [OCI::Response] A {OCI::Response} object with data of type {OCI::KeyManagement::Models::Key}
116
+ def enable_key_and_wait_for_state(key_id, wait_for_states = [], base_operation_opts = {}, waiter_opts = {})
117
+ operation_result = @service_client.enable_key(key_id, base_operation_opts)
118
+
119
+ return operation_result if wait_for_states.empty?
120
+
121
+ lowered_wait_for_states = wait_for_states.map(&:downcase)
122
+ wait_for_resource_id = operation_result.data.id
123
+
124
+ begin
125
+ waiter_result = @service_client.get_key(wait_for_resource_id).wait_until(
126
+ eval_proc: ->(response) { response.data.respond_to?(:lifecycle_state) && lowered_wait_for_states.include?(response.data.lifecycle_state.downcase) },
127
+ max_interval_seconds: waiter_opts.key?(:max_interval_seconds) ? waiter_opts[:max_interval_seconds] : 30,
128
+ max_wait_seconds: waiter_opts.key?(:max_wait_seconds) ? waiter_opts[:max_wait_seconds] : 1200
129
+ )
130
+ result_to_return = waiter_result
131
+
132
+ return result_to_return
133
+ rescue StandardError
134
+ raise OCI::Errors::CompositeOperationError.new(partial_results: [operation_result])
135
+ end
136
+ end
137
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/ParameterLists, Metrics/PerceivedComplexity
138
+ # rubocop:enable Layout/EmptyLines
139
+
140
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/ParameterLists, Metrics/PerceivedComplexity
141
+ # rubocop:disable Layout/EmptyLines
142
+
143
+
144
+ # Calls {OCI::KeyManagement::KmsManagementClient#update_key} and then waits for the {OCI::KeyManagement::Models::Key} acted upon
145
+ # to enter the given state(s).
146
+ #
147
+ # @param [String] key_id The OCID of the key.
148
+ # @param [OCI::KeyManagement::Models::UpdateKeyDetails] update_key_details UpdateKeyDetails
149
+ # @param [Array<String>] wait_for_states An array of states to wait on. These should be valid values for {OCI::KeyManagement::Models::Key#lifecycle_state}
150
+ # @param [Hash] base_operation_opts Any optional arguments accepted by {OCI::KeyManagement::KmsManagementClient#update_key}
151
+ # @param [Hash] waiter_opts Optional arguments for the waiter. Keys should be symbols, and the following keys are supported:
152
+ # * max_interval_seconds: The maximum interval between queries, in seconds.
153
+ # * max_wait_seconds The maximum time to wait, in seconds
154
+ #
155
+ # @return [OCI::Response] A {OCI::Response} object with data of type {OCI::KeyManagement::Models::Key}
156
+ def update_key_and_wait_for_state(key_id, update_key_details, wait_for_states = [], base_operation_opts = {}, waiter_opts = {})
157
+ operation_result = @service_client.update_key(key_id, update_key_details, base_operation_opts)
158
+
159
+ return operation_result if wait_for_states.empty?
160
+
161
+ lowered_wait_for_states = wait_for_states.map(&:downcase)
162
+ wait_for_resource_id = operation_result.data.id
163
+
164
+ begin
165
+ waiter_result = @service_client.get_key(wait_for_resource_id).wait_until(
166
+ eval_proc: ->(response) { response.data.respond_to?(:lifecycle_state) && lowered_wait_for_states.include?(response.data.lifecycle_state.downcase) },
167
+ max_interval_seconds: waiter_opts.key?(:max_interval_seconds) ? waiter_opts[:max_interval_seconds] : 30,
168
+ max_wait_seconds: waiter_opts.key?(:max_wait_seconds) ? waiter_opts[:max_wait_seconds] : 1200
169
+ )
170
+ result_to_return = waiter_result
171
+
172
+ return result_to_return
173
+ rescue StandardError
174
+ raise OCI::Errors::CompositeOperationError.new(partial_results: [operation_result])
175
+ end
176
+ end
177
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/ParameterLists, Metrics/PerceivedComplexity
178
+ # rubocop:enable Layout/EmptyLines
179
+ end
180
+ end
181
+ # rubocop:enable Lint/UnneededCopDisableDirective, Metrics/LineLength
@@ -0,0 +1,533 @@
1
+ # Copyright (c) 2016, 2018, 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
+ # API for managing and performing operations with keys and vaults.
9
+ class KeyManagement::KmsVaultClient
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
29
+
30
+
31
+ # Creates a new KmsVaultClient.
32
+ # Notes:
33
+ # If a config is not specified, then the global OCI.config will be used.
34
+ # This client is not thread-safe
35
+ #
36
+ # A region must be specified in either the config or the region parameter. If specified in both,
37
+ # then the region parameter will be used.
38
+ #
39
+ # @param [Config] config A Config object.
40
+ # @param [String] region A region used to determine the service endpoint. This will usually
41
+ # correspond to a value in {OCI::Regions::REGION_ENUM}, but may be an arbitrary string.
42
+ # @param [OCI::BaseSigner] signer A signer implementation which can be used by this client. If this is not provided then
43
+ # a signer will be constructed via the provided config. One use case of this parameter is instance principals authentication,
44
+ # so that the instance principals signer can be provided to the client
45
+ # @param [OCI::ApiClientProxySettings] proxy_settings If your environment requires you to use a proxy server for outgoing HTTP requests
46
+ # the details for the proxy can be provided in this parameter
47
+ # @param [OCI::Retry::RetryConfig] retry_config The retry configuration for this service client. This represents the default retry configuration to
48
+ # 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
49
+ # will not perform any retries
50
+ def initialize(config: nil, region: nil, signer: nil, proxy_settings: nil, retry_config: nil)
51
+ # If the signer is an InstancePrincipalsSecurityTokenSigner and no config was supplied (which is valid for instance principals)
52
+ # then create a dummy config to pass to the ApiClient constructor. If customers wish to create a client which uses instance principals
53
+ # and has config (either populated programmatically or loaded from a file), they must construct that config themselves and then
54
+ # pass it to this constructor.
55
+ #
56
+ # If there is no signer (or the signer is not an instance principals signer) and no config was supplied, this is not valid
57
+ # so try and load the config from the default file.
58
+ config ||= OCI.config unless signer.is_a?(OCI::Auth::Signers::InstancePrincipalsSecurityTokenSigner)
59
+ config ||= OCI::Config.new if signer.is_a?(OCI::Auth::Signers::InstancePrincipalsSecurityTokenSigner)
60
+ config.validate unless signer.is_a?(OCI::Auth::Signers::InstancePrincipalsSecurityTokenSigner)
61
+
62
+ if signer.nil?
63
+ signer = OCI::Signer.new(
64
+ config.user,
65
+ config.fingerprint,
66
+ config.tenancy,
67
+ config.key_file,
68
+ pass_phrase: config.pass_phrase,
69
+ private_key_content: config.key_content
70
+ )
71
+ end
72
+
73
+ @api_client = OCI::ApiClient.new(config, signer, proxy_settings: proxy_settings)
74
+ @retry_config = retry_config
75
+
76
+ region ||= config.region
77
+ region ||= signer.region if signer.respond_to?(:region)
78
+ self.region = region
79
+ end
80
+ # rubocop:enable Metrics/AbcSize, Metrics/CyclomaticComplexity, Layout/EmptyLines
81
+
82
+ # Set the region that will be used to determine the service endpoint.
83
+ # This will usually correspond to a value in {OCI::Regions::REGION_ENUM},
84
+ # but may be an arbitrary string.
85
+ def region=(new_region)
86
+ @region = new_region
87
+
88
+ raise 'A region must be specified.' unless @region
89
+
90
+ @endpoint = OCI::Regions.get_service_endpoint(@region, :KmsVaultClient) + '/20180608'
91
+ logger.info "KmsVaultClient endpoint set to '#{endpoint}'." if logger
92
+ end
93
+
94
+ # @return [Logger] The logger for this client. May be nil.
95
+ def logger
96
+ @api_client.config.logger
97
+ end
98
+
99
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
100
+ # rubocop:disable Style/IfUnlessModifier, Metrics/ParameterLists
101
+ # rubocop:disable Metrics/MethodLength, Layout/EmptyLines
102
+
103
+
104
+ # Cancels the scheduled deletion of the specified Vault, which must be in PendingDeletion
105
+ # state. The Vault and all Keys in it will be moved back to their previous states before
106
+ # the deletion was scheduled.
107
+ #
108
+ # @param [String] vault_id The OCID of the vault.
109
+ # @param [Hash] opts the optional parameters
110
+ # @option opts [OCI::Retry::RetryConfig] :retry_config The retry configuration to apply to this operation. If no key is provided then the service-level
111
+ # retry configuration defined by {#retry_config} will be used. If an explicit `nil` value is provided then the operation will not retry
112
+ # @option opts [String] :if_match For optimistic concurrency control. In the PUT or DELETE call for a
113
+ # resource, set the `if-match` parameter to the value of the etag from a
114
+ # previous GET or POST response for that resource. The resource will be
115
+ # updated or deleted only if the etag you provide matches the resource's
116
+ # current etag value.
117
+ #
118
+ # @option opts [String] :opc_request_id Unique identifier for the request. If provided, the returned request ID
119
+ # will include this value. Otherwise, a random request ID will be
120
+ # generated by the service.
121
+ #
122
+ # @option opts [String] :opc_retry_token A token that uniquely identifies a request so it can be retried in case
123
+ # of a timeout or server error without risk of executing that same action
124
+ # again. Retry tokens expire after 24 hours, but can be invalidated
125
+ # before then due to conflicting operations (e.g., if a resource has been
126
+ # deleted and purged from the system, then a retry of the original
127
+ # creation request may be rejected).
128
+ #
129
+ # @return [Response] A Response object with data of type {OCI::KeyManagement::Models::Vault Vault}
130
+ def cancel_vault_deletion(vault_id, opts = {})
131
+ logger.debug 'Calling operation KmsVaultClient#cancel_vault_deletion.' if logger
132
+
133
+ raise "Missing the required parameter 'vault_id' when calling cancel_vault_deletion." if vault_id.nil?
134
+ raise "Parameter value for 'vault_id' must not be blank" if OCI::Internal::Util.blank_string?(vault_id)
135
+
136
+ path = '/vaults/{vaultId}/actions/cancelDeletion'.sub('{vaultId}', vault_id.to_s)
137
+ operation_signing_strategy = :standard
138
+
139
+ # rubocop:disable Style/NegatedIf
140
+ # Query Params
141
+ query_params = {}
142
+
143
+ # Header Params
144
+ header_params = {}
145
+ header_params[:accept] = 'application/json'
146
+ header_params[:'content-type'] = 'application/json'
147
+ header_params[:'if-match'] = opts[:if_match] if opts[:if_match]
148
+ header_params[:'opc-request-id'] = opts[:opc_request_id] if opts[:opc_request_id]
149
+ header_params[:'opc-retry-token'] = opts[:opc_retry_token] if opts[:opc_retry_token]
150
+ # rubocop:enable Style/NegatedIf
151
+ header_params[:'opc-retry-token'] ||= OCI::Retry.generate_opc_retry_token
152
+
153
+ post_body = nil
154
+
155
+ # rubocop:disable Metrics/BlockLength
156
+ OCI::Retry.make_retrying_call(applicable_retry_config(opts), call_name: 'KmsVaultClient#cancel_vault_deletion') do
157
+ @api_client.call_api(
158
+ :POST,
159
+ path,
160
+ endpoint,
161
+ header_params: header_params,
162
+ query_params: query_params,
163
+ operation_signing_strategy: operation_signing_strategy,
164
+ body: post_body,
165
+ return_type: 'OCI::KeyManagement::Models::Vault'
166
+ )
167
+ end
168
+ # rubocop:enable Metrics/BlockLength
169
+ end
170
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
171
+ # rubocop:enable Style/IfUnlessModifier, Metrics/ParameterLists
172
+ # rubocop:enable Metrics/MethodLength, Layout/EmptyLines
173
+
174
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
175
+ # rubocop:disable Style/IfUnlessModifier, Metrics/ParameterLists
176
+ # rubocop:disable Metrics/MethodLength, Layout/EmptyLines
177
+
178
+
179
+ # Creates a new vault. The type of vault you create determines key
180
+ # placement, pricing, and available options. Options include storage
181
+ # isolation, a dedicated service endpoint instead of a shared service
182
+ # endpoint for API calls, and a dedicated HSM or a multitenant HSM.
183
+ #
184
+ # @param [OCI::KeyManagement::Models::CreateVaultDetails] create_vault_details CreateVaultDetails
185
+ # @param [Hash] opts the optional parameters
186
+ # @option opts [OCI::Retry::RetryConfig] :retry_config The retry configuration to apply to this operation. If no key is provided then the service-level
187
+ # retry configuration defined by {#retry_config} will be used. If an explicit `nil` value is provided then the operation will not retry
188
+ # @option opts [String] :opc_request_id Unique identifier for the request. If provided, the returned request ID
189
+ # will include this value. Otherwise, a random request ID will be
190
+ # generated by the service.
191
+ #
192
+ # @option opts [String] :opc_retry_token A token that uniquely identifies a request so it can be retried in case
193
+ # of a timeout or server error without risk of executing that same action
194
+ # again. Retry tokens expire after 24 hours, but can be invalidated
195
+ # before then due to conflicting operations (e.g., if a resource has been
196
+ # deleted and purged from the system, then a retry of the original
197
+ # creation request may be rejected).
198
+ #
199
+ # @return [Response] A Response object with data of type {OCI::KeyManagement::Models::Vault Vault}
200
+ def create_vault(create_vault_details, opts = {})
201
+ logger.debug 'Calling operation KmsVaultClient#create_vault.' if logger
202
+
203
+ raise "Missing the required parameter 'create_vault_details' when calling create_vault." if create_vault_details.nil?
204
+
205
+ path = '/vaults'
206
+ operation_signing_strategy = :standard
207
+
208
+ # rubocop:disable Style/NegatedIf
209
+ # Query Params
210
+ query_params = {}
211
+
212
+ # Header Params
213
+ header_params = {}
214
+ header_params[:accept] = 'application/json'
215
+ header_params[:'content-type'] = 'application/json'
216
+ header_params[:'opc-request-id'] = opts[:opc_request_id] if opts[:opc_request_id]
217
+ header_params[:'opc-retry-token'] = opts[:opc_retry_token] if opts[:opc_retry_token]
218
+ # rubocop:enable Style/NegatedIf
219
+ header_params[:'opc-retry-token'] ||= OCI::Retry.generate_opc_retry_token
220
+
221
+ post_body = @api_client.object_to_http_body(create_vault_details)
222
+
223
+ # rubocop:disable Metrics/BlockLength
224
+ OCI::Retry.make_retrying_call(applicable_retry_config(opts), call_name: 'KmsVaultClient#create_vault') do
225
+ @api_client.call_api(
226
+ :POST,
227
+ path,
228
+ endpoint,
229
+ header_params: header_params,
230
+ query_params: query_params,
231
+ operation_signing_strategy: operation_signing_strategy,
232
+ body: post_body,
233
+ return_type: 'OCI::KeyManagement::Models::Vault'
234
+ )
235
+ end
236
+ # rubocop:enable Metrics/BlockLength
237
+ end
238
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
239
+ # rubocop:enable Style/IfUnlessModifier, Metrics/ParameterLists
240
+ # rubocop:enable Metrics/MethodLength, Layout/EmptyLines
241
+
242
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
243
+ # rubocop:disable Style/IfUnlessModifier, Metrics/ParameterLists
244
+ # rubocop:disable Metrics/MethodLength, Layout/EmptyLines
245
+
246
+
247
+ # Gets the specified vault's configuration information.
248
+ #
249
+ # @param [String] vault_id The OCID of the vault.
250
+ # @param [Hash] opts the optional parameters
251
+ # @option opts [OCI::Retry::RetryConfig] :retry_config The retry configuration to apply to this operation. If no key is provided then the service-level
252
+ # retry configuration defined by {#retry_config} will be used. If an explicit `nil` value is provided then the operation will not retry
253
+ # @option opts [String] :opc_request_id Unique identifier for the request. If provided, the returned request ID
254
+ # will include this value. Otherwise, a random request ID will be
255
+ # generated by the service.
256
+ #
257
+ # @return [Response] A Response object with data of type {OCI::KeyManagement::Models::Vault Vault}
258
+ def get_vault(vault_id, opts = {})
259
+ logger.debug 'Calling operation KmsVaultClient#get_vault.' if logger
260
+
261
+ raise "Missing the required parameter 'vault_id' when calling get_vault." if vault_id.nil?
262
+ raise "Parameter value for 'vault_id' must not be blank" if OCI::Internal::Util.blank_string?(vault_id)
263
+
264
+ path = '/vaults/{vaultId}'.sub('{vaultId}', vault_id.to_s)
265
+ operation_signing_strategy = :standard
266
+
267
+ # rubocop:disable Style/NegatedIf
268
+ # Query Params
269
+ query_params = {}
270
+
271
+ # Header Params
272
+ header_params = {}
273
+ header_params[:accept] = 'application/json'
274
+ header_params[:'content-type'] = 'application/json'
275
+ header_params[:'opc-request-id'] = opts[:opc_request_id] if opts[:opc_request_id]
276
+ # rubocop:enable Style/NegatedIf
277
+
278
+ post_body = nil
279
+
280
+ # rubocop:disable Metrics/BlockLength
281
+ OCI::Retry.make_retrying_call(applicable_retry_config(opts), call_name: 'KmsVaultClient#get_vault') do
282
+ @api_client.call_api(
283
+ :GET,
284
+ path,
285
+ endpoint,
286
+ header_params: header_params,
287
+ query_params: query_params,
288
+ operation_signing_strategy: operation_signing_strategy,
289
+ body: post_body,
290
+ return_type: 'OCI::KeyManagement::Models::Vault'
291
+ )
292
+ end
293
+ # rubocop:enable Metrics/BlockLength
294
+ end
295
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
296
+ # rubocop:enable Style/IfUnlessModifier, Metrics/ParameterLists
297
+ # rubocop:enable Metrics/MethodLength, Layout/EmptyLines
298
+
299
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
300
+ # rubocop:disable Style/IfUnlessModifier, Metrics/ParameterLists
301
+ # rubocop:disable Metrics/MethodLength, Layout/EmptyLines
302
+
303
+
304
+ # Lists vaults in the specified compartment.
305
+ #
306
+ # @param [String] compartment_id The OCID of the compartment.
307
+ # @param [Hash] opts the optional parameters
308
+ # @option opts [OCI::Retry::RetryConfig] :retry_config The retry configuration to apply to this operation. If no key is provided then the service-level
309
+ # retry configuration defined by {#retry_config} will be used. If an explicit `nil` value is provided then the operation will not retry
310
+ # @option opts [Integer] :limit The maximum number of items to return in a paginated \"List\" call.
311
+ #
312
+ # @option opts [String] :page The value of the `opc-next-page` response header
313
+ # from the previous \"List\" call.
314
+ #
315
+ # @option opts [String] :opc_request_id Unique identifier for the request. If provided, the returned request ID
316
+ # will include this value. Otherwise, a random request ID will be
317
+ # generated by the service.
318
+ #
319
+ # @option opts [String] :sort_by The field to sort by. You can specify only one sort order. The default
320
+ # order for TIMECREATED is descending. The default order for DISPLAYNAME
321
+ # is ascending.
322
+ #
323
+ # Allowed values are: TIMECREATED, DISPLAYNAME
324
+ # @option opts [String] :sort_order The sort order to use, either ascending (`ASC`) or descending (`DESC`).
325
+ #
326
+ # Allowed values are: ASC, DESC
327
+ # @return [Response] A Response object with data of type Array<{OCI::KeyManagement::Models::VaultSummary VaultSummary}>
328
+ def list_vaults(compartment_id, opts = {})
329
+ logger.debug 'Calling operation KmsVaultClient#list_vaults.' if logger
330
+
331
+ raise "Missing the required parameter 'compartment_id' when calling list_vaults." if compartment_id.nil?
332
+
333
+ if opts[:sort_by] && !%w[TIMECREATED DISPLAYNAME].include?(opts[:sort_by])
334
+ raise 'Invalid value for "sort_by", must be one of TIMECREATED, DISPLAYNAME.'
335
+ end
336
+
337
+ if opts[:sort_order] && !%w[ASC DESC].include?(opts[:sort_order])
338
+ raise 'Invalid value for "sort_order", must be one of ASC, DESC.'
339
+ end
340
+
341
+ path = '/vaults'
342
+ operation_signing_strategy = :standard
343
+
344
+ # rubocop:disable Style/NegatedIf
345
+ # Query Params
346
+ query_params = {}
347
+ query_params[:compartmentId] = compartment_id
348
+ query_params[:limit] = opts[:limit] if opts[:limit]
349
+ query_params[:page] = opts[:page] if opts[:page]
350
+ query_params[:sortBy] = opts[:sort_by] if opts[:sort_by]
351
+ query_params[:sortOrder] = opts[:sort_order] if opts[:sort_order]
352
+
353
+ # Header Params
354
+ header_params = {}
355
+ header_params[:accept] = 'application/json'
356
+ header_params[:'content-type'] = 'application/json'
357
+ header_params[:'opc-request-id'] = opts[:opc_request_id] if opts[:opc_request_id]
358
+ # rubocop:enable Style/NegatedIf
359
+
360
+ post_body = nil
361
+
362
+ # rubocop:disable Metrics/BlockLength
363
+ OCI::Retry.make_retrying_call(applicable_retry_config(opts), call_name: 'KmsVaultClient#list_vaults') do
364
+ @api_client.call_api(
365
+ :GET,
366
+ path,
367
+ endpoint,
368
+ header_params: header_params,
369
+ query_params: query_params,
370
+ operation_signing_strategy: operation_signing_strategy,
371
+ body: post_body,
372
+ return_type: 'Array<OCI::KeyManagement::Models::VaultSummary>'
373
+ )
374
+ end
375
+ # rubocop:enable Metrics/BlockLength
376
+ end
377
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
378
+ # rubocop:enable Style/IfUnlessModifier, Metrics/ParameterLists
379
+ # rubocop:enable Metrics/MethodLength, Layout/EmptyLines
380
+
381
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
382
+ # rubocop:disable Style/IfUnlessModifier, Metrics/ParameterLists
383
+ # rubocop:disable Metrics/MethodLength, Layout/EmptyLines
384
+
385
+
386
+ # Schedules the deletion of the specified Vault. The Vault and all Keys in it
387
+ # will be moved to PendingDeletion state and deleted after the retention period.
388
+ #
389
+ # @param [String] vault_id The OCID of the vault.
390
+ # @param [OCI::KeyManagement::Models::ScheduleVaultDeletionDetails] schedule_vault_deletion_details ScheduleVaultDeletionDetails
391
+ # @param [Hash] opts the optional parameters
392
+ # @option opts [OCI::Retry::RetryConfig] :retry_config The retry configuration to apply to this operation. If no key is provided then the service-level
393
+ # retry configuration defined by {#retry_config} will be used. If an explicit `nil` value is provided then the operation will not retry
394
+ # @option opts [String] :if_match For optimistic concurrency control. In the PUT or DELETE call for a
395
+ # resource, set the `if-match` parameter to the value of the etag from a
396
+ # previous GET or POST response for that resource. The resource will be
397
+ # updated or deleted only if the etag you provide matches the resource's
398
+ # current etag value.
399
+ #
400
+ # @option opts [String] :opc_request_id Unique identifier for the request. If provided, the returned request ID
401
+ # will include this value. Otherwise, a random request ID will be
402
+ # generated by the service.
403
+ #
404
+ # @option opts [String] :opc_retry_token A token that uniquely identifies a request so it can be retried in case
405
+ # of a timeout or server error without risk of executing that same action
406
+ # again. Retry tokens expire after 24 hours, but can be invalidated
407
+ # before then due to conflicting operations (e.g., if a resource has been
408
+ # deleted and purged from the system, then a retry of the original
409
+ # creation request may be rejected).
410
+ #
411
+ # @return [Response] A Response object with data of type {OCI::KeyManagement::Models::Vault Vault}
412
+ def schedule_vault_deletion(vault_id, schedule_vault_deletion_details, opts = {})
413
+ logger.debug 'Calling operation KmsVaultClient#schedule_vault_deletion.' if logger
414
+
415
+ raise "Missing the required parameter 'vault_id' when calling schedule_vault_deletion." if vault_id.nil?
416
+ raise "Missing the required parameter 'schedule_vault_deletion_details' when calling schedule_vault_deletion." if schedule_vault_deletion_details.nil?
417
+ raise "Parameter value for 'vault_id' must not be blank" if OCI::Internal::Util.blank_string?(vault_id)
418
+
419
+ path = '/vaults/{vaultId}/actions/scheduleDeletion'.sub('{vaultId}', vault_id.to_s)
420
+ operation_signing_strategy = :standard
421
+
422
+ # rubocop:disable Style/NegatedIf
423
+ # Query Params
424
+ query_params = {}
425
+
426
+ # Header Params
427
+ header_params = {}
428
+ header_params[:accept] = 'application/json'
429
+ header_params[:'content-type'] = 'application/json'
430
+ header_params[:'if-match'] = opts[:if_match] if opts[:if_match]
431
+ header_params[:'opc-request-id'] = opts[:opc_request_id] if opts[:opc_request_id]
432
+ header_params[:'opc-retry-token'] = opts[:opc_retry_token] if opts[:opc_retry_token]
433
+ # rubocop:enable Style/NegatedIf
434
+ header_params[:'opc-retry-token'] ||= OCI::Retry.generate_opc_retry_token
435
+
436
+ post_body = @api_client.object_to_http_body(schedule_vault_deletion_details)
437
+
438
+ # rubocop:disable Metrics/BlockLength
439
+ OCI::Retry.make_retrying_call(applicable_retry_config(opts), call_name: 'KmsVaultClient#schedule_vault_deletion') do
440
+ @api_client.call_api(
441
+ :POST,
442
+ path,
443
+ endpoint,
444
+ header_params: header_params,
445
+ query_params: query_params,
446
+ operation_signing_strategy: operation_signing_strategy,
447
+ body: post_body,
448
+ return_type: 'OCI::KeyManagement::Models::Vault'
449
+ )
450
+ end
451
+ # rubocop:enable Metrics/BlockLength
452
+ end
453
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
454
+ # rubocop:enable Style/IfUnlessModifier, Metrics/ParameterLists
455
+ # rubocop:enable Metrics/MethodLength, Layout/EmptyLines
456
+
457
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
458
+ # rubocop:disable Style/IfUnlessModifier, Metrics/ParameterLists
459
+ # rubocop:disable Metrics/MethodLength, Layout/EmptyLines
460
+
461
+
462
+ # Updates the properties of a vault. Specifically, you can
463
+ # only update the `displayName` property. Furthermore, the vault
464
+ # must be in an `ACTIVE` or `CREATING` state.
465
+ #
466
+ # @param [String] vault_id The OCID of the vault.
467
+ # @param [OCI::KeyManagement::Models::UpdateVaultDetails] update_vault_details UpdateVaultDetails
468
+ # @param [Hash] opts the optional parameters
469
+ # @option opts [OCI::Retry::RetryConfig] :retry_config The retry configuration to apply to this operation. If no key is provided then the service-level
470
+ # retry configuration defined by {#retry_config} will be used. If an explicit `nil` value is provided then the operation will not retry
471
+ # @option opts [String] :if_match For optimistic concurrency control. In the PUT or DELETE call for a
472
+ # resource, set the `if-match` parameter to the value of the etag from a
473
+ # previous GET or POST response for that resource. The resource will be
474
+ # updated or deleted only if the etag you provide matches the resource's
475
+ # current etag value.
476
+ #
477
+ # @option opts [String] :opc_request_id Unique identifier for the request. If provided, the returned request ID
478
+ # will include this value. Otherwise, a random request ID will be
479
+ # generated by the service.
480
+ #
481
+ # @return [Response] A Response object with data of type {OCI::KeyManagement::Models::Vault Vault}
482
+ def update_vault(vault_id, update_vault_details, opts = {})
483
+ logger.debug 'Calling operation KmsVaultClient#update_vault.' if logger
484
+
485
+ raise "Missing the required parameter 'vault_id' when calling update_vault." if vault_id.nil?
486
+ raise "Missing the required parameter 'update_vault_details' when calling update_vault." if update_vault_details.nil?
487
+ raise "Parameter value for 'vault_id' must not be blank" if OCI::Internal::Util.blank_string?(vault_id)
488
+
489
+ path = '/vaults/{vaultId}'.sub('{vaultId}', vault_id.to_s)
490
+ operation_signing_strategy = :standard
491
+
492
+ # rubocop:disable Style/NegatedIf
493
+ # Query Params
494
+ query_params = {}
495
+
496
+ # Header Params
497
+ header_params = {}
498
+ header_params[:accept] = 'application/json'
499
+ header_params[:'content-type'] = 'application/json'
500
+ header_params[:'if-match'] = opts[:if_match] if opts[:if_match]
501
+ header_params[:'opc-request-id'] = opts[:opc_request_id] if opts[:opc_request_id]
502
+ # rubocop:enable Style/NegatedIf
503
+
504
+ post_body = @api_client.object_to_http_body(update_vault_details)
505
+
506
+ # rubocop:disable Metrics/BlockLength
507
+ OCI::Retry.make_retrying_call(applicable_retry_config(opts), call_name: 'KmsVaultClient#update_vault') do
508
+ @api_client.call_api(
509
+ :PUT,
510
+ path,
511
+ endpoint,
512
+ header_params: header_params,
513
+ query_params: query_params,
514
+ operation_signing_strategy: operation_signing_strategy,
515
+ body: post_body,
516
+ return_type: 'OCI::KeyManagement::Models::Vault'
517
+ )
518
+ end
519
+ # rubocop:enable Metrics/BlockLength
520
+ end
521
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
522
+ # rubocop:enable Style/IfUnlessModifier, Metrics/ParameterLists
523
+ # rubocop:enable Metrics/MethodLength, Layout/EmptyLines
524
+
525
+ private
526
+
527
+ def applicable_retry_config(opts = {})
528
+ return @retry_config unless opts.key?(:retry_config)
529
+ opts[:retry_config]
530
+ end
531
+ end
532
+ end
533
+ # rubocop:enable Lint/UnneededCopDisableDirective, Metrics/LineLength