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,216 @@
1
+ # Copyright (c) 2016 Oracle and/or its affiliates. All rights reserved.
2
+
3
+ require 'date'
4
+
5
+ module OracleBMC
6
+ class LoadBalancer::Models::Listener
7
+ # A friendly name for the listener. It must be unique and it cannot be changed.
8
+ #
9
+ # Example: `My listener`
10
+ #
11
+ # @return [String]
12
+ attr_accessor :name
13
+
14
+ # The name of the associated backend set.
15
+ # @return [String]
16
+ attr_accessor :default_backend_set_name
17
+
18
+ # The communication port for the listener.
19
+ #
20
+ # Example: `80`
21
+ #
22
+ # @return [Integer]
23
+ attr_accessor :port
24
+
25
+ # The protocol on which the listener accepts connection requests.
26
+ # To get a list of valid protocols, use the {#list_protocols list_protocols}
27
+ # operation.
28
+ #
29
+ # Example: `HTTP`
30
+ #
31
+ # @return [String]
32
+ attr_accessor :protocol
33
+
34
+ # @return [OracleBMC::LoadBalancer::Models::SSLConfiguration]
35
+ attr_accessor :ssl_configuration
36
+
37
+
38
+ # Initializes the object
39
+ # @param [Hash] attributes Model attributes in the form of hash
40
+ def initialize(attributes = {})
41
+ return unless attributes.is_a?(Hash)
42
+
43
+ # convert string to symbol for hash key
44
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
45
+
46
+
47
+ if attributes[:'name']
48
+ self.name = attributes[:'name']
49
+ end
50
+
51
+ if attributes[:'defaultBackendSetName']
52
+ self.default_backend_set_name = attributes[:'defaultBackendSetName']
53
+ end
54
+
55
+ if attributes[:'port']
56
+ self.port = attributes[:'port']
57
+ end
58
+
59
+ if attributes[:'protocol']
60
+ self.protocol = attributes[:'protocol']
61
+ end
62
+
63
+ if attributes[:'sslConfiguration']
64
+ self.ssl_configuration = attributes[:'sslConfiguration']
65
+ end
66
+
67
+ end
68
+
69
+ # Checks equality by comparing each attribute.
70
+ # @param [Object] other_object to be compared
71
+ def ==(other_object)
72
+ return true if self.equal?(other_object)
73
+ self.class == other_object.class &&
74
+ name == other_object.name &&
75
+ default_backend_set_name == other_object.default_backend_set_name &&
76
+ port == other_object.port &&
77
+ protocol == other_object.protocol &&
78
+ ssl_configuration == other_object.ssl_configuration
79
+ end
80
+
81
+ # @see the `==` method
82
+ # @param [Object] other_object to be compared
83
+ def eql?(other_object)
84
+ self == other_object
85
+ end
86
+
87
+ # Calculates hash code according to all attributes.
88
+ # @return [Fixnum] Hash code
89
+ def hash
90
+ [name, default_backend_set_name, port, protocol, ssl_configuration].hash
91
+ end
92
+
93
+ # Builds the object from hash
94
+ # @param [Hash] attributes Model attributes in the form of hash
95
+ # @return [Object] Returns the model itself
96
+ def build_from_hash(attributes)
97
+ return nil unless attributes.is_a?(Hash)
98
+ self.class.swagger_types.each_pair do |key, type|
99
+ if type =~ /^Array<(.*)>/i
100
+ # check to ensure the input is an array given that the the attribute
101
+ # is documented as an array but the input is not
102
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
103
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
104
+ end
105
+ elsif !attributes[self.class.attribute_map[key]].nil?
106
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
107
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
108
+ end
109
+
110
+ self
111
+ end
112
+
113
+ # Returns the string representation of the object
114
+ # @return [String] String presentation of the object
115
+ def to_s
116
+ to_hash.to_s
117
+ end
118
+
119
+ # Returns the object in the form of hash
120
+ # @return [Hash] Returns the object in the form of hash
121
+ def to_hash
122
+ hash = {}
123
+ self.class.attribute_map.each_pair do |attr, param|
124
+ value = self.send(attr)
125
+ next if value.nil?
126
+ hash[param] = _to_hash(value)
127
+ end
128
+ hash
129
+ end
130
+
131
+ private
132
+
133
+ # Outputs non-array value in the form of hash
134
+ # For object, use to_hash. Otherwise, just return the value
135
+ # @param [Object] value Any valid value
136
+ # @return [Hash] Returns the value in the form of hash
137
+ def _to_hash(value)
138
+ if value.is_a?(Array)
139
+ value.compact.map{ |v| _to_hash(v) }
140
+ elsif value.is_a?(Hash)
141
+ {}.tap do |hash|
142
+ value.each { |k, v| hash[k] = _to_hash(v) }
143
+ end
144
+ elsif value.respond_to? :to_hash
145
+ value.to_hash
146
+ else
147
+ value
148
+ end
149
+ end
150
+
151
+ # Deserializes the data based on type
152
+ # @param [String] type Data type
153
+ # @param [String] value Value to be deserialized
154
+ # @return [Object] Deserialized data
155
+ def _deserialize(type, value)
156
+ case type.to_sym
157
+ when :DateTime
158
+ DateTime.parse(value)
159
+ when :Date
160
+ Date.parse(value)
161
+ when :String
162
+ value.to_s
163
+ when :Integer
164
+ value.to_i
165
+ when :Float
166
+ value.to_f
167
+ when :BOOLEAN
168
+ if value.to_s =~ /^(true|t|yes|y|1)$/i
169
+ true
170
+ else
171
+ false
172
+ end
173
+ when :Object
174
+ # generic object (usually a Hash), return directly
175
+ value
176
+ when /\AArray<(?<inner_type>.+)>\z/
177
+ inner_type = Regexp.last_match[:inner_type]
178
+ value.map { |v| _deserialize(inner_type, v) }
179
+ when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
180
+ k_type = Regexp.last_match[:k_type]
181
+ v_type = Regexp.last_match[:v_type]
182
+ {}.tap do |hash|
183
+ value.each do |k, v|
184
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
185
+ end
186
+ end
187
+ else # model
188
+ temp_model = OracleBMC.const_get(type.to_s).new
189
+ temp_model.build_from_hash(value)
190
+ end
191
+ end
192
+
193
+
194
+ # Attribute mapping from ruby-style variable name to JSON key.
195
+ def self.attribute_map
196
+ {
197
+ :'name' => :'name',
198
+ :'default_backend_set_name' => :'defaultBackendSetName',
199
+ :'port' => :'port',
200
+ :'protocol' => :'protocol',
201
+ :'ssl_configuration' => :'sslConfiguration'
202
+ }
203
+ end
204
+
205
+ # Attribute type mapping.
206
+ def self.swagger_types
207
+ {
208
+ :'name' => :'String',
209
+ :'default_backend_set_name' => :'String',
210
+ :'port' => :'Integer',
211
+ :'protocol' => :'String',
212
+ :'ssl_configuration' => :'OracleBMC::LoadBalancer::Models::SSLConfiguration'
213
+ }
214
+ end
215
+ end
216
+ end
@@ -0,0 +1,202 @@
1
+ # Copyright (c) 2016 Oracle and/or its affiliates. All rights reserved.
2
+
3
+ require 'date'
4
+
5
+ module OracleBMC
6
+ class LoadBalancer::Models::ListenerDetails
7
+ # The name of the associated backend set.
8
+ # @return [String]
9
+ attr_accessor :default_backend_set_name
10
+
11
+ # The communication port for the listener.
12
+ #
13
+ # Example: `80`
14
+ #
15
+ # @return [Integer]
16
+ attr_accessor :port
17
+
18
+ # The protocol on which the listener accepts connection requests.
19
+ # To get a list of valid protocols, use the {#list_protocols list_protocols}
20
+ # operation.
21
+ #
22
+ # Example: `HTTP`
23
+ #
24
+ # @return [String]
25
+ attr_accessor :protocol
26
+
27
+ # @return [OracleBMC::LoadBalancer::Models::SSLConfigurationDetails]
28
+ attr_accessor :ssl_configuration
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[:'defaultBackendSetName']
41
+ self.default_backend_set_name = attributes[:'defaultBackendSetName']
42
+ end
43
+
44
+ if attributes[:'port']
45
+ self.port = attributes[:'port']
46
+ end
47
+
48
+ if attributes[:'protocol']
49
+ self.protocol = attributes[:'protocol']
50
+ end
51
+
52
+ if attributes[:'sslConfiguration']
53
+ self.ssl_configuration = attributes[:'sslConfiguration']
54
+ end
55
+
56
+ end
57
+
58
+ # Checks equality by comparing each attribute.
59
+ # @param [Object] other_object to be compared
60
+ def ==(other_object)
61
+ return true if self.equal?(other_object)
62
+ self.class == other_object.class &&
63
+ default_backend_set_name == other_object.default_backend_set_name &&
64
+ port == other_object.port &&
65
+ protocol == other_object.protocol &&
66
+ ssl_configuration == other_object.ssl_configuration
67
+ end
68
+
69
+ # @see the `==` method
70
+ # @param [Object] other_object to be compared
71
+ def eql?(other_object)
72
+ self == other_object
73
+ end
74
+
75
+ # Calculates hash code according to all attributes.
76
+ # @return [Fixnum] Hash code
77
+ def hash
78
+ [default_backend_set_name, port, protocol, ssl_configuration].hash
79
+ end
80
+
81
+ # Builds the object from hash
82
+ # @param [Hash] attributes Model attributes in the form of hash
83
+ # @return [Object] Returns the model itself
84
+ def build_from_hash(attributes)
85
+ return nil unless attributes.is_a?(Hash)
86
+ self.class.swagger_types.each_pair do |key, type|
87
+ if type =~ /^Array<(.*)>/i
88
+ # check to ensure the input is an array given that the the attribute
89
+ # is documented as an array but the input is not
90
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
91
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
92
+ end
93
+ elsif !attributes[self.class.attribute_map[key]].nil?
94
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
95
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
96
+ end
97
+
98
+ self
99
+ end
100
+
101
+ # Returns the string representation of the object
102
+ # @return [String] String presentation of the object
103
+ def to_s
104
+ to_hash.to_s
105
+ end
106
+
107
+ # Returns the object in the form of hash
108
+ # @return [Hash] Returns the object in the form of hash
109
+ def to_hash
110
+ hash = {}
111
+ self.class.attribute_map.each_pair do |attr, param|
112
+ value = self.send(attr)
113
+ next if value.nil?
114
+ hash[param] = _to_hash(value)
115
+ end
116
+ hash
117
+ end
118
+
119
+ private
120
+
121
+ # Outputs non-array value in the form of hash
122
+ # For object, use to_hash. Otherwise, just return the value
123
+ # @param [Object] value Any valid value
124
+ # @return [Hash] Returns the value in the form of hash
125
+ def _to_hash(value)
126
+ if value.is_a?(Array)
127
+ value.compact.map{ |v| _to_hash(v) }
128
+ elsif value.is_a?(Hash)
129
+ {}.tap do |hash|
130
+ value.each { |k, v| hash[k] = _to_hash(v) }
131
+ end
132
+ elsif value.respond_to? :to_hash
133
+ value.to_hash
134
+ else
135
+ value
136
+ end
137
+ end
138
+
139
+ # Deserializes the data based on type
140
+ # @param [String] type Data type
141
+ # @param [String] value Value to be deserialized
142
+ # @return [Object] Deserialized data
143
+ def _deserialize(type, value)
144
+ case type.to_sym
145
+ when :DateTime
146
+ DateTime.parse(value)
147
+ when :Date
148
+ Date.parse(value)
149
+ when :String
150
+ value.to_s
151
+ when :Integer
152
+ value.to_i
153
+ when :Float
154
+ value.to_f
155
+ when :BOOLEAN
156
+ if value.to_s =~ /^(true|t|yes|y|1)$/i
157
+ true
158
+ else
159
+ false
160
+ end
161
+ when :Object
162
+ # generic object (usually a Hash), return directly
163
+ value
164
+ when /\AArray<(?<inner_type>.+)>\z/
165
+ inner_type = Regexp.last_match[:inner_type]
166
+ value.map { |v| _deserialize(inner_type, v) }
167
+ when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
168
+ k_type = Regexp.last_match[:k_type]
169
+ v_type = Regexp.last_match[:v_type]
170
+ {}.tap do |hash|
171
+ value.each do |k, v|
172
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
173
+ end
174
+ end
175
+ else # model
176
+ temp_model = OracleBMC.const_get(type.to_s).new
177
+ temp_model.build_from_hash(value)
178
+ end
179
+ end
180
+
181
+
182
+ # Attribute mapping from ruby-style variable name to JSON key.
183
+ def self.attribute_map
184
+ {
185
+ :'default_backend_set_name' => :'defaultBackendSetName',
186
+ :'port' => :'port',
187
+ :'protocol' => :'protocol',
188
+ :'ssl_configuration' => :'sslConfiguration'
189
+ }
190
+ end
191
+
192
+ # Attribute type mapping.
193
+ def self.swagger_types
194
+ {
195
+ :'default_backend_set_name' => :'String',
196
+ :'port' => :'Integer',
197
+ :'protocol' => :'String',
198
+ :'ssl_configuration' => :'OracleBMC::LoadBalancer::Models::SSLConfigurationDetails'
199
+ }
200
+ end
201
+ end
202
+ end
@@ -0,0 +1,296 @@
1
+ # Copyright (c) 2016 Oracle and/or its affiliates. All rights reserved.
2
+
3
+ require 'date'
4
+
5
+ module OracleBMC
6
+ class LoadBalancer::Models::LoadBalancer
7
+
8
+ LIFECYCLE_STATE_ENUM = [LIFECYCLE_STATE_CREATING = 'CREATING',
9
+ LIFECYCLE_STATE_FAILED = 'FAILED',
10
+ LIFECYCLE_STATE_ACTIVE = 'ACTIVE',
11
+ LIFECYCLE_STATE_DELETING = 'DELETING',
12
+ LIFECYCLE_STATE_DELETED = 'DELETED']
13
+
14
+ # The [OCID](https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm) of the load balancer.
15
+ # @return [String]
16
+ attr_accessor :id
17
+
18
+ # The [OCID](https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm) of the compartment containing the load balancer.
19
+ # @return [String]
20
+ attr_accessor :compartment_id
21
+
22
+ # A user-friendly name. It does not have to be unique, and it is changeable.
23
+ #
24
+ # Example: `My load balancer`
25
+ #
26
+ # @return [String]
27
+ attr_accessor :display_name
28
+
29
+ # @return [String]
30
+ attr_accessor :lifecycle_state
31
+
32
+ # The date and time the load balancer 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
+ # An array of IP addresses.
40
+ #
41
+ # @return [Array<OracleBMC::LoadBalancer::Models::IpAddress>]
42
+ attr_accessor :ip_addresses
43
+
44
+ # A template that determines the total pre-provisioned bandwidth (ingress plus egress).
45
+ # To get a list of available shapes, use the {#list_shapes list_shapes}
46
+ # operation.
47
+ #
48
+ # Example: `100Mbps`
49
+ #
50
+ # @return [String]
51
+ attr_accessor :shape_name
52
+
53
+ # An array of subnet [OCIDs](https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm).
54
+ # @return [Array<String>]
55
+ attr_accessor :subnet_ids
56
+
57
+ # @return [Hash<String, OracleBMC::LoadBalancer::Models::Listener>]
58
+ attr_accessor :listeners
59
+
60
+ # @return [Hash<String, OracleBMC::LoadBalancer::Models::Certificate>]
61
+ attr_accessor :certificates
62
+
63
+ # @return [Hash<String, OracleBMC::LoadBalancer::Models::BackendSet>]
64
+ attr_accessor :backend_sets
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[:'id']
77
+ self.id = attributes[:'id']
78
+ end
79
+
80
+ if attributes[:'compartmentId']
81
+ self.compartment_id = attributes[:'compartmentId']
82
+ end
83
+
84
+ if attributes[:'displayName']
85
+ self.display_name = attributes[:'displayName']
86
+ end
87
+
88
+ if attributes[:'lifecycleState']
89
+ self.lifecycle_state = attributes[:'lifecycleState']
90
+ end
91
+
92
+ if attributes[:'timeCreated']
93
+ self.time_created = attributes[:'timeCreated']
94
+ end
95
+
96
+ if attributes[:'ipAddresses']
97
+ self.ip_addresses = attributes[:'ipAddresses']
98
+ end
99
+
100
+ if attributes[:'shapeName']
101
+ self.shape_name = attributes[:'shapeName']
102
+ end
103
+
104
+ if attributes[:'subnetIds']
105
+ self.subnet_ids = attributes[:'subnetIds']
106
+ end
107
+
108
+ if attributes[:'listeners']
109
+ self.listeners = attributes[:'listeners']
110
+ end
111
+
112
+ if attributes[:'certificates']
113
+ self.certificates = attributes[:'certificates']
114
+ end
115
+
116
+ if attributes[:'backendSets']
117
+ self.backend_sets = attributes[:'backendSets']
118
+ end
119
+
120
+ end
121
+
122
+ # Custom attribute writer method checking allowed values (enum).
123
+ # @param [Object] lifecycle_state Object to be assigned
124
+ def lifecycle_state=(lifecycle_state)
125
+ if lifecycle_state && !LIFECYCLE_STATE_ENUM.include?(lifecycle_state)
126
+ fail "Invalid value for 'lifecycle_state': this must be one of the values in LIFECYCLE_STATE_ENUM."
127
+ end
128
+ @lifecycle_state = lifecycle_state
129
+ end
130
+
131
+ # Checks equality by comparing each attribute.
132
+ # @param [Object] other_object to be compared
133
+ def ==(other_object)
134
+ return true if self.equal?(other_object)
135
+ self.class == other_object.class &&
136
+ id == other_object.id &&
137
+ compartment_id == other_object.compartment_id &&
138
+ display_name == other_object.display_name &&
139
+ lifecycle_state == other_object.lifecycle_state &&
140
+ time_created == other_object.time_created &&
141
+ ip_addresses == other_object.ip_addresses &&
142
+ shape_name == other_object.shape_name &&
143
+ subnet_ids == other_object.subnet_ids &&
144
+ listeners == other_object.listeners &&
145
+ certificates == other_object.certificates &&
146
+ backend_sets == other_object.backend_sets
147
+ end
148
+
149
+ # @see the `==` method
150
+ # @param [Object] other_object to be compared
151
+ def eql?(other_object)
152
+ self == other_object
153
+ end
154
+
155
+ # Calculates hash code according to all attributes.
156
+ # @return [Fixnum] Hash code
157
+ def hash
158
+ [id, compartment_id, display_name, lifecycle_state, time_created, ip_addresses, shape_name, subnet_ids, listeners, certificates, backend_sets].hash
159
+ end
160
+
161
+ # Builds the object from hash
162
+ # @param [Hash] attributes Model attributes in the form of hash
163
+ # @return [Object] Returns the model itself
164
+ def build_from_hash(attributes)
165
+ return nil unless attributes.is_a?(Hash)
166
+ self.class.swagger_types.each_pair do |key, type|
167
+ if type =~ /^Array<(.*)>/i
168
+ # check to ensure the input is an array given that the the attribute
169
+ # is documented as an array but the input is not
170
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
171
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
172
+ end
173
+ elsif !attributes[self.class.attribute_map[key]].nil?
174
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
175
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
176
+ end
177
+
178
+ self
179
+ end
180
+
181
+ # Returns the string representation of the object
182
+ # @return [String] String presentation of the object
183
+ def to_s
184
+ to_hash.to_s
185
+ end
186
+
187
+ # Returns the object in the form of hash
188
+ # @return [Hash] Returns the object in the form of hash
189
+ def to_hash
190
+ hash = {}
191
+ self.class.attribute_map.each_pair do |attr, param|
192
+ value = self.send(attr)
193
+ next if value.nil?
194
+ hash[param] = _to_hash(value)
195
+ end
196
+ hash
197
+ end
198
+
199
+ private
200
+
201
+ # Outputs non-array value in the form of hash
202
+ # For object, use to_hash. Otherwise, just return the value
203
+ # @param [Object] value Any valid value
204
+ # @return [Hash] Returns the value in the form of hash
205
+ def _to_hash(value)
206
+ if value.is_a?(Array)
207
+ value.compact.map{ |v| _to_hash(v) }
208
+ elsif value.is_a?(Hash)
209
+ {}.tap do |hash|
210
+ value.each { |k, v| hash[k] = _to_hash(v) }
211
+ end
212
+ elsif value.respond_to? :to_hash
213
+ value.to_hash
214
+ else
215
+ value
216
+ end
217
+ end
218
+
219
+ # Deserializes the data based on type
220
+ # @param [String] type Data type
221
+ # @param [String] value Value to be deserialized
222
+ # @return [Object] Deserialized data
223
+ def _deserialize(type, value)
224
+ case type.to_sym
225
+ when :DateTime
226
+ DateTime.parse(value)
227
+ when :Date
228
+ Date.parse(value)
229
+ when :String
230
+ value.to_s
231
+ when :Integer
232
+ value.to_i
233
+ when :Float
234
+ value.to_f
235
+ when :BOOLEAN
236
+ if value.to_s =~ /^(true|t|yes|y|1)$/i
237
+ true
238
+ else
239
+ false
240
+ end
241
+ when :Object
242
+ # generic object (usually a Hash), return directly
243
+ value
244
+ when /\AArray<(?<inner_type>.+)>\z/
245
+ inner_type = Regexp.last_match[:inner_type]
246
+ value.map { |v| _deserialize(inner_type, v) }
247
+ when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
248
+ k_type = Regexp.last_match[:k_type]
249
+ v_type = Regexp.last_match[:v_type]
250
+ {}.tap do |hash|
251
+ value.each do |k, v|
252
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
253
+ end
254
+ end
255
+ else # model
256
+ temp_model = OracleBMC.const_get(type.to_s).new
257
+ temp_model.build_from_hash(value)
258
+ end
259
+ end
260
+
261
+
262
+ # Attribute mapping from ruby-style variable name to JSON key.
263
+ def self.attribute_map
264
+ {
265
+ :'id' => :'id',
266
+ :'compartment_id' => :'compartmentId',
267
+ :'display_name' => :'displayName',
268
+ :'lifecycle_state' => :'lifecycleState',
269
+ :'time_created' => :'timeCreated',
270
+ :'ip_addresses' => :'ipAddresses',
271
+ :'shape_name' => :'shapeName',
272
+ :'subnet_ids' => :'subnetIds',
273
+ :'listeners' => :'listeners',
274
+ :'certificates' => :'certificates',
275
+ :'backend_sets' => :'backendSets'
276
+ }
277
+ end
278
+
279
+ # Attribute type mapping.
280
+ def self.swagger_types
281
+ {
282
+ :'id' => :'String',
283
+ :'compartment_id' => :'String',
284
+ :'display_name' => :'String',
285
+ :'lifecycle_state' => :'String',
286
+ :'time_created' => :'DateTime',
287
+ :'ip_addresses' => :'Array<OracleBMC::LoadBalancer::Models::IpAddress>',
288
+ :'shape_name' => :'String',
289
+ :'subnet_ids' => :'Array<String>',
290
+ :'listeners' => :'Hash<String, OracleBMC::LoadBalancer::Models::Listener>',
291
+ :'certificates' => :'Hash<String, OracleBMC::LoadBalancer::Models::Certificate>',
292
+ :'backend_sets' => :'Hash<String, OracleBMC::LoadBalancer::Models::BackendSet>'
293
+ }
294
+ end
295
+ end
296
+ end