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