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,195 @@
1
+ # Copyright (c) 2016 Oracle and/or its affiliates. All rights reserved.
2
+
3
+ require 'date'
4
+
5
+ module OracleBMC
6
+ class LoadBalancer::Models::SSLConfigurationDetails
7
+ # A friendly name for the certificate bundle. It must be unique and it cannot be changed.
8
+ #
9
+ # Example: `My certificate bundle`
10
+ #
11
+ # @return [String]
12
+ attr_accessor :certificate_name
13
+
14
+ # Whether the load balancer listener should verify peer certificates.
15
+ #
16
+ # Example: `true`
17
+ #
18
+ # @return [BOOLEAN]
19
+ attr_accessor :verify_peer_certificate
20
+
21
+ # The maximum depth for peer certificate chain verification.
22
+ #
23
+ # Example: `3`
24
+ #
25
+ # @return [Integer]
26
+ attr_accessor :verify_depth
27
+
28
+
29
+ # Initializes the object
30
+ # @param [Hash] attributes Model attributes in the form of hash
31
+ def initialize(attributes = {})
32
+ return unless attributes.is_a?(Hash)
33
+
34
+ # convert string to symbol for hash key
35
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
36
+
37
+
38
+ if attributes[:'certificateName']
39
+ self.certificate_name = attributes[:'certificateName']
40
+ end
41
+
42
+ if attributes[:'verifyPeerCertificate']
43
+ self.verify_peer_certificate = attributes[:'verifyPeerCertificate']
44
+ else
45
+ self.verify_peer_certificate = false
46
+ end
47
+
48
+ if attributes[:'verifyDepth']
49
+ self.verify_depth = attributes[:'verifyDepth']
50
+ end
51
+
52
+ end
53
+
54
+ # Checks equality by comparing each attribute.
55
+ # @param [Object] other_object to be compared
56
+ def ==(other_object)
57
+ return true if self.equal?(other_object)
58
+ self.class == other_object.class &&
59
+ certificate_name == other_object.certificate_name &&
60
+ verify_peer_certificate == other_object.verify_peer_certificate &&
61
+ verify_depth == other_object.verify_depth
62
+ end
63
+
64
+ # @see the `==` method
65
+ # @param [Object] other_object to be compared
66
+ def eql?(other_object)
67
+ self == other_object
68
+ end
69
+
70
+ # Calculates hash code according to all attributes.
71
+ # @return [Fixnum] Hash code
72
+ def hash
73
+ [certificate_name, verify_peer_certificate, verify_depth].hash
74
+ end
75
+
76
+ # Builds the object from hash
77
+ # @param [Hash] attributes Model attributes in the form of hash
78
+ # @return [Object] Returns the model itself
79
+ def build_from_hash(attributes)
80
+ return nil unless attributes.is_a?(Hash)
81
+ self.class.swagger_types.each_pair do |key, type|
82
+ if type =~ /^Array<(.*)>/i
83
+ # check to ensure the input is an array given that the the attribute
84
+ # is documented as an array but the input is not
85
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
86
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
87
+ end
88
+ elsif !attributes[self.class.attribute_map[key]].nil?
89
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
90
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
91
+ end
92
+
93
+ self
94
+ end
95
+
96
+ # Returns the string representation of the object
97
+ # @return [String] String presentation of the object
98
+ def to_s
99
+ to_hash.to_s
100
+ end
101
+
102
+ # Returns the object in the form of hash
103
+ # @return [Hash] Returns the object in the form of hash
104
+ def to_hash
105
+ hash = {}
106
+ self.class.attribute_map.each_pair do |attr, param|
107
+ value = self.send(attr)
108
+ next if value.nil?
109
+ hash[param] = _to_hash(value)
110
+ end
111
+ hash
112
+ end
113
+
114
+ private
115
+
116
+ # Outputs non-array value in the form of hash
117
+ # For object, use to_hash. Otherwise, just return the value
118
+ # @param [Object] value Any valid value
119
+ # @return [Hash] Returns the value in the form of hash
120
+ def _to_hash(value)
121
+ if value.is_a?(Array)
122
+ value.compact.map{ |v| _to_hash(v) }
123
+ elsif value.is_a?(Hash)
124
+ {}.tap do |hash|
125
+ value.each { |k, v| hash[k] = _to_hash(v) }
126
+ end
127
+ elsif value.respond_to? :to_hash
128
+ value.to_hash
129
+ else
130
+ value
131
+ end
132
+ end
133
+
134
+ # Deserializes the data based on type
135
+ # @param [String] type Data type
136
+ # @param [String] value Value to be deserialized
137
+ # @return [Object] Deserialized data
138
+ def _deserialize(type, value)
139
+ case type.to_sym
140
+ when :DateTime
141
+ DateTime.parse(value)
142
+ when :Date
143
+ Date.parse(value)
144
+ when :String
145
+ value.to_s
146
+ when :Integer
147
+ value.to_i
148
+ when :Float
149
+ value.to_f
150
+ when :BOOLEAN
151
+ if value.to_s =~ /^(true|t|yes|y|1)$/i
152
+ true
153
+ else
154
+ false
155
+ end
156
+ when :Object
157
+ # generic object (usually a Hash), return directly
158
+ value
159
+ when /\AArray<(?<inner_type>.+)>\z/
160
+ inner_type = Regexp.last_match[:inner_type]
161
+ value.map { |v| _deserialize(inner_type, v) }
162
+ when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
163
+ k_type = Regexp.last_match[:k_type]
164
+ v_type = Regexp.last_match[:v_type]
165
+ {}.tap do |hash|
166
+ value.each do |k, v|
167
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
168
+ end
169
+ end
170
+ else # model
171
+ temp_model = OracleBMC.const_get(type.to_s).new
172
+ temp_model.build_from_hash(value)
173
+ end
174
+ end
175
+
176
+
177
+ # Attribute mapping from ruby-style variable name to JSON key.
178
+ def self.attribute_map
179
+ {
180
+ :'certificate_name' => :'certificateName',
181
+ :'verify_peer_certificate' => :'verifyPeerCertificate',
182
+ :'verify_depth' => :'verifyDepth'
183
+ }
184
+ end
185
+
186
+ # Attribute type mapping.
187
+ def self.swagger_types
188
+ {
189
+ :'certificate_name' => :'String',
190
+ :'verify_peer_certificate' => :'BOOLEAN',
191
+ :'verify_depth' => :'Integer'
192
+ }
193
+ end
194
+ end
195
+ end
@@ -0,0 +1,220 @@
1
+ # Copyright (c) 2016 Oracle and/or its affiliates. All rights reserved.
2
+
3
+ require 'date'
4
+
5
+ module OracleBMC
6
+ class LoadBalancer::Models::UpdateBackendDetails
7
+ # The load balancing policy weight assigned to the server. Backend servers with a higher weight receive a larger
8
+ # proportion of incoming traffic. For example, a server weighted '3' receives 3 times the number of new connections
9
+ # as a server weighted '1'.
10
+ # For more information on load balancing policies, see
11
+ # [How Load Balancing Policies Work](https://docs.us-phoenix-1.oraclecloud.com/Content/Balance/Reference/lbpolicies.htm).
12
+ #
13
+ # Example: `3`
14
+ #
15
+ # @return [Integer]
16
+ attr_accessor :weight
17
+
18
+ # Whether the load balancer should treat this server as a backup unit. If `true`, the load balancer forwards no ingress
19
+ # traffic to this backend server unless all other backend servers not marked as \"backup\" fail the health check policy.
20
+ #
21
+ # Example: `true`
22
+ #
23
+ # @return [BOOLEAN]
24
+ attr_accessor :backup
25
+
26
+ # Whether the load balancer should drain this server. Servers marked \"drain\" receive no new
27
+ # incoming traffic.
28
+ #
29
+ # Example: `true`
30
+ #
31
+ # @return [BOOLEAN]
32
+ attr_accessor :drain
33
+
34
+ # Whether the load balancer should treat this server as offline. Offline servers receive no incoming
35
+ # traffic.
36
+ #
37
+ # Example: `true`
38
+ #
39
+ # @return [BOOLEAN]
40
+ attr_accessor :offline
41
+
42
+
43
+ # Initializes the object
44
+ # @param [Hash] attributes Model attributes in the form of hash
45
+ def initialize(attributes = {})
46
+ return unless attributes.is_a?(Hash)
47
+
48
+ # convert string to symbol for hash key
49
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
50
+
51
+
52
+ if attributes[:'weight']
53
+ self.weight = attributes[:'weight']
54
+ end
55
+
56
+ if attributes[:'backup']
57
+ self.backup = attributes[:'backup']
58
+ else
59
+ self.backup = false
60
+ end
61
+
62
+ if attributes[:'drain']
63
+ self.drain = attributes[:'drain']
64
+ else
65
+ self.drain = false
66
+ end
67
+
68
+ if attributes[:'offline']
69
+ self.offline = attributes[:'offline']
70
+ else
71
+ self.offline = false
72
+ end
73
+
74
+ end
75
+
76
+ # Checks equality by comparing each attribute.
77
+ # @param [Object] other_object to be compared
78
+ def ==(other_object)
79
+ return true if self.equal?(other_object)
80
+ self.class == other_object.class &&
81
+ weight == other_object.weight &&
82
+ backup == other_object.backup &&
83
+ drain == other_object.drain &&
84
+ offline == other_object.offline
85
+ end
86
+
87
+ # @see the `==` method
88
+ # @param [Object] other_object to be compared
89
+ def eql?(other_object)
90
+ self == other_object
91
+ end
92
+
93
+ # Calculates hash code according to all attributes.
94
+ # @return [Fixnum] Hash code
95
+ def hash
96
+ [weight, backup, drain, offline].hash
97
+ end
98
+
99
+ # Builds the object from hash
100
+ # @param [Hash] attributes Model attributes in the form of hash
101
+ # @return [Object] Returns the model itself
102
+ def build_from_hash(attributes)
103
+ return nil unless attributes.is_a?(Hash)
104
+ self.class.swagger_types.each_pair do |key, type|
105
+ if type =~ /^Array<(.*)>/i
106
+ # check to ensure the input is an array given that the the attribute
107
+ # is documented as an array but the input is not
108
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
109
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
110
+ end
111
+ elsif !attributes[self.class.attribute_map[key]].nil?
112
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
113
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
114
+ end
115
+
116
+ self
117
+ end
118
+
119
+ # Returns the string representation of the object
120
+ # @return [String] String presentation of the object
121
+ def to_s
122
+ to_hash.to_s
123
+ end
124
+
125
+ # Returns the object in the form of hash
126
+ # @return [Hash] Returns the object in the form of hash
127
+ def to_hash
128
+ hash = {}
129
+ self.class.attribute_map.each_pair do |attr, param|
130
+ value = self.send(attr)
131
+ next if value.nil?
132
+ hash[param] = _to_hash(value)
133
+ end
134
+ hash
135
+ end
136
+
137
+ private
138
+
139
+ # Outputs non-array value in the form of hash
140
+ # For object, use to_hash. Otherwise, just return the value
141
+ # @param [Object] value Any valid value
142
+ # @return [Hash] Returns the value in the form of hash
143
+ def _to_hash(value)
144
+ if value.is_a?(Array)
145
+ value.compact.map{ |v| _to_hash(v) }
146
+ elsif value.is_a?(Hash)
147
+ {}.tap do |hash|
148
+ value.each { |k, v| hash[k] = _to_hash(v) }
149
+ end
150
+ elsif value.respond_to? :to_hash
151
+ value.to_hash
152
+ else
153
+ value
154
+ end
155
+ end
156
+
157
+ # Deserializes the data based on type
158
+ # @param [String] type Data type
159
+ # @param [String] value Value to be deserialized
160
+ # @return [Object] Deserialized data
161
+ def _deserialize(type, value)
162
+ case type.to_sym
163
+ when :DateTime
164
+ DateTime.parse(value)
165
+ when :Date
166
+ Date.parse(value)
167
+ when :String
168
+ value.to_s
169
+ when :Integer
170
+ value.to_i
171
+ when :Float
172
+ value.to_f
173
+ when :BOOLEAN
174
+ if value.to_s =~ /^(true|t|yes|y|1)$/i
175
+ true
176
+ else
177
+ false
178
+ end
179
+ when :Object
180
+ # generic object (usually a Hash), return directly
181
+ value
182
+ when /\AArray<(?<inner_type>.+)>\z/
183
+ inner_type = Regexp.last_match[:inner_type]
184
+ value.map { |v| _deserialize(inner_type, v) }
185
+ when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
186
+ k_type = Regexp.last_match[:k_type]
187
+ v_type = Regexp.last_match[:v_type]
188
+ {}.tap do |hash|
189
+ value.each do |k, v|
190
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
191
+ end
192
+ end
193
+ else # model
194
+ temp_model = OracleBMC.const_get(type.to_s).new
195
+ temp_model.build_from_hash(value)
196
+ end
197
+ end
198
+
199
+
200
+ # Attribute mapping from ruby-style variable name to JSON key.
201
+ def self.attribute_map
202
+ {
203
+ :'weight' => :'weight',
204
+ :'backup' => :'backup',
205
+ :'drain' => :'drain',
206
+ :'offline' => :'offline'
207
+ }
208
+ end
209
+
210
+ # Attribute type mapping.
211
+ def self.swagger_types
212
+ {
213
+ :'weight' => :'Integer',
214
+ :'backup' => :'BOOLEAN',
215
+ :'drain' => :'BOOLEAN',
216
+ :'offline' => :'BOOLEAN'
217
+ }
218
+ end
219
+ end
220
+ end
@@ -0,0 +1,197 @@
1
+ # Copyright (c) 2016 Oracle and/or its affiliates. All rights reserved.
2
+
3
+ require 'date'
4
+
5
+ module OracleBMC
6
+ class LoadBalancer::Models::UpdateBackendSetDetails
7
+ # The load balancer policy for the backend set. The default load balancing policy is 'ROUND_ROBIN'
8
+ # To get a list of available policies, use the {#list_policies list_policies}
9
+ # operation.
10
+ #
11
+ # Example: `LEAST_CONNECTIONS`
12
+ #
13
+ # @return [String]
14
+ attr_accessor :policy
15
+
16
+ # @return [Array<OracleBMC::LoadBalancer::Models::BackendDetails>]
17
+ attr_accessor :backends
18
+
19
+ # @return [OracleBMC::LoadBalancer::Models::HealthCheckerDetails]
20
+ attr_accessor :health_checker
21
+
22
+ # @return [OracleBMC::LoadBalancer::Models::SSLConfigurationDetails]
23
+ attr_accessor :ssl_configuration
24
+
25
+
26
+ # Initializes the object
27
+ # @param [Hash] attributes Model attributes in the form of hash
28
+ def initialize(attributes = {})
29
+ return unless attributes.is_a?(Hash)
30
+
31
+ # convert string to symbol for hash key
32
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
33
+
34
+
35
+ if attributes[:'policy']
36
+ self.policy = attributes[:'policy']
37
+ end
38
+
39
+ if attributes[:'backends']
40
+ self.backends = attributes[:'backends']
41
+ end
42
+
43
+ if attributes[:'healthChecker']
44
+ self.health_checker = attributes[:'healthChecker']
45
+ end
46
+
47
+ if attributes[:'sslConfiguration']
48
+ self.ssl_configuration = attributes[:'sslConfiguration']
49
+ end
50
+
51
+ end
52
+
53
+ # Checks equality by comparing each attribute.
54
+ # @param [Object] other_object to be compared
55
+ def ==(other_object)
56
+ return true if self.equal?(other_object)
57
+ self.class == other_object.class &&
58
+ policy == other_object.policy &&
59
+ backends == other_object.backends &&
60
+ health_checker == other_object.health_checker &&
61
+ ssl_configuration == other_object.ssl_configuration
62
+ end
63
+
64
+ # @see the `==` method
65
+ # @param [Object] other_object to be compared
66
+ def eql?(other_object)
67
+ self == other_object
68
+ end
69
+
70
+ # Calculates hash code according to all attributes.
71
+ # @return [Fixnum] Hash code
72
+ def hash
73
+ [policy, backends, health_checker, ssl_configuration].hash
74
+ end
75
+
76
+ # Builds the object from hash
77
+ # @param [Hash] attributes Model attributes in the form of hash
78
+ # @return [Object] Returns the model itself
79
+ def build_from_hash(attributes)
80
+ return nil unless attributes.is_a?(Hash)
81
+ self.class.swagger_types.each_pair do |key, type|
82
+ if type =~ /^Array<(.*)>/i
83
+ # check to ensure the input is an array given that the the attribute
84
+ # is documented as an array but the input is not
85
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
86
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
87
+ end
88
+ elsif !attributes[self.class.attribute_map[key]].nil?
89
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
90
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
91
+ end
92
+
93
+ self
94
+ end
95
+
96
+ # Returns the string representation of the object
97
+ # @return [String] String presentation of the object
98
+ def to_s
99
+ to_hash.to_s
100
+ end
101
+
102
+ # Returns the object in the form of hash
103
+ # @return [Hash] Returns the object in the form of hash
104
+ def to_hash
105
+ hash = {}
106
+ self.class.attribute_map.each_pair do |attr, param|
107
+ value = self.send(attr)
108
+ next if value.nil?
109
+ hash[param] = _to_hash(value)
110
+ end
111
+ hash
112
+ end
113
+
114
+ private
115
+
116
+ # Outputs non-array value in the form of hash
117
+ # For object, use to_hash. Otherwise, just return the value
118
+ # @param [Object] value Any valid value
119
+ # @return [Hash] Returns the value in the form of hash
120
+ def _to_hash(value)
121
+ if value.is_a?(Array)
122
+ value.compact.map{ |v| _to_hash(v) }
123
+ elsif value.is_a?(Hash)
124
+ {}.tap do |hash|
125
+ value.each { |k, v| hash[k] = _to_hash(v) }
126
+ end
127
+ elsif value.respond_to? :to_hash
128
+ value.to_hash
129
+ else
130
+ value
131
+ end
132
+ end
133
+
134
+ # Deserializes the data based on type
135
+ # @param [String] type Data type
136
+ # @param [String] value Value to be deserialized
137
+ # @return [Object] Deserialized data
138
+ def _deserialize(type, value)
139
+ case type.to_sym
140
+ when :DateTime
141
+ DateTime.parse(value)
142
+ when :Date
143
+ Date.parse(value)
144
+ when :String
145
+ value.to_s
146
+ when :Integer
147
+ value.to_i
148
+ when :Float
149
+ value.to_f
150
+ when :BOOLEAN
151
+ if value.to_s =~ /^(true|t|yes|y|1)$/i
152
+ true
153
+ else
154
+ false
155
+ end
156
+ when :Object
157
+ # generic object (usually a Hash), return directly
158
+ value
159
+ when /\AArray<(?<inner_type>.+)>\z/
160
+ inner_type = Regexp.last_match[:inner_type]
161
+ value.map { |v| _deserialize(inner_type, v) }
162
+ when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
163
+ k_type = Regexp.last_match[:k_type]
164
+ v_type = Regexp.last_match[:v_type]
165
+ {}.tap do |hash|
166
+ value.each do |k, v|
167
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
168
+ end
169
+ end
170
+ else # model
171
+ temp_model = OracleBMC.const_get(type.to_s).new
172
+ temp_model.build_from_hash(value)
173
+ end
174
+ end
175
+
176
+
177
+ # Attribute mapping from ruby-style variable name to JSON key.
178
+ def self.attribute_map
179
+ {
180
+ :'policy' => :'policy',
181
+ :'backends' => :'backends',
182
+ :'health_checker' => :'healthChecker',
183
+ :'ssl_configuration' => :'sslConfiguration'
184
+ }
185
+ end
186
+
187
+ # Attribute type mapping.
188
+ def self.swagger_types
189
+ {
190
+ :'policy' => :'String',
191
+ :'backends' => :'Array<OracleBMC::LoadBalancer::Models::BackendDetails>',
192
+ :'health_checker' => :'OracleBMC::LoadBalancer::Models::HealthCheckerDetails',
193
+ :'ssl_configuration' => :'OracleBMC::LoadBalancer::Models::SSLConfigurationDetails'
194
+ }
195
+ end
196
+ end
197
+ end