oci 2.3.0 → 2.3.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 (32) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/lib/oci/core/blockstorage_client.rb +412 -13
  4. data/lib/oci/core/blockstorage_client_composite_operations.rb +158 -0
  5. data/lib/oci/core/compute_client.rb +6 -7
  6. data/lib/oci/core/core.rb +13 -0
  7. data/lib/oci/core/models/boot_volume.rb +68 -1
  8. data/lib/oci/core/models/boot_volume_backup.rb +435 -0
  9. data/lib/oci/core/models/boot_volume_source_details.rb +163 -0
  10. data/lib/oci/core/models/boot_volume_source_from_boot_volume_backup_details.rb +154 -0
  11. data/lib/oci/core/models/boot_volume_source_from_boot_volume_details.rb +154 -0
  12. data/lib/oci/core/models/create_boot_volume_backup_details.rb +227 -0
  13. data/lib/oci/core/models/create_boot_volume_details.rb +250 -0
  14. data/lib/oci/core/models/create_service_gateway_details.rb +228 -0
  15. data/lib/oci/core/models/egress_security_rule.rb +44 -3
  16. data/lib/oci/core/models/ingress_security_rule.rb +47 -3
  17. data/lib/oci/core/models/instance_source_via_image_details.rb +0 -1
  18. data/lib/oci/core/models/route_rule.rb +59 -2
  19. data/lib/oci/core/models/service.rb +185 -0
  20. data/lib/oci/core/models/service_gateway.rb +325 -0
  21. data/lib/oci/core/models/service_id_request_details.rb +151 -0
  22. data/lib/oci/core/models/service_id_response_details.rb +165 -0
  23. data/lib/oci/core/models/update_boot_volume_backup_details.rb +189 -0
  24. data/lib/oci/core/models/update_boot_volume_details.rb +41 -4
  25. data/lib/oci/core/models/update_service_gateway_details.rb +225 -0
  26. data/lib/oci/core/models/volume_group.rb +21 -7
  27. data/lib/oci/core/models/volume_group_backup.rb +39 -7
  28. data/lib/oci/core/models/volume_group_source_from_volumes_details.rb +1 -1
  29. data/lib/oci/core/virtual_network_client.rb +582 -1
  30. data/lib/oci/core/virtual_network_client_composite_operations.rb +119 -0
  31. data/lib/oci/version.rb +1 -1
  32. metadata +15 -2
@@ -8,7 +8,6 @@ module OCI
8
8
  # InstanceSourceViaImageDetails model.
9
9
  class Core::Models::InstanceSourceViaImageDetails < Core::Models::InstanceSourceDetails # rubocop:disable Metrics/LineLength
10
10
  # The size of the boot volume in GBs. Minimum value is 50 GB and maximum value is 16384 GB (16TB).
11
- #
12
11
  # @return [Integer]
13
12
  attr_accessor :boot_volume_size_in_gbs
14
13
 
@@ -1,6 +1,7 @@
1
1
  # Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
2
2
 
3
3
  require 'date'
4
+ require 'logger'
4
5
 
5
6
  # rubocop:disable Lint/UnneededCopDisableDirective
6
7
  module OCI
@@ -8,7 +9,14 @@ module OCI
8
9
  # packets to (a target).
9
10
  #
10
11
  class Core::Models::RouteRule # rubocop:disable Metrics/LineLength
11
- # **[Required]** A destination IP address range in CIDR notation. Matching packets will
12
+ DESTINATION_TYPE_ENUM = [
13
+ DESTINATION_TYPE_CIDR_BLOCK = 'CIDR_BLOCK'.freeze,
14
+ DESTINATION_TYPE_SERVICE_CIDR_BLOCK = 'SERVICE_CIDR_BLOCK'.freeze,
15
+ DESTINATION_TYPE_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
16
+ ].freeze
17
+
18
+ # **[Required]** Deprecated, Destination and DestinationType should be used instead; request including both fields will be rejected.
19
+ # A destination IP address range in CIDR notation. Matching packets will
12
20
  # be routed to the indicated network entity (the target).
13
21
  #
14
22
  # Example: `0.0.0.0/0`
@@ -16,6 +24,22 @@ module OCI
16
24
  # @return [String]
17
25
  attr_accessor :cidr_block
18
26
 
27
+ # The destination service cidrBlock or destination IP address range in CIDR notation. Matching packets will
28
+ # be routed to the indicated network entity (the target).
29
+ #
30
+ # Examples: `10.12.0.0/16`
31
+ # `oci-phx-objectstorage`
32
+ #
33
+ # @return [String]
34
+ attr_accessor :destination
35
+
36
+ # Type of destination for the route rule. SERVICE_CIDR_BLOCK should be used if destination is a service
37
+ # cidrBlock. CIDR_BLOCK should be used if destination is IP address range in CIDR notation. It must be provided
38
+ # along with `destination`.
39
+ #
40
+ # @return [String]
41
+ attr_reader :destination_type
42
+
19
43
  # **[Required]** The OCID for the route rule's target. For information about the type of
20
44
  # targets you can specify, see
21
45
  # [Route Tables](https://docs.us-phoenix-1.oraclecloud.com/Content/Network/Tasks/managingroutetables.htm).
@@ -28,6 +52,8 @@ module OCI
28
52
  {
29
53
  # rubocop:disable Style/SymbolLiteral
30
54
  'cidr_block': :'cidrBlock',
55
+ 'destination': :'destination',
56
+ 'destination_type': :'destinationType',
31
57
  'network_entity_id': :'networkEntityId'
32
58
  # rubocop:enable Style/SymbolLiteral
33
59
  }
@@ -38,6 +64,8 @@ module OCI
38
64
  {
39
65
  # rubocop:disable Style/SymbolLiteral
40
66
  'cidr_block': :'String',
67
+ 'destination': :'String',
68
+ 'destination_type': :'String',
41
69
  'network_entity_id': :'String'
42
70
  # rubocop:enable Style/SymbolLiteral
43
71
  }
@@ -50,6 +78,8 @@ module OCI
50
78
  # Initializes the object
51
79
  # @param [Hash] attributes Model attributes in the form of hash
52
80
  # @option attributes [String] :cidr_block The value to assign to the {#cidr_block} property
81
+ # @option attributes [String] :destination The value to assign to the {#destination} property
82
+ # @option attributes [String] :destination_type The value to assign to the {#destination_type} property
53
83
  # @option attributes [String] :network_entity_id The value to assign to the {#network_entity_id} property
54
84
  def initialize(attributes = {})
55
85
  return unless attributes.is_a?(Hash)
@@ -63,6 +93,16 @@ module OCI
63
93
 
64
94
  self.cidr_block = attributes[:'cidr_block'] if attributes[:'cidr_block']
65
95
 
96
+ self.destination = attributes[:'destination'] if attributes[:'destination']
97
+
98
+ self.destination_type = attributes[:'destinationType'] if attributes[:'destinationType']
99
+ self.destination_type = "CIDR_BLOCK" if destination_type.nil? && !attributes.key?(:'destinationType') # rubocop:disable Style/StringLiterals
100
+
101
+ raise 'You cannot provide both :destinationType and :destination_type' if attributes.key?(:'destinationType') && attributes.key?(:'destination_type')
102
+
103
+ self.destination_type = attributes[:'destination_type'] if attributes[:'destination_type']
104
+ self.destination_type = "CIDR_BLOCK" if destination_type.nil? && !attributes.key?(:'destinationType') && !attributes.key?(:'destination_type') # rubocop:disable Style/StringLiterals
105
+
66
106
  self.network_entity_id = attributes[:'networkEntityId'] if attributes[:'networkEntityId']
67
107
 
68
108
  raise 'You cannot provide both :networkEntityId and :network_entity_id' if attributes.key?(:'networkEntityId') && attributes.key?(:'network_entity_id')
@@ -72,6 +112,21 @@ module OCI
72
112
  # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
73
113
  # rubocop:enable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
74
114
 
115
+ # Custom attribute writer method checking allowed values (enum).
116
+ # @param [Object] destination_type Object to be assigned
117
+ def destination_type=(destination_type)
118
+ # rubocop:disable Style/ConditionalAssignment
119
+ if destination_type && !DESTINATION_TYPE_ENUM.include?(destination_type)
120
+ # rubocop: disable Metrics/LineLength
121
+ OCI.logger.debug("Unknown value for 'destination_type' [" + destination_type + "]. Mapping to 'DESTINATION_TYPE_UNKNOWN_ENUM_VALUE'") if OCI.logger
122
+ # rubocop: enable Metrics/LineLength
123
+ @destination_type = DESTINATION_TYPE_UNKNOWN_ENUM_VALUE
124
+ else
125
+ @destination_type = destination_type
126
+ end
127
+ # rubocop:enable Style/ConditionalAssignment
128
+ end
129
+
75
130
  # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Layout/EmptyLines
76
131
 
77
132
 
@@ -81,6 +136,8 @@ module OCI
81
136
  return true if equal?(other)
82
137
  self.class == other.class &&
83
138
  cidr_block == other.cidr_block &&
139
+ destination == other.destination &&
140
+ destination_type == other.destination_type &&
84
141
  network_entity_id == other.network_entity_id
85
142
  end
86
143
  # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Layout/EmptyLines
@@ -97,7 +154,7 @@ module OCI
97
154
  # Calculates hash code according to all attributes.
98
155
  # @return [Fixnum] Hash code
99
156
  def hash
100
- [cidr_block, network_entity_id].hash
157
+ [cidr_block, destination, destination_type, network_entity_id].hash
101
158
  end
102
159
  # rubocop:enable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
103
160
 
@@ -0,0 +1,185 @@
1
+ # Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
2
+
3
+ require 'date'
4
+
5
+ # rubocop:disable Lint/UnneededCopDisableDirective
6
+ module OCI
7
+ # Information about a service that is accessible through a service gateway.
8
+ #
9
+ class Core::Models::Service # rubocop:disable Metrics/LineLength
10
+ # **[Required]** A string that represents the public endpoints for the service. When you set up a route rule
11
+ # to route traffic to the service gateway, use this value as the destination CIDR block for
12
+ # the rule. See {RouteTable}.
13
+ #
14
+ # @return [String]
15
+ attr_accessor :cidr_block
16
+
17
+ # **[Required]** Description of the service.
18
+ #
19
+ # @return [String]
20
+ attr_accessor :description
21
+
22
+ # **[Required]** The service's [OCID](https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm).
23
+ # @return [String]
24
+ attr_accessor :id
25
+
26
+ # **[Required]** Name of the service.
27
+ # @return [String]
28
+ attr_accessor :name
29
+
30
+ # Attribute mapping from ruby-style variable name to JSON key.
31
+ def self.attribute_map
32
+ {
33
+ # rubocop:disable Style/SymbolLiteral
34
+ 'cidr_block': :'cidrBlock',
35
+ 'description': :'description',
36
+ 'id': :'id',
37
+ 'name': :'name'
38
+ # rubocop:enable Style/SymbolLiteral
39
+ }
40
+ end
41
+
42
+ # Attribute type mapping.
43
+ def self.swagger_types
44
+ {
45
+ # rubocop:disable Style/SymbolLiteral
46
+ 'cidr_block': :'String',
47
+ 'description': :'String',
48
+ 'id': :'String',
49
+ 'name': :'String'
50
+ # rubocop:enable Style/SymbolLiteral
51
+ }
52
+ end
53
+
54
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
55
+ # rubocop:disable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
56
+
57
+
58
+ # Initializes the object
59
+ # @param [Hash] attributes Model attributes in the form of hash
60
+ # @option attributes [String] :cidr_block The value to assign to the {#cidr_block} property
61
+ # @option attributes [String] :description The value to assign to the {#description} property
62
+ # @option attributes [String] :id The value to assign to the {#id} property
63
+ # @option attributes [String] :name The value to assign to the {#name} property
64
+ def initialize(attributes = {})
65
+ return unless attributes.is_a?(Hash)
66
+
67
+ # convert string to symbol for hash key
68
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
69
+
70
+ self.cidr_block = attributes[:'cidrBlock'] if attributes[:'cidrBlock']
71
+
72
+ raise 'You cannot provide both :cidrBlock and :cidr_block' if attributes.key?(:'cidrBlock') && attributes.key?(:'cidr_block')
73
+
74
+ self.cidr_block = attributes[:'cidr_block'] if attributes[:'cidr_block']
75
+
76
+ self.description = attributes[:'description'] if attributes[:'description']
77
+
78
+ self.id = attributes[:'id'] if attributes[:'id']
79
+
80
+ self.name = attributes[:'name'] if attributes[:'name']
81
+ end
82
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
83
+ # rubocop:enable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
84
+
85
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Layout/EmptyLines
86
+
87
+
88
+ # Checks equality by comparing each attribute.
89
+ # @param [Object] other the other object to be compared
90
+ def ==(other)
91
+ return true if equal?(other)
92
+ self.class == other.class &&
93
+ cidr_block == other.cidr_block &&
94
+ description == other.description &&
95
+ id == other.id &&
96
+ name == other.name
97
+ end
98
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Layout/EmptyLines
99
+
100
+ # @see the `==` method
101
+ # @param [Object] other the other object to be compared
102
+ def eql?(other)
103
+ self == other
104
+ end
105
+
106
+ # rubocop:disable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
107
+
108
+
109
+ # Calculates hash code according to all attributes.
110
+ # @return [Fixnum] Hash code
111
+ def hash
112
+ [cidr_block, description, id, name].hash
113
+ end
114
+ # rubocop:enable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
115
+
116
+ # rubocop:disable Metrics/AbcSize, Layout/EmptyLines
117
+
118
+
119
+ # Builds the object from hash
120
+ # @param [Hash] attributes Model attributes in the form of hash
121
+ # @return [Object] Returns the model itself
122
+ def build_from_hash(attributes)
123
+ return nil unless attributes.is_a?(Hash)
124
+ self.class.swagger_types.each_pair do |key, type|
125
+ if type =~ /^Array<(.*)>/i
126
+ # check to ensure the input is an array given that the the attribute
127
+ # is documented as an array but the input is not
128
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
129
+ public_method("#{key}=").call(
130
+ attributes[self.class.attribute_map[key]]
131
+ .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
132
+ )
133
+ end
134
+ elsif !attributes[self.class.attribute_map[key]].nil?
135
+ public_method("#{key}=").call(
136
+ OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
137
+ )
138
+ end
139
+ # or else data not found in attributes(hash), not an issue as the data can be optional
140
+ end
141
+
142
+ self
143
+ end
144
+ # rubocop:enable Metrics/AbcSize, Layout/EmptyLines
145
+
146
+ # Returns the string representation of the object
147
+ # @return [String] String presentation of the object
148
+ def to_s
149
+ to_hash.to_s
150
+ end
151
+
152
+ # Returns the object in the form of hash
153
+ # @return [Hash] Returns the object in the form of hash
154
+ def to_hash
155
+ hash = {}
156
+ self.class.attribute_map.each_pair do |attr, param|
157
+ value = public_method(attr).call
158
+ next if value.nil? && !instance_variable_defined?("@#{attr}")
159
+ hash[param] = _to_hash(value)
160
+ end
161
+ hash
162
+ end
163
+
164
+ private
165
+
166
+ # Outputs non-array value in the form of hash
167
+ # For object, use to_hash. Otherwise, just return the value
168
+ # @param [Object] value Any valid value
169
+ # @return [Hash] Returns the value in the form of hash
170
+ def _to_hash(value)
171
+ if value.is_a?(Array)
172
+ value.compact.map { |v| _to_hash(v) }
173
+ elsif value.is_a?(Hash)
174
+ {}.tap do |hash|
175
+ value.each { |k, v| hash[k] = _to_hash(v) }
176
+ end
177
+ elsif value.respond_to? :to_hash
178
+ value.to_hash
179
+ else
180
+ value
181
+ end
182
+ end
183
+ end
184
+ end
185
+ # rubocop:enable Lint/UnneededCopDisableDirective
@@ -0,0 +1,325 @@
1
+ # Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
2
+
3
+ require 'date'
4
+ require 'logger'
5
+
6
+ # rubocop:disable Lint/UnneededCopDisableDirective
7
+ module OCI
8
+ # Represents a router that connects the edge of a VCN with public Oracle Cloud Infrastructure
9
+ # services such as Object Storage. Traffic leaving the VCN and destined for a supported public
10
+ # service (see {#list_services list_services}) is routed through the
11
+ # service gateway and does not traverse the internet. The instances in the VCN do not need to
12
+ # have public IP addresses nor be in a public subnet. The VCN does not need an internet gateway
13
+ # for this traffic. For more information, see
14
+ # [Access to Object Storage: Service Gateway](https://docs.us-phoenix-1.oraclecloud.com/Content/Network/Tasks/servicegateway.htm).
15
+ #
16
+ # To use any of the API operations, you must be authorized in an IAM policy. If you're not authorized,
17
+ # talk to an administrator. If you're an administrator who needs to write policies to give users access, see
18
+ # [Getting Started with Policies](https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/policygetstarted.htm).
19
+ #
20
+ class Core::Models::ServiceGateway # rubocop:disable Metrics/LineLength
21
+ LIFECYCLE_STATE_ENUM = [
22
+ LIFECYCLE_STATE_PROVISIONING = 'PROVISIONING'.freeze,
23
+ LIFECYCLE_STATE_AVAILABLE = 'AVAILABLE'.freeze,
24
+ LIFECYCLE_STATE_TERMINATING = 'TERMINATING'.freeze,
25
+ LIFECYCLE_STATE_TERMINATED = 'TERMINATED'.freeze,
26
+ LIFECYCLE_STATE_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
27
+ ].freeze
28
+
29
+ # **[Required]** Whether the service gateway blocks all traffic through it. The default is `false`. When
30
+ # this is `true`, traffic is not routed to any services, regardless of route rules.
31
+ #
32
+ # Example: `true`
33
+ #
34
+ # @return [BOOLEAN]
35
+ attr_accessor :block_traffic
36
+
37
+ # **[Required]** The [OCID](https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm) of the compartment that contains the
38
+ # service gateway.
39
+ #
40
+ # @return [String]
41
+ attr_accessor :compartment_id
42
+
43
+ # Usage of predefined tag keys. These predefined keys are scoped to namespaces.
44
+ # Example: `{\"foo-namespace\": {\"bar-key\": \"foo-value\"}}`
45
+ #
46
+ # @return [Hash<String, Hash<String, Object>>]
47
+ attr_accessor :defined_tags
48
+
49
+ # A user-friendly name. Does not have to be unique, and it's changeable.
50
+ # Avoid entering confidential information.
51
+ #
52
+ # @return [String]
53
+ attr_accessor :display_name
54
+
55
+ # Simple key-value pair that is applied without any predefined name, type or scope. Exists for cross-compatibility only.
56
+ # Example: `{\"bar-key\": \"value\"}`
57
+ #
58
+ # @return [Hash<String, String>]
59
+ attr_accessor :freeform_tags
60
+
61
+ # **[Required]** The [OCID](https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm) of the service gateway.
62
+ # @return [String]
63
+ attr_accessor :id
64
+
65
+ # **[Required]** The service gateway's current state.
66
+ # @return [String]
67
+ attr_reader :lifecycle_state
68
+
69
+ # **[Required]** List of the services enabled on this service gateway. The list can be empty.
70
+ # You can enable a particular service by using
71
+ # {#attach_service_id attach_service_id}.
72
+ #
73
+ # @return [Array<OCI::Core::Models::ServiceIdResponseDetails>]
74
+ attr_accessor :services
75
+
76
+ # The date and time the service gateway was created, in the format defined by RFC3339.
77
+ #
78
+ # Example: `2016-08-25T21:10:29.600Z`
79
+ #
80
+ # @return [DateTime]
81
+ attr_accessor :time_created
82
+
83
+ # **[Required]** The [OCID](https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm) of the VCN the service gateway
84
+ # belongs to.
85
+ #
86
+ # @return [String]
87
+ attr_accessor :vcn_id
88
+
89
+ # Attribute mapping from ruby-style variable name to JSON key.
90
+ def self.attribute_map
91
+ {
92
+ # rubocop:disable Style/SymbolLiteral
93
+ 'block_traffic': :'blockTraffic',
94
+ 'compartment_id': :'compartmentId',
95
+ 'defined_tags': :'definedTags',
96
+ 'display_name': :'displayName',
97
+ 'freeform_tags': :'freeformTags',
98
+ 'id': :'id',
99
+ 'lifecycle_state': :'lifecycleState',
100
+ 'services': :'services',
101
+ 'time_created': :'timeCreated',
102
+ 'vcn_id': :'vcnId'
103
+ # rubocop:enable Style/SymbolLiteral
104
+ }
105
+ end
106
+
107
+ # Attribute type mapping.
108
+ def self.swagger_types
109
+ {
110
+ # rubocop:disable Style/SymbolLiteral
111
+ 'block_traffic': :'BOOLEAN',
112
+ 'compartment_id': :'String',
113
+ 'defined_tags': :'Hash<String, Hash<String, Object>>',
114
+ 'display_name': :'String',
115
+ 'freeform_tags': :'Hash<String, String>',
116
+ 'id': :'String',
117
+ 'lifecycle_state': :'String',
118
+ 'services': :'Array<OCI::Core::Models::ServiceIdResponseDetails>',
119
+ 'time_created': :'DateTime',
120
+ 'vcn_id': :'String'
121
+ # rubocop:enable Style/SymbolLiteral
122
+ }
123
+ end
124
+
125
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
126
+ # rubocop:disable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
127
+
128
+
129
+ # Initializes the object
130
+ # @param [Hash] attributes Model attributes in the form of hash
131
+ # @option attributes [BOOLEAN] :block_traffic The value to assign to the {#block_traffic} property
132
+ # @option attributes [String] :compartment_id The value to assign to the {#compartment_id} property
133
+ # @option attributes [Hash<String, Hash<String, Object>>] :defined_tags The value to assign to the {#defined_tags} property
134
+ # @option attributes [String] :display_name The value to assign to the {#display_name} property
135
+ # @option attributes [Hash<String, String>] :freeform_tags The value to assign to the {#freeform_tags} property
136
+ # @option attributes [String] :id The value to assign to the {#id} property
137
+ # @option attributes [String] :lifecycle_state The value to assign to the {#lifecycle_state} property
138
+ # @option attributes [Array<OCI::Core::Models::ServiceIdResponseDetails>] :services The value to assign to the {#services} property
139
+ # @option attributes [DateTime] :time_created The value to assign to the {#time_created} property
140
+ # @option attributes [String] :vcn_id The value to assign to the {#vcn_id} property
141
+ def initialize(attributes = {})
142
+ return unless attributes.is_a?(Hash)
143
+
144
+ # convert string to symbol for hash key
145
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
146
+
147
+ self.block_traffic = attributes[:'blockTraffic'] unless attributes[:'blockTraffic'].nil?
148
+ self.block_traffic = false if block_traffic.nil? && !attributes.key?(:'blockTraffic') # rubocop:disable Style/StringLiterals
149
+
150
+ raise 'You cannot provide both :blockTraffic and :block_traffic' if attributes.key?(:'blockTraffic') && attributes.key?(:'block_traffic')
151
+
152
+ self.block_traffic = attributes[:'block_traffic'] unless attributes[:'block_traffic'].nil?
153
+ self.block_traffic = false if block_traffic.nil? && !attributes.key?(:'blockTraffic') && !attributes.key?(:'block_traffic') # rubocop:disable Style/StringLiterals
154
+
155
+ self.compartment_id = attributes[:'compartmentId'] if attributes[:'compartmentId']
156
+
157
+ raise 'You cannot provide both :compartmentId and :compartment_id' if attributes.key?(:'compartmentId') && attributes.key?(:'compartment_id')
158
+
159
+ self.compartment_id = attributes[:'compartment_id'] if attributes[:'compartment_id']
160
+
161
+ self.defined_tags = attributes[:'definedTags'] if attributes[:'definedTags']
162
+
163
+ raise 'You cannot provide both :definedTags and :defined_tags' if attributes.key?(:'definedTags') && attributes.key?(:'defined_tags')
164
+
165
+ self.defined_tags = attributes[:'defined_tags'] if attributes[:'defined_tags']
166
+
167
+ self.display_name = attributes[:'displayName'] if attributes[:'displayName']
168
+
169
+ raise 'You cannot provide both :displayName and :display_name' if attributes.key?(:'displayName') && attributes.key?(:'display_name')
170
+
171
+ self.display_name = attributes[:'display_name'] if attributes[:'display_name']
172
+
173
+ self.freeform_tags = attributes[:'freeformTags'] if attributes[:'freeformTags']
174
+
175
+ raise 'You cannot provide both :freeformTags and :freeform_tags' if attributes.key?(:'freeformTags') && attributes.key?(:'freeform_tags')
176
+
177
+ self.freeform_tags = attributes[:'freeform_tags'] if attributes[:'freeform_tags']
178
+
179
+ self.id = attributes[:'id'] if attributes[:'id']
180
+
181
+ self.lifecycle_state = attributes[:'lifecycleState'] if attributes[:'lifecycleState']
182
+
183
+ raise 'You cannot provide both :lifecycleState and :lifecycle_state' if attributes.key?(:'lifecycleState') && attributes.key?(:'lifecycle_state')
184
+
185
+ self.lifecycle_state = attributes[:'lifecycle_state'] if attributes[:'lifecycle_state']
186
+
187
+ self.services = attributes[:'services'] if attributes[:'services']
188
+
189
+ self.time_created = attributes[:'timeCreated'] if attributes[:'timeCreated']
190
+
191
+ raise 'You cannot provide both :timeCreated and :time_created' if attributes.key?(:'timeCreated') && attributes.key?(:'time_created')
192
+
193
+ self.time_created = attributes[:'time_created'] if attributes[:'time_created']
194
+
195
+ self.vcn_id = attributes[:'vcnId'] if attributes[:'vcnId']
196
+
197
+ raise 'You cannot provide both :vcnId and :vcn_id' if attributes.key?(:'vcnId') && attributes.key?(:'vcn_id')
198
+
199
+ self.vcn_id = attributes[:'vcn_id'] if attributes[:'vcn_id']
200
+ end
201
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
202
+ # rubocop:enable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
203
+
204
+ # Custom attribute writer method checking allowed values (enum).
205
+ # @param [Object] lifecycle_state Object to be assigned
206
+ def lifecycle_state=(lifecycle_state)
207
+ # rubocop:disable Style/ConditionalAssignment
208
+ if lifecycle_state && !LIFECYCLE_STATE_ENUM.include?(lifecycle_state)
209
+ # rubocop: disable Metrics/LineLength
210
+ OCI.logger.debug("Unknown value for 'lifecycle_state' [" + lifecycle_state + "]. Mapping to 'LIFECYCLE_STATE_UNKNOWN_ENUM_VALUE'") if OCI.logger
211
+ # rubocop: enable Metrics/LineLength
212
+ @lifecycle_state = LIFECYCLE_STATE_UNKNOWN_ENUM_VALUE
213
+ else
214
+ @lifecycle_state = lifecycle_state
215
+ end
216
+ # rubocop:enable Style/ConditionalAssignment
217
+ end
218
+
219
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Layout/EmptyLines
220
+
221
+
222
+ # Checks equality by comparing each attribute.
223
+ # @param [Object] other the other object to be compared
224
+ def ==(other)
225
+ return true if equal?(other)
226
+ self.class == other.class &&
227
+ block_traffic == other.block_traffic &&
228
+ compartment_id == other.compartment_id &&
229
+ defined_tags == other.defined_tags &&
230
+ display_name == other.display_name &&
231
+ freeform_tags == other.freeform_tags &&
232
+ id == other.id &&
233
+ lifecycle_state == other.lifecycle_state &&
234
+ services == other.services &&
235
+ time_created == other.time_created &&
236
+ vcn_id == other.vcn_id
237
+ end
238
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Layout/EmptyLines
239
+
240
+ # @see the `==` method
241
+ # @param [Object] other the other object to be compared
242
+ def eql?(other)
243
+ self == other
244
+ end
245
+
246
+ # rubocop:disable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
247
+
248
+
249
+ # Calculates hash code according to all attributes.
250
+ # @return [Fixnum] Hash code
251
+ def hash
252
+ [block_traffic, compartment_id, defined_tags, display_name, freeform_tags, id, lifecycle_state, services, time_created, vcn_id].hash
253
+ end
254
+ # rubocop:enable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
255
+
256
+ # rubocop:disable Metrics/AbcSize, Layout/EmptyLines
257
+
258
+
259
+ # Builds the object from hash
260
+ # @param [Hash] attributes Model attributes in the form of hash
261
+ # @return [Object] Returns the model itself
262
+ def build_from_hash(attributes)
263
+ return nil unless attributes.is_a?(Hash)
264
+ self.class.swagger_types.each_pair do |key, type|
265
+ if type =~ /^Array<(.*)>/i
266
+ # check to ensure the input is an array given that the the attribute
267
+ # is documented as an array but the input is not
268
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
269
+ public_method("#{key}=").call(
270
+ attributes[self.class.attribute_map[key]]
271
+ .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
272
+ )
273
+ end
274
+ elsif !attributes[self.class.attribute_map[key]].nil?
275
+ public_method("#{key}=").call(
276
+ OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
277
+ )
278
+ end
279
+ # or else data not found in attributes(hash), not an issue as the data can be optional
280
+ end
281
+
282
+ self
283
+ end
284
+ # rubocop:enable Metrics/AbcSize, Layout/EmptyLines
285
+
286
+ # Returns the string representation of the object
287
+ # @return [String] String presentation of the object
288
+ def to_s
289
+ to_hash.to_s
290
+ end
291
+
292
+ # Returns the object in the form of hash
293
+ # @return [Hash] Returns the object in the form of hash
294
+ def to_hash
295
+ hash = {}
296
+ self.class.attribute_map.each_pair do |attr, param|
297
+ value = public_method(attr).call
298
+ next if value.nil? && !instance_variable_defined?("@#{attr}")
299
+ hash[param] = _to_hash(value)
300
+ end
301
+ hash
302
+ end
303
+
304
+ private
305
+
306
+ # Outputs non-array value in the form of hash
307
+ # For object, use to_hash. Otherwise, just return the value
308
+ # @param [Object] value Any valid value
309
+ # @return [Hash] Returns the value in the form of hash
310
+ def _to_hash(value)
311
+ if value.is_a?(Array)
312
+ value.compact.map { |v| _to_hash(v) }
313
+ elsif value.is_a?(Hash)
314
+ {}.tap do |hash|
315
+ value.each { |k, v| hash[k] = _to_hash(v) }
316
+ end
317
+ elsif value.respond_to? :to_hash
318
+ value.to_hash
319
+ else
320
+ value
321
+ end
322
+ end
323
+ end
324
+ end
325
+ # rubocop:enable Lint/UnneededCopDisableDirective