oraclebmc 1.1.1

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 (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,252 @@
1
+ # Copyright (c) 2016 Oracle and/or its affiliates. All rights reserved.
2
+
3
+ require 'date'
4
+
5
+ module OracleBMC
6
+ class Core::Models::ConsoleHistory
7
+
8
+ LIFECYCLE_STATE_ENUM = [LIFECYCLE_STATE_REQUESTED = 'REQUESTED',
9
+ LIFECYCLE_STATE_GETTING_HISTORY = 'GETTING-HISTORY',
10
+ LIFECYCLE_STATE_SUCCEEDED = 'SUCCEEDED',
11
+ LIFECYCLE_STATE_FAILED = 'FAILED']
12
+
13
+ # The Availability Domain of an instance.
14
+ #
15
+ # Example: `Uocm:PHX-AD-1`
16
+ #
17
+ # @return [String]
18
+ attr_accessor :availability_domain
19
+
20
+ # The OCID of the compartment.
21
+ # @return [String]
22
+ attr_accessor :compartment_id
23
+
24
+ # A user-friendly name. Does not have to be unique, and it's changeable.
25
+ #
26
+ # Example: `My console history metadata`
27
+ #
28
+ # @return [String]
29
+ attr_accessor :display_name
30
+
31
+ # The OCID of the console history metadata object.
32
+ # @return [String]
33
+ attr_accessor :id
34
+
35
+ # The OCID of the instance this console history was fetched from.
36
+ # @return [String]
37
+ attr_accessor :instance_id
38
+
39
+ # The current state of the console history.
40
+ # @return [String]
41
+ attr_accessor :lifecycle_state
42
+
43
+ # The date and time the history was created, in the format defined by RFC3339.
44
+ #
45
+ # Example: `2016-08-25T21:10:29.600Z`
46
+ #
47
+ # @return [DateTime]
48
+ attr_accessor :time_created
49
+
50
+
51
+ # Initializes the object
52
+ # @param [Hash] attributes Model attributes in the form of hash
53
+ def initialize(attributes = {})
54
+ return unless attributes.is_a?(Hash)
55
+
56
+ # convert string to symbol for hash key
57
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
58
+
59
+
60
+ if attributes[:'availabilityDomain']
61
+ self.availability_domain = attributes[:'availabilityDomain']
62
+ end
63
+
64
+ if attributes[:'compartmentId']
65
+ self.compartment_id = attributes[:'compartmentId']
66
+ end
67
+
68
+ if attributes[:'displayName']
69
+ self.display_name = attributes[:'displayName']
70
+ end
71
+
72
+ if attributes[:'id']
73
+ self.id = attributes[:'id']
74
+ end
75
+
76
+ if attributes[:'instanceId']
77
+ self.instance_id = attributes[:'instanceId']
78
+ end
79
+
80
+ if attributes[:'lifecycleState']
81
+ self.lifecycle_state = attributes[:'lifecycleState']
82
+ end
83
+
84
+ if attributes[:'timeCreated']
85
+ self.time_created = attributes[:'timeCreated']
86
+ end
87
+
88
+ end
89
+
90
+ # Custom attribute writer method checking allowed values (enum).
91
+ # @param [Object] lifecycle_state Object to be assigned
92
+ def lifecycle_state=(lifecycle_state)
93
+ if lifecycle_state && !LIFECYCLE_STATE_ENUM.include?(lifecycle_state)
94
+ fail "Invalid value for 'lifecycle_state': this must be one of the values in LIFECYCLE_STATE_ENUM."
95
+ end
96
+ @lifecycle_state = lifecycle_state
97
+ end
98
+
99
+ # Checks equality by comparing each attribute.
100
+ # @param [Object] other_object to be compared
101
+ def ==(other_object)
102
+ return true if self.equal?(other_object)
103
+ self.class == other_object.class &&
104
+ availability_domain == other_object.availability_domain &&
105
+ compartment_id == other_object.compartment_id &&
106
+ display_name == other_object.display_name &&
107
+ id == other_object.id &&
108
+ instance_id == other_object.instance_id &&
109
+ lifecycle_state == other_object.lifecycle_state &&
110
+ time_created == other_object.time_created
111
+ end
112
+
113
+ # @see the `==` method
114
+ # @param [Object] other_object to be compared
115
+ def eql?(other_object)
116
+ self == other_object
117
+ end
118
+
119
+ # Calculates hash code according to all attributes.
120
+ # @return [Fixnum] Hash code
121
+ def hash
122
+ [availability_domain, compartment_id, display_name, id, instance_id, lifecycle_state, time_created].hash
123
+ end
124
+
125
+ # Builds the object from hash
126
+ # @param [Hash] attributes Model attributes in the form of hash
127
+ # @return [Object] Returns the model itself
128
+ def build_from_hash(attributes)
129
+ return nil unless attributes.is_a?(Hash)
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
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
136
+ end
137
+ elsif !attributes[self.class.attribute_map[key]].nil?
138
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
139
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
140
+ end
141
+
142
+ self
143
+ end
144
+
145
+ # Returns the string representation of the object
146
+ # @return [String] String presentation of the object
147
+ def to_s
148
+ to_hash.to_s
149
+ end
150
+
151
+ # Returns the object in the form of hash
152
+ # @return [Hash] Returns the object in the form of hash
153
+ def to_hash
154
+ hash = {}
155
+ self.class.attribute_map.each_pair do |attr, param|
156
+ value = self.send(attr)
157
+ next if value.nil?
158
+ hash[param] = _to_hash(value)
159
+ end
160
+ hash
161
+ end
162
+
163
+ private
164
+
165
+ # Outputs non-array value in the form of hash
166
+ # For object, use to_hash. Otherwise, just return the value
167
+ # @param [Object] value Any valid value
168
+ # @return [Hash] Returns the value in the form of hash
169
+ def _to_hash(value)
170
+ if value.is_a?(Array)
171
+ value.compact.map{ |v| _to_hash(v) }
172
+ elsif value.is_a?(Hash)
173
+ {}.tap do |hash|
174
+ value.each { |k, v| hash[k] = _to_hash(v) }
175
+ end
176
+ elsif value.respond_to? :to_hash
177
+ value.to_hash
178
+ else
179
+ value
180
+ end
181
+ end
182
+
183
+ # Deserializes the data based on type
184
+ # @param [String] type Data type
185
+ # @param [String] value Value to be deserialized
186
+ # @return [Object] Deserialized data
187
+ def _deserialize(type, value)
188
+ case type.to_sym
189
+ when :DateTime
190
+ DateTime.parse(value)
191
+ when :Date
192
+ Date.parse(value)
193
+ when :String
194
+ value.to_s
195
+ when :Integer
196
+ value.to_i
197
+ when :Float
198
+ value.to_f
199
+ when :BOOLEAN
200
+ if value.to_s =~ /^(true|t|yes|y|1)$/i
201
+ true
202
+ else
203
+ false
204
+ end
205
+ when :Object
206
+ # generic object (usually a Hash), return directly
207
+ value
208
+ when /\AArray<(?<inner_type>.+)>\z/
209
+ inner_type = Regexp.last_match[:inner_type]
210
+ value.map { |v| _deserialize(inner_type, v) }
211
+ when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
212
+ k_type = Regexp.last_match[:k_type]
213
+ v_type = Regexp.last_match[:v_type]
214
+ {}.tap do |hash|
215
+ value.each do |k, v|
216
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
217
+ end
218
+ end
219
+ else # model
220
+ temp_model = OracleBMC.const_get(type.to_s).new
221
+ temp_model.build_from_hash(value)
222
+ end
223
+ end
224
+
225
+
226
+ # Attribute mapping from ruby-style variable name to JSON key.
227
+ def self.attribute_map
228
+ {
229
+ :'availability_domain' => :'availabilityDomain',
230
+ :'compartment_id' => :'compartmentId',
231
+ :'display_name' => :'displayName',
232
+ :'id' => :'id',
233
+ :'instance_id' => :'instanceId',
234
+ :'lifecycle_state' => :'lifecycleState',
235
+ :'time_created' => :'timeCreated'
236
+ }
237
+ end
238
+
239
+ # Attribute type mapping.
240
+ def self.swagger_types
241
+ {
242
+ :'availability_domain' => :'String',
243
+ :'compartment_id' => :'String',
244
+ :'display_name' => :'String',
245
+ :'id' => :'String',
246
+ :'instance_id' => :'String',
247
+ :'lifecycle_state' => :'String',
248
+ :'time_created' => :'DateTime'
249
+ }
250
+ end
251
+ end
252
+ end
@@ -0,0 +1,209 @@
1
+ # Copyright (c) 2016 Oracle and/or its affiliates. All rights reserved.
2
+
3
+ require 'date'
4
+
5
+ module OracleBMC
6
+ class Core::Models::Cpe
7
+ # The OCID of the compartment containing the CPE.
8
+ # @return [String]
9
+ attr_accessor :compartment_id
10
+
11
+ # A user-friendly name. Does not have to be unique, and it's changeable.
12
+ # @return [String]
13
+ attr_accessor :display_name
14
+
15
+ # The CPE's Oracle ID (OCID).
16
+ # @return [String]
17
+ attr_accessor :id
18
+
19
+ # The public IP address of the on-premise router.
20
+ # @return [String]
21
+ attr_accessor :ip_address
22
+
23
+ # The date and time the CPE was created, in the format defined by RFC3339.
24
+ #
25
+ # Example: `2016-08-25T21:10:29.600Z`
26
+ #
27
+ # @return [DateTime]
28
+ attr_accessor :time_created
29
+
30
+
31
+ # Initializes the object
32
+ # @param [Hash] attributes Model attributes in the form of hash
33
+ def initialize(attributes = {})
34
+ return unless attributes.is_a?(Hash)
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[:'compartmentId']
41
+ self.compartment_id = attributes[:'compartmentId']
42
+ end
43
+
44
+ if attributes[:'displayName']
45
+ self.display_name = attributes[:'displayName']
46
+ end
47
+
48
+ if attributes[:'id']
49
+ self.id = attributes[:'id']
50
+ end
51
+
52
+ if attributes[:'ipAddress']
53
+ self.ip_address = attributes[:'ipAddress']
54
+ end
55
+
56
+ if attributes[:'timeCreated']
57
+ self.time_created = attributes[:'timeCreated']
58
+ end
59
+
60
+ end
61
+
62
+ # Checks equality by comparing each attribute.
63
+ # @param [Object] other_object to be compared
64
+ def ==(other_object)
65
+ return true if self.equal?(other_object)
66
+ self.class == other_object.class &&
67
+ compartment_id == other_object.compartment_id &&
68
+ display_name == other_object.display_name &&
69
+ id == other_object.id &&
70
+ ip_address == other_object.ip_address &&
71
+ time_created == other_object.time_created
72
+ end
73
+
74
+ # @see the `==` method
75
+ # @param [Object] other_object to be compared
76
+ def eql?(other_object)
77
+ self == other_object
78
+ end
79
+
80
+ # Calculates hash code according to all attributes.
81
+ # @return [Fixnum] Hash code
82
+ def hash
83
+ [compartment_id, display_name, id, ip_address, time_created].hash
84
+ end
85
+
86
+ # Builds the object from hash
87
+ # @param [Hash] attributes Model attributes in the form of hash
88
+ # @return [Object] Returns the model itself
89
+ def build_from_hash(attributes)
90
+ return nil unless attributes.is_a?(Hash)
91
+ self.class.swagger_types.each_pair do |key, type|
92
+ if type =~ /^Array<(.*)>/i
93
+ # check to ensure the input is an array given that the the attribute
94
+ # is documented as an array but the input is not
95
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
96
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
97
+ end
98
+ elsif !attributes[self.class.attribute_map[key]].nil?
99
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
100
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
101
+ end
102
+
103
+ self
104
+ end
105
+
106
+ # Returns the string representation of the object
107
+ # @return [String] String presentation of the object
108
+ def to_s
109
+ to_hash.to_s
110
+ end
111
+
112
+ # Returns the object in the form of hash
113
+ # @return [Hash] Returns the object in the form of hash
114
+ def to_hash
115
+ hash = {}
116
+ self.class.attribute_map.each_pair do |attr, param|
117
+ value = self.send(attr)
118
+ next if value.nil?
119
+ hash[param] = _to_hash(value)
120
+ end
121
+ hash
122
+ end
123
+
124
+ private
125
+
126
+ # Outputs non-array value in the form of hash
127
+ # For object, use to_hash. Otherwise, just return the value
128
+ # @param [Object] value Any valid value
129
+ # @return [Hash] Returns the value in the form of hash
130
+ def _to_hash(value)
131
+ if value.is_a?(Array)
132
+ value.compact.map{ |v| _to_hash(v) }
133
+ elsif value.is_a?(Hash)
134
+ {}.tap do |hash|
135
+ value.each { |k, v| hash[k] = _to_hash(v) }
136
+ end
137
+ elsif value.respond_to? :to_hash
138
+ value.to_hash
139
+ else
140
+ value
141
+ end
142
+ end
143
+
144
+ # Deserializes the data based on type
145
+ # @param [String] type Data type
146
+ # @param [String] value Value to be deserialized
147
+ # @return [Object] Deserialized data
148
+ def _deserialize(type, value)
149
+ case type.to_sym
150
+ when :DateTime
151
+ DateTime.parse(value)
152
+ when :Date
153
+ Date.parse(value)
154
+ when :String
155
+ value.to_s
156
+ when :Integer
157
+ value.to_i
158
+ when :Float
159
+ value.to_f
160
+ when :BOOLEAN
161
+ if value.to_s =~ /^(true|t|yes|y|1)$/i
162
+ true
163
+ else
164
+ false
165
+ end
166
+ when :Object
167
+ # generic object (usually a Hash), return directly
168
+ value
169
+ when /\AArray<(?<inner_type>.+)>\z/
170
+ inner_type = Regexp.last_match[:inner_type]
171
+ value.map { |v| _deserialize(inner_type, v) }
172
+ when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
173
+ k_type = Regexp.last_match[:k_type]
174
+ v_type = Regexp.last_match[:v_type]
175
+ {}.tap do |hash|
176
+ value.each do |k, v|
177
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
178
+ end
179
+ end
180
+ else # model
181
+ temp_model = OracleBMC.const_get(type.to_s).new
182
+ temp_model.build_from_hash(value)
183
+ end
184
+ end
185
+
186
+
187
+ # Attribute mapping from ruby-style variable name to JSON key.
188
+ def self.attribute_map
189
+ {
190
+ :'compartment_id' => :'compartmentId',
191
+ :'display_name' => :'displayName',
192
+ :'id' => :'id',
193
+ :'ip_address' => :'ipAddress',
194
+ :'time_created' => :'timeCreated'
195
+ }
196
+ end
197
+
198
+ # Attribute type mapping.
199
+ def self.swagger_types
200
+ {
201
+ :'compartment_id' => :'String',
202
+ :'display_name' => :'String',
203
+ :'id' => :'String',
204
+ :'ip_address' => :'String',
205
+ :'time_created' => :'DateTime'
206
+ }
207
+ end
208
+ end
209
+ end
@@ -0,0 +1,187 @@
1
+ # Copyright (c) 2016 Oracle and/or its affiliates. All rights reserved.
2
+
3
+ require 'date'
4
+
5
+ module OracleBMC
6
+ class Core::Models::CreateCpeDetails
7
+ # The OCID of the compartment to contain the CPE.
8
+ # @return [String]
9
+ attr_accessor :compartment_id
10
+
11
+ # A user-friendly name. Does not have to be unique, and it's changeable.
12
+ # @return [String]
13
+ attr_accessor :display_name
14
+
15
+ # The public IP address of the on-premise router.
16
+ #
17
+ # Example: `143.19.23.16`
18
+ #
19
+ # @return [String]
20
+ attr_accessor :ip_address
21
+
22
+
23
+ # Initializes the object
24
+ # @param [Hash] attributes Model attributes in the form of hash
25
+ def initialize(attributes = {})
26
+ return unless attributes.is_a?(Hash)
27
+
28
+ # convert string to symbol for hash key
29
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
30
+
31
+
32
+ if attributes[:'compartmentId']
33
+ self.compartment_id = attributes[:'compartmentId']
34
+ end
35
+
36
+ if attributes[:'displayName']
37
+ self.display_name = attributes[:'displayName']
38
+ end
39
+
40
+ if attributes[:'ipAddress']
41
+ self.ip_address = attributes[:'ipAddress']
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
+ compartment_id == other_object.compartment_id &&
52
+ display_name == other_object.display_name &&
53
+ ip_address == other_object.ip_address
54
+ end
55
+
56
+ # @see the `==` method
57
+ # @param [Object] other_object to be compared
58
+ def eql?(other_object)
59
+ self == other_object
60
+ end
61
+
62
+ # Calculates hash code according to all attributes.
63
+ # @return [Fixnum] Hash code
64
+ def hash
65
+ [compartment_id, display_name, ip_address].hash
66
+ end
67
+
68
+ # Builds the object from hash
69
+ # @param [Hash] attributes Model attributes in the form of hash
70
+ # @return [Object] Returns the model itself
71
+ def build_from_hash(attributes)
72
+ return nil unless attributes.is_a?(Hash)
73
+ self.class.swagger_types.each_pair do |key, type|
74
+ if type =~ /^Array<(.*)>/i
75
+ # check to ensure the input is an array given that the the attribute
76
+ # is documented as an array but the input is not
77
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
78
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
79
+ end
80
+ elsif !attributes[self.class.attribute_map[key]].nil?
81
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
82
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
83
+ end
84
+
85
+ self
86
+ end
87
+
88
+ # Returns the string representation of the object
89
+ # @return [String] String presentation of the object
90
+ def to_s
91
+ to_hash.to_s
92
+ end
93
+
94
+ # Returns the object in the form of hash
95
+ # @return [Hash] Returns the object in the form of hash
96
+ def to_hash
97
+ hash = {}
98
+ self.class.attribute_map.each_pair do |attr, param|
99
+ value = self.send(attr)
100
+ next if value.nil?
101
+ hash[param] = _to_hash(value)
102
+ end
103
+ hash
104
+ end
105
+
106
+ private
107
+
108
+ # Outputs non-array value in the form of hash
109
+ # For object, use to_hash. Otherwise, just return the value
110
+ # @param [Object] value Any valid value
111
+ # @return [Hash] Returns the value in the form of hash
112
+ def _to_hash(value)
113
+ if value.is_a?(Array)
114
+ value.compact.map{ |v| _to_hash(v) }
115
+ elsif value.is_a?(Hash)
116
+ {}.tap do |hash|
117
+ value.each { |k, v| hash[k] = _to_hash(v) }
118
+ end
119
+ elsif value.respond_to? :to_hash
120
+ value.to_hash
121
+ else
122
+ value
123
+ end
124
+ end
125
+
126
+ # Deserializes the data based on type
127
+ # @param [String] type Data type
128
+ # @param [String] value Value to be deserialized
129
+ # @return [Object] Deserialized data
130
+ def _deserialize(type, value)
131
+ case type.to_sym
132
+ when :DateTime
133
+ DateTime.parse(value)
134
+ when :Date
135
+ Date.parse(value)
136
+ when :String
137
+ value.to_s
138
+ when :Integer
139
+ value.to_i
140
+ when :Float
141
+ value.to_f
142
+ when :BOOLEAN
143
+ if value.to_s =~ /^(true|t|yes|y|1)$/i
144
+ true
145
+ else
146
+ false
147
+ end
148
+ when :Object
149
+ # generic object (usually a Hash), return directly
150
+ value
151
+ when /\AArray<(?<inner_type>.+)>\z/
152
+ inner_type = Regexp.last_match[:inner_type]
153
+ value.map { |v| _deserialize(inner_type, v) }
154
+ when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
155
+ k_type = Regexp.last_match[:k_type]
156
+ v_type = Regexp.last_match[:v_type]
157
+ {}.tap do |hash|
158
+ value.each do |k, v|
159
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
160
+ end
161
+ end
162
+ else # model
163
+ temp_model = OracleBMC.const_get(type.to_s).new
164
+ temp_model.build_from_hash(value)
165
+ end
166
+ end
167
+
168
+
169
+ # Attribute mapping from ruby-style variable name to JSON key.
170
+ def self.attribute_map
171
+ {
172
+ :'compartment_id' => :'compartmentId',
173
+ :'display_name' => :'displayName',
174
+ :'ip_address' => :'ipAddress'
175
+ }
176
+ end
177
+
178
+ # Attribute type mapping.
179
+ def self.swagger_types
180
+ {
181
+ :'compartment_id' => :'String',
182
+ :'display_name' => :'String',
183
+ :'ip_address' => :'String'
184
+ }
185
+ end
186
+ end
187
+ end