oraclebmc 1.1.2 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
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
@@ -95,10 +95,10 @@ module OracleBMC
95
95
  # check to ensure the input is an array given that the the attribute
96
96
  # is documented as an array but the input is not
97
97
  if attributes[self.class.attribute_map[key]].is_a?(Array)
98
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
98
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| OracleBMC::Internal::Util.convert_to_type($1, v) } )
99
99
  end
100
100
  elsif !attributes[self.class.attribute_map[key]].nil?
101
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
101
+ self.send("#{key}=", OracleBMC::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]]))
102
102
  end # or else data not found in attributes(hash), not an issue as the data can be optional
103
103
  end
104
104
 
@@ -143,47 +143,6 @@ module OracleBMC
143
143
  end
144
144
  end
145
145
 
146
- # Deserializes the data based on type
147
- # @param [String] type Data type
148
- # @param [String] value Value to be deserialized
149
- # @return [Object] Deserialized data
150
- def _deserialize(type, value)
151
- case type.to_sym
152
- when :DateTime
153
- DateTime.parse(value)
154
- when :Date
155
- Date.parse(value)
156
- when :String
157
- value.to_s
158
- when :Integer
159
- value.to_i
160
- when :Float
161
- value.to_f
162
- when :BOOLEAN
163
- if value.to_s =~ /^(true|t|yes|y|1)$/i
164
- true
165
- else
166
- false
167
- end
168
- when :Object
169
- # generic object (usually a Hash), return directly
170
- value
171
- when /\AArray<(?<inner_type>.+)>\z/
172
- inner_type = Regexp.last_match[:inner_type]
173
- value.map { |v| _deserialize(inner_type, v) }
174
- when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
175
- k_type = Regexp.last_match[:k_type]
176
- v_type = Regexp.last_match[:v_type]
177
- {}.tap do |hash|
178
- value.each do |k, v|
179
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
180
- end
181
- end
182
- else # model
183
- temp_model = OracleBMC.const_get(type.to_s).new
184
- temp_model.build_from_hash(value)
185
- end
186
- end
187
146
 
188
147
 
189
148
  # Attribute mapping from ruby-style variable name to JSON key.
@@ -16,12 +16,20 @@ module OracleBMC
16
16
  # @return [Array<String>]
17
17
  attr_accessor :custom_dns_servers
18
18
 
19
- # - *VcnLocal:* Reserved for future use.
20
- # - *VcnLocalPlusInternet:* Instances can resolve only internet host
21
- # names (no Internet Gateway is required). The instances still need to use
22
- # their IP addresses to communicate with each other. This is the default
23
- # value in the default set of DHCP options in the VCN.
24
- # - *CustomDnsServer:* Instances use a DNS server of your choice (three maximum).
19
+ # - **VcnLocal:** Reserved for future use.
20
+ #
21
+ # - **VcnLocalPlusInternet:** Also referred to as \"Internet and VCN Resolver\".
22
+ # Instances can resolve internet hostnames (no Internet Gateway is required),
23
+ # and can resolve hostnames of instances in the VCN. This is the default
24
+ # value in the default set of DHCP options in the VCN. For the Internet and
25
+ # VCN Resolver to work across the VCN, there must also be a DNS label set for
26
+ # the VCN, a DNS label set for each subnet, and a hostname for each instance.
27
+ # The Internet and VCN Resolver also enables reverse DNS lookup, which lets
28
+ # you determine the hostname corresponding to the private IP address. For more
29
+ # information, see
30
+ # [DNS in Your Virtual Cloud Network](https://docs.us-phoenix-1.oraclecloud.com/Content/Network/Concepts/dns.htm).
31
+ #
32
+ # - **CustomDnsServer:** Instances use a DNS server of your choice (three maximum).
25
33
  #
26
34
  # @return [String]
27
35
  attr_accessor :server_type
@@ -91,10 +99,10 @@ module OracleBMC
91
99
  # check to ensure the input is an array given that the the attribute
92
100
  # is documented as an array but the input is not
93
101
  if attributes[self.class.attribute_map[key]].is_a?(Array)
94
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
102
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| OracleBMC::Internal::Util.convert_to_type($1, v) } )
95
103
  end
96
104
  elsif !attributes[self.class.attribute_map[key]].nil?
97
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
105
+ self.send("#{key}=", OracleBMC::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]]))
98
106
  end # or else data not found in attributes(hash), not an issue as the data can be optional
99
107
  end
100
108
 
@@ -139,47 +147,6 @@ module OracleBMC
139
147
  end
140
148
  end
141
149
 
142
- # Deserializes the data based on type
143
- # @param [String] type Data type
144
- # @param [String] value Value to be deserialized
145
- # @return [Object] Deserialized data
146
- def _deserialize(type, value)
147
- case type.to_sym
148
- when :DateTime
149
- DateTime.parse(value)
150
- when :Date
151
- Date.parse(value)
152
- when :String
153
- value.to_s
154
- when :Integer
155
- value.to_i
156
- when :Float
157
- value.to_f
158
- when :BOOLEAN
159
- if value.to_s =~ /^(true|t|yes|y|1)$/i
160
- true
161
- else
162
- false
163
- end
164
- when :Object
165
- # generic object (usually a Hash), return directly
166
- value
167
- when /\AArray<(?<inner_type>.+)>\z/
168
- inner_type = Regexp.last_match[:inner_type]
169
- value.map { |v| _deserialize(inner_type, v) }
170
- when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
171
- k_type = Regexp.last_match[:k_type]
172
- v_type = Regexp.last_match[:v_type]
173
- {}.tap do |hash|
174
- value.each do |k, v|
175
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
176
- end
177
- end
178
- else # model
179
- temp_model = OracleBMC.const_get(type.to_s).new
180
- temp_model.build_from_hash(value)
181
- end
182
- end
183
150
 
184
151
 
185
152
  # Attribute mapping from ruby-style variable name to JSON key.
@@ -4,6 +4,10 @@ require 'date'
4
4
 
5
5
  module OracleBMC
6
6
  class Core::Models::DhcpOption
7
+ # The specific DHCP option. Either `DomainNameServer`
8
+ # (for {DhcpDnsOption}) or
9
+ # `SearchDomain` (for {DhcpSearchDomainOption}).
10
+ #
7
11
  # @return [String]
8
12
  attr_accessor :type
9
13
 
@@ -14,6 +18,7 @@ module OracleBMC
14
18
  type = object_hash[:'type']
15
19
 
16
20
  return 'OracleBMC::Core::Models::DhcpDnsOption' if type == 'DomainNameServer'
21
+ return 'OracleBMC::Core::Models::DhcpSearchDomainOption' if type == 'SearchDomain'
17
22
 
18
23
  # TODO: Log a warning when the subtype is not found.
19
24
  return 'OracleBMC::Core::Models::DhcpOption'
@@ -64,10 +69,10 @@ module OracleBMC
64
69
  # check to ensure the input is an array given that the the attribute
65
70
  # is documented as an array but the input is not
66
71
  if attributes[self.class.attribute_map[key]].is_a?(Array)
67
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
72
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| OracleBMC::Internal::Util.convert_to_type($1, v) } )
68
73
  end
69
74
  elsif !attributes[self.class.attribute_map[key]].nil?
70
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
75
+ self.send("#{key}=", OracleBMC::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]]))
71
76
  end # or else data not found in attributes(hash), not an issue as the data can be optional
72
77
  end
73
78
 
@@ -112,47 +117,6 @@ module OracleBMC
112
117
  end
113
118
  end
114
119
 
115
- # Deserializes the data based on type
116
- # @param [String] type Data type
117
- # @param [String] value Value to be deserialized
118
- # @return [Object] Deserialized data
119
- def _deserialize(type, value)
120
- case type.to_sym
121
- when :DateTime
122
- DateTime.parse(value)
123
- when :Date
124
- Date.parse(value)
125
- when :String
126
- value.to_s
127
- when :Integer
128
- value.to_i
129
- when :Float
130
- value.to_f
131
- when :BOOLEAN
132
- if value.to_s =~ /^(true|t|yes|y|1)$/i
133
- true
134
- else
135
- false
136
- end
137
- when :Object
138
- # generic object (usually a Hash), return directly
139
- value
140
- when /\AArray<(?<inner_type>.+)>\z/
141
- inner_type = Regexp.last_match[:inner_type]
142
- value.map { |v| _deserialize(inner_type, v) }
143
- when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
144
- k_type = Regexp.last_match[:k_type]
145
- v_type = Regexp.last_match[:v_type]
146
- {}.tap do |hash|
147
- value.each do |k, v|
148
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
149
- end
150
- end
151
- else # model
152
- temp_model = OracleBMC.const_get(type.to_s).new
153
- temp_model.build_from_hash(value)
154
- end
155
- end
156
120
 
157
121
 
158
122
  # Attribute mapping from ruby-style variable name to JSON key.
@@ -126,10 +126,10 @@ module OracleBMC
126
126
  # check to ensure the input is an array given that the the attribute
127
127
  # is documented as an array but the input is not
128
128
  if attributes[self.class.attribute_map[key]].is_a?(Array)
129
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
129
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| OracleBMC::Internal::Util.convert_to_type($1, v) } )
130
130
  end
131
131
  elsif !attributes[self.class.attribute_map[key]].nil?
132
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
132
+ self.send("#{key}=", OracleBMC::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]]))
133
133
  end # or else data not found in attributes(hash), not an issue as the data can be optional
134
134
  end
135
135
 
@@ -174,47 +174,6 @@ module OracleBMC
174
174
  end
175
175
  end
176
176
 
177
- # Deserializes the data based on type
178
- # @param [String] type Data type
179
- # @param [String] value Value to be deserialized
180
- # @return [Object] Deserialized data
181
- def _deserialize(type, value)
182
- case type.to_sym
183
- when :DateTime
184
- DateTime.parse(value)
185
- when :Date
186
- Date.parse(value)
187
- when :String
188
- value.to_s
189
- when :Integer
190
- value.to_i
191
- when :Float
192
- value.to_f
193
- when :BOOLEAN
194
- if value.to_s =~ /^(true|t|yes|y|1)$/i
195
- true
196
- else
197
- false
198
- end
199
- when :Object
200
- # generic object (usually a Hash), return directly
201
- value
202
- when /\AArray<(?<inner_type>.+)>\z/
203
- inner_type = Regexp.last_match[:inner_type]
204
- value.map { |v| _deserialize(inner_type, v) }
205
- when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
206
- k_type = Regexp.last_match[:k_type]
207
- v_type = Regexp.last_match[:v_type]
208
- {}.tap do |hash|
209
- value.each do |k, v|
210
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
211
- end
212
- end
213
- else # model
214
- temp_model = OracleBMC.const_get(type.to_s).new
215
- temp_model.build_from_hash(value)
216
- end
217
- end
218
177
 
219
178
 
220
179
  # Attribute mapping from ruby-style variable name to JSON key.
@@ -0,0 +1,143 @@
1
+ # Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
2
+
3
+ require 'date'
4
+ require_relative 'dhcp_option'
5
+
6
+ module OracleBMC
7
+ class Core::Models::DhcpSearchDomainOption < Core::Models::DhcpOption
8
+ # A single search domain name according to [RFC 952](https://tools.ietf.org/html/rfc952)
9
+ # and [RFC 1123](https://tools.ietf.org/html/rfc1123). During a DNS query,
10
+ # the OS will append this search domain name to the value being queried, but only if
11
+ # that value is not a fully qualified domain name (FQDN).
12
+ #
13
+ # If you set {DhcpDnsOption} to `VcnLocalPlusInternet`,
14
+ # and you assign a DNS label to the VCN during creation, the search domain name in the
15
+ # VCN's default set of DHCP options is automatically set to the VCN domain
16
+ # (e.g., `vcn1.oraclevcn.com`).
17
+ #
18
+ # If you don't want to use a search domain name, omit this option from the
19
+ # set of DHCP options. Do not include this option with an empty list
20
+ # of search domain names, or with an empty string as the value for any search
21
+ # domain name.
22
+ #
23
+ # @return [Array<String>]
24
+ attr_accessor :search_domain_names
25
+
26
+
27
+ # Initializes the object
28
+ # @param [Hash] attributes Model attributes in the form of hash
29
+ def initialize(attributes = {})
30
+ return unless attributes.is_a?(Hash)
31
+
32
+ attributes['type'] = 'SearchDomain'
33
+
34
+ super(attributes)
35
+
36
+ # convert string to symbol for hash key
37
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
38
+
39
+
40
+ if attributes[:'searchDomainNames']
41
+ self.search_domain_names = attributes[:'searchDomainNames']
42
+ end
43
+
44
+ end
45
+
46
+ # Checks equality by comparing each attribute.
47
+ # @param [Object] other_object to be compared
48
+ def ==(other_object)
49
+ return true if self.equal?(other_object)
50
+ self.class == other_object.class &&
51
+ type == other_object.type &&
52
+ search_domain_names == other_object.search_domain_names
53
+ end
54
+
55
+ # @see the `==` method
56
+ # @param [Object] other_object to be compared
57
+ def eql?(other_object)
58
+ self == other_object
59
+ end
60
+
61
+ # Calculates hash code according to all attributes.
62
+ # @return [Fixnum] Hash code
63
+ def hash
64
+ [type, search_domain_names].hash
65
+ end
66
+
67
+ # Builds the object from hash
68
+ # @param [Hash] attributes Model attributes in the form of hash
69
+ # @return [Object] Returns the model itself
70
+ def build_from_hash(attributes)
71
+ return nil unless attributes.is_a?(Hash)
72
+ self.class.swagger_types.each_pair do |key, type|
73
+ if type =~ /^Array<(.*)>/i
74
+ # check to ensure the input is an array given that the the attribute
75
+ # is documented as an array but the input is not
76
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
77
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| OracleBMC::Internal::Util.convert_to_type($1, v) } )
78
+ end
79
+ elsif !attributes[self.class.attribute_map[key]].nil?
80
+ self.send("#{key}=", OracleBMC::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]]))
81
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
82
+ end
83
+
84
+ self
85
+ end
86
+
87
+ # Returns the string representation of the object
88
+ # @return [String] String presentation of the object
89
+ def to_s
90
+ to_hash.to_s
91
+ end
92
+
93
+ # Returns the object in the form of hash
94
+ # @return [Hash] Returns the object in the form of hash
95
+ def to_hash
96
+ hash = {}
97
+ self.class.attribute_map.each_pair do |attr, param|
98
+ value = self.send(attr)
99
+ next if value.nil?
100
+ hash[param] = _to_hash(value)
101
+ end
102
+ hash
103
+ end
104
+
105
+ private
106
+
107
+ # Outputs non-array value in the form of hash
108
+ # For object, use to_hash. Otherwise, just return the value
109
+ # @param [Object] value Any valid value
110
+ # @return [Hash] Returns the value in the form of hash
111
+ def _to_hash(value)
112
+ if value.is_a?(Array)
113
+ value.compact.map{ |v| _to_hash(v) }
114
+ elsif value.is_a?(Hash)
115
+ {}.tap do |hash|
116
+ value.each { |k, v| hash[k] = _to_hash(v) }
117
+ end
118
+ elsif value.respond_to? :to_hash
119
+ value.to_hash
120
+ else
121
+ value
122
+ end
123
+ end
124
+
125
+
126
+
127
+ # Attribute mapping from ruby-style variable name to JSON key.
128
+ def self.attribute_map
129
+ {
130
+ :'type' => :'type',
131
+ :'search_domain_names' => :'searchDomainNames'
132
+ }
133
+ end
134
+
135
+ # Attribute type mapping.
136
+ def self.swagger_types
137
+ {
138
+ :'type' => :'String',
139
+ :'search_domain_names' => :'Array<String>'
140
+ }
141
+ end
142
+ end
143
+ end
@@ -108,10 +108,10 @@ module OracleBMC
108
108
  # check to ensure the input is an array given that the the attribute
109
109
  # is documented as an array but the input is not
110
110
  if attributes[self.class.attribute_map[key]].is_a?(Array)
111
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
111
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| OracleBMC::Internal::Util.convert_to_type($1, v) } )
112
112
  end
113
113
  elsif !attributes[self.class.attribute_map[key]].nil?
114
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
114
+ self.send("#{key}=", OracleBMC::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]]))
115
115
  end # or else data not found in attributes(hash), not an issue as the data can be optional
116
116
  end
117
117
 
@@ -156,47 +156,6 @@ module OracleBMC
156
156
  end
157
157
  end
158
158
 
159
- # Deserializes the data based on type
160
- # @param [String] type Data type
161
- # @param [String] value Value to be deserialized
162
- # @return [Object] Deserialized data
163
- def _deserialize(type, value)
164
- case type.to_sym
165
- when :DateTime
166
- DateTime.parse(value)
167
- when :Date
168
- Date.parse(value)
169
- when :String
170
- value.to_s
171
- when :Integer
172
- value.to_i
173
- when :Float
174
- value.to_f
175
- when :BOOLEAN
176
- if value.to_s =~ /^(true|t|yes|y|1)$/i
177
- true
178
- else
179
- false
180
- end
181
- when :Object
182
- # generic object (usually a Hash), return directly
183
- value
184
- when /\AArray<(?<inner_type>.+)>\z/
185
- inner_type = Regexp.last_match[:inner_type]
186
- value.map { |v| _deserialize(inner_type, v) }
187
- when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
188
- k_type = Regexp.last_match[:k_type]
189
- v_type = Regexp.last_match[:v_type]
190
- {}.tap do |hash|
191
- value.each do |k, v|
192
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
193
- end
194
- end
195
- else # model
196
- temp_model = OracleBMC.const_get(type.to_s).new
197
- temp_model.build_from_hash(value)
198
- end
199
- end
200
159
 
201
160
 
202
161
  # Attribute mapping from ruby-style variable name to JSON key.
@@ -126,10 +126,10 @@ module OracleBMC
126
126
  # check to ensure the input is an array given that the the attribute
127
127
  # is documented as an array but the input is not
128
128
  if attributes[self.class.attribute_map[key]].is_a?(Array)
129
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
129
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| OracleBMC::Internal::Util.convert_to_type($1, v) } )
130
130
  end
131
131
  elsif !attributes[self.class.attribute_map[key]].nil?
132
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
132
+ self.send("#{key}=", OracleBMC::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]]))
133
133
  end # or else data not found in attributes(hash), not an issue as the data can be optional
134
134
  end
135
135
 
@@ -174,47 +174,6 @@ module OracleBMC
174
174
  end
175
175
  end
176
176
 
177
- # Deserializes the data based on type
178
- # @param [String] type Data type
179
- # @param [String] value Value to be deserialized
180
- # @return [Object] Deserialized data
181
- def _deserialize(type, value)
182
- case type.to_sym
183
- when :DateTime
184
- DateTime.parse(value)
185
- when :Date
186
- Date.parse(value)
187
- when :String
188
- value.to_s
189
- when :Integer
190
- value.to_i
191
- when :Float
192
- value.to_f
193
- when :BOOLEAN
194
- if value.to_s =~ /^(true|t|yes|y|1)$/i
195
- true
196
- else
197
- false
198
- end
199
- when :Object
200
- # generic object (usually a Hash), return directly
201
- value
202
- when /\AArray<(?<inner_type>.+)>\z/
203
- inner_type = Regexp.last_match[:inner_type]
204
- value.map { |v| _deserialize(inner_type, v) }
205
- when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
206
- k_type = Regexp.last_match[:k_type]
207
- v_type = Regexp.last_match[:v_type]
208
- {}.tap do |hash|
209
- value.each do |k, v|
210
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
211
- end
212
- end
213
- else # model
214
- temp_model = OracleBMC.const_get(type.to_s).new
215
- temp_model.build_from_hash(value)
216
- end
217
- end
218
177
 
219
178
 
220
179
  # 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.
@@ -120,10 +120,10 @@ module OracleBMC
120
120
  # check to ensure the input is an array given that the the attribute
121
121
  # is documented as an array but the input is not
122
122
  if attributes[self.class.attribute_map[key]].is_a?(Array)
123
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
123
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| OracleBMC::Internal::Util.convert_to_type($1, v) } )
124
124
  end
125
125
  elsif !attributes[self.class.attribute_map[key]].nil?
126
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
126
+ self.send("#{key}=", OracleBMC::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]]))
127
127
  end # or else data not found in attributes(hash), not an issue as the data can be optional
128
128
  end
129
129
 
@@ -168,47 +168,6 @@ module OracleBMC
168
168
  end
169
169
  end
170
170
 
171
- # Deserializes the data based on type
172
- # @param [String] type Data type
173
- # @param [String] value Value to be deserialized
174
- # @return [Object] Deserialized data
175
- def _deserialize(type, value)
176
- case type.to_sym
177
- when :DateTime
178
- DateTime.parse(value)
179
- when :Date
180
- Date.parse(value)
181
- when :String
182
- value.to_s
183
- when :Integer
184
- value.to_i
185
- when :Float
186
- value.to_f
187
- when :BOOLEAN
188
- if value.to_s =~ /^(true|t|yes|y|1)$/i
189
- true
190
- else
191
- false
192
- end
193
- when :Object
194
- # generic object (usually a Hash), return directly
195
- value
196
- when /\AArray<(?<inner_type>.+)>\z/
197
- inner_type = Regexp.last_match[:inner_type]
198
- value.map { |v| _deserialize(inner_type, v) }
199
- when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
200
- k_type = Regexp.last_match[:k_type]
201
- v_type = Regexp.last_match[:v_type]
202
- {}.tap do |hash|
203
- value.each do |k, v|
204
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
205
- end
206
- end
207
- else # model
208
- temp_model = OracleBMC.const_get(type.to_s).new
209
- temp_model.build_from_hash(value)
210
- end
211
- end
212
171
 
213
172
 
214
173
  # Attribute mapping from ruby-style variable name to JSON key.