oci 2.5.0 → 2.5.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 (141) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +5 -1
  3. data/lib/oci.rb +4 -0
  4. data/lib/oci/auth/federation_client.rb +4 -4
  5. data/lib/oci/auth/signers/instance_principals_security_token_signer.rb +22 -16
  6. data/lib/oci/autoscaling/auto_scaling_client.rb +774 -0
  7. data/lib/oci/autoscaling/auto_scaling_client_composite_operations.rb +24 -0
  8. data/lib/oci/autoscaling/autoscaling.rb +38 -0
  9. data/lib/oci/autoscaling/models/action.rb +182 -0
  10. data/lib/oci/autoscaling/models/auto_scaling_configuration.rb +282 -0
  11. data/lib/oci/autoscaling/models/auto_scaling_configuration_summary.rb +234 -0
  12. data/lib/oci/autoscaling/models/auto_scaling_policy.rb +222 -0
  13. data/lib/oci/autoscaling/models/auto_scaling_policy_summary.rb +179 -0
  14. data/lib/oci/autoscaling/models/capacity.rb +170 -0
  15. data/lib/oci/autoscaling/models/condition.rb +186 -0
  16. data/lib/oci/autoscaling/models/create_auto_scaling_configuration_details.rb +256 -0
  17. data/lib/oci/autoscaling/models/create_auto_scaling_policy_details.rb +196 -0
  18. data/lib/oci/autoscaling/models/create_condition_details.rb +176 -0
  19. data/lib/oci/autoscaling/models/create_threshold_policy_details.rb +166 -0
  20. data/lib/oci/autoscaling/models/instance_pool_resource.rb +148 -0
  21. data/lib/oci/autoscaling/models/metric.rb +186 -0
  22. data/lib/oci/autoscaling/models/resource.rb +177 -0
  23. data/lib/oci/autoscaling/models/threshold.rb +188 -0
  24. data/lib/oci/autoscaling/models/threshold_policy.rb +173 -0
  25. data/lib/oci/autoscaling/models/update_auto_scaling_configuration_details.rb +219 -0
  26. data/lib/oci/autoscaling/models/update_auto_scaling_policy_details.rb +194 -0
  27. data/lib/oci/autoscaling/models/update_condition_details.rb +176 -0
  28. data/lib/oci/autoscaling/models/update_threshold_policy_details.rb +164 -0
  29. data/lib/oci/autoscaling/util.rb +2 -0
  30. data/lib/oci/core/blockstorage_client.rb +1 -1
  31. data/lib/oci/core/compute_client.rb +1 -1
  32. data/lib/oci/core/compute_management_client.rb +135 -1
  33. data/lib/oci/core/compute_management_client_composite_operations.rb +80 -0
  34. data/lib/oci/core/core.rb +8 -0
  35. data/lib/oci/core/models/attach_load_balancer_details.rb +191 -0
  36. data/lib/oci/core/models/create_instance_pool_details.rb +19 -4
  37. data/lib/oci/core/models/detach_load_balancer_details.rb +167 -0
  38. data/lib/oci/core/models/image.rb +14 -1
  39. data/lib/oci/core/models/instance.rb +18 -2
  40. data/lib/oci/core/models/instance_agent_config.rb +154 -0
  41. data/lib/oci/core/models/instance_agent_features.rb +154 -0
  42. data/lib/oci/core/models/instance_pool.rb +19 -4
  43. data/lib/oci/core/models/instance_pool_instance_load_balancer_backend.rb +219 -0
  44. data/lib/oci/core/models/instance_pool_load_balancer_attachment.rb +253 -0
  45. data/lib/oci/core/models/instance_summary.rb +19 -4
  46. data/lib/oci/core/models/launch_instance_agent_config_details.rb +155 -0
  47. data/lib/oci/core/models/launch_instance_details.rb +14 -1
  48. data/lib/oci/core/models/update_instance_agent_config_details.rb +154 -0
  49. data/lib/oci/core/models/update_instance_details.rb +16 -1
  50. data/lib/oci/core/virtual_network_client.rb +1 -1
  51. data/lib/oci/database/database_client.rb +12 -14
  52. data/lib/oci/database/models/autonomous_data_warehouse_connection_strings.rb +3 -1
  53. data/lib/oci/database/models/autonomous_database_connection_strings.rb +3 -1
  54. data/lib/oci/database/models/create_data_guard_association_details.rb +2 -7
  55. data/lib/oci/database/models/create_data_guard_association_to_existing_db_system_details.rb +5 -1
  56. data/lib/oci/database/models/create_data_guard_association_with_new_db_system_details.rb +4 -1
  57. data/lib/oci/database/models/database_summary.rb +1 -1
  58. data/lib/oci/database/models/db_node.rb +15 -1
  59. data/lib/oci/database/models/db_node_summary.rb +15 -1
  60. data/lib/oci/database/models/db_system.rb +15 -1
  61. data/lib/oci/database/models/db_system_summary.rb +15 -1
  62. data/lib/oci/database/models/db_version_summary.rb +1 -1
  63. data/lib/oci/database/models/launch_db_system_base.rb +33 -2
  64. data/lib/oci/database/models/launch_db_system_details.rb +5 -1
  65. data/lib/oci/database/models/launch_db_system_from_backup_details.rb +5 -1
  66. data/lib/oci/database/models/update_db_system_details.rb +1 -1
  67. data/lib/oci/identity/identity.rb +4 -0
  68. data/lib/oci/identity/identity_client.rb +468 -12
  69. data/lib/oci/identity/identity_client_composite_operations.rb +79 -0
  70. data/lib/oci/identity/models/change_tag_namespace_compartment_detail.rb +154 -0
  71. data/lib/oci/identity/models/create_identity_provider_details.rb +2 -1
  72. data/lib/oci/identity/models/mfa_totp_device.rb +279 -0
  73. data/lib/oci/identity/models/mfa_totp_device_summary.rb +267 -0
  74. data/lib/oci/identity/models/mfa_totp_token.rb +155 -0
  75. data/lib/oci/identity/models/tag_namespace_summary.rb +1 -1
  76. data/lib/oci/identity/models/user.rb +18 -4
  77. data/lib/oci/monitoring/models/aggregated_datapoint.rb +166 -0
  78. data/lib/oci/monitoring/models/alarm.rb +538 -0
  79. data/lib/oci/monitoring/models/alarm_history_collection.rb +183 -0
  80. data/lib/oci/monitoring/models/alarm_history_entry.rb +187 -0
  81. data/lib/oci/monitoring/models/alarm_status_summary.rb +277 -0
  82. data/lib/oci/monitoring/models/alarm_summary.rb +386 -0
  83. data/lib/oci/monitoring/models/create_alarm_details.rb +423 -0
  84. data/lib/oci/monitoring/models/datapoint.rb +179 -0
  85. data/lib/oci/monitoring/models/failed_metric_record.rb +166 -0
  86. data/lib/oci/monitoring/models/list_metrics_details.rb +271 -0
  87. data/lib/oci/monitoring/models/metric.rb +197 -0
  88. data/lib/oci/monitoring/models/metric_data.rb +243 -0
  89. data/lib/oci/monitoring/models/metric_data_details.rb +227 -0
  90. data/lib/oci/monitoring/models/post_metric_data_details.rb +194 -0
  91. data/lib/oci/monitoring/models/post_metric_data_response_details.rb +170 -0
  92. data/lib/oci/monitoring/models/summarize_metrics_data_details.rb +229 -0
  93. data/lib/oci/monitoring/models/suppression.rb +196 -0
  94. data/lib/oci/monitoring/models/update_alarm_details.rb +423 -0
  95. data/lib/oci/monitoring/monitoring.rb +37 -0
  96. data/lib/oci/monitoring/monitoring_client.rb +923 -0
  97. data/lib/oci/monitoring/monitoring_client_composite_operations.rb +145 -0
  98. data/lib/oci/monitoring/util.rb +2 -0
  99. data/lib/oci/ons/models/backoff_retry_policy.rb +192 -0
  100. data/lib/oci/ons/models/confirmation_result.rb +221 -0
  101. data/lib/oci/ons/models/create_subscription_details.rb +238 -0
  102. data/lib/oci/ons/models/create_topic_details.rb +209 -0
  103. data/lib/oci/ons/models/delivery_policy.rb +153 -0
  104. data/lib/oci/ons/models/message_details.rb +163 -0
  105. data/lib/oci/ons/models/notification_topic.rb +302 -0
  106. data/lib/oci/ons/models/notification_topic_summary.rb +303 -0
  107. data/lib/oci/ons/models/publish_result.rb +168 -0
  108. data/lib/oci/ons/models/subscription.rb +273 -0
  109. data/lib/oci/ons/models/subscription_summary.rb +300 -0
  110. data/lib/oci/ons/models/topic_attributes_details.rb +184 -0
  111. data/lib/oci/ons/models/update_subscription_details.rb +188 -0
  112. data/lib/oci/ons/notification_control_plane_client.rb +463 -0
  113. data/lib/oci/ons/notification_control_plane_client_composite_operations.rb +24 -0
  114. data/lib/oci/ons/notification_data_plane_client.rb +680 -0
  115. data/lib/oci/ons/notification_data_plane_client_composite_operations.rb +104 -0
  116. data/lib/oci/ons/ons.rb +33 -0
  117. data/lib/oci/ons/util.rb +2 -0
  118. data/lib/oci/regions.rb +5 -0
  119. data/lib/oci/resource_manager/models/apply_job_plan_resolution.rb +189 -0
  120. data/lib/oci/resource_manager/models/config_source.rb +208 -0
  121. data/lib/oci/resource_manager/models/create_config_source_details.rb +187 -0
  122. data/lib/oci/resource_manager/models/create_job_details.rb +225 -0
  123. data/lib/oci/resource_manager/models/create_stack_details.rb +239 -0
  124. data/lib/oci/resource_manager/models/create_zip_upload_config_source_details.rb +166 -0
  125. data/lib/oci/resource_manager/models/failure_details.rb +185 -0
  126. data/lib/oci/resource_manager/models/job.rb +399 -0
  127. data/lib/oci/resource_manager/models/job_summary.rb +311 -0
  128. data/lib/oci/resource_manager/models/log_entry.rb +225 -0
  129. data/lib/oci/resource_manager/models/stack.rb +305 -0
  130. data/lib/oci/resource_manager/models/stack_summary.rb +249 -0
  131. data/lib/oci/resource_manager/models/update_config_source_details.rb +184 -0
  132. data/lib/oci/resource_manager/models/update_job_details.rb +188 -0
  133. data/lib/oci/resource_manager/models/update_stack_details.rb +225 -0
  134. data/lib/oci/resource_manager/models/update_zip_upload_config_source_details.rb +164 -0
  135. data/lib/oci/resource_manager/models/zip_upload_config_source.rb +149 -0
  136. data/lib/oci/resource_manager/resource_manager.rb +36 -0
  137. data/lib/oci/resource_manager/resource_manager_client.rb +1264 -0
  138. data/lib/oci/resource_manager/resource_manager_client_composite_operations.rb +263 -0
  139. data/lib/oci/resource_manager/util.rb +2 -0
  140. data/lib/oci/version.rb +1 -1
  141. metadata +100 -2
@@ -0,0 +1,234 @@
1
+ # Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
2
+
3
+ require 'date'
4
+
5
+ # rubocop:disable Lint/UnneededCopDisableDirective
6
+ module OCI
7
+ # AutoScalingConfigurationSummary model.
8
+ class Autoscaling::Models::AutoScalingConfigurationSummary # rubocop:disable Metrics/LineLength
9
+ # **[Required]** The OCID of the compartment containing the AutoScalingConfiguration.
10
+ #
11
+ # @return [String]
12
+ attr_accessor :compartment_id
13
+
14
+ # A user-friendly name for the AutoScalingConfiguration. Does not have to be unique, and it's changeable.
15
+ # Avoid entering confidential information.
16
+ #
17
+ # @return [String]
18
+ attr_accessor :display_name
19
+
20
+ # **[Required]** The OCID of the AutoScalingConfiguration
21
+ # @return [String]
22
+ attr_accessor :id
23
+
24
+ # The minimum period of time between scaling actions. The default is 300 seconds.
25
+ #
26
+ # @return [Integer]
27
+ attr_accessor :cool_down_in_seconds
28
+
29
+ # If the AutoScalingConfiguration is enabled
30
+ # @return [BOOLEAN]
31
+ attr_accessor :is_enabled
32
+
33
+ # @return [OCI::Autoscaling::Models::Resource]
34
+ attr_accessor :resource
35
+
36
+ # **[Required]** The date and time the AutoScalingConfiguration was created, in the format defined by RFC3339.
37
+ # Example: `2016-08-25T21:10:29.600Z`
38
+ #
39
+ # @return [DateTime]
40
+ attr_accessor :time_created
41
+
42
+ # Attribute mapping from ruby-style variable name to JSON key.
43
+ def self.attribute_map
44
+ {
45
+ # rubocop:disable Style/SymbolLiteral
46
+ 'compartment_id': :'compartmentId',
47
+ 'display_name': :'displayName',
48
+ 'id': :'id',
49
+ 'cool_down_in_seconds': :'coolDownInSeconds',
50
+ 'is_enabled': :'isEnabled',
51
+ 'resource': :'resource',
52
+ 'time_created': :'timeCreated'
53
+ # rubocop:enable Style/SymbolLiteral
54
+ }
55
+ end
56
+
57
+ # Attribute type mapping.
58
+ def self.swagger_types
59
+ {
60
+ # rubocop:disable Style/SymbolLiteral
61
+ 'compartment_id': :'String',
62
+ 'display_name': :'String',
63
+ 'id': :'String',
64
+ 'cool_down_in_seconds': :'Integer',
65
+ 'is_enabled': :'BOOLEAN',
66
+ 'resource': :'OCI::Autoscaling::Models::Resource',
67
+ 'time_created': :'DateTime'
68
+ # rubocop:enable Style/SymbolLiteral
69
+ }
70
+ end
71
+
72
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
73
+ # rubocop:disable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
74
+
75
+
76
+ # Initializes the object
77
+ # @param [Hash] attributes Model attributes in the form of hash
78
+ # @option attributes [String] :compartment_id The value to assign to the {#compartment_id} property
79
+ # @option attributes [String] :display_name The value to assign to the {#display_name} property
80
+ # @option attributes [String] :id The value to assign to the {#id} property
81
+ # @option attributes [Integer] :cool_down_in_seconds The value to assign to the {#cool_down_in_seconds} property
82
+ # @option attributes [BOOLEAN] :is_enabled The value to assign to the {#is_enabled} property
83
+ # @option attributes [OCI::Autoscaling::Models::Resource] :resource The value to assign to the {#resource} property
84
+ # @option attributes [DateTime] :time_created The value to assign to the {#time_created} property
85
+ def initialize(attributes = {})
86
+ return unless attributes.is_a?(Hash)
87
+
88
+ # convert string to symbol for hash key
89
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
90
+
91
+ self.compartment_id = attributes[:'compartmentId'] if attributes[:'compartmentId']
92
+
93
+ raise 'You cannot provide both :compartmentId and :compartment_id' if attributes.key?(:'compartmentId') && attributes.key?(:'compartment_id')
94
+
95
+ self.compartment_id = attributes[:'compartment_id'] if attributes[:'compartment_id']
96
+
97
+ self.display_name = attributes[:'displayName'] if attributes[:'displayName']
98
+
99
+ raise 'You cannot provide both :displayName and :display_name' if attributes.key?(:'displayName') && attributes.key?(:'display_name')
100
+
101
+ self.display_name = attributes[:'display_name'] if attributes[:'display_name']
102
+
103
+ self.id = attributes[:'id'] if attributes[:'id']
104
+
105
+ self.cool_down_in_seconds = attributes[:'coolDownInSeconds'] if attributes[:'coolDownInSeconds']
106
+
107
+ raise 'You cannot provide both :coolDownInSeconds and :cool_down_in_seconds' if attributes.key?(:'coolDownInSeconds') && attributes.key?(:'cool_down_in_seconds')
108
+
109
+ self.cool_down_in_seconds = attributes[:'cool_down_in_seconds'] if attributes[:'cool_down_in_seconds']
110
+
111
+ self.is_enabled = attributes[:'isEnabled'] unless attributes[:'isEnabled'].nil?
112
+
113
+ raise 'You cannot provide both :isEnabled and :is_enabled' if attributes.key?(:'isEnabled') && attributes.key?(:'is_enabled')
114
+
115
+ self.is_enabled = attributes[:'is_enabled'] unless attributes[:'is_enabled'].nil?
116
+
117
+ self.resource = attributes[:'resource'] if attributes[:'resource']
118
+
119
+ self.time_created = attributes[:'timeCreated'] if attributes[:'timeCreated']
120
+
121
+ raise 'You cannot provide both :timeCreated and :time_created' if attributes.key?(:'timeCreated') && attributes.key?(:'time_created')
122
+
123
+ self.time_created = attributes[:'time_created'] if attributes[:'time_created']
124
+ end
125
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
126
+ # rubocop:enable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
127
+
128
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Metrics/LineLength, Layout/EmptyLines
129
+
130
+
131
+ # Checks equality by comparing each attribute.
132
+ # @param [Object] other the other object to be compared
133
+ def ==(other)
134
+ return true if equal?(other)
135
+
136
+ self.class == other.class &&
137
+ compartment_id == other.compartment_id &&
138
+ display_name == other.display_name &&
139
+ id == other.id &&
140
+ cool_down_in_seconds == other.cool_down_in_seconds &&
141
+ is_enabled == other.is_enabled &&
142
+ resource == other.resource &&
143
+ time_created == other.time_created
144
+ end
145
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Metrics/LineLength, Layout/EmptyLines
146
+
147
+ # @see the `==` method
148
+ # @param [Object] other the other object to be compared
149
+ def eql?(other)
150
+ self == other
151
+ end
152
+
153
+ # rubocop:disable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
154
+
155
+
156
+ # Calculates hash code according to all attributes.
157
+ # @return [Fixnum] Hash code
158
+ def hash
159
+ [compartment_id, display_name, id, cool_down_in_seconds, is_enabled, resource, time_created].hash
160
+ end
161
+ # rubocop:enable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
162
+
163
+ # rubocop:disable Metrics/AbcSize, Layout/EmptyLines
164
+
165
+
166
+ # Builds the object from hash
167
+ # @param [Hash] attributes Model attributes in the form of hash
168
+ # @return [Object] Returns the model itself
169
+ def build_from_hash(attributes)
170
+ return nil unless attributes.is_a?(Hash)
171
+
172
+ self.class.swagger_types.each_pair do |key, type|
173
+ if type =~ /^Array<(.*)>/i
174
+ # check to ensure the input is an array given that the the attribute
175
+ # is documented as an array but the input is not
176
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
177
+ public_method("#{key}=").call(
178
+ attributes[self.class.attribute_map[key]]
179
+ .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
180
+ )
181
+ end
182
+ elsif !attributes[self.class.attribute_map[key]].nil?
183
+ public_method("#{key}=").call(
184
+ OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
185
+ )
186
+ end
187
+ # or else data not found in attributes(hash), not an issue as the data can be optional
188
+ end
189
+
190
+ self
191
+ end
192
+ # rubocop:enable Metrics/AbcSize, Layout/EmptyLines
193
+
194
+ # Returns the string representation of the object
195
+ # @return [String] String presentation of the object
196
+ def to_s
197
+ to_hash.to_s
198
+ end
199
+
200
+ # Returns the object in the form of hash
201
+ # @return [Hash] Returns the object in the form of hash
202
+ def to_hash
203
+ hash = {}
204
+ self.class.attribute_map.each_pair do |attr, param|
205
+ value = public_method(attr).call
206
+ next if value.nil? && !instance_variable_defined?("@#{attr}")
207
+
208
+ hash[param] = _to_hash(value)
209
+ end
210
+ hash
211
+ end
212
+
213
+ private
214
+
215
+ # Outputs non-array value in the form of hash
216
+ # For object, use to_hash. Otherwise, just return the value
217
+ # @param [Object] value Any valid value
218
+ # @return [Hash] Returns the value in the form of hash
219
+ def _to_hash(value)
220
+ if value.is_a?(Array)
221
+ value.compact.map { |v| _to_hash(v) }
222
+ elsif value.is_a?(Hash)
223
+ {}.tap do |hash|
224
+ value.each { |k, v| hash[k] = _to_hash(v) }
225
+ end
226
+ elsif value.respond_to? :to_hash
227
+ value.to_hash
228
+ else
229
+ value
230
+ end
231
+ end
232
+ end
233
+ end
234
+ # rubocop:enable Lint/UnneededCopDisableDirective
@@ -0,0 +1,222 @@
1
+ # Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
2
+
3
+ require 'date'
4
+
5
+ # rubocop:disable Lint/UnneededCopDisableDirective
6
+ module OCI
7
+ # A Policy defines the rules and actions of an AutoScalingConfiguration. The only supported type is 'threshold'
8
+ #
9
+ # This class has direct subclasses. If you are using this class as input to a service operations then you should favor using a subclass over the base class
10
+ class Autoscaling::Models::AutoScalingPolicy # rubocop:disable Metrics/LineLength
11
+ # **[Required]** The capacity requirements of the Policy
12
+ # @return [OCI::Autoscaling::Models::Capacity]
13
+ attr_accessor :capacity
14
+
15
+ # The ID of the policy that is assigned after creation
16
+ # @return [String]
17
+ attr_accessor :id
18
+
19
+ # A user-friendly name for the Policy. Does not have to be unique, and it's changeable. Avoid entering
20
+ # confidential information.
21
+ #
22
+ # @return [String]
23
+ attr_accessor :display_name
24
+
25
+ # **[Required]** Indicates type of Policy
26
+ # @return [String]
27
+ attr_accessor :policy_type
28
+
29
+ # **[Required]** The date and time the AutoScalingConfiguration was created, in the format defined by RFC3339.
30
+ # Example: `2016-08-25T21:10:29.600Z`
31
+ #
32
+ # @return [DateTime]
33
+ attr_accessor :time_created
34
+
35
+ # Attribute mapping from ruby-style variable name to JSON key.
36
+ def self.attribute_map
37
+ {
38
+ # rubocop:disable Style/SymbolLiteral
39
+ 'capacity': :'capacity',
40
+ 'id': :'id',
41
+ 'display_name': :'displayName',
42
+ 'policy_type': :'policyType',
43
+ 'time_created': :'timeCreated'
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
+ 'capacity': :'OCI::Autoscaling::Models::Capacity',
53
+ 'id': :'String',
54
+ 'display_name': :'String',
55
+ 'policy_type': :'String',
56
+ 'time_created': :'DateTime'
57
+ # rubocop:enable Style/SymbolLiteral
58
+ }
59
+ end
60
+
61
+ # rubocop:disable Metrics/CyclomaticComplexity, Layout/EmptyLines
62
+
63
+
64
+ # Given the hash representation of a subtype of this class,
65
+ # use the info in the hash to return the class of the subtype.
66
+ def self.get_subtype(object_hash)
67
+ type = object_hash[:'policyType'] # rubocop:disable Style/SymbolLiteral
68
+
69
+ return 'OCI::Autoscaling::Models::ThresholdPolicy' if type == 'threshold'
70
+
71
+ # TODO: Log a warning when the subtype is not found.
72
+ 'OCI::Autoscaling::Models::AutoScalingPolicy'
73
+ end
74
+ # rubocop:enable Metrics/CyclomaticComplexity, Layout/EmptyLines
75
+
76
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
77
+ # rubocop:disable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
78
+
79
+
80
+ # Initializes the object
81
+ # @param [Hash] attributes Model attributes in the form of hash
82
+ # @option attributes [OCI::Autoscaling::Models::Capacity] :capacity The value to assign to the {#capacity} property
83
+ # @option attributes [String] :id The value to assign to the {#id} property
84
+ # @option attributes [String] :display_name The value to assign to the {#display_name} property
85
+ # @option attributes [String] :policy_type The value to assign to the {#policy_type} property
86
+ # @option attributes [DateTime] :time_created The value to assign to the {#time_created} property
87
+ def initialize(attributes = {})
88
+ return unless attributes.is_a?(Hash)
89
+
90
+ # convert string to symbol for hash key
91
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
92
+
93
+ self.capacity = attributes[:'capacity'] if attributes[:'capacity']
94
+
95
+ self.id = attributes[:'id'] if attributes[:'id']
96
+
97
+ self.display_name = attributes[:'displayName'] if attributes[:'displayName']
98
+
99
+ raise 'You cannot provide both :displayName and :display_name' if attributes.key?(:'displayName') && attributes.key?(:'display_name')
100
+
101
+ self.display_name = attributes[:'display_name'] if attributes[:'display_name']
102
+
103
+ self.policy_type = attributes[:'policyType'] if attributes[:'policyType']
104
+
105
+ raise 'You cannot provide both :policyType and :policy_type' if attributes.key?(:'policyType') && attributes.key?(:'policy_type')
106
+
107
+ self.policy_type = attributes[:'policy_type'] if attributes[:'policy_type']
108
+
109
+ self.time_created = attributes[:'timeCreated'] if attributes[:'timeCreated']
110
+
111
+ raise 'You cannot provide both :timeCreated and :time_created' if attributes.key?(:'timeCreated') && attributes.key?(:'time_created')
112
+
113
+ self.time_created = attributes[:'time_created'] if attributes[:'time_created']
114
+ end
115
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
116
+ # rubocop:enable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
117
+
118
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Metrics/LineLength, Layout/EmptyLines
119
+
120
+
121
+ # Checks equality by comparing each attribute.
122
+ # @param [Object] other the other object to be compared
123
+ def ==(other)
124
+ return true if equal?(other)
125
+
126
+ self.class == other.class &&
127
+ capacity == other.capacity &&
128
+ id == other.id &&
129
+ display_name == other.display_name &&
130
+ policy_type == other.policy_type &&
131
+ time_created == other.time_created
132
+ end
133
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Metrics/LineLength, Layout/EmptyLines
134
+
135
+ # @see the `==` method
136
+ # @param [Object] other the other object to be compared
137
+ def eql?(other)
138
+ self == other
139
+ end
140
+
141
+ # rubocop:disable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
142
+
143
+
144
+ # Calculates hash code according to all attributes.
145
+ # @return [Fixnum] Hash code
146
+ def hash
147
+ [capacity, id, display_name, policy_type, time_created].hash
148
+ end
149
+ # rubocop:enable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
150
+
151
+ # rubocop:disable Metrics/AbcSize, Layout/EmptyLines
152
+
153
+
154
+ # Builds the object from hash
155
+ # @param [Hash] attributes Model attributes in the form of hash
156
+ # @return [Object] Returns the model itself
157
+ def build_from_hash(attributes)
158
+ return nil unless attributes.is_a?(Hash)
159
+
160
+ self.class.swagger_types.each_pair do |key, type|
161
+ if type =~ /^Array<(.*)>/i
162
+ # check to ensure the input is an array given that the the attribute
163
+ # is documented as an array but the input is not
164
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
165
+ public_method("#{key}=").call(
166
+ attributes[self.class.attribute_map[key]]
167
+ .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
168
+ )
169
+ end
170
+ elsif !attributes[self.class.attribute_map[key]].nil?
171
+ public_method("#{key}=").call(
172
+ OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
173
+ )
174
+ end
175
+ # or else data not found in attributes(hash), not an issue as the data can be optional
176
+ end
177
+
178
+ self
179
+ end
180
+ # rubocop:enable Metrics/AbcSize, Layout/EmptyLines
181
+
182
+ # Returns the string representation of the object
183
+ # @return [String] String presentation of the object
184
+ def to_s
185
+ to_hash.to_s
186
+ end
187
+
188
+ # Returns the object in the form of hash
189
+ # @return [Hash] Returns the object in the form of hash
190
+ def to_hash
191
+ hash = {}
192
+ self.class.attribute_map.each_pair do |attr, param|
193
+ value = public_method(attr).call
194
+ next if value.nil? && !instance_variable_defined?("@#{attr}")
195
+
196
+ hash[param] = _to_hash(value)
197
+ end
198
+ hash
199
+ end
200
+
201
+ private
202
+
203
+ # Outputs non-array value in the form of hash
204
+ # For object, use to_hash. Otherwise, just return the value
205
+ # @param [Object] value Any valid value
206
+ # @return [Hash] Returns the value in the form of hash
207
+ def _to_hash(value)
208
+ if value.is_a?(Array)
209
+ value.compact.map { |v| _to_hash(v) }
210
+ elsif value.is_a?(Hash)
211
+ {}.tap do |hash|
212
+ value.each { |k, v| hash[k] = _to_hash(v) }
213
+ end
214
+ elsif value.respond_to? :to_hash
215
+ value.to_hash
216
+ else
217
+ value
218
+ end
219
+ end
220
+ end
221
+ end
222
+ # rubocop:enable Lint/UnneededCopDisableDirective