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,224 @@
1
+ # Copyright (c) 2016 Oracle and/or its affiliates. All rights reserved.
2
+
3
+ require 'date'
4
+
5
+ module OracleBMC
6
+ class Core::Models::Drg
7
+
8
+ LIFECYCLE_STATE_ENUM = [LIFECYCLE_STATE_PROVISIONING = 'PROVISIONING',
9
+ LIFECYCLE_STATE_AVAILABLE = 'AVAILABLE',
10
+ LIFECYCLE_STATE_TERMINATING = 'TERMINATING',
11
+ LIFECYCLE_STATE_TERMINATED = 'TERMINATED']
12
+
13
+ # The OCID of the compartment containing the DRG.
14
+ # @return [String]
15
+ attr_accessor :compartment_id
16
+
17
+ # A user-friendly name. Does not have to be unique, and it's changeable.
18
+ # @return [String]
19
+ attr_accessor :display_name
20
+
21
+ # The DRG's Oracle ID (OCID).
22
+ # @return [String]
23
+ attr_accessor :id
24
+
25
+ # The DRG's current state.
26
+ # @return [String]
27
+ attr_accessor :lifecycle_state
28
+
29
+ # The date and time the DRG was created, in the format defined by RFC3339.
30
+ #
31
+ # Example: `2016-08-25T21:10:29.600Z`
32
+ #
33
+ # @return [DateTime]
34
+ attr_accessor :time_created
35
+
36
+
37
+ # Initializes the object
38
+ # @param [Hash] attributes Model attributes in the form of hash
39
+ def initialize(attributes = {})
40
+ return unless attributes.is_a?(Hash)
41
+
42
+ # convert string to symbol for hash key
43
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
44
+
45
+
46
+ if attributes[:'compartmentId']
47
+ self.compartment_id = attributes[:'compartmentId']
48
+ end
49
+
50
+ if attributes[:'displayName']
51
+ self.display_name = attributes[:'displayName']
52
+ end
53
+
54
+ if attributes[:'id']
55
+ self.id = attributes[:'id']
56
+ end
57
+
58
+ if attributes[:'lifecycleState']
59
+ self.lifecycle_state = attributes[:'lifecycleState']
60
+ end
61
+
62
+ if attributes[:'timeCreated']
63
+ self.time_created = attributes[:'timeCreated']
64
+ end
65
+
66
+ end
67
+
68
+ # Custom attribute writer method checking allowed values (enum).
69
+ # @param [Object] lifecycle_state Object to be assigned
70
+ def lifecycle_state=(lifecycle_state)
71
+ if lifecycle_state && !LIFECYCLE_STATE_ENUM.include?(lifecycle_state)
72
+ fail "Invalid value for 'lifecycle_state': this must be one of the values in LIFECYCLE_STATE_ENUM."
73
+ end
74
+ @lifecycle_state = lifecycle_state
75
+ end
76
+
77
+ # Checks equality by comparing each attribute.
78
+ # @param [Object] other_object to be compared
79
+ def ==(other_object)
80
+ return true if self.equal?(other_object)
81
+ self.class == other_object.class &&
82
+ compartment_id == other_object.compartment_id &&
83
+ display_name == other_object.display_name &&
84
+ id == other_object.id &&
85
+ lifecycle_state == other_object.lifecycle_state &&
86
+ time_created == other_object.time_created
87
+ end
88
+
89
+ # @see the `==` method
90
+ # @param [Object] other_object to be compared
91
+ def eql?(other_object)
92
+ self == other_object
93
+ end
94
+
95
+ # Calculates hash code according to all attributes.
96
+ # @return [Fixnum] Hash code
97
+ def hash
98
+ [compartment_id, display_name, id, lifecycle_state, time_created].hash
99
+ end
100
+
101
+ # Builds the object from hash
102
+ # @param [Hash] attributes Model attributes in the form of hash
103
+ # @return [Object] Returns the model itself
104
+ def build_from_hash(attributes)
105
+ return nil unless attributes.is_a?(Hash)
106
+ self.class.swagger_types.each_pair do |key, type|
107
+ if type =~ /^Array<(.*)>/i
108
+ # check to ensure the input is an array given that the the attribute
109
+ # is documented as an array but the input is not
110
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
111
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
112
+ end
113
+ elsif !attributes[self.class.attribute_map[key]].nil?
114
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
115
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
116
+ end
117
+
118
+ self
119
+ end
120
+
121
+ # Returns the string representation of the object
122
+ # @return [String] String presentation of the object
123
+ def to_s
124
+ to_hash.to_s
125
+ end
126
+
127
+ # Returns the object in the form of hash
128
+ # @return [Hash] Returns the object in the form of hash
129
+ def to_hash
130
+ hash = {}
131
+ self.class.attribute_map.each_pair do |attr, param|
132
+ value = self.send(attr)
133
+ next if value.nil?
134
+ hash[param] = _to_hash(value)
135
+ end
136
+ hash
137
+ end
138
+
139
+ private
140
+
141
+ # Outputs non-array value in the form of hash
142
+ # For object, use to_hash. Otherwise, just return the value
143
+ # @param [Object] value Any valid value
144
+ # @return [Hash] Returns the value in the form of hash
145
+ def _to_hash(value)
146
+ if value.is_a?(Array)
147
+ value.compact.map{ |v| _to_hash(v) }
148
+ elsif value.is_a?(Hash)
149
+ {}.tap do |hash|
150
+ value.each { |k, v| hash[k] = _to_hash(v) }
151
+ end
152
+ elsif value.respond_to? :to_hash
153
+ value.to_hash
154
+ else
155
+ value
156
+ end
157
+ end
158
+
159
+ # Deserializes the data based on type
160
+ # @param [String] type Data type
161
+ # @param [String] value Value to be deserialized
162
+ # @return [Object] Deserialized data
163
+ def _deserialize(type, value)
164
+ case type.to_sym
165
+ when :DateTime
166
+ DateTime.parse(value)
167
+ when :Date
168
+ Date.parse(value)
169
+ when :String
170
+ value.to_s
171
+ when :Integer
172
+ value.to_i
173
+ when :Float
174
+ value.to_f
175
+ when :BOOLEAN
176
+ if value.to_s =~ /^(true|t|yes|y|1)$/i
177
+ true
178
+ else
179
+ false
180
+ end
181
+ when :Object
182
+ # generic object (usually a Hash), return directly
183
+ value
184
+ when /\AArray<(?<inner_type>.+)>\z/
185
+ inner_type = Regexp.last_match[:inner_type]
186
+ value.map { |v| _deserialize(inner_type, v) }
187
+ when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
188
+ k_type = Regexp.last_match[:k_type]
189
+ v_type = Regexp.last_match[:v_type]
190
+ {}.tap do |hash|
191
+ value.each do |k, v|
192
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
193
+ end
194
+ end
195
+ else # model
196
+ temp_model = OracleBMC.const_get(type.to_s).new
197
+ temp_model.build_from_hash(value)
198
+ end
199
+ end
200
+
201
+
202
+ # Attribute mapping from ruby-style variable name to JSON key.
203
+ def self.attribute_map
204
+ {
205
+ :'compartment_id' => :'compartmentId',
206
+ :'display_name' => :'displayName',
207
+ :'id' => :'id',
208
+ :'lifecycle_state' => :'lifecycleState',
209
+ :'time_created' => :'timeCreated'
210
+ }
211
+ end
212
+
213
+ # Attribute type mapping.
214
+ def self.swagger_types
215
+ {
216
+ :'compartment_id' => :'String',
217
+ :'display_name' => :'String',
218
+ :'id' => :'String',
219
+ :'lifecycle_state' => :'String',
220
+ :'time_created' => :'DateTime'
221
+ }
222
+ end
223
+ end
224
+ end
@@ -0,0 +1,246 @@
1
+ # Copyright (c) 2016 Oracle and/or its affiliates. All rights reserved.
2
+
3
+ require 'date'
4
+
5
+ module OracleBMC
6
+ class Core::Models::DrgAttachment
7
+
8
+ LIFECYCLE_STATE_ENUM = [LIFECYCLE_STATE_ATTACHING = 'ATTACHING',
9
+ LIFECYCLE_STATE_ATTACHED = 'ATTACHED',
10
+ LIFECYCLE_STATE_DETACHING = 'DETACHING',
11
+ LIFECYCLE_STATE_DETACHED = 'DETACHED']
12
+
13
+ # The OCID of the compartment containing the DRG attachment.
14
+ # @return [String]
15
+ attr_accessor :compartment_id
16
+
17
+ # A user-friendly name. Does not have to be unique, and it's changeable.
18
+ # @return [String]
19
+ attr_accessor :display_name
20
+
21
+ # The OCID of the DRG.
22
+ # @return [String]
23
+ attr_accessor :drg_id
24
+
25
+ # The DRG attachment's Oracle ID (OCID).
26
+ # @return [String]
27
+ attr_accessor :id
28
+
29
+ # The DRG attachment's current state.
30
+ # @return [String]
31
+ attr_accessor :lifecycle_state
32
+
33
+ # The date and time the DRG attachment was created, in the format defined by RFC3339.
34
+ #
35
+ # Example: `2016-08-25T21:10:29.600Z`
36
+ #
37
+ # @return [DateTime]
38
+ attr_accessor :time_created
39
+
40
+ # The OCID of the VCN.
41
+ # @return [String]
42
+ attr_accessor :vcn_id
43
+
44
+
45
+ # Initializes the object
46
+ # @param [Hash] attributes Model attributes in the form of hash
47
+ def initialize(attributes = {})
48
+ return unless attributes.is_a?(Hash)
49
+
50
+ # convert string to symbol for hash key
51
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
52
+
53
+
54
+ if attributes[:'compartmentId']
55
+ self.compartment_id = attributes[:'compartmentId']
56
+ end
57
+
58
+ if attributes[:'displayName']
59
+ self.display_name = attributes[:'displayName']
60
+ end
61
+
62
+ if attributes[:'drgId']
63
+ self.drg_id = attributes[:'drgId']
64
+ end
65
+
66
+ if attributes[:'id']
67
+ self.id = attributes[:'id']
68
+ end
69
+
70
+ if attributes[:'lifecycleState']
71
+ self.lifecycle_state = attributes[:'lifecycleState']
72
+ end
73
+
74
+ if attributes[:'timeCreated']
75
+ self.time_created = attributes[:'timeCreated']
76
+ end
77
+
78
+ if attributes[:'vcnId']
79
+ self.vcn_id = attributes[:'vcnId']
80
+ end
81
+
82
+ end
83
+
84
+ # Custom attribute writer method checking allowed values (enum).
85
+ # @param [Object] lifecycle_state Object to be assigned
86
+ def lifecycle_state=(lifecycle_state)
87
+ if lifecycle_state && !LIFECYCLE_STATE_ENUM.include?(lifecycle_state)
88
+ fail "Invalid value for 'lifecycle_state': this must be one of the values in LIFECYCLE_STATE_ENUM."
89
+ end
90
+ @lifecycle_state = lifecycle_state
91
+ end
92
+
93
+ # Checks equality by comparing each attribute.
94
+ # @param [Object] other_object to be compared
95
+ def ==(other_object)
96
+ return true if self.equal?(other_object)
97
+ self.class == other_object.class &&
98
+ compartment_id == other_object.compartment_id &&
99
+ display_name == other_object.display_name &&
100
+ drg_id == other_object.drg_id &&
101
+ id == other_object.id &&
102
+ lifecycle_state == other_object.lifecycle_state &&
103
+ time_created == other_object.time_created &&
104
+ vcn_id == other_object.vcn_id
105
+ end
106
+
107
+ # @see the `==` method
108
+ # @param [Object] other_object to be compared
109
+ def eql?(other_object)
110
+ self == other_object
111
+ end
112
+
113
+ # Calculates hash code according to all attributes.
114
+ # @return [Fixnum] Hash code
115
+ def hash
116
+ [compartment_id, display_name, drg_id, id, lifecycle_state, time_created, vcn_id].hash
117
+ end
118
+
119
+ # Builds the object from hash
120
+ # @param [Hash] attributes Model attributes in the form of hash
121
+ # @return [Object] Returns the model itself
122
+ def build_from_hash(attributes)
123
+ return nil unless attributes.is_a?(Hash)
124
+ self.class.swagger_types.each_pair do |key, type|
125
+ if type =~ /^Array<(.*)>/i
126
+ # check to ensure the input is an array given that the the attribute
127
+ # is documented as an array but the input is not
128
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
129
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
130
+ end
131
+ elsif !attributes[self.class.attribute_map[key]].nil?
132
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
133
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
134
+ end
135
+
136
+ self
137
+ end
138
+
139
+ # Returns the string representation of the object
140
+ # @return [String] String presentation of the object
141
+ def to_s
142
+ to_hash.to_s
143
+ end
144
+
145
+ # Returns the object in the form of hash
146
+ # @return [Hash] Returns the object in the form of hash
147
+ def to_hash
148
+ hash = {}
149
+ self.class.attribute_map.each_pair do |attr, param|
150
+ value = self.send(attr)
151
+ next if value.nil?
152
+ hash[param] = _to_hash(value)
153
+ end
154
+ hash
155
+ end
156
+
157
+ private
158
+
159
+ # Outputs non-array value in the form of hash
160
+ # For object, use to_hash. Otherwise, just return the value
161
+ # @param [Object] value Any valid value
162
+ # @return [Hash] Returns the value in the form of hash
163
+ def _to_hash(value)
164
+ if value.is_a?(Array)
165
+ value.compact.map{ |v| _to_hash(v) }
166
+ elsif value.is_a?(Hash)
167
+ {}.tap do |hash|
168
+ value.each { |k, v| hash[k] = _to_hash(v) }
169
+ end
170
+ elsif value.respond_to? :to_hash
171
+ value.to_hash
172
+ else
173
+ value
174
+ end
175
+ end
176
+
177
+ # Deserializes the data based on type
178
+ # @param [String] type Data type
179
+ # @param [String] value Value to be deserialized
180
+ # @return [Object] Deserialized data
181
+ def _deserialize(type, value)
182
+ case type.to_sym
183
+ when :DateTime
184
+ DateTime.parse(value)
185
+ when :Date
186
+ Date.parse(value)
187
+ when :String
188
+ value.to_s
189
+ when :Integer
190
+ value.to_i
191
+ when :Float
192
+ value.to_f
193
+ when :BOOLEAN
194
+ if value.to_s =~ /^(true|t|yes|y|1)$/i
195
+ true
196
+ else
197
+ false
198
+ end
199
+ when :Object
200
+ # generic object (usually a Hash), return directly
201
+ value
202
+ when /\AArray<(?<inner_type>.+)>\z/
203
+ inner_type = Regexp.last_match[:inner_type]
204
+ value.map { |v| _deserialize(inner_type, v) }
205
+ when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
206
+ k_type = Regexp.last_match[:k_type]
207
+ v_type = Regexp.last_match[:v_type]
208
+ {}.tap do |hash|
209
+ value.each do |k, v|
210
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
211
+ end
212
+ end
213
+ else # model
214
+ temp_model = OracleBMC.const_get(type.to_s).new
215
+ temp_model.build_from_hash(value)
216
+ end
217
+ end
218
+
219
+
220
+ # Attribute mapping from ruby-style variable name to JSON key.
221
+ def self.attribute_map
222
+ {
223
+ :'compartment_id' => :'compartmentId',
224
+ :'display_name' => :'displayName',
225
+ :'drg_id' => :'drgId',
226
+ :'id' => :'id',
227
+ :'lifecycle_state' => :'lifecycleState',
228
+ :'time_created' => :'timeCreated',
229
+ :'vcn_id' => :'vcnId'
230
+ }
231
+ end
232
+
233
+ # Attribute type mapping.
234
+ def self.swagger_types
235
+ {
236
+ :'compartment_id' => :'String',
237
+ :'display_name' => :'String',
238
+ :'drg_id' => :'String',
239
+ :'id' => :'String',
240
+ :'lifecycle_state' => :'String',
241
+ :'time_created' => :'DateTime',
242
+ :'vcn_id' => :'String'
243
+ }
244
+ end
245
+ end
246
+ end
@@ -0,0 +1,240 @@
1
+ # Copyright (c) 2016 Oracle and/or its affiliates. All rights reserved.
2
+
3
+ require 'date'
4
+
5
+ module OracleBMC
6
+ class Core::Models::EgressSecurityRule
7
+ # The destination CIDR block for the egress rule. This is the range of IP addresses that a
8
+ # packet originating from the instance can go to.
9
+ #
10
+ # @return [String]
11
+ attr_accessor :destination
12
+
13
+ # Optional and valid only for ICMP. Use to specify a particular ICMP type and code
14
+ # as defined in
15
+ # [ICMP Parameters](http://www.iana.org/assignments/icmp-parameters/icmp-parameters.xhtml).
16
+ # If you specify ICMP as the protocol but omit this object, then all ICMP types and
17
+ # codes are allowed. If you do provide this object, the type is required and the code is optional.
18
+ # To enable MTU negotiation for ingress internet traffic, make sure to allow type 3 (\"Destination
19
+ # Unreachable\") code 4 (\"Fragmentation Needed and Don't Fragment was Set\"). If you need to specify
20
+ # multiple codes for a single type, create a separate security list rule for each.
21
+ #
22
+ # @return [OracleBMC::Core::Models::IcmpOptions]
23
+ attr_accessor :icmp_options
24
+
25
+ # A stateless rule allows traffic in one direction. Remember to add a corresponding
26
+ # stateless rule in the other direction if you need to support bidirectional traffic. For
27
+ # example, if egress traffic allows TCP destination port 80, there should be an ingress
28
+ # rule to allow TCP source port 80. Defaults to false, which means the rule is stateful
29
+ # and a corresponding rule is not necessary for bidirectional traffic.
30
+ #
31
+ # @return [BOOLEAN]
32
+ attr_accessor :is_stateless
33
+
34
+ # The transport protocol. Specify either `all` or an IPv4 protocol number as
35
+ # defined in
36
+ # [Protocol Numbers](http://www.iana.org/assignments/protocol-numbers/protocol-numbers.xhtml).
37
+ # Options are supported only for ICMP (\"1\"), TCP (\"6\"), and UDP (\"17\").
38
+ #
39
+ # @return [String]
40
+ attr_accessor :protocol
41
+
42
+ # Optional and valid only for TCP. Use to specify particular destination ports for TCP rules.
43
+ # If you specify TCP as the protocol but omit this object, then all destination ports are allowed.
44
+ #
45
+ # @return [OracleBMC::Core::Models::TcpOptions]
46
+ attr_accessor :tcp_options
47
+
48
+ # Optional and valid only for UDP. Use to specify particular destination ports for UDP rules.
49
+ # If you specify UDP as the protocol but omit this object, then all destination ports are allowed.
50
+ #
51
+ # @return [OracleBMC::Core::Models::UdpOptions]
52
+ attr_accessor :udp_options
53
+
54
+
55
+ # Initializes the object
56
+ # @param [Hash] attributes Model attributes in the form of hash
57
+ def initialize(attributes = {})
58
+ return unless attributes.is_a?(Hash)
59
+
60
+ # convert string to symbol for hash key
61
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
62
+
63
+
64
+ if attributes[:'destination']
65
+ self.destination = attributes[:'destination']
66
+ end
67
+
68
+ if attributes[:'icmpOptions']
69
+ self.icmp_options = attributes[:'icmpOptions']
70
+ end
71
+
72
+ if attributes[:'isStateless']
73
+ self.is_stateless = attributes[:'isStateless']
74
+ end
75
+
76
+ if attributes[:'protocol']
77
+ self.protocol = attributes[:'protocol']
78
+ end
79
+
80
+ if attributes[:'tcpOptions']
81
+ self.tcp_options = attributes[:'tcpOptions']
82
+ end
83
+
84
+ if attributes[:'udpOptions']
85
+ self.udp_options = attributes[:'udpOptions']
86
+ end
87
+
88
+ end
89
+
90
+ # Checks equality by comparing each attribute.
91
+ # @param [Object] other_object to be compared
92
+ def ==(other_object)
93
+ return true if self.equal?(other_object)
94
+ self.class == other_object.class &&
95
+ destination == other_object.destination &&
96
+ icmp_options == other_object.icmp_options &&
97
+ is_stateless == other_object.is_stateless &&
98
+ protocol == other_object.protocol &&
99
+ tcp_options == other_object.tcp_options &&
100
+ udp_options == other_object.udp_options
101
+ end
102
+
103
+ # @see the `==` method
104
+ # @param [Object] other_object to be compared
105
+ def eql?(other_object)
106
+ self == other_object
107
+ end
108
+
109
+ # Calculates hash code according to all attributes.
110
+ # @return [Fixnum] Hash code
111
+ def hash
112
+ [destination, icmp_options, is_stateless, protocol, tcp_options, udp_options].hash
113
+ end
114
+
115
+ # Builds the object from hash
116
+ # @param [Hash] attributes Model attributes in the form of hash
117
+ # @return [Object] Returns the model itself
118
+ def build_from_hash(attributes)
119
+ return nil unless attributes.is_a?(Hash)
120
+ self.class.swagger_types.each_pair do |key, type|
121
+ if type =~ /^Array<(.*)>/i
122
+ # check to ensure the input is an array given that the the attribute
123
+ # is documented as an array but the input is not
124
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
125
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
126
+ end
127
+ elsif !attributes[self.class.attribute_map[key]].nil?
128
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
129
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
130
+ end
131
+
132
+ self
133
+ end
134
+
135
+ # Returns the string representation of the object
136
+ # @return [String] String presentation of the object
137
+ def to_s
138
+ to_hash.to_s
139
+ end
140
+
141
+ # Returns the object in the form of hash
142
+ # @return [Hash] Returns the object in the form of hash
143
+ def to_hash
144
+ hash = {}
145
+ self.class.attribute_map.each_pair do |attr, param|
146
+ value = self.send(attr)
147
+ next if value.nil?
148
+ hash[param] = _to_hash(value)
149
+ end
150
+ hash
151
+ end
152
+
153
+ private
154
+
155
+ # Outputs non-array value in the form of hash
156
+ # For object, use to_hash. Otherwise, just return the value
157
+ # @param [Object] value Any valid value
158
+ # @return [Hash] Returns the value in the form of hash
159
+ def _to_hash(value)
160
+ if value.is_a?(Array)
161
+ value.compact.map{ |v| _to_hash(v) }
162
+ elsif value.is_a?(Hash)
163
+ {}.tap do |hash|
164
+ value.each { |k, v| hash[k] = _to_hash(v) }
165
+ end
166
+ elsif value.respond_to? :to_hash
167
+ value.to_hash
168
+ else
169
+ value
170
+ end
171
+ end
172
+
173
+ # Deserializes the data based on type
174
+ # @param [String] type Data type
175
+ # @param [String] value Value to be deserialized
176
+ # @return [Object] Deserialized data
177
+ def _deserialize(type, value)
178
+ case type.to_sym
179
+ when :DateTime
180
+ DateTime.parse(value)
181
+ when :Date
182
+ Date.parse(value)
183
+ when :String
184
+ value.to_s
185
+ when :Integer
186
+ value.to_i
187
+ when :Float
188
+ value.to_f
189
+ when :BOOLEAN
190
+ if value.to_s =~ /^(true|t|yes|y|1)$/i
191
+ true
192
+ else
193
+ false
194
+ end
195
+ when :Object
196
+ # generic object (usually a Hash), return directly
197
+ value
198
+ when /\AArray<(?<inner_type>.+)>\z/
199
+ inner_type = Regexp.last_match[:inner_type]
200
+ value.map { |v| _deserialize(inner_type, v) }
201
+ when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
202
+ k_type = Regexp.last_match[:k_type]
203
+ v_type = Regexp.last_match[:v_type]
204
+ {}.tap do |hash|
205
+ value.each do |k, v|
206
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
207
+ end
208
+ end
209
+ else # model
210
+ temp_model = OracleBMC.const_get(type.to_s).new
211
+ temp_model.build_from_hash(value)
212
+ end
213
+ end
214
+
215
+
216
+ # Attribute mapping from ruby-style variable name to JSON key.
217
+ def self.attribute_map
218
+ {
219
+ :'destination' => :'destination',
220
+ :'icmp_options' => :'icmpOptions',
221
+ :'is_stateless' => :'isStateless',
222
+ :'protocol' => :'protocol',
223
+ :'tcp_options' => :'tcpOptions',
224
+ :'udp_options' => :'udpOptions'
225
+ }
226
+ end
227
+
228
+ # Attribute type mapping.
229
+ def self.swagger_types
230
+ {
231
+ :'destination' => :'String',
232
+ :'icmp_options' => :'OracleBMC::Core::Models::IcmpOptions',
233
+ :'is_stateless' => :'BOOLEAN',
234
+ :'protocol' => :'String',
235
+ :'tcp_options' => :'OracleBMC::Core::Models::TcpOptions',
236
+ :'udp_options' => :'OracleBMC::Core::Models::UdpOptions'
237
+ }
238
+ end
239
+ end
240
+ end