oci 2.0.9 → 2.1.0

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 (36) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +179 -10
  3. data/lib/oci.rb +1 -0
  4. data/lib/oci/api_client.rb +186 -64
  5. data/lib/oci/api_client_proxy_settings.rb +71 -0
  6. data/lib/oci/audit/audit_client.rb +6 -4
  7. data/lib/oci/auth/signers/instance_principals_security_token_signer.rb +1 -1
  8. data/lib/oci/core/blockstorage_client.rb +18 -4
  9. data/lib/oci/core/compute_client.rb +27 -4
  10. data/lib/oci/core/core.rb +5 -0
  11. data/lib/oci/core/models/connect_remote_peering_connections_details.rb +149 -0
  12. data/lib/oci/core/models/create_remote_peering_connection_details.rb +165 -0
  13. data/lib/oci/core/models/peer_region_for_remote_peering.rb +125 -0
  14. data/lib/oci/core/models/remote_peering_connection.rb +362 -0
  15. data/lib/oci/core/models/update_remote_peering_connection_details.rb +129 -0
  16. data/lib/oci/core/virtual_network_client.rb +334 -4
  17. data/lib/oci/database/database_client.rb +41 -4
  18. data/lib/oci/database/models/db_system.rb +1 -1
  19. data/lib/oci/database/models/db_system_shape_summary.rb +74 -2
  20. data/lib/oci/database/models/db_system_summary.rb +1 -1
  21. data/lib/oci/dns/dns_client.rb +32 -4
  22. data/lib/oci/email/email_client.rb +10 -4
  23. data/lib/oci/errors.rb +115 -19
  24. data/lib/oci/file_storage/file_storage_client.rb +18 -4
  25. data/lib/oci/global_context.rb +2 -2
  26. data/lib/oci/identity/identity_client.rb +68 -4
  27. data/lib/oci/identity/models/create_region_subscription_details.rb +1 -0
  28. data/lib/oci/identity/models/region.rb +2 -0
  29. data/lib/oci/identity/models/region_subscription.rb +2 -0
  30. data/lib/oci/identity/models/tenancy.rb +3 -1
  31. data/lib/oci/internal/util.rb +5 -0
  32. data/lib/oci/load_balancer/load_balancer_client.rb +59 -4
  33. data/lib/oci/object_storage/object_storage_client.rb +62 -4
  34. data/lib/oci/regions.rb +4 -2
  35. data/lib/oci/version.rb +1 -1
  36. metadata +8 -2
@@ -0,0 +1,149 @@
1
+ # Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
2
+
3
+ require 'date'
4
+
5
+ module OCI
6
+ # Information about the other remote peering connection (RPC).
7
+ class Core::Models::ConnectRemotePeeringConnectionsDetails
8
+ # **[Required]** The OCID of the RPC you want to peer with.
9
+ # @return [String]
10
+ attr_accessor :peer_id
11
+
12
+ # **[Required]** The name of the region that contains the RPC you want to peer with.
13
+ #
14
+ # Example: `us-ashburn-1`
15
+ #
16
+ # @return [String]
17
+ attr_accessor :peer_region_name
18
+
19
+
20
+ # Initializes the object
21
+ # @param [Hash] attributes Model attributes in the form of hash
22
+ # @option attributes [String] :peer_id The value to assign to the {#peer_id} property
23
+ # @option attributes [String] :peer_region_name The value to assign to the {#peer_region_name} property
24
+ def initialize(attributes = {})
25
+ return unless attributes.is_a?(Hash)
26
+
27
+ # convert string to symbol for hash key
28
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
29
+
30
+ if attributes[:'peerId']
31
+ self.peer_id = attributes[:'peerId']
32
+ end
33
+
34
+ raise 'You cannot provide both :peerId and :peer_id' if attributes.key?(:'peerId') && attributes.key?(:'peer_id')
35
+
36
+ if attributes[:'peer_id']
37
+ self.peer_id = attributes[:'peer_id']
38
+ end
39
+
40
+ if attributes[:'peerRegionName']
41
+ self.peer_region_name = attributes[:'peerRegionName']
42
+ end
43
+
44
+ raise 'You cannot provide both :peerRegionName and :peer_region_name' if attributes.key?(:'peerRegionName') && attributes.key?(:'peer_region_name')
45
+
46
+ if attributes[:'peer_region_name']
47
+ self.peer_region_name = attributes[:'peer_region_name']
48
+ end
49
+
50
+ end
51
+
52
+ # Checks equality by comparing each attribute.
53
+ # @param [Object] other_object to be compared
54
+ def ==(other_object)
55
+ return true if self.equal?(other_object)
56
+ self.class == other_object.class &&
57
+ peer_id == other_object.peer_id &&
58
+ peer_region_name == other_object.peer_region_name
59
+ end
60
+
61
+ # @see the `==` method
62
+ # @param [Object] other_object to be compared
63
+ def eql?(other_object)
64
+ self == other_object
65
+ end
66
+
67
+ # Calculates hash code according to all attributes.
68
+ # @return [Fixnum] Hash code
69
+ def hash
70
+ [peer_id, peer_region_name].hash
71
+ end
72
+
73
+ # Builds the object from hash
74
+ # @param [Hash] attributes Model attributes in the form of hash
75
+ # @return [Object] Returns the model itself
76
+ def build_from_hash(attributes)
77
+ return nil unless attributes.is_a?(Hash)
78
+ self.class.swagger_types.each_pair do |key, type|
79
+ if type =~ /^Array<(.*)>/i
80
+ # check to ensure the input is an array given that the the attribute
81
+ # is documented as an array but the input is not
82
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
83
+ self.public_method("#{key}=").call(attributes[self.class.attribute_map[key]].map{ |v| OCI::Internal::Util.convert_to_type($1, v) } )
84
+ end
85
+ elsif !attributes[self.class.attribute_map[key]].nil?
86
+ self.public_method("#{key}=").call(OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]]))
87
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
88
+ end
89
+
90
+ self
91
+ end
92
+
93
+ # Returns the string representation of the object
94
+ # @return [String] String presentation of the object
95
+ def to_s
96
+ to_hash.to_s
97
+ end
98
+
99
+ # Returns the object in the form of hash
100
+ # @return [Hash] Returns the object in the form of hash
101
+ def to_hash
102
+ hash = {}
103
+ self.class.attribute_map.each_pair do |attr, param|
104
+ value = public_method(attr).call
105
+ next if value.nil? && !instance_variable_defined?("@#{attr}")
106
+ hash[param] = _to_hash(value)
107
+ end
108
+ hash
109
+ end
110
+
111
+ private
112
+
113
+ # Outputs non-array value in the form of hash
114
+ # For object, use to_hash. Otherwise, just return the value
115
+ # @param [Object] value Any valid value
116
+ # @return [Hash] Returns the value in the form of hash
117
+ def _to_hash(value)
118
+ if value.is_a?(Array)
119
+ value.compact.map{ |v| _to_hash(v) }
120
+ elsif value.is_a?(Hash)
121
+ {}.tap do |hash|
122
+ value.each { |k, v| hash[k] = _to_hash(v) }
123
+ end
124
+ elsif value.respond_to? :to_hash
125
+ value.to_hash
126
+ else
127
+ value
128
+ end
129
+ end
130
+
131
+
132
+
133
+ # Attribute mapping from ruby-style variable name to JSON key.
134
+ def self.attribute_map
135
+ {
136
+ :'peer_id' => :'peerId',
137
+ :'peer_region_name' => :'peerRegionName'
138
+ }
139
+ end
140
+
141
+ # Attribute type mapping.
142
+ def self.swagger_types
143
+ {
144
+ :'peer_id' => :'String',
145
+ :'peer_region_name' => :'String'
146
+ }
147
+ end
148
+ end
149
+ end
@@ -0,0 +1,165 @@
1
+ # Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
2
+
3
+ require 'date'
4
+
5
+ module OCI
6
+ class Core::Models::CreateRemotePeeringConnectionDetails
7
+ # **[Required]** The OCID of the compartment to contain the RPC.
8
+ # @return [String]
9
+ attr_accessor :compartment_id
10
+
11
+ # A user-friendly name. Does not have to be unique, and it's changeable.
12
+ # Avoid entering confidential information.
13
+ #
14
+ # @return [String]
15
+ attr_accessor :display_name
16
+
17
+ # **[Required]** The OCID of the DRG the RPC belongs to.
18
+ # @return [String]
19
+ attr_accessor :drg_id
20
+
21
+
22
+ # Initializes the object
23
+ # @param [Hash] attributes Model attributes in the form of hash
24
+ # @option attributes [String] :compartment_id The value to assign to the {#compartment_id} property
25
+ # @option attributes [String] :display_name The value to assign to the {#display_name} property
26
+ # @option attributes [String] :drg_id The value to assign to the {#drg_id} property
27
+ def initialize(attributes = {})
28
+ return unless attributes.is_a?(Hash)
29
+
30
+ # convert string to symbol for hash key
31
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
32
+
33
+ if attributes[:'compartmentId']
34
+ self.compartment_id = attributes[:'compartmentId']
35
+ end
36
+
37
+ raise 'You cannot provide both :compartmentId and :compartment_id' if attributes.key?(:'compartmentId') && attributes.key?(:'compartment_id')
38
+
39
+ if attributes[:'compartment_id']
40
+ self.compartment_id = attributes[:'compartment_id']
41
+ end
42
+
43
+ if attributes[:'displayName']
44
+ self.display_name = attributes[:'displayName']
45
+ end
46
+
47
+ raise 'You cannot provide both :displayName and :display_name' if attributes.key?(:'displayName') && attributes.key?(:'display_name')
48
+
49
+ if attributes[:'display_name']
50
+ self.display_name = attributes[:'display_name']
51
+ end
52
+
53
+ if attributes[:'drgId']
54
+ self.drg_id = attributes[:'drgId']
55
+ end
56
+
57
+ raise 'You cannot provide both :drgId and :drg_id' if attributes.key?(:'drgId') && attributes.key?(:'drg_id')
58
+
59
+ if attributes[:'drg_id']
60
+ self.drg_id = attributes[:'drg_id']
61
+ end
62
+
63
+ end
64
+
65
+ # Checks equality by comparing each attribute.
66
+ # @param [Object] other_object to be compared
67
+ def ==(other_object)
68
+ return true if self.equal?(other_object)
69
+ self.class == other_object.class &&
70
+ compartment_id == other_object.compartment_id &&
71
+ display_name == other_object.display_name &&
72
+ drg_id == other_object.drg_id
73
+ end
74
+
75
+ # @see the `==` method
76
+ # @param [Object] other_object to be compared
77
+ def eql?(other_object)
78
+ self == other_object
79
+ end
80
+
81
+ # Calculates hash code according to all attributes.
82
+ # @return [Fixnum] Hash code
83
+ def hash
84
+ [compartment_id, display_name, drg_id].hash
85
+ end
86
+
87
+ # Builds the object from hash
88
+ # @param [Hash] attributes Model attributes in the form of hash
89
+ # @return [Object] Returns the model itself
90
+ def build_from_hash(attributes)
91
+ return nil unless attributes.is_a?(Hash)
92
+ self.class.swagger_types.each_pair do |key, type|
93
+ if type =~ /^Array<(.*)>/i
94
+ # check to ensure the input is an array given that the the attribute
95
+ # is documented as an array but the input is not
96
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
97
+ self.public_method("#{key}=").call(attributes[self.class.attribute_map[key]].map{ |v| OCI::Internal::Util.convert_to_type($1, v) } )
98
+ end
99
+ elsif !attributes[self.class.attribute_map[key]].nil?
100
+ self.public_method("#{key}=").call(OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]]))
101
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
102
+ end
103
+
104
+ self
105
+ end
106
+
107
+ # Returns the string representation of the object
108
+ # @return [String] String presentation of the object
109
+ def to_s
110
+ to_hash.to_s
111
+ end
112
+
113
+ # Returns the object in the form of hash
114
+ # @return [Hash] Returns the object in the form of hash
115
+ def to_hash
116
+ hash = {}
117
+ self.class.attribute_map.each_pair do |attr, param|
118
+ value = public_method(attr).call
119
+ next if value.nil? && !instance_variable_defined?("@#{attr}")
120
+ hash[param] = _to_hash(value)
121
+ end
122
+ hash
123
+ end
124
+
125
+ private
126
+
127
+ # Outputs non-array value in the form of hash
128
+ # For object, use to_hash. Otherwise, just return the value
129
+ # @param [Object] value Any valid value
130
+ # @return [Hash] Returns the value in the form of hash
131
+ def _to_hash(value)
132
+ if value.is_a?(Array)
133
+ value.compact.map{ |v| _to_hash(v) }
134
+ elsif value.is_a?(Hash)
135
+ {}.tap do |hash|
136
+ value.each { |k, v| hash[k] = _to_hash(v) }
137
+ end
138
+ elsif value.respond_to? :to_hash
139
+ value.to_hash
140
+ else
141
+ value
142
+ end
143
+ end
144
+
145
+
146
+
147
+ # Attribute mapping from ruby-style variable name to JSON key.
148
+ def self.attribute_map
149
+ {
150
+ :'compartment_id' => :'compartmentId',
151
+ :'display_name' => :'displayName',
152
+ :'drg_id' => :'drgId'
153
+ }
154
+ end
155
+
156
+ # Attribute type mapping.
157
+ def self.swagger_types
158
+ {
159
+ :'compartment_id' => :'String',
160
+ :'display_name' => :'String',
161
+ :'drg_id' => :'String'
162
+ }
163
+ end
164
+ end
165
+ end
@@ -0,0 +1,125 @@
1
+ # Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
2
+
3
+ require 'date'
4
+
5
+ module OCI
6
+ # Details about a region that supports remote VCN peering. For more information, see [VCN Peering](https://docs.us-phoenix-1.oraclecloud.com/Content/Network/Tasks/VCNpeering.htm).
7
+ class Core::Models::PeerRegionForRemotePeering
8
+ # **[Required]** The region's name.
9
+ #
10
+ # Example: `us-phoenix-1`
11
+ #
12
+ # @return [String]
13
+ attr_accessor :name
14
+
15
+
16
+ # Initializes the object
17
+ # @param [Hash] attributes Model attributes in the form of hash
18
+ # @option attributes [String] :name The value to assign to the {#name} property
19
+ def initialize(attributes = {})
20
+ return unless attributes.is_a?(Hash)
21
+
22
+ # convert string to symbol for hash key
23
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
24
+
25
+ if attributes[:'name']
26
+ self.name = attributes[:'name']
27
+ end
28
+
29
+ end
30
+
31
+ # Checks equality by comparing each attribute.
32
+ # @param [Object] other_object to be compared
33
+ def ==(other_object)
34
+ return true if self.equal?(other_object)
35
+ self.class == other_object.class &&
36
+ name == other_object.name
37
+ end
38
+
39
+ # @see the `==` method
40
+ # @param [Object] other_object to be compared
41
+ def eql?(other_object)
42
+ self == other_object
43
+ end
44
+
45
+ # Calculates hash code according to all attributes.
46
+ # @return [Fixnum] Hash code
47
+ def hash
48
+ [name].hash
49
+ end
50
+
51
+ # Builds the object from hash
52
+ # @param [Hash] attributes Model attributes in the form of hash
53
+ # @return [Object] Returns the model itself
54
+ def build_from_hash(attributes)
55
+ return nil unless attributes.is_a?(Hash)
56
+ self.class.swagger_types.each_pair do |key, type|
57
+ if type =~ /^Array<(.*)>/i
58
+ # check to ensure the input is an array given that the the attribute
59
+ # is documented as an array but the input is not
60
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
61
+ self.public_method("#{key}=").call(attributes[self.class.attribute_map[key]].map{ |v| OCI::Internal::Util.convert_to_type($1, v) } )
62
+ end
63
+ elsif !attributes[self.class.attribute_map[key]].nil?
64
+ self.public_method("#{key}=").call(OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]]))
65
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
66
+ end
67
+
68
+ self
69
+ end
70
+
71
+ # Returns the string representation of the object
72
+ # @return [String] String presentation of the object
73
+ def to_s
74
+ to_hash.to_s
75
+ end
76
+
77
+ # Returns the object in the form of hash
78
+ # @return [Hash] Returns the object in the form of hash
79
+ def to_hash
80
+ hash = {}
81
+ self.class.attribute_map.each_pair do |attr, param|
82
+ value = public_method(attr).call
83
+ next if value.nil? && !instance_variable_defined?("@#{attr}")
84
+ hash[param] = _to_hash(value)
85
+ end
86
+ hash
87
+ end
88
+
89
+ private
90
+
91
+ # Outputs non-array value in the form of hash
92
+ # For object, use to_hash. Otherwise, just return the value
93
+ # @param [Object] value Any valid value
94
+ # @return [Hash] Returns the value in the form of hash
95
+ def _to_hash(value)
96
+ if value.is_a?(Array)
97
+ value.compact.map{ |v| _to_hash(v) }
98
+ elsif value.is_a?(Hash)
99
+ {}.tap do |hash|
100
+ value.each { |k, v| hash[k] = _to_hash(v) }
101
+ end
102
+ elsif value.respond_to? :to_hash
103
+ value.to_hash
104
+ else
105
+ value
106
+ end
107
+ end
108
+
109
+
110
+
111
+ # Attribute mapping from ruby-style variable name to JSON key.
112
+ def self.attribute_map
113
+ {
114
+ :'name' => :'name'
115
+ }
116
+ end
117
+
118
+ # Attribute type mapping.
119
+ def self.swagger_types
120
+ {
121
+ :'name' => :'String'
122
+ }
123
+ end
124
+ end
125
+ end
@@ -0,0 +1,362 @@
1
+ # Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
2
+
3
+ require 'date'
4
+
5
+ module OCI
6
+ # A remote peering connection (RPC) is an object on a DRG that lets the VCN that is attached
7
+ # to the DRG peer with a VCN in a different region. *Peering* means that the two VCNs can
8
+ # communicate using private IP addresses, but without the traffic traversing the internet or
9
+ # routing through your on-premises network. For more information, see
10
+ # [VCN Peering](https://docs.us-phoenix-1.oraclecloud.com/Content/Network/Tasks/VCNpeering.htm).
11
+ #
12
+ # To use any of the API operations, you must be authorized in an IAM policy. If you're not authorized,
13
+ # talk to an administrator. If you're an administrator who needs to write policies to give users access, see
14
+ # [Getting Started with Policies](https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/policygetstarted.htm).
15
+ #
16
+ class Core::Models::RemotePeeringConnection
17
+
18
+ LIFECYCLE_STATE_ENUM = [LIFECYCLE_STATE_AVAILABLE = 'AVAILABLE',
19
+ LIFECYCLE_STATE_PROVISIONING = 'PROVISIONING',
20
+ LIFECYCLE_STATE_TERMINATING = 'TERMINATING',
21
+ LIFECYCLE_STATE_TERMINATED = 'TERMINATED',
22
+ LIFECYCLE_STATE_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE']
23
+
24
+
25
+ PEERING_STATUS_ENUM = [PEERING_STATUS_INVALID = 'INVALID',
26
+ PEERING_STATUS_NEW = 'NEW',
27
+ PEERING_STATUS_PENDING = 'PENDING',
28
+ PEERING_STATUS_PEERED = 'PEERED',
29
+ PEERING_STATUS_REVOKED = 'REVOKED',
30
+ PEERING_STATUS_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE']
31
+
32
+ # **[Required]** The OCID of the compartment that contains the RPC.
33
+ # @return [String]
34
+ attr_accessor :compartment_id
35
+
36
+ # **[Required]** A user-friendly name. Does not have to be unique, and it's changeable.
37
+ # Avoid entering confidential information.
38
+ #
39
+ # @return [String]
40
+ attr_accessor :display_name
41
+
42
+ # **[Required]** The OCID of the DRG that this RPC belongs to.
43
+ # @return [String]
44
+ attr_accessor :drg_id
45
+
46
+ # **[Required]** The OCID of the RPC.
47
+ # @return [String]
48
+ attr_accessor :id
49
+
50
+ # **[Required]** Whether the VCN at the other end of the peering is in a different tenancy.
51
+ #
52
+ # Example: `false`
53
+ #
54
+ # @return [BOOLEAN]
55
+ attr_accessor :is_cross_tenancy_peering
56
+
57
+ # **[Required]** The RPC's current lifecycle state.
58
+ # @return [String]
59
+ attr_accessor :lifecycle_state
60
+
61
+ # If this RPC is peered, this value is the OCID of the other RPC.
62
+ #
63
+ # @return [String]
64
+ attr_accessor :peer_id
65
+
66
+ # If this RPC is peered, this value is the region that contains the other RPC.
67
+ #
68
+ # Example: `us-ashburn-1`
69
+ #
70
+ # @return [String]
71
+ attr_accessor :peer_region_name
72
+
73
+ # If this RPC is peered, this value is the OCID of the other RPC's tenancy.
74
+ #
75
+ # @return [String]
76
+ attr_accessor :peer_tenancy_id
77
+
78
+ # **[Required]** Whether the RPC is peered with another RPC. `NEW` means the RPC has not yet been
79
+ # peered. `PENDING` means the peering is being established. `REVOKED` means the
80
+ # RPC at the other end of the peering has been deleted.
81
+ #
82
+ # @return [String]
83
+ attr_accessor :peering_status
84
+
85
+ # **[Required]** The date and time the RPC was created, in the format defined by RFC3339.
86
+ #
87
+ # Example: `2016-08-25T21:10:29.600Z`
88
+ #
89
+ # @return [DateTime]
90
+ attr_accessor :time_created
91
+
92
+
93
+ # Initializes the object
94
+ # @param [Hash] attributes Model attributes in the form of hash
95
+ # @option attributes [String] :compartment_id The value to assign to the {#compartment_id} property
96
+ # @option attributes [String] :display_name The value to assign to the {#display_name} property
97
+ # @option attributes [String] :drg_id The value to assign to the {#drg_id} property
98
+ # @option attributes [String] :id The value to assign to the {#id} property
99
+ # @option attributes [BOOLEAN] :is_cross_tenancy_peering The value to assign to the {#is_cross_tenancy_peering} property
100
+ # @option attributes [String] :lifecycle_state The value to assign to the {#lifecycle_state} property
101
+ # @option attributes [String] :peer_id The value to assign to the {#peer_id} property
102
+ # @option attributes [String] :peer_region_name The value to assign to the {#peer_region_name} property
103
+ # @option attributes [String] :peer_tenancy_id The value to assign to the {#peer_tenancy_id} property
104
+ # @option attributes [String] :peering_status The value to assign to the {#peering_status} property
105
+ # @option attributes [DateTime] :time_created The value to assign to the {#time_created} property
106
+ def initialize(attributes = {})
107
+ return unless attributes.is_a?(Hash)
108
+
109
+ # convert string to symbol for hash key
110
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
111
+
112
+ if attributes[:'compartmentId']
113
+ self.compartment_id = attributes[:'compartmentId']
114
+ end
115
+
116
+ raise 'You cannot provide both :compartmentId and :compartment_id' if attributes.key?(:'compartmentId') && attributes.key?(:'compartment_id')
117
+
118
+ if attributes[:'compartment_id']
119
+ self.compartment_id = attributes[:'compartment_id']
120
+ end
121
+
122
+ if attributes[:'displayName']
123
+ self.display_name = attributes[:'displayName']
124
+ end
125
+
126
+ raise 'You cannot provide both :displayName and :display_name' if attributes.key?(:'displayName') && attributes.key?(:'display_name')
127
+
128
+ if attributes[:'display_name']
129
+ self.display_name = attributes[:'display_name']
130
+ end
131
+
132
+ if attributes[:'drgId']
133
+ self.drg_id = attributes[:'drgId']
134
+ end
135
+
136
+ raise 'You cannot provide both :drgId and :drg_id' if attributes.key?(:'drgId') && attributes.key?(:'drg_id')
137
+
138
+ if attributes[:'drg_id']
139
+ self.drg_id = attributes[:'drg_id']
140
+ end
141
+
142
+ if attributes[:'id']
143
+ self.id = attributes[:'id']
144
+ end
145
+
146
+ unless attributes[:'isCrossTenancyPeering'].nil?
147
+ self.is_cross_tenancy_peering = attributes[:'isCrossTenancyPeering']
148
+ end
149
+
150
+ raise 'You cannot provide both :isCrossTenancyPeering and :is_cross_tenancy_peering' if attributes.key?(:'isCrossTenancyPeering') && attributes.key?(:'is_cross_tenancy_peering')
151
+
152
+ unless attributes[:'is_cross_tenancy_peering'].nil?
153
+ self.is_cross_tenancy_peering = attributes[:'is_cross_tenancy_peering']
154
+ end
155
+
156
+ if attributes[:'lifecycleState']
157
+ self.lifecycle_state = attributes[:'lifecycleState']
158
+ end
159
+
160
+ raise 'You cannot provide both :lifecycleState and :lifecycle_state' if attributes.key?(:'lifecycleState') && attributes.key?(:'lifecycle_state')
161
+
162
+ if attributes[:'lifecycle_state']
163
+ self.lifecycle_state = attributes[:'lifecycle_state']
164
+ end
165
+
166
+ if attributes[:'peerId']
167
+ self.peer_id = attributes[:'peerId']
168
+ end
169
+
170
+ raise 'You cannot provide both :peerId and :peer_id' if attributes.key?(:'peerId') && attributes.key?(:'peer_id')
171
+
172
+ if attributes[:'peer_id']
173
+ self.peer_id = attributes[:'peer_id']
174
+ end
175
+
176
+ if attributes[:'peerRegionName']
177
+ self.peer_region_name = attributes[:'peerRegionName']
178
+ end
179
+
180
+ raise 'You cannot provide both :peerRegionName and :peer_region_name' if attributes.key?(:'peerRegionName') && attributes.key?(:'peer_region_name')
181
+
182
+ if attributes[:'peer_region_name']
183
+ self.peer_region_name = attributes[:'peer_region_name']
184
+ end
185
+
186
+ if attributes[:'peerTenancyId']
187
+ self.peer_tenancy_id = attributes[:'peerTenancyId']
188
+ end
189
+
190
+ raise 'You cannot provide both :peerTenancyId and :peer_tenancy_id' if attributes.key?(:'peerTenancyId') && attributes.key?(:'peer_tenancy_id')
191
+
192
+ if attributes[:'peer_tenancy_id']
193
+ self.peer_tenancy_id = attributes[:'peer_tenancy_id']
194
+ end
195
+
196
+ if attributes[:'peeringStatus']
197
+ self.peering_status = attributes[:'peeringStatus']
198
+ end
199
+
200
+ raise 'You cannot provide both :peeringStatus and :peering_status' if attributes.key?(:'peeringStatus') && attributes.key?(:'peering_status')
201
+
202
+ if attributes[:'peering_status']
203
+ self.peering_status = attributes[:'peering_status']
204
+ end
205
+
206
+ if attributes[:'timeCreated']
207
+ self.time_created = attributes[:'timeCreated']
208
+ end
209
+
210
+ raise 'You cannot provide both :timeCreated and :time_created' if attributes.key?(:'timeCreated') && attributes.key?(:'time_created')
211
+
212
+ if attributes[:'time_created']
213
+ self.time_created = attributes[:'time_created']
214
+ end
215
+
216
+ end
217
+
218
+ # Custom attribute writer method checking allowed values (enum).
219
+ # @param [Object] lifecycle_state Object to be assigned
220
+ def lifecycle_state=(lifecycle_state)
221
+ if lifecycle_state && !LIFECYCLE_STATE_ENUM.include?(lifecycle_state)
222
+ @lifecycle_state = LIFECYCLE_STATE_UNKNOWN_ENUM_VALUE
223
+ else
224
+ @lifecycle_state = lifecycle_state
225
+ end
226
+ end
227
+
228
+ # Custom attribute writer method checking allowed values (enum).
229
+ # @param [Object] peering_status Object to be assigned
230
+ def peering_status=(peering_status)
231
+ if peering_status && !PEERING_STATUS_ENUM.include?(peering_status)
232
+ @peering_status = PEERING_STATUS_UNKNOWN_ENUM_VALUE
233
+ else
234
+ @peering_status = peering_status
235
+ end
236
+ end
237
+
238
+ # Checks equality by comparing each attribute.
239
+ # @param [Object] other_object to be compared
240
+ def ==(other_object)
241
+ return true if self.equal?(other_object)
242
+ self.class == other_object.class &&
243
+ compartment_id == other_object.compartment_id &&
244
+ display_name == other_object.display_name &&
245
+ drg_id == other_object.drg_id &&
246
+ id == other_object.id &&
247
+ is_cross_tenancy_peering == other_object.is_cross_tenancy_peering &&
248
+ lifecycle_state == other_object.lifecycle_state &&
249
+ peer_id == other_object.peer_id &&
250
+ peer_region_name == other_object.peer_region_name &&
251
+ peer_tenancy_id == other_object.peer_tenancy_id &&
252
+ peering_status == other_object.peering_status &&
253
+ time_created == other_object.time_created
254
+ end
255
+
256
+ # @see the `==` method
257
+ # @param [Object] other_object to be compared
258
+ def eql?(other_object)
259
+ self == other_object
260
+ end
261
+
262
+ # Calculates hash code according to all attributes.
263
+ # @return [Fixnum] Hash code
264
+ def hash
265
+ [compartment_id, display_name, drg_id, id, is_cross_tenancy_peering, lifecycle_state, peer_id, peer_region_name, peer_tenancy_id, peering_status, time_created].hash
266
+ end
267
+
268
+ # Builds the object from hash
269
+ # @param [Hash] attributes Model attributes in the form of hash
270
+ # @return [Object] Returns the model itself
271
+ def build_from_hash(attributes)
272
+ return nil unless attributes.is_a?(Hash)
273
+ self.class.swagger_types.each_pair do |key, type|
274
+ if type =~ /^Array<(.*)>/i
275
+ # check to ensure the input is an array given that the the attribute
276
+ # is documented as an array but the input is not
277
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
278
+ self.public_method("#{key}=").call(attributes[self.class.attribute_map[key]].map{ |v| OCI::Internal::Util.convert_to_type($1, v) } )
279
+ end
280
+ elsif !attributes[self.class.attribute_map[key]].nil?
281
+ self.public_method("#{key}=").call(OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]]))
282
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
283
+ end
284
+
285
+ self
286
+ end
287
+
288
+ # Returns the string representation of the object
289
+ # @return [String] String presentation of the object
290
+ def to_s
291
+ to_hash.to_s
292
+ end
293
+
294
+ # Returns the object in the form of hash
295
+ # @return [Hash] Returns the object in the form of hash
296
+ def to_hash
297
+ hash = {}
298
+ self.class.attribute_map.each_pair do |attr, param|
299
+ value = public_method(attr).call
300
+ next if value.nil? && !instance_variable_defined?("@#{attr}")
301
+ hash[param] = _to_hash(value)
302
+ end
303
+ hash
304
+ end
305
+
306
+ private
307
+
308
+ # Outputs non-array value in the form of hash
309
+ # For object, use to_hash. Otherwise, just return the value
310
+ # @param [Object] value Any valid value
311
+ # @return [Hash] Returns the value in the form of hash
312
+ def _to_hash(value)
313
+ if value.is_a?(Array)
314
+ value.compact.map{ |v| _to_hash(v) }
315
+ elsif value.is_a?(Hash)
316
+ {}.tap do |hash|
317
+ value.each { |k, v| hash[k] = _to_hash(v) }
318
+ end
319
+ elsif value.respond_to? :to_hash
320
+ value.to_hash
321
+ else
322
+ value
323
+ end
324
+ end
325
+
326
+
327
+
328
+ # Attribute mapping from ruby-style variable name to JSON key.
329
+ def self.attribute_map
330
+ {
331
+ :'compartment_id' => :'compartmentId',
332
+ :'display_name' => :'displayName',
333
+ :'drg_id' => :'drgId',
334
+ :'id' => :'id',
335
+ :'is_cross_tenancy_peering' => :'isCrossTenancyPeering',
336
+ :'lifecycle_state' => :'lifecycleState',
337
+ :'peer_id' => :'peerId',
338
+ :'peer_region_name' => :'peerRegionName',
339
+ :'peer_tenancy_id' => :'peerTenancyId',
340
+ :'peering_status' => :'peeringStatus',
341
+ :'time_created' => :'timeCreated'
342
+ }
343
+ end
344
+
345
+ # Attribute type mapping.
346
+ def self.swagger_types
347
+ {
348
+ :'compartment_id' => :'String',
349
+ :'display_name' => :'String',
350
+ :'drg_id' => :'String',
351
+ :'id' => :'String',
352
+ :'is_cross_tenancy_peering' => :'BOOLEAN',
353
+ :'lifecycle_state' => :'String',
354
+ :'peer_id' => :'String',
355
+ :'peer_region_name' => :'String',
356
+ :'peer_tenancy_id' => :'String',
357
+ :'peering_status' => :'String',
358
+ :'time_created' => :'DateTime'
359
+ }
360
+ end
361
+ end
362
+ end