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,164 @@
1
+ # Copyright (c) 2016 Oracle and/or its affiliates. All rights reserved.
2
+
3
+ require 'date'
4
+
5
+ module OracleBMC
6
+ class Core::Models::Shape
7
+ # The name of the shape. You can enumerate all available shapes by calling
8
+ # {#list_shapes list_shapes}.
9
+ #
10
+ # @return [String]
11
+ attr_accessor :shape
12
+
13
+
14
+ # Initializes the object
15
+ # @param [Hash] attributes Model attributes in the form of hash
16
+ def initialize(attributes = {})
17
+ return unless attributes.is_a?(Hash)
18
+
19
+ # convert string to symbol for hash key
20
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
21
+
22
+
23
+ if attributes[:'shape']
24
+ self.shape = attributes[:'shape']
25
+ end
26
+
27
+ end
28
+
29
+ # Checks equality by comparing each attribute.
30
+ # @param [Object] other_object to be compared
31
+ def ==(other_object)
32
+ return true if self.equal?(other_object)
33
+ self.class == other_object.class &&
34
+ shape == other_object.shape
35
+ end
36
+
37
+ # @see the `==` method
38
+ # @param [Object] other_object to be compared
39
+ def eql?(other_object)
40
+ self == other_object
41
+ end
42
+
43
+ # Calculates hash code according to all attributes.
44
+ # @return [Fixnum] Hash code
45
+ def hash
46
+ [shape].hash
47
+ end
48
+
49
+ # Builds the object from hash
50
+ # @param [Hash] attributes Model attributes in the form of hash
51
+ # @return [Object] Returns the model itself
52
+ def build_from_hash(attributes)
53
+ return nil unless attributes.is_a?(Hash)
54
+ self.class.swagger_types.each_pair do |key, type|
55
+ if type =~ /^Array<(.*)>/i
56
+ # check to ensure the input is an array given that the the attribute
57
+ # is documented as an array but the input is not
58
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
59
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
60
+ end
61
+ elsif !attributes[self.class.attribute_map[key]].nil?
62
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
63
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
64
+ end
65
+
66
+ self
67
+ end
68
+
69
+ # Returns the string representation of the object
70
+ # @return [String] String presentation of the object
71
+ def to_s
72
+ to_hash.to_s
73
+ end
74
+
75
+ # Returns the object in the form of hash
76
+ # @return [Hash] Returns the object in the form of hash
77
+ def to_hash
78
+ hash = {}
79
+ self.class.attribute_map.each_pair do |attr, param|
80
+ value = self.send(attr)
81
+ next if value.nil?
82
+ hash[param] = _to_hash(value)
83
+ end
84
+ hash
85
+ end
86
+
87
+ private
88
+
89
+ # Outputs non-array value in the form of hash
90
+ # For object, use to_hash. Otherwise, just return the value
91
+ # @param [Object] value Any valid value
92
+ # @return [Hash] Returns the value in the form of hash
93
+ def _to_hash(value)
94
+ if value.is_a?(Array)
95
+ value.compact.map{ |v| _to_hash(v) }
96
+ elsif value.is_a?(Hash)
97
+ {}.tap do |hash|
98
+ value.each { |k, v| hash[k] = _to_hash(v) }
99
+ end
100
+ elsif value.respond_to? :to_hash
101
+ value.to_hash
102
+ else
103
+ value
104
+ end
105
+ end
106
+
107
+ # Deserializes the data based on type
108
+ # @param [String] type Data type
109
+ # @param [String] value Value to be deserialized
110
+ # @return [Object] Deserialized data
111
+ def _deserialize(type, value)
112
+ case type.to_sym
113
+ when :DateTime
114
+ DateTime.parse(value)
115
+ when :Date
116
+ Date.parse(value)
117
+ when :String
118
+ value.to_s
119
+ when :Integer
120
+ value.to_i
121
+ when :Float
122
+ value.to_f
123
+ when :BOOLEAN
124
+ if value.to_s =~ /^(true|t|yes|y|1)$/i
125
+ true
126
+ else
127
+ false
128
+ end
129
+ when :Object
130
+ # generic object (usually a Hash), return directly
131
+ value
132
+ when /\AArray<(?<inner_type>.+)>\z/
133
+ inner_type = Regexp.last_match[:inner_type]
134
+ value.map { |v| _deserialize(inner_type, v) }
135
+ when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
136
+ k_type = Regexp.last_match[:k_type]
137
+ v_type = Regexp.last_match[:v_type]
138
+ {}.tap do |hash|
139
+ value.each do |k, v|
140
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
141
+ end
142
+ end
143
+ else # model
144
+ temp_model = OracleBMC.const_get(type.to_s).new
145
+ temp_model.build_from_hash(value)
146
+ end
147
+ end
148
+
149
+
150
+ # Attribute mapping from ruby-style variable name to JSON key.
151
+ def self.attribute_map
152
+ {
153
+ :'shape' => :'shape'
154
+ }
155
+ end
156
+
157
+ # Attribute type mapping.
158
+ def self.swagger_types
159
+ {
160
+ :'shape' => :'String'
161
+ }
162
+ end
163
+ end
164
+ end
@@ -0,0 +1,325 @@
1
+ # Copyright (c) 2016 Oracle and/or its affiliates. All rights reserved.
2
+
3
+ require 'date'
4
+
5
+ module OracleBMC
6
+ class Core::Models::Subnet
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 subnet's Availability Domain.
14
+ #
15
+ # Example: `Uocm:PHX-AD-1`
16
+ #
17
+ # @return [String]
18
+ attr_accessor :availability_domain
19
+
20
+ # The subnet's CIDR block.
21
+ #
22
+ # Example: `172.16.1.0/24`
23
+ #
24
+ # @return [String]
25
+ attr_accessor :cidr_block
26
+
27
+ # The OCID of the compartment containing the subnet.
28
+ # @return [String]
29
+ attr_accessor :compartment_id
30
+
31
+ # The OCID of the set of DHCP options associated with the subnet.
32
+ #
33
+ # @return [String]
34
+ attr_accessor :dhcp_options_id
35
+
36
+ # A user-friendly name. Does not have to be unique, and it's changeable.
37
+ # @return [String]
38
+ attr_accessor :display_name
39
+
40
+ # The subnet's Oracle ID (OCID).
41
+ # @return [String]
42
+ attr_accessor :id
43
+
44
+ # The subnet's current state.
45
+ # @return [String]
46
+ attr_accessor :lifecycle_state
47
+
48
+ # The OCID of the route table the subnet is using.
49
+ # @return [String]
50
+ attr_accessor :route_table_id
51
+
52
+ # OCIDs for the security lists to use for VNICs in this subnet.
53
+ # @return [Array<String>]
54
+ attr_accessor :security_list_ids
55
+
56
+ # The date and time the subnet was created, in the format defined by RFC3339.
57
+ #
58
+ # Example: `2016-08-25T21:10:29.600Z`
59
+ #
60
+ # @return [DateTime]
61
+ attr_accessor :time_created
62
+
63
+ # The OCID of the VCN the subnet is in.
64
+ # @return [String]
65
+ attr_accessor :vcn_id
66
+
67
+ # The IP address of the virtual router.
68
+ #
69
+ # Example: `10.0.14.1`
70
+ #
71
+ # @return [String]
72
+ attr_accessor :virtual_router_ip
73
+
74
+ # The MAC address of the virtual router.
75
+ #
76
+ # Example: `00:00:17:B6:4D:DD`
77
+ #
78
+ # @return [String]
79
+ attr_accessor :virtual_router_mac
80
+
81
+
82
+ # Initializes the object
83
+ # @param [Hash] attributes Model attributes in the form of hash
84
+ def initialize(attributes = {})
85
+ return unless attributes.is_a?(Hash)
86
+
87
+ # convert string to symbol for hash key
88
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
89
+
90
+
91
+ if attributes[:'availabilityDomain']
92
+ self.availability_domain = attributes[:'availabilityDomain']
93
+ end
94
+
95
+ if attributes[:'cidrBlock']
96
+ self.cidr_block = attributes[:'cidrBlock']
97
+ end
98
+
99
+ if attributes[:'compartmentId']
100
+ self.compartment_id = attributes[:'compartmentId']
101
+ end
102
+
103
+ if attributes[:'dhcpOptionsId']
104
+ self.dhcp_options_id = attributes[:'dhcpOptionsId']
105
+ end
106
+
107
+ if attributes[:'displayName']
108
+ self.display_name = attributes[:'displayName']
109
+ end
110
+
111
+ if attributes[:'id']
112
+ self.id = attributes[:'id']
113
+ end
114
+
115
+ if attributes[:'lifecycleState']
116
+ self.lifecycle_state = attributes[:'lifecycleState']
117
+ end
118
+
119
+ if attributes[:'routeTableId']
120
+ self.route_table_id = attributes[:'routeTableId']
121
+ end
122
+
123
+ if attributes[:'securityListIds']
124
+ self.security_list_ids = attributes[:'securityListIds']
125
+ end
126
+
127
+ if attributes[:'timeCreated']
128
+ self.time_created = attributes[:'timeCreated']
129
+ end
130
+
131
+ if attributes[:'vcnId']
132
+ self.vcn_id = attributes[:'vcnId']
133
+ end
134
+
135
+ if attributes[:'virtualRouterIp']
136
+ self.virtual_router_ip = attributes[:'virtualRouterIp']
137
+ end
138
+
139
+ if attributes[:'virtualRouterMac']
140
+ self.virtual_router_mac = attributes[:'virtualRouterMac']
141
+ end
142
+
143
+ end
144
+
145
+ # Custom attribute writer method checking allowed values (enum).
146
+ # @param [Object] lifecycle_state Object to be assigned
147
+ def lifecycle_state=(lifecycle_state)
148
+ if lifecycle_state && !LIFECYCLE_STATE_ENUM.include?(lifecycle_state)
149
+ fail "Invalid value for 'lifecycle_state': this must be one of the values in LIFECYCLE_STATE_ENUM."
150
+ end
151
+ @lifecycle_state = lifecycle_state
152
+ end
153
+
154
+ # Checks equality by comparing each attribute.
155
+ # @param [Object] other_object to be compared
156
+ def ==(other_object)
157
+ return true if self.equal?(other_object)
158
+ self.class == other_object.class &&
159
+ availability_domain == other_object.availability_domain &&
160
+ cidr_block == other_object.cidr_block &&
161
+ compartment_id == other_object.compartment_id &&
162
+ dhcp_options_id == other_object.dhcp_options_id &&
163
+ display_name == other_object.display_name &&
164
+ id == other_object.id &&
165
+ lifecycle_state == other_object.lifecycle_state &&
166
+ route_table_id == other_object.route_table_id &&
167
+ security_list_ids == other_object.security_list_ids &&
168
+ time_created == other_object.time_created &&
169
+ vcn_id == other_object.vcn_id &&
170
+ virtual_router_ip == other_object.virtual_router_ip &&
171
+ virtual_router_mac == other_object.virtual_router_mac
172
+ end
173
+
174
+ # @see the `==` method
175
+ # @param [Object] other_object to be compared
176
+ def eql?(other_object)
177
+ self == other_object
178
+ end
179
+
180
+ # Calculates hash code according to all attributes.
181
+ # @return [Fixnum] Hash code
182
+ def hash
183
+ [availability_domain, cidr_block, compartment_id, dhcp_options_id, display_name, id, lifecycle_state, route_table_id, security_list_ids, time_created, vcn_id, virtual_router_ip, virtual_router_mac].hash
184
+ end
185
+
186
+ # Builds the object from hash
187
+ # @param [Hash] attributes Model attributes in the form of hash
188
+ # @return [Object] Returns the model itself
189
+ def build_from_hash(attributes)
190
+ return nil unless attributes.is_a?(Hash)
191
+ self.class.swagger_types.each_pair do |key, type|
192
+ if type =~ /^Array<(.*)>/i
193
+ # check to ensure the input is an array given that the the attribute
194
+ # is documented as an array but the input is not
195
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
196
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
197
+ end
198
+ elsif !attributes[self.class.attribute_map[key]].nil?
199
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
200
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
201
+ end
202
+
203
+ self
204
+ end
205
+
206
+ # Returns the string representation of the object
207
+ # @return [String] String presentation of the object
208
+ def to_s
209
+ to_hash.to_s
210
+ end
211
+
212
+ # Returns the object in the form of hash
213
+ # @return [Hash] Returns the object in the form of hash
214
+ def to_hash
215
+ hash = {}
216
+ self.class.attribute_map.each_pair do |attr, param|
217
+ value = self.send(attr)
218
+ next if value.nil?
219
+ hash[param] = _to_hash(value)
220
+ end
221
+ hash
222
+ end
223
+
224
+ private
225
+
226
+ # Outputs non-array value in the form of hash
227
+ # For object, use to_hash. Otherwise, just return the value
228
+ # @param [Object] value Any valid value
229
+ # @return [Hash] Returns the value in the form of hash
230
+ def _to_hash(value)
231
+ if value.is_a?(Array)
232
+ value.compact.map{ |v| _to_hash(v) }
233
+ elsif value.is_a?(Hash)
234
+ {}.tap do |hash|
235
+ value.each { |k, v| hash[k] = _to_hash(v) }
236
+ end
237
+ elsif value.respond_to? :to_hash
238
+ value.to_hash
239
+ else
240
+ value
241
+ end
242
+ end
243
+
244
+ # Deserializes the data based on type
245
+ # @param [String] type Data type
246
+ # @param [String] value Value to be deserialized
247
+ # @return [Object] Deserialized data
248
+ def _deserialize(type, value)
249
+ case type.to_sym
250
+ when :DateTime
251
+ DateTime.parse(value)
252
+ when :Date
253
+ Date.parse(value)
254
+ when :String
255
+ value.to_s
256
+ when :Integer
257
+ value.to_i
258
+ when :Float
259
+ value.to_f
260
+ when :BOOLEAN
261
+ if value.to_s =~ /^(true|t|yes|y|1)$/i
262
+ true
263
+ else
264
+ false
265
+ end
266
+ when :Object
267
+ # generic object (usually a Hash), return directly
268
+ value
269
+ when /\AArray<(?<inner_type>.+)>\z/
270
+ inner_type = Regexp.last_match[:inner_type]
271
+ value.map { |v| _deserialize(inner_type, v) }
272
+ when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
273
+ k_type = Regexp.last_match[:k_type]
274
+ v_type = Regexp.last_match[:v_type]
275
+ {}.tap do |hash|
276
+ value.each do |k, v|
277
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
278
+ end
279
+ end
280
+ else # model
281
+ temp_model = OracleBMC.const_get(type.to_s).new
282
+ temp_model.build_from_hash(value)
283
+ end
284
+ end
285
+
286
+
287
+ # Attribute mapping from ruby-style variable name to JSON key.
288
+ def self.attribute_map
289
+ {
290
+ :'availability_domain' => :'availabilityDomain',
291
+ :'cidr_block' => :'cidrBlock',
292
+ :'compartment_id' => :'compartmentId',
293
+ :'dhcp_options_id' => :'dhcpOptionsId',
294
+ :'display_name' => :'displayName',
295
+ :'id' => :'id',
296
+ :'lifecycle_state' => :'lifecycleState',
297
+ :'route_table_id' => :'routeTableId',
298
+ :'security_list_ids' => :'securityListIds',
299
+ :'time_created' => :'timeCreated',
300
+ :'vcn_id' => :'vcnId',
301
+ :'virtual_router_ip' => :'virtualRouterIp',
302
+ :'virtual_router_mac' => :'virtualRouterMac'
303
+ }
304
+ end
305
+
306
+ # Attribute type mapping.
307
+ def self.swagger_types
308
+ {
309
+ :'availability_domain' => :'String',
310
+ :'cidr_block' => :'String',
311
+ :'compartment_id' => :'String',
312
+ :'dhcp_options_id' => :'String',
313
+ :'display_name' => :'String',
314
+ :'id' => :'String',
315
+ :'lifecycle_state' => :'String',
316
+ :'route_table_id' => :'String',
317
+ :'security_list_ids' => :'Array<String>',
318
+ :'time_created' => :'DateTime',
319
+ :'vcn_id' => :'String',
320
+ :'virtual_router_ip' => :'String',
321
+ :'virtual_router_mac' => :'String'
322
+ }
323
+ end
324
+ end
325
+ 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::TcpOptions
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