oci 2.0.6 → 2.0.7

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 (93) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +23 -1
  3. data/lib/oci.rb +4 -7
  4. data/lib/oci/api_client.rb +51 -6
  5. data/lib/oci/auth/auth.rb +5 -2
  6. data/lib/oci/auth/federation_client.rb +2 -2
  7. data/lib/oci/auth/internal/auth_token_request_signer.rb +2 -2
  8. data/lib/oci/auth/security_token_container.rb +2 -2
  9. data/lib/oci/auth/session_key_supplier.rb +3 -4
  10. data/lib/oci/auth/signers/instance_principals_security_token_signer.rb +30 -17
  11. data/lib/oci/auth/signers/security_token_signer.rb +13 -6
  12. data/lib/oci/auth/signers/x509_federation_client_based_security_token_signer.rb +8 -4
  13. data/lib/oci/auth/url_based_certificate_retriever.rb +3 -4
  14. data/lib/oci/auth/util.rb +6 -4
  15. data/lib/oci/base_signer.rb +54 -50
  16. data/lib/oci/config_file_loader.rb +3 -11
  17. data/lib/oci/core/blockstorage_client.rb +211 -0
  18. data/lib/oci/core/compute_client.rb +4 -2
  19. data/lib/oci/core/core.rb +9 -0
  20. data/lib/oci/core/models/attach_i_scsi_volume_details.rb +5 -1
  21. data/lib/oci/core/models/attach_volume_details.rb +13 -1
  22. data/lib/oci/core/models/create_public_ip_details.rb +186 -0
  23. data/lib/oci/core/models/create_vnic_details.rb +8 -2
  24. data/lib/oci/core/models/create_volume_backup_details.rb +27 -1
  25. data/lib/oci/core/models/create_volume_backup_policy_assignment_details.rb +133 -0
  26. data/lib/oci/core/models/create_volume_details.rb +15 -1
  27. data/lib/oci/core/models/get_public_ip_by_ip_address_details.rb +125 -0
  28. data/lib/oci/core/models/get_public_ip_by_private_ip_id_details.rb +124 -0
  29. data/lib/oci/core/models/i_scsi_volume_attachment.rb +5 -1
  30. data/lib/oci/core/models/public_ip.rb +328 -0
  31. data/lib/oci/core/models/update_public_ip_details.rb +140 -0
  32. data/lib/oci/core/models/volume_attachment.rb +13 -1
  33. data/lib/oci/core/models/volume_backup.rb +72 -1
  34. data/lib/oci/core/models/volume_backup_policy.rb +161 -0
  35. data/lib/oci/core/models/volume_backup_policy_assignment.rb +159 -0
  36. data/lib/oci/core/models/volume_backup_schedule.rb +191 -0
  37. data/lib/oci/core/virtual_network_client.rb +374 -4
  38. data/lib/oci/database/database_client.rb +3 -1
  39. data/lib/oci/dns/dns.rb +34 -0
  40. data/lib/oci/dns/dns_client.rb +985 -0
  41. data/lib/oci/dns/models/create_zone_details.rb +174 -0
  42. data/lib/oci/dns/models/external_master.rb +145 -0
  43. data/lib/oci/dns/models/patch_domain_records_details.rb +120 -0
  44. data/lib/oci/dns/models/patch_rr_set_details.rb +120 -0
  45. data/lib/oci/dns/models/patch_zone_records_details.rb +120 -0
  46. data/lib/oci/dns/models/record.rb +204 -0
  47. data/lib/oci/dns/models/record_collection.rb +121 -0
  48. data/lib/oci/dns/models/record_details.rb +204 -0
  49. data/lib/oci/dns/models/record_operation.rb +253 -0
  50. data/lib/oci/dns/models/rr_set.rb +123 -0
  51. data/lib/oci/dns/models/sort_order.rb +12 -0
  52. data/lib/oci/dns/models/tsig.rb +149 -0
  53. data/lib/oci/dns/models/update_domain_records_details.rb +120 -0
  54. data/lib/oci/dns/models/update_rr_set_details.rb +120 -0
  55. data/lib/oci/dns/models/update_zone_details.rb +122 -0
  56. data/lib/oci/dns/models/update_zone_records_details.rb +120 -0
  57. data/lib/oci/dns/models/zone.rb +272 -0
  58. data/lib/oci/dns/models/zone_summary.rb +230 -0
  59. data/lib/oci/dns/util.rb +2 -0
  60. data/lib/oci/errors.rb +20 -0
  61. data/lib/oci/identity/identity_client.rb +1 -0
  62. data/lib/oci/identity/models/create_dynamic_group_details.rb +4 -2
  63. data/lib/oci/identity/models/dynamic_group.rb +9 -6
  64. data/lib/oci/identity/models/update_dynamic_group_details.rb +4 -2
  65. data/lib/oci/load_balancer/load_balancer.rb +6 -0
  66. data/lib/oci/load_balancer/load_balancer_client.rb +219 -0
  67. data/lib/oci/load_balancer/models/create_listener_details.rb +17 -1
  68. data/lib/oci/load_balancer/models/create_load_balancer_details.rb +12 -1
  69. data/lib/oci/load_balancer/models/create_path_route_set_details.rb +138 -0
  70. data/lib/oci/load_balancer/models/listener.rb +17 -1
  71. data/lib/oci/load_balancer/models/listener_details.rb +17 -1
  72. data/lib/oci/load_balancer/models/load_balancer.rb +12 -1
  73. data/lib/oci/load_balancer/models/path_match_type.rb +153 -0
  74. data/lib/oci/load_balancer/models/path_route.rb +161 -0
  75. data/lib/oci/load_balancer/models/path_route_set.rb +139 -0
  76. data/lib/oci/load_balancer/models/path_route_set_details.rb +122 -0
  77. data/lib/oci/load_balancer/models/update_listener_details.rb +17 -1
  78. data/lib/oci/load_balancer/models/update_path_route_set_details.rb +122 -0
  79. data/lib/oci/load_balancer/util.rb +1 -3
  80. data/lib/oci/object_storage/transfer/multipart/internal/file_part_io_wrapper.rb +111 -0
  81. data/lib/oci/object_storage/transfer/multipart/internal/multipart_upload_parts_collection.rb +41 -0
  82. data/lib/oci/object_storage/transfer/multipart/internal/seekable_non_file_part_io_wrapper.rb +48 -0
  83. data/lib/oci/object_storage/transfer/multipart/internal/stdin_part_io_wrapper.rb +54 -0
  84. data/lib/oci/object_storage/transfer/multipart/multipart_object_assembler.rb +545 -0
  85. data/lib/oci/object_storage/transfer/transfer.rb +31 -0
  86. data/lib/oci/object_storage/transfer/upload_manager.rb +212 -0
  87. data/lib/oci/object_storage/transfer/upload_manager_config.rb +60 -0
  88. data/lib/oci/regions.rb +3 -1
  89. data/lib/oci/response.rb +1 -3
  90. data/lib/oci/version.rb +1 -1
  91. data/lib/oci/waiter.rb +16 -11
  92. data/lib/oraclebmc.rb +1 -1
  93. metadata +46 -2
@@ -0,0 +1,174 @@
1
+ # Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
2
+
3
+ require 'date'
4
+
5
+ module OCI
6
+ # The body for defining a new zone.
7
+ #
8
+ class Dns::Models::CreateZoneDetails
9
+
10
+ ZONE_TYPE_ENUM = [ZONE_TYPE_PRIMARY = 'PRIMARY',
11
+ ZONE_TYPE_SECONDARY = 'SECONDARY']
12
+
13
+ # **[Required]** The name of the zone.
14
+ # @return [String]
15
+ attr_accessor :name
16
+
17
+ # **[Required]** The type of the zone. Must be either `PRIMARY` or `SECONDARY`.
18
+ #
19
+ # @return [String]
20
+ attr_accessor :zone_type
21
+
22
+ # **[Required]** The OCID of the compartment containing the zone.
23
+ # @return [String]
24
+ attr_accessor :compartment_id
25
+
26
+ # External master servers for the zone.
27
+ # @return [Array<OCI::Dns::Models::ExternalMaster>]
28
+ attr_accessor :external_masters
29
+
30
+
31
+ # Initializes the object
32
+ # @param [Hash] attributes Model attributes in the form of hash
33
+ # @option attributes [String] :name The value to assign to the {#name} property
34
+ # @option attributes [String] :zoneType The value to assign to the {#zone_type} property
35
+ # @option attributes [String] :compartmentId The value to assign to the {#compartment_id} property
36
+ # @option attributes [Array<OCI::Dns::Models::ExternalMaster>] :externalMasters The value to assign to the {#external_masters} property
37
+ def initialize(attributes = {})
38
+ return unless attributes.is_a?(Hash)
39
+
40
+ # convert string to symbol for hash key
41
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
42
+
43
+ if attributes[:'name']
44
+ self.name = attributes[:'name']
45
+ end
46
+
47
+ if attributes[:'zoneType']
48
+ self.zone_type = attributes[:'zoneType']
49
+ end
50
+
51
+ if attributes[:'compartmentId']
52
+ self.compartment_id = attributes[:'compartmentId']
53
+ end
54
+
55
+ if attributes[:'externalMasters']
56
+ self.external_masters = attributes[:'externalMasters']
57
+ end
58
+
59
+ end
60
+
61
+ # Custom attribute writer method checking allowed values (enum).
62
+ # @param [Object] zone_type Object to be assigned
63
+ def zone_type=(zone_type)
64
+ if zone_type && !ZONE_TYPE_ENUM.include?(zone_type)
65
+ fail "Invalid value for 'zone_type': this must be one of the values in ZONE_TYPE_ENUM."
66
+ else
67
+ @zone_type = zone_type
68
+ end
69
+ end
70
+
71
+ # Checks equality by comparing each attribute.
72
+ # @param [Object] other_object to be compared
73
+ def ==(other_object)
74
+ return true if self.equal?(other_object)
75
+ self.class == other_object.class &&
76
+ name == other_object.name &&
77
+ zone_type == other_object.zone_type &&
78
+ compartment_id == other_object.compartment_id &&
79
+ external_masters == other_object.external_masters
80
+ end
81
+
82
+ # @see the `==` method
83
+ # @param [Object] other_object to be compared
84
+ def eql?(other_object)
85
+ self == other_object
86
+ end
87
+
88
+ # Calculates hash code according to all attributes.
89
+ # @return [Fixnum] Hash code
90
+ def hash
91
+ [name, zone_type, compartment_id, external_masters].hash
92
+ end
93
+
94
+ # Builds the object from hash
95
+ # @param [Hash] attributes Model attributes in the form of hash
96
+ # @return [Object] Returns the model itself
97
+ def build_from_hash(attributes)
98
+ return nil unless attributes.is_a?(Hash)
99
+ self.class.swagger_types.each_pair do |key, type|
100
+ if type =~ /^Array<(.*)>/i
101
+ # check to ensure the input is an array given that the the attribute
102
+ # is documented as an array but the input is not
103
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
104
+ self.public_method("#{key}=").call(attributes[self.class.attribute_map[key]].map{ |v| OCI::Internal::Util.convert_to_type($1, v) } )
105
+ end
106
+ elsif !attributes[self.class.attribute_map[key]].nil?
107
+ self.public_method("#{key}=").call(OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]]))
108
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
109
+ end
110
+
111
+ self
112
+ end
113
+
114
+ # Returns the string representation of the object
115
+ # @return [String] String presentation of the object
116
+ def to_s
117
+ to_hash.to_s
118
+ end
119
+
120
+ # Returns the object in the form of hash
121
+ # @return [Hash] Returns the object in the form of hash
122
+ def to_hash
123
+ hash = {}
124
+ self.class.attribute_map.each_pair do |attr, param|
125
+ value = public_method(attr).call
126
+ next if value.nil? && !instance_variable_defined?("@#{attr}")
127
+ hash[param] = _to_hash(value)
128
+ end
129
+ hash
130
+ end
131
+
132
+ private
133
+
134
+ # Outputs non-array value in the form of hash
135
+ # For object, use to_hash. Otherwise, just return the value
136
+ # @param [Object] value Any valid value
137
+ # @return [Hash] Returns the value in the form of hash
138
+ def _to_hash(value)
139
+ if value.is_a?(Array)
140
+ value.compact.map{ |v| _to_hash(v) }
141
+ elsif value.is_a?(Hash)
142
+ {}.tap do |hash|
143
+ value.each { |k, v| hash[k] = _to_hash(v) }
144
+ end
145
+ elsif value.respond_to? :to_hash
146
+ value.to_hash
147
+ else
148
+ value
149
+ end
150
+ end
151
+
152
+
153
+
154
+ # Attribute mapping from ruby-style variable name to JSON key.
155
+ def self.attribute_map
156
+ {
157
+ :'name' => :'name',
158
+ :'zone_type' => :'zoneType',
159
+ :'compartment_id' => :'compartmentId',
160
+ :'external_masters' => :'externalMasters'
161
+ }
162
+ end
163
+
164
+ # Attribute type mapping.
165
+ def self.swagger_types
166
+ {
167
+ :'name' => :'String',
168
+ :'zone_type' => :'String',
169
+ :'compartment_id' => :'String',
170
+ :'external_masters' => :'Array<OCI::Dns::Models::ExternalMaster>'
171
+ }
172
+ end
173
+ end
174
+ end
@@ -0,0 +1,145 @@
1
+ # Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
2
+
3
+ require 'date'
4
+
5
+ module OCI
6
+ # An external master name server used as the source of zone data.
7
+ class Dns::Models::ExternalMaster
8
+ # **[Required]** The server's IP address (IPv4 or IPv6).
9
+ # @return [String]
10
+ attr_accessor :address
11
+
12
+ # The server's port.
13
+ # @return [Integer]
14
+ attr_accessor :port
15
+
16
+ # @return [OCI::Dns::Models::TSIG]
17
+ attr_accessor :tsig
18
+
19
+
20
+ # Initializes the object
21
+ # @param [Hash] attributes Model attributes in the form of hash
22
+ # @option attributes [String] :address The value to assign to the {#address} property
23
+ # @option attributes [Integer] :port The value to assign to the {#port} property
24
+ # @option attributes [OCI::Dns::Models::TSIG] :tsig The value to assign to the {#tsig} property
25
+ def initialize(attributes = {})
26
+ return unless attributes.is_a?(Hash)
27
+
28
+ # convert string to symbol for hash key
29
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
30
+
31
+ if attributes[:'address']
32
+ self.address = attributes[:'address']
33
+ end
34
+
35
+ if attributes[:'port']
36
+ self.port = attributes[:'port']
37
+ end
38
+
39
+ if attributes[:'tsig']
40
+ self.tsig = attributes[:'tsig']
41
+ end
42
+
43
+ end
44
+
45
+ # Checks equality by comparing each attribute.
46
+ # @param [Object] other_object to be compared
47
+ def ==(other_object)
48
+ return true if self.equal?(other_object)
49
+ self.class == other_object.class &&
50
+ address == other_object.address &&
51
+ port == other_object.port &&
52
+ tsig == other_object.tsig
53
+ end
54
+
55
+ # @see the `==` method
56
+ # @param [Object] other_object to be compared
57
+ def eql?(other_object)
58
+ self == other_object
59
+ end
60
+
61
+ # Calculates hash code according to all attributes.
62
+ # @return [Fixnum] Hash code
63
+ def hash
64
+ [address, port, tsig].hash
65
+ end
66
+
67
+ # Builds the object from hash
68
+ # @param [Hash] attributes Model attributes in the form of hash
69
+ # @return [Object] Returns the model itself
70
+ def build_from_hash(attributes)
71
+ return nil unless attributes.is_a?(Hash)
72
+ self.class.swagger_types.each_pair do |key, type|
73
+ if type =~ /^Array<(.*)>/i
74
+ # check to ensure the input is an array given that the the attribute
75
+ # is documented as an array but the input is not
76
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
77
+ self.public_method("#{key}=").call(attributes[self.class.attribute_map[key]].map{ |v| OCI::Internal::Util.convert_to_type($1, v) } )
78
+ end
79
+ elsif !attributes[self.class.attribute_map[key]].nil?
80
+ self.public_method("#{key}=").call(OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]]))
81
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
82
+ end
83
+
84
+ self
85
+ end
86
+
87
+ # Returns the string representation of the object
88
+ # @return [String] String presentation of the object
89
+ def to_s
90
+ to_hash.to_s
91
+ end
92
+
93
+ # Returns the object in the form of hash
94
+ # @return [Hash] Returns the object in the form of hash
95
+ def to_hash
96
+ hash = {}
97
+ self.class.attribute_map.each_pair do |attr, param|
98
+ value = public_method(attr).call
99
+ next if value.nil? && !instance_variable_defined?("@#{attr}")
100
+ hash[param] = _to_hash(value)
101
+ end
102
+ hash
103
+ end
104
+
105
+ private
106
+
107
+ # Outputs non-array value in the form of hash
108
+ # For object, use to_hash. Otherwise, just return the value
109
+ # @param [Object] value Any valid value
110
+ # @return [Hash] Returns the value in the form of hash
111
+ def _to_hash(value)
112
+ if value.is_a?(Array)
113
+ value.compact.map{ |v| _to_hash(v) }
114
+ elsif value.is_a?(Hash)
115
+ {}.tap do |hash|
116
+ value.each { |k, v| hash[k] = _to_hash(v) }
117
+ end
118
+ elsif value.respond_to? :to_hash
119
+ value.to_hash
120
+ else
121
+ value
122
+ end
123
+ end
124
+
125
+
126
+
127
+ # Attribute mapping from ruby-style variable name to JSON key.
128
+ def self.attribute_map
129
+ {
130
+ :'address' => :'address',
131
+ :'port' => :'port',
132
+ :'tsig' => :'tsig'
133
+ }
134
+ end
135
+
136
+ # Attribute type mapping.
137
+ def self.swagger_types
138
+ {
139
+ :'address' => :'String',
140
+ :'port' => :'Integer',
141
+ :'tsig' => :'OCI::Dns::Models::TSIG'
142
+ }
143
+ end
144
+ end
145
+ end
@@ -0,0 +1,120 @@
1
+ # Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
2
+
3
+ require 'date'
4
+
5
+ module OCI
6
+ class Dns::Models::PatchDomainRecordsDetails
7
+ # @return [Array<OCI::Dns::Models::RecordOperation>]
8
+ attr_accessor :items
9
+
10
+
11
+ # Initializes the object
12
+ # @param [Hash] attributes Model attributes in the form of hash
13
+ # @option attributes [Array<OCI::Dns::Models::RecordOperation>] :items The value to assign to the {#items} property
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
+ if attributes[:'items']
21
+ self.items = attributes[:'items']
22
+ end
23
+
24
+ end
25
+
26
+ # Checks equality by comparing each attribute.
27
+ # @param [Object] other_object to be compared
28
+ def ==(other_object)
29
+ return true if self.equal?(other_object)
30
+ self.class == other_object.class &&
31
+ items == other_object.items
32
+ end
33
+
34
+ # @see the `==` method
35
+ # @param [Object] other_object to be compared
36
+ def eql?(other_object)
37
+ self == other_object
38
+ end
39
+
40
+ # Calculates hash code according to all attributes.
41
+ # @return [Fixnum] Hash code
42
+ def hash
43
+ [items].hash
44
+ end
45
+
46
+ # Builds the object from hash
47
+ # @param [Hash] attributes Model attributes in the form of hash
48
+ # @return [Object] Returns the model itself
49
+ def build_from_hash(attributes)
50
+ return nil unless attributes.is_a?(Hash)
51
+ self.class.swagger_types.each_pair do |key, type|
52
+ if type =~ /^Array<(.*)>/i
53
+ # check to ensure the input is an array given that the the attribute
54
+ # is documented as an array but the input is not
55
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
56
+ self.public_method("#{key}=").call(attributes[self.class.attribute_map[key]].map{ |v| OCI::Internal::Util.convert_to_type($1, v) } )
57
+ end
58
+ elsif !attributes[self.class.attribute_map[key]].nil?
59
+ self.public_method("#{key}=").call(OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]]))
60
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
61
+ end
62
+
63
+ self
64
+ end
65
+
66
+ # Returns the string representation of the object
67
+ # @return [String] String presentation of the object
68
+ def to_s
69
+ to_hash.to_s
70
+ end
71
+
72
+ # Returns the object in the form of hash
73
+ # @return [Hash] Returns the object in the form of hash
74
+ def to_hash
75
+ hash = {}
76
+ self.class.attribute_map.each_pair do |attr, param|
77
+ value = public_method(attr).call
78
+ next if value.nil? && !instance_variable_defined?("@#{attr}")
79
+ hash[param] = _to_hash(value)
80
+ end
81
+ hash
82
+ end
83
+
84
+ private
85
+
86
+ # Outputs non-array value in the form of hash
87
+ # For object, use to_hash. Otherwise, just return the value
88
+ # @param [Object] value Any valid value
89
+ # @return [Hash] Returns the value in the form of hash
90
+ def _to_hash(value)
91
+ if value.is_a?(Array)
92
+ value.compact.map{ |v| _to_hash(v) }
93
+ elsif value.is_a?(Hash)
94
+ {}.tap do |hash|
95
+ value.each { |k, v| hash[k] = _to_hash(v) }
96
+ end
97
+ elsif value.respond_to? :to_hash
98
+ value.to_hash
99
+ else
100
+ value
101
+ end
102
+ end
103
+
104
+
105
+
106
+ # Attribute mapping from ruby-style variable name to JSON key.
107
+ def self.attribute_map
108
+ {
109
+ :'items' => :'items'
110
+ }
111
+ end
112
+
113
+ # Attribute type mapping.
114
+ def self.swagger_types
115
+ {
116
+ :'items' => :'Array<OCI::Dns::Models::RecordOperation>'
117
+ }
118
+ end
119
+ end
120
+ end
@@ -0,0 +1,120 @@
1
+ # Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
2
+
3
+ require 'date'
4
+
5
+ module OCI
6
+ class Dns::Models::PatchRRSetDetails
7
+ # @return [Array<OCI::Dns::Models::RecordOperation>]
8
+ attr_accessor :items
9
+
10
+
11
+ # Initializes the object
12
+ # @param [Hash] attributes Model attributes in the form of hash
13
+ # @option attributes [Array<OCI::Dns::Models::RecordOperation>] :items The value to assign to the {#items} property
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
+ if attributes[:'items']
21
+ self.items = attributes[:'items']
22
+ end
23
+
24
+ end
25
+
26
+ # Checks equality by comparing each attribute.
27
+ # @param [Object] other_object to be compared
28
+ def ==(other_object)
29
+ return true if self.equal?(other_object)
30
+ self.class == other_object.class &&
31
+ items == other_object.items
32
+ end
33
+
34
+ # @see the `==` method
35
+ # @param [Object] other_object to be compared
36
+ def eql?(other_object)
37
+ self == other_object
38
+ end
39
+
40
+ # Calculates hash code according to all attributes.
41
+ # @return [Fixnum] Hash code
42
+ def hash
43
+ [items].hash
44
+ end
45
+
46
+ # Builds the object from hash
47
+ # @param [Hash] attributes Model attributes in the form of hash
48
+ # @return [Object] Returns the model itself
49
+ def build_from_hash(attributes)
50
+ return nil unless attributes.is_a?(Hash)
51
+ self.class.swagger_types.each_pair do |key, type|
52
+ if type =~ /^Array<(.*)>/i
53
+ # check to ensure the input is an array given that the the attribute
54
+ # is documented as an array but the input is not
55
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
56
+ self.public_method("#{key}=").call(attributes[self.class.attribute_map[key]].map{ |v| OCI::Internal::Util.convert_to_type($1, v) } )
57
+ end
58
+ elsif !attributes[self.class.attribute_map[key]].nil?
59
+ self.public_method("#{key}=").call(OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]]))
60
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
61
+ end
62
+
63
+ self
64
+ end
65
+
66
+ # Returns the string representation of the object
67
+ # @return [String] String presentation of the object
68
+ def to_s
69
+ to_hash.to_s
70
+ end
71
+
72
+ # Returns the object in the form of hash
73
+ # @return [Hash] Returns the object in the form of hash
74
+ def to_hash
75
+ hash = {}
76
+ self.class.attribute_map.each_pair do |attr, param|
77
+ value = public_method(attr).call
78
+ next if value.nil? && !instance_variable_defined?("@#{attr}")
79
+ hash[param] = _to_hash(value)
80
+ end
81
+ hash
82
+ end
83
+
84
+ private
85
+
86
+ # Outputs non-array value in the form of hash
87
+ # For object, use to_hash. Otherwise, just return the value
88
+ # @param [Object] value Any valid value
89
+ # @return [Hash] Returns the value in the form of hash
90
+ def _to_hash(value)
91
+ if value.is_a?(Array)
92
+ value.compact.map{ |v| _to_hash(v) }
93
+ elsif value.is_a?(Hash)
94
+ {}.tap do |hash|
95
+ value.each { |k, v| hash[k] = _to_hash(v) }
96
+ end
97
+ elsif value.respond_to? :to_hash
98
+ value.to_hash
99
+ else
100
+ value
101
+ end
102
+ end
103
+
104
+
105
+
106
+ # Attribute mapping from ruby-style variable name to JSON key.
107
+ def self.attribute_map
108
+ {
109
+ :'items' => :'items'
110
+ }
111
+ end
112
+
113
+ # Attribute type mapping.
114
+ def self.swagger_types
115
+ {
116
+ :'items' => :'Array<OCI::Dns::Models::RecordOperation>'
117
+ }
118
+ end
119
+ end
120
+ end