oci 2.5.0 → 2.5.1

Sign up to get free protection for your applications and to get access to all the features.
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,386 @@
1
+ # Copyright (c) 2016, 2019, 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
+ # A summary of properties for the specified alarm.
9
+ # For information about alarms, see [Alarms Overview](https://docs.us-phoenix-1.oraclecloud.com/iaas/Content/Monitoring/Concepts/monitoringoverview.htm#AlarmsOverview).
10
+ #
11
+ # To use any of the API operations, you must be authorized in an IAM policy. If you're not authorized,
12
+ # talk to an administrator. If you're an administrator who needs to write policies to give users access, see
13
+ # [Getting Started with Policies](https://docs.us-phoenix-1.oraclecloud.com/iaas/Content/Identity/Concepts/policygetstarted.htm).
14
+ #
15
+ # For information about endpoints and signing API requests, see
16
+ # [About the API](https://docs.us-phoenix-1.oraclecloud.com/iaas/Content/API/Concepts/usingapi.htm). For information about available SDKs and tools, see
17
+ # [SDKS and Other Tools](https://docs.us-phoenix-1.oraclecloud.com/iaas/Content/API/Concepts/sdks.htm).
18
+ #
19
+ class Monitoring::Models::AlarmSummary # rubocop:disable Metrics/LineLength
20
+ SEVERITY_ENUM = [
21
+ SEVERITY_CRITICAL = 'CRITICAL'.freeze,
22
+ SEVERITY_ERROR = 'ERROR'.freeze,
23
+ SEVERITY_WARNING = 'WARNING'.freeze,
24
+ SEVERITY_INFO = 'INFO'.freeze,
25
+ SEVERITY_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
26
+ ].freeze
27
+
28
+ # **[Required]** The [OCID](https://docs.us-phoenix-1.oraclecloud.com/iaas/Content/General/Concepts/identifiers.htm) of the alarm.
29
+ #
30
+ # @return [String]
31
+ attr_accessor :id
32
+
33
+ # **[Required]** A user-friendly name for the alarm. It does not have to be unique, and it's changeable.
34
+ # Avoid entering confidential information.
35
+ #
36
+ # This name is sent as the title for notifications related to this alarm.
37
+ #
38
+ # Example: `High CPU Utilization`
39
+ #
40
+ # @return [String]
41
+ attr_accessor :display_name
42
+
43
+ # **[Required]** The [OCID](https://docs.us-phoenix-1.oraclecloud.com/iaas/Content/General/Concepts/identifiers.htm) of the compartment containing the alarm.
44
+ #
45
+ # @return [String]
46
+ attr_accessor :compartment_id
47
+
48
+ # **[Required]** The [OCID](https://docs.us-phoenix-1.oraclecloud.com/iaas/Content/General/Concepts/identifiers.htm) of the compartment containing the metric
49
+ # being evaluated by the alarm.
50
+ #
51
+ # @return [String]
52
+ attr_accessor :metric_compartment_id
53
+
54
+ # **[Required]** The source service or application emitting the metric that is evaluated by the alarm.
55
+ #
56
+ # Example: `oci_computeagent`
57
+ #
58
+ # @return [String]
59
+ attr_accessor :namespace
60
+
61
+ # **[Required]** The Monitoring Query Language (MQL) expression to evaluate for the alarm. The Alarms feature of
62
+ # the Monitoring service interprets results for each returned time series as Boolean values,
63
+ # where zero represents false and a non-zero value represents true. A true value means that the trigger
64
+ # rule condition has been met. The query must specify a metric, statistic, interval, and trigger
65
+ # rule (threshold or absence). Supported values for interval: `1m`-`60m` (also `1h`). You can optionally
66
+ # specify dimensions and grouping functions. Supported grouping functions: `grouping()`, `groupBy()`.
67
+ # For details about Monitoring Query Language (MQL), see [Monitoring Query Language (MQL) Reference](https://docs.us-phoenix-1.oraclecloud.com/iaas/Content/Monitoring/Reference/mql.htm).
68
+ # For available dimensions, review the metric definition for the supported service.
69
+ # See [Supported Services](https://docs.us-phoenix-1.oraclecloud.com/iaas/Content/Monitoring/Concepts/monitoringoverview.htm#SupportedServices).
70
+ #
71
+ # Example of threshold alarm:
72
+ #
73
+ # -----
74
+ #
75
+ # CpuUtilization[1m]{availabilityDomain=\"cumS:PHX-AD-1\"}.groupBy(availabilityDomain).percentile(0.9) > 85
76
+ #
77
+ # -----
78
+ #
79
+ # Example of absence alarm:
80
+ #
81
+ # -----
82
+ #
83
+ # CpuUtilization[1m]{availabilityDomain=\"cumS:PHX-AD-1\"}.absent()
84
+ #
85
+ # -----
86
+ #
87
+ # @return [String]
88
+ attr_accessor :query
89
+
90
+ # **[Required]** The perceived severity of the alarm with regard to the affected system.
91
+ #
92
+ # Example: `CRITICAL`
93
+ #
94
+ # @return [String]
95
+ attr_reader :severity
96
+
97
+ # **[Required]** An array of [OCIDs](https://docs.us-phoenix-1.oraclecloud.com/iaas/Content/General/Concepts/identifiers.htm) to which the notifications for
98
+ # this alarm will be delivered. An example destination is an OCID for a topic managed by the
99
+ # Oracle Cloud Infrastructure Notification service.
100
+ #
101
+ # @return [Array<String>]
102
+ attr_accessor :destinations
103
+
104
+ # The configuration details for suppressing an alarm.
105
+ #
106
+ # @return [OCI::Monitoring::Models::Suppression]
107
+ attr_accessor :suppression
108
+
109
+ # **[Required]** Whether the alarm is enabled.
110
+ #
111
+ # Example: `true`
112
+ #
113
+ # @return [BOOLEAN]
114
+ attr_accessor :is_enabled
115
+
116
+ # Simple key-value pair that is applied without any predefined name, type or scope. Exists for cross-compatibility only.
117
+ # Example: `{\"Department\": \"Finance\"}`
118
+ #
119
+ # @return [Hash<String, String>]
120
+ attr_accessor :freeform_tags
121
+
122
+ # Usage of predefined tag keys. These predefined keys are scoped to namespaces.
123
+ # Example: `{\"Operations\": {\"CostCenter\": \"42\"}}`
124
+ #
125
+ # @return [Hash<String, Hash<String, Object>>]
126
+ attr_accessor :defined_tags
127
+
128
+ # **[Required]** The current lifecycle state of the alarm.
129
+ #
130
+ # Example: `DELETED`
131
+ #
132
+ # @return [String]
133
+ attr_accessor :lifecycle_state
134
+
135
+ # Attribute mapping from ruby-style variable name to JSON key.
136
+ def self.attribute_map
137
+ {
138
+ # rubocop:disable Style/SymbolLiteral
139
+ 'id': :'id',
140
+ 'display_name': :'displayName',
141
+ 'compartment_id': :'compartmentId',
142
+ 'metric_compartment_id': :'metricCompartmentId',
143
+ 'namespace': :'namespace',
144
+ 'query': :'query',
145
+ 'severity': :'severity',
146
+ 'destinations': :'destinations',
147
+ 'suppression': :'suppression',
148
+ 'is_enabled': :'isEnabled',
149
+ 'freeform_tags': :'freeformTags',
150
+ 'defined_tags': :'definedTags',
151
+ 'lifecycle_state': :'lifecycleState'
152
+ # rubocop:enable Style/SymbolLiteral
153
+ }
154
+ end
155
+
156
+ # Attribute type mapping.
157
+ def self.swagger_types
158
+ {
159
+ # rubocop:disable Style/SymbolLiteral
160
+ 'id': :'String',
161
+ 'display_name': :'String',
162
+ 'compartment_id': :'String',
163
+ 'metric_compartment_id': :'String',
164
+ 'namespace': :'String',
165
+ 'query': :'String',
166
+ 'severity': :'String',
167
+ 'destinations': :'Array<String>',
168
+ 'suppression': :'OCI::Monitoring::Models::Suppression',
169
+ 'is_enabled': :'BOOLEAN',
170
+ 'freeform_tags': :'Hash<String, String>',
171
+ 'defined_tags': :'Hash<String, Hash<String, Object>>',
172
+ 'lifecycle_state': :'String'
173
+ # rubocop:enable Style/SymbolLiteral
174
+ }
175
+ end
176
+
177
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
178
+ # rubocop:disable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
179
+
180
+
181
+ # Initializes the object
182
+ # @param [Hash] attributes Model attributes in the form of hash
183
+ # @option attributes [String] :id The value to assign to the {#id} property
184
+ # @option attributes [String] :display_name The value to assign to the {#display_name} property
185
+ # @option attributes [String] :compartment_id The value to assign to the {#compartment_id} property
186
+ # @option attributes [String] :metric_compartment_id The value to assign to the {#metric_compartment_id} property
187
+ # @option attributes [String] :namespace The value to assign to the {#namespace} property
188
+ # @option attributes [String] :query The value to assign to the {#query} property
189
+ # @option attributes [String] :severity The value to assign to the {#severity} property
190
+ # @option attributes [Array<String>] :destinations The value to assign to the {#destinations} property
191
+ # @option attributes [OCI::Monitoring::Models::Suppression] :suppression The value to assign to the {#suppression} property
192
+ # @option attributes [BOOLEAN] :is_enabled The value to assign to the {#is_enabled} property
193
+ # @option attributes [Hash<String, String>] :freeform_tags The value to assign to the {#freeform_tags} property
194
+ # @option attributes [Hash<String, Hash<String, Object>>] :defined_tags The value to assign to the {#defined_tags} property
195
+ # @option attributes [String] :lifecycle_state The value to assign to the {#lifecycle_state} property
196
+ def initialize(attributes = {})
197
+ return unless attributes.is_a?(Hash)
198
+
199
+ # convert string to symbol for hash key
200
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
201
+
202
+ self.id = attributes[:'id'] if attributes[:'id']
203
+
204
+ self.display_name = attributes[:'displayName'] if attributes[:'displayName']
205
+
206
+ raise 'You cannot provide both :displayName and :display_name' if attributes.key?(:'displayName') && attributes.key?(:'display_name')
207
+
208
+ self.display_name = attributes[:'display_name'] if attributes[:'display_name']
209
+
210
+ self.compartment_id = attributes[:'compartmentId'] if attributes[:'compartmentId']
211
+
212
+ raise 'You cannot provide both :compartmentId and :compartment_id' if attributes.key?(:'compartmentId') && attributes.key?(:'compartment_id')
213
+
214
+ self.compartment_id = attributes[:'compartment_id'] if attributes[:'compartment_id']
215
+
216
+ self.metric_compartment_id = attributes[:'metricCompartmentId'] if attributes[:'metricCompartmentId']
217
+
218
+ raise 'You cannot provide both :metricCompartmentId and :metric_compartment_id' if attributes.key?(:'metricCompartmentId') && attributes.key?(:'metric_compartment_id')
219
+
220
+ self.metric_compartment_id = attributes[:'metric_compartment_id'] if attributes[:'metric_compartment_id']
221
+
222
+ self.namespace = attributes[:'namespace'] if attributes[:'namespace']
223
+
224
+ self.query = attributes[:'query'] if attributes[:'query']
225
+
226
+ self.severity = attributes[:'severity'] if attributes[:'severity']
227
+
228
+ self.destinations = attributes[:'destinations'] if attributes[:'destinations']
229
+
230
+ self.suppression = attributes[:'suppression'] if attributes[:'suppression']
231
+
232
+ self.is_enabled = attributes[:'isEnabled'] unless attributes[:'isEnabled'].nil?
233
+
234
+ raise 'You cannot provide both :isEnabled and :is_enabled' if attributes.key?(:'isEnabled') && attributes.key?(:'is_enabled')
235
+
236
+ self.is_enabled = attributes[:'is_enabled'] unless attributes[:'is_enabled'].nil?
237
+
238
+ self.freeform_tags = attributes[:'freeformTags'] if attributes[:'freeformTags']
239
+
240
+ raise 'You cannot provide both :freeformTags and :freeform_tags' if attributes.key?(:'freeformTags') && attributes.key?(:'freeform_tags')
241
+
242
+ self.freeform_tags = attributes[:'freeform_tags'] if attributes[:'freeform_tags']
243
+
244
+ self.defined_tags = attributes[:'definedTags'] if attributes[:'definedTags']
245
+
246
+ raise 'You cannot provide both :definedTags and :defined_tags' if attributes.key?(:'definedTags') && attributes.key?(:'defined_tags')
247
+
248
+ self.defined_tags = attributes[:'defined_tags'] if attributes[:'defined_tags']
249
+
250
+ self.lifecycle_state = attributes[:'lifecycleState'] if attributes[:'lifecycleState']
251
+
252
+ raise 'You cannot provide both :lifecycleState and :lifecycle_state' if attributes.key?(:'lifecycleState') && attributes.key?(:'lifecycle_state')
253
+
254
+ self.lifecycle_state = attributes[:'lifecycle_state'] if attributes[:'lifecycle_state']
255
+ end
256
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
257
+ # rubocop:enable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
258
+
259
+ # Custom attribute writer method checking allowed values (enum).
260
+ # @param [Object] severity Object to be assigned
261
+ def severity=(severity)
262
+ # rubocop:disable Style/ConditionalAssignment
263
+ if severity && !SEVERITY_ENUM.include?(severity)
264
+ # rubocop: disable Metrics/LineLength
265
+ OCI.logger.debug("Unknown value for 'severity' [" + severity + "]. Mapping to 'SEVERITY_UNKNOWN_ENUM_VALUE'") if OCI.logger
266
+ # rubocop: enable Metrics/LineLength
267
+ @severity = SEVERITY_UNKNOWN_ENUM_VALUE
268
+ else
269
+ @severity = severity
270
+ end
271
+ # rubocop:enable Style/ConditionalAssignment
272
+ end
273
+
274
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Metrics/LineLength, Layout/EmptyLines
275
+
276
+
277
+ # Checks equality by comparing each attribute.
278
+ # @param [Object] other the other object to be compared
279
+ def ==(other)
280
+ return true if equal?(other)
281
+
282
+ self.class == other.class &&
283
+ id == other.id &&
284
+ display_name == other.display_name &&
285
+ compartment_id == other.compartment_id &&
286
+ metric_compartment_id == other.metric_compartment_id &&
287
+ namespace == other.namespace &&
288
+ query == other.query &&
289
+ severity == other.severity &&
290
+ destinations == other.destinations &&
291
+ suppression == other.suppression &&
292
+ is_enabled == other.is_enabled &&
293
+ freeform_tags == other.freeform_tags &&
294
+ defined_tags == other.defined_tags &&
295
+ lifecycle_state == other.lifecycle_state
296
+ end
297
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Metrics/LineLength, Layout/EmptyLines
298
+
299
+ # @see the `==` method
300
+ # @param [Object] other the other object to be compared
301
+ def eql?(other)
302
+ self == other
303
+ end
304
+
305
+ # rubocop:disable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
306
+
307
+
308
+ # Calculates hash code according to all attributes.
309
+ # @return [Fixnum] Hash code
310
+ def hash
311
+ [id, display_name, compartment_id, metric_compartment_id, namespace, query, severity, destinations, suppression, is_enabled, freeform_tags, defined_tags, lifecycle_state].hash
312
+ end
313
+ # rubocop:enable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
314
+
315
+ # rubocop:disable Metrics/AbcSize, Layout/EmptyLines
316
+
317
+
318
+ # Builds the object from hash
319
+ # @param [Hash] attributes Model attributes in the form of hash
320
+ # @return [Object] Returns the model itself
321
+ def build_from_hash(attributes)
322
+ return nil unless attributes.is_a?(Hash)
323
+
324
+ self.class.swagger_types.each_pair do |key, type|
325
+ if type =~ /^Array<(.*)>/i
326
+ # check to ensure the input is an array given that the the attribute
327
+ # is documented as an array but the input is not
328
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
329
+ public_method("#{key}=").call(
330
+ attributes[self.class.attribute_map[key]]
331
+ .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
332
+ )
333
+ end
334
+ elsif !attributes[self.class.attribute_map[key]].nil?
335
+ public_method("#{key}=").call(
336
+ OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
337
+ )
338
+ end
339
+ # or else data not found in attributes(hash), not an issue as the data can be optional
340
+ end
341
+
342
+ self
343
+ end
344
+ # rubocop:enable Metrics/AbcSize, Layout/EmptyLines
345
+
346
+ # Returns the string representation of the object
347
+ # @return [String] String presentation of the object
348
+ def to_s
349
+ to_hash.to_s
350
+ end
351
+
352
+ # Returns the object in the form of hash
353
+ # @return [Hash] Returns the object in the form of hash
354
+ def to_hash
355
+ hash = {}
356
+ self.class.attribute_map.each_pair do |attr, param|
357
+ value = public_method(attr).call
358
+ next if value.nil? && !instance_variable_defined?("@#{attr}")
359
+
360
+ hash[param] = _to_hash(value)
361
+ end
362
+ hash
363
+ end
364
+
365
+ private
366
+
367
+ # Outputs non-array value in the form of hash
368
+ # For object, use to_hash. Otherwise, just return the value
369
+ # @param [Object] value Any valid value
370
+ # @return [Hash] Returns the value in the form of hash
371
+ def _to_hash(value)
372
+ if value.is_a?(Array)
373
+ value.compact.map { |v| _to_hash(v) }
374
+ elsif value.is_a?(Hash)
375
+ {}.tap do |hash|
376
+ value.each { |k, v| hash[k] = _to_hash(v) }
377
+ end
378
+ elsif value.respond_to? :to_hash
379
+ value.to_hash
380
+ else
381
+ value
382
+ end
383
+ end
384
+ end
385
+ end
386
+ # rubocop:enable Lint/UnneededCopDisableDirective
@@ -0,0 +1,423 @@
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
+ # The configuration details for creating an alarm.
8
+ #
9
+ # **Warning:** Oracle recommends that you avoid using any confidential information when you supply string values using the API.
10
+ #
11
+ class Monitoring::Models::CreateAlarmDetails # rubocop:disable Metrics/LineLength
12
+ # **[Required]** A user-friendly name for the alarm. It does not have to be unique, and it's changeable.
13
+ # Avoid entering confidential information.
14
+ #
15
+ # This name is sent as the title for notifications related to this alarm.
16
+ #
17
+ # Example: `High CPU Utilization`
18
+ #
19
+ # @return [String]
20
+ attr_accessor :display_name
21
+
22
+ # **[Required]** The [OCID](https://docs.us-phoenix-1.oraclecloud.com/iaas/Content/General/Concepts/identifiers.htm) of the compartment containing the alarm.
23
+ #
24
+ # @return [String]
25
+ attr_accessor :compartment_id
26
+
27
+ # **[Required]** The [OCID](https://docs.us-phoenix-1.oraclecloud.com/iaas/Content/General/Concepts/identifiers.htm) of the compartment containing the metric
28
+ # being evaluated by the alarm.
29
+ #
30
+ # @return [String]
31
+ attr_accessor :metric_compartment_id
32
+
33
+ # When true, the alarm evaluates metrics from all compartments and subcompartments. The parameter can
34
+ # only be set to true when metricCompartmentId is the tenancy OCID (the tenancy is the root compartment).
35
+ # A true value requires the user to have tenancy-level permissions. If this requirement is not met,
36
+ # then the call is rejected. When false, the alarm evaluates metrics from only the compartment specified
37
+ # in metricCompartmentId. Default is false.
38
+ #
39
+ # Example: `true`
40
+ #
41
+ # @return [BOOLEAN]
42
+ attr_accessor :metric_compartment_id_in_subtree
43
+
44
+ # **[Required]** The source service or application emitting the metric that is evaluated by the alarm.
45
+ #
46
+ # Example: `oci_computeagent`
47
+ #
48
+ # @return [String]
49
+ attr_accessor :namespace
50
+
51
+ # **[Required]** The Monitoring Query Language (MQL) expression to evaluate for the alarm. The Alarms feature of
52
+ # the Monitoring service interprets results for each returned time series as Boolean values,
53
+ # where zero represents false and a non-zero value represents true. A true value means that the trigger
54
+ # rule condition has been met. The query must specify a metric, statistic, interval, and trigger
55
+ # rule (threshold or absence). Supported values for interval: `1m`-`60m` (also `1h`). You can optionally
56
+ # specify dimensions and grouping functions. Supported grouping functions: `grouping()`, `groupBy()`.
57
+ # For details about Monitoring Query Language (MQL), see [Monitoring Query Language (MQL) Reference](https://docs.us-phoenix-1.oraclecloud.com/iaas/Content/Monitoring/Reference/mql.htm).
58
+ # For available dimensions, review the metric definition for the supported service.
59
+ # See [Supported Services](https://docs.us-phoenix-1.oraclecloud.com/iaas/Content/Monitoring/Concepts/monitoringoverview.htm#SupportedServices).
60
+ #
61
+ # Example of threshold alarm:
62
+ #
63
+ # -----
64
+ #
65
+ # CpuUtilization[1m]{availabilityDomain=\"cumS:PHX-AD-1\"}.groupBy(availabilityDomain).percentile(0.9) > 85
66
+ #
67
+ # -----
68
+ #
69
+ # Example of absence alarm:
70
+ #
71
+ # -----
72
+ #
73
+ # CpuUtilization[1m]{availabilityDomain=\"cumS:PHX-AD-1\"}.absent()
74
+ #
75
+ # -----
76
+ #
77
+ # @return [String]
78
+ attr_accessor :query
79
+
80
+ # The time between calculated aggregation windows for the alarm. Supported value: `1m`
81
+ #
82
+ # @return [String]
83
+ attr_accessor :resolution
84
+
85
+ # The period of time that the condition defined in the alarm must persist before the alarm state
86
+ # changes from \"OK\" to \"FIRING\" or vice versa. For example, a value of 5 minutes means that the
87
+ # alarm must persist in breaching the condition for five minutes before the alarm updates its
88
+ # state to \"FIRING\"; likewise, the alarm must persist in not breaching the condition for five
89
+ # minutes before the alarm updates its state to \"OK.\"
90
+ #
91
+ # The duration is specified as a string in ISO 8601 format (`PT10M` for ten minutes or `PT1H`
92
+ # for one hour). Minimum: PT1M. Maximum: PT1H. Default: PT1M.
93
+ #
94
+ # Under the default value of PT1M, the first evaluation that breaches the alarm updates the
95
+ # state to \"FIRING\" and the first evaluation that does not breach the alarm updates the state
96
+ # to \"OK\".
97
+ #
98
+ # Example: `PT5M`
99
+ #
100
+ # @return [String]
101
+ attr_accessor :pending_duration
102
+
103
+ # **[Required]** The perceived type of response required when the alarm is in the \"FIRING\" state.
104
+ #
105
+ # Example: `CRITICAL`
106
+ #
107
+ # @return [String]
108
+ attr_accessor :severity
109
+
110
+ # The human-readable content of the notification delivered. Oracle recommends providing guidance
111
+ # to operators for resolving the alarm condition. Consider adding links to standard runbook
112
+ # practices. Avoid entering confidential information.
113
+ #
114
+ # Example: `High CPU usage alert. Follow runbook instructions for resolution.`
115
+ #
116
+ # @return [String]
117
+ attr_accessor :body
118
+
119
+ # **[Required]** An array of [OCIDs](https://docs.us-phoenix-1.oraclecloud.com/iaas/Content/General/Concepts/identifiers.htm) to which the notifications for
120
+ # this alarm will be delivered. An example destination is an OCID for a topic managed by the
121
+ # Oracle Cloud Infrastructure Notification service.
122
+ #
123
+ # @return [Array<String>]
124
+ attr_accessor :destinations
125
+
126
+ # The frequency at which notifications are re-submitted, if the alarm keeps firing without
127
+ # interruption. Format defined by ISO 8601. For example, `PT4H` indicates four hours.
128
+ # Minimum: PT1M. Maximum: P30D.
129
+ #
130
+ # Default value: null (notifications are not re-submitted).
131
+ #
132
+ # Example: `PT2H`
133
+ #
134
+ # @return [String]
135
+ attr_accessor :repeat_notification_duration
136
+
137
+ # The configuration details for suppressing an alarm.
138
+ #
139
+ # @return [OCI::Monitoring::Models::Suppression]
140
+ attr_accessor :suppression
141
+
142
+ # **[Required]** Whether the alarm is enabled.
143
+ #
144
+ # Example: `true`
145
+ #
146
+ # @return [BOOLEAN]
147
+ attr_accessor :is_enabled
148
+
149
+ # Simple key-value pair that is applied without any predefined name, type or scope. Exists for cross-compatibility only.
150
+ # Example: `{\"Department\": \"Finance\"}`
151
+ #
152
+ # @return [Hash<String, String>]
153
+ attr_accessor :freeform_tags
154
+
155
+ # Usage of predefined tag keys. These predefined keys are scoped to namespaces.
156
+ # Example: `{\"Operations\": {\"CostCenter\": \"42\"}}`
157
+ #
158
+ # @return [Hash<String, Hash<String, Object>>]
159
+ attr_accessor :defined_tags
160
+
161
+ # Attribute mapping from ruby-style variable name to JSON key.
162
+ def self.attribute_map
163
+ {
164
+ # rubocop:disable Style/SymbolLiteral
165
+ 'display_name': :'displayName',
166
+ 'compartment_id': :'compartmentId',
167
+ 'metric_compartment_id': :'metricCompartmentId',
168
+ 'metric_compartment_id_in_subtree': :'metricCompartmentIdInSubtree',
169
+ 'namespace': :'namespace',
170
+ 'query': :'query',
171
+ 'resolution': :'resolution',
172
+ 'pending_duration': :'pendingDuration',
173
+ 'severity': :'severity',
174
+ 'body': :'body',
175
+ 'destinations': :'destinations',
176
+ 'repeat_notification_duration': :'repeatNotificationDuration',
177
+ 'suppression': :'suppression',
178
+ 'is_enabled': :'isEnabled',
179
+ 'freeform_tags': :'freeformTags',
180
+ 'defined_tags': :'definedTags'
181
+ # rubocop:enable Style/SymbolLiteral
182
+ }
183
+ end
184
+
185
+ # Attribute type mapping.
186
+ def self.swagger_types
187
+ {
188
+ # rubocop:disable Style/SymbolLiteral
189
+ 'display_name': :'String',
190
+ 'compartment_id': :'String',
191
+ 'metric_compartment_id': :'String',
192
+ 'metric_compartment_id_in_subtree': :'BOOLEAN',
193
+ 'namespace': :'String',
194
+ 'query': :'String',
195
+ 'resolution': :'String',
196
+ 'pending_duration': :'String',
197
+ 'severity': :'String',
198
+ 'body': :'String',
199
+ 'destinations': :'Array<String>',
200
+ 'repeat_notification_duration': :'String',
201
+ 'suppression': :'OCI::Monitoring::Models::Suppression',
202
+ 'is_enabled': :'BOOLEAN',
203
+ 'freeform_tags': :'Hash<String, String>',
204
+ 'defined_tags': :'Hash<String, Hash<String, Object>>'
205
+ # rubocop:enable Style/SymbolLiteral
206
+ }
207
+ end
208
+
209
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
210
+ # rubocop:disable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
211
+
212
+
213
+ # Initializes the object
214
+ # @param [Hash] attributes Model attributes in the form of hash
215
+ # @option attributes [String] :display_name The value to assign to the {#display_name} property
216
+ # @option attributes [String] :compartment_id The value to assign to the {#compartment_id} property
217
+ # @option attributes [String] :metric_compartment_id The value to assign to the {#metric_compartment_id} property
218
+ # @option attributes [BOOLEAN] :metric_compartment_id_in_subtree The value to assign to the {#metric_compartment_id_in_subtree} property
219
+ # @option attributes [String] :namespace The value to assign to the {#namespace} property
220
+ # @option attributes [String] :query The value to assign to the {#query} property
221
+ # @option attributes [String] :resolution The value to assign to the {#resolution} property
222
+ # @option attributes [String] :pending_duration The value to assign to the {#pending_duration} property
223
+ # @option attributes [String] :severity The value to assign to the {#severity} property
224
+ # @option attributes [String] :body The value to assign to the {#body} property
225
+ # @option attributes [Array<String>] :destinations The value to assign to the {#destinations} property
226
+ # @option attributes [String] :repeat_notification_duration The value to assign to the {#repeat_notification_duration} property
227
+ # @option attributes [OCI::Monitoring::Models::Suppression] :suppression The value to assign to the {#suppression} property
228
+ # @option attributes [BOOLEAN] :is_enabled The value to assign to the {#is_enabled} property
229
+ # @option attributes [Hash<String, String>] :freeform_tags The value to assign to the {#freeform_tags} property
230
+ # @option attributes [Hash<String, Hash<String, Object>>] :defined_tags The value to assign to the {#defined_tags} property
231
+ def initialize(attributes = {})
232
+ return unless attributes.is_a?(Hash)
233
+
234
+ # convert string to symbol for hash key
235
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
236
+
237
+ self.display_name = attributes[:'displayName'] if attributes[:'displayName']
238
+
239
+ raise 'You cannot provide both :displayName and :display_name' if attributes.key?(:'displayName') && attributes.key?(:'display_name')
240
+
241
+ self.display_name = attributes[:'display_name'] if attributes[:'display_name']
242
+
243
+ self.compartment_id = attributes[:'compartmentId'] if attributes[:'compartmentId']
244
+
245
+ raise 'You cannot provide both :compartmentId and :compartment_id' if attributes.key?(:'compartmentId') && attributes.key?(:'compartment_id')
246
+
247
+ self.compartment_id = attributes[:'compartment_id'] if attributes[:'compartment_id']
248
+
249
+ self.metric_compartment_id = attributes[:'metricCompartmentId'] if attributes[:'metricCompartmentId']
250
+
251
+ raise 'You cannot provide both :metricCompartmentId and :metric_compartment_id' if attributes.key?(:'metricCompartmentId') && attributes.key?(:'metric_compartment_id')
252
+
253
+ self.metric_compartment_id = attributes[:'metric_compartment_id'] if attributes[:'metric_compartment_id']
254
+
255
+ self.metric_compartment_id_in_subtree = attributes[:'metricCompartmentIdInSubtree'] unless attributes[:'metricCompartmentIdInSubtree'].nil?
256
+
257
+ raise 'You cannot provide both :metricCompartmentIdInSubtree and :metric_compartment_id_in_subtree' if attributes.key?(:'metricCompartmentIdInSubtree') && attributes.key?(:'metric_compartment_id_in_subtree')
258
+
259
+ self.metric_compartment_id_in_subtree = attributes[:'metric_compartment_id_in_subtree'] unless attributes[:'metric_compartment_id_in_subtree'].nil?
260
+
261
+ self.namespace = attributes[:'namespace'] if attributes[:'namespace']
262
+
263
+ self.query = attributes[:'query'] if attributes[:'query']
264
+
265
+ self.resolution = attributes[:'resolution'] if attributes[:'resolution']
266
+
267
+ self.pending_duration = attributes[:'pendingDuration'] if attributes[:'pendingDuration']
268
+
269
+ raise 'You cannot provide both :pendingDuration and :pending_duration' if attributes.key?(:'pendingDuration') && attributes.key?(:'pending_duration')
270
+
271
+ self.pending_duration = attributes[:'pending_duration'] if attributes[:'pending_duration']
272
+
273
+ self.severity = attributes[:'severity'] if attributes[:'severity']
274
+
275
+ self.body = attributes[:'body'] if attributes[:'body']
276
+
277
+ self.destinations = attributes[:'destinations'] if attributes[:'destinations']
278
+
279
+ self.repeat_notification_duration = attributes[:'repeatNotificationDuration'] if attributes[:'repeatNotificationDuration']
280
+
281
+ raise 'You cannot provide both :repeatNotificationDuration and :repeat_notification_duration' if attributes.key?(:'repeatNotificationDuration') && attributes.key?(:'repeat_notification_duration')
282
+
283
+ self.repeat_notification_duration = attributes[:'repeat_notification_duration'] if attributes[:'repeat_notification_duration']
284
+
285
+ self.suppression = attributes[:'suppression'] if attributes[:'suppression']
286
+
287
+ self.is_enabled = attributes[:'isEnabled'] unless attributes[:'isEnabled'].nil?
288
+
289
+ raise 'You cannot provide both :isEnabled and :is_enabled' if attributes.key?(:'isEnabled') && attributes.key?(:'is_enabled')
290
+
291
+ self.is_enabled = attributes[:'is_enabled'] unless attributes[:'is_enabled'].nil?
292
+
293
+ self.freeform_tags = attributes[:'freeformTags'] if attributes[:'freeformTags']
294
+
295
+ raise 'You cannot provide both :freeformTags and :freeform_tags' if attributes.key?(:'freeformTags') && attributes.key?(:'freeform_tags')
296
+
297
+ self.freeform_tags = attributes[:'freeform_tags'] if attributes[:'freeform_tags']
298
+
299
+ self.defined_tags = attributes[:'definedTags'] if attributes[:'definedTags']
300
+
301
+ raise 'You cannot provide both :definedTags and :defined_tags' if attributes.key?(:'definedTags') && attributes.key?(:'defined_tags')
302
+
303
+ self.defined_tags = attributes[:'defined_tags'] if attributes[:'defined_tags']
304
+ end
305
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
306
+ # rubocop:enable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
307
+
308
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Metrics/LineLength, Layout/EmptyLines
309
+
310
+
311
+ # Checks equality by comparing each attribute.
312
+ # @param [Object] other the other object to be compared
313
+ def ==(other)
314
+ return true if equal?(other)
315
+
316
+ self.class == other.class &&
317
+ display_name == other.display_name &&
318
+ compartment_id == other.compartment_id &&
319
+ metric_compartment_id == other.metric_compartment_id &&
320
+ metric_compartment_id_in_subtree == other.metric_compartment_id_in_subtree &&
321
+ namespace == other.namespace &&
322
+ query == other.query &&
323
+ resolution == other.resolution &&
324
+ pending_duration == other.pending_duration &&
325
+ severity == other.severity &&
326
+ body == other.body &&
327
+ destinations == other.destinations &&
328
+ repeat_notification_duration == other.repeat_notification_duration &&
329
+ suppression == other.suppression &&
330
+ is_enabled == other.is_enabled &&
331
+ freeform_tags == other.freeform_tags &&
332
+ defined_tags == other.defined_tags
333
+ end
334
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Metrics/LineLength, Layout/EmptyLines
335
+
336
+ # @see the `==` method
337
+ # @param [Object] other the other object to be compared
338
+ def eql?(other)
339
+ self == other
340
+ end
341
+
342
+ # rubocop:disable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
343
+
344
+
345
+ # Calculates hash code according to all attributes.
346
+ # @return [Fixnum] Hash code
347
+ def hash
348
+ [display_name, compartment_id, metric_compartment_id, metric_compartment_id_in_subtree, namespace, query, resolution, pending_duration, severity, body, destinations, repeat_notification_duration, suppression, is_enabled, freeform_tags, defined_tags].hash
349
+ end
350
+ # rubocop:enable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
351
+
352
+ # rubocop:disable Metrics/AbcSize, Layout/EmptyLines
353
+
354
+
355
+ # Builds the object from hash
356
+ # @param [Hash] attributes Model attributes in the form of hash
357
+ # @return [Object] Returns the model itself
358
+ def build_from_hash(attributes)
359
+ return nil unless attributes.is_a?(Hash)
360
+
361
+ self.class.swagger_types.each_pair do |key, type|
362
+ if type =~ /^Array<(.*)>/i
363
+ # check to ensure the input is an array given that the the attribute
364
+ # is documented as an array but the input is not
365
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
366
+ public_method("#{key}=").call(
367
+ attributes[self.class.attribute_map[key]]
368
+ .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
369
+ )
370
+ end
371
+ elsif !attributes[self.class.attribute_map[key]].nil?
372
+ public_method("#{key}=").call(
373
+ OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
374
+ )
375
+ end
376
+ # or else data not found in attributes(hash), not an issue as the data can be optional
377
+ end
378
+
379
+ self
380
+ end
381
+ # rubocop:enable Metrics/AbcSize, Layout/EmptyLines
382
+
383
+ # Returns the string representation of the object
384
+ # @return [String] String presentation of the object
385
+ def to_s
386
+ to_hash.to_s
387
+ end
388
+
389
+ # Returns the object in the form of hash
390
+ # @return [Hash] Returns the object in the form of hash
391
+ def to_hash
392
+ hash = {}
393
+ self.class.attribute_map.each_pair do |attr, param|
394
+ value = public_method(attr).call
395
+ next if value.nil? && !instance_variable_defined?("@#{attr}")
396
+
397
+ hash[param] = _to_hash(value)
398
+ end
399
+ hash
400
+ end
401
+
402
+ private
403
+
404
+ # Outputs non-array value in the form of hash
405
+ # For object, use to_hash. Otherwise, just return the value
406
+ # @param [Object] value Any valid value
407
+ # @return [Hash] Returns the value in the form of hash
408
+ def _to_hash(value)
409
+ if value.is_a?(Array)
410
+ value.compact.map { |v| _to_hash(v) }
411
+ elsif value.is_a?(Hash)
412
+ {}.tap do |hash|
413
+ value.each { |k, v| hash[k] = _to_hash(v) }
414
+ end
415
+ elsif value.respond_to? :to_hash
416
+ value.to_hash
417
+ else
418
+ value
419
+ end
420
+ end
421
+ end
422
+ end
423
+ # rubocop:enable Lint/UnneededCopDisableDirective