oraclebmc 1.1.2 → 1.2.0

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 (129) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE.txt +2 -2
  3. data/README.md +2 -2
  4. data/lib/oraclebmc/api_client.rb +1 -50
  5. data/lib/oraclebmc/core/compute_client.rb +33 -0
  6. data/lib/oraclebmc/core/core.rb +2 -0
  7. data/lib/oraclebmc/core/models/attach_i_scsi_volume_details.rb +2 -43
  8. data/lib/oraclebmc/core/models/attach_volume_details.rb +2 -43
  9. data/lib/oraclebmc/core/models/capture_console_history_details.rb +2 -43
  10. data/lib/oraclebmc/core/models/console_history.rb +2 -43
  11. data/lib/oraclebmc/core/models/cpe.rb +2 -43
  12. data/lib/oraclebmc/core/models/create_cpe_details.rb +2 -43
  13. data/lib/oraclebmc/core/models/create_dhcp_details.rb +2 -43
  14. data/lib/oraclebmc/core/models/create_drg_attachment_details.rb +2 -43
  15. data/lib/oraclebmc/core/models/create_drg_details.rb +2 -43
  16. data/lib/oraclebmc/core/models/create_image_details.rb +2 -43
  17. data/lib/oraclebmc/core/models/create_internet_gateway_details.rb +2 -43
  18. data/lib/oraclebmc/core/models/create_ip_sec_connection_details.rb +2 -43
  19. data/lib/oraclebmc/core/models/create_route_table_details.rb +2 -43
  20. data/lib/oraclebmc/core/models/create_security_list_details.rb +2 -43
  21. data/lib/oraclebmc/core/models/create_subnet_details.rb +28 -44
  22. data/lib/oraclebmc/core/models/create_vcn_details.rb +33 -47
  23. data/lib/oraclebmc/core/models/create_volume_backup_details.rb +2 -43
  24. data/lib/oraclebmc/core/models/create_volume_details.rb +2 -43
  25. data/lib/oraclebmc/core/models/dhcp_dns_option.rb +16 -49
  26. data/lib/oraclebmc/core/models/dhcp_option.rb +7 -43
  27. data/lib/oraclebmc/core/models/dhcp_options.rb +2 -43
  28. data/lib/oraclebmc/core/models/dhcp_search_domain_option.rb +143 -0
  29. data/lib/oraclebmc/core/models/drg.rb +2 -43
  30. data/lib/oraclebmc/core/models/drg_attachment.rb +2 -43
  31. data/lib/oraclebmc/core/models/egress_security_rule.rb +2 -43
  32. data/lib/oraclebmc/core/models/i_scsi_volume_attachment.rb +2 -43
  33. data/lib/oraclebmc/core/models/icmp_options.rb +2 -43
  34. data/lib/oraclebmc/core/models/image.rb +2 -43
  35. data/lib/oraclebmc/core/models/ingress_security_rule.rb +2 -43
  36. data/lib/oraclebmc/core/models/instance.rb +7 -43
  37. data/lib/oraclebmc/core/models/instance_credentials.rb +132 -0
  38. data/lib/oraclebmc/core/models/internet_gateway.rb +2 -43
  39. data/lib/oraclebmc/core/models/ip_sec_connection.rb +2 -43
  40. data/lib/oraclebmc/core/models/ip_sec_connection_device_config.rb +2 -43
  41. data/lib/oraclebmc/core/models/ip_sec_connection_device_status.rb +2 -43
  42. data/lib/oraclebmc/core/models/launch_instance_details.rb +32 -44
  43. data/lib/oraclebmc/core/models/port_range.rb +2 -43
  44. data/lib/oraclebmc/core/models/route_rule.rb +2 -43
  45. data/lib/oraclebmc/core/models/route_table.rb +2 -43
  46. data/lib/oraclebmc/core/models/security_list.rb +2 -43
  47. data/lib/oraclebmc/core/models/shape.rb +2 -43
  48. data/lib/oraclebmc/core/models/subnet.rb +45 -44
  49. data/lib/oraclebmc/core/models/tcp_options.rb +2 -43
  50. data/lib/oraclebmc/core/models/tunnel_config.rb +2 -43
  51. data/lib/oraclebmc/core/models/tunnel_status.rb +2 -43
  52. data/lib/oraclebmc/core/models/udp_options.rb +2 -43
  53. data/lib/oraclebmc/core/models/update_cpe_details.rb +2 -43
  54. data/lib/oraclebmc/core/models/update_dhcp_details.rb +2 -43
  55. data/lib/oraclebmc/core/models/update_drg_attachment_details.rb +2 -43
  56. data/lib/oraclebmc/core/models/update_drg_details.rb +2 -43
  57. data/lib/oraclebmc/core/models/update_image_details.rb +2 -43
  58. data/lib/oraclebmc/core/models/update_instance_details.rb +2 -43
  59. data/lib/oraclebmc/core/models/update_internet_gateway_details.rb +2 -43
  60. data/lib/oraclebmc/core/models/update_ip_sec_connection_details.rb +2 -43
  61. data/lib/oraclebmc/core/models/update_route_table_details.rb +2 -43
  62. data/lib/oraclebmc/core/models/update_security_list_details.rb +2 -43
  63. data/lib/oraclebmc/core/models/update_subnet_details.rb +2 -43
  64. data/lib/oraclebmc/core/models/update_vcn_details.rb +2 -43
  65. data/lib/oraclebmc/core/models/update_volume_backup_details.rb +2 -43
  66. data/lib/oraclebmc/core/models/update_volume_details.rb +2 -43
  67. data/lib/oraclebmc/core/models/vcn.rb +48 -47
  68. data/lib/oraclebmc/core/models/vnic.rb +30 -47
  69. data/lib/oraclebmc/core/models/vnic_attachment.rb +2 -43
  70. data/lib/oraclebmc/core/models/volume.rb +2 -43
  71. data/lib/oraclebmc/core/models/volume_attachment.rb +2 -43
  72. data/lib/oraclebmc/core/models/volume_backup.rb +2 -43
  73. data/lib/oraclebmc/core/virtual_network_client.rb +10 -4
  74. data/lib/oraclebmc/identity/models/add_user_to_group_details.rb +2 -43
  75. data/lib/oraclebmc/identity/models/api_key.rb +2 -43
  76. data/lib/oraclebmc/identity/models/availability_domain.rb +2 -43
  77. data/lib/oraclebmc/identity/models/compartment.rb +2 -43
  78. data/lib/oraclebmc/identity/models/create_api_key_details.rb +2 -43
  79. data/lib/oraclebmc/identity/models/create_compartment_details.rb +2 -43
  80. data/lib/oraclebmc/identity/models/create_group_details.rb +2 -43
  81. data/lib/oraclebmc/identity/models/create_policy_details.rb +2 -43
  82. data/lib/oraclebmc/identity/models/create_swift_password_details.rb +2 -43
  83. data/lib/oraclebmc/identity/models/create_user_details.rb +2 -43
  84. data/lib/oraclebmc/identity/models/group.rb +2 -43
  85. data/lib/oraclebmc/identity/models/policy.rb +2 -43
  86. data/lib/oraclebmc/identity/models/swift_password.rb +2 -43
  87. data/lib/oraclebmc/identity/models/ui_password.rb +2 -43
  88. data/lib/oraclebmc/identity/models/update_compartment_details.rb +2 -43
  89. data/lib/oraclebmc/identity/models/update_group_details.rb +2 -43
  90. data/lib/oraclebmc/identity/models/update_policy_details.rb +2 -43
  91. data/lib/oraclebmc/identity/models/update_state_details.rb +2 -43
  92. data/lib/oraclebmc/identity/models/update_swift_password_details.rb +2 -43
  93. data/lib/oraclebmc/identity/models/update_user_details.rb +2 -43
  94. data/lib/oraclebmc/identity/models/user.rb +2 -43
  95. data/lib/oraclebmc/identity/models/user_group_membership.rb +2 -43
  96. data/lib/oraclebmc/internal/internal.rb +11 -0
  97. data/lib/oraclebmc/internal/util.rb +69 -0
  98. data/lib/oraclebmc/load_balancer/models/backend.rb +2 -43
  99. data/lib/oraclebmc/load_balancer/models/backend_details.rb +2 -43
  100. data/lib/oraclebmc/load_balancer/models/backend_set.rb +2 -43
  101. data/lib/oraclebmc/load_balancer/models/backend_set_details.rb +2 -43
  102. data/lib/oraclebmc/load_balancer/models/certificate.rb +2 -43
  103. data/lib/oraclebmc/load_balancer/models/certificate_details.rb +2 -43
  104. data/lib/oraclebmc/load_balancer/models/create_backend_details.rb +2 -43
  105. data/lib/oraclebmc/load_balancer/models/create_backend_set_details.rb +2 -43
  106. data/lib/oraclebmc/load_balancer/models/create_certificate_details.rb +2 -43
  107. data/lib/oraclebmc/load_balancer/models/create_listener_details.rb +2 -43
  108. data/lib/oraclebmc/load_balancer/models/create_load_balancer_details.rb +2 -43
  109. data/lib/oraclebmc/load_balancer/models/health_checker.rb +2 -43
  110. data/lib/oraclebmc/load_balancer/models/health_checker_details.rb +2 -43
  111. data/lib/oraclebmc/load_balancer/models/ip_address.rb +2 -43
  112. data/lib/oraclebmc/load_balancer/models/listener.rb +2 -43
  113. data/lib/oraclebmc/load_balancer/models/listener_details.rb +2 -43
  114. data/lib/oraclebmc/load_balancer/models/load_balancer.rb +2 -43
  115. data/lib/oraclebmc/load_balancer/models/load_balancer_policy.rb +2 -43
  116. data/lib/oraclebmc/load_balancer/models/load_balancer_protocol.rb +2 -43
  117. data/lib/oraclebmc/load_balancer/models/load_balancer_shape.rb +2 -43
  118. data/lib/oraclebmc/load_balancer/models/ssl_configuration.rb +2 -43
  119. data/lib/oraclebmc/load_balancer/models/ssl_configuration_details.rb +2 -43
  120. data/lib/oraclebmc/load_balancer/models/update_backend_details.rb +2 -43
  121. data/lib/oraclebmc/load_balancer/models/update_backend_set_details.rb +2 -43
  122. data/lib/oraclebmc/load_balancer/models/update_health_checker_details.rb +2 -43
  123. data/lib/oraclebmc/load_balancer/models/update_listener_details.rb +2 -43
  124. data/lib/oraclebmc/load_balancer/models/update_load_balancer_details.rb +2 -43
  125. data/lib/oraclebmc/load_balancer/models/work_request.rb +2 -43
  126. data/lib/oraclebmc/load_balancer/models/work_request_error.rb +2 -43
  127. data/lib/oraclebmc/version.rb +1 -1
  128. data/lib/oraclebmc.rb +1 -0
  129. metadata +6 -2
@@ -63,10 +63,10 @@ module OracleBMC
63
63
  # check to ensure the input is an array given that the the attribute
64
64
  # is documented as an array but the input is not
65
65
  if attributes[self.class.attribute_map[key]].is_a?(Array)
66
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
66
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| OracleBMC::Internal::Util.convert_to_type($1, v) } )
67
67
  end
68
68
  elsif !attributes[self.class.attribute_map[key]].nil?
69
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
69
+ self.send("#{key}=", OracleBMC::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]]))
70
70
  end # or else data not found in attributes(hash), not an issue as the data can be optional
71
71
  end
72
72
 
@@ -111,47 +111,6 @@ module OracleBMC
111
111
  end
112
112
  end
113
113
 
114
- # Deserializes the data based on type
115
- # @param [String] type Data type
116
- # @param [String] value Value to be deserialized
117
- # @return [Object] Deserialized data
118
- def _deserialize(type, value)
119
- case type.to_sym
120
- when :DateTime
121
- DateTime.parse(value)
122
- when :Date
123
- Date.parse(value)
124
- when :String
125
- value.to_s
126
- when :Integer
127
- value.to_i
128
- when :Float
129
- value.to_f
130
- when :BOOLEAN
131
- if value.to_s =~ /^(true|t|yes|y|1)$/i
132
- true
133
- else
134
- false
135
- end
136
- when :Object
137
- # generic object (usually a Hash), return directly
138
- value
139
- when /\AArray<(?<inner_type>.+)>\z/
140
- inner_type = Regexp.last_match[:inner_type]
141
- value.map { |v| _deserialize(inner_type, v) }
142
- when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
143
- k_type = Regexp.last_match[:k_type]
144
- v_type = Regexp.last_match[:v_type]
145
- {}.tap do |hash|
146
- value.each do |k, v|
147
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
148
- end
149
- end
150
- else # model
151
- temp_model = OracleBMC.const_get(type.to_s).new
152
- temp_model.build_from_hash(value)
153
- end
154
- end
155
114
 
156
115
 
157
116
  # Attribute mapping from ruby-style variable name to JSON key.
@@ -158,10 +158,10 @@ module OracleBMC
158
158
  # check to ensure the input is an array given that the the attribute
159
159
  # is documented as an array but the input is not
160
160
  if attributes[self.class.attribute_map[key]].is_a?(Array)
161
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
161
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| OracleBMC::Internal::Util.convert_to_type($1, v) } )
162
162
  end
163
163
  elsif !attributes[self.class.attribute_map[key]].nil?
164
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
164
+ self.send("#{key}=", OracleBMC::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]]))
165
165
  end # or else data not found in attributes(hash), not an issue as the data can be optional
166
166
  end
167
167
 
@@ -206,47 +206,6 @@ module OracleBMC
206
206
  end
207
207
  end
208
208
 
209
- # Deserializes the data based on type
210
- # @param [String] type Data type
211
- # @param [String] value Value to be deserialized
212
- # @return [Object] Deserialized data
213
- def _deserialize(type, value)
214
- case type.to_sym
215
- when :DateTime
216
- DateTime.parse(value)
217
- when :Date
218
- Date.parse(value)
219
- when :String
220
- value.to_s
221
- when :Integer
222
- value.to_i
223
- when :Float
224
- value.to_f
225
- when :BOOLEAN
226
- if value.to_s =~ /^(true|t|yes|y|1)$/i
227
- true
228
- else
229
- false
230
- end
231
- when :Object
232
- # generic object (usually a Hash), return directly
233
- value
234
- when /\AArray<(?<inner_type>.+)>\z/
235
- inner_type = Regexp.last_match[:inner_type]
236
- value.map { |v| _deserialize(inner_type, v) }
237
- when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
238
- k_type = Regexp.last_match[:k_type]
239
- v_type = Regexp.last_match[:v_type]
240
- {}.tap do |hash|
241
- value.each do |k, v|
242
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
243
- end
244
- end
245
- else # model
246
- temp_model = OracleBMC.const_get(type.to_s).new
247
- temp_model.build_from_hash(value)
248
- end
249
- end
250
209
 
251
210
 
252
211
  # Attribute mapping from ruby-style variable name to JSON key.
@@ -122,10 +122,10 @@ module OracleBMC
122
122
  # check to ensure the input is an array given that the the attribute
123
123
  # is documented as an array but the input is not
124
124
  if attributes[self.class.attribute_map[key]].is_a?(Array)
125
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
125
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| OracleBMC::Internal::Util.convert_to_type($1, v) } )
126
126
  end
127
127
  elsif !attributes[self.class.attribute_map[key]].nil?
128
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
128
+ self.send("#{key}=", OracleBMC::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]]))
129
129
  end # or else data not found in attributes(hash), not an issue as the data can be optional
130
130
  end
131
131
 
@@ -170,47 +170,6 @@ module OracleBMC
170
170
  end
171
171
  end
172
172
 
173
- # Deserializes the data based on type
174
- # @param [String] type Data type
175
- # @param [String] value Value to be deserialized
176
- # @return [Object] Deserialized data
177
- def _deserialize(type, value)
178
- case type.to_sym
179
- when :DateTime
180
- DateTime.parse(value)
181
- when :Date
182
- Date.parse(value)
183
- when :String
184
- value.to_s
185
- when :Integer
186
- value.to_i
187
- when :Float
188
- value.to_f
189
- when :BOOLEAN
190
- if value.to_s =~ /^(true|t|yes|y|1)$/i
191
- true
192
- else
193
- false
194
- end
195
- when :Object
196
- # generic object (usually a Hash), return directly
197
- value
198
- when /\AArray<(?<inner_type>.+)>\z/
199
- inner_type = Regexp.last_match[:inner_type]
200
- value.map { |v| _deserialize(inner_type, v) }
201
- when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
202
- k_type = Regexp.last_match[:k_type]
203
- v_type = Regexp.last_match[:v_type]
204
- {}.tap do |hash|
205
- value.each do |k, v|
206
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
207
- end
208
- end
209
- else # model
210
- temp_model = OracleBMC.const_get(type.to_s).new
211
- temp_model.build_from_hash(value)
212
- end
213
- end
214
173
 
215
174
 
216
175
  # Attribute mapping from ruby-style variable name to JSON key.
@@ -59,6 +59,11 @@ module OracleBMC
59
59
  # following iSCSI IP address: 169.254.0.2, and boot volume IQN:
60
60
  # iqn.2015-02.oracle.boot.
61
61
  #
62
+ # For more information about the Bring Your Own Image feature of
63
+ # Oracle Bare Metal Cloud Services, see [Bring Your Own Custom
64
+ # Image: RHEL 7.x & Derivatives (CentOS, Oracle Linux)]
65
+ # (/Content/General/Reference/aqswhitepapers.htm).
66
+ #
62
67
  # For more information about iPXE, see http://ipxe.org.
63
68
  #
64
69
  # @return [String]
@@ -198,10 +203,10 @@ module OracleBMC
198
203
  # check to ensure the input is an array given that the the attribute
199
204
  # is documented as an array but the input is not
200
205
  if attributes[self.class.attribute_map[key]].is_a?(Array)
201
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
206
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| OracleBMC::Internal::Util.convert_to_type($1, v) } )
202
207
  end
203
208
  elsif !attributes[self.class.attribute_map[key]].nil?
204
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
209
+ self.send("#{key}=", OracleBMC::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]]))
205
210
  end # or else data not found in attributes(hash), not an issue as the data can be optional
206
211
  end
207
212
 
@@ -246,47 +251,6 @@ module OracleBMC
246
251
  end
247
252
  end
248
253
 
249
- # Deserializes the data based on type
250
- # @param [String] type Data type
251
- # @param [String] value Value to be deserialized
252
- # @return [Object] Deserialized data
253
- def _deserialize(type, value)
254
- case type.to_sym
255
- when :DateTime
256
- DateTime.parse(value)
257
- when :Date
258
- Date.parse(value)
259
- when :String
260
- value.to_s
261
- when :Integer
262
- value.to_i
263
- when :Float
264
- value.to_f
265
- when :BOOLEAN
266
- if value.to_s =~ /^(true|t|yes|y|1)$/i
267
- true
268
- else
269
- false
270
- end
271
- when :Object
272
- # generic object (usually a Hash), return directly
273
- value
274
- when /\AArray<(?<inner_type>.+)>\z/
275
- inner_type = Regexp.last_match[:inner_type]
276
- value.map { |v| _deserialize(inner_type, v) }
277
- when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
278
- k_type = Regexp.last_match[:k_type]
279
- v_type = Regexp.last_match[:v_type]
280
- {}.tap do |hash|
281
- value.each do |k, v|
282
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
283
- end
284
- end
285
- else # model
286
- temp_model = OracleBMC.const_get(type.to_s).new
287
- temp_model.build_from_hash(value)
288
- end
289
- end
290
254
 
291
255
 
292
256
  # Attribute mapping from ruby-style variable name to JSON key.
@@ -0,0 +1,132 @@
1
+ # Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
2
+
3
+ require 'date'
4
+
5
+ module OracleBMC
6
+ class Core::Models::InstanceCredentials
7
+ # The password for the username.
8
+ # @return [String]
9
+ attr_accessor :password
10
+
11
+ # The username.
12
+ # @return [String]
13
+ attr_accessor :username
14
+
15
+
16
+ # Initializes the object
17
+ # @param [Hash] attributes Model attributes in the form of hash
18
+ def initialize(attributes = {})
19
+ return unless attributes.is_a?(Hash)
20
+
21
+ # convert string to symbol for hash key
22
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
23
+
24
+
25
+ if attributes[:'password']
26
+ self.password = attributes[:'password']
27
+ end
28
+
29
+ if attributes[:'username']
30
+ self.username = attributes[:'username']
31
+ end
32
+
33
+ end
34
+
35
+ # Checks equality by comparing each attribute.
36
+ # @param [Object] other_object to be compared
37
+ def ==(other_object)
38
+ return true if self.equal?(other_object)
39
+ self.class == other_object.class &&
40
+ password == other_object.password &&
41
+ username == other_object.username
42
+ end
43
+
44
+ # @see the `==` method
45
+ # @param [Object] other_object to be compared
46
+ def eql?(other_object)
47
+ self == other_object
48
+ end
49
+
50
+ # Calculates hash code according to all attributes.
51
+ # @return [Fixnum] Hash code
52
+ def hash
53
+ [password, username].hash
54
+ end
55
+
56
+ # Builds the object from hash
57
+ # @param [Hash] attributes Model attributes in the form of hash
58
+ # @return [Object] Returns the model itself
59
+ def build_from_hash(attributes)
60
+ return nil unless attributes.is_a?(Hash)
61
+ self.class.swagger_types.each_pair do |key, type|
62
+ if type =~ /^Array<(.*)>/i
63
+ # check to ensure the input is an array given that the the attribute
64
+ # is documented as an array but the input is not
65
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
66
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| OracleBMC::Internal::Util.convert_to_type($1, v) } )
67
+ end
68
+ elsif !attributes[self.class.attribute_map[key]].nil?
69
+ self.send("#{key}=", OracleBMC::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]]))
70
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
71
+ end
72
+
73
+ self
74
+ end
75
+
76
+ # Returns the string representation of the object
77
+ # @return [String] String presentation of the object
78
+ def to_s
79
+ to_hash.to_s
80
+ end
81
+
82
+ # Returns the object in the form of hash
83
+ # @return [Hash] Returns the object in the form of hash
84
+ def to_hash
85
+ hash = {}
86
+ self.class.attribute_map.each_pair do |attr, param|
87
+ value = self.send(attr)
88
+ next if value.nil?
89
+ hash[param] = _to_hash(value)
90
+ end
91
+ hash
92
+ end
93
+
94
+ private
95
+
96
+ # Outputs non-array value in the form of hash
97
+ # For object, use to_hash. Otherwise, just return the value
98
+ # @param [Object] value Any valid value
99
+ # @return [Hash] Returns the value in the form of hash
100
+ def _to_hash(value)
101
+ if value.is_a?(Array)
102
+ value.compact.map{ |v| _to_hash(v) }
103
+ elsif value.is_a?(Hash)
104
+ {}.tap do |hash|
105
+ value.each { |k, v| hash[k] = _to_hash(v) }
106
+ end
107
+ elsif value.respond_to? :to_hash
108
+ value.to_hash
109
+ else
110
+ value
111
+ end
112
+ end
113
+
114
+
115
+
116
+ # Attribute mapping from ruby-style variable name to JSON key.
117
+ def self.attribute_map
118
+ {
119
+ :'password' => :'password',
120
+ :'username' => :'username'
121
+ }
122
+ end
123
+
124
+ # Attribute type mapping.
125
+ def self.swagger_types
126
+ {
127
+ :'password' => :'String',
128
+ :'username' => :'String'
129
+ }
130
+ end
131
+ end
132
+ end
@@ -128,10 +128,10 @@ module OracleBMC
128
128
  # check to ensure the input is an array given that the the attribute
129
129
  # is documented as an array but the input is not
130
130
  if attributes[self.class.attribute_map[key]].is_a?(Array)
131
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
131
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| OracleBMC::Internal::Util.convert_to_type($1, v) } )
132
132
  end
133
133
  elsif !attributes[self.class.attribute_map[key]].nil?
134
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
134
+ self.send("#{key}=", OracleBMC::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]]))
135
135
  end # or else data not found in attributes(hash), not an issue as the data can be optional
136
136
  end
137
137
 
@@ -176,47 +176,6 @@ module OracleBMC
176
176
  end
177
177
  end
178
178
 
179
- # Deserializes the data based on type
180
- # @param [String] type Data type
181
- # @param [String] value Value to be deserialized
182
- # @return [Object] Deserialized data
183
- def _deserialize(type, value)
184
- case type.to_sym
185
- when :DateTime
186
- DateTime.parse(value)
187
- when :Date
188
- Date.parse(value)
189
- when :String
190
- value.to_s
191
- when :Integer
192
- value.to_i
193
- when :Float
194
- value.to_f
195
- when :BOOLEAN
196
- if value.to_s =~ /^(true|t|yes|y|1)$/i
197
- true
198
- else
199
- false
200
- end
201
- when :Object
202
- # generic object (usually a Hash), return directly
203
- value
204
- when /\AArray<(?<inner_type>.+)>\z/
205
- inner_type = Regexp.last_match[:inner_type]
206
- value.map { |v| _deserialize(inner_type, v) }
207
- when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
208
- k_type = Regexp.last_match[:k_type]
209
- v_type = Regexp.last_match[:v_type]
210
- {}.tap do |hash|
211
- value.each do |k, v|
212
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
213
- end
214
- end
215
- else # model
216
- temp_model = OracleBMC.const_get(type.to_s).new
217
- temp_model.build_from_hash(value)
218
- end
219
- end
220
179
 
221
180
 
222
181
  # Attribute mapping from ruby-style variable name to JSON key.
@@ -139,10 +139,10 @@ module OracleBMC
139
139
  # check to ensure the input is an array given that the the attribute
140
140
  # is documented as an array but the input is not
141
141
  if attributes[self.class.attribute_map[key]].is_a?(Array)
142
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
142
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| OracleBMC::Internal::Util.convert_to_type($1, v) } )
143
143
  end
144
144
  elsif !attributes[self.class.attribute_map[key]].nil?
145
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
145
+ self.send("#{key}=", OracleBMC::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]]))
146
146
  end # or else data not found in attributes(hash), not an issue as the data can be optional
147
147
  end
148
148
 
@@ -187,47 +187,6 @@ module OracleBMC
187
187
  end
188
188
  end
189
189
 
190
- # Deserializes the data based on type
191
- # @param [String] type Data type
192
- # @param [String] value Value to be deserialized
193
- # @return [Object] Deserialized data
194
- def _deserialize(type, value)
195
- case type.to_sym
196
- when :DateTime
197
- DateTime.parse(value)
198
- when :Date
199
- Date.parse(value)
200
- when :String
201
- value.to_s
202
- when :Integer
203
- value.to_i
204
- when :Float
205
- value.to_f
206
- when :BOOLEAN
207
- if value.to_s =~ /^(true|t|yes|y|1)$/i
208
- true
209
- else
210
- false
211
- end
212
- when :Object
213
- # generic object (usually a Hash), return directly
214
- value
215
- when /\AArray<(?<inner_type>.+)>\z/
216
- inner_type = Regexp.last_match[:inner_type]
217
- value.map { |v| _deserialize(inner_type, v) }
218
- when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
219
- k_type = Regexp.last_match[:k_type]
220
- v_type = Regexp.last_match[:v_type]
221
- {}.tap do |hash|
222
- value.each do |k, v|
223
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
224
- end
225
- end
226
- else # model
227
- temp_model = OracleBMC.const_get(type.to_s).new
228
- temp_model.build_from_hash(value)
229
- end
230
- end
231
190
 
232
191
 
233
192
  # Attribute mapping from ruby-style variable name to JSON key.
@@ -81,10 +81,10 @@ module OracleBMC
81
81
  # check to ensure the input is an array given that the the attribute
82
82
  # is documented as an array but the input is not
83
83
  if attributes[self.class.attribute_map[key]].is_a?(Array)
84
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
84
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| OracleBMC::Internal::Util.convert_to_type($1, v) } )
85
85
  end
86
86
  elsif !attributes[self.class.attribute_map[key]].nil?
87
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
87
+ self.send("#{key}=", OracleBMC::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]]))
88
88
  end # or else data not found in attributes(hash), not an issue as the data can be optional
89
89
  end
90
90
 
@@ -129,47 +129,6 @@ module OracleBMC
129
129
  end
130
130
  end
131
131
 
132
- # Deserializes the data based on type
133
- # @param [String] type Data type
134
- # @param [String] value Value to be deserialized
135
- # @return [Object] Deserialized data
136
- def _deserialize(type, value)
137
- case type.to_sym
138
- when :DateTime
139
- DateTime.parse(value)
140
- when :Date
141
- Date.parse(value)
142
- when :String
143
- value.to_s
144
- when :Integer
145
- value.to_i
146
- when :Float
147
- value.to_f
148
- when :BOOLEAN
149
- if value.to_s =~ /^(true|t|yes|y|1)$/i
150
- true
151
- else
152
- false
153
- end
154
- when :Object
155
- # generic object (usually a Hash), return directly
156
- value
157
- when /\AArray<(?<inner_type>.+)>\z/
158
- inner_type = Regexp.last_match[:inner_type]
159
- value.map { |v| _deserialize(inner_type, v) }
160
- when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
161
- k_type = Regexp.last_match[:k_type]
162
- v_type = Regexp.last_match[:v_type]
163
- {}.tap do |hash|
164
- value.each do |k, v|
165
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
166
- end
167
- end
168
- else # model
169
- temp_model = OracleBMC.const_get(type.to_s).new
170
- temp_model.build_from_hash(value)
171
- end
172
- end
173
132
 
174
133
 
175
134
  # Attribute mapping from ruby-style variable name to JSON key.
@@ -84,10 +84,10 @@ module OracleBMC
84
84
  # check to ensure the input is an array given that the the attribute
85
85
  # is documented as an array but the input is not
86
86
  if attributes[self.class.attribute_map[key]].is_a?(Array)
87
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
87
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| OracleBMC::Internal::Util.convert_to_type($1, v) } )
88
88
  end
89
89
  elsif !attributes[self.class.attribute_map[key]].nil?
90
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
90
+ self.send("#{key}=", OracleBMC::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]]))
91
91
  end # or else data not found in attributes(hash), not an issue as the data can be optional
92
92
  end
93
93
 
@@ -132,47 +132,6 @@ module OracleBMC
132
132
  end
133
133
  end
134
134
 
135
- # Deserializes the data based on type
136
- # @param [String] type Data type
137
- # @param [String] value Value to be deserialized
138
- # @return [Object] Deserialized data
139
- def _deserialize(type, value)
140
- case type.to_sym
141
- when :DateTime
142
- DateTime.parse(value)
143
- when :Date
144
- Date.parse(value)
145
- when :String
146
- value.to_s
147
- when :Integer
148
- value.to_i
149
- when :Float
150
- value.to_f
151
- when :BOOLEAN
152
- if value.to_s =~ /^(true|t|yes|y|1)$/i
153
- true
154
- else
155
- false
156
- end
157
- when :Object
158
- # generic object (usually a Hash), return directly
159
- value
160
- when /\AArray<(?<inner_type>.+)>\z/
161
- inner_type = Regexp.last_match[:inner_type]
162
- value.map { |v| _deserialize(inner_type, v) }
163
- when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
164
- k_type = Regexp.last_match[:k_type]
165
- v_type = Regexp.last_match[:v_type]
166
- {}.tap do |hash|
167
- value.each do |k, v|
168
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
169
- end
170
- end
171
- else # model
172
- temp_model = OracleBMC.const_get(type.to_s).new
173
- temp_model.build_from_hash(value)
174
- end
175
- end
176
135
 
177
136
 
178
137
  # Attribute mapping from ruby-style variable name to JSON key.