oraclebmc 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (141) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.txt +82 -0
  3. data/README.md +220 -0
  4. data/lib/oraclebmc/api_client.rb +349 -0
  5. data/lib/oraclebmc/config.rb +80 -0
  6. data/lib/oraclebmc/config_file_loader.rb +85 -0
  7. data/lib/oraclebmc/core/blockstorage_client.rb +459 -0
  8. data/lib/oraclebmc/core/compute_client.rb +1053 -0
  9. data/lib/oraclebmc/core/core.rb +82 -0
  10. data/lib/oraclebmc/core/models/attach_i_scsi_volume_details.rb +179 -0
  11. data/lib/oraclebmc/core/models/attach_volume_details.rb +206 -0
  12. data/lib/oraclebmc/core/models/capture_console_history_details.rb +162 -0
  13. data/lib/oraclebmc/core/models/console_history.rb +252 -0
  14. data/lib/oraclebmc/core/models/cpe.rb +209 -0
  15. data/lib/oraclebmc/core/models/create_cpe_details.rb +187 -0
  16. data/lib/oraclebmc/core/models/create_dhcp_details.rb +195 -0
  17. data/lib/oraclebmc/core/models/create_drg_attachment_details.rb +184 -0
  18. data/lib/oraclebmc/core/models/create_drg_details.rb +173 -0
  19. data/lib/oraclebmc/core/models/create_image_details.rb +188 -0
  20. data/lib/oraclebmc/core/models/create_internet_gateway_details.rb +195 -0
  21. data/lib/oraclebmc/core/models/create_ip_sec_connection_details.rb +210 -0
  22. data/lib/oraclebmc/core/models/create_route_table_details.rb +195 -0
  23. data/lib/oraclebmc/core/models/create_security_list_details.rb +206 -0
  24. data/lib/oraclebmc/core/models/create_subnet_details.rb +253 -0
  25. data/lib/oraclebmc/core/models/create_vcn_details.rb +187 -0
  26. data/lib/oraclebmc/core/models/create_volume_backup_details.rb +173 -0
  27. data/lib/oraclebmc/core/models/create_volume_details.rb +211 -0
  28. data/lib/oraclebmc/core/models/dhcp_dns_option.rb +203 -0
  29. data/lib/oraclebmc/core/models/dhcp_option.rb +171 -0
  30. data/lib/oraclebmc/core/models/dhcp_options.rb +246 -0
  31. data/lib/oraclebmc/core/models/drg.rb +224 -0
  32. data/lib/oraclebmc/core/models/drg_attachment.rb +246 -0
  33. data/lib/oraclebmc/core/models/egress_security_rule.rb +240 -0
  34. data/lib/oraclebmc/core/models/i_scsi_volume_attachment.rb +254 -0
  35. data/lib/oraclebmc/core/models/icmp_options.rb +173 -0
  36. data/lib/oraclebmc/core/models/image.rb +282 -0
  37. data/lib/oraclebmc/core/models/ingress_security_rule.rb +240 -0
  38. data/lib/oraclebmc/core/models/instance.rb +326 -0
  39. data/lib/oraclebmc/core/models/internet_gateway.rb +248 -0
  40. data/lib/oraclebmc/core/models/ip_sec_connection.rb +261 -0
  41. data/lib/oraclebmc/core/models/ip_sec_connection_device_config.rb +195 -0
  42. data/lib/oraclebmc/core/models/ip_sec_connection_device_status.rb +198 -0
  43. data/lib/oraclebmc/core/models/launch_instance_details.rb +327 -0
  44. data/lib/oraclebmc/core/models/port_range.rb +175 -0
  45. data/lib/oraclebmc/core/models/route_rule.rb +177 -0
  46. data/lib/oraclebmc/core/models/route_table.rb +246 -0
  47. data/lib/oraclebmc/core/models/security_list.rb +257 -0
  48. data/lib/oraclebmc/core/models/shape.rb +164 -0
  49. data/lib/oraclebmc/core/models/subnet.rb +325 -0
  50. data/lib/oraclebmc/core/models/tcp_options.rb +177 -0
  51. data/lib/oraclebmc/core/models/tunnel_config.rb +193 -0
  52. data/lib/oraclebmc/core/models/tunnel_status.rb +218 -0
  53. data/lib/oraclebmc/core/models/udp_options.rb +177 -0
  54. data/lib/oraclebmc/core/models/update_cpe_details.rb +162 -0
  55. data/lib/oraclebmc/core/models/update_dhcp_details.rb +172 -0
  56. data/lib/oraclebmc/core/models/update_drg_attachment_details.rb +162 -0
  57. data/lib/oraclebmc/core/models/update_drg_details.rb +162 -0
  58. data/lib/oraclebmc/core/models/update_image_details.rb +165 -0
  59. data/lib/oraclebmc/core/models/update_instance_details.rb +165 -0
  60. data/lib/oraclebmc/core/models/update_internet_gateway_details.rb +173 -0
  61. data/lib/oraclebmc/core/models/update_ip_sec_connection_details.rb +162 -0
  62. data/lib/oraclebmc/core/models/update_route_table_details.rb +173 -0
  63. data/lib/oraclebmc/core/models/update_security_list_details.rb +184 -0
  64. data/lib/oraclebmc/core/models/update_subnet_details.rb +162 -0
  65. data/lib/oraclebmc/core/models/update_vcn_details.rb +162 -0
  66. data/lib/oraclebmc/core/models/update_volume_backup_details.rb +162 -0
  67. data/lib/oraclebmc/core/models/update_volume_details.rb +163 -0
  68. data/lib/oraclebmc/core/models/vcn.rb +272 -0
  69. data/lib/oraclebmc/core/models/vnic.rb +274 -0
  70. data/lib/oraclebmc/core/models/vnic_attachment.rb +271 -0
  71. data/lib/oraclebmc/core/models/volume.rb +249 -0
  72. data/lib/oraclebmc/core/models/volume_attachment.rb +284 -0
  73. data/lib/oraclebmc/core/models/volume_backup.rb +273 -0
  74. data/lib/oraclebmc/core/util.rb +1 -0
  75. data/lib/oraclebmc/core/virtual_network_client.rb +2263 -0
  76. data/lib/oraclebmc/errors.rb +62 -0
  77. data/lib/oraclebmc/global_context.rb +21 -0
  78. data/lib/oraclebmc/identity/identity.rb +38 -0
  79. data/lib/oraclebmc/identity/identity_client.rb +1462 -0
  80. data/lib/oraclebmc/identity/models/add_user_to_group_details.rb +173 -0
  81. data/lib/oraclebmc/identity/models/api_key.rb +251 -0
  82. data/lib/oraclebmc/identity/models/availability_domain.rb +173 -0
  83. data/lib/oraclebmc/identity/models/compartment.rb +251 -0
  84. data/lib/oraclebmc/identity/models/create_api_key_details.rb +162 -0
  85. data/lib/oraclebmc/identity/models/create_compartment_details.rb +187 -0
  86. data/lib/oraclebmc/identity/models/create_group_details.rb +186 -0
  87. data/lib/oraclebmc/identity/models/create_policy_details.rb +215 -0
  88. data/lib/oraclebmc/identity/models/create_swift_password_details.rb +163 -0
  89. data/lib/oraclebmc/identity/models/create_user_details.rb +186 -0
  90. data/lib/oraclebmc/identity/models/group.rb +251 -0
  91. data/lib/oraclebmc/identity/models/policy.rb +277 -0
  92. data/lib/oraclebmc/identity/models/swift_password.rb +266 -0
  93. data/lib/oraclebmc/identity/models/ui_password.rb +227 -0
  94. data/lib/oraclebmc/identity/models/update_compartment_details.rb +162 -0
  95. data/lib/oraclebmc/identity/models/update_group_details.rb +162 -0
  96. data/lib/oraclebmc/identity/models/update_policy_details.rb +190 -0
  97. data/lib/oraclebmc/identity/models/update_state_details.rb +163 -0
  98. data/lib/oraclebmc/identity/models/update_swift_password_details.rb +162 -0
  99. data/lib/oraclebmc/identity/models/update_user_details.rb +162 -0
  100. data/lib/oraclebmc/identity/models/user.rb +257 -0
  101. data/lib/oraclebmc/identity/models/user_group_membership.rb +249 -0
  102. data/lib/oraclebmc/identity/util.rb +1 -0
  103. data/lib/oraclebmc/load_balancer/load_balancer.rb +45 -0
  104. data/lib/oraclebmc/load_balancer/load_balancer_client.rb +1218 -0
  105. data/lib/oraclebmc/load_balancer/models/backend.rb +262 -0
  106. data/lib/oraclebmc/load_balancer/models/backend_details.rb +248 -0
  107. data/lib/oraclebmc/load_balancer/models/backend_set.rb +211 -0
  108. data/lib/oraclebmc/load_balancer/models/backend_set_details.rb +197 -0
  109. data/lib/oraclebmc/load_balancer/models/certificate.rb +209 -0
  110. data/lib/oraclebmc/load_balancer/models/certificate_details.rb +245 -0
  111. data/lib/oraclebmc/load_balancer/models/create_backend_details.rb +248 -0
  112. data/lib/oraclebmc/load_balancer/models/create_backend_set_details.rb +210 -0
  113. data/lib/oraclebmc/load_balancer/models/create_certificate_details.rb +245 -0
  114. data/lib/oraclebmc/load_balancer/models/create_listener_details.rb +216 -0
  115. data/lib/oraclebmc/load_balancer/models/create_load_balancer_details.rb +233 -0
  116. data/lib/oraclebmc/load_balancer/models/health_checker.rb +265 -0
  117. data/lib/oraclebmc/load_balancer/models/health_checker_details.rb +264 -0
  118. data/lib/oraclebmc/load_balancer/models/ip_address.rb +165 -0
  119. data/lib/oraclebmc/load_balancer/models/listener.rb +216 -0
  120. data/lib/oraclebmc/load_balancer/models/listener_details.rb +202 -0
  121. data/lib/oraclebmc/load_balancer/models/load_balancer.rb +296 -0
  122. data/lib/oraclebmc/load_balancer/models/load_balancer_policy.rb +162 -0
  123. data/lib/oraclebmc/load_balancer/models/load_balancer_protocol.rb +162 -0
  124. data/lib/oraclebmc/load_balancer/models/load_balancer_shape.rb +162 -0
  125. data/lib/oraclebmc/load_balancer/models/ssl_configuration.rb +195 -0
  126. data/lib/oraclebmc/load_balancer/models/ssl_configuration_details.rb +195 -0
  127. data/lib/oraclebmc/load_balancer/models/update_backend_details.rb +220 -0
  128. data/lib/oraclebmc/load_balancer/models/update_backend_set_details.rb +197 -0
  129. data/lib/oraclebmc/load_balancer/models/update_health_checker_details.rb +263 -0
  130. data/lib/oraclebmc/load_balancer/models/update_listener_details.rb +202 -0
  131. data/lib/oraclebmc/load_balancer/models/update_load_balancer_details.rb +165 -0
  132. data/lib/oraclebmc/load_balancer/models/work_request.rb +269 -0
  133. data/lib/oraclebmc/load_balancer/models/work_request_error.rb +185 -0
  134. data/lib/oraclebmc/load_balancer/util.rb +55 -0
  135. data/lib/oraclebmc/regions.rb +41 -0
  136. data/lib/oraclebmc/response.rb +86 -0
  137. data/lib/oraclebmc/signer.rb +119 -0
  138. data/lib/oraclebmc/version.rb +5 -0
  139. data/lib/oraclebmc/waiter.rb +111 -0
  140. data/lib/oraclebmc.rb +20 -0
  141. metadata +265 -0
@@ -0,0 +1,254 @@
1
+ # Copyright (c) 2016 Oracle and/or its affiliates. All rights reserved.
2
+
3
+ require 'date'
4
+ require_relative 'volume_attachment'
5
+
6
+ module OracleBMC
7
+ class Core::Models::IScsiVolumeAttachment < Core::Models::VolumeAttachment
8
+ # The Challenge-Handshake-Authentication-Protocol (CHAP) secret valid for the associated CHAP user name.
9
+ # (Also called the \"CHAP password\".)
10
+ #
11
+ # Example: `d6866c0d-298b-48ba-95af-309b4faux45e`
12
+ #
13
+ # @return [String]
14
+ attr_accessor :chap_secret
15
+
16
+ # The volume's system-generated Challenge-Handshake-Authentication-Protocol (CHAP) user name.
17
+ #
18
+ # Example: `ocid1.volume.oc1.phx.abyhqljrgvttnlx73nmrwfaux7kcvzfs3s66izvxf2h4lgvyndsdsnoiwr5q`
19
+ #
20
+ # @return [String]
21
+ attr_accessor :chap_username
22
+
23
+ # The volume's iSCSI IP address.
24
+ #
25
+ # Example: `169.254.0.2`
26
+ #
27
+ # @return [String]
28
+ attr_accessor :ipv4
29
+
30
+ # The target volume's iSCSI Qualified Name in the format defined by RFC 3720.
31
+ #
32
+ # Example: `iqn.2015-12.us.oracle.com:456b0391-17b8-4122-bbf1-f85fc0bb97d9`
33
+ #
34
+ # @return [String]
35
+ attr_accessor :iqn
36
+
37
+ # The volume's iSCSI port.
38
+ #
39
+ # Example: `3260`
40
+ #
41
+ # @return [Integer]
42
+ attr_accessor :port
43
+
44
+
45
+ # Initializes the object
46
+ # @param [Hash] attributes Model attributes in the form of hash
47
+ def initialize(attributes = {})
48
+ return unless attributes.is_a?(Hash)
49
+
50
+ attributes['attachmentType'] = 'iscsi'
51
+
52
+ super(attributes)
53
+
54
+ # convert string to symbol for hash key
55
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
56
+
57
+
58
+ if attributes[:'chapSecret']
59
+ self.chap_secret = attributes[:'chapSecret']
60
+ end
61
+
62
+ if attributes[:'chapUsername']
63
+ self.chap_username = attributes[:'chapUsername']
64
+ end
65
+
66
+ if attributes[:'ipv4']
67
+ self.ipv4 = attributes[:'ipv4']
68
+ end
69
+
70
+ if attributes[:'iqn']
71
+ self.iqn = attributes[:'iqn']
72
+ end
73
+
74
+ if attributes[:'port']
75
+ self.port = attributes[:'port']
76
+ end
77
+
78
+ end
79
+
80
+ # Checks equality by comparing each attribute.
81
+ # @param [Object] other_object to be compared
82
+ def ==(other_object)
83
+ return true if self.equal?(other_object)
84
+ self.class == other_object.class &&
85
+ attachment_type == other_object.attachment_type &&
86
+ availability_domain == other_object.availability_domain &&
87
+ compartment_id == other_object.compartment_id &&
88
+ display_name == other_object.display_name &&
89
+ id == other_object.id &&
90
+ instance_id == other_object.instance_id &&
91
+ lifecycle_state == other_object.lifecycle_state &&
92
+ time_created == other_object.time_created &&
93
+ volume_id == other_object.volume_id &&
94
+ chap_secret == other_object.chap_secret &&
95
+ chap_username == other_object.chap_username &&
96
+ ipv4 == other_object.ipv4 &&
97
+ iqn == other_object.iqn &&
98
+ port == other_object.port
99
+ end
100
+
101
+ # @see the `==` method
102
+ # @param [Object] other_object to be compared
103
+ def eql?(other_object)
104
+ self == other_object
105
+ end
106
+
107
+ # Calculates hash code according to all attributes.
108
+ # @return [Fixnum] Hash code
109
+ def hash
110
+ [attachment_type, availability_domain, compartment_id, display_name, id, instance_id, lifecycle_state, time_created, volume_id, chap_secret, chap_username, ipv4, iqn, port].hash
111
+ end
112
+
113
+ # Builds the object from hash
114
+ # @param [Hash] attributes Model attributes in the form of hash
115
+ # @return [Object] Returns the model itself
116
+ def build_from_hash(attributes)
117
+ return nil unless attributes.is_a?(Hash)
118
+ self.class.swagger_types.each_pair do |key, type|
119
+ if type =~ /^Array<(.*)>/i
120
+ # check to ensure the input is an array given that the the attribute
121
+ # is documented as an array but the input is not
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) } )
124
+ end
125
+ elsif !attributes[self.class.attribute_map[key]].nil?
126
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
127
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
128
+ end
129
+
130
+ self
131
+ end
132
+
133
+ # Returns the string representation of the object
134
+ # @return [String] String presentation of the object
135
+ def to_s
136
+ to_hash.to_s
137
+ end
138
+
139
+ # Returns the object in the form of hash
140
+ # @return [Hash] Returns the object in the form of hash
141
+ def to_hash
142
+ hash = {}
143
+ self.class.attribute_map.each_pair do |attr, param|
144
+ value = self.send(attr)
145
+ next if value.nil?
146
+ hash[param] = _to_hash(value)
147
+ end
148
+ hash
149
+ end
150
+
151
+ private
152
+
153
+ # Outputs non-array value in the form of hash
154
+ # For object, use to_hash. Otherwise, just return the value
155
+ # @param [Object] value Any valid value
156
+ # @return [Hash] Returns the value in the form of hash
157
+ def _to_hash(value)
158
+ if value.is_a?(Array)
159
+ value.compact.map{ |v| _to_hash(v) }
160
+ elsif value.is_a?(Hash)
161
+ {}.tap do |hash|
162
+ value.each { |k, v| hash[k] = _to_hash(v) }
163
+ end
164
+ elsif value.respond_to? :to_hash
165
+ value.to_hash
166
+ else
167
+ value
168
+ end
169
+ end
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
+
213
+
214
+ # Attribute mapping from ruby-style variable name to JSON key.
215
+ def self.attribute_map
216
+ {
217
+ :'attachment_type' => :'attachmentType',
218
+ :'availability_domain' => :'availabilityDomain',
219
+ :'compartment_id' => :'compartmentId',
220
+ :'display_name' => :'displayName',
221
+ :'id' => :'id',
222
+ :'instance_id' => :'instanceId',
223
+ :'lifecycle_state' => :'lifecycleState',
224
+ :'time_created' => :'timeCreated',
225
+ :'volume_id' => :'volumeId',
226
+ :'chap_secret' => :'chapSecret',
227
+ :'chap_username' => :'chapUsername',
228
+ :'ipv4' => :'ipv4',
229
+ :'iqn' => :'iqn',
230
+ :'port' => :'port'
231
+ }
232
+ end
233
+
234
+ # Attribute type mapping.
235
+ def self.swagger_types
236
+ {
237
+ :'attachment_type' => :'String',
238
+ :'availability_domain' => :'String',
239
+ :'compartment_id' => :'String',
240
+ :'display_name' => :'String',
241
+ :'id' => :'String',
242
+ :'instance_id' => :'String',
243
+ :'lifecycle_state' => :'String',
244
+ :'time_created' => :'DateTime',
245
+ :'volume_id' => :'String',
246
+ :'chap_secret' => :'String',
247
+ :'chap_username' => :'String',
248
+ :'ipv4' => :'String',
249
+ :'iqn' => :'String',
250
+ :'port' => :'Integer'
251
+ }
252
+ end
253
+ end
254
+ end
@@ -0,0 +1,173 @@
1
+ # Copyright (c) 2016 Oracle and/or its affiliates. All rights reserved.
2
+
3
+ require 'date'
4
+
5
+ module OracleBMC
6
+ class Core::Models::IcmpOptions
7
+ # The ICMP code (optional).
8
+ # @return [Integer]
9
+ attr_accessor :code
10
+
11
+ # The ICMP type.
12
+ # @return [Integer]
13
+ attr_accessor :type
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[:'code']
26
+ self.code = attributes[:'code']
27
+ end
28
+
29
+ if attributes[:'type']
30
+ self.type = attributes[:'type']
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
+ code == other_object.code &&
41
+ type == other_object.type
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
+ [code, type].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| _deserialize($1, v) } )
67
+ end
68
+ elsif !attributes[self.class.attribute_map[key]].nil?
69
+ self.send("#{key}=", _deserialize(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
+ # 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
+
156
+
157
+ # Attribute mapping from ruby-style variable name to JSON key.
158
+ def self.attribute_map
159
+ {
160
+ :'code' => :'code',
161
+ :'type' => :'type'
162
+ }
163
+ end
164
+
165
+ # Attribute type mapping.
166
+ def self.swagger_types
167
+ {
168
+ :'code' => :'Integer',
169
+ :'type' => :'Integer'
170
+ }
171
+ end
172
+ end
173
+ end
@@ -0,0 +1,282 @@
1
+ # Copyright (c) 2016 Oracle and/or its affiliates. All rights reserved.
2
+
3
+ require 'date'
4
+
5
+ module OracleBMC
6
+ class Core::Models::Image
7
+
8
+ LIFECYCLE_STATE_ENUM = [LIFECYCLE_STATE_PROVISIONING = 'PROVISIONING',
9
+ LIFECYCLE_STATE_AVAILABLE = 'AVAILABLE',
10
+ LIFECYCLE_STATE_DISABLED = 'DISABLED',
11
+ LIFECYCLE_STATE_DELETED = 'DELETED']
12
+
13
+ # The OCID of the image originally used to launch the instance.
14
+ # @return [String]
15
+ attr_accessor :base_image_id
16
+
17
+ # The OCID of the compartment containing the instance you want to use as the basis for the image.
18
+ #
19
+ # @return [String]
20
+ attr_accessor :compartment_id
21
+
22
+ # Whether instances launched with this image can be used to create new images.
23
+ # For example, you cannot create an image of an Oracle Database instance.
24
+ #
25
+ # Example: `true`
26
+ #
27
+ # @return [BOOLEAN]
28
+ attr_accessor :create_image_allowed
29
+
30
+ # A user-friendly name for the image. It does not have to be unique, and it's changeable.
31
+ # You cannot use an Oracle-provided image name as a custom image name.
32
+ #
33
+ # Example: `My custom Oracle Linux image`
34
+ #
35
+ # @return [String]
36
+ attr_accessor :display_name
37
+
38
+ # The OCID of the image.
39
+ # @return [String]
40
+ attr_accessor :id
41
+
42
+ # @return [String]
43
+ attr_accessor :lifecycle_state
44
+
45
+ # The image's operating system.
46
+ #
47
+ # Example: `Oracle Linux`
48
+ #
49
+ # @return [String]
50
+ attr_accessor :operating_system
51
+
52
+ # The image's operating system version.
53
+ #
54
+ # Example: `7.2`
55
+ #
56
+ # @return [String]
57
+ attr_accessor :operating_system_version
58
+
59
+ # The date and time the image was created, in the format defined by RFC3339.
60
+ #
61
+ # Example: `2016-08-25T21:10:29.600Z`
62
+ #
63
+ # @return [DateTime]
64
+ attr_accessor :time_created
65
+
66
+
67
+ # Initializes the object
68
+ # @param [Hash] attributes Model attributes in the form of hash
69
+ def initialize(attributes = {})
70
+ return unless attributes.is_a?(Hash)
71
+
72
+ # convert string to symbol for hash key
73
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
74
+
75
+
76
+ if attributes[:'baseImageId']
77
+ self.base_image_id = attributes[:'baseImageId']
78
+ end
79
+
80
+ if attributes[:'compartmentId']
81
+ self.compartment_id = attributes[:'compartmentId']
82
+ end
83
+
84
+ if attributes[:'createImageAllowed']
85
+ self.create_image_allowed = attributes[:'createImageAllowed']
86
+ end
87
+
88
+ if attributes[:'displayName']
89
+ self.display_name = attributes[:'displayName']
90
+ end
91
+
92
+ if attributes[:'id']
93
+ self.id = attributes[:'id']
94
+ end
95
+
96
+ if attributes[:'lifecycleState']
97
+ self.lifecycle_state = attributes[:'lifecycleState']
98
+ end
99
+
100
+ if attributes[:'operatingSystem']
101
+ self.operating_system = attributes[:'operatingSystem']
102
+ end
103
+
104
+ if attributes[:'operatingSystemVersion']
105
+ self.operating_system_version = attributes[:'operatingSystemVersion']
106
+ end
107
+
108
+ if attributes[:'timeCreated']
109
+ self.time_created = attributes[:'timeCreated']
110
+ end
111
+
112
+ end
113
+
114
+ # Custom attribute writer method checking allowed values (enum).
115
+ # @param [Object] lifecycle_state Object to be assigned
116
+ def lifecycle_state=(lifecycle_state)
117
+ if lifecycle_state && !LIFECYCLE_STATE_ENUM.include?(lifecycle_state)
118
+ fail "Invalid value for 'lifecycle_state': this must be one of the values in LIFECYCLE_STATE_ENUM."
119
+ end
120
+ @lifecycle_state = lifecycle_state
121
+ end
122
+
123
+ # Checks equality by comparing each attribute.
124
+ # @param [Object] other_object to be compared
125
+ def ==(other_object)
126
+ return true if self.equal?(other_object)
127
+ self.class == other_object.class &&
128
+ base_image_id == other_object.base_image_id &&
129
+ compartment_id == other_object.compartment_id &&
130
+ create_image_allowed == other_object.create_image_allowed &&
131
+ display_name == other_object.display_name &&
132
+ id == other_object.id &&
133
+ lifecycle_state == other_object.lifecycle_state &&
134
+ operating_system == other_object.operating_system &&
135
+ operating_system_version == other_object.operating_system_version &&
136
+ time_created == other_object.time_created
137
+ end
138
+
139
+ # @see the `==` method
140
+ # @param [Object] other_object to be compared
141
+ def eql?(other_object)
142
+ self == other_object
143
+ end
144
+
145
+ # Calculates hash code according to all attributes.
146
+ # @return [Fixnum] Hash code
147
+ def hash
148
+ [base_image_id, compartment_id, create_image_allowed, display_name, id, lifecycle_state, operating_system, operating_system_version, time_created].hash
149
+ end
150
+
151
+ # Builds the object from hash
152
+ # @param [Hash] attributes Model attributes in the form of hash
153
+ # @return [Object] Returns the model itself
154
+ def build_from_hash(attributes)
155
+ return nil unless attributes.is_a?(Hash)
156
+ self.class.swagger_types.each_pair do |key, type|
157
+ if type =~ /^Array<(.*)>/i
158
+ # check to ensure the input is an array given that the the attribute
159
+ # is documented as an array but the input is not
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) } )
162
+ end
163
+ elsif !attributes[self.class.attribute_map[key]].nil?
164
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
165
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
166
+ end
167
+
168
+ self
169
+ end
170
+
171
+ # Returns the string representation of the object
172
+ # @return [String] String presentation of the object
173
+ def to_s
174
+ to_hash.to_s
175
+ end
176
+
177
+ # Returns the object in the form of hash
178
+ # @return [Hash] Returns the object in the form of hash
179
+ def to_hash
180
+ hash = {}
181
+ self.class.attribute_map.each_pair do |attr, param|
182
+ value = self.send(attr)
183
+ next if value.nil?
184
+ hash[param] = _to_hash(value)
185
+ end
186
+ hash
187
+ end
188
+
189
+ private
190
+
191
+ # Outputs non-array value in the form of hash
192
+ # For object, use to_hash. Otherwise, just return the value
193
+ # @param [Object] value Any valid value
194
+ # @return [Hash] Returns the value in the form of hash
195
+ def _to_hash(value)
196
+ if value.is_a?(Array)
197
+ value.compact.map{ |v| _to_hash(v) }
198
+ elsif value.is_a?(Hash)
199
+ {}.tap do |hash|
200
+ value.each { |k, v| hash[k] = _to_hash(v) }
201
+ end
202
+ elsif value.respond_to? :to_hash
203
+ value.to_hash
204
+ else
205
+ value
206
+ end
207
+ end
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
+
251
+
252
+ # Attribute mapping from ruby-style variable name to JSON key.
253
+ def self.attribute_map
254
+ {
255
+ :'base_image_id' => :'baseImageId',
256
+ :'compartment_id' => :'compartmentId',
257
+ :'create_image_allowed' => :'createImageAllowed',
258
+ :'display_name' => :'displayName',
259
+ :'id' => :'id',
260
+ :'lifecycle_state' => :'lifecycleState',
261
+ :'operating_system' => :'operatingSystem',
262
+ :'operating_system_version' => :'operatingSystemVersion',
263
+ :'time_created' => :'timeCreated'
264
+ }
265
+ end
266
+
267
+ # Attribute type mapping.
268
+ def self.swagger_types
269
+ {
270
+ :'base_image_id' => :'String',
271
+ :'compartment_id' => :'String',
272
+ :'create_image_allowed' => :'BOOLEAN',
273
+ :'display_name' => :'String',
274
+ :'id' => :'String',
275
+ :'lifecycle_state' => :'String',
276
+ :'operating_system' => :'String',
277
+ :'operating_system_version' => :'String',
278
+ :'time_created' => :'DateTime'
279
+ }
280
+ end
281
+ end
282
+ end