oraclebmc 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (141) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.txt +82 -0
  3. data/README.md +220 -0
  4. data/lib/oraclebmc/api_client.rb +349 -0
  5. data/lib/oraclebmc/config.rb +80 -0
  6. data/lib/oraclebmc/config_file_loader.rb +85 -0
  7. data/lib/oraclebmc/core/blockstorage_client.rb +459 -0
  8. data/lib/oraclebmc/core/compute_client.rb +1053 -0
  9. data/lib/oraclebmc/core/core.rb +82 -0
  10. data/lib/oraclebmc/core/models/attach_i_scsi_volume_details.rb +179 -0
  11. data/lib/oraclebmc/core/models/attach_volume_details.rb +206 -0
  12. data/lib/oraclebmc/core/models/capture_console_history_details.rb +162 -0
  13. data/lib/oraclebmc/core/models/console_history.rb +252 -0
  14. data/lib/oraclebmc/core/models/cpe.rb +209 -0
  15. data/lib/oraclebmc/core/models/create_cpe_details.rb +187 -0
  16. data/lib/oraclebmc/core/models/create_dhcp_details.rb +195 -0
  17. data/lib/oraclebmc/core/models/create_drg_attachment_details.rb +184 -0
  18. data/lib/oraclebmc/core/models/create_drg_details.rb +173 -0
  19. data/lib/oraclebmc/core/models/create_image_details.rb +188 -0
  20. data/lib/oraclebmc/core/models/create_internet_gateway_details.rb +195 -0
  21. data/lib/oraclebmc/core/models/create_ip_sec_connection_details.rb +210 -0
  22. data/lib/oraclebmc/core/models/create_route_table_details.rb +195 -0
  23. data/lib/oraclebmc/core/models/create_security_list_details.rb +206 -0
  24. data/lib/oraclebmc/core/models/create_subnet_details.rb +253 -0
  25. data/lib/oraclebmc/core/models/create_vcn_details.rb +187 -0
  26. data/lib/oraclebmc/core/models/create_volume_backup_details.rb +173 -0
  27. data/lib/oraclebmc/core/models/create_volume_details.rb +211 -0
  28. data/lib/oraclebmc/core/models/dhcp_dns_option.rb +203 -0
  29. data/lib/oraclebmc/core/models/dhcp_option.rb +171 -0
  30. data/lib/oraclebmc/core/models/dhcp_options.rb +246 -0
  31. data/lib/oraclebmc/core/models/drg.rb +224 -0
  32. data/lib/oraclebmc/core/models/drg_attachment.rb +246 -0
  33. data/lib/oraclebmc/core/models/egress_security_rule.rb +240 -0
  34. data/lib/oraclebmc/core/models/i_scsi_volume_attachment.rb +254 -0
  35. data/lib/oraclebmc/core/models/icmp_options.rb +173 -0
  36. data/lib/oraclebmc/core/models/image.rb +282 -0
  37. data/lib/oraclebmc/core/models/ingress_security_rule.rb +240 -0
  38. data/lib/oraclebmc/core/models/instance.rb +326 -0
  39. data/lib/oraclebmc/core/models/internet_gateway.rb +248 -0
  40. data/lib/oraclebmc/core/models/ip_sec_connection.rb +261 -0
  41. data/lib/oraclebmc/core/models/ip_sec_connection_device_config.rb +195 -0
  42. data/lib/oraclebmc/core/models/ip_sec_connection_device_status.rb +198 -0
  43. data/lib/oraclebmc/core/models/launch_instance_details.rb +327 -0
  44. data/lib/oraclebmc/core/models/port_range.rb +175 -0
  45. data/lib/oraclebmc/core/models/route_rule.rb +177 -0
  46. data/lib/oraclebmc/core/models/route_table.rb +246 -0
  47. data/lib/oraclebmc/core/models/security_list.rb +257 -0
  48. data/lib/oraclebmc/core/models/shape.rb +164 -0
  49. data/lib/oraclebmc/core/models/subnet.rb +325 -0
  50. data/lib/oraclebmc/core/models/tcp_options.rb +177 -0
  51. data/lib/oraclebmc/core/models/tunnel_config.rb +193 -0
  52. data/lib/oraclebmc/core/models/tunnel_status.rb +218 -0
  53. data/lib/oraclebmc/core/models/udp_options.rb +177 -0
  54. data/lib/oraclebmc/core/models/update_cpe_details.rb +162 -0
  55. data/lib/oraclebmc/core/models/update_dhcp_details.rb +172 -0
  56. data/lib/oraclebmc/core/models/update_drg_attachment_details.rb +162 -0
  57. data/lib/oraclebmc/core/models/update_drg_details.rb +162 -0
  58. data/lib/oraclebmc/core/models/update_image_details.rb +165 -0
  59. data/lib/oraclebmc/core/models/update_instance_details.rb +165 -0
  60. data/lib/oraclebmc/core/models/update_internet_gateway_details.rb +173 -0
  61. data/lib/oraclebmc/core/models/update_ip_sec_connection_details.rb +162 -0
  62. data/lib/oraclebmc/core/models/update_route_table_details.rb +173 -0
  63. data/lib/oraclebmc/core/models/update_security_list_details.rb +184 -0
  64. data/lib/oraclebmc/core/models/update_subnet_details.rb +162 -0
  65. data/lib/oraclebmc/core/models/update_vcn_details.rb +162 -0
  66. data/lib/oraclebmc/core/models/update_volume_backup_details.rb +162 -0
  67. data/lib/oraclebmc/core/models/update_volume_details.rb +163 -0
  68. data/lib/oraclebmc/core/models/vcn.rb +272 -0
  69. data/lib/oraclebmc/core/models/vnic.rb +274 -0
  70. data/lib/oraclebmc/core/models/vnic_attachment.rb +271 -0
  71. data/lib/oraclebmc/core/models/volume.rb +249 -0
  72. data/lib/oraclebmc/core/models/volume_attachment.rb +284 -0
  73. data/lib/oraclebmc/core/models/volume_backup.rb +273 -0
  74. data/lib/oraclebmc/core/util.rb +1 -0
  75. data/lib/oraclebmc/core/virtual_network_client.rb +2263 -0
  76. data/lib/oraclebmc/errors.rb +62 -0
  77. data/lib/oraclebmc/global_context.rb +21 -0
  78. data/lib/oraclebmc/identity/identity.rb +38 -0
  79. data/lib/oraclebmc/identity/identity_client.rb +1462 -0
  80. data/lib/oraclebmc/identity/models/add_user_to_group_details.rb +173 -0
  81. data/lib/oraclebmc/identity/models/api_key.rb +251 -0
  82. data/lib/oraclebmc/identity/models/availability_domain.rb +173 -0
  83. data/lib/oraclebmc/identity/models/compartment.rb +251 -0
  84. data/lib/oraclebmc/identity/models/create_api_key_details.rb +162 -0
  85. data/lib/oraclebmc/identity/models/create_compartment_details.rb +187 -0
  86. data/lib/oraclebmc/identity/models/create_group_details.rb +186 -0
  87. data/lib/oraclebmc/identity/models/create_policy_details.rb +215 -0
  88. data/lib/oraclebmc/identity/models/create_swift_password_details.rb +163 -0
  89. data/lib/oraclebmc/identity/models/create_user_details.rb +186 -0
  90. data/lib/oraclebmc/identity/models/group.rb +251 -0
  91. data/lib/oraclebmc/identity/models/policy.rb +277 -0
  92. data/lib/oraclebmc/identity/models/swift_password.rb +266 -0
  93. data/lib/oraclebmc/identity/models/ui_password.rb +227 -0
  94. data/lib/oraclebmc/identity/models/update_compartment_details.rb +162 -0
  95. data/lib/oraclebmc/identity/models/update_group_details.rb +162 -0
  96. data/lib/oraclebmc/identity/models/update_policy_details.rb +190 -0
  97. data/lib/oraclebmc/identity/models/update_state_details.rb +163 -0
  98. data/lib/oraclebmc/identity/models/update_swift_password_details.rb +162 -0
  99. data/lib/oraclebmc/identity/models/update_user_details.rb +162 -0
  100. data/lib/oraclebmc/identity/models/user.rb +257 -0
  101. data/lib/oraclebmc/identity/models/user_group_membership.rb +249 -0
  102. data/lib/oraclebmc/identity/util.rb +1 -0
  103. data/lib/oraclebmc/load_balancer/load_balancer.rb +45 -0
  104. data/lib/oraclebmc/load_balancer/load_balancer_client.rb +1218 -0
  105. data/lib/oraclebmc/load_balancer/models/backend.rb +262 -0
  106. data/lib/oraclebmc/load_balancer/models/backend_details.rb +248 -0
  107. data/lib/oraclebmc/load_balancer/models/backend_set.rb +211 -0
  108. data/lib/oraclebmc/load_balancer/models/backend_set_details.rb +197 -0
  109. data/lib/oraclebmc/load_balancer/models/certificate.rb +209 -0
  110. data/lib/oraclebmc/load_balancer/models/certificate_details.rb +245 -0
  111. data/lib/oraclebmc/load_balancer/models/create_backend_details.rb +248 -0
  112. data/lib/oraclebmc/load_balancer/models/create_backend_set_details.rb +210 -0
  113. data/lib/oraclebmc/load_balancer/models/create_certificate_details.rb +245 -0
  114. data/lib/oraclebmc/load_balancer/models/create_listener_details.rb +216 -0
  115. data/lib/oraclebmc/load_balancer/models/create_load_balancer_details.rb +233 -0
  116. data/lib/oraclebmc/load_balancer/models/health_checker.rb +265 -0
  117. data/lib/oraclebmc/load_balancer/models/health_checker_details.rb +264 -0
  118. data/lib/oraclebmc/load_balancer/models/ip_address.rb +165 -0
  119. data/lib/oraclebmc/load_balancer/models/listener.rb +216 -0
  120. data/lib/oraclebmc/load_balancer/models/listener_details.rb +202 -0
  121. data/lib/oraclebmc/load_balancer/models/load_balancer.rb +296 -0
  122. data/lib/oraclebmc/load_balancer/models/load_balancer_policy.rb +162 -0
  123. data/lib/oraclebmc/load_balancer/models/load_balancer_protocol.rb +162 -0
  124. data/lib/oraclebmc/load_balancer/models/load_balancer_shape.rb +162 -0
  125. data/lib/oraclebmc/load_balancer/models/ssl_configuration.rb +195 -0
  126. data/lib/oraclebmc/load_balancer/models/ssl_configuration_details.rb +195 -0
  127. data/lib/oraclebmc/load_balancer/models/update_backend_details.rb +220 -0
  128. data/lib/oraclebmc/load_balancer/models/update_backend_set_details.rb +197 -0
  129. data/lib/oraclebmc/load_balancer/models/update_health_checker_details.rb +263 -0
  130. data/lib/oraclebmc/load_balancer/models/update_listener_details.rb +202 -0
  131. data/lib/oraclebmc/load_balancer/models/update_load_balancer_details.rb +165 -0
  132. data/lib/oraclebmc/load_balancer/models/work_request.rb +269 -0
  133. data/lib/oraclebmc/load_balancer/models/work_request_error.rb +185 -0
  134. data/lib/oraclebmc/load_balancer/util.rb +55 -0
  135. data/lib/oraclebmc/regions.rb +41 -0
  136. data/lib/oraclebmc/response.rb +86 -0
  137. data/lib/oraclebmc/signer.rb +119 -0
  138. data/lib/oraclebmc/version.rb +5 -0
  139. data/lib/oraclebmc/waiter.rb +111 -0
  140. data/lib/oraclebmc.rb +20 -0
  141. metadata +265 -0
@@ -0,0 +1,262 @@
1
+ # Copyright (c) 2016 Oracle and/or its affiliates. All rights reserved.
2
+
3
+ require 'date'
4
+
5
+ module OracleBMC
6
+ class LoadBalancer::Models::Backend
7
+ # A name to uniquely identify this backend server in the backend set.
8
+ #
9
+ # Example: `My first backend server`
10
+ #
11
+ # @return [String]
12
+ attr_accessor :name
13
+
14
+ # The IP address of the backend server.
15
+ #
16
+ # Example: `10.10.10.4`
17
+ #
18
+ # @return [String]
19
+ attr_accessor :ip_address
20
+
21
+ # The communication port for the backend server.
22
+ #
23
+ # Example: `8080`
24
+ #
25
+ # @return [Integer]
26
+ attr_accessor :port
27
+
28
+ # The load balancing policy weight assigned to the server. Backend servers with a higher weight receive a larger
29
+ # proportion of incoming traffic. For example, a server weighted '3' receives 3 times the number of new connections
30
+ # as a server weighted '1'.
31
+ # For more information on load balancing policies, see
32
+ # [How Load Balancing Policies Work](https://docs.us-phoenix-1.oraclecloud.com/Content/Balance/Reference/lbpolicies.htm).
33
+ #
34
+ # Example: `3`
35
+ #
36
+ # @return [Integer]
37
+ attr_accessor :weight
38
+
39
+ # Whether the load balancer should drain this server. Servers marked \"drain\" receive no new
40
+ # incoming traffic.
41
+ #
42
+ # Example: `true`
43
+ #
44
+ # @return [BOOLEAN]
45
+ attr_accessor :drain
46
+
47
+ # Whether the load balancer should treat this server as a backup unit. If `true`, the load balancer forwards no ingress
48
+ # traffic to this backend server unless all other backend servers not marked as \"backup\" fail the health check policy.
49
+ #
50
+ # Example: `true`
51
+ #
52
+ # @return [BOOLEAN]
53
+ attr_accessor :backup
54
+
55
+ # Whether the load balancer should treat this server as offline. Offline servers receive no incoming
56
+ # traffic.
57
+ #
58
+ # Example: `true`
59
+ #
60
+ # @return [BOOLEAN]
61
+ attr_accessor :offline
62
+
63
+
64
+ # Initializes the object
65
+ # @param [Hash] attributes Model attributes in the form of hash
66
+ def initialize(attributes = {})
67
+ return unless attributes.is_a?(Hash)
68
+
69
+ # convert string to symbol for hash key
70
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
71
+
72
+
73
+ if attributes[:'name']
74
+ self.name = attributes[:'name']
75
+ end
76
+
77
+ if attributes[:'ipAddress']
78
+ self.ip_address = attributes[:'ipAddress']
79
+ end
80
+
81
+ if attributes[:'port']
82
+ self.port = attributes[:'port']
83
+ end
84
+
85
+ if attributes[:'weight']
86
+ self.weight = attributes[:'weight']
87
+ end
88
+
89
+ if attributes[:'drain']
90
+ self.drain = attributes[:'drain']
91
+ else
92
+ self.drain = false
93
+ end
94
+
95
+ if attributes[:'backup']
96
+ self.backup = attributes[:'backup']
97
+ else
98
+ self.backup = false
99
+ end
100
+
101
+ if attributes[:'offline']
102
+ self.offline = attributes[:'offline']
103
+ else
104
+ self.offline = false
105
+ end
106
+
107
+ end
108
+
109
+ # Checks equality by comparing each attribute.
110
+ # @param [Object] other_object to be compared
111
+ def ==(other_object)
112
+ return true if self.equal?(other_object)
113
+ self.class == other_object.class &&
114
+ name == other_object.name &&
115
+ ip_address == other_object.ip_address &&
116
+ port == other_object.port &&
117
+ weight == other_object.weight &&
118
+ drain == other_object.drain &&
119
+ backup == other_object.backup &&
120
+ offline == other_object.offline
121
+ end
122
+
123
+ # @see the `==` method
124
+ # @param [Object] other_object to be compared
125
+ def eql?(other_object)
126
+ self == other_object
127
+ end
128
+
129
+ # Calculates hash code according to all attributes.
130
+ # @return [Fixnum] Hash code
131
+ def hash
132
+ [name, ip_address, port, weight, drain, backup, offline].hash
133
+ end
134
+
135
+ # Builds the object from hash
136
+ # @param [Hash] attributes Model attributes in the form of hash
137
+ # @return [Object] Returns the model itself
138
+ def build_from_hash(attributes)
139
+ return nil unless attributes.is_a?(Hash)
140
+ self.class.swagger_types.each_pair do |key, type|
141
+ if type =~ /^Array<(.*)>/i
142
+ # check to ensure the input is an array given that the the attribute
143
+ # is documented as an array but the input is not
144
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
145
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
146
+ end
147
+ elsif !attributes[self.class.attribute_map[key]].nil?
148
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
149
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
150
+ end
151
+
152
+ self
153
+ end
154
+
155
+ # Returns the string representation of the object
156
+ # @return [String] String presentation of the object
157
+ def to_s
158
+ to_hash.to_s
159
+ end
160
+
161
+ # Returns the object in the form of hash
162
+ # @return [Hash] Returns the object in the form of hash
163
+ def to_hash
164
+ hash = {}
165
+ self.class.attribute_map.each_pair do |attr, param|
166
+ value = self.send(attr)
167
+ next if value.nil?
168
+ hash[param] = _to_hash(value)
169
+ end
170
+ hash
171
+ end
172
+
173
+ private
174
+
175
+ # Outputs non-array value in the form of hash
176
+ # For object, use to_hash. Otherwise, just return the value
177
+ # @param [Object] value Any valid value
178
+ # @return [Hash] Returns the value in the form of hash
179
+ def _to_hash(value)
180
+ if value.is_a?(Array)
181
+ value.compact.map{ |v| _to_hash(v) }
182
+ elsif value.is_a?(Hash)
183
+ {}.tap do |hash|
184
+ value.each { |k, v| hash[k] = _to_hash(v) }
185
+ end
186
+ elsif value.respond_to? :to_hash
187
+ value.to_hash
188
+ else
189
+ value
190
+ end
191
+ end
192
+
193
+ # Deserializes the data based on type
194
+ # @param [String] type Data type
195
+ # @param [String] value Value to be deserialized
196
+ # @return [Object] Deserialized data
197
+ def _deserialize(type, value)
198
+ case type.to_sym
199
+ when :DateTime
200
+ DateTime.parse(value)
201
+ when :Date
202
+ Date.parse(value)
203
+ when :String
204
+ value.to_s
205
+ when :Integer
206
+ value.to_i
207
+ when :Float
208
+ value.to_f
209
+ when :BOOLEAN
210
+ if value.to_s =~ /^(true|t|yes|y|1)$/i
211
+ true
212
+ else
213
+ false
214
+ end
215
+ when :Object
216
+ # generic object (usually a Hash), return directly
217
+ value
218
+ when /\AArray<(?<inner_type>.+)>\z/
219
+ inner_type = Regexp.last_match[:inner_type]
220
+ value.map { |v| _deserialize(inner_type, v) }
221
+ when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
222
+ k_type = Regexp.last_match[:k_type]
223
+ v_type = Regexp.last_match[:v_type]
224
+ {}.tap do |hash|
225
+ value.each do |k, v|
226
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
227
+ end
228
+ end
229
+ else # model
230
+ temp_model = OracleBMC.const_get(type.to_s).new
231
+ temp_model.build_from_hash(value)
232
+ end
233
+ end
234
+
235
+
236
+ # Attribute mapping from ruby-style variable name to JSON key.
237
+ def self.attribute_map
238
+ {
239
+ :'name' => :'name',
240
+ :'ip_address' => :'ipAddress',
241
+ :'port' => :'port',
242
+ :'weight' => :'weight',
243
+ :'drain' => :'drain',
244
+ :'backup' => :'backup',
245
+ :'offline' => :'offline'
246
+ }
247
+ end
248
+
249
+ # Attribute type mapping.
250
+ def self.swagger_types
251
+ {
252
+ :'name' => :'String',
253
+ :'ip_address' => :'String',
254
+ :'port' => :'Integer',
255
+ :'weight' => :'Integer',
256
+ :'drain' => :'BOOLEAN',
257
+ :'backup' => :'BOOLEAN',
258
+ :'offline' => :'BOOLEAN'
259
+ }
260
+ end
261
+ end
262
+ end
@@ -0,0 +1,248 @@
1
+ # Copyright (c) 2016 Oracle and/or its affiliates. All rights reserved.
2
+
3
+ require 'date'
4
+
5
+ module OracleBMC
6
+ class LoadBalancer::Models::BackendDetails
7
+ # The IP address of the backend server.
8
+ #
9
+ # Example: `10.10.10.4`
10
+ #
11
+ # @return [String]
12
+ attr_accessor :ip_address
13
+
14
+ # The communication port for the backend server.
15
+ #
16
+ # Example: `8080`
17
+ #
18
+ # @return [Integer]
19
+ attr_accessor :port
20
+
21
+ # The load balancing policy weight assigned to the server. Backend servers with a higher weight receive a larger
22
+ # proportion of incoming traffic. For example, a server weighted '3' receives 3 times the number of new connections
23
+ # as a server weighted '1'.
24
+ # For more information on load balancing policies, see
25
+ # [How Load Balancing Policies Work](https://docs.us-phoenix-1.oraclecloud.com/Content/Balance/Reference/lbpolicies.htm).
26
+ #
27
+ # Example: `3`
28
+ #
29
+ # @return [Integer]
30
+ attr_accessor :weight
31
+
32
+ # Whether the load balancer should treat this server as a backup unit. If `true`, the load balancer forwards no ingress
33
+ # traffic to this backend server unless all other backend servers not marked as \"backup\" fail the health check policy.
34
+ #
35
+ # Example: `true`
36
+ #
37
+ # @return [BOOLEAN]
38
+ attr_accessor :backup
39
+
40
+ # Whether the load balancer should drain this server. Servers marked \"drain\" receive no new
41
+ # incoming traffic.
42
+ #
43
+ # Example: `true`
44
+ #
45
+ # @return [BOOLEAN]
46
+ attr_accessor :drain
47
+
48
+ # Whether the load balancer should treat this server as offline. Offline servers receive no incoming
49
+ # traffic.
50
+ #
51
+ # Example: `true`
52
+ #
53
+ # @return [BOOLEAN]
54
+ attr_accessor :offline
55
+
56
+
57
+ # Initializes the object
58
+ # @param [Hash] attributes Model attributes in the form of hash
59
+ def initialize(attributes = {})
60
+ return unless attributes.is_a?(Hash)
61
+
62
+ # convert string to symbol for hash key
63
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
64
+
65
+
66
+ if attributes[:'ipAddress']
67
+ self.ip_address = attributes[:'ipAddress']
68
+ end
69
+
70
+ if attributes[:'port']
71
+ self.port = attributes[:'port']
72
+ end
73
+
74
+ if attributes[:'weight']
75
+ self.weight = attributes[:'weight']
76
+ end
77
+
78
+ if attributes[:'backup']
79
+ self.backup = attributes[:'backup']
80
+ else
81
+ self.backup = false
82
+ end
83
+
84
+ if attributes[:'drain']
85
+ self.drain = attributes[:'drain']
86
+ else
87
+ self.drain = false
88
+ end
89
+
90
+ if attributes[:'offline']
91
+ self.offline = attributes[:'offline']
92
+ else
93
+ self.offline = false
94
+ end
95
+
96
+ end
97
+
98
+ # Checks equality by comparing each attribute.
99
+ # @param [Object] other_object to be compared
100
+ def ==(other_object)
101
+ return true if self.equal?(other_object)
102
+ self.class == other_object.class &&
103
+ ip_address == other_object.ip_address &&
104
+ port == other_object.port &&
105
+ weight == other_object.weight &&
106
+ backup == other_object.backup &&
107
+ drain == other_object.drain &&
108
+ offline == other_object.offline
109
+ end
110
+
111
+ # @see the `==` method
112
+ # @param [Object] other_object to be compared
113
+ def eql?(other_object)
114
+ self == other_object
115
+ end
116
+
117
+ # Calculates hash code according to all attributes.
118
+ # @return [Fixnum] Hash code
119
+ def hash
120
+ [ip_address, port, weight, backup, drain, offline].hash
121
+ end
122
+
123
+ # Builds the object from hash
124
+ # @param [Hash] attributes Model attributes in the form of hash
125
+ # @return [Object] Returns the model itself
126
+ def build_from_hash(attributes)
127
+ return nil unless attributes.is_a?(Hash)
128
+ self.class.swagger_types.each_pair do |key, type|
129
+ if type =~ /^Array<(.*)>/i
130
+ # check to ensure the input is an array given that the the attribute
131
+ # is documented as an array but the input is not
132
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
133
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
134
+ end
135
+ elsif !attributes[self.class.attribute_map[key]].nil?
136
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
137
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
138
+ end
139
+
140
+ self
141
+ end
142
+
143
+ # Returns the string representation of the object
144
+ # @return [String] String presentation of the object
145
+ def to_s
146
+ to_hash.to_s
147
+ end
148
+
149
+ # Returns the object in the form of hash
150
+ # @return [Hash] Returns the object in the form of hash
151
+ def to_hash
152
+ hash = {}
153
+ self.class.attribute_map.each_pair do |attr, param|
154
+ value = self.send(attr)
155
+ next if value.nil?
156
+ hash[param] = _to_hash(value)
157
+ end
158
+ hash
159
+ end
160
+
161
+ private
162
+
163
+ # Outputs non-array value in the form of hash
164
+ # For object, use to_hash. Otherwise, just return the value
165
+ # @param [Object] value Any valid value
166
+ # @return [Hash] Returns the value in the form of hash
167
+ def _to_hash(value)
168
+ if value.is_a?(Array)
169
+ value.compact.map{ |v| _to_hash(v) }
170
+ elsif value.is_a?(Hash)
171
+ {}.tap do |hash|
172
+ value.each { |k, v| hash[k] = _to_hash(v) }
173
+ end
174
+ elsif value.respond_to? :to_hash
175
+ value.to_hash
176
+ else
177
+ value
178
+ end
179
+ end
180
+
181
+ # Deserializes the data based on type
182
+ # @param [String] type Data type
183
+ # @param [String] value Value to be deserialized
184
+ # @return [Object] Deserialized data
185
+ def _deserialize(type, value)
186
+ case type.to_sym
187
+ when :DateTime
188
+ DateTime.parse(value)
189
+ when :Date
190
+ Date.parse(value)
191
+ when :String
192
+ value.to_s
193
+ when :Integer
194
+ value.to_i
195
+ when :Float
196
+ value.to_f
197
+ when :BOOLEAN
198
+ if value.to_s =~ /^(true|t|yes|y|1)$/i
199
+ true
200
+ else
201
+ false
202
+ end
203
+ when :Object
204
+ # generic object (usually a Hash), return directly
205
+ value
206
+ when /\AArray<(?<inner_type>.+)>\z/
207
+ inner_type = Regexp.last_match[:inner_type]
208
+ value.map { |v| _deserialize(inner_type, v) }
209
+ when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
210
+ k_type = Regexp.last_match[:k_type]
211
+ v_type = Regexp.last_match[:v_type]
212
+ {}.tap do |hash|
213
+ value.each do |k, v|
214
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
215
+ end
216
+ end
217
+ else # model
218
+ temp_model = OracleBMC.const_get(type.to_s).new
219
+ temp_model.build_from_hash(value)
220
+ end
221
+ end
222
+
223
+
224
+ # Attribute mapping from ruby-style variable name to JSON key.
225
+ def self.attribute_map
226
+ {
227
+ :'ip_address' => :'ipAddress',
228
+ :'port' => :'port',
229
+ :'weight' => :'weight',
230
+ :'backup' => :'backup',
231
+ :'drain' => :'drain',
232
+ :'offline' => :'offline'
233
+ }
234
+ end
235
+
236
+ # Attribute type mapping.
237
+ def self.swagger_types
238
+ {
239
+ :'ip_address' => :'String',
240
+ :'port' => :'Integer',
241
+ :'weight' => :'Integer',
242
+ :'backup' => :'BOOLEAN',
243
+ :'drain' => :'BOOLEAN',
244
+ :'offline' => :'BOOLEAN'
245
+ }
246
+ end
247
+ end
248
+ end