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,193 @@
1
+ # Copyright (c) 2016 Oracle and/or its affiliates. All rights reserved.
2
+
3
+ require 'date'
4
+
5
+ module OracleBMC
6
+ class Core::Models::TunnelConfig
7
+ # The IP address of Oracle's VPN headend.
8
+ #
9
+ # Example: `129.146.17.50`
10
+ #
11
+ # @return [String]
12
+ attr_accessor :ip_address
13
+
14
+ # The shared secret of the IPSec tunnel.
15
+ #
16
+ # Example: `vFG2IF6TWq4UToUiLSRDoJEUs6j1c.p8G.dVQxiMfMO0yXMLi.lZTbYIWhGu4V8o`
17
+ #
18
+ # @return [String]
19
+ attr_accessor :shared_secret
20
+
21
+ # The date and time the IPSec connection was created, in the format defined by RFC3339.
22
+ #
23
+ # Example: `2016-08-25T21:10:29.600Z`
24
+ #
25
+ # @return [DateTime]
26
+ attr_accessor :time_created
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[:'ipAddress']
39
+ self.ip_address = attributes[:'ipAddress']
40
+ end
41
+
42
+ if attributes[:'sharedSecret']
43
+ self.shared_secret = attributes[:'sharedSecret']
44
+ end
45
+
46
+ if attributes[:'timeCreated']
47
+ self.time_created = attributes[:'timeCreated']
48
+ end
49
+
50
+ end
51
+
52
+ # Checks equality by comparing each attribute.
53
+ # @param [Object] other_object to be compared
54
+ def ==(other_object)
55
+ return true if self.equal?(other_object)
56
+ self.class == other_object.class &&
57
+ ip_address == other_object.ip_address &&
58
+ shared_secret == other_object.shared_secret &&
59
+ time_created == other_object.time_created
60
+ end
61
+
62
+ # @see the `==` method
63
+ # @param [Object] other_object to be compared
64
+ def eql?(other_object)
65
+ self == other_object
66
+ end
67
+
68
+ # Calculates hash code according to all attributes.
69
+ # @return [Fixnum] Hash code
70
+ def hash
71
+ [ip_address, shared_secret, time_created].hash
72
+ end
73
+
74
+ # Builds the object from hash
75
+ # @param [Hash] attributes Model attributes in the form of hash
76
+ # @return [Object] Returns the model itself
77
+ def build_from_hash(attributes)
78
+ return nil unless attributes.is_a?(Hash)
79
+ self.class.swagger_types.each_pair do |key, type|
80
+ if type =~ /^Array<(.*)>/i
81
+ # check to ensure the input is an array given that the the attribute
82
+ # is documented as an array but the input is not
83
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
84
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
85
+ end
86
+ elsif !attributes[self.class.attribute_map[key]].nil?
87
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
88
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
89
+ end
90
+
91
+ self
92
+ end
93
+
94
+ # Returns the string representation of the object
95
+ # @return [String] String presentation of the object
96
+ def to_s
97
+ to_hash.to_s
98
+ end
99
+
100
+ # Returns the object in the form of hash
101
+ # @return [Hash] Returns the object in the form of hash
102
+ def to_hash
103
+ hash = {}
104
+ self.class.attribute_map.each_pair do |attr, param|
105
+ value = self.send(attr)
106
+ next if value.nil?
107
+ hash[param] = _to_hash(value)
108
+ end
109
+ hash
110
+ end
111
+
112
+ private
113
+
114
+ # Outputs non-array value in the form of hash
115
+ # For object, use to_hash. Otherwise, just return the value
116
+ # @param [Object] value Any valid value
117
+ # @return [Hash] Returns the value in the form of hash
118
+ def _to_hash(value)
119
+ if value.is_a?(Array)
120
+ value.compact.map{ |v| _to_hash(v) }
121
+ elsif value.is_a?(Hash)
122
+ {}.tap do |hash|
123
+ value.each { |k, v| hash[k] = _to_hash(v) }
124
+ end
125
+ elsif value.respond_to? :to_hash
126
+ value.to_hash
127
+ else
128
+ value
129
+ end
130
+ end
131
+
132
+ # Deserializes the data based on type
133
+ # @param [String] type Data type
134
+ # @param [String] value Value to be deserialized
135
+ # @return [Object] Deserialized data
136
+ def _deserialize(type, value)
137
+ case type.to_sym
138
+ when :DateTime
139
+ DateTime.parse(value)
140
+ when :Date
141
+ Date.parse(value)
142
+ when :String
143
+ value.to_s
144
+ when :Integer
145
+ value.to_i
146
+ when :Float
147
+ value.to_f
148
+ when :BOOLEAN
149
+ if value.to_s =~ /^(true|t|yes|y|1)$/i
150
+ true
151
+ else
152
+ false
153
+ end
154
+ when :Object
155
+ # generic object (usually a Hash), return directly
156
+ value
157
+ when /\AArray<(?<inner_type>.+)>\z/
158
+ inner_type = Regexp.last_match[:inner_type]
159
+ value.map { |v| _deserialize(inner_type, v) }
160
+ when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
161
+ k_type = Regexp.last_match[:k_type]
162
+ v_type = Regexp.last_match[:v_type]
163
+ {}.tap do |hash|
164
+ value.each do |k, v|
165
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
166
+ end
167
+ end
168
+ else # model
169
+ temp_model = OracleBMC.const_get(type.to_s).new
170
+ temp_model.build_from_hash(value)
171
+ end
172
+ end
173
+
174
+
175
+ # Attribute mapping from ruby-style variable name to JSON key.
176
+ def self.attribute_map
177
+ {
178
+ :'ip_address' => :'ipAddress',
179
+ :'shared_secret' => :'sharedSecret',
180
+ :'time_created' => :'timeCreated'
181
+ }
182
+ end
183
+
184
+ # Attribute type mapping.
185
+ def self.swagger_types
186
+ {
187
+ :'ip_address' => :'String',
188
+ :'shared_secret' => :'String',
189
+ :'time_created' => :'DateTime'
190
+ }
191
+ end
192
+ end
193
+ end
@@ -0,0 +1,218 @@
1
+ # Copyright (c) 2016 Oracle and/or its affiliates. All rights reserved.
2
+
3
+ require 'date'
4
+
5
+ module OracleBMC
6
+ class Core::Models::TunnelStatus
7
+
8
+ LIFECYCLE_STATE_ENUM = [LIFECYCLE_STATE_UP = 'UP',
9
+ LIFECYCLE_STATE_DOWN = 'DOWN',
10
+ LIFECYCLE_STATE_DOWN_FOR_MAINTENANCE = 'DOWN_FOR_MAINTENANCE']
11
+
12
+ # The IP address of Oracle's VPN headend.
13
+ #
14
+ # Example: `129.146.17.50`
15
+ #
16
+ # @return [String]
17
+ attr_accessor :ip_address
18
+
19
+ # The tunnel's current state.
20
+ # @return [String]
21
+ attr_accessor :lifecycle_state
22
+
23
+ # The date and time the IPSec connection was created, in the format defined by RFC3339.
24
+ #
25
+ # Example: `2016-08-25T21:10:29.600Z`
26
+ #
27
+ # @return [DateTime]
28
+ attr_accessor :time_created
29
+
30
+ # When the state of the tunnel last changed, in the format defined by RFC3339.
31
+ #
32
+ # Example: `2016-08-25T21:10:29.600Z`
33
+ #
34
+ # @return [DateTime]
35
+ attr_accessor :time_state_modified
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[:'ipAddress']
48
+ self.ip_address = attributes[:'ipAddress']
49
+ end
50
+
51
+ if attributes[:'lifecycleState']
52
+ self.lifecycle_state = attributes[:'lifecycleState']
53
+ end
54
+
55
+ if attributes[:'timeCreated']
56
+ self.time_created = attributes[:'timeCreated']
57
+ end
58
+
59
+ if attributes[:'timeStateModified']
60
+ self.time_state_modified = attributes[:'timeStateModified']
61
+ end
62
+
63
+ end
64
+
65
+ # Custom attribute writer method checking allowed values (enum).
66
+ # @param [Object] lifecycle_state Object to be assigned
67
+ def lifecycle_state=(lifecycle_state)
68
+ if lifecycle_state && !LIFECYCLE_STATE_ENUM.include?(lifecycle_state)
69
+ fail "Invalid value for 'lifecycle_state': this must be one of the values in LIFECYCLE_STATE_ENUM."
70
+ end
71
+ @lifecycle_state = lifecycle_state
72
+ end
73
+
74
+ # Checks equality by comparing each attribute.
75
+ # @param [Object] other_object to be compared
76
+ def ==(other_object)
77
+ return true if self.equal?(other_object)
78
+ self.class == other_object.class &&
79
+ ip_address == other_object.ip_address &&
80
+ lifecycle_state == other_object.lifecycle_state &&
81
+ time_created == other_object.time_created &&
82
+ time_state_modified == other_object.time_state_modified
83
+ end
84
+
85
+ # @see the `==` method
86
+ # @param [Object] other_object to be compared
87
+ def eql?(other_object)
88
+ self == other_object
89
+ end
90
+
91
+ # Calculates hash code according to all attributes.
92
+ # @return [Fixnum] Hash code
93
+ def hash
94
+ [ip_address, lifecycle_state, time_created, time_state_modified].hash
95
+ end
96
+
97
+ # Builds the object from hash
98
+ # @param [Hash] attributes Model attributes in the form of hash
99
+ # @return [Object] Returns the model itself
100
+ def build_from_hash(attributes)
101
+ return nil unless attributes.is_a?(Hash)
102
+ self.class.swagger_types.each_pair do |key, type|
103
+ if type =~ /^Array<(.*)>/i
104
+ # check to ensure the input is an array given that the the attribute
105
+ # is documented as an array but the input is not
106
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
107
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
108
+ end
109
+ elsif !attributes[self.class.attribute_map[key]].nil?
110
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
111
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
112
+ end
113
+
114
+ self
115
+ end
116
+
117
+ # Returns the string representation of the object
118
+ # @return [String] String presentation of the object
119
+ def to_s
120
+ to_hash.to_s
121
+ end
122
+
123
+ # Returns the object in the form of hash
124
+ # @return [Hash] Returns the object in the form of hash
125
+ def to_hash
126
+ hash = {}
127
+ self.class.attribute_map.each_pair do |attr, param|
128
+ value = self.send(attr)
129
+ next if value.nil?
130
+ hash[param] = _to_hash(value)
131
+ end
132
+ hash
133
+ end
134
+
135
+ private
136
+
137
+ # Outputs non-array value in the form of hash
138
+ # For object, use to_hash. Otherwise, just return the value
139
+ # @param [Object] value Any valid value
140
+ # @return [Hash] Returns the value in the form of hash
141
+ def _to_hash(value)
142
+ if value.is_a?(Array)
143
+ value.compact.map{ |v| _to_hash(v) }
144
+ elsif value.is_a?(Hash)
145
+ {}.tap do |hash|
146
+ value.each { |k, v| hash[k] = _to_hash(v) }
147
+ end
148
+ elsif value.respond_to? :to_hash
149
+ value.to_hash
150
+ else
151
+ value
152
+ end
153
+ end
154
+
155
+ # Deserializes the data based on type
156
+ # @param [String] type Data type
157
+ # @param [String] value Value to be deserialized
158
+ # @return [Object] Deserialized data
159
+ def _deserialize(type, value)
160
+ case type.to_sym
161
+ when :DateTime
162
+ DateTime.parse(value)
163
+ when :Date
164
+ Date.parse(value)
165
+ when :String
166
+ value.to_s
167
+ when :Integer
168
+ value.to_i
169
+ when :Float
170
+ value.to_f
171
+ when :BOOLEAN
172
+ if value.to_s =~ /^(true|t|yes|y|1)$/i
173
+ true
174
+ else
175
+ false
176
+ end
177
+ when :Object
178
+ # generic object (usually a Hash), return directly
179
+ value
180
+ when /\AArray<(?<inner_type>.+)>\z/
181
+ inner_type = Regexp.last_match[:inner_type]
182
+ value.map { |v| _deserialize(inner_type, v) }
183
+ when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
184
+ k_type = Regexp.last_match[:k_type]
185
+ v_type = Regexp.last_match[:v_type]
186
+ {}.tap do |hash|
187
+ value.each do |k, v|
188
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
189
+ end
190
+ end
191
+ else # model
192
+ temp_model = OracleBMC.const_get(type.to_s).new
193
+ temp_model.build_from_hash(value)
194
+ end
195
+ end
196
+
197
+
198
+ # Attribute mapping from ruby-style variable name to JSON key.
199
+ def self.attribute_map
200
+ {
201
+ :'ip_address' => :'ipAddress',
202
+ :'lifecycle_state' => :'lifecycleState',
203
+ :'time_created' => :'timeCreated',
204
+ :'time_state_modified' => :'timeStateModified'
205
+ }
206
+ end
207
+
208
+ # Attribute type mapping.
209
+ def self.swagger_types
210
+ {
211
+ :'ip_address' => :'String',
212
+ :'lifecycle_state' => :'String',
213
+ :'time_created' => :'DateTime',
214
+ :'time_state_modified' => :'DateTime'
215
+ }
216
+ end
217
+ end
218
+ end
@@ -0,0 +1,177 @@
1
+ # Copyright (c) 2016 Oracle and/or its affiliates. All rights reserved.
2
+
3
+ require 'date'
4
+
5
+ module OracleBMC
6
+ class Core::Models::UdpOptions
7
+ # An inclusive range of allowed destination ports. Use the same number for the min and max
8
+ # to indicate a single port. Defaults to all ports if not specified.
9
+ #
10
+ # @return [OracleBMC::Core::Models::PortRange]
11
+ attr_accessor :destination_port_range
12
+
13
+ # An inclusive range of allowed source ports. Use the same number for the min and max to
14
+ # indicate a single port. Defaults to all ports if not specified.
15
+ #
16
+ # @return [OracleBMC::Core::Models::PortRange]
17
+ attr_accessor :source_port_range
18
+
19
+
20
+ # Initializes the object
21
+ # @param [Hash] attributes Model attributes in the form of hash
22
+ def initialize(attributes = {})
23
+ return unless attributes.is_a?(Hash)
24
+
25
+ # convert string to symbol for hash key
26
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
27
+
28
+
29
+ if attributes[:'destinationPortRange']
30
+ self.destination_port_range = attributes[:'destinationPortRange']
31
+ end
32
+
33
+ if attributes[:'sourcePortRange']
34
+ self.source_port_range = attributes[:'sourcePortRange']
35
+ end
36
+
37
+ end
38
+
39
+ # Checks equality by comparing each attribute.
40
+ # @param [Object] other_object to be compared
41
+ def ==(other_object)
42
+ return true if self.equal?(other_object)
43
+ self.class == other_object.class &&
44
+ destination_port_range == other_object.destination_port_range &&
45
+ source_port_range == other_object.source_port_range
46
+ end
47
+
48
+ # @see the `==` method
49
+ # @param [Object] other_object to be compared
50
+ def eql?(other_object)
51
+ self == other_object
52
+ end
53
+
54
+ # Calculates hash code according to all attributes.
55
+ # @return [Fixnum] Hash code
56
+ def hash
57
+ [destination_port_range, source_port_range].hash
58
+ end
59
+
60
+ # Builds the object from hash
61
+ # @param [Hash] attributes Model attributes in the form of hash
62
+ # @return [Object] Returns the model itself
63
+ def build_from_hash(attributes)
64
+ return nil unless attributes.is_a?(Hash)
65
+ self.class.swagger_types.each_pair do |key, type|
66
+ if type =~ /^Array<(.*)>/i
67
+ # check to ensure the input is an array given that the the attribute
68
+ # is documented as an array but the input is not
69
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
70
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
71
+ end
72
+ elsif !attributes[self.class.attribute_map[key]].nil?
73
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
74
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
75
+ end
76
+
77
+ self
78
+ end
79
+
80
+ # Returns the string representation of the object
81
+ # @return [String] String presentation of the object
82
+ def to_s
83
+ to_hash.to_s
84
+ end
85
+
86
+ # Returns the object in the form of hash
87
+ # @return [Hash] Returns the object in the form of hash
88
+ def to_hash
89
+ hash = {}
90
+ self.class.attribute_map.each_pair do |attr, param|
91
+ value = self.send(attr)
92
+ next if value.nil?
93
+ hash[param] = _to_hash(value)
94
+ end
95
+ hash
96
+ end
97
+
98
+ private
99
+
100
+ # Outputs non-array value in the form of hash
101
+ # For object, use to_hash. Otherwise, just return the value
102
+ # @param [Object] value Any valid value
103
+ # @return [Hash] Returns the value in the form of hash
104
+ def _to_hash(value)
105
+ if value.is_a?(Array)
106
+ value.compact.map{ |v| _to_hash(v) }
107
+ elsif value.is_a?(Hash)
108
+ {}.tap do |hash|
109
+ value.each { |k, v| hash[k] = _to_hash(v) }
110
+ end
111
+ elsif value.respond_to? :to_hash
112
+ value.to_hash
113
+ else
114
+ value
115
+ end
116
+ end
117
+
118
+ # Deserializes the data based on type
119
+ # @param [String] type Data type
120
+ # @param [String] value Value to be deserialized
121
+ # @return [Object] Deserialized data
122
+ def _deserialize(type, value)
123
+ case type.to_sym
124
+ when :DateTime
125
+ DateTime.parse(value)
126
+ when :Date
127
+ Date.parse(value)
128
+ when :String
129
+ value.to_s
130
+ when :Integer
131
+ value.to_i
132
+ when :Float
133
+ value.to_f
134
+ when :BOOLEAN
135
+ if value.to_s =~ /^(true|t|yes|y|1)$/i
136
+ true
137
+ else
138
+ false
139
+ end
140
+ when :Object
141
+ # generic object (usually a Hash), return directly
142
+ value
143
+ when /\AArray<(?<inner_type>.+)>\z/
144
+ inner_type = Regexp.last_match[:inner_type]
145
+ value.map { |v| _deserialize(inner_type, v) }
146
+ when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
147
+ k_type = Regexp.last_match[:k_type]
148
+ v_type = Regexp.last_match[:v_type]
149
+ {}.tap do |hash|
150
+ value.each do |k, v|
151
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
152
+ end
153
+ end
154
+ else # model
155
+ temp_model = OracleBMC.const_get(type.to_s).new
156
+ temp_model.build_from_hash(value)
157
+ end
158
+ end
159
+
160
+
161
+ # Attribute mapping from ruby-style variable name to JSON key.
162
+ def self.attribute_map
163
+ {
164
+ :'destination_port_range' => :'destinationPortRange',
165
+ :'source_port_range' => :'sourcePortRange'
166
+ }
167
+ end
168
+
169
+ # Attribute type mapping.
170
+ def self.swagger_types
171
+ {
172
+ :'destination_port_range' => :'OracleBMC::Core::Models::PortRange',
173
+ :'source_port_range' => :'OracleBMC::Core::Models::PortRange'
174
+ }
175
+ end
176
+ end
177
+ end