oci 2.3.7 → 2.3.8

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 (43) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/lib/oci/core/blockstorage_client.rb +56 -24
  4. data/lib/oci/core/compute_client.rb +578 -24
  5. data/lib/oci/core/core.rb +11 -0
  6. data/lib/oci/core/models/app_catalog_listing.rb +242 -0
  7. data/lib/oci/core/models/app_catalog_listing_resource_version.rb +295 -0
  8. data/lib/oci/core/models/app_catalog_listing_resource_version_agreements.rb +219 -0
  9. data/lib/oci/core/models/app_catalog_listing_resource_version_summary.rb +194 -0
  10. data/lib/oci/core/models/app_catalog_listing_summary.rb +188 -0
  11. data/lib/oci/core/models/app_catalog_subscription.rb +246 -0
  12. data/lib/oci/core/models/app_catalog_subscription_summary.rb +246 -0
  13. data/lib/oci/core/models/create_app_catalog_subscription_details.rb +232 -0
  14. data/lib/oci/core/models/create_nat_gateway_details.rb +239 -0
  15. data/lib/oci/core/models/launch_instance_details.rb +4 -0
  16. data/lib/oci/core/models/nat_gateway.rb +333 -0
  17. data/lib/oci/core/models/public_ip.rb +76 -13
  18. data/lib/oci/core/models/service_gateway.rb +9 -4
  19. data/lib/oci/core/models/update_nat_gateway_details.rb +208 -0
  20. data/lib/oci/core/models/update_service_gateway_details.rb +9 -4
  21. data/lib/oci/core/virtual_network_client.rb +546 -91
  22. data/lib/oci/core/virtual_network_client_composite_operations.rb +119 -0
  23. data/lib/oci/object_storage/models/bucket.rb +18 -4
  24. data/lib/oci/object_storage/models/copy_object_details.rb +269 -0
  25. data/lib/oci/object_storage/models/multipart_upload.rb +1 -1
  26. data/lib/oci/object_storage/models/namespace_metadata.rb +1 -1
  27. data/lib/oci/object_storage/models/object_lifecycle_policy.rb +167 -0
  28. data/lib/oci/object_storage/models/object_lifecycle_rule.rb +245 -0
  29. data/lib/oci/object_storage/models/object_name_filter.rb +153 -0
  30. data/lib/oci/object_storage/models/preauthenticated_request.rb +1 -1
  31. data/lib/oci/object_storage/models/put_object_lifecycle_policy_details.rb +147 -0
  32. data/lib/oci/object_storage/models/restore_objects_details.rb +2 -2
  33. data/lib/oci/object_storage/models/work_request.rb +304 -0
  34. data/lib/oci/object_storage/models/work_request_error.rb +168 -0
  35. data/lib/oci/object_storage/models/work_request_log_entry.rb +156 -0
  36. data/lib/oci/object_storage/models/work_request_resource.rb +225 -0
  37. data/lib/oci/object_storage/models/work_request_resource_metadata_key.rb +12 -0
  38. data/lib/oci/object_storage/models/work_request_summary.rb +304 -0
  39. data/lib/oci/object_storage/object_storage.rb +12 -0
  40. data/lib/oci/object_storage/object_storage_client.rb +542 -17
  41. data/lib/oci/object_storage/object_storage_client_composite_operations.rb +53 -0
  42. data/lib/oci/version.rb +1 -1
  43. metadata +24 -2
@@ -0,0 +1,168 @@
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
+ # WorkRequestError model.
8
+ class ObjectStorage::Models::WorkRequestError # rubocop:disable Metrics/LineLength
9
+ # A machine-usable code for the error that occured. Error codes are listed on
10
+ # (https://docs.cloud.oracle.com/Content/API/References/apierrors.htm)
11
+ #
12
+ # @return [String]
13
+ attr_accessor :code
14
+
15
+ # A human readable description of the issue encountered.
16
+ # @return [String]
17
+ attr_accessor :message
18
+
19
+ # The time the error happened
20
+ # @return [DateTime]
21
+ attr_accessor :timestamp
22
+
23
+ # Attribute mapping from ruby-style variable name to JSON key.
24
+ def self.attribute_map
25
+ {
26
+ # rubocop:disable Style/SymbolLiteral
27
+ 'code': :'code',
28
+ 'message': :'message',
29
+ 'timestamp': :'timestamp'
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
+ 'code': :'String',
39
+ 'message': :'String',
40
+ 'timestamp': :'DateTime'
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] :code The value to assign to the {#code} property
52
+ # @option attributes [String] :message The value to assign to the {#message} property
53
+ # @option attributes [DateTime] :timestamp The value to assign to the {#timestamp} 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.code = attributes[:'code'] if attributes[:'code']
61
+
62
+ self.message = attributes[:'message'] if attributes[:'message']
63
+
64
+ self.timestamp = attributes[:'timestamp'] if attributes[:'timestamp']
65
+ end
66
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
67
+ # rubocop:enable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
68
+
69
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Layout/EmptyLines
70
+
71
+
72
+ # Checks equality by comparing each attribute.
73
+ # @param [Object] other the other object to be compared
74
+ def ==(other)
75
+ return true if equal?(other)
76
+ self.class == other.class &&
77
+ code == other.code &&
78
+ message == other.message &&
79
+ timestamp == other.timestamp
80
+ end
81
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Layout/EmptyLines
82
+
83
+ # @see the `==` method
84
+ # @param [Object] other the other object to be compared
85
+ def eql?(other)
86
+ self == other
87
+ end
88
+
89
+ # rubocop:disable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
90
+
91
+
92
+ # Calculates hash code according to all attributes.
93
+ # @return [Fixnum] Hash code
94
+ def hash
95
+ [code, message, timestamp].hash
96
+ end
97
+ # rubocop:enable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
98
+
99
+ # rubocop:disable Metrics/AbcSize, Layout/EmptyLines
100
+
101
+
102
+ # Builds the object from hash
103
+ # @param [Hash] attributes Model attributes in the form of hash
104
+ # @return [Object] Returns the model itself
105
+ def build_from_hash(attributes)
106
+ return nil unless attributes.is_a?(Hash)
107
+ self.class.swagger_types.each_pair do |key, type|
108
+ if type =~ /^Array<(.*)>/i
109
+ # check to ensure the input is an array given that the the attribute
110
+ # is documented as an array but the input is not
111
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
112
+ public_method("#{key}=").call(
113
+ attributes[self.class.attribute_map[key]]
114
+ .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
115
+ )
116
+ end
117
+ elsif !attributes[self.class.attribute_map[key]].nil?
118
+ public_method("#{key}=").call(
119
+ OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
120
+ )
121
+ end
122
+ # or else data not found in attributes(hash), not an issue as the data can be optional
123
+ end
124
+
125
+ self
126
+ end
127
+ # rubocop:enable Metrics/AbcSize, Layout/EmptyLines
128
+
129
+ # Returns the string representation of the object
130
+ # @return [String] String presentation of the object
131
+ def to_s
132
+ to_hash.to_s
133
+ end
134
+
135
+ # Returns the object in the form of hash
136
+ # @return [Hash] Returns the object in the form of hash
137
+ def to_hash
138
+ hash = {}
139
+ self.class.attribute_map.each_pair do |attr, param|
140
+ value = public_method(attr).call
141
+ next if value.nil? && !instance_variable_defined?("@#{attr}")
142
+ hash[param] = _to_hash(value)
143
+ end
144
+ hash
145
+ end
146
+
147
+ private
148
+
149
+ # Outputs non-array value in the form of hash
150
+ # For object, use to_hash. Otherwise, just return the value
151
+ # @param [Object] value Any valid value
152
+ # @return [Hash] Returns the value in the form of hash
153
+ def _to_hash(value)
154
+ if value.is_a?(Array)
155
+ value.compact.map { |v| _to_hash(v) }
156
+ elsif value.is_a?(Hash)
157
+ {}.tap do |hash|
158
+ value.each { |k, v| hash[k] = _to_hash(v) }
159
+ end
160
+ elsif value.respond_to? :to_hash
161
+ value.to_hash
162
+ else
163
+ value
164
+ end
165
+ end
166
+ end
167
+ end
168
+ # rubocop:enable Lint/UnneededCopDisableDirective
@@ -0,0 +1,156 @@
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
+ # WorkRequestLogEntry model.
8
+ class ObjectStorage::Models::WorkRequestLogEntry # rubocop:disable Metrics/LineLength
9
+ # Human-readable log message.
10
+ # @return [String]
11
+ attr_accessor :message
12
+
13
+ # The time the log message was written. An RFC3339 formatted datetime string
14
+ # @return [DateTime]
15
+ attr_accessor :timestamp
16
+
17
+ # Attribute mapping from ruby-style variable name to JSON key.
18
+ def self.attribute_map
19
+ {
20
+ # rubocop:disable Style/SymbolLiteral
21
+ 'message': :'message',
22
+ 'timestamp': :'timestamp'
23
+ # rubocop:enable Style/SymbolLiteral
24
+ }
25
+ end
26
+
27
+ # Attribute type mapping.
28
+ def self.swagger_types
29
+ {
30
+ # rubocop:disable Style/SymbolLiteral
31
+ 'message': :'String',
32
+ 'timestamp': :'DateTime'
33
+ # rubocop:enable Style/SymbolLiteral
34
+ }
35
+ end
36
+
37
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
38
+ # rubocop:disable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
39
+
40
+
41
+ # Initializes the object
42
+ # @param [Hash] attributes Model attributes in the form of hash
43
+ # @option attributes [String] :message The value to assign to the {#message} property
44
+ # @option attributes [DateTime] :timestamp The value to assign to the {#timestamp} property
45
+ def initialize(attributes = {})
46
+ return unless attributes.is_a?(Hash)
47
+
48
+ # convert string to symbol for hash key
49
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
50
+
51
+ self.message = attributes[:'message'] if attributes[:'message']
52
+
53
+ self.timestamp = attributes[:'timestamp'] if attributes[:'timestamp']
54
+ end
55
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
56
+ # rubocop:enable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
57
+
58
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Layout/EmptyLines
59
+
60
+
61
+ # Checks equality by comparing each attribute.
62
+ # @param [Object] other the other object to be compared
63
+ def ==(other)
64
+ return true if equal?(other)
65
+ self.class == other.class &&
66
+ message == other.message &&
67
+ timestamp == other.timestamp
68
+ end
69
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Layout/EmptyLines
70
+
71
+ # @see the `==` method
72
+ # @param [Object] other the other object to be compared
73
+ def eql?(other)
74
+ self == other
75
+ end
76
+
77
+ # rubocop:disable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
78
+
79
+
80
+ # Calculates hash code according to all attributes.
81
+ # @return [Fixnum] Hash code
82
+ def hash
83
+ [message, timestamp].hash
84
+ end
85
+ # rubocop:enable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
86
+
87
+ # rubocop:disable Metrics/AbcSize, Layout/EmptyLines
88
+
89
+
90
+ # Builds the object from hash
91
+ # @param [Hash] attributes Model attributes in the form of hash
92
+ # @return [Object] Returns the model itself
93
+ def build_from_hash(attributes)
94
+ return nil unless attributes.is_a?(Hash)
95
+ self.class.swagger_types.each_pair do |key, type|
96
+ if type =~ /^Array<(.*)>/i
97
+ # check to ensure the input is an array given that the the attribute
98
+ # is documented as an array but the input is not
99
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
100
+ public_method("#{key}=").call(
101
+ attributes[self.class.attribute_map[key]]
102
+ .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
103
+ )
104
+ end
105
+ elsif !attributes[self.class.attribute_map[key]].nil?
106
+ public_method("#{key}=").call(
107
+ OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
108
+ )
109
+ end
110
+ # or else data not found in attributes(hash), not an issue as the data can be optional
111
+ end
112
+
113
+ self
114
+ end
115
+ # rubocop:enable Metrics/AbcSize, Layout/EmptyLines
116
+
117
+ # Returns the string representation of the object
118
+ # @return [String] String presentation of the object
119
+ def to_s
120
+ to_hash.to_s
121
+ end
122
+
123
+ # Returns the object in the form of hash
124
+ # @return [Hash] Returns the object in the form of hash
125
+ def to_hash
126
+ hash = {}
127
+ self.class.attribute_map.each_pair do |attr, param|
128
+ value = public_method(attr).call
129
+ next if value.nil? && !instance_variable_defined?("@#{attr}")
130
+ hash[param] = _to_hash(value)
131
+ end
132
+ hash
133
+ end
134
+
135
+ private
136
+
137
+ # Outputs non-array value in the form of hash
138
+ # For object, use to_hash. Otherwise, just return the value
139
+ # @param [Object] value Any valid value
140
+ # @return [Hash] Returns the value in the form of hash
141
+ def _to_hash(value)
142
+ if value.is_a?(Array)
143
+ value.compact.map { |v| _to_hash(v) }
144
+ elsif value.is_a?(Hash)
145
+ {}.tap do |hash|
146
+ value.each { |k, v| hash[k] = _to_hash(v) }
147
+ end
148
+ elsif value.respond_to? :to_hash
149
+ value.to_hash
150
+ else
151
+ value
152
+ end
153
+ end
154
+ end
155
+ end
156
+ # rubocop:enable Lint/UnneededCopDisableDirective
@@ -0,0 +1,225 @@
1
+ # Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
2
+
3
+ require 'date'
4
+ require 'logger'
5
+
6
+ # rubocop:disable Lint/UnneededCopDisableDirective
7
+ module OCI
8
+ # WorkRequestResource model.
9
+ class ObjectStorage::Models::WorkRequestResource # rubocop:disable Metrics/LineLength
10
+ ACTION_TYPE_ENUM = [
11
+ ACTION_TYPE_CREATED = 'CREATED'.freeze,
12
+ ACTION_TYPE_UPDATED = 'UPDATED'.freeze,
13
+ ACTION_TYPE_DELETED = 'DELETED'.freeze,
14
+ ACTION_TYPE_RELATED = 'RELATED'.freeze,
15
+ ACTION_TYPE_IN_PROGRESS = 'IN_PROGRESS'.freeze,
16
+ ACTION_TYPE_READ = 'READ'.freeze,
17
+ ACTION_TYPE_WRITTEN = 'WRITTEN'.freeze,
18
+ ACTION_TYPE_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
19
+ ].freeze
20
+
21
+ # The status that a work request can present
22
+ # @return [String]
23
+ attr_reader :action_type
24
+
25
+ # The resource type the work request is affects.
26
+ # @return [String]
27
+ attr_accessor :entity_type
28
+
29
+ # The identifier of the resource the work request affects.
30
+ # @return [String]
31
+ attr_accessor :identifier
32
+
33
+ # The URI path that the user can do a GET on to access the resource metadata
34
+ # @return [String]
35
+ attr_accessor :entity_uri
36
+
37
+ # The metadata of the resource.
38
+ # @return [Hash<String, String>]
39
+ attr_accessor :metadata
40
+
41
+ # Attribute mapping from ruby-style variable name to JSON key.
42
+ def self.attribute_map
43
+ {
44
+ # rubocop:disable Style/SymbolLiteral
45
+ 'action_type': :'actionType',
46
+ 'entity_type': :'entityType',
47
+ 'identifier': :'identifier',
48
+ 'entity_uri': :'entityUri',
49
+ 'metadata': :'metadata'
50
+ # rubocop:enable Style/SymbolLiteral
51
+ }
52
+ end
53
+
54
+ # Attribute type mapping.
55
+ def self.swagger_types
56
+ {
57
+ # rubocop:disable Style/SymbolLiteral
58
+ 'action_type': :'String',
59
+ 'entity_type': :'String',
60
+ 'identifier': :'String',
61
+ 'entity_uri': :'String',
62
+ 'metadata': :'Hash<String, String>'
63
+ # rubocop:enable Style/SymbolLiteral
64
+ }
65
+ end
66
+
67
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
68
+ # rubocop:disable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
69
+
70
+
71
+ # Initializes the object
72
+ # @param [Hash] attributes Model attributes in the form of hash
73
+ # @option attributes [String] :action_type The value to assign to the {#action_type} property
74
+ # @option attributes [String] :entity_type The value to assign to the {#entity_type} property
75
+ # @option attributes [String] :identifier The value to assign to the {#identifier} property
76
+ # @option attributes [String] :entity_uri The value to assign to the {#entity_uri} property
77
+ # @option attributes [Hash<String, String>] :metadata The value to assign to the {#metadata} property
78
+ def initialize(attributes = {})
79
+ return unless attributes.is_a?(Hash)
80
+
81
+ # convert string to symbol for hash key
82
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
83
+
84
+ self.action_type = attributes[:'actionType'] if attributes[:'actionType']
85
+
86
+ raise 'You cannot provide both :actionType and :action_type' if attributes.key?(:'actionType') && attributes.key?(:'action_type')
87
+
88
+ self.action_type = attributes[:'action_type'] if attributes[:'action_type']
89
+
90
+ self.entity_type = attributes[:'entityType'] if attributes[:'entityType']
91
+
92
+ raise 'You cannot provide both :entityType and :entity_type' if attributes.key?(:'entityType') && attributes.key?(:'entity_type')
93
+
94
+ self.entity_type = attributes[:'entity_type'] if attributes[:'entity_type']
95
+
96
+ self.identifier = attributes[:'identifier'] if attributes[:'identifier']
97
+
98
+ self.entity_uri = attributes[:'entityUri'] if attributes[:'entityUri']
99
+
100
+ raise 'You cannot provide both :entityUri and :entity_uri' if attributes.key?(:'entityUri') && attributes.key?(:'entity_uri')
101
+
102
+ self.entity_uri = attributes[:'entity_uri'] if attributes[:'entity_uri']
103
+
104
+ self.metadata = attributes[:'metadata'] if attributes[:'metadata']
105
+ end
106
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
107
+ # rubocop:enable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
108
+
109
+ # Custom attribute writer method checking allowed values (enum).
110
+ # @param [Object] action_type Object to be assigned
111
+ def action_type=(action_type)
112
+ # rubocop:disable Style/ConditionalAssignment
113
+ if action_type && !ACTION_TYPE_ENUM.include?(action_type)
114
+ # rubocop: disable Metrics/LineLength
115
+ OCI.logger.debug("Unknown value for 'action_type' [" + action_type + "]. Mapping to 'ACTION_TYPE_UNKNOWN_ENUM_VALUE'") if OCI.logger
116
+ # rubocop: enable Metrics/LineLength
117
+ @action_type = ACTION_TYPE_UNKNOWN_ENUM_VALUE
118
+ else
119
+ @action_type = action_type
120
+ end
121
+ # rubocop:enable Style/ConditionalAssignment
122
+ end
123
+
124
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Layout/EmptyLines
125
+
126
+
127
+ # Checks equality by comparing each attribute.
128
+ # @param [Object] other the other object to be compared
129
+ def ==(other)
130
+ return true if equal?(other)
131
+ self.class == other.class &&
132
+ action_type == other.action_type &&
133
+ entity_type == other.entity_type &&
134
+ identifier == other.identifier &&
135
+ entity_uri == other.entity_uri &&
136
+ metadata == other.metadata
137
+ end
138
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Layout/EmptyLines
139
+
140
+ # @see the `==` method
141
+ # @param [Object] other the other object to be compared
142
+ def eql?(other)
143
+ self == other
144
+ end
145
+
146
+ # rubocop:disable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
147
+
148
+
149
+ # Calculates hash code according to all attributes.
150
+ # @return [Fixnum] Hash code
151
+ def hash
152
+ [action_type, entity_type, identifier, entity_uri, metadata].hash
153
+ end
154
+ # rubocop:enable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
155
+
156
+ # rubocop:disable Metrics/AbcSize, Layout/EmptyLines
157
+
158
+
159
+ # Builds the object from hash
160
+ # @param [Hash] attributes Model attributes in the form of hash
161
+ # @return [Object] Returns the model itself
162
+ def build_from_hash(attributes)
163
+ return nil unless attributes.is_a?(Hash)
164
+ self.class.swagger_types.each_pair do |key, type|
165
+ if type =~ /^Array<(.*)>/i
166
+ # check to ensure the input is an array given that the the attribute
167
+ # is documented as an array but the input is not
168
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
169
+ public_method("#{key}=").call(
170
+ attributes[self.class.attribute_map[key]]
171
+ .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
172
+ )
173
+ end
174
+ elsif !attributes[self.class.attribute_map[key]].nil?
175
+ public_method("#{key}=").call(
176
+ OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
177
+ )
178
+ end
179
+ # or else data not found in attributes(hash), not an issue as the data can be optional
180
+ end
181
+
182
+ self
183
+ end
184
+ # rubocop:enable Metrics/AbcSize, Layout/EmptyLines
185
+
186
+ # Returns the string representation of the object
187
+ # @return [String] String presentation of the object
188
+ def to_s
189
+ to_hash.to_s
190
+ end
191
+
192
+ # Returns the object in the form of hash
193
+ # @return [Hash] Returns the object in the form of hash
194
+ def to_hash
195
+ hash = {}
196
+ self.class.attribute_map.each_pair do |attr, param|
197
+ value = public_method(attr).call
198
+ next if value.nil? && !instance_variable_defined?("@#{attr}")
199
+ hash[param] = _to_hash(value)
200
+ end
201
+ hash
202
+ end
203
+
204
+ private
205
+
206
+ # Outputs non-array value in the form of hash
207
+ # For object, use to_hash. Otherwise, just return the value
208
+ # @param [Object] value Any valid value
209
+ # @return [Hash] Returns the value in the form of hash
210
+ def _to_hash(value)
211
+ if value.is_a?(Array)
212
+ value.compact.map { |v| _to_hash(v) }
213
+ elsif value.is_a?(Hash)
214
+ {}.tap do |hash|
215
+ value.each { |k, v| hash[k] = _to_hash(v) }
216
+ end
217
+ elsif value.respond_to? :to_hash
218
+ value.to_hash
219
+ else
220
+ value
221
+ end
222
+ end
223
+ end
224
+ end
225
+ # rubocop:enable Lint/UnneededCopDisableDirective