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