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,205 @@
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
+ # KeyVersionSummary model.
8
+ class KeyManagement::Models::KeyVersionSummary # rubocop:disable Metrics/LineLength
9
+ # **[Required]** The OCID of the compartment that contains this key version.
10
+ # @return [String]
11
+ attr_accessor :compartment_id
12
+
13
+ # **[Required]** The OCID of the key version.
14
+ # @return [String]
15
+ attr_accessor :id
16
+
17
+ # **[Required]** The OCID of the key associated with this key version.
18
+ # @return [String]
19
+ attr_accessor :key_id
20
+
21
+ # **[Required]** The date and time this key version was created, expressed in [RFC 3339](https://tools.ietf.org/html/rfc3339) timestamp format.
22
+ #
23
+ # Example: `2018-04-03T21:10:29.600Z`
24
+ #
25
+ # @return [DateTime]
26
+ attr_accessor :time_created
27
+
28
+ # **[Required]** The OCID of the vault that contains this key version.
29
+ # @return [String]
30
+ attr_accessor :vault_id
31
+
32
+ # Attribute mapping from ruby-style variable name to JSON key.
33
+ def self.attribute_map
34
+ {
35
+ # rubocop:disable Style/SymbolLiteral
36
+ 'compartment_id': :'compartmentId',
37
+ 'id': :'id',
38
+ 'key_id': :'keyId',
39
+ 'time_created': :'timeCreated',
40
+ 'vault_id': :'vaultId'
41
+ # rubocop:enable Style/SymbolLiteral
42
+ }
43
+ end
44
+
45
+ # Attribute type mapping.
46
+ def self.swagger_types
47
+ {
48
+ # rubocop:disable Style/SymbolLiteral
49
+ 'compartment_id': :'String',
50
+ 'id': :'String',
51
+ 'key_id': :'String',
52
+ 'time_created': :'DateTime',
53
+ 'vault_id': :'String'
54
+ # rubocop:enable Style/SymbolLiteral
55
+ }
56
+ end
57
+
58
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
59
+ # rubocop:disable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
60
+
61
+
62
+ # Initializes the object
63
+ # @param [Hash] attributes Model attributes in the form of hash
64
+ # @option attributes [String] :compartment_id The value to assign to the {#compartment_id} property
65
+ # @option attributes [String] :id The value to assign to the {#id} property
66
+ # @option attributes [String] :key_id The value to assign to the {#key_id} property
67
+ # @option attributes [DateTime] :time_created The value to assign to the {#time_created} property
68
+ # @option attributes [String] :vault_id The value to assign to the {#vault_id} property
69
+ def initialize(attributes = {})
70
+ return unless attributes.is_a?(Hash)
71
+
72
+ # convert string to symbol for hash key
73
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
74
+
75
+ self.compartment_id = attributes[:'compartmentId'] if attributes[:'compartmentId']
76
+
77
+ raise 'You cannot provide both :compartmentId and :compartment_id' if attributes.key?(:'compartmentId') && attributes.key?(:'compartment_id')
78
+
79
+ self.compartment_id = attributes[:'compartment_id'] if attributes[:'compartment_id']
80
+
81
+ self.id = attributes[:'id'] if attributes[:'id']
82
+
83
+ self.key_id = attributes[:'keyId'] if attributes[:'keyId']
84
+
85
+ raise 'You cannot provide both :keyId and :key_id' if attributes.key?(:'keyId') && attributes.key?(:'key_id')
86
+
87
+ self.key_id = attributes[:'key_id'] if attributes[:'key_id']
88
+
89
+ self.time_created = attributes[:'timeCreated'] if attributes[:'timeCreated']
90
+
91
+ raise 'You cannot provide both :timeCreated and :time_created' if attributes.key?(:'timeCreated') && attributes.key?(:'time_created')
92
+
93
+ self.time_created = attributes[:'time_created'] if attributes[:'time_created']
94
+
95
+ self.vault_id = attributes[:'vaultId'] if attributes[:'vaultId']
96
+
97
+ raise 'You cannot provide both :vaultId and :vault_id' if attributes.key?(:'vaultId') && attributes.key?(:'vault_id')
98
+
99
+ self.vault_id = attributes[:'vault_id'] if attributes[:'vault_id']
100
+ end
101
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
102
+ # rubocop:enable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
103
+
104
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Layout/EmptyLines
105
+
106
+
107
+ # Checks equality by comparing each attribute.
108
+ # @param [Object] other the other object to be compared
109
+ def ==(other)
110
+ return true if equal?(other)
111
+ self.class == other.class &&
112
+ compartment_id == other.compartment_id &&
113
+ id == other.id &&
114
+ key_id == other.key_id &&
115
+ time_created == other.time_created &&
116
+ vault_id == other.vault_id
117
+ end
118
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Layout/EmptyLines
119
+
120
+ # @see the `==` method
121
+ # @param [Object] other the other object to be compared
122
+ def eql?(other)
123
+ self == other
124
+ end
125
+
126
+ # rubocop:disable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
127
+
128
+
129
+ # Calculates hash code according to all attributes.
130
+ # @return [Fixnum] Hash code
131
+ def hash
132
+ [compartment_id, id, key_id, time_created, vault_id].hash
133
+ end
134
+ # rubocop:enable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
135
+
136
+ # rubocop:disable Metrics/AbcSize, Layout/EmptyLines
137
+
138
+
139
+ # Builds the object from hash
140
+ # @param [Hash] attributes Model attributes in the form of hash
141
+ # @return [Object] Returns the model itself
142
+ def build_from_hash(attributes)
143
+ return nil unless attributes.is_a?(Hash)
144
+ self.class.swagger_types.each_pair do |key, type|
145
+ if type =~ /^Array<(.*)>/i
146
+ # check to ensure the input is an array given that the the attribute
147
+ # is documented as an array but the input is not
148
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
149
+ public_method("#{key}=").call(
150
+ attributes[self.class.attribute_map[key]]
151
+ .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
152
+ )
153
+ end
154
+ elsif !attributes[self.class.attribute_map[key]].nil?
155
+ public_method("#{key}=").call(
156
+ OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
157
+ )
158
+ end
159
+ # or else data not found in attributes(hash), not an issue as the data can be optional
160
+ end
161
+
162
+ self
163
+ end
164
+ # rubocop:enable Metrics/AbcSize, Layout/EmptyLines
165
+
166
+ # Returns the string representation of the object
167
+ # @return [String] String presentation of the object
168
+ def to_s
169
+ to_hash.to_s
170
+ end
171
+
172
+ # Returns the object in the form of hash
173
+ # @return [Hash] Returns the object in the form of hash
174
+ def to_hash
175
+ hash = {}
176
+ self.class.attribute_map.each_pair do |attr, param|
177
+ value = public_method(attr).call
178
+ next if value.nil? && !instance_variable_defined?("@#{attr}")
179
+ hash[param] = _to_hash(value)
180
+ end
181
+ hash
182
+ end
183
+
184
+ private
185
+
186
+ # Outputs non-array value in the form of hash
187
+ # For object, use to_hash. Otherwise, just return the value
188
+ # @param [Object] value Any valid value
189
+ # @return [Hash] Returns the value in the form of hash
190
+ def _to_hash(value)
191
+ if value.is_a?(Array)
192
+ value.compact.map { |v| _to_hash(v) }
193
+ elsif value.is_a?(Hash)
194
+ {}.tap do |hash|
195
+ value.each { |k, v| hash[k] = _to_hash(v) }
196
+ end
197
+ elsif value.respond_to? :to_hash
198
+ value.to_hash
199
+ else
200
+ value
201
+ end
202
+ end
203
+ end
204
+ end
205
+ # rubocop:enable Lint/UnneededCopDisableDirective
@@ -0,0 +1,153 @@
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
+ # Details for scheduling Vault deletion
8
+ class KeyManagement::Models::ScheduleVaultDeletionDetails # rubocop:disable Metrics/LineLength
9
+ # An optional property to indicate the deletion time of the Vault.
10
+ # The time format should comply with RFC-3339 standards. This time must be between 7 to 30 days from the time
11
+ # when the request is received. If the property is missing, it will be set to 30 days from request time by default.
12
+ #
13
+ # @return [DateTime]
14
+ attr_accessor :time_of_deletion
15
+
16
+ # Attribute mapping from ruby-style variable name to JSON key.
17
+ def self.attribute_map
18
+ {
19
+ # rubocop:disable Style/SymbolLiteral
20
+ 'time_of_deletion': :'timeOfDeletion'
21
+ # rubocop:enable Style/SymbolLiteral
22
+ }
23
+ end
24
+
25
+ # Attribute type mapping.
26
+ def self.swagger_types
27
+ {
28
+ # rubocop:disable Style/SymbolLiteral
29
+ 'time_of_deletion': :'DateTime'
30
+ # rubocop:enable Style/SymbolLiteral
31
+ }
32
+ end
33
+
34
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
35
+ # rubocop:disable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
36
+
37
+
38
+ # Initializes the object
39
+ # @param [Hash] attributes Model attributes in the form of hash
40
+ # @option attributes [DateTime] :time_of_deletion The value to assign to the {#time_of_deletion} property
41
+ def initialize(attributes = {})
42
+ return unless attributes.is_a?(Hash)
43
+
44
+ # convert string to symbol for hash key
45
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
46
+
47
+ self.time_of_deletion = attributes[:'timeOfDeletion'] if attributes[:'timeOfDeletion']
48
+
49
+ raise 'You cannot provide both :timeOfDeletion and :time_of_deletion' if attributes.key?(:'timeOfDeletion') && attributes.key?(:'time_of_deletion')
50
+
51
+ self.time_of_deletion = attributes[:'time_of_deletion'] if attributes[:'time_of_deletion']
52
+ end
53
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
54
+ # rubocop:enable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
55
+
56
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Layout/EmptyLines
57
+
58
+
59
+ # Checks equality by comparing each attribute.
60
+ # @param [Object] other the other object to be compared
61
+ def ==(other)
62
+ return true if equal?(other)
63
+ self.class == other.class &&
64
+ time_of_deletion == other.time_of_deletion
65
+ end
66
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Layout/EmptyLines
67
+
68
+ # @see the `==` method
69
+ # @param [Object] other the other object to be compared
70
+ def eql?(other)
71
+ self == other
72
+ end
73
+
74
+ # rubocop:disable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
75
+
76
+
77
+ # Calculates hash code according to all attributes.
78
+ # @return [Fixnum] Hash code
79
+ def hash
80
+ [time_of_deletion].hash
81
+ end
82
+ # rubocop:enable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
83
+
84
+ # rubocop:disable Metrics/AbcSize, Layout/EmptyLines
85
+
86
+
87
+ # Builds the object from hash
88
+ # @param [Hash] attributes Model attributes in the form of hash
89
+ # @return [Object] Returns the model itself
90
+ def build_from_hash(attributes)
91
+ return nil unless attributes.is_a?(Hash)
92
+ self.class.swagger_types.each_pair do |key, type|
93
+ if type =~ /^Array<(.*)>/i
94
+ # check to ensure the input is an array given that the the attribute
95
+ # is documented as an array but the input is not
96
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
97
+ public_method("#{key}=").call(
98
+ attributes[self.class.attribute_map[key]]
99
+ .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
100
+ )
101
+ end
102
+ elsif !attributes[self.class.attribute_map[key]].nil?
103
+ public_method("#{key}=").call(
104
+ OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
105
+ )
106
+ end
107
+ # or else data not found in attributes(hash), not an issue as the data can be optional
108
+ end
109
+
110
+ self
111
+ end
112
+ # rubocop:enable Metrics/AbcSize, Layout/EmptyLines
113
+
114
+ # Returns the string representation of the object
115
+ # @return [String] String presentation of the object
116
+ def to_s
117
+ to_hash.to_s
118
+ end
119
+
120
+ # Returns the object in the form of hash
121
+ # @return [Hash] Returns the object in the form of hash
122
+ def to_hash
123
+ hash = {}
124
+ self.class.attribute_map.each_pair do |attr, param|
125
+ value = public_method(attr).call
126
+ next if value.nil? && !instance_variable_defined?("@#{attr}")
127
+ hash[param] = _to_hash(value)
128
+ end
129
+ hash
130
+ end
131
+
132
+ private
133
+
134
+ # Outputs non-array value in the form of hash
135
+ # For object, use to_hash. Otherwise, just return the value
136
+ # @param [Object] value Any valid value
137
+ # @return [Hash] Returns the value in the form of hash
138
+ def _to_hash(value)
139
+ if value.is_a?(Array)
140
+ value.compact.map { |v| _to_hash(v) }
141
+ elsif value.is_a?(Hash)
142
+ {}.tap do |hash|
143
+ value.each { |k, v| hash[k] = _to_hash(v) }
144
+ end
145
+ elsif value.respond_to? :to_hash
146
+ value.to_hash
147
+ else
148
+ value
149
+ end
150
+ end
151
+ end
152
+ end
153
+ # rubocop:enable Lint/UnneededCopDisableDirective
@@ -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
+ # UpdateKeyDetails model.
8
+ class KeyManagement::Models::UpdateKeyDetails # rubocop:disable Metrics/LineLength
9
+ # A user-friendly name for the key. It does not have to be unique, and it is changeable.
10
+ # Avoid entering confidential information.
11
+ #
12
+ # @return [String]
13
+ attr_accessor :display_name
14
+
15
+ # Attribute mapping from ruby-style variable name to JSON key.
16
+ def self.attribute_map
17
+ {
18
+ # rubocop:disable Style/SymbolLiteral
19
+ 'display_name': :'displayName'
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
+ 'display_name': :'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] :display_name The value to assign to the {#display_name} 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.display_name = attributes[:'displayName'] if attributes[:'displayName']
47
+
48
+ raise 'You cannot provide both :displayName and :display_name' if attributes.key?(:'displayName') && attributes.key?(:'display_name')
49
+
50
+ self.display_name = attributes[:'display_name'] if attributes[:'display_name']
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
+ display_name == other.display_name
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
+ [display_name].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