oci 2.2.1 → 2.3.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 (43) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +2 -1
  3. data/lib/oci.rb +1 -0
  4. data/lib/oci/audit/audit_client_composite_operations.rb +16 -6
  5. data/lib/oci/container_engine/container_engine.rb +47 -0
  6. data/lib/oci/container_engine/container_engine_client.rb +1276 -0
  7. data/lib/oci/container_engine/container_engine_client_composite_operations.rb +320 -0
  8. data/lib/oci/container_engine/models/add_on_options.rb +164 -0
  9. data/lib/oci/container_engine/models/cluster.rb +296 -0
  10. data/lib/oci/container_engine/models/cluster_create_options.rb +178 -0
  11. data/lib/oci/container_engine/models/cluster_endpoints.rb +146 -0
  12. data/lib/oci/container_engine/models/cluster_lifecycle_state.rb +14 -0
  13. data/lib/oci/container_engine/models/cluster_metadata.rb +262 -0
  14. data/lib/oci/container_engine/models/cluster_options.rb +150 -0
  15. data/lib/oci/container_engine/models/cluster_summary.rb +296 -0
  16. data/lib/oci/container_engine/models/create_cluster_details.rb +198 -0
  17. data/lib/oci/container_engine/models/create_cluster_kubeconfig_content_details.rb +162 -0
  18. data/lib/oci/container_engine/models/create_node_pool_details.rb +272 -0
  19. data/lib/oci/container_engine/models/key_value.rb +156 -0
  20. data/lib/oci/container_engine/models/kubernetes_network_config.rb +164 -0
  21. data/lib/oci/container_engine/models/node.rb +281 -0
  22. data/lib/oci/container_engine/models/node_error.rb +180 -0
  23. data/lib/oci/container_engine/models/node_pool.rb +306 -0
  24. data/lib/oci/container_engine/models/node_pool_options.rb +170 -0
  25. data/lib/oci/container_engine/models/node_pool_summary.rb +296 -0
  26. data/lib/oci/container_engine/models/sort_order.rb +10 -0
  27. data/lib/oci/container_engine/models/update_cluster_details.rb +160 -0
  28. data/lib/oci/container_engine/models/update_node_pool_details.rb +202 -0
  29. data/lib/oci/container_engine/models/work_request.rb +288 -0
  30. data/lib/oci/container_engine/models/work_request_error.rb +167 -0
  31. data/lib/oci/container_engine/models/work_request_log_entry.rb +156 -0
  32. data/lib/oci/container_engine/models/work_request_operation_type.rb +15 -0
  33. data/lib/oci/container_engine/models/work_request_resource.rb +214 -0
  34. data/lib/oci/container_engine/models/work_request_status.rb +14 -0
  35. data/lib/oci/container_engine/models/work_request_summary.rb +288 -0
  36. data/lib/oci/container_engine/util.rb +46 -0
  37. data/lib/oci/errors.rb +21 -2
  38. data/lib/oci/load_balancer/load_balancer_client_composite_operations.rb +336 -133
  39. data/lib/oci/load_balancer/util.rb +19 -32
  40. data/lib/oci/regions.rb +2 -1
  41. data/lib/oci/version.rb +1 -1
  42. data/lib/oci/waiter.rb +47 -0
  43. metadata +34 -2
@@ -0,0 +1,167 @@
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
+ # Errors related to a specific work request.
9
+ class ContainerEngine::Models::WorkRequestError # rubocop:disable Metrics/LineLength
10
+ # **[Required]** A short error code that defines the error, meant for programmatic parsing. See [API Errors](https://docs.us-phoenix-1.oraclecloud.com/Content/API/References/apierrors.htm).
11
+ # @return [String]
12
+ attr_accessor :code
13
+
14
+ # **[Required]** A human-readable error string.
15
+ # @return [String]
16
+ attr_accessor :message
17
+
18
+ # **[Required]** The date and time the error occurred.
19
+ # @return [DateTime]
20
+ attr_accessor :timestamp
21
+
22
+ # Attribute mapping from ruby-style variable name to JSON key.
23
+ def self.attribute_map
24
+ {
25
+ # rubocop:disable Style/SymbolLiteral
26
+ 'code': :'code',
27
+ 'message': :'message',
28
+ 'timestamp': :'timestamp'
29
+ # rubocop:enable Style/SymbolLiteral
30
+ }
31
+ end
32
+
33
+ # Attribute type mapping.
34
+ def self.swagger_types
35
+ {
36
+ # rubocop:disable Style/SymbolLiteral
37
+ 'code': :'String',
38
+ 'message': :'String',
39
+ 'timestamp': :'DateTime'
40
+ # rubocop:enable Style/SymbolLiteral
41
+ }
42
+ end
43
+
44
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
45
+ # rubocop:disable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
46
+
47
+
48
+ # Initializes the object
49
+ # @param [Hash] attributes Model attributes in the form of hash
50
+ # @option attributes [String] :code The value to assign to the {#code} property
51
+ # @option attributes [String] :message The value to assign to the {#message} property
52
+ # @option attributes [DateTime] :timestamp The value to assign to the {#timestamp} property
53
+ def initialize(attributes = {})
54
+ return unless attributes.is_a?(Hash)
55
+
56
+ # convert string to symbol for hash key
57
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
58
+
59
+ self.code = attributes[:'code'] if attributes[:'code']
60
+
61
+ self.message = attributes[:'message'] if attributes[:'message']
62
+
63
+ self.timestamp = attributes[:'timestamp'] if attributes[:'timestamp']
64
+ end
65
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
66
+ # rubocop:enable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
67
+
68
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Layout/EmptyLines
69
+
70
+
71
+ # Checks equality by comparing each attribute.
72
+ # @param [Object] other the other object to be compared
73
+ def ==(other)
74
+ return true if equal?(other)
75
+ self.class == other.class &&
76
+ code == other.code &&
77
+ message == other.message &&
78
+ timestamp == other.timestamp
79
+ end
80
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Layout/EmptyLines
81
+
82
+ # @see the `==` method
83
+ # @param [Object] other the other object to be compared
84
+ def eql?(other)
85
+ self == other
86
+ end
87
+
88
+ # rubocop:disable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
89
+
90
+
91
+ # Calculates hash code according to all attributes.
92
+ # @return [Fixnum] Hash code
93
+ def hash
94
+ [code, message, timestamp].hash
95
+ end
96
+ # rubocop:enable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
97
+
98
+ # rubocop:disable Metrics/AbcSize, Layout/EmptyLines
99
+
100
+
101
+ # Builds the object from hash
102
+ # @param [Hash] attributes Model attributes in the form of hash
103
+ # @return [Object] Returns the model itself
104
+ def build_from_hash(attributes)
105
+ return nil unless attributes.is_a?(Hash)
106
+ self.class.swagger_types.each_pair do |key, type|
107
+ if type =~ /^Array<(.*)>/i
108
+ # check to ensure the input is an array given that the the attribute
109
+ # is documented as an array but the input is not
110
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
111
+ public_method("#{key}=").call(
112
+ attributes[self.class.attribute_map[key]]
113
+ .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
114
+ )
115
+ end
116
+ elsif !attributes[self.class.attribute_map[key]].nil?
117
+ public_method("#{key}=").call(
118
+ OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
119
+ )
120
+ end
121
+ # or else data not found in attributes(hash), not an issue as the data can be optional
122
+ end
123
+
124
+ self
125
+ end
126
+ # rubocop:enable Metrics/AbcSize, Layout/EmptyLines
127
+
128
+ # Returns the string representation of the object
129
+ # @return [String] String presentation of the object
130
+ def to_s
131
+ to_hash.to_s
132
+ end
133
+
134
+ # Returns the object in the form of hash
135
+ # @return [Hash] Returns the object in the form of hash
136
+ def to_hash
137
+ hash = {}
138
+ self.class.attribute_map.each_pair do |attr, param|
139
+ value = public_method(attr).call
140
+ next if value.nil? && !instance_variable_defined?("@#{attr}")
141
+ hash[param] = _to_hash(value)
142
+ end
143
+ hash
144
+ end
145
+
146
+ private
147
+
148
+ # Outputs non-array value in the form of hash
149
+ # For object, use to_hash. Otherwise, just return the value
150
+ # @param [Object] value Any valid value
151
+ # @return [Hash] Returns the value in the form of hash
152
+ def _to_hash(value)
153
+ if value.is_a?(Array)
154
+ value.compact.map { |v| _to_hash(v) }
155
+ elsif value.is_a?(Hash)
156
+ {}.tap do |hash|
157
+ value.each { |k, v| hash[k] = _to_hash(v) }
158
+ end
159
+ elsif value.respond_to? :to_hash
160
+ value.to_hash
161
+ else
162
+ value
163
+ end
164
+ end
165
+ end
166
+ end
167
+ # rubocop:enable Lint/UnneededCopDisableDirective
@@ -0,0 +1,156 @@
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
+ # Log entries related to a specific work request.
8
+ class ContainerEngine::Models::WorkRequestLogEntry # rubocop:disable Metrics/LineLength
9
+ # The description of an action that occurred.
10
+ # @return [String]
11
+ attr_accessor :message
12
+
13
+ # The date and time the log entry occurred.
14
+ # @return [String]
15
+ attr_accessor :timestamp
16
+
17
+ # Attribute mapping from ruby-style variable name to JSON key.
18
+ def self.attribute_map
19
+ {
20
+ # rubocop:disable Style/SymbolLiteral
21
+ 'message': :'message',
22
+ 'timestamp': :'timestamp'
23
+ # rubocop:enable Style/SymbolLiteral
24
+ }
25
+ end
26
+
27
+ # Attribute type mapping.
28
+ def self.swagger_types
29
+ {
30
+ # rubocop:disable Style/SymbolLiteral
31
+ 'message': :'String',
32
+ 'timestamp': :'String'
33
+ # rubocop:enable Style/SymbolLiteral
34
+ }
35
+ end
36
+
37
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
38
+ # rubocop:disable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
39
+
40
+
41
+ # Initializes the object
42
+ # @param [Hash] attributes Model attributes in the form of hash
43
+ # @option attributes [String] :message The value to assign to the {#message} property
44
+ # @option attributes [String] :timestamp The value to assign to the {#timestamp} property
45
+ def initialize(attributes = {})
46
+ return unless attributes.is_a?(Hash)
47
+
48
+ # convert string to symbol for hash key
49
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
50
+
51
+ self.message = attributes[:'message'] if attributes[:'message']
52
+
53
+ self.timestamp = attributes[:'timestamp'] if attributes[:'timestamp']
54
+ end
55
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
56
+ # rubocop:enable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
57
+
58
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Layout/EmptyLines
59
+
60
+
61
+ # Checks equality by comparing each attribute.
62
+ # @param [Object] other the other object to be compared
63
+ def ==(other)
64
+ return true if equal?(other)
65
+ self.class == other.class &&
66
+ message == other.message &&
67
+ timestamp == other.timestamp
68
+ end
69
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Layout/EmptyLines
70
+
71
+ # @see the `==` method
72
+ # @param [Object] other the other object to be compared
73
+ def eql?(other)
74
+ self == other
75
+ end
76
+
77
+ # rubocop:disable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
78
+
79
+
80
+ # Calculates hash code according to all attributes.
81
+ # @return [Fixnum] Hash code
82
+ def hash
83
+ [message, timestamp].hash
84
+ end
85
+ # rubocop:enable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
86
+
87
+ # rubocop:disable Metrics/AbcSize, Layout/EmptyLines
88
+
89
+
90
+ # Builds the object from hash
91
+ # @param [Hash] attributes Model attributes in the form of hash
92
+ # @return [Object] Returns the model itself
93
+ def build_from_hash(attributes)
94
+ return nil unless attributes.is_a?(Hash)
95
+ self.class.swagger_types.each_pair do |key, type|
96
+ if type =~ /^Array<(.*)>/i
97
+ # check to ensure the input is an array given that the the attribute
98
+ # is documented as an array but the input is not
99
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
100
+ public_method("#{key}=").call(
101
+ attributes[self.class.attribute_map[key]]
102
+ .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
103
+ )
104
+ end
105
+ elsif !attributes[self.class.attribute_map[key]].nil?
106
+ public_method("#{key}=").call(
107
+ OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
108
+ )
109
+ end
110
+ # or else data not found in attributes(hash), not an issue as the data can be optional
111
+ end
112
+
113
+ self
114
+ end
115
+ # rubocop:enable Metrics/AbcSize, Layout/EmptyLines
116
+
117
+ # Returns the string representation of the object
118
+ # @return [String] String presentation of the object
119
+ def to_s
120
+ to_hash.to_s
121
+ end
122
+
123
+ # Returns the object in the form of hash
124
+ # @return [Hash] Returns the object in the form of hash
125
+ def to_hash
126
+ hash = {}
127
+ self.class.attribute_map.each_pair do |attr, param|
128
+ value = public_method(attr).call
129
+ next if value.nil? && !instance_variable_defined?("@#{attr}")
130
+ hash[param] = _to_hash(value)
131
+ end
132
+ hash
133
+ end
134
+
135
+ private
136
+
137
+ # Outputs non-array value in the form of hash
138
+ # For object, use to_hash. Otherwise, just return the value
139
+ # @param [Object] value Any valid value
140
+ # @return [Hash] Returns the value in the form of hash
141
+ def _to_hash(value)
142
+ if value.is_a?(Array)
143
+ value.compact.map { |v| _to_hash(v) }
144
+ elsif value.is_a?(Hash)
145
+ {}.tap do |hash|
146
+ value.each { |k, v| hash[k] = _to_hash(v) }
147
+ end
148
+ elsif value.respond_to? :to_hash
149
+ value.to_hash
150
+ else
151
+ value
152
+ end
153
+ end
154
+ end
155
+ end
156
+ # rubocop:enable Lint/UnneededCopDisableDirective
@@ -0,0 +1,15 @@
1
+ # Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
2
+
3
+ module OCI
4
+ module ContainerEngine::Models
5
+ WORK_REQUEST_OPERATION_TYPE_ENUM = [
6
+ WORK_REQUEST_OPERATION_TYPE_CLUSTER_CREATE = 'CLUSTER_CREATE'.freeze,
7
+ WORK_REQUEST_OPERATION_TYPE_CLUSTER_UPDATE = 'CLUSTER_UPDATE'.freeze,
8
+ WORK_REQUEST_OPERATION_TYPE_CLUSTER_DELETE = 'CLUSTER_DELETE'.freeze,
9
+ WORK_REQUEST_OPERATION_TYPE_NODEPOOL_CREATE = 'NODEPOOL_CREATE'.freeze,
10
+ WORK_REQUEST_OPERATION_TYPE_NODEPOOL_UPDATE = 'NODEPOOL_UPDATE'.freeze,
11
+ WORK_REQUEST_OPERATION_TYPE_NODEPOOL_DELETE = 'NODEPOOL_DELETE'.freeze,
12
+ WORK_REQUEST_OPERATION_TYPE_WORKREQUEST_CANCEL = 'WORKREQUEST_CANCEL'.freeze
13
+ ].freeze
14
+ end
15
+ end
@@ -0,0 +1,214 @@
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
+ # The properties that define a work request resource.
9
+ class ContainerEngine::Models::WorkRequestResource # rubocop:disable Metrics/LineLength
10
+ ACTION_TYPE_ENUM = [
11
+ ACTION_TYPE_CREATED = 'CREATED'.freeze,
12
+ ACTION_TYPE_UPDATED = 'UPDATED'.freeze,
13
+ ACTION_TYPE_DELETED = 'DELETED'.freeze,
14
+ ACTION_TYPE_RELATED = 'RELATED'.freeze,
15
+ ACTION_TYPE_IN_PROGRESS = 'IN_PROGRESS'.freeze,
16
+ ACTION_TYPE_FAILED = 'FAILED'.freeze,
17
+ ACTION_TYPE_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
18
+ ].freeze
19
+
20
+ # The way in which this resource was affected by the work tracked by the work request.
21
+ # @return [String]
22
+ attr_reader :action_type
23
+
24
+ # The resource type the work request affects.
25
+ # @return [String]
26
+ attr_accessor :entity_type
27
+
28
+ # The OCID of the resource the work request affects.
29
+ # @return [String]
30
+ attr_accessor :identifier
31
+
32
+ # The URI path on which the user can issue a GET request to access the resource metadata.
33
+ # @return [String]
34
+ attr_accessor :entity_uri
35
+
36
+ # Attribute mapping from ruby-style variable name to JSON key.
37
+ def self.attribute_map
38
+ {
39
+ # rubocop:disable Style/SymbolLiteral
40
+ 'action_type': :'actionType',
41
+ 'entity_type': :'entityType',
42
+ 'identifier': :'identifier',
43
+ 'entity_uri': :'entityUri'
44
+ # rubocop:enable Style/SymbolLiteral
45
+ }
46
+ end
47
+
48
+ # Attribute type mapping.
49
+ def self.swagger_types
50
+ {
51
+ # rubocop:disable Style/SymbolLiteral
52
+ 'action_type': :'String',
53
+ 'entity_type': :'String',
54
+ 'identifier': :'String',
55
+ 'entity_uri': :'String'
56
+ # rubocop:enable Style/SymbolLiteral
57
+ }
58
+ end
59
+
60
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
61
+ # rubocop:disable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
62
+
63
+
64
+ # Initializes the object
65
+ # @param [Hash] attributes Model attributes in the form of hash
66
+ # @option attributes [String] :action_type The value to assign to the {#action_type} property
67
+ # @option attributes [String] :entity_type The value to assign to the {#entity_type} property
68
+ # @option attributes [String] :identifier The value to assign to the {#identifier} property
69
+ # @option attributes [String] :entity_uri The value to assign to the {#entity_uri} property
70
+ def initialize(attributes = {})
71
+ return unless attributes.is_a?(Hash)
72
+
73
+ # convert string to symbol for hash key
74
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
75
+
76
+ self.action_type = attributes[:'actionType'] if attributes[:'actionType']
77
+
78
+ raise 'You cannot provide both :actionType and :action_type' if attributes.key?(:'actionType') && attributes.key?(:'action_type')
79
+
80
+ self.action_type = attributes[:'action_type'] if attributes[:'action_type']
81
+
82
+ self.entity_type = attributes[:'entityType'] if attributes[:'entityType']
83
+
84
+ raise 'You cannot provide both :entityType and :entity_type' if attributes.key?(:'entityType') && attributes.key?(:'entity_type')
85
+
86
+ self.entity_type = attributes[:'entity_type'] if attributes[:'entity_type']
87
+
88
+ self.identifier = attributes[:'identifier'] if attributes[:'identifier']
89
+
90
+ self.entity_uri = attributes[:'entityUri'] if attributes[:'entityUri']
91
+
92
+ raise 'You cannot provide both :entityUri and :entity_uri' if attributes.key?(:'entityUri') && attributes.key?(:'entity_uri')
93
+
94
+ self.entity_uri = attributes[:'entity_uri'] if attributes[:'entity_uri']
95
+ end
96
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
97
+ # rubocop:enable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
98
+
99
+ # Custom attribute writer method checking allowed values (enum).
100
+ # @param [Object] action_type Object to be assigned
101
+ def action_type=(action_type)
102
+ # rubocop:disable Style/ConditionalAssignment
103
+ if action_type && !ACTION_TYPE_ENUM.include?(action_type)
104
+ # rubocop: disable Metrics/LineLength
105
+ OCI.logger.debug("Unknown value for 'action_type' [" + action_type + "]. Mapping to 'ACTION_TYPE_UNKNOWN_ENUM_VALUE'") if OCI.logger
106
+ # rubocop: enable Metrics/LineLength
107
+ @action_type = ACTION_TYPE_UNKNOWN_ENUM_VALUE
108
+ else
109
+ @action_type = action_type
110
+ end
111
+ # rubocop:enable Style/ConditionalAssignment
112
+ end
113
+
114
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Layout/EmptyLines
115
+
116
+
117
+ # Checks equality by comparing each attribute.
118
+ # @param [Object] other the other object to be compared
119
+ def ==(other)
120
+ return true if equal?(other)
121
+ self.class == other.class &&
122
+ action_type == other.action_type &&
123
+ entity_type == other.entity_type &&
124
+ identifier == other.identifier &&
125
+ entity_uri == other.entity_uri
126
+ end
127
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Layout/EmptyLines
128
+
129
+ # @see the `==` method
130
+ # @param [Object] other the other object to be compared
131
+ def eql?(other)
132
+ self == other
133
+ end
134
+
135
+ # rubocop:disable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
136
+
137
+
138
+ # Calculates hash code according to all attributes.
139
+ # @return [Fixnum] Hash code
140
+ def hash
141
+ [action_type, entity_type, identifier, entity_uri].hash
142
+ end
143
+ # rubocop:enable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
144
+
145
+ # rubocop:disable Metrics/AbcSize, Layout/EmptyLines
146
+
147
+
148
+ # Builds the object from hash
149
+ # @param [Hash] attributes Model attributes in the form of hash
150
+ # @return [Object] Returns the model itself
151
+ def build_from_hash(attributes)
152
+ return nil unless attributes.is_a?(Hash)
153
+ self.class.swagger_types.each_pair do |key, type|
154
+ if type =~ /^Array<(.*)>/i
155
+ # check to ensure the input is an array given that the the attribute
156
+ # is documented as an array but the input is not
157
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
158
+ public_method("#{key}=").call(
159
+ attributes[self.class.attribute_map[key]]
160
+ .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
161
+ )
162
+ end
163
+ elsif !attributes[self.class.attribute_map[key]].nil?
164
+ public_method("#{key}=").call(
165
+ OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
166
+ )
167
+ end
168
+ # or else data not found in attributes(hash), not an issue as the data can be optional
169
+ end
170
+
171
+ self
172
+ end
173
+ # rubocop:enable Metrics/AbcSize, Layout/EmptyLines
174
+
175
+ # Returns the string representation of the object
176
+ # @return [String] String presentation of the object
177
+ def to_s
178
+ to_hash.to_s
179
+ end
180
+
181
+ # Returns the object in the form of hash
182
+ # @return [Hash] Returns the object in the form of hash
183
+ def to_hash
184
+ hash = {}
185
+ self.class.attribute_map.each_pair do |attr, param|
186
+ value = public_method(attr).call
187
+ next if value.nil? && !instance_variable_defined?("@#{attr}")
188
+ hash[param] = _to_hash(value)
189
+ end
190
+ hash
191
+ end
192
+
193
+ private
194
+
195
+ # Outputs non-array value in the form of hash
196
+ # For object, use to_hash. Otherwise, just return the value
197
+ # @param [Object] value Any valid value
198
+ # @return [Hash] Returns the value in the form of hash
199
+ def _to_hash(value)
200
+ if value.is_a?(Array)
201
+ value.compact.map { |v| _to_hash(v) }
202
+ elsif value.is_a?(Hash)
203
+ {}.tap do |hash|
204
+ value.each { |k, v| hash[k] = _to_hash(v) }
205
+ end
206
+ elsif value.respond_to? :to_hash
207
+ value.to_hash
208
+ else
209
+ value
210
+ end
211
+ end
212
+ end
213
+ end
214
+ # rubocop:enable Lint/UnneededCopDisableDirective