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,182 @@
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::KmsVaultClient} 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::KmsVaultClientCompositeOperations
10
+ # The {OCI::KeyManagement::KmsVaultClient} used to communicate with the service_client
11
+ #
12
+ # @return [OCI::KeyManagement::KmsVaultClient]
13
+ attr_reader :service_client
14
+
15
+ # Initializes a new KmsVaultClientCompositeOperations
16
+ #
17
+ # @param [OCI::KeyManagement::KmsVaultClient] service_client The client used to communicate with the service.
18
+ # Defaults to a new service client created via {OCI::KeyManagement::KmsVaultClient#initialize} with no arguments
19
+ def initialize(service_client = OCI::KeyManagement::KmsVaultClient.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::KmsVaultClient#cancel_vault_deletion} and then waits for the {OCI::KeyManagement::Models::Vault} acted upon
28
+ # to enter the given state(s).
29
+ #
30
+ # @param [String] vault_id The OCID of the vault.
31
+ # @param [Array<String>] wait_for_states An array of states to wait on. These should be valid values for {OCI::KeyManagement::Models::Vault#lifecycle_state}
32
+ # @param [Hash] base_operation_opts Any optional arguments accepted by {OCI::KeyManagement::KmsVaultClient#cancel_vault_deletion}
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::Vault}
38
+ def cancel_vault_deletion_and_wait_for_state(vault_id, wait_for_states = [], base_operation_opts = {}, waiter_opts = {})
39
+ operation_result = @service_client.cancel_vault_deletion(vault_id, 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_vault(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::KmsVaultClient#create_vault} and then waits for the {OCI::KeyManagement::Models::Vault} acted upon
67
+ # to enter the given state(s).
68
+ #
69
+ # @param [OCI::KeyManagement::Models::CreateVaultDetails] create_vault_details CreateVaultDetails
70
+ # @param [Array<String>] wait_for_states An array of states to wait on. These should be valid values for {OCI::KeyManagement::Models::Vault#lifecycle_state}
71
+ # @param [Hash] base_operation_opts Any optional arguments accepted by {OCI::KeyManagement::KmsVaultClient#create_vault}
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::Vault}
77
+ def create_vault_and_wait_for_state(create_vault_details, wait_for_states = [], base_operation_opts = {}, waiter_opts = {})
78
+ operation_result = @service_client.create_vault(create_vault_details, 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_vault(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::KmsVaultClient#schedule_vault_deletion} and then waits for the {OCI::KeyManagement::Models::Vault} acted upon
106
+ # to enter the given state(s).
107
+ #
108
+ # @param [String] vault_id The OCID of the vault.
109
+ # @param [OCI::KeyManagement::Models::ScheduleVaultDeletionDetails] schedule_vault_deletion_details ScheduleVaultDeletionDetails
110
+ # @param [Array<String>] wait_for_states An array of states to wait on. These should be valid values for {OCI::KeyManagement::Models::Vault#lifecycle_state}
111
+ # @param [Hash] base_operation_opts Any optional arguments accepted by {OCI::KeyManagement::KmsVaultClient#schedule_vault_deletion}
112
+ # @param [Hash] waiter_opts Optional arguments for the waiter. Keys should be symbols, and the following keys are supported:
113
+ # * max_interval_seconds: The maximum interval between queries, in seconds.
114
+ # * max_wait_seconds The maximum time to wait, in seconds
115
+ #
116
+ # @return [OCI::Response] A {OCI::Response} object with data of type {OCI::KeyManagement::Models::Vault}
117
+ def schedule_vault_deletion_and_wait_for_state(vault_id, schedule_vault_deletion_details, wait_for_states = [], base_operation_opts = {}, waiter_opts = {})
118
+ operation_result = @service_client.schedule_vault_deletion(vault_id, schedule_vault_deletion_details, base_operation_opts)
119
+
120
+ return operation_result if wait_for_states.empty?
121
+
122
+ lowered_wait_for_states = wait_for_states.map(&:downcase)
123
+ wait_for_resource_id = operation_result.data.id
124
+
125
+ begin
126
+ waiter_result = @service_client.get_vault(wait_for_resource_id).wait_until(
127
+ eval_proc: ->(response) { response.data.respond_to?(:lifecycle_state) && lowered_wait_for_states.include?(response.data.lifecycle_state.downcase) },
128
+ max_interval_seconds: waiter_opts.key?(:max_interval_seconds) ? waiter_opts[:max_interval_seconds] : 30,
129
+ max_wait_seconds: waiter_opts.key?(:max_wait_seconds) ? waiter_opts[:max_wait_seconds] : 1200
130
+ )
131
+ result_to_return = waiter_result
132
+
133
+ return result_to_return
134
+ rescue StandardError
135
+ raise OCI::Errors::CompositeOperationError.new(partial_results: [operation_result])
136
+ end
137
+ end
138
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/ParameterLists, Metrics/PerceivedComplexity
139
+ # rubocop:enable Layout/EmptyLines
140
+
141
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/ParameterLists, Metrics/PerceivedComplexity
142
+ # rubocop:disable Layout/EmptyLines
143
+
144
+
145
+ # Calls {OCI::KeyManagement::KmsVaultClient#update_vault} and then waits for the {OCI::KeyManagement::Models::Vault} acted upon
146
+ # to enter the given state(s).
147
+ #
148
+ # @param [String] vault_id The OCID of the vault.
149
+ # @param [OCI::KeyManagement::Models::UpdateVaultDetails] update_vault_details UpdateVaultDetails
150
+ # @param [Array<String>] wait_for_states An array of states to wait on. These should be valid values for {OCI::KeyManagement::Models::Vault#lifecycle_state}
151
+ # @param [Hash] base_operation_opts Any optional arguments accepted by {OCI::KeyManagement::KmsVaultClient#update_vault}
152
+ # @param [Hash] waiter_opts Optional arguments for the waiter. Keys should be symbols, and the following keys are supported:
153
+ # * max_interval_seconds: The maximum interval between queries, in seconds.
154
+ # * max_wait_seconds The maximum time to wait, in seconds
155
+ #
156
+ # @return [OCI::Response] A {OCI::Response} object with data of type {OCI::KeyManagement::Models::Vault}
157
+ def update_vault_and_wait_for_state(vault_id, update_vault_details, wait_for_states = [], base_operation_opts = {}, waiter_opts = {})
158
+ operation_result = @service_client.update_vault(vault_id, update_vault_details, base_operation_opts)
159
+
160
+ return operation_result if wait_for_states.empty?
161
+
162
+ lowered_wait_for_states = wait_for_states.map(&:downcase)
163
+ wait_for_resource_id = operation_result.data.id
164
+
165
+ begin
166
+ waiter_result = @service_client.get_vault(wait_for_resource_id).wait_until(
167
+ eval_proc: ->(response) { response.data.respond_to?(:lifecycle_state) && lowered_wait_for_states.include?(response.data.lifecycle_state.downcase) },
168
+ max_interval_seconds: waiter_opts.key?(:max_interval_seconds) ? waiter_opts[:max_interval_seconds] : 30,
169
+ max_wait_seconds: waiter_opts.key?(:max_wait_seconds) ? waiter_opts[:max_wait_seconds] : 1200
170
+ )
171
+ result_to_return = waiter_result
172
+
173
+ return result_to_return
174
+ rescue StandardError
175
+ raise OCI::Errors::CompositeOperationError.new(partial_results: [operation_result])
176
+ end
177
+ end
178
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/ParameterLists, Metrics/PerceivedComplexity
179
+ # rubocop:enable Layout/EmptyLines
180
+ end
181
+ end
182
+ # rubocop:enable Lint/UnneededCopDisableDirective, Metrics/LineLength
@@ -0,0 +1,180 @@
1
+ # Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
2
+
3
+ require 'date'
4
+
5
+ # rubocop:disable Lint/UnneededCopDisableDirective
6
+ module OCI
7
+ # CreateKeyDetails model.
8
+ class KeyManagement::Models::CreateKeyDetails # rubocop:disable Metrics/LineLength
9
+ # **[Required]** The OCID of the compartment that contains this key.
10
+ # @return [String]
11
+ attr_accessor :compartment_id
12
+
13
+ # **[Required]** A user-friendly name for the key. It does not have to be unique, and it is changeable.
14
+ # Avoid entering confidential information.
15
+ #
16
+ # @return [String]
17
+ attr_accessor :display_name
18
+
19
+ # This attribute is required.
20
+ # @return [OCI::KeyManagement::Models::KeyShape]
21
+ attr_accessor :key_shape
22
+
23
+ # Attribute mapping from ruby-style variable name to JSON key.
24
+ def self.attribute_map
25
+ {
26
+ # rubocop:disable Style/SymbolLiteral
27
+ 'compartment_id': :'compartmentId',
28
+ 'display_name': :'displayName',
29
+ 'key_shape': :'keyShape'
30
+ # rubocop:enable Style/SymbolLiteral
31
+ }
32
+ end
33
+
34
+ # Attribute type mapping.
35
+ def self.swagger_types
36
+ {
37
+ # rubocop:disable Style/SymbolLiteral
38
+ 'compartment_id': :'String',
39
+ 'display_name': :'String',
40
+ 'key_shape': :'OCI::KeyManagement::Models::KeyShape'
41
+ # rubocop:enable Style/SymbolLiteral
42
+ }
43
+ end
44
+
45
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
46
+ # rubocop:disable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
47
+
48
+
49
+ # Initializes the object
50
+ # @param [Hash] attributes Model attributes in the form of hash
51
+ # @option attributes [String] :compartment_id The value to assign to the {#compartment_id} property
52
+ # @option attributes [String] :display_name The value to assign to the {#display_name} property
53
+ # @option attributes [OCI::KeyManagement::Models::KeyShape] :key_shape The value to assign to the {#key_shape} property
54
+ def initialize(attributes = {})
55
+ return unless attributes.is_a?(Hash)
56
+
57
+ # convert string to symbol for hash key
58
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
59
+
60
+ self.compartment_id = attributes[:'compartmentId'] if attributes[:'compartmentId']
61
+
62
+ raise 'You cannot provide both :compartmentId and :compartment_id' if attributes.key?(:'compartmentId') && attributes.key?(:'compartment_id')
63
+
64
+ self.compartment_id = attributes[:'compartment_id'] if attributes[:'compartment_id']
65
+
66
+ self.display_name = attributes[:'displayName'] if attributes[:'displayName']
67
+
68
+ raise 'You cannot provide both :displayName and :display_name' if attributes.key?(:'displayName') && attributes.key?(:'display_name')
69
+
70
+ self.display_name = attributes[:'display_name'] if attributes[:'display_name']
71
+
72
+ self.key_shape = attributes[:'keyShape'] if attributes[:'keyShape']
73
+
74
+ raise 'You cannot provide both :keyShape and :key_shape' if attributes.key?(:'keyShape') && attributes.key?(:'key_shape')
75
+
76
+ self.key_shape = attributes[:'key_shape'] if attributes[:'key_shape']
77
+ end
78
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
79
+ # rubocop:enable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
80
+
81
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Layout/EmptyLines
82
+
83
+
84
+ # Checks equality by comparing each attribute.
85
+ # @param [Object] other the other object to be compared
86
+ def ==(other)
87
+ return true if equal?(other)
88
+ self.class == other.class &&
89
+ compartment_id == other.compartment_id &&
90
+ display_name == other.display_name &&
91
+ key_shape == other.key_shape
92
+ end
93
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Layout/EmptyLines
94
+
95
+ # @see the `==` method
96
+ # @param [Object] other the other object to be compared
97
+ def eql?(other)
98
+ self == other
99
+ end
100
+
101
+ # rubocop:disable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
102
+
103
+
104
+ # Calculates hash code according to all attributes.
105
+ # @return [Fixnum] Hash code
106
+ def hash
107
+ [compartment_id, display_name, key_shape].hash
108
+ end
109
+ # rubocop:enable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
110
+
111
+ # rubocop:disable Metrics/AbcSize, Layout/EmptyLines
112
+
113
+
114
+ # Builds the object from hash
115
+ # @param [Hash] attributes Model attributes in the form of hash
116
+ # @return [Object] Returns the model itself
117
+ def build_from_hash(attributes)
118
+ return nil unless attributes.is_a?(Hash)
119
+ self.class.swagger_types.each_pair do |key, type|
120
+ if type =~ /^Array<(.*)>/i
121
+ # check to ensure the input is an array given that the the attribute
122
+ # is documented as an array but the input is not
123
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
124
+ public_method("#{key}=").call(
125
+ attributes[self.class.attribute_map[key]]
126
+ .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
127
+ )
128
+ end
129
+ elsif !attributes[self.class.attribute_map[key]].nil?
130
+ public_method("#{key}=").call(
131
+ OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
132
+ )
133
+ end
134
+ # or else data not found in attributes(hash), not an issue as the data can be optional
135
+ end
136
+
137
+ self
138
+ end
139
+ # rubocop:enable Metrics/AbcSize, Layout/EmptyLines
140
+
141
+ # Returns the string representation of the object
142
+ # @return [String] String presentation of the object
143
+ def to_s
144
+ to_hash.to_s
145
+ end
146
+
147
+ # Returns the object in the form of hash
148
+ # @return [Hash] Returns the object in the form of hash
149
+ def to_hash
150
+ hash = {}
151
+ self.class.attribute_map.each_pair do |attr, param|
152
+ value = public_method(attr).call
153
+ next if value.nil? && !instance_variable_defined?("@#{attr}")
154
+ hash[param] = _to_hash(value)
155
+ end
156
+ hash
157
+ end
158
+
159
+ private
160
+
161
+ # Outputs non-array value in the form of hash
162
+ # For object, use to_hash. Otherwise, just return the value
163
+ # @param [Object] value Any valid value
164
+ # @return [Hash] Returns the value in the form of hash
165
+ def _to_hash(value)
166
+ if value.is_a?(Array)
167
+ value.compact.map { |v| _to_hash(v) }
168
+ elsif value.is_a?(Hash)
169
+ {}.tap do |hash|
170
+ value.each { |k, v| hash[k] = _to_hash(v) }
171
+ end
172
+ elsif value.respond_to? :to_hash
173
+ value.to_hash
174
+ else
175
+ value
176
+ end
177
+ end
178
+ end
179
+ end
180
+ # rubocop:enable Lint/UnneededCopDisableDirective
@@ -0,0 +1,194 @@
1
+ # Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
2
+
3
+ require 'date'
4
+
5
+ # rubocop:disable Lint/UnneededCopDisableDirective
6
+ module OCI
7
+ # CreateVaultDetails model.
8
+ class KeyManagement::Models::CreateVaultDetails # rubocop:disable Metrics/LineLength
9
+ VAULT_TYPE_ENUM = [
10
+ VAULT_TYPE_VIRTUAL_PRIVATE = 'VIRTUAL_PRIVATE'.freeze
11
+ ].freeze
12
+
13
+ # **[Required]** The OCID of the compartment where you want to create this vault.
14
+ # @return [String]
15
+ attr_accessor :compartment_id
16
+
17
+ # **[Required]** A user-friendly name for the vault. It does not have to be unique, and it is changeable.
18
+ # Avoid entering confidential information.
19
+ #
20
+ # @return [String]
21
+ attr_accessor :display_name
22
+
23
+ # **[Required]** The type of vault to create. Each type of vault stores the key with different degrees of isolation and has different options and pricing.
24
+ #
25
+ # @return [String]
26
+ attr_reader :vault_type
27
+
28
+ # Attribute mapping from ruby-style variable name to JSON key.
29
+ def self.attribute_map
30
+ {
31
+ # rubocop:disable Style/SymbolLiteral
32
+ 'compartment_id': :'compartmentId',
33
+ 'display_name': :'displayName',
34
+ 'vault_type': :'vaultType'
35
+ # rubocop:enable Style/SymbolLiteral
36
+ }
37
+ end
38
+
39
+ # Attribute type mapping.
40
+ def self.swagger_types
41
+ {
42
+ # rubocop:disable Style/SymbolLiteral
43
+ 'compartment_id': :'String',
44
+ 'display_name': :'String',
45
+ 'vault_type': :'String'
46
+ # rubocop:enable Style/SymbolLiteral
47
+ }
48
+ end
49
+
50
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
51
+ # rubocop:disable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
52
+
53
+
54
+ # Initializes the object
55
+ # @param [Hash] attributes Model attributes in the form of hash
56
+ # @option attributes [String] :compartment_id The value to assign to the {#compartment_id} property
57
+ # @option attributes [String] :display_name The value to assign to the {#display_name} property
58
+ # @option attributes [String] :vault_type The value to assign to the {#vault_type} property
59
+ def initialize(attributes = {})
60
+ return unless attributes.is_a?(Hash)
61
+
62
+ # convert string to symbol for hash key
63
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
64
+
65
+ self.compartment_id = attributes[:'compartmentId'] if attributes[:'compartmentId']
66
+
67
+ raise 'You cannot provide both :compartmentId and :compartment_id' if attributes.key?(:'compartmentId') && attributes.key?(:'compartment_id')
68
+
69
+ self.compartment_id = attributes[:'compartment_id'] if attributes[:'compartment_id']
70
+
71
+ self.display_name = attributes[:'displayName'] if attributes[:'displayName']
72
+
73
+ raise 'You cannot provide both :displayName and :display_name' if attributes.key?(:'displayName') && attributes.key?(:'display_name')
74
+
75
+ self.display_name = attributes[:'display_name'] if attributes[:'display_name']
76
+
77
+ self.vault_type = attributes[:'vaultType'] if attributes[:'vaultType']
78
+
79
+ raise 'You cannot provide both :vaultType and :vault_type' if attributes.key?(:'vaultType') && attributes.key?(:'vault_type')
80
+
81
+ self.vault_type = attributes[:'vault_type'] if attributes[:'vault_type']
82
+ end
83
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
84
+ # rubocop:enable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
85
+
86
+ # Custom attribute writer method checking allowed values (enum).
87
+ # @param [Object] vault_type Object to be assigned
88
+ def vault_type=(vault_type)
89
+ # rubocop: disable Metrics/LineLength
90
+ raise "Invalid value for 'vault_type': this must be one of the values in VAULT_TYPE_ENUM." if vault_type && !VAULT_TYPE_ENUM.include?(vault_type)
91
+ # rubocop: enable Metrics/LineLength
92
+ @vault_type = vault_type
93
+ end
94
+
95
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Layout/EmptyLines
96
+
97
+
98
+ # Checks equality by comparing each attribute.
99
+ # @param [Object] other the other object to be compared
100
+ def ==(other)
101
+ return true if equal?(other)
102
+ self.class == other.class &&
103
+ compartment_id == other.compartment_id &&
104
+ display_name == other.display_name &&
105
+ vault_type == other.vault_type
106
+ end
107
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Layout/EmptyLines
108
+
109
+ # @see the `==` method
110
+ # @param [Object] other the other object to be compared
111
+ def eql?(other)
112
+ self == other
113
+ end
114
+
115
+ # rubocop:disable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
116
+
117
+
118
+ # Calculates hash code according to all attributes.
119
+ # @return [Fixnum] Hash code
120
+ def hash
121
+ [compartment_id, display_name, vault_type].hash
122
+ end
123
+ # rubocop:enable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
124
+
125
+ # rubocop:disable Metrics/AbcSize, Layout/EmptyLines
126
+
127
+
128
+ # Builds the object from hash
129
+ # @param [Hash] attributes Model attributes in the form of hash
130
+ # @return [Object] Returns the model itself
131
+ def build_from_hash(attributes)
132
+ return nil unless attributes.is_a?(Hash)
133
+ self.class.swagger_types.each_pair do |key, type|
134
+ if type =~ /^Array<(.*)>/i
135
+ # check to ensure the input is an array given that the the attribute
136
+ # is documented as an array but the input is not
137
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
138
+ public_method("#{key}=").call(
139
+ attributes[self.class.attribute_map[key]]
140
+ .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
141
+ )
142
+ end
143
+ elsif !attributes[self.class.attribute_map[key]].nil?
144
+ public_method("#{key}=").call(
145
+ OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
146
+ )
147
+ end
148
+ # or else data not found in attributes(hash), not an issue as the data can be optional
149
+ end
150
+
151
+ self
152
+ end
153
+ # rubocop:enable Metrics/AbcSize, Layout/EmptyLines
154
+
155
+ # Returns the string representation of the object
156
+ # @return [String] String presentation of the object
157
+ def to_s
158
+ to_hash.to_s
159
+ end
160
+
161
+ # Returns the object in the form of hash
162
+ # @return [Hash] Returns the object in the form of hash
163
+ def to_hash
164
+ hash = {}
165
+ self.class.attribute_map.each_pair do |attr, param|
166
+ value = public_method(attr).call
167
+ next if value.nil? && !instance_variable_defined?("@#{attr}")
168
+ hash[param] = _to_hash(value)
169
+ end
170
+ hash
171
+ end
172
+
173
+ private
174
+
175
+ # Outputs non-array value in the form of hash
176
+ # For object, use to_hash. Otherwise, just return the value
177
+ # @param [Object] value Any valid value
178
+ # @return [Hash] Returns the value in the form of hash
179
+ def _to_hash(value)
180
+ if value.is_a?(Array)
181
+ value.compact.map { |v| _to_hash(v) }
182
+ elsif value.is_a?(Hash)
183
+ {}.tap do |hash|
184
+ value.each { |k, v| hash[k] = _to_hash(v) }
185
+ end
186
+ elsif value.respond_to? :to_hash
187
+ value.to_hash
188
+ else
189
+ value
190
+ end
191
+ end
192
+ end
193
+ end
194
+ # rubocop:enable Lint/UnneededCopDisableDirective