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,256 @@
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
+ # An AutoScalingConfiguration creation details
8
+ #
9
+ class Autoscaling::Models::CreateAutoScalingConfigurationDetails # rubocop:disable Metrics/LineLength
10
+ # **[Required]** The OCID of the compartment containing the AutoScalingConfiguration.
11
+ #
12
+ # @return [String]
13
+ attr_accessor :compartment_id
14
+
15
+ # Defined tags for this resource. Each key is predefined and scoped to a
16
+ # namespace. For more information, see [Resource Tags](https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm).
17
+ #
18
+ # Example: `{\"Operations\": {\"CostCenter\": \"42\"}}`
19
+ #
20
+ # @return [Hash<String, Hash<String, Object>>]
21
+ attr_accessor :defined_tags
22
+
23
+ # A user-friendly name for the AutoScalingConfiguration. Does not have to be unique, and it's changeable.
24
+ # Avoid entering confidential information.
25
+ #
26
+ # @return [String]
27
+ attr_accessor :display_name
28
+
29
+ # Free-form tags for this resource. Each tag is a simple key-value pair with no
30
+ # predefined name, type, or namespace. For more information, see [Resource Tags](https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm).
31
+ #
32
+ # Example: `{\"Department\": \"Finance\"}`
33
+ #
34
+ # @return [Hash<String, String>]
35
+ attr_accessor :freeform_tags
36
+
37
+ # The minimum period of time between scaling actions. The default is 300 seconds.
38
+ #
39
+ # @return [Integer]
40
+ attr_accessor :cool_down_in_seconds
41
+
42
+ # If the AutoScalingConfiguration is enabled
43
+ # @return [BOOLEAN]
44
+ attr_accessor :is_enabled
45
+
46
+ # This attribute is required.
47
+ # @return [Array<OCI::Autoscaling::Models::CreateAutoScalingPolicyDetails>]
48
+ attr_accessor :policies
49
+
50
+ # This attribute is required.
51
+ # @return [OCI::Autoscaling::Models::Resource]
52
+ attr_accessor :resource
53
+
54
+ # Attribute mapping from ruby-style variable name to JSON key.
55
+ def self.attribute_map
56
+ {
57
+ # rubocop:disable Style/SymbolLiteral
58
+ 'compartment_id': :'compartmentId',
59
+ 'defined_tags': :'definedTags',
60
+ 'display_name': :'displayName',
61
+ 'freeform_tags': :'freeformTags',
62
+ 'cool_down_in_seconds': :'coolDownInSeconds',
63
+ 'is_enabled': :'isEnabled',
64
+ 'policies': :'policies',
65
+ 'resource': :'resource'
66
+ # rubocop:enable Style/SymbolLiteral
67
+ }
68
+ end
69
+
70
+ # Attribute type mapping.
71
+ def self.swagger_types
72
+ {
73
+ # rubocop:disable Style/SymbolLiteral
74
+ 'compartment_id': :'String',
75
+ 'defined_tags': :'Hash<String, Hash<String, Object>>',
76
+ 'display_name': :'String',
77
+ 'freeform_tags': :'Hash<String, String>',
78
+ 'cool_down_in_seconds': :'Integer',
79
+ 'is_enabled': :'BOOLEAN',
80
+ 'policies': :'Array<OCI::Autoscaling::Models::CreateAutoScalingPolicyDetails>',
81
+ 'resource': :'OCI::Autoscaling::Models::Resource'
82
+ # rubocop:enable Style/SymbolLiteral
83
+ }
84
+ end
85
+
86
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
87
+ # rubocop:disable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
88
+
89
+
90
+ # Initializes the object
91
+ # @param [Hash] attributes Model attributes in the form of hash
92
+ # @option attributes [String] :compartment_id The value to assign to the {#compartment_id} property
93
+ # @option attributes [Hash<String, Hash<String, Object>>] :defined_tags The value to assign to the {#defined_tags} property
94
+ # @option attributes [String] :display_name The value to assign to the {#display_name} property
95
+ # @option attributes [Hash<String, String>] :freeform_tags The value to assign to the {#freeform_tags} property
96
+ # @option attributes [Integer] :cool_down_in_seconds The value to assign to the {#cool_down_in_seconds} property
97
+ # @option attributes [BOOLEAN] :is_enabled The value to assign to the {#is_enabled} property
98
+ # @option attributes [Array<OCI::Autoscaling::Models::CreateAutoScalingPolicyDetails>] :policies The value to assign to the {#policies} property
99
+ # @option attributes [OCI::Autoscaling::Models::Resource] :resource The value to assign to the {#resource} property
100
+ def initialize(attributes = {})
101
+ return unless attributes.is_a?(Hash)
102
+
103
+ # convert string to symbol for hash key
104
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
105
+
106
+ self.compartment_id = attributes[:'compartmentId'] if attributes[:'compartmentId']
107
+
108
+ raise 'You cannot provide both :compartmentId and :compartment_id' if attributes.key?(:'compartmentId') && attributes.key?(:'compartment_id')
109
+
110
+ self.compartment_id = attributes[:'compartment_id'] if attributes[:'compartment_id']
111
+
112
+ self.defined_tags = attributes[:'definedTags'] if attributes[:'definedTags']
113
+
114
+ raise 'You cannot provide both :definedTags and :defined_tags' if attributes.key?(:'definedTags') && attributes.key?(:'defined_tags')
115
+
116
+ self.defined_tags = attributes[:'defined_tags'] if attributes[:'defined_tags']
117
+
118
+ self.display_name = attributes[:'displayName'] if attributes[:'displayName']
119
+
120
+ raise 'You cannot provide both :displayName and :display_name' if attributes.key?(:'displayName') && attributes.key?(:'display_name')
121
+
122
+ self.display_name = attributes[:'display_name'] if attributes[:'display_name']
123
+
124
+ self.freeform_tags = attributes[:'freeformTags'] if attributes[:'freeformTags']
125
+
126
+ raise 'You cannot provide both :freeformTags and :freeform_tags' if attributes.key?(:'freeformTags') && attributes.key?(:'freeform_tags')
127
+
128
+ self.freeform_tags = attributes[:'freeform_tags'] if attributes[:'freeform_tags']
129
+
130
+ self.cool_down_in_seconds = attributes[:'coolDownInSeconds'] if attributes[:'coolDownInSeconds']
131
+
132
+ raise 'You cannot provide both :coolDownInSeconds and :cool_down_in_seconds' if attributes.key?(:'coolDownInSeconds') && attributes.key?(:'cool_down_in_seconds')
133
+
134
+ self.cool_down_in_seconds = attributes[:'cool_down_in_seconds'] if attributes[:'cool_down_in_seconds']
135
+
136
+ self.is_enabled = attributes[:'isEnabled'] unless attributes[:'isEnabled'].nil?
137
+
138
+ raise 'You cannot provide both :isEnabled and :is_enabled' if attributes.key?(:'isEnabled') && attributes.key?(:'is_enabled')
139
+
140
+ self.is_enabled = attributes[:'is_enabled'] unless attributes[:'is_enabled'].nil?
141
+
142
+ self.policies = attributes[:'policies'] if attributes[:'policies']
143
+
144
+ self.resource = attributes[:'resource'] if attributes[:'resource']
145
+ end
146
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
147
+ # rubocop:enable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
148
+
149
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Metrics/LineLength, Layout/EmptyLines
150
+
151
+
152
+ # Checks equality by comparing each attribute.
153
+ # @param [Object] other the other object to be compared
154
+ def ==(other)
155
+ return true if equal?(other)
156
+
157
+ self.class == other.class &&
158
+ compartment_id == other.compartment_id &&
159
+ defined_tags == other.defined_tags &&
160
+ display_name == other.display_name &&
161
+ freeform_tags == other.freeform_tags &&
162
+ cool_down_in_seconds == other.cool_down_in_seconds &&
163
+ is_enabled == other.is_enabled &&
164
+ policies == other.policies &&
165
+ resource == other.resource
166
+ end
167
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Metrics/LineLength, Layout/EmptyLines
168
+
169
+ # @see the `==` method
170
+ # @param [Object] other the other object to be compared
171
+ def eql?(other)
172
+ self == other
173
+ end
174
+
175
+ # rubocop:disable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
176
+
177
+
178
+ # Calculates hash code according to all attributes.
179
+ # @return [Fixnum] Hash code
180
+ def hash
181
+ [compartment_id, defined_tags, display_name, freeform_tags, cool_down_in_seconds, is_enabled, policies, resource].hash
182
+ end
183
+ # rubocop:enable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
184
+
185
+ # rubocop:disable Metrics/AbcSize, Layout/EmptyLines
186
+
187
+
188
+ # Builds the object from hash
189
+ # @param [Hash] attributes Model attributes in the form of hash
190
+ # @return [Object] Returns the model itself
191
+ def build_from_hash(attributes)
192
+ return nil unless attributes.is_a?(Hash)
193
+
194
+ self.class.swagger_types.each_pair do |key, type|
195
+ if type =~ /^Array<(.*)>/i
196
+ # check to ensure the input is an array given that the the attribute
197
+ # is documented as an array but the input is not
198
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
199
+ public_method("#{key}=").call(
200
+ attributes[self.class.attribute_map[key]]
201
+ .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
202
+ )
203
+ end
204
+ elsif !attributes[self.class.attribute_map[key]].nil?
205
+ public_method("#{key}=").call(
206
+ OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
207
+ )
208
+ end
209
+ # or else data not found in attributes(hash), not an issue as the data can be optional
210
+ end
211
+
212
+ self
213
+ end
214
+ # rubocop:enable Metrics/AbcSize, Layout/EmptyLines
215
+
216
+ # Returns the string representation of the object
217
+ # @return [String] String presentation of the object
218
+ def to_s
219
+ to_hash.to_s
220
+ end
221
+
222
+ # Returns the object in the form of hash
223
+ # @return [Hash] Returns the object in the form of hash
224
+ def to_hash
225
+ hash = {}
226
+ self.class.attribute_map.each_pair do |attr, param|
227
+ value = public_method(attr).call
228
+ next if value.nil? && !instance_variable_defined?("@#{attr}")
229
+
230
+ hash[param] = _to_hash(value)
231
+ end
232
+ hash
233
+ end
234
+
235
+ private
236
+
237
+ # Outputs non-array value in the form of hash
238
+ # For object, use to_hash. Otherwise, just return the value
239
+ # @param [Object] value Any valid value
240
+ # @return [Hash] Returns the value in the form of hash
241
+ def _to_hash(value)
242
+ if value.is_a?(Array)
243
+ value.compact.map { |v| _to_hash(v) }
244
+ elsif value.is_a?(Hash)
245
+ {}.tap do |hash|
246
+ value.each { |k, v| hash[k] = _to_hash(v) }
247
+ end
248
+ elsif value.respond_to? :to_hash
249
+ value.to_hash
250
+ else
251
+ value
252
+ end
253
+ end
254
+ end
255
+ end
256
+ # rubocop:enable Lint/UnneededCopDisableDirective
@@ -0,0 +1,196 @@
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
+ # An AutoScalingConfiguration Policy creation details
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::CreateAutoScalingPolicyDetails # rubocop:disable Metrics/LineLength
11
+ # **[Required]** The capacity requirements of the Policy
12
+ # @return [OCI::Autoscaling::Models::Capacity]
13
+ attr_accessor :capacity
14
+
15
+ # A user-friendly name for the Policy. Does not have to be unique, and it's changeable. Avoid entering
16
+ # confidential information.
17
+ #
18
+ # @return [String]
19
+ attr_accessor :display_name
20
+
21
+ # **[Required]** Indicates type of Policy
22
+ # @return [String]
23
+ attr_accessor :policy_type
24
+
25
+ # Attribute mapping from ruby-style variable name to JSON key.
26
+ def self.attribute_map
27
+ {
28
+ # rubocop:disable Style/SymbolLiteral
29
+ 'capacity': :'capacity',
30
+ 'display_name': :'displayName',
31
+ 'policy_type': :'policyType'
32
+ # rubocop:enable Style/SymbolLiteral
33
+ }
34
+ end
35
+
36
+ # Attribute type mapping.
37
+ def self.swagger_types
38
+ {
39
+ # rubocop:disable Style/SymbolLiteral
40
+ 'capacity': :'OCI::Autoscaling::Models::Capacity',
41
+ 'display_name': :'String',
42
+ 'policy_type': :'String'
43
+ # rubocop:enable Style/SymbolLiteral
44
+ }
45
+ end
46
+
47
+ # rubocop:disable Metrics/CyclomaticComplexity, Layout/EmptyLines
48
+
49
+
50
+ # Given the hash representation of a subtype of this class,
51
+ # use the info in the hash to return the class of the subtype.
52
+ def self.get_subtype(object_hash)
53
+ type = object_hash[:'policyType'] # rubocop:disable Style/SymbolLiteral
54
+
55
+ return 'OCI::Autoscaling::Models::CreateThresholdPolicyDetails' if type == 'threshold'
56
+
57
+ # TODO: Log a warning when the subtype is not found.
58
+ 'OCI::Autoscaling::Models::CreateAutoScalingPolicyDetails'
59
+ end
60
+ # rubocop:enable Metrics/CyclomaticComplexity, Layout/EmptyLines
61
+
62
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
63
+ # rubocop:disable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
64
+
65
+
66
+ # Initializes the object
67
+ # @param [Hash] attributes Model attributes in the form of hash
68
+ # @option attributes [OCI::Autoscaling::Models::Capacity] :capacity The value to assign to the {#capacity} property
69
+ # @option attributes [String] :display_name The value to assign to the {#display_name} property
70
+ # @option attributes [String] :policy_type The value to assign to the {#policy_type} property
71
+ def initialize(attributes = {})
72
+ return unless attributes.is_a?(Hash)
73
+
74
+ # convert string to symbol for hash key
75
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
76
+
77
+ self.capacity = attributes[:'capacity'] if attributes[:'capacity']
78
+
79
+ self.display_name = attributes[:'displayName'] if attributes[:'displayName']
80
+
81
+ raise 'You cannot provide both :displayName and :display_name' if attributes.key?(:'displayName') && attributes.key?(:'display_name')
82
+
83
+ self.display_name = attributes[:'display_name'] if attributes[:'display_name']
84
+
85
+ self.policy_type = attributes[:'policyType'] if attributes[:'policyType']
86
+
87
+ raise 'You cannot provide both :policyType and :policy_type' if attributes.key?(:'policyType') && attributes.key?(:'policy_type')
88
+
89
+ self.policy_type = attributes[:'policy_type'] if attributes[:'policy_type']
90
+ end
91
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
92
+ # rubocop:enable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
93
+
94
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Metrics/LineLength, Layout/EmptyLines
95
+
96
+
97
+ # Checks equality by comparing each attribute.
98
+ # @param [Object] other the other object to be compared
99
+ def ==(other)
100
+ return true if equal?(other)
101
+
102
+ self.class == other.class &&
103
+ capacity == other.capacity &&
104
+ display_name == other.display_name &&
105
+ policy_type == other.policy_type
106
+ end
107
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Metrics/LineLength, Layout/EmptyLines
108
+
109
+ # @see the `==` method
110
+ # @param [Object] other the other object to be compared
111
+ def eql?(other)
112
+ self == other
113
+ end
114
+
115
+ # rubocop:disable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
116
+
117
+
118
+ # Calculates hash code according to all attributes.
119
+ # @return [Fixnum] Hash code
120
+ def hash
121
+ [capacity, display_name, policy_type].hash
122
+ end
123
+ # rubocop:enable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
124
+
125
+ # rubocop:disable Metrics/AbcSize, Layout/EmptyLines
126
+
127
+
128
+ # Builds the object from hash
129
+ # @param [Hash] attributes Model attributes in the form of hash
130
+ # @return [Object] Returns the model itself
131
+ def build_from_hash(attributes)
132
+ return nil unless attributes.is_a?(Hash)
133
+
134
+ self.class.swagger_types.each_pair do |key, type|
135
+ if type =~ /^Array<(.*)>/i
136
+ # check to ensure the input is an array given that the the attribute
137
+ # is documented as an array but the input is not
138
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
139
+ public_method("#{key}=").call(
140
+ attributes[self.class.attribute_map[key]]
141
+ .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
142
+ )
143
+ end
144
+ elsif !attributes[self.class.attribute_map[key]].nil?
145
+ public_method("#{key}=").call(
146
+ OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
147
+ )
148
+ end
149
+ # or else data not found in attributes(hash), not an issue as the data can be optional
150
+ end
151
+
152
+ self
153
+ end
154
+ # rubocop:enable Metrics/AbcSize, Layout/EmptyLines
155
+
156
+ # Returns the string representation of the object
157
+ # @return [String] String presentation of the object
158
+ def to_s
159
+ to_hash.to_s
160
+ end
161
+
162
+ # Returns the object in the form of hash
163
+ # @return [Hash] Returns the object in the form of hash
164
+ def to_hash
165
+ hash = {}
166
+ self.class.attribute_map.each_pair do |attr, param|
167
+ value = public_method(attr).call
168
+ next if value.nil? && !instance_variable_defined?("@#{attr}")
169
+
170
+ hash[param] = _to_hash(value)
171
+ end
172
+ hash
173
+ end
174
+
175
+ private
176
+
177
+ # Outputs non-array value in the form of hash
178
+ # For object, use to_hash. Otherwise, just return the value
179
+ # @param [Object] value Any valid value
180
+ # @return [Hash] Returns the value in the form of hash
181
+ def _to_hash(value)
182
+ if value.is_a?(Array)
183
+ value.compact.map { |v| _to_hash(v) }
184
+ elsif value.is_a?(Hash)
185
+ {}.tap do |hash|
186
+ value.each { |k, v| hash[k] = _to_hash(v) }
187
+ end
188
+ elsif value.respond_to? :to_hash
189
+ value.to_hash
190
+ else
191
+ value
192
+ end
193
+ end
194
+ end
195
+ end
196
+ # rubocop:enable Lint/UnneededCopDisableDirective