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
@@ -813,6 +813,46 @@ module OCI
813
813
  end
814
814
  # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/ParameterLists, Metrics/PerceivedComplexity
815
815
  # rubocop:enable Layout/EmptyLines
816
+
817
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/ParameterLists, Metrics/PerceivedComplexity
818
+ # rubocop:disable Layout/EmptyLines
819
+
820
+
821
+ # Calls {OCI::Identity::IdentityClient#update_user_state} and then waits for the {OCI::Identity::Models::User} acted upon
822
+ # to enter the given state(s).
823
+ #
824
+ # @param [String] user_id The OCID of the user.
825
+ # @param [OCI::Identity::Models::UpdateStateDetails] update_state_details Request object for updating a user state.
826
+ # @param [Array<String>] wait_for_states An array of states to wait on. These should be valid values for {OCI::Identity::Models::User#lifecycle_state}
827
+ # @param [Hash] base_operation_opts Any optional arguments accepted by {OCI::Identity::IdentityClient#update_user_state}
828
+ # @param [Hash] waiter_opts Optional arguments for the waiter. Keys should be symbols, and the following keys are supported:
829
+ # * max_interval_seconds: The maximum interval between queries, in seconds.
830
+ # * max_wait_seconds The maximum time to wait, in seconds
831
+ #
832
+ # @return [OCI::Response] A {OCI::Response} object with data of type {OCI::Identity::Models::User}
833
+ def update_user_state_and_wait_for_state(user_id, update_state_details, wait_for_states = [], base_operation_opts = {}, waiter_opts = {})
834
+ operation_result = @service_client.update_user_state(user_id, update_state_details, base_operation_opts)
835
+
836
+ return operation_result if wait_for_states.empty?
837
+
838
+ lowered_wait_for_states = wait_for_states.map(&:downcase)
839
+ wait_for_resource_id = operation_result.data.id
840
+
841
+ begin
842
+ waiter_result = @service_client.get_user(wait_for_resource_id).wait_until(
843
+ eval_proc: ->(response) { response.data.respond_to?(:lifecycle_state) && lowered_wait_for_states.include?(response.data.lifecycle_state.downcase) },
844
+ max_interval_seconds: waiter_opts.key?(:max_interval_seconds) ? waiter_opts[:max_interval_seconds] : 30,
845
+ max_wait_seconds: waiter_opts.key?(:max_wait_seconds) ? waiter_opts[:max_wait_seconds] : 1200
846
+ )
847
+ result_to_return = waiter_result
848
+
849
+ return result_to_return
850
+ rescue StandardError
851
+ raise OCI::Errors::CompositeOperationError.new(partial_results: [operation_result])
852
+ end
853
+ end
854
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/ParameterLists, Metrics/PerceivedComplexity
855
+ # rubocop:enable Layout/EmptyLines
816
856
  end
817
857
  end
818
858
  # rubocop:enable Lint/UnneededCopDisableDirective, Metrics/LineLength
@@ -0,0 +1,40 @@
1
+ # Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
2
+
3
+ module OCI
4
+ module KeyManagement
5
+ # Module containing models for requests made to, and responses received from,
6
+ # OCI KeyManagement services
7
+ module Models
8
+ end
9
+ end
10
+ end
11
+
12
+ # Require models
13
+ require 'oci/key_management/models/create_key_details'
14
+ require 'oci/key_management/models/create_vault_details'
15
+ require 'oci/key_management/models/decrypt_data_details'
16
+ require 'oci/key_management/models/decrypted_data'
17
+ require 'oci/key_management/models/encrypt_data_details'
18
+ require 'oci/key_management/models/encrypted_data'
19
+ require 'oci/key_management/models/generate_key_details'
20
+ require 'oci/key_management/models/generated_key'
21
+ require 'oci/key_management/models/key'
22
+ require 'oci/key_management/models/key_shape'
23
+ require 'oci/key_management/models/key_summary'
24
+ require 'oci/key_management/models/key_version'
25
+ require 'oci/key_management/models/key_version_summary'
26
+ require 'oci/key_management/models/schedule_vault_deletion_details'
27
+ require 'oci/key_management/models/update_key_details'
28
+ require 'oci/key_management/models/update_vault_details'
29
+ require 'oci/key_management/models/vault'
30
+ require 'oci/key_management/models/vault_summary'
31
+
32
+ # Require generated clients
33
+ require 'oci/key_management/kms_crypto_client'
34
+ require 'oci/key_management/kms_management_client'
35
+ require 'oci/key_management/kms_management_client_composite_operations'
36
+ require 'oci/key_management/kms_vault_client'
37
+ require 'oci/key_management/kms_vault_client_composite_operations'
38
+
39
+ # Require service utilities
40
+ require 'oci/key_management/util'
@@ -0,0 +1,258 @@
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::KmsCryptoClient
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
+ # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Layout/EmptyLines
25
+
26
+
27
+ # Creates a new KmsCryptoClient.
28
+ # Notes:
29
+ # If a config is not specified, then the global OCI.config will be used.
30
+ # This client is not thread-safe
31
+ #
32
+ # @param [Config] config A Config object.
33
+ # @param [String] endpoint The fully qualified endpoint URL
34
+ # @param [OCI::BaseSigner] signer A signer implementation which can be used by this client. If this is not provided then
35
+ # a signer will be constructed via the provided config. One use case of this parameter is instance principals authentication,
36
+ # so that the instance principals signer can be provided to the client
37
+ # @param [OCI::ApiClientProxySettings] proxy_settings If your environment requires you to use a proxy server for outgoing HTTP requests
38
+ # the details for the proxy can be provided in this parameter
39
+ # @param [OCI::Retry::RetryConfig] retry_config The retry configuration for this service client. This represents the default retry configuration to
40
+ # 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
41
+ # will not perform any retries
42
+ def initialize(config: nil, endpoint:, signer: nil, proxy_settings: nil, retry_config: nil)
43
+ raise 'A fully qualified endpoint URL must be defined' unless endpoint
44
+ @endpoint = endpoint + '/20180608'
45
+
46
+ # If the signer is an InstancePrincipalsSecurityTokenSigner and no config was supplied (which is valid for instance principals)
47
+ # then create a dummy config to pass to the ApiClient constructor. If customers wish to create a client which uses instance principals
48
+ # and has config (either populated programmatically or loaded from a file), they must construct that config themselves and then
49
+ # pass it to this constructor.
50
+ #
51
+ # If there is no signer (or the signer is not an instance principals signer) and no config was supplied, this is not valid
52
+ # so try and load the config from the default file.
53
+ config ||= OCI.config unless signer.is_a?(OCI::Auth::Signers::InstancePrincipalsSecurityTokenSigner)
54
+ config ||= OCI::Config.new if signer.is_a?(OCI::Auth::Signers::InstancePrincipalsSecurityTokenSigner)
55
+ config.validate unless signer.is_a?(OCI::Auth::Signers::InstancePrincipalsSecurityTokenSigner)
56
+
57
+ if signer.nil?
58
+ signer = OCI::Signer.new(
59
+ config.user,
60
+ config.fingerprint,
61
+ config.tenancy,
62
+ config.key_file,
63
+ pass_phrase: config.pass_phrase,
64
+ private_key_content: config.key_content
65
+ )
66
+ end
67
+
68
+ @api_client = OCI::ApiClient.new(config, signer, proxy_settings: proxy_settings)
69
+ @retry_config = retry_config
70
+
71
+ logger.info "KmsCryptoClient endpoint set to '#{@endpoint}'." if logger
72
+ end
73
+ # rubocop:enable Metrics/AbcSize, Metrics/CyclomaticComplexity, Layout/EmptyLines
74
+
75
+ # @return [Logger] The logger for this client. May be nil.
76
+ def logger
77
+ @api_client.config.logger
78
+ end
79
+
80
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
81
+ # rubocop:disable Style/IfUnlessModifier, Metrics/ParameterLists
82
+ # rubocop:disable Metrics/MethodLength, Layout/EmptyLines
83
+
84
+
85
+ # Decrypts data using the given DecryptDataDetails resource.
86
+ #
87
+ # @param [OCI::KeyManagement::Models::DecryptDataDetails] decrypt_data_details DecryptDataDetails
88
+ # @param [Hash] opts the optional parameters
89
+ # @option opts [OCI::Retry::RetryConfig] :retry_config The retry configuration to apply to this operation. If no key is provided then the service-level
90
+ # retry configuration defined by {#retry_config} will be used. If an explicit `nil` value is provided then the operation will not retry
91
+ # @option opts [String] :opc_request_id Unique identifier for the request. If provided, the returned request ID
92
+ # will include this value. Otherwise, a random request ID will be
93
+ # generated by the service.
94
+ #
95
+ # @return [Response] A Response object with data of type {OCI::KeyManagement::Models::DecryptedData DecryptedData}
96
+ def decrypt(decrypt_data_details, opts = {})
97
+ logger.debug 'Calling operation KmsCryptoClient#decrypt.' if logger
98
+
99
+ raise "Missing the required parameter 'decrypt_data_details' when calling decrypt." if decrypt_data_details.nil?
100
+
101
+ path = '/decrypt'
102
+ operation_signing_strategy = :standard
103
+
104
+ # rubocop:disable Style/NegatedIf
105
+ # Query Params
106
+ query_params = {}
107
+
108
+ # Header Params
109
+ header_params = {}
110
+ header_params[:accept] = 'application/json'
111
+ header_params[:'content-type'] = 'application/json'
112
+ header_params[:'opc-request-id'] = opts[:opc_request_id] if opts[:opc_request_id]
113
+ # rubocop:enable Style/NegatedIf
114
+
115
+ post_body = @api_client.object_to_http_body(decrypt_data_details)
116
+
117
+ # rubocop:disable Metrics/BlockLength
118
+ OCI::Retry.make_retrying_call(applicable_retry_config(opts), call_name: 'KmsCryptoClient#decrypt') do
119
+ @api_client.call_api(
120
+ :POST,
121
+ path,
122
+ endpoint,
123
+ header_params: header_params,
124
+ query_params: query_params,
125
+ operation_signing_strategy: operation_signing_strategy,
126
+ body: post_body,
127
+ return_type: 'OCI::KeyManagement::Models::DecryptedData'
128
+ )
129
+ end
130
+ # rubocop:enable Metrics/BlockLength
131
+ end
132
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
133
+ # rubocop:enable Style/IfUnlessModifier, Metrics/ParameterLists
134
+ # rubocop:enable Metrics/MethodLength, Layout/EmptyLines
135
+
136
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
137
+ # rubocop:disable Style/IfUnlessModifier, Metrics/ParameterLists
138
+ # rubocop:disable Metrics/MethodLength, Layout/EmptyLines
139
+
140
+
141
+ # Encrypts data using the given EncryptDataDetails resource.
142
+ # Plaintext included in the example request is a base64-encoded value
143
+ # of a UTF-8 string.
144
+ #
145
+ # @param [OCI::KeyManagement::Models::EncryptDataDetails] encrypt_data_details EncryptDataDetails
146
+ # @param [Hash] opts the optional parameters
147
+ # @option opts [OCI::Retry::RetryConfig] :retry_config The retry configuration to apply to this operation. If no key is provided then the service-level
148
+ # retry configuration defined by {#retry_config} will be used. If an explicit `nil` value is provided then the operation will not retry
149
+ # @option opts [String] :opc_request_id Unique identifier for the request. If provided, the returned request ID
150
+ # will include this value. Otherwise, a random request ID will be
151
+ # generated by the service.
152
+ #
153
+ # @return [Response] A Response object with data of type {OCI::KeyManagement::Models::EncryptedData EncryptedData}
154
+ def encrypt(encrypt_data_details, opts = {})
155
+ logger.debug 'Calling operation KmsCryptoClient#encrypt.' if logger
156
+
157
+ raise "Missing the required parameter 'encrypt_data_details' when calling encrypt." if encrypt_data_details.nil?
158
+
159
+ path = '/encrypt'
160
+ operation_signing_strategy = :standard
161
+
162
+ # rubocop:disable Style/NegatedIf
163
+ # Query Params
164
+ query_params = {}
165
+
166
+ # Header Params
167
+ header_params = {}
168
+ header_params[:accept] = 'application/json'
169
+ header_params[:'content-type'] = 'application/json'
170
+ header_params[:'opc-request-id'] = opts[:opc_request_id] if opts[:opc_request_id]
171
+ # rubocop:enable Style/NegatedIf
172
+
173
+ post_body = @api_client.object_to_http_body(encrypt_data_details)
174
+
175
+ # rubocop:disable Metrics/BlockLength
176
+ OCI::Retry.make_retrying_call(applicable_retry_config(opts), call_name: 'KmsCryptoClient#encrypt') do
177
+ @api_client.call_api(
178
+ :POST,
179
+ path,
180
+ endpoint,
181
+ header_params: header_params,
182
+ query_params: query_params,
183
+ operation_signing_strategy: operation_signing_strategy,
184
+ body: post_body,
185
+ return_type: 'OCI::KeyManagement::Models::EncryptedData'
186
+ )
187
+ end
188
+ # rubocop:enable Metrics/BlockLength
189
+ end
190
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
191
+ # rubocop:enable Style/IfUnlessModifier, Metrics/ParameterLists
192
+ # rubocop:enable Metrics/MethodLength, Layout/EmptyLines
193
+
194
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
195
+ # rubocop:disable Style/IfUnlessModifier, Metrics/ParameterLists
196
+ # rubocop:disable Metrics/MethodLength, Layout/EmptyLines
197
+
198
+
199
+ # Generates a key that you can use to encrypt or decrypt data.
200
+ #
201
+ # @param [OCI::KeyManagement::Models::GenerateKeyDetails] generate_key_details GenerateKeyDetails
202
+ # @param [Hash] opts the optional parameters
203
+ # @option opts [OCI::Retry::RetryConfig] :retry_config The retry configuration to apply to this operation. If no key is provided then the service-level
204
+ # retry configuration defined by {#retry_config} will be used. If an explicit `nil` value is provided then the operation will not retry
205
+ # @option opts [String] :opc_request_id Unique identifier for the request. If provided, the returned request ID
206
+ # will include this value. Otherwise, a random request ID will be
207
+ # generated by the service.
208
+ #
209
+ # @return [Response] A Response object with data of type {OCI::KeyManagement::Models::GeneratedKey GeneratedKey}
210
+ def generate_data_encryption_key(generate_key_details, opts = {})
211
+ logger.debug 'Calling operation KmsCryptoClient#generate_data_encryption_key.' if logger
212
+
213
+ raise "Missing the required parameter 'generate_key_details' when calling generate_data_encryption_key." if generate_key_details.nil?
214
+
215
+ path = '/generateDataEncryptionKey'
216
+ operation_signing_strategy = :standard
217
+
218
+ # rubocop:disable Style/NegatedIf
219
+ # Query Params
220
+ query_params = {}
221
+
222
+ # Header Params
223
+ header_params = {}
224
+ header_params[:accept] = 'application/json'
225
+ header_params[:'content-type'] = 'application/json'
226
+ header_params[:'opc-request-id'] = opts[:opc_request_id] if opts[:opc_request_id]
227
+ # rubocop:enable Style/NegatedIf
228
+
229
+ post_body = @api_client.object_to_http_body(generate_key_details)
230
+
231
+ # rubocop:disable Metrics/BlockLength
232
+ OCI::Retry.make_retrying_call(applicable_retry_config(opts), call_name: 'KmsCryptoClient#generate_data_encryption_key') do
233
+ @api_client.call_api(
234
+ :POST,
235
+ path,
236
+ endpoint,
237
+ header_params: header_params,
238
+ query_params: query_params,
239
+ operation_signing_strategy: operation_signing_strategy,
240
+ body: post_body,
241
+ return_type: 'OCI::KeyManagement::Models::GeneratedKey'
242
+ )
243
+ end
244
+ # rubocop:enable Metrics/BlockLength
245
+ end
246
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
247
+ # rubocop:enable Style/IfUnlessModifier, Metrics/ParameterLists
248
+ # rubocop:enable Metrics/MethodLength, Layout/EmptyLines
249
+
250
+ private
251
+
252
+ def applicable_retry_config(opts = {})
253
+ return @retry_config unless opts.key?(:retry_config)
254
+ opts[:retry_config]
255
+ end
256
+ end
257
+ end
258
+ # rubocop:enable Lint/UnneededCopDisableDirective, Metrics/LineLength
@@ -0,0 +1,24 @@
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::KmsCryptoClient} 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::KmsCryptoClientCompositeOperations
10
+ # The {OCI::KeyManagement::KmsCryptoClient} used to communicate with the service_client
11
+ #
12
+ # @return [OCI::KeyManagement::KmsCryptoClient]
13
+ attr_reader :service_client
14
+
15
+ # Initializes a new KmsCryptoClientCompositeOperations
16
+ #
17
+ # @param [OCI::KeyManagement::KmsCryptoClient] service_client The client used to communicate with the service.
18
+ # Defaults to a new service client created via {OCI::KeyManagement::KmsCryptoClient#initialize} with no arguments
19
+ def initialize(service_client = OCI::KeyManagement::KmsCryptoClient.new)
20
+ @service_client = service_client
21
+ end
22
+ end
23
+ end
24
+ # rubocop:enable Lint/UnneededCopDisableDirective, Metrics/LineLength
@@ -0,0 +1,716 @@
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::KmsManagementClient
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
+ # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Layout/EmptyLines
25
+
26
+
27
+ # Creates a new KmsManagementClient.
28
+ # Notes:
29
+ # If a config is not specified, then the global OCI.config will be used.
30
+ # This client is not thread-safe
31
+ #
32
+ # @param [Config] config A Config object.
33
+ # @param [String] endpoint The fully qualified endpoint URL
34
+ # @param [OCI::BaseSigner] signer A signer implementation which can be used by this client. If this is not provided then
35
+ # a signer will be constructed via the provided config. One use case of this parameter is instance principals authentication,
36
+ # so that the instance principals signer can be provided to the client
37
+ # @param [OCI::ApiClientProxySettings] proxy_settings If your environment requires you to use a proxy server for outgoing HTTP requests
38
+ # the details for the proxy can be provided in this parameter
39
+ # @param [OCI::Retry::RetryConfig] retry_config The retry configuration for this service client. This represents the default retry configuration to
40
+ # 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
41
+ # will not perform any retries
42
+ def initialize(config: nil, endpoint:, signer: nil, proxy_settings: nil, retry_config: nil)
43
+ raise 'A fully qualified endpoint URL must be defined' unless endpoint
44
+ @endpoint = endpoint + '/20180608'
45
+
46
+ # If the signer is an InstancePrincipalsSecurityTokenSigner and no config was supplied (which is valid for instance principals)
47
+ # then create a dummy config to pass to the ApiClient constructor. If customers wish to create a client which uses instance principals
48
+ # and has config (either populated programmatically or loaded from a file), they must construct that config themselves and then
49
+ # pass it to this constructor.
50
+ #
51
+ # If there is no signer (or the signer is not an instance principals signer) and no config was supplied, this is not valid
52
+ # so try and load the config from the default file.
53
+ config ||= OCI.config unless signer.is_a?(OCI::Auth::Signers::InstancePrincipalsSecurityTokenSigner)
54
+ config ||= OCI::Config.new if signer.is_a?(OCI::Auth::Signers::InstancePrincipalsSecurityTokenSigner)
55
+ config.validate unless signer.is_a?(OCI::Auth::Signers::InstancePrincipalsSecurityTokenSigner)
56
+
57
+ if signer.nil?
58
+ signer = OCI::Signer.new(
59
+ config.user,
60
+ config.fingerprint,
61
+ config.tenancy,
62
+ config.key_file,
63
+ pass_phrase: config.pass_phrase,
64
+ private_key_content: config.key_content
65
+ )
66
+ end
67
+
68
+ @api_client = OCI::ApiClient.new(config, signer, proxy_settings: proxy_settings)
69
+ @retry_config = retry_config
70
+
71
+ logger.info "KmsManagementClient endpoint set to '#{@endpoint}'." if logger
72
+ end
73
+ # rubocop:enable Metrics/AbcSize, Metrics/CyclomaticComplexity, Layout/EmptyLines
74
+
75
+ # @return [Logger] The logger for this client. May be nil.
76
+ def logger
77
+ @api_client.config.logger
78
+ end
79
+
80
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
81
+ # rubocop:disable Style/IfUnlessModifier, Metrics/ParameterLists
82
+ # rubocop:disable Metrics/MethodLength, Layout/EmptyLines
83
+
84
+
85
+ # Creates a new key.
86
+ # @param [OCI::KeyManagement::Models::CreateKeyDetails] create_key_details CreateKeyDetails
87
+ # @param [Hash] opts the optional parameters
88
+ # @option opts [OCI::Retry::RetryConfig] :retry_config The retry configuration to apply to this operation. If no key is provided then the service-level
89
+ # retry configuration defined by {#retry_config} will be used. If an explicit `nil` value is provided then the operation will not retry
90
+ # @option opts [String] :opc_request_id Unique identifier for the request. If provided, the returned request ID
91
+ # will include this value. Otherwise, a random request ID will be
92
+ # generated by the service.
93
+ #
94
+ # @option opts [String] :opc_retry_token A token that uniquely identifies a request so it can be retried in case
95
+ # of a timeout or server error without risk of executing that same action
96
+ # again. Retry tokens expire after 24 hours, but can be invalidated
97
+ # before then due to conflicting operations (e.g., if a resource has been
98
+ # deleted and purged from the system, then a retry of the original
99
+ # creation request may be rejected).
100
+ #
101
+ # @return [Response] A Response object with data of type {OCI::KeyManagement::Models::Key Key}
102
+ def create_key(create_key_details, opts = {})
103
+ logger.debug 'Calling operation KmsManagementClient#create_key.' if logger
104
+
105
+ raise "Missing the required parameter 'create_key_details' when calling create_key." if create_key_details.nil?
106
+
107
+ path = '/keys'
108
+ operation_signing_strategy = :standard
109
+
110
+ # rubocop:disable Style/NegatedIf
111
+ # Query Params
112
+ query_params = {}
113
+
114
+ # Header Params
115
+ header_params = {}
116
+ header_params[:accept] = 'application/json'
117
+ header_params[:'content-type'] = 'application/json'
118
+ header_params[:'opc-request-id'] = opts[:opc_request_id] if opts[:opc_request_id]
119
+ header_params[:'opc-retry-token'] = opts[:opc_retry_token] if opts[:opc_retry_token]
120
+ # rubocop:enable Style/NegatedIf
121
+ header_params[:'opc-retry-token'] ||= OCI::Retry.generate_opc_retry_token
122
+
123
+ post_body = @api_client.object_to_http_body(create_key_details)
124
+
125
+ # rubocop:disable Metrics/BlockLength
126
+ OCI::Retry.make_retrying_call(applicable_retry_config(opts), call_name: 'KmsManagementClient#create_key') do
127
+ @api_client.call_api(
128
+ :POST,
129
+ path,
130
+ endpoint,
131
+ header_params: header_params,
132
+ query_params: query_params,
133
+ operation_signing_strategy: operation_signing_strategy,
134
+ body: post_body,
135
+ return_type: 'OCI::KeyManagement::Models::Key'
136
+ )
137
+ end
138
+ # rubocop:enable Metrics/BlockLength
139
+ end
140
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
141
+ # rubocop:enable Style/IfUnlessModifier, Metrics/ParameterLists
142
+ # rubocop:enable Metrics/MethodLength, Layout/EmptyLines
143
+
144
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
145
+ # rubocop:disable Style/IfUnlessModifier, Metrics/ParameterLists
146
+ # rubocop:disable Metrics/MethodLength, Layout/EmptyLines
147
+
148
+
149
+ # Generates new cryptographic material for a key. Key must be in an `ENABLED` state to be
150
+ # rotated.
151
+ #
152
+ # @param [String] key_id The OCID of the key.
153
+ # @param [Hash] opts the optional parameters
154
+ # @option opts [OCI::Retry::RetryConfig] :retry_config The retry configuration to apply to this operation. If no key is provided then the service-level
155
+ # retry configuration defined by {#retry_config} will be used. If an explicit `nil` value is provided then the operation will not retry
156
+ # @option opts [String] :opc_request_id Unique identifier for the request. If provided, the returned request ID
157
+ # will include this value. Otherwise, a random request ID will be
158
+ # generated by the service.
159
+ #
160
+ # @option opts [String] :opc_retry_token A token that uniquely identifies a request so it can be retried in case
161
+ # of a timeout or server error without risk of executing that same action
162
+ # again. Retry tokens expire after 24 hours, but can be invalidated
163
+ # before then due to conflicting operations (e.g., if a resource has been
164
+ # deleted and purged from the system, then a retry of the original
165
+ # creation request may be rejected).
166
+ #
167
+ # @return [Response] A Response object with data of type {OCI::KeyManagement::Models::KeyVersion KeyVersion}
168
+ def create_key_version(key_id, opts = {})
169
+ logger.debug 'Calling operation KmsManagementClient#create_key_version.' if logger
170
+
171
+ raise "Missing the required parameter 'key_id' when calling create_key_version." if key_id.nil?
172
+ raise "Parameter value for 'key_id' must not be blank" if OCI::Internal::Util.blank_string?(key_id)
173
+
174
+ path = '/keys/{keyId}/keyVersions'.sub('{keyId}', key_id.to_s)
175
+ operation_signing_strategy = :standard
176
+
177
+ # rubocop:disable Style/NegatedIf
178
+ # Query Params
179
+ query_params = {}
180
+
181
+ # Header Params
182
+ header_params = {}
183
+ header_params[:accept] = 'application/json'
184
+ header_params[:'content-type'] = 'application/json'
185
+ header_params[:'opc-request-id'] = opts[:opc_request_id] if opts[:opc_request_id]
186
+ header_params[:'opc-retry-token'] = opts[:opc_retry_token] if opts[:opc_retry_token]
187
+ # rubocop:enable Style/NegatedIf
188
+ header_params[:'opc-retry-token'] ||= OCI::Retry.generate_opc_retry_token
189
+
190
+ post_body = nil
191
+
192
+ # rubocop:disable Metrics/BlockLength
193
+ OCI::Retry.make_retrying_call(applicable_retry_config(opts), call_name: 'KmsManagementClient#create_key_version') do
194
+ @api_client.call_api(
195
+ :POST,
196
+ path,
197
+ endpoint,
198
+ header_params: header_params,
199
+ query_params: query_params,
200
+ operation_signing_strategy: operation_signing_strategy,
201
+ body: post_body,
202
+ return_type: 'OCI::KeyManagement::Models::KeyVersion'
203
+ )
204
+ end
205
+ # rubocop:enable Metrics/BlockLength
206
+ end
207
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
208
+ # rubocop:enable Style/IfUnlessModifier, Metrics/ParameterLists
209
+ # rubocop:enable Metrics/MethodLength, Layout/EmptyLines
210
+
211
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
212
+ # rubocop:disable Style/IfUnlessModifier, Metrics/ParameterLists
213
+ # rubocop:disable Metrics/MethodLength, Layout/EmptyLines
214
+
215
+
216
+ # Disables a key to make it unavailable for encryption
217
+ # or decryption.
218
+ #
219
+ # @param [String] key_id The OCID of the key.
220
+ # @param [Hash] opts the optional parameters
221
+ # @option opts [OCI::Retry::RetryConfig] :retry_config The retry configuration to apply to this operation. If no key is provided then the service-level
222
+ # retry configuration defined by {#retry_config} will be used. If an explicit `nil` value is provided then the operation will not retry
223
+ # @option opts [String] :if_match For optimistic concurrency control. In the PUT or DELETE call for a
224
+ # resource, set the `if-match` parameter to the value of the etag from a
225
+ # previous GET or POST response for that resource. The resource will be
226
+ # updated or deleted only if the etag you provide matches the resource's
227
+ # current etag value.
228
+ #
229
+ # @option opts [String] :opc_request_id Unique identifier for the request. If provided, the returned request ID
230
+ # will include this value. Otherwise, a random request ID will be
231
+ # generated by the service.
232
+ #
233
+ # @option opts [String] :opc_retry_token A token that uniquely identifies a request so it can be retried in case
234
+ # of a timeout or server error without risk of executing that same action
235
+ # again. Retry tokens expire after 24 hours, but can be invalidated
236
+ # before then due to conflicting operations (e.g., if a resource has been
237
+ # deleted and purged from the system, then a retry of the original
238
+ # creation request may be rejected).
239
+ #
240
+ # @return [Response] A Response object with data of type {OCI::KeyManagement::Models::Key Key}
241
+ def disable_key(key_id, opts = {})
242
+ logger.debug 'Calling operation KmsManagementClient#disable_key.' if logger
243
+
244
+ raise "Missing the required parameter 'key_id' when calling disable_key." if key_id.nil?
245
+ raise "Parameter value for 'key_id' must not be blank" if OCI::Internal::Util.blank_string?(key_id)
246
+
247
+ path = '/keys/{keyId}/actions/disable'.sub('{keyId}', key_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[:'if-match'] = opts[:if_match] if opts[:if_match]
259
+ header_params[:'opc-request-id'] = opts[:opc_request_id] if opts[:opc_request_id]
260
+ header_params[:'opc-retry-token'] = opts[:opc_retry_token] if opts[:opc_retry_token]
261
+ # rubocop:enable Style/NegatedIf
262
+ header_params[:'opc-retry-token'] ||= OCI::Retry.generate_opc_retry_token
263
+
264
+ post_body = nil
265
+
266
+ # rubocop:disable Metrics/BlockLength
267
+ OCI::Retry.make_retrying_call(applicable_retry_config(opts), call_name: 'KmsManagementClient#disable_key') do
268
+ @api_client.call_api(
269
+ :POST,
270
+ path,
271
+ endpoint,
272
+ header_params: header_params,
273
+ query_params: query_params,
274
+ operation_signing_strategy: operation_signing_strategy,
275
+ body: post_body,
276
+ return_type: 'OCI::KeyManagement::Models::Key'
277
+ )
278
+ end
279
+ # rubocop:enable Metrics/BlockLength
280
+ end
281
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
282
+ # rubocop:enable Style/IfUnlessModifier, Metrics/ParameterLists
283
+ # rubocop:enable Metrics/MethodLength, Layout/EmptyLines
284
+
285
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
286
+ # rubocop:disable Style/IfUnlessModifier, Metrics/ParameterLists
287
+ # rubocop:disable Metrics/MethodLength, Layout/EmptyLines
288
+
289
+
290
+ # Enables a key to make it available for encryption or
291
+ # decryption.
292
+ #
293
+ # @param [String] key_id The OCID of the key.
294
+ # @param [Hash] opts the optional parameters
295
+ # @option opts [OCI::Retry::RetryConfig] :retry_config The retry configuration to apply to this operation. If no key is provided then the service-level
296
+ # retry configuration defined by {#retry_config} will be used. If an explicit `nil` value is provided then the operation will not retry
297
+ # @option opts [String] :if_match For optimistic concurrency control. In the PUT or DELETE call for a
298
+ # resource, set the `if-match` parameter to the value of the etag from a
299
+ # previous GET or POST response for that resource. The resource will be
300
+ # updated or deleted only if the etag you provide matches the resource's
301
+ # current etag value.
302
+ #
303
+ # @option opts [String] :opc_request_id Unique identifier for the request. If provided, the returned request ID
304
+ # will include this value. Otherwise, a random request ID will be
305
+ # generated by the service.
306
+ #
307
+ # @option opts [String] :opc_retry_token A token that uniquely identifies a request so it can be retried in case
308
+ # of a timeout or server error without risk of executing that same action
309
+ # again. Retry tokens expire after 24 hours, but can be invalidated
310
+ # before then due to conflicting operations (e.g., if a resource has been
311
+ # deleted and purged from the system, then a retry of the original
312
+ # creation request may be rejected).
313
+ #
314
+ # @return [Response] A Response object with data of type {OCI::KeyManagement::Models::Key Key}
315
+ def enable_key(key_id, opts = {})
316
+ logger.debug 'Calling operation KmsManagementClient#enable_key.' if logger
317
+
318
+ raise "Missing the required parameter 'key_id' when calling enable_key." if key_id.nil?
319
+ raise "Parameter value for 'key_id' must not be blank" if OCI::Internal::Util.blank_string?(key_id)
320
+
321
+ path = '/keys/{keyId}/actions/enable'.sub('{keyId}', key_id.to_s)
322
+ operation_signing_strategy = :standard
323
+
324
+ # rubocop:disable Style/NegatedIf
325
+ # Query Params
326
+ query_params = {}
327
+
328
+ # Header Params
329
+ header_params = {}
330
+ header_params[:accept] = 'application/json'
331
+ header_params[:'content-type'] = 'application/json'
332
+ header_params[:'if-match'] = opts[:if_match] if opts[:if_match]
333
+ header_params[:'opc-request-id'] = opts[:opc_request_id] if opts[:opc_request_id]
334
+ header_params[:'opc-retry-token'] = opts[:opc_retry_token] if opts[:opc_retry_token]
335
+ # rubocop:enable Style/NegatedIf
336
+ header_params[:'opc-retry-token'] ||= OCI::Retry.generate_opc_retry_token
337
+
338
+ post_body = nil
339
+
340
+ # rubocop:disable Metrics/BlockLength
341
+ OCI::Retry.make_retrying_call(applicable_retry_config(opts), call_name: 'KmsManagementClient#enable_key') do
342
+ @api_client.call_api(
343
+ :POST,
344
+ path,
345
+ endpoint,
346
+ header_params: header_params,
347
+ query_params: query_params,
348
+ operation_signing_strategy: operation_signing_strategy,
349
+ body: post_body,
350
+ return_type: 'OCI::KeyManagement::Models::Key'
351
+ )
352
+ end
353
+ # rubocop:enable Metrics/BlockLength
354
+ end
355
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
356
+ # rubocop:enable Style/IfUnlessModifier, Metrics/ParameterLists
357
+ # rubocop:enable Metrics/MethodLength, Layout/EmptyLines
358
+
359
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
360
+ # rubocop:disable Style/IfUnlessModifier, Metrics/ParameterLists
361
+ # rubocop:disable Metrics/MethodLength, Layout/EmptyLines
362
+
363
+
364
+ # Gets information about the specified key.
365
+ #
366
+ # @param [String] key_id The OCID of the key.
367
+ # @param [Hash] opts the optional parameters
368
+ # @option opts [OCI::Retry::RetryConfig] :retry_config The retry configuration to apply to this operation. If no key is provided then the service-level
369
+ # retry configuration defined by {#retry_config} will be used. If an explicit `nil` value is provided then the operation will not retry
370
+ # @option opts [String] :opc_request_id Unique identifier for the request. If provided, the returned request ID
371
+ # will include this value. Otherwise, a random request ID will be
372
+ # generated by the service.
373
+ #
374
+ # @return [Response] A Response object with data of type {OCI::KeyManagement::Models::Key Key}
375
+ def get_key(key_id, opts = {})
376
+ logger.debug 'Calling operation KmsManagementClient#get_key.' if logger
377
+
378
+ raise "Missing the required parameter 'key_id' when calling get_key." if key_id.nil?
379
+ raise "Parameter value for 'key_id' must not be blank" if OCI::Internal::Util.blank_string?(key_id)
380
+
381
+ path = '/keys/{keyId}'.sub('{keyId}', key_id.to_s)
382
+ operation_signing_strategy = :standard
383
+
384
+ # rubocop:disable Style/NegatedIf
385
+ # Query Params
386
+ query_params = {}
387
+
388
+ # Header Params
389
+ header_params = {}
390
+ header_params[:accept] = 'application/json'
391
+ header_params[:'content-type'] = 'application/json'
392
+ header_params[:'opc-request-id'] = opts[:opc_request_id] if opts[:opc_request_id]
393
+ # rubocop:enable Style/NegatedIf
394
+
395
+ post_body = nil
396
+
397
+ # rubocop:disable Metrics/BlockLength
398
+ OCI::Retry.make_retrying_call(applicable_retry_config(opts), call_name: 'KmsManagementClient#get_key') do
399
+ @api_client.call_api(
400
+ :GET,
401
+ path,
402
+ endpoint,
403
+ header_params: header_params,
404
+ query_params: query_params,
405
+ operation_signing_strategy: operation_signing_strategy,
406
+ body: post_body,
407
+ return_type: 'OCI::KeyManagement::Models::Key'
408
+ )
409
+ end
410
+ # rubocop:enable Metrics/BlockLength
411
+ end
412
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
413
+ # rubocop:enable Style/IfUnlessModifier, Metrics/ParameterLists
414
+ # rubocop:enable Metrics/MethodLength, Layout/EmptyLines
415
+
416
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
417
+ # rubocop:disable Style/IfUnlessModifier, Metrics/ParameterLists
418
+ # rubocop:disable Metrics/MethodLength, Layout/EmptyLines
419
+
420
+
421
+ # Gets information about the specified key version.
422
+ #
423
+ # @param [String] key_id The OCID of the key.
424
+ # @param [String] key_version_id The OCID of the key version.
425
+ # @param [Hash] opts the optional parameters
426
+ # @option opts [OCI::Retry::RetryConfig] :retry_config The retry configuration to apply to this operation. If no key is provided then the service-level
427
+ # retry configuration defined by {#retry_config} will be used. If an explicit `nil` value is provided then the operation will not retry
428
+ # @option opts [String] :opc_request_id Unique identifier for the request. If provided, the returned request ID
429
+ # will include this value. Otherwise, a random request ID will be
430
+ # generated by the service.
431
+ #
432
+ # @return [Response] A Response object with data of type {OCI::KeyManagement::Models::KeyVersion KeyVersion}
433
+ def get_key_version(key_id, key_version_id, opts = {})
434
+ logger.debug 'Calling operation KmsManagementClient#get_key_version.' if logger
435
+
436
+ raise "Missing the required parameter 'key_id' when calling get_key_version." if key_id.nil?
437
+ raise "Missing the required parameter 'key_version_id' when calling get_key_version." if key_version_id.nil?
438
+ raise "Parameter value for 'key_id' must not be blank" if OCI::Internal::Util.blank_string?(key_id)
439
+ raise "Parameter value for 'key_version_id' must not be blank" if OCI::Internal::Util.blank_string?(key_version_id)
440
+
441
+ path = '/keys/{keyId}/keyVersions/{keyVersionId}'.sub('{keyId}', key_id.to_s).sub('{keyVersionId}', key_version_id.to_s)
442
+ operation_signing_strategy = :standard
443
+
444
+ # rubocop:disable Style/NegatedIf
445
+ # Query Params
446
+ query_params = {}
447
+
448
+ # Header Params
449
+ header_params = {}
450
+ header_params[:accept] = 'application/json'
451
+ header_params[:'content-type'] = 'application/json'
452
+ header_params[:'opc-request-id'] = opts[:opc_request_id] if opts[:opc_request_id]
453
+ # rubocop:enable Style/NegatedIf
454
+
455
+ post_body = nil
456
+
457
+ # rubocop:disable Metrics/BlockLength
458
+ OCI::Retry.make_retrying_call(applicable_retry_config(opts), call_name: 'KmsManagementClient#get_key_version') do
459
+ @api_client.call_api(
460
+ :GET,
461
+ path,
462
+ endpoint,
463
+ header_params: header_params,
464
+ query_params: query_params,
465
+ operation_signing_strategy: operation_signing_strategy,
466
+ body: post_body,
467
+ return_type: 'OCI::KeyManagement::Models::KeyVersion'
468
+ )
469
+ end
470
+ # rubocop:enable Metrics/BlockLength
471
+ end
472
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
473
+ # rubocop:enable Style/IfUnlessModifier, Metrics/ParameterLists
474
+ # rubocop:enable Metrics/MethodLength, Layout/EmptyLines
475
+
476
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
477
+ # rubocop:disable Style/IfUnlessModifier, Metrics/ParameterLists
478
+ # rubocop:disable Metrics/MethodLength, Layout/EmptyLines
479
+
480
+
481
+ # Lists all key versions for the specified key.
482
+ #
483
+ # @param [String] key_id The OCID of the key.
484
+ # @param [Hash] opts the optional parameters
485
+ # @option opts [OCI::Retry::RetryConfig] :retry_config The retry configuration to apply to this operation. If no key is provided then the service-level
486
+ # retry configuration defined by {#retry_config} will be used. If an explicit `nil` value is provided then the operation will not retry
487
+ # @option opts [Integer] :limit The maximum number of items to return in a paginated \"List\" call.
488
+ #
489
+ # @option opts [String] :page The value of the `opc-next-page` response header
490
+ # from the previous \"List\" call.
491
+ #
492
+ # @option opts [String] :opc_request_id Unique identifier for the request. If provided, the returned request ID
493
+ # will include this value. Otherwise, a random request ID will be
494
+ # generated by the service.
495
+ #
496
+ # @option opts [String] :sort_by The field to sort by. You can specify only one sort order. The default
497
+ # order for TIMECREATED is descending. The default order for DISPLAYNAME
498
+ # is ascending.
499
+ #
500
+ # Allowed values are: TIMECREATED, DISPLAYNAME
501
+ # @option opts [String] :sort_order The sort order to use, either ascending (`ASC`) or descending (`DESC`).
502
+ #
503
+ # Allowed values are: ASC, DESC
504
+ # @return [Response] A Response object with data of type Array<{OCI::KeyManagement::Models::KeyVersionSummary KeyVersionSummary}>
505
+ def list_key_versions(key_id, opts = {})
506
+ logger.debug 'Calling operation KmsManagementClient#list_key_versions.' if logger
507
+
508
+ raise "Missing the required parameter 'key_id' when calling list_key_versions." if key_id.nil?
509
+
510
+ if opts[:sort_by] && !%w[TIMECREATED DISPLAYNAME].include?(opts[:sort_by])
511
+ raise 'Invalid value for "sort_by", must be one of TIMECREATED, DISPLAYNAME.'
512
+ end
513
+
514
+ if opts[:sort_order] && !%w[ASC DESC].include?(opts[:sort_order])
515
+ raise 'Invalid value for "sort_order", must be one of ASC, DESC.'
516
+ end
517
+ raise "Parameter value for 'key_id' must not be blank" if OCI::Internal::Util.blank_string?(key_id)
518
+
519
+ path = '/keys/{keyId}/keyVersions'.sub('{keyId}', key_id.to_s)
520
+ operation_signing_strategy = :standard
521
+
522
+ # rubocop:disable Style/NegatedIf
523
+ # Query Params
524
+ query_params = {}
525
+ query_params[:limit] = opts[:limit] if opts[:limit]
526
+ query_params[:page] = opts[:page] if opts[:page]
527
+ query_params[:sortBy] = opts[:sort_by] if opts[:sort_by]
528
+ query_params[:sortOrder] = opts[:sort_order] if opts[:sort_order]
529
+
530
+ # Header Params
531
+ header_params = {}
532
+ header_params[:accept] = 'application/json'
533
+ header_params[:'content-type'] = 'application/json'
534
+ header_params[:'opc-request-id'] = opts[:opc_request_id] if opts[:opc_request_id]
535
+ # rubocop:enable Style/NegatedIf
536
+
537
+ post_body = nil
538
+
539
+ # rubocop:disable Metrics/BlockLength
540
+ OCI::Retry.make_retrying_call(applicable_retry_config(opts), call_name: 'KmsManagementClient#list_key_versions') do
541
+ @api_client.call_api(
542
+ :GET,
543
+ path,
544
+ endpoint,
545
+ header_params: header_params,
546
+ query_params: query_params,
547
+ operation_signing_strategy: operation_signing_strategy,
548
+ body: post_body,
549
+ return_type: 'Array<OCI::KeyManagement::Models::KeyVersionSummary>'
550
+ )
551
+ end
552
+ # rubocop:enable Metrics/BlockLength
553
+ end
554
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
555
+ # rubocop:enable Style/IfUnlessModifier, Metrics/ParameterLists
556
+ # rubocop:enable Metrics/MethodLength, Layout/EmptyLines
557
+
558
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
559
+ # rubocop:disable Style/IfUnlessModifier, Metrics/ParameterLists
560
+ # rubocop:disable Metrics/MethodLength, Layout/EmptyLines
561
+
562
+
563
+ # Lists the keys in the specified vault and compartment.
564
+ #
565
+ # @param [String] compartment_id The OCID of the compartment.
566
+ # @param [Hash] opts the optional parameters
567
+ # @option opts [OCI::Retry::RetryConfig] :retry_config The retry configuration to apply to this operation. If no key is provided then the service-level
568
+ # retry configuration defined by {#retry_config} will be used. If an explicit `nil` value is provided then the operation will not retry
569
+ # @option opts [Integer] :limit The maximum number of items to return in a paginated \"List\" call.
570
+ #
571
+ # @option opts [String] :page The value of the `opc-next-page` response header
572
+ # from the previous \"List\" call.
573
+ #
574
+ # @option opts [String] :opc_request_id Unique identifier for the request. If provided, the returned request ID
575
+ # will include this value. Otherwise, a random request ID will be
576
+ # generated by the service.
577
+ #
578
+ # @option opts [String] :sort_by The field to sort by. You can specify only one sort order. The default
579
+ # order for TIMECREATED is descending. The default order for DISPLAYNAME
580
+ # is ascending.
581
+ #
582
+ # Allowed values are: TIMECREATED, DISPLAYNAME
583
+ # @option opts [String] :sort_order The sort order to use, either ascending (`ASC`) or descending (`DESC`).
584
+ #
585
+ # Allowed values are: ASC, DESC
586
+ # @return [Response] A Response object with data of type Array<{OCI::KeyManagement::Models::KeySummary KeySummary}>
587
+ def list_keys(compartment_id, opts = {})
588
+ logger.debug 'Calling operation KmsManagementClient#list_keys.' if logger
589
+
590
+ raise "Missing the required parameter 'compartment_id' when calling list_keys." if compartment_id.nil?
591
+
592
+ if opts[:sort_by] && !%w[TIMECREATED DISPLAYNAME].include?(opts[:sort_by])
593
+ raise 'Invalid value for "sort_by", must be one of TIMECREATED, DISPLAYNAME.'
594
+ end
595
+
596
+ if opts[:sort_order] && !%w[ASC DESC].include?(opts[:sort_order])
597
+ raise 'Invalid value for "sort_order", must be one of ASC, DESC.'
598
+ end
599
+
600
+ path = '/keys'
601
+ operation_signing_strategy = :standard
602
+
603
+ # rubocop:disable Style/NegatedIf
604
+ # Query Params
605
+ query_params = {}
606
+ query_params[:compartmentId] = compartment_id
607
+ query_params[:limit] = opts[:limit] if opts[:limit]
608
+ query_params[:page] = opts[:page] if opts[:page]
609
+ query_params[:sortBy] = opts[:sort_by] if opts[:sort_by]
610
+ query_params[:sortOrder] = opts[:sort_order] if opts[:sort_order]
611
+
612
+ # Header Params
613
+ header_params = {}
614
+ header_params[:accept] = 'application/json'
615
+ header_params[:'content-type'] = 'application/json'
616
+ header_params[:'opc-request-id'] = opts[:opc_request_id] if opts[:opc_request_id]
617
+ # rubocop:enable Style/NegatedIf
618
+
619
+ post_body = nil
620
+
621
+ # rubocop:disable Metrics/BlockLength
622
+ OCI::Retry.make_retrying_call(applicable_retry_config(opts), call_name: 'KmsManagementClient#list_keys') do
623
+ @api_client.call_api(
624
+ :GET,
625
+ path,
626
+ endpoint,
627
+ header_params: header_params,
628
+ query_params: query_params,
629
+ operation_signing_strategy: operation_signing_strategy,
630
+ body: post_body,
631
+ return_type: 'Array<OCI::KeyManagement::Models::KeySummary>'
632
+ )
633
+ end
634
+ # rubocop:enable Metrics/BlockLength
635
+ end
636
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
637
+ # rubocop:enable Style/IfUnlessModifier, Metrics/ParameterLists
638
+ # rubocop:enable Metrics/MethodLength, Layout/EmptyLines
639
+
640
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
641
+ # rubocop:disable Style/IfUnlessModifier, Metrics/ParameterLists
642
+ # rubocop:disable Metrics/MethodLength, Layout/EmptyLines
643
+
644
+
645
+ # Updates the properties of a key. Specifically, you can
646
+ # only update the `displayName` property. Furthermore, the
647
+ # key must in an `ACTIVE` or `CREATING` state.
648
+ #
649
+ # @param [String] key_id The OCID of the key.
650
+ # @param [OCI::KeyManagement::Models::UpdateKeyDetails] update_key_details UpdateKeyDetails
651
+ # @param [Hash] opts the optional parameters
652
+ # @option opts [OCI::Retry::RetryConfig] :retry_config The retry configuration to apply to this operation. If no key is provided then the service-level
653
+ # retry configuration defined by {#retry_config} will be used. If an explicit `nil` value is provided then the operation will not retry
654
+ # @option opts [String] :if_match For optimistic concurrency control. In the PUT or DELETE call for a
655
+ # resource, set the `if-match` parameter to the value of the etag from a
656
+ # previous GET or POST response for that resource. The resource will be
657
+ # updated or deleted only if the etag you provide matches the resource's
658
+ # current etag value.
659
+ #
660
+ # @option opts [String] :opc_request_id Unique identifier for the request. If provided, the returned request ID
661
+ # will include this value. Otherwise, a random request ID will be
662
+ # generated by the service.
663
+ #
664
+ # @return [Response] A Response object with data of type {OCI::KeyManagement::Models::Key Key}
665
+ def update_key(key_id, update_key_details, opts = {})
666
+ logger.debug 'Calling operation KmsManagementClient#update_key.' if logger
667
+
668
+ raise "Missing the required parameter 'key_id' when calling update_key." if key_id.nil?
669
+ raise "Missing the required parameter 'update_key_details' when calling update_key." if update_key_details.nil?
670
+ raise "Parameter value for 'key_id' must not be blank" if OCI::Internal::Util.blank_string?(key_id)
671
+
672
+ path = '/keys/{keyId}'.sub('{keyId}', key_id.to_s)
673
+ operation_signing_strategy = :standard
674
+
675
+ # rubocop:disable Style/NegatedIf
676
+ # Query Params
677
+ query_params = {}
678
+
679
+ # Header Params
680
+ header_params = {}
681
+ header_params[:accept] = 'application/json'
682
+ header_params[:'content-type'] = 'application/json'
683
+ header_params[:'if-match'] = opts[:if_match] if opts[:if_match]
684
+ header_params[:'opc-request-id'] = opts[:opc_request_id] if opts[:opc_request_id]
685
+ # rubocop:enable Style/NegatedIf
686
+
687
+ post_body = @api_client.object_to_http_body(update_key_details)
688
+
689
+ # rubocop:disable Metrics/BlockLength
690
+ OCI::Retry.make_retrying_call(applicable_retry_config(opts), call_name: 'KmsManagementClient#update_key') do
691
+ @api_client.call_api(
692
+ :PUT,
693
+ path,
694
+ endpoint,
695
+ header_params: header_params,
696
+ query_params: query_params,
697
+ operation_signing_strategy: operation_signing_strategy,
698
+ body: post_body,
699
+ return_type: 'OCI::KeyManagement::Models::Key'
700
+ )
701
+ end
702
+ # rubocop:enable Metrics/BlockLength
703
+ end
704
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
705
+ # rubocop:enable Style/IfUnlessModifier, Metrics/ParameterLists
706
+ # rubocop:enable Metrics/MethodLength, Layout/EmptyLines
707
+
708
+ private
709
+
710
+ def applicable_retry_config(opts = {})
711
+ return @retry_config unless opts.key?(:retry_config)
712
+ opts[:retry_config]
713
+ end
714
+ end
715
+ end
716
+ # rubocop:enable Lint/UnneededCopDisableDirective, Metrics/LineLength