oci 2.3.6 → 2.3.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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
@@ -26,6 +26,7 @@ module OCI
26
26
  NETWORK_TYPE_ENUM = [
27
27
  NETWORK_TYPE_E1000 = 'E1000'.freeze,
28
28
  NETWORK_TYPE_VFIO = 'VFIO'.freeze,
29
+ NETWORK_TYPE_PARAVIRTUALIZED = 'PARAVIRTUALIZED'.freeze,
29
30
  NETWORK_TYPE_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
30
31
  ].freeze
31
32
 
@@ -62,6 +63,7 @@ module OCI
62
63
  # **[Required]** Emulation type for NIC.
63
64
  # * `E1000` - Emulated Gigabit ethernet controller. Compatible with Linux e1000 network driver.
64
65
  # * `VFIO` - Direct attached Virtual Function network controller. Default for Oracle provided images.
66
+ # * `PARAVIRTUALIZED` - VM instances launch with paravirtualized devices using virtio drivers.
65
67
  #
66
68
  # @return [String]
67
69
  attr_reader :network_type
@@ -0,0 +1,154 @@
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
+ # UpdateBootVolumeKmsKeyDetails model.
8
+ class Core::Models::UpdateBootVolumeKmsKeyDetails # rubocop:disable Metrics/LineLength
9
+ # The new kms key which will be used to protect the specific volume.
10
+ # This key has to be a valid kms key ocid, and user must have key delegation policy to allow them to access this key.
11
+ # Even if this new kms key is the same as the previous kms key id, block storage service will use it to regenerate a new volume encryption key.
12
+ # Example: `{\"kmsKeyId\": \"ocid1.key.region1.sea.afnl2n7daag4s.abzwkljs6uevhlgcznhmh7oiatyrxngrywc3tje3uk3g77hzmewqiieuk75f\"}`
13
+ #
14
+ # @return [String]
15
+ attr_accessor :kms_key_id
16
+
17
+ # Attribute mapping from ruby-style variable name to JSON key.
18
+ def self.attribute_map
19
+ {
20
+ # rubocop:disable Style/SymbolLiteral
21
+ 'kms_key_id': :'kmsKeyId'
22
+ # rubocop:enable Style/SymbolLiteral
23
+ }
24
+ end
25
+
26
+ # Attribute type mapping.
27
+ def self.swagger_types
28
+ {
29
+ # rubocop:disable Style/SymbolLiteral
30
+ 'kms_key_id': :'String'
31
+ # rubocop:enable Style/SymbolLiteral
32
+ }
33
+ end
34
+
35
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
36
+ # rubocop:disable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
37
+
38
+
39
+ # Initializes the object
40
+ # @param [Hash] attributes Model attributes in the form of hash
41
+ # @option attributes [String] :kms_key_id The value to assign to the {#kms_key_id} property
42
+ def initialize(attributes = {})
43
+ return unless attributes.is_a?(Hash)
44
+
45
+ # convert string to symbol for hash key
46
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
47
+
48
+ self.kms_key_id = attributes[:'kmsKeyId'] if attributes[:'kmsKeyId']
49
+
50
+ raise 'You cannot provide both :kmsKeyId and :kms_key_id' if attributes.key?(:'kmsKeyId') && attributes.key?(:'kms_key_id')
51
+
52
+ self.kms_key_id = attributes[:'kms_key_id'] if attributes[:'kms_key_id']
53
+ end
54
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
55
+ # rubocop:enable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
56
+
57
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Layout/EmptyLines
58
+
59
+
60
+ # Checks equality by comparing each attribute.
61
+ # @param [Object] other the other object to be compared
62
+ def ==(other)
63
+ return true if equal?(other)
64
+ self.class == other.class &&
65
+ kms_key_id == other.kms_key_id
66
+ end
67
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Layout/EmptyLines
68
+
69
+ # @see the `==` method
70
+ # @param [Object] other the other object to be compared
71
+ def eql?(other)
72
+ self == other
73
+ end
74
+
75
+ # rubocop:disable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
76
+
77
+
78
+ # Calculates hash code according to all attributes.
79
+ # @return [Fixnum] Hash code
80
+ def hash
81
+ [kms_key_id].hash
82
+ end
83
+ # rubocop:enable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
84
+
85
+ # rubocop:disable Metrics/AbcSize, Layout/EmptyLines
86
+
87
+
88
+ # Builds the object from hash
89
+ # @param [Hash] attributes Model attributes in the form of hash
90
+ # @return [Object] Returns the model itself
91
+ def build_from_hash(attributes)
92
+ return nil unless attributes.is_a?(Hash)
93
+ self.class.swagger_types.each_pair do |key, type|
94
+ if type =~ /^Array<(.*)>/i
95
+ # check to ensure the input is an array given that the the attribute
96
+ # is documented as an array but the input is not
97
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
98
+ public_method("#{key}=").call(
99
+ attributes[self.class.attribute_map[key]]
100
+ .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
101
+ )
102
+ end
103
+ elsif !attributes[self.class.attribute_map[key]].nil?
104
+ public_method("#{key}=").call(
105
+ OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
106
+ )
107
+ end
108
+ # or else data not found in attributes(hash), not an issue as the data can be optional
109
+ end
110
+
111
+ self
112
+ end
113
+ # rubocop:enable Metrics/AbcSize, Layout/EmptyLines
114
+
115
+ # Returns the string representation of the object
116
+ # @return [String] String presentation of the object
117
+ def to_s
118
+ to_hash.to_s
119
+ end
120
+
121
+ # Returns the object in the form of hash
122
+ # @return [Hash] Returns the object in the form of hash
123
+ def to_hash
124
+ hash = {}
125
+ self.class.attribute_map.each_pair do |attr, param|
126
+ value = public_method(attr).call
127
+ next if value.nil? && !instance_variable_defined?("@#{attr}")
128
+ hash[param] = _to_hash(value)
129
+ end
130
+ hash
131
+ end
132
+
133
+ private
134
+
135
+ # Outputs non-array value in the form of hash
136
+ # For object, use to_hash. Otherwise, just return the value
137
+ # @param [Object] value Any valid value
138
+ # @return [Hash] Returns the value in the form of hash
139
+ def _to_hash(value)
140
+ if value.is_a?(Array)
141
+ value.compact.map { |v| _to_hash(v) }
142
+ elsif value.is_a?(Hash)
143
+ {}.tap do |hash|
144
+ value.each { |k, v| hash[k] = _to_hash(v) }
145
+ end
146
+ elsif value.respond_to? :to_hash
147
+ value.to_hash
148
+ else
149
+ value
150
+ end
151
+ end
152
+ end
153
+ end
154
+ # rubocop:enable Lint/UnneededCopDisableDirective
@@ -0,0 +1,154 @@
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
+ # UpdateVolumeKmsKeyDetails model.
8
+ class Core::Models::UpdateVolumeKmsKeyDetails # rubocop:disable Metrics/LineLength
9
+ # The new kms key which will be used to protect the specific volume.
10
+ # This key has to be a valid kms key ocid, and user must have key delegation policy to allow them to access this key.
11
+ # Even if this new kms key is the same as the previous kms key id, block storage service will use it to regenerate a new volume encryption key.
12
+ # Example: `{\"kmsKeyId\": \"ocid1.key.region1.sea.afnl2n7daag4s.abzwkljs6uevhlgcznhmh7oiatyrxngrywc3tje3uk3g77hzmewqiieuk75f\"}`
13
+ #
14
+ # @return [String]
15
+ attr_accessor :kms_key_id
16
+
17
+ # Attribute mapping from ruby-style variable name to JSON key.
18
+ def self.attribute_map
19
+ {
20
+ # rubocop:disable Style/SymbolLiteral
21
+ 'kms_key_id': :'kmsKeyId'
22
+ # rubocop:enable Style/SymbolLiteral
23
+ }
24
+ end
25
+
26
+ # Attribute type mapping.
27
+ def self.swagger_types
28
+ {
29
+ # rubocop:disable Style/SymbolLiteral
30
+ 'kms_key_id': :'String'
31
+ # rubocop:enable Style/SymbolLiteral
32
+ }
33
+ end
34
+
35
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
36
+ # rubocop:disable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
37
+
38
+
39
+ # Initializes the object
40
+ # @param [Hash] attributes Model attributes in the form of hash
41
+ # @option attributes [String] :kms_key_id The value to assign to the {#kms_key_id} property
42
+ def initialize(attributes = {})
43
+ return unless attributes.is_a?(Hash)
44
+
45
+ # convert string to symbol for hash key
46
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
47
+
48
+ self.kms_key_id = attributes[:'kmsKeyId'] if attributes[:'kmsKeyId']
49
+
50
+ raise 'You cannot provide both :kmsKeyId and :kms_key_id' if attributes.key?(:'kmsKeyId') && attributes.key?(:'kms_key_id')
51
+
52
+ self.kms_key_id = attributes[:'kms_key_id'] if attributes[:'kms_key_id']
53
+ end
54
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
55
+ # rubocop:enable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
56
+
57
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Layout/EmptyLines
58
+
59
+
60
+ # Checks equality by comparing each attribute.
61
+ # @param [Object] other the other object to be compared
62
+ def ==(other)
63
+ return true if equal?(other)
64
+ self.class == other.class &&
65
+ kms_key_id == other.kms_key_id
66
+ end
67
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Layout/EmptyLines
68
+
69
+ # @see the `==` method
70
+ # @param [Object] other the other object to be compared
71
+ def eql?(other)
72
+ self == other
73
+ end
74
+
75
+ # rubocop:disable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
76
+
77
+
78
+ # Calculates hash code according to all attributes.
79
+ # @return [Fixnum] Hash code
80
+ def hash
81
+ [kms_key_id].hash
82
+ end
83
+ # rubocop:enable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
84
+
85
+ # rubocop:disable Metrics/AbcSize, Layout/EmptyLines
86
+
87
+
88
+ # Builds the object from hash
89
+ # @param [Hash] attributes Model attributes in the form of hash
90
+ # @return [Object] Returns the model itself
91
+ def build_from_hash(attributes)
92
+ return nil unless attributes.is_a?(Hash)
93
+ self.class.swagger_types.each_pair do |key, type|
94
+ if type =~ /^Array<(.*)>/i
95
+ # check to ensure the input is an array given that the the attribute
96
+ # is documented as an array but the input is not
97
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
98
+ public_method("#{key}=").call(
99
+ attributes[self.class.attribute_map[key]]
100
+ .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
101
+ )
102
+ end
103
+ elsif !attributes[self.class.attribute_map[key]].nil?
104
+ public_method("#{key}=").call(
105
+ OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
106
+ )
107
+ end
108
+ # or else data not found in attributes(hash), not an issue as the data can be optional
109
+ end
110
+
111
+ self
112
+ end
113
+ # rubocop:enable Metrics/AbcSize, Layout/EmptyLines
114
+
115
+ # Returns the string representation of the object
116
+ # @return [String] String presentation of the object
117
+ def to_s
118
+ to_hash.to_s
119
+ end
120
+
121
+ # Returns the object in the form of hash
122
+ # @return [Hash] Returns the object in the form of hash
123
+ def to_hash
124
+ hash = {}
125
+ self.class.attribute_map.each_pair do |attr, param|
126
+ value = public_method(attr).call
127
+ next if value.nil? && !instance_variable_defined?("@#{attr}")
128
+ hash[param] = _to_hash(value)
129
+ end
130
+ hash
131
+ end
132
+
133
+ private
134
+
135
+ # Outputs non-array value in the form of hash
136
+ # For object, use to_hash. Otherwise, just return the value
137
+ # @param [Object] value Any valid value
138
+ # @return [Hash] Returns the value in the form of hash
139
+ def _to_hash(value)
140
+ if value.is_a?(Array)
141
+ value.compact.map { |v| _to_hash(v) }
142
+ elsif value.is_a?(Hash)
143
+ {}.tap do |hash|
144
+ value.each { |k, v| hash[k] = _to_hash(v) }
145
+ end
146
+ elsif value.respond_to? :to_hash
147
+ value.to_hash
148
+ else
149
+ value
150
+ end
151
+ end
152
+ end
153
+ end
154
+ # rubocop:enable Lint/UnneededCopDisableDirective
@@ -69,6 +69,10 @@ module OCI
69
69
  # @return [BOOLEAN]
70
70
  attr_accessor :is_hydrated
71
71
 
72
+ # The OCID of the KMS key which is the master encryption key for the volume.
73
+ # @return [String]
74
+ attr_accessor :kms_key_id
75
+
72
76
  # **[Required]** The current state of a volume.
73
77
  # @return [String]
74
78
  attr_reader :lifecycle_state
@@ -106,6 +110,7 @@ module OCI
106
110
  'freeform_tags': :'freeformTags',
107
111
  'id': :'id',
108
112
  'is_hydrated': :'isHydrated',
113
+ 'kms_key_id': :'kmsKeyId',
109
114
  'lifecycle_state': :'lifecycleState',
110
115
  'size_in_gbs': :'sizeInGBs',
111
116
  'size_in_mbs': :'sizeInMBs',
@@ -127,6 +132,7 @@ module OCI
127
132
  'freeform_tags': :'Hash<String, String>',
128
133
  'id': :'String',
129
134
  'is_hydrated': :'BOOLEAN',
135
+ 'kms_key_id': :'String',
130
136
  'lifecycle_state': :'String',
131
137
  'size_in_gbs': :'Integer',
132
138
  'size_in_mbs': :'Integer',
@@ -150,6 +156,7 @@ module OCI
150
156
  # @option attributes [Hash<String, String>] :freeform_tags The value to assign to the {#freeform_tags} property
151
157
  # @option attributes [String] :id The value to assign to the {#id} property
152
158
  # @option attributes [BOOLEAN] :is_hydrated The value to assign to the {#is_hydrated} property
159
+ # @option attributes [String] :kms_key_id The value to assign to the {#kms_key_id} property
153
160
  # @option attributes [String] :lifecycle_state The value to assign to the {#lifecycle_state} property
154
161
  # @option attributes [Integer] :size_in_gbs The value to assign to the {#size_in_gbs} property
155
162
  # @option attributes [Integer] :size_in_mbs The value to assign to the {#size_in_mbs} property
@@ -200,6 +207,12 @@ module OCI
200
207
 
201
208
  self.is_hydrated = attributes[:'is_hydrated'] unless attributes[:'is_hydrated'].nil?
202
209
 
210
+ self.kms_key_id = attributes[:'kmsKeyId'] if attributes[:'kmsKeyId']
211
+
212
+ raise 'You cannot provide both :kmsKeyId and :kms_key_id' if attributes.key?(:'kmsKeyId') && attributes.key?(:'kms_key_id')
213
+
214
+ self.kms_key_id = attributes[:'kms_key_id'] if attributes[:'kms_key_id']
215
+
203
216
  self.lifecycle_state = attributes[:'lifecycleState'] if attributes[:'lifecycleState']
204
217
 
205
218
  raise 'You cannot provide both :lifecycleState and :lifecycle_state' if attributes.key?(:'lifecycleState') && attributes.key?(:'lifecycle_state')
@@ -269,6 +282,7 @@ module OCI
269
282
  freeform_tags == other.freeform_tags &&
270
283
  id == other.id &&
271
284
  is_hydrated == other.is_hydrated &&
285
+ kms_key_id == other.kms_key_id &&
272
286
  lifecycle_state == other.lifecycle_state &&
273
287
  size_in_gbs == other.size_in_gbs &&
274
288
  size_in_mbs == other.size_in_mbs &&
@@ -290,7 +304,7 @@ module OCI
290
304
  # Calculates hash code according to all attributes.
291
305
  # @return [Fixnum] Hash code
292
306
  def hash
293
- [availability_domain, compartment_id, defined_tags, display_name, freeform_tags, id, is_hydrated, lifecycle_state, size_in_gbs, size_in_mbs, source_details, time_created, volume_group_id].hash
307
+ [availability_domain, compartment_id, defined_tags, display_name, freeform_tags, id, is_hydrated, kms_key_id, lifecycle_state, size_in_gbs, size_in_mbs, source_details, time_created, volume_group_id].hash
294
308
  end
295
309
  # rubocop:enable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
296
310
 
@@ -0,0 +1,152 @@
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
+ # Kms key id associated with this volume.
8
+ #
9
+ class Core::Models::VolumeKmsKey # rubocop:disable Metrics/LineLength
10
+ # Kms key id associated with this volume. If volume is not using KMS, then kmsKeyId will be null string.
11
+ #
12
+ # @return [String]
13
+ attr_accessor :kms_key_id
14
+
15
+ # Attribute mapping from ruby-style variable name to JSON key.
16
+ def self.attribute_map
17
+ {
18
+ # rubocop:disable Style/SymbolLiteral
19
+ 'kms_key_id': :'kmsKeyId'
20
+ # rubocop:enable Style/SymbolLiteral
21
+ }
22
+ end
23
+
24
+ # Attribute type mapping.
25
+ def self.swagger_types
26
+ {
27
+ # rubocop:disable Style/SymbolLiteral
28
+ 'kms_key_id': :'String'
29
+ # rubocop:enable Style/SymbolLiteral
30
+ }
31
+ end
32
+
33
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
34
+ # rubocop:disable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
35
+
36
+
37
+ # Initializes the object
38
+ # @param [Hash] attributes Model attributes in the form of hash
39
+ # @option attributes [String] :kms_key_id The value to assign to the {#kms_key_id} property
40
+ def initialize(attributes = {})
41
+ return unless attributes.is_a?(Hash)
42
+
43
+ # convert string to symbol for hash key
44
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
45
+
46
+ self.kms_key_id = attributes[:'kmsKeyId'] if attributes[:'kmsKeyId']
47
+
48
+ raise 'You cannot provide both :kmsKeyId and :kms_key_id' if attributes.key?(:'kmsKeyId') && attributes.key?(:'kms_key_id')
49
+
50
+ self.kms_key_id = attributes[:'kms_key_id'] if attributes[:'kms_key_id']
51
+ end
52
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
53
+ # rubocop:enable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
54
+
55
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Layout/EmptyLines
56
+
57
+
58
+ # Checks equality by comparing each attribute.
59
+ # @param [Object] other the other object to be compared
60
+ def ==(other)
61
+ return true if equal?(other)
62
+ self.class == other.class &&
63
+ kms_key_id == other.kms_key_id
64
+ end
65
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Layout/EmptyLines
66
+
67
+ # @see the `==` method
68
+ # @param [Object] other the other object to be compared
69
+ def eql?(other)
70
+ self == other
71
+ end
72
+
73
+ # rubocop:disable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
74
+
75
+
76
+ # Calculates hash code according to all attributes.
77
+ # @return [Fixnum] Hash code
78
+ def hash
79
+ [kms_key_id].hash
80
+ end
81
+ # rubocop:enable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
82
+
83
+ # rubocop:disable Metrics/AbcSize, Layout/EmptyLines
84
+
85
+
86
+ # Builds the object from hash
87
+ # @param [Hash] attributes Model attributes in the form of hash
88
+ # @return [Object] Returns the model itself
89
+ def build_from_hash(attributes)
90
+ return nil unless attributes.is_a?(Hash)
91
+ self.class.swagger_types.each_pair do |key, type|
92
+ if type =~ /^Array<(.*)>/i
93
+ # check to ensure the input is an array given that the the attribute
94
+ # is documented as an array but the input is not
95
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
96
+ public_method("#{key}=").call(
97
+ attributes[self.class.attribute_map[key]]
98
+ .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
99
+ )
100
+ end
101
+ elsif !attributes[self.class.attribute_map[key]].nil?
102
+ public_method("#{key}=").call(
103
+ OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
104
+ )
105
+ end
106
+ # or else data not found in attributes(hash), not an issue as the data can be optional
107
+ end
108
+
109
+ self
110
+ end
111
+ # rubocop:enable Metrics/AbcSize, Layout/EmptyLines
112
+
113
+ # Returns the string representation of the object
114
+ # @return [String] String presentation of the object
115
+ def to_s
116
+ to_hash.to_s
117
+ end
118
+
119
+ # Returns the object in the form of hash
120
+ # @return [Hash] Returns the object in the form of hash
121
+ def to_hash
122
+ hash = {}
123
+ self.class.attribute_map.each_pair do |attr, param|
124
+ value = public_method(attr).call
125
+ next if value.nil? && !instance_variable_defined?("@#{attr}")
126
+ hash[param] = _to_hash(value)
127
+ end
128
+ hash
129
+ end
130
+
131
+ private
132
+
133
+ # Outputs non-array value in the form of hash
134
+ # For object, use to_hash. Otherwise, just return the value
135
+ # @param [Object] value Any valid value
136
+ # @return [Hash] Returns the value in the form of hash
137
+ def _to_hash(value)
138
+ if value.is_a?(Array)
139
+ value.compact.map { |v| _to_hash(v) }
140
+ elsif value.is_a?(Hash)
141
+ {}.tap do |hash|
142
+ value.each { |k, v| hash[k] = _to_hash(v) }
143
+ end
144
+ elsif value.respond_to? :to_hash
145
+ value.to_hash
146
+ else
147
+ value
148
+ end
149
+ end
150
+ end
151
+ end
152
+ # rubocop:enable Lint/UnneededCopDisableDirective