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