oci 2.4.7 → 2.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (61) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +18 -1
  3. data/lib/oci.rb +1 -0
  4. data/lib/oci/announcements_service/announcement_client.rb +47 -36
  5. data/lib/oci/announcements_service/announcements_service.rb +0 -1
  6. data/lib/oci/announcements_service/models/affected_resource.rb +4 -4
  7. data/lib/oci/announcements_service/models/announcement.rb +10 -14
  8. data/lib/oci/announcements_service/models/announcement_summary.rb +1 -1
  9. data/lib/oci/announcements_service/models/announcement_user_status_details.rb +5 -5
  10. data/lib/oci/announcements_service/models/announcements_collection.rb +3 -3
  11. data/lib/oci/announcements_service/models/base_announcement.rb +28 -18
  12. data/lib/oci/audit/audit_client.rb +17 -10
  13. data/lib/oci/container_engine/container_engine_client.rb +17 -10
  14. data/lib/oci/core/blockstorage_client.rb +17 -10
  15. data/lib/oci/core/compute_client.rb +17 -10
  16. data/lib/oci/core/compute_management_client.rb +17 -10
  17. data/lib/oci/core/models/create_subnet_details.rb +1 -1
  18. data/lib/oci/core/models/subnet.rb +1 -1
  19. data/lib/oci/core/virtual_network_client.rb +17 -10
  20. data/lib/oci/database/database_client.rb +17 -10
  21. data/lib/oci/dns/dns_client.rb +17 -10
  22. data/lib/oci/email/email_client.rb +17 -10
  23. data/lib/oci/file_storage/file_storage_client.rb +17 -10
  24. data/lib/oci/healthchecks/health_checks_client.rb +17 -10
  25. data/lib/oci/identity/identity_client.rb +17 -10
  26. data/lib/oci/key_management/kms_crypto_client.rb +4 -5
  27. data/lib/oci/key_management/kms_management_client.rb +7 -8
  28. data/lib/oci/key_management/kms_vault_client.rb +20 -13
  29. data/lib/oci/key_management/models/create_key_details.rb +34 -1
  30. data/lib/oci/key_management/models/create_vault_details.rb +34 -1
  31. data/lib/oci/key_management/models/key_version.rb +1 -1
  32. data/lib/oci/key_management/models/update_key_details.rb +37 -4
  33. data/lib/oci/key_management/models/update_vault_details.rb +37 -4
  34. data/lib/oci/load_balancer/load_balancer_client.rb +17 -10
  35. data/lib/oci/object_storage/object_storage_client.rb +17 -10
  36. data/lib/oci/regions.rb +20 -4
  37. data/lib/oci/resource_search/resource_search_client.rb +17 -10
  38. data/lib/oci/streaming/models/create_cursor_details.rb +205 -0
  39. data/lib/oci/streaming/models/create_group_cursor_details.rb +237 -0
  40. data/lib/oci/streaming/models/create_stream_details.rb +227 -0
  41. data/lib/oci/streaming/models/cursor.rb +150 -0
  42. data/lib/oci/streaming/models/group.rb +179 -0
  43. data/lib/oci/streaming/models/message.rb +199 -0
  44. data/lib/oci/streaming/models/partition_reservation.rb +192 -0
  45. data/lib/oci/streaming/models/put_messages_details.rb +149 -0
  46. data/lib/oci/{announcements_service/models/notification_followup_details.rb → streaming/models/put_messages_details_entry.rb} +19 -22
  47. data/lib/oci/streaming/models/put_messages_result.rb +165 -0
  48. data/lib/oci/streaming/models/put_messages_result_entry.rb +196 -0
  49. data/lib/oci/streaming/models/stream.rb +319 -0
  50. data/lib/oci/streaming/models/stream_summary.rb +291 -0
  51. data/lib/oci/streaming/models/update_group_details.rb +176 -0
  52. data/lib/oci/streaming/models/update_stream_details.rb +174 -0
  53. data/lib/oci/streaming/stream_admin_client.rb +432 -0
  54. data/lib/oci/streaming/stream_admin_client_composite_operations.rb +143 -0
  55. data/lib/oci/streaming/stream_client.rb +602 -0
  56. data/lib/oci/streaming/stream_client_composite_operations.rb +24 -0
  57. data/lib/oci/streaming/streaming.rb +35 -0
  58. data/lib/oci/streaming/util.rb +2 -0
  59. data/lib/oci/version.rb +1 -1
  60. data/lib/oci/waas/waas_client.rb +17 -10
  61. metadata +51 -3
@@ -0,0 +1,199 @@
1
+ # Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
2
+
3
+ require 'date'
4
+
5
+ # rubocop:disable Lint/UnneededCopDisableDirective
6
+ module OCI
7
+ # A message in a stream.
8
+ class Streaming::Models::Message # rubocop:disable Metrics/LineLength
9
+ # **[Required]** The name of the stream that the message belongs to.
10
+ # @return [String]
11
+ attr_accessor :stream
12
+
13
+ # **[Required]** The ID of the partition where the message is stored.
14
+ # @return [String]
15
+ attr_accessor :partition
16
+
17
+ # **[Required]** The key associated with the message, expressed as a byte array.
18
+ # @return [String]
19
+ attr_accessor :key
20
+
21
+ # **[Required]** The value associated with the message, expressed as a byte array.
22
+ # @return [String]
23
+ attr_accessor :value
24
+
25
+ # **[Required]** The offset of the message, which uniquely identifies it within the partition.
26
+ # @return [Integer]
27
+ attr_accessor :offset
28
+
29
+ # **[Required]** The timestamp indicating when the server appended the message to the stream.
30
+ # @return [DateTime]
31
+ attr_accessor :timestamp
32
+
33
+ # Attribute mapping from ruby-style variable name to JSON key.
34
+ def self.attribute_map
35
+ {
36
+ # rubocop:disable Style/SymbolLiteral
37
+ 'stream': :'stream',
38
+ 'partition': :'partition',
39
+ 'key': :'key',
40
+ 'value': :'value',
41
+ 'offset': :'offset',
42
+ 'timestamp': :'timestamp'
43
+ # rubocop:enable Style/SymbolLiteral
44
+ }
45
+ end
46
+
47
+ # Attribute type mapping.
48
+ def self.swagger_types
49
+ {
50
+ # rubocop:disable Style/SymbolLiteral
51
+ 'stream': :'String',
52
+ 'partition': :'String',
53
+ 'key': :'String',
54
+ 'value': :'String',
55
+ 'offset': :'Integer',
56
+ 'timestamp': :'DateTime'
57
+ # rubocop:enable Style/SymbolLiteral
58
+ }
59
+ end
60
+
61
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
62
+ # rubocop:disable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
63
+
64
+
65
+ # Initializes the object
66
+ # @param [Hash] attributes Model attributes in the form of hash
67
+ # @option attributes [String] :stream The value to assign to the {#stream} property
68
+ # @option attributes [String] :partition The value to assign to the {#partition} property
69
+ # @option attributes [String] :key The value to assign to the {#key} property
70
+ # @option attributes [String] :value The value to assign to the {#value} property
71
+ # @option attributes [Integer] :offset The value to assign to the {#offset} property
72
+ # @option attributes [DateTime] :timestamp The value to assign to the {#timestamp} property
73
+ def initialize(attributes = {})
74
+ return unless attributes.is_a?(Hash)
75
+
76
+ # convert string to symbol for hash key
77
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
78
+
79
+ self.stream = attributes[:'stream'] if attributes[:'stream']
80
+
81
+ self.partition = attributes[:'partition'] if attributes[:'partition']
82
+
83
+ self.key = attributes[:'key'] if attributes[:'key']
84
+
85
+ self.value = attributes[:'value'] if attributes[:'value']
86
+
87
+ self.offset = attributes[:'offset'] if attributes[:'offset']
88
+
89
+ self.timestamp = attributes[:'timestamp'] if attributes[:'timestamp']
90
+ end
91
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
92
+ # rubocop:enable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
93
+
94
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Metrics/LineLength, Layout/EmptyLines
95
+
96
+
97
+ # Checks equality by comparing each attribute.
98
+ # @param [Object] other the other object to be compared
99
+ def ==(other)
100
+ return true if equal?(other)
101
+
102
+ self.class == other.class &&
103
+ stream == other.stream &&
104
+ partition == other.partition &&
105
+ key == other.key &&
106
+ value == other.value &&
107
+ offset == other.offset &&
108
+ timestamp == other.timestamp
109
+ end
110
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Metrics/LineLength, Layout/EmptyLines
111
+
112
+ # @see the `==` method
113
+ # @param [Object] other the other object to be compared
114
+ def eql?(other)
115
+ self == other
116
+ end
117
+
118
+ # rubocop:disable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
119
+
120
+
121
+ # Calculates hash code according to all attributes.
122
+ # @return [Fixnum] Hash code
123
+ def hash
124
+ [stream, partition, key, value, offset, timestamp].hash
125
+ end
126
+ # rubocop:enable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
127
+
128
+ # rubocop:disable Metrics/AbcSize, Layout/EmptyLines
129
+
130
+
131
+ # Builds the object from hash
132
+ # @param [Hash] attributes Model attributes in the form of hash
133
+ # @return [Object] Returns the model itself
134
+ def build_from_hash(attributes)
135
+ return nil unless attributes.is_a?(Hash)
136
+
137
+ self.class.swagger_types.each_pair do |key, type|
138
+ if type =~ /^Array<(.*)>/i
139
+ # check to ensure the input is an array given that the the attribute
140
+ # is documented as an array but the input is not
141
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
142
+ public_method("#{key}=").call(
143
+ attributes[self.class.attribute_map[key]]
144
+ .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
145
+ )
146
+ end
147
+ elsif !attributes[self.class.attribute_map[key]].nil?
148
+ public_method("#{key}=").call(
149
+ OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
150
+ )
151
+ end
152
+ # or else data not found in attributes(hash), not an issue as the data can be optional
153
+ end
154
+
155
+ self
156
+ end
157
+ # rubocop:enable Metrics/AbcSize, Layout/EmptyLines
158
+
159
+ # Returns the string representation of the object
160
+ # @return [String] String presentation of the object
161
+ def to_s
162
+ to_hash.to_s
163
+ end
164
+
165
+ # Returns the object in the form of hash
166
+ # @return [Hash] Returns the object in the form of hash
167
+ def to_hash
168
+ hash = {}
169
+ self.class.attribute_map.each_pair do |attr, param|
170
+ value = public_method(attr).call
171
+ next if value.nil? && !instance_variable_defined?("@#{attr}")
172
+
173
+ hash[param] = _to_hash(value)
174
+ end
175
+ hash
176
+ end
177
+
178
+ private
179
+
180
+ # Outputs non-array value in the form of hash
181
+ # For object, use to_hash. Otherwise, just return the value
182
+ # @param [Object] value Any valid value
183
+ # @return [Hash] Returns the value in the form of hash
184
+ def _to_hash(value)
185
+ if value.is_a?(Array)
186
+ value.compact.map { |v| _to_hash(v) }
187
+ elsif value.is_a?(Hash)
188
+ {}.tap do |hash|
189
+ value.each { |k, v| hash[k] = _to_hash(v) }
190
+ end
191
+ elsif value.respond_to? :to_hash
192
+ value.to_hash
193
+ else
194
+ value
195
+ end
196
+ end
197
+ end
198
+ end
199
+ # rubocop:enable Lint/UnneededCopDisableDirective
@@ -0,0 +1,192 @@
1
+ # Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
2
+
3
+ require 'date'
4
+
5
+ # rubocop:disable Lint/UnneededCopDisableDirective
6
+ module OCI
7
+ # Represents the state of a single partition reservation.
8
+ #
9
+ class Streaming::Models::PartitionReservation # rubocop:disable Metrics/LineLength
10
+ # The partition for which the reservation applies.
11
+ # @return [String]
12
+ attr_accessor :partition
13
+
14
+ # The latest offset which has been committed for this partition.
15
+ # @return [Integer]
16
+ attr_accessor :committed_offset
17
+
18
+ # The consumer instance which currently has the partition reserved.
19
+ # @return [String]
20
+ attr_accessor :reserved_instance
21
+
22
+ # A timestamp when the current reservation expires.
23
+ # @return [DateTime]
24
+ attr_accessor :time_reserved_until
25
+
26
+ # Attribute mapping from ruby-style variable name to JSON key.
27
+ def self.attribute_map
28
+ {
29
+ # rubocop:disable Style/SymbolLiteral
30
+ 'partition': :'partition',
31
+ 'committed_offset': :'committedOffset',
32
+ 'reserved_instance': :'reservedInstance',
33
+ 'time_reserved_until': :'timeReservedUntil'
34
+ # rubocop:enable Style/SymbolLiteral
35
+ }
36
+ end
37
+
38
+ # Attribute type mapping.
39
+ def self.swagger_types
40
+ {
41
+ # rubocop:disable Style/SymbolLiteral
42
+ 'partition': :'String',
43
+ 'committed_offset': :'Integer',
44
+ 'reserved_instance': :'String',
45
+ 'time_reserved_until': :'DateTime'
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] :partition The value to assign to the {#partition} property
57
+ # @option attributes [Integer] :committed_offset The value to assign to the {#committed_offset} property
58
+ # @option attributes [String] :reserved_instance The value to assign to the {#reserved_instance} property
59
+ # @option attributes [DateTime] :time_reserved_until The value to assign to the {#time_reserved_until} property
60
+ def initialize(attributes = {})
61
+ return unless attributes.is_a?(Hash)
62
+
63
+ # convert string to symbol for hash key
64
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
65
+
66
+ self.partition = attributes[:'partition'] if attributes[:'partition']
67
+
68
+ self.committed_offset = attributes[:'committedOffset'] if attributes[:'committedOffset']
69
+
70
+ raise 'You cannot provide both :committedOffset and :committed_offset' if attributes.key?(:'committedOffset') && attributes.key?(:'committed_offset')
71
+
72
+ self.committed_offset = attributes[:'committed_offset'] if attributes[:'committed_offset']
73
+
74
+ self.reserved_instance = attributes[:'reservedInstance'] if attributes[:'reservedInstance']
75
+
76
+ raise 'You cannot provide both :reservedInstance and :reserved_instance' if attributes.key?(:'reservedInstance') && attributes.key?(:'reserved_instance')
77
+
78
+ self.reserved_instance = attributes[:'reserved_instance'] if attributes[:'reserved_instance']
79
+
80
+ self.time_reserved_until = attributes[:'timeReservedUntil'] if attributes[:'timeReservedUntil']
81
+
82
+ raise 'You cannot provide both :timeReservedUntil and :time_reserved_until' if attributes.key?(:'timeReservedUntil') && attributes.key?(:'time_reserved_until')
83
+
84
+ self.time_reserved_until = attributes[:'time_reserved_until'] if attributes[:'time_reserved_until']
85
+ end
86
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
87
+ # rubocop:enable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
88
+
89
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Metrics/LineLength, Layout/EmptyLines
90
+
91
+
92
+ # Checks equality by comparing each attribute.
93
+ # @param [Object] other the other object to be compared
94
+ def ==(other)
95
+ return true if equal?(other)
96
+
97
+ self.class == other.class &&
98
+ partition == other.partition &&
99
+ committed_offset == other.committed_offset &&
100
+ reserved_instance == other.reserved_instance &&
101
+ time_reserved_until == other.time_reserved_until
102
+ end
103
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Metrics/LineLength, Layout/EmptyLines
104
+
105
+ # @see the `==` method
106
+ # @param [Object] other the other object to be compared
107
+ def eql?(other)
108
+ self == other
109
+ end
110
+
111
+ # rubocop:disable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
112
+
113
+
114
+ # Calculates hash code according to all attributes.
115
+ # @return [Fixnum] Hash code
116
+ def hash
117
+ [partition, committed_offset, reserved_instance, time_reserved_until].hash
118
+ end
119
+ # rubocop:enable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
120
+
121
+ # rubocop:disable Metrics/AbcSize, Layout/EmptyLines
122
+
123
+
124
+ # Builds the object from hash
125
+ # @param [Hash] attributes Model attributes in the form of hash
126
+ # @return [Object] Returns the model itself
127
+ def build_from_hash(attributes)
128
+ return nil unless attributes.is_a?(Hash)
129
+
130
+ self.class.swagger_types.each_pair do |key, type|
131
+ if type =~ /^Array<(.*)>/i
132
+ # check to ensure the input is an array given that the the attribute
133
+ # is documented as an array but the input is not
134
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
135
+ public_method("#{key}=").call(
136
+ attributes[self.class.attribute_map[key]]
137
+ .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
138
+ )
139
+ end
140
+ elsif !attributes[self.class.attribute_map[key]].nil?
141
+ public_method("#{key}=").call(
142
+ OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
143
+ )
144
+ end
145
+ # or else data not found in attributes(hash), not an issue as the data can be optional
146
+ end
147
+
148
+ self
149
+ end
150
+ # rubocop:enable Metrics/AbcSize, Layout/EmptyLines
151
+
152
+ # Returns the string representation of the object
153
+ # @return [String] String presentation of the object
154
+ def to_s
155
+ to_hash.to_s
156
+ end
157
+
158
+ # Returns the object in the form of hash
159
+ # @return [Hash] Returns the object in the form of hash
160
+ def to_hash
161
+ hash = {}
162
+ self.class.attribute_map.each_pair do |attr, param|
163
+ value = public_method(attr).call
164
+ next if value.nil? && !instance_variable_defined?("@#{attr}")
165
+
166
+ hash[param] = _to_hash(value)
167
+ end
168
+ hash
169
+ end
170
+
171
+ private
172
+
173
+ # Outputs non-array value in the form of hash
174
+ # For object, use to_hash. Otherwise, just return the value
175
+ # @param [Object] value Any valid value
176
+ # @return [Hash] Returns the value in the form of hash
177
+ def _to_hash(value)
178
+ if value.is_a?(Array)
179
+ value.compact.map { |v| _to_hash(v) }
180
+ elsif value.is_a?(Hash)
181
+ {}.tap do |hash|
182
+ value.each { |k, v| hash[k] = _to_hash(v) }
183
+ end
184
+ elsif value.respond_to? :to_hash
185
+ value.to_hash
186
+ else
187
+ value
188
+ end
189
+ end
190
+ end
191
+ end
192
+ # rubocop:enable Lint/UnneededCopDisableDirective
@@ -0,0 +1,149 @@
1
+ # Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
2
+
3
+ require 'date'
4
+
5
+ # rubocop:disable Lint/UnneededCopDisableDirective
6
+ module OCI
7
+ # Object that represents an array of messages to emit to a stream.
8
+ class Streaming::Models::PutMessagesDetails # rubocop:disable Metrics/LineLength
9
+ # **[Required]** The array of messages to put into a stream.
10
+ # @return [Array<OCI::Streaming::Models::PutMessagesDetailsEntry>]
11
+ attr_accessor :messages
12
+
13
+ # Attribute mapping from ruby-style variable name to JSON key.
14
+ def self.attribute_map
15
+ {
16
+ # rubocop:disable Style/SymbolLiteral
17
+ 'messages': :'messages'
18
+ # rubocop:enable Style/SymbolLiteral
19
+ }
20
+ end
21
+
22
+ # Attribute type mapping.
23
+ def self.swagger_types
24
+ {
25
+ # rubocop:disable Style/SymbolLiteral
26
+ 'messages': :'Array<OCI::Streaming::Models::PutMessagesDetailsEntry>'
27
+ # rubocop:enable Style/SymbolLiteral
28
+ }
29
+ end
30
+
31
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
32
+ # rubocop:disable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
33
+
34
+
35
+ # Initializes the object
36
+ # @param [Hash] attributes Model attributes in the form of hash
37
+ # @option attributes [Array<OCI::Streaming::Models::PutMessagesDetailsEntry>] :messages The value to assign to the {#messages} property
38
+ def initialize(attributes = {})
39
+ return unless attributes.is_a?(Hash)
40
+
41
+ # convert string to symbol for hash key
42
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
43
+
44
+ self.messages = attributes[:'messages'] if attributes[:'messages']
45
+ end
46
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
47
+ # rubocop:enable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
48
+
49
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Metrics/LineLength, Layout/EmptyLines
50
+
51
+
52
+ # Checks equality by comparing each attribute.
53
+ # @param [Object] other the other object to be compared
54
+ def ==(other)
55
+ return true if equal?(other)
56
+
57
+ self.class == other.class &&
58
+ messages == other.messages
59
+ end
60
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Metrics/LineLength, Layout/EmptyLines
61
+
62
+ # @see the `==` method
63
+ # @param [Object] other the other object to be compared
64
+ def eql?(other)
65
+ self == other
66
+ end
67
+
68
+ # rubocop:disable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
69
+
70
+
71
+ # Calculates hash code according to all attributes.
72
+ # @return [Fixnum] Hash code
73
+ def hash
74
+ [messages].hash
75
+ end
76
+ # rubocop:enable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
77
+
78
+ # rubocop:disable Metrics/AbcSize, Layout/EmptyLines
79
+
80
+
81
+ # Builds the object from hash
82
+ # @param [Hash] attributes Model attributes in the form of hash
83
+ # @return [Object] Returns the model itself
84
+ def build_from_hash(attributes)
85
+ return nil unless attributes.is_a?(Hash)
86
+
87
+ self.class.swagger_types.each_pair do |key, type|
88
+ if type =~ /^Array<(.*)>/i
89
+ # check to ensure the input is an array given that the the attribute
90
+ # is documented as an array but the input is not
91
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
92
+ public_method("#{key}=").call(
93
+ attributes[self.class.attribute_map[key]]
94
+ .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
95
+ )
96
+ end
97
+ elsif !attributes[self.class.attribute_map[key]].nil?
98
+ public_method("#{key}=").call(
99
+ OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
100
+ )
101
+ end
102
+ # or else data not found in attributes(hash), not an issue as the data can be optional
103
+ end
104
+
105
+ self
106
+ end
107
+ # rubocop:enable Metrics/AbcSize, Layout/EmptyLines
108
+
109
+ # Returns the string representation of the object
110
+ # @return [String] String presentation of the object
111
+ def to_s
112
+ to_hash.to_s
113
+ end
114
+
115
+ # Returns the object in the form of hash
116
+ # @return [Hash] Returns the object in the form of hash
117
+ def to_hash
118
+ hash = {}
119
+ self.class.attribute_map.each_pair do |attr, param|
120
+ value = public_method(attr).call
121
+ next if value.nil? && !instance_variable_defined?("@#{attr}")
122
+
123
+ hash[param] = _to_hash(value)
124
+ end
125
+ hash
126
+ end
127
+
128
+ private
129
+
130
+ # Outputs non-array value in the form of hash
131
+ # For object, use to_hash. Otherwise, just return the value
132
+ # @param [Object] value Any valid value
133
+ # @return [Hash] Returns the value in the form of hash
134
+ def _to_hash(value)
135
+ if value.is_a?(Array)
136
+ value.compact.map { |v| _to_hash(v) }
137
+ elsif value.is_a?(Hash)
138
+ {}.tap do |hash|
139
+ value.each { |k, v| hash[k] = _to_hash(v) }
140
+ end
141
+ elsif value.respond_to? :to_hash
142
+ value.to_hash
143
+ else
144
+ value
145
+ end
146
+ end
147
+ end
148
+ end
149
+ # rubocop:enable Lint/UnneededCopDisableDirective