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,183 @@
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 retrieving alarm history.
8
+ #
9
+ class Monitoring::Models::AlarmHistoryCollection # rubocop:disable Metrics/LineLength
10
+ # **[Required]** The [OCID](https://docs.us-phoenix-1.oraclecloud.com/iaas/Content/General/Concepts/identifiers.htm) of the alarm for which to retrieve history.
11
+ #
12
+ # @return [String]
13
+ attr_accessor :alarm_id
14
+
15
+ # **[Required]** Whether the alarm is enabled.
16
+ #
17
+ # Example: `true`
18
+ #
19
+ # @return [BOOLEAN]
20
+ attr_accessor :is_enabled
21
+
22
+ # **[Required]** The set of history entries retrieved for the alarm.
23
+ #
24
+ # @return [Array<OCI::Monitoring::Models::AlarmHistoryEntry>]
25
+ attr_accessor :entries
26
+
27
+ # Attribute mapping from ruby-style variable name to JSON key.
28
+ def self.attribute_map
29
+ {
30
+ # rubocop:disable Style/SymbolLiteral
31
+ 'alarm_id': :'alarmId',
32
+ 'is_enabled': :'isEnabled',
33
+ 'entries': :'entries'
34
+ # rubocop:enable Style/SymbolLiteral
35
+ }
36
+ end
37
+
38
+ # Attribute type mapping.
39
+ def self.swagger_types
40
+ {
41
+ # rubocop:disable Style/SymbolLiteral
42
+ 'alarm_id': :'String',
43
+ 'is_enabled': :'BOOLEAN',
44
+ 'entries': :'Array<OCI::Monitoring::Models::AlarmHistoryEntry>'
45
+ # rubocop:enable Style/SymbolLiteral
46
+ }
47
+ end
48
+
49
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
50
+ # rubocop:disable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
51
+
52
+
53
+ # Initializes the object
54
+ # @param [Hash] attributes Model attributes in the form of hash
55
+ # @option attributes [String] :alarm_id The value to assign to the {#alarm_id} property
56
+ # @option attributes [BOOLEAN] :is_enabled The value to assign to the {#is_enabled} property
57
+ # @option attributes [Array<OCI::Monitoring::Models::AlarmHistoryEntry>] :entries The value to assign to the {#entries} property
58
+ def initialize(attributes = {})
59
+ return unless attributes.is_a?(Hash)
60
+
61
+ # convert string to symbol for hash key
62
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
63
+
64
+ self.alarm_id = attributes[:'alarmId'] if attributes[:'alarmId']
65
+
66
+ raise 'You cannot provide both :alarmId and :alarm_id' if attributes.key?(:'alarmId') && attributes.key?(:'alarm_id')
67
+
68
+ self.alarm_id = attributes[:'alarm_id'] if attributes[:'alarm_id']
69
+
70
+ self.is_enabled = attributes[:'isEnabled'] unless attributes[:'isEnabled'].nil?
71
+
72
+ raise 'You cannot provide both :isEnabled and :is_enabled' if attributes.key?(:'isEnabled') && attributes.key?(:'is_enabled')
73
+
74
+ self.is_enabled = attributes[:'is_enabled'] unless attributes[:'is_enabled'].nil?
75
+
76
+ self.entries = attributes[:'entries'] if attributes[:'entries']
77
+ end
78
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
79
+ # rubocop:enable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
80
+
81
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Metrics/LineLength, Layout/EmptyLines
82
+
83
+
84
+ # Checks equality by comparing each attribute.
85
+ # @param [Object] other the other object to be compared
86
+ def ==(other)
87
+ return true if equal?(other)
88
+
89
+ self.class == other.class &&
90
+ alarm_id == other.alarm_id &&
91
+ is_enabled == other.is_enabled &&
92
+ entries == other.entries
93
+ end
94
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Metrics/LineLength, Layout/EmptyLines
95
+
96
+ # @see the `==` method
97
+ # @param [Object] other the other object to be compared
98
+ def eql?(other)
99
+ self == other
100
+ end
101
+
102
+ # rubocop:disable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
103
+
104
+
105
+ # Calculates hash code according to all attributes.
106
+ # @return [Fixnum] Hash code
107
+ def hash
108
+ [alarm_id, is_enabled, entries].hash
109
+ end
110
+ # rubocop:enable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
111
+
112
+ # rubocop:disable Metrics/AbcSize, Layout/EmptyLines
113
+
114
+
115
+ # Builds the object from hash
116
+ # @param [Hash] attributes Model attributes in the form of hash
117
+ # @return [Object] Returns the model itself
118
+ def build_from_hash(attributes)
119
+ return nil unless attributes.is_a?(Hash)
120
+
121
+ self.class.swagger_types.each_pair do |key, type|
122
+ if type =~ /^Array<(.*)>/i
123
+ # check to ensure the input is an array given that the the attribute
124
+ # is documented as an array but the input is not
125
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
126
+ public_method("#{key}=").call(
127
+ attributes[self.class.attribute_map[key]]
128
+ .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
129
+ )
130
+ end
131
+ elsif !attributes[self.class.attribute_map[key]].nil?
132
+ public_method("#{key}=").call(
133
+ OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
134
+ )
135
+ end
136
+ # or else data not found in attributes(hash), not an issue as the data can be optional
137
+ end
138
+
139
+ self
140
+ end
141
+ # rubocop:enable Metrics/AbcSize, Layout/EmptyLines
142
+
143
+ # Returns the string representation of the object
144
+ # @return [String] String presentation of the object
145
+ def to_s
146
+ to_hash.to_s
147
+ end
148
+
149
+ # Returns the object in the form of hash
150
+ # @return [Hash] Returns the object in the form of hash
151
+ def to_hash
152
+ hash = {}
153
+ self.class.attribute_map.each_pair do |attr, param|
154
+ value = public_method(attr).call
155
+ next if value.nil? && !instance_variable_defined?("@#{attr}")
156
+
157
+ hash[param] = _to_hash(value)
158
+ end
159
+ hash
160
+ end
161
+
162
+ private
163
+
164
+ # Outputs non-array value in the form of hash
165
+ # For object, use to_hash. Otherwise, just return the value
166
+ # @param [Object] value Any valid value
167
+ # @return [Hash] Returns the value in the form of hash
168
+ def _to_hash(value)
169
+ if value.is_a?(Array)
170
+ value.compact.map { |v| _to_hash(v) }
171
+ elsif value.is_a?(Hash)
172
+ {}.tap do |hash|
173
+ value.each { |k, v| hash[k] = _to_hash(v) }
174
+ end
175
+ elsif value.respond_to? :to_hash
176
+ value.to_hash
177
+ else
178
+ value
179
+ end
180
+ end
181
+ end
182
+ end
183
+ # rubocop:enable Lint/UnneededCopDisableDirective
@@ -0,0 +1,187 @@
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 alarm history entry indicating a description of the entry and the time that the entry occurred.
8
+ # If the entry corresponds to a state transition, such as OK to Firing, then the entry also includes a transition timestamp.
9
+ #
10
+ class Monitoring::Models::AlarmHistoryEntry # rubocop:disable Metrics/LineLength
11
+ # **[Required]** Description for this alarm history entry. Avoid entering confidential information.
12
+ #
13
+ # Example 1 - alarm state history entry: `The alarm state is FIRING`
14
+ #
15
+ # Example 2 - alarm state transition history entry: `State transitioned from OK to Firing`
16
+ #
17
+ # @return [String]
18
+ attr_accessor :summary
19
+
20
+ # **[Required]** Timestamp for this alarm history entry. Format defined by RFC3339.
21
+ #
22
+ # Example: `2019-02-01T01:02:29.600Z`
23
+ #
24
+ # @return [DateTime]
25
+ attr_accessor :timestamp
26
+
27
+ # Timestamp for the transition of the alarm state. For example, the time when the alarm transitioned from OK to Firing.
28
+ # Available for state transition entries only. Note: A three-minute lag for this value accounts for any late-arriving metrics.
29
+ #
30
+ # Example: `2019-02-01T0:59:00.789Z`
31
+ #
32
+ # @return [DateTime]
33
+ attr_accessor :timestamp_triggered
34
+
35
+ # Attribute mapping from ruby-style variable name to JSON key.
36
+ def self.attribute_map
37
+ {
38
+ # rubocop:disable Style/SymbolLiteral
39
+ 'summary': :'summary',
40
+ 'timestamp': :'timestamp',
41
+ 'timestamp_triggered': :'timestampTriggered'
42
+ # rubocop:enable Style/SymbolLiteral
43
+ }
44
+ end
45
+
46
+ # Attribute type mapping.
47
+ def self.swagger_types
48
+ {
49
+ # rubocop:disable Style/SymbolLiteral
50
+ 'summary': :'String',
51
+ 'timestamp': :'DateTime',
52
+ 'timestamp_triggered': :'DateTime'
53
+ # rubocop:enable Style/SymbolLiteral
54
+ }
55
+ end
56
+
57
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
58
+ # rubocop:disable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
59
+
60
+
61
+ # Initializes the object
62
+ # @param [Hash] attributes Model attributes in the form of hash
63
+ # @option attributes [String] :summary The value to assign to the {#summary} property
64
+ # @option attributes [DateTime] :timestamp The value to assign to the {#timestamp} property
65
+ # @option attributes [DateTime] :timestamp_triggered The value to assign to the {#timestamp_triggered} property
66
+ def initialize(attributes = {})
67
+ return unless attributes.is_a?(Hash)
68
+
69
+ # convert string to symbol for hash key
70
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
71
+
72
+ self.summary = attributes[:'summary'] if attributes[:'summary']
73
+
74
+ self.timestamp = attributes[:'timestamp'] if attributes[:'timestamp']
75
+
76
+ self.timestamp_triggered = attributes[:'timestampTriggered'] if attributes[:'timestampTriggered']
77
+
78
+ raise 'You cannot provide both :timestampTriggered and :timestamp_triggered' if attributes.key?(:'timestampTriggered') && attributes.key?(:'timestamp_triggered')
79
+
80
+ self.timestamp_triggered = attributes[:'timestamp_triggered'] if attributes[:'timestamp_triggered']
81
+ end
82
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
83
+ # rubocop:enable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
84
+
85
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Metrics/LineLength, Layout/EmptyLines
86
+
87
+
88
+ # Checks equality by comparing each attribute.
89
+ # @param [Object] other the other object to be compared
90
+ def ==(other)
91
+ return true if equal?(other)
92
+
93
+ self.class == other.class &&
94
+ summary == other.summary &&
95
+ timestamp == other.timestamp &&
96
+ timestamp_triggered == other.timestamp_triggered
97
+ end
98
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Metrics/LineLength, Layout/EmptyLines
99
+
100
+ # @see the `==` method
101
+ # @param [Object] other the other object to be compared
102
+ def eql?(other)
103
+ self == other
104
+ end
105
+
106
+ # rubocop:disable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
107
+
108
+
109
+ # Calculates hash code according to all attributes.
110
+ # @return [Fixnum] Hash code
111
+ def hash
112
+ [summary, timestamp, timestamp_triggered].hash
113
+ end
114
+ # rubocop:enable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
115
+
116
+ # rubocop:disable Metrics/AbcSize, Layout/EmptyLines
117
+
118
+
119
+ # Builds the object from hash
120
+ # @param [Hash] attributes Model attributes in the form of hash
121
+ # @return [Object] Returns the model itself
122
+ def build_from_hash(attributes)
123
+ return nil unless attributes.is_a?(Hash)
124
+
125
+ self.class.swagger_types.each_pair do |key, type|
126
+ if type =~ /^Array<(.*)>/i
127
+ # check to ensure the input is an array given that the the attribute
128
+ # is documented as an array but the input is not
129
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
130
+ public_method("#{key}=").call(
131
+ attributes[self.class.attribute_map[key]]
132
+ .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
133
+ )
134
+ end
135
+ elsif !attributes[self.class.attribute_map[key]].nil?
136
+ public_method("#{key}=").call(
137
+ OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
138
+ )
139
+ end
140
+ # or else data not found in attributes(hash), not an issue as the data can be optional
141
+ end
142
+
143
+ self
144
+ end
145
+ # rubocop:enable Metrics/AbcSize, Layout/EmptyLines
146
+
147
+ # Returns the string representation of the object
148
+ # @return [String] String presentation of the object
149
+ def to_s
150
+ to_hash.to_s
151
+ end
152
+
153
+ # Returns the object in the form of hash
154
+ # @return [Hash] Returns the object in the form of hash
155
+ def to_hash
156
+ hash = {}
157
+ self.class.attribute_map.each_pair do |attr, param|
158
+ value = public_method(attr).call
159
+ next if value.nil? && !instance_variable_defined?("@#{attr}")
160
+
161
+ hash[param] = _to_hash(value)
162
+ end
163
+ hash
164
+ end
165
+
166
+ private
167
+
168
+ # Outputs non-array value in the form of hash
169
+ # For object, use to_hash. Otherwise, just return the value
170
+ # @param [Object] value Any valid value
171
+ # @return [Hash] Returns the value in the form of hash
172
+ def _to_hash(value)
173
+ if value.is_a?(Array)
174
+ value.compact.map { |v| _to_hash(v) }
175
+ elsif value.is_a?(Hash)
176
+ {}.tap do |hash|
177
+ value.each { |k, v| hash[k] = _to_hash(v) }
178
+ end
179
+ elsif value.respond_to? :to_hash
180
+ value.to_hash
181
+ else
182
+ value
183
+ end
184
+ end
185
+ end
186
+ end
187
+ # rubocop:enable Lint/UnneededCopDisableDirective
@@ -0,0 +1,277 @@
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 and its current evaluation status.
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::AlarmStatusSummary # 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
+ STATUS_ENUM = [
29
+ STATUS_FIRING = 'FIRING'.freeze,
30
+ STATUS_OK = 'OK'.freeze,
31
+ STATUS_SUSPENDED = 'SUSPENDED'.freeze,
32
+ STATUS_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]** The configured name of the alarm.
41
+ #
42
+ # Example: `High CPU Utilization`
43
+ #
44
+ # @return [String]
45
+ attr_accessor :display_name
46
+
47
+ # **[Required]** The configured severity of the alarm.
48
+ #
49
+ # Example: `CRITICAL`
50
+ #
51
+ # @return [String]
52
+ attr_reader :severity
53
+
54
+ # **[Required]** Timestamp for the transition of the alarm state. For example, the time when the alarm transitioned from OK to Firing.
55
+ #
56
+ # Example: `2019-02-01T01:02:29.600Z`
57
+ #
58
+ # @return [DateTime]
59
+ attr_accessor :timestamp_triggered
60
+
61
+ # **[Required]** The status of this alarm.
62
+ #
63
+ # Example: `FIRING`
64
+ #
65
+ # @return [String]
66
+ attr_reader :status
67
+
68
+ # The configuration details for suppressing an alarm.
69
+ #
70
+ # @return [OCI::Monitoring::Models::Suppression]
71
+ attr_accessor :suppression
72
+
73
+ # Attribute mapping from ruby-style variable name to JSON key.
74
+ def self.attribute_map
75
+ {
76
+ # rubocop:disable Style/SymbolLiteral
77
+ 'id': :'id',
78
+ 'display_name': :'displayName',
79
+ 'severity': :'severity',
80
+ 'timestamp_triggered': :'timestampTriggered',
81
+ 'status': :'status',
82
+ 'suppression': :'suppression'
83
+ # rubocop:enable Style/SymbolLiteral
84
+ }
85
+ end
86
+
87
+ # Attribute type mapping.
88
+ def self.swagger_types
89
+ {
90
+ # rubocop:disable Style/SymbolLiteral
91
+ 'id': :'String',
92
+ 'display_name': :'String',
93
+ 'severity': :'String',
94
+ 'timestamp_triggered': :'DateTime',
95
+ 'status': :'String',
96
+ 'suppression': :'OCI::Monitoring::Models::Suppression'
97
+ # rubocop:enable Style/SymbolLiteral
98
+ }
99
+ end
100
+
101
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
102
+ # rubocop:disable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
103
+
104
+
105
+ # Initializes the object
106
+ # @param [Hash] attributes Model attributes in the form of hash
107
+ # @option attributes [String] :id The value to assign to the {#id} property
108
+ # @option attributes [String] :display_name The value to assign to the {#display_name} property
109
+ # @option attributes [String] :severity The value to assign to the {#severity} property
110
+ # @option attributes [DateTime] :timestamp_triggered The value to assign to the {#timestamp_triggered} property
111
+ # @option attributes [String] :status The value to assign to the {#status} property
112
+ # @option attributes [OCI::Monitoring::Models::Suppression] :suppression The value to assign to the {#suppression} property
113
+ def initialize(attributes = {})
114
+ return unless attributes.is_a?(Hash)
115
+
116
+ # convert string to symbol for hash key
117
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
118
+
119
+ self.id = attributes[:'id'] if attributes[:'id']
120
+
121
+ self.display_name = attributes[:'displayName'] if attributes[:'displayName']
122
+
123
+ raise 'You cannot provide both :displayName and :display_name' if attributes.key?(:'displayName') && attributes.key?(:'display_name')
124
+
125
+ self.display_name = attributes[:'display_name'] if attributes[:'display_name']
126
+
127
+ self.severity = attributes[:'severity'] if attributes[:'severity']
128
+
129
+ self.timestamp_triggered = attributes[:'timestampTriggered'] if attributes[:'timestampTriggered']
130
+
131
+ raise 'You cannot provide both :timestampTriggered and :timestamp_triggered' if attributes.key?(:'timestampTriggered') && attributes.key?(:'timestamp_triggered')
132
+
133
+ self.timestamp_triggered = attributes[:'timestamp_triggered'] if attributes[:'timestamp_triggered']
134
+
135
+ self.status = attributes[:'status'] if attributes[:'status']
136
+
137
+ self.suppression = attributes[:'suppression'] if attributes[:'suppression']
138
+ end
139
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
140
+ # rubocop:enable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
141
+
142
+ # Custom attribute writer method checking allowed values (enum).
143
+ # @param [Object] severity Object to be assigned
144
+ def severity=(severity)
145
+ # rubocop:disable Style/ConditionalAssignment
146
+ if severity && !SEVERITY_ENUM.include?(severity)
147
+ # rubocop: disable Metrics/LineLength
148
+ OCI.logger.debug("Unknown value for 'severity' [" + severity + "]. Mapping to 'SEVERITY_UNKNOWN_ENUM_VALUE'") if OCI.logger
149
+ # rubocop: enable Metrics/LineLength
150
+ @severity = SEVERITY_UNKNOWN_ENUM_VALUE
151
+ else
152
+ @severity = severity
153
+ end
154
+ # rubocop:enable Style/ConditionalAssignment
155
+ end
156
+
157
+ # Custom attribute writer method checking allowed values (enum).
158
+ # @param [Object] status Object to be assigned
159
+ def status=(status)
160
+ # rubocop:disable Style/ConditionalAssignment
161
+ if status && !STATUS_ENUM.include?(status)
162
+ # rubocop: disable Metrics/LineLength
163
+ OCI.logger.debug("Unknown value for 'status' [" + status + "]. Mapping to 'STATUS_UNKNOWN_ENUM_VALUE'") if OCI.logger
164
+ # rubocop: enable Metrics/LineLength
165
+ @status = STATUS_UNKNOWN_ENUM_VALUE
166
+ else
167
+ @status = status
168
+ end
169
+ # rubocop:enable Style/ConditionalAssignment
170
+ end
171
+
172
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Metrics/LineLength, Layout/EmptyLines
173
+
174
+
175
+ # Checks equality by comparing each attribute.
176
+ # @param [Object] other the other object to be compared
177
+ def ==(other)
178
+ return true if equal?(other)
179
+
180
+ self.class == other.class &&
181
+ id == other.id &&
182
+ display_name == other.display_name &&
183
+ severity == other.severity &&
184
+ timestamp_triggered == other.timestamp_triggered &&
185
+ status == other.status &&
186
+ suppression == other.suppression
187
+ end
188
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Metrics/LineLength, Layout/EmptyLines
189
+
190
+ # @see the `==` method
191
+ # @param [Object] other the other object to be compared
192
+ def eql?(other)
193
+ self == other
194
+ end
195
+
196
+ # rubocop:disable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
197
+
198
+
199
+ # Calculates hash code according to all attributes.
200
+ # @return [Fixnum] Hash code
201
+ def hash
202
+ [id, display_name, severity, timestamp_triggered, status, suppression].hash
203
+ end
204
+ # rubocop:enable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
205
+
206
+ # rubocop:disable Metrics/AbcSize, Layout/EmptyLines
207
+
208
+
209
+ # Builds the object from hash
210
+ # @param [Hash] attributes Model attributes in the form of hash
211
+ # @return [Object] Returns the model itself
212
+ def build_from_hash(attributes)
213
+ return nil unless attributes.is_a?(Hash)
214
+
215
+ self.class.swagger_types.each_pair do |key, type|
216
+ if type =~ /^Array<(.*)>/i
217
+ # check to ensure the input is an array given that the the attribute
218
+ # is documented as an array but the input is not
219
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
220
+ public_method("#{key}=").call(
221
+ attributes[self.class.attribute_map[key]]
222
+ .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
223
+ )
224
+ end
225
+ elsif !attributes[self.class.attribute_map[key]].nil?
226
+ public_method("#{key}=").call(
227
+ OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
228
+ )
229
+ end
230
+ # or else data not found in attributes(hash), not an issue as the data can be optional
231
+ end
232
+
233
+ self
234
+ end
235
+ # rubocop:enable Metrics/AbcSize, Layout/EmptyLines
236
+
237
+ # Returns the string representation of the object
238
+ # @return [String] String presentation of the object
239
+ def to_s
240
+ to_hash.to_s
241
+ end
242
+
243
+ # Returns the object in the form of hash
244
+ # @return [Hash] Returns the object in the form of hash
245
+ def to_hash
246
+ hash = {}
247
+ self.class.attribute_map.each_pair do |attr, param|
248
+ value = public_method(attr).call
249
+ next if value.nil? && !instance_variable_defined?("@#{attr}")
250
+
251
+ hash[param] = _to_hash(value)
252
+ end
253
+ hash
254
+ end
255
+
256
+ private
257
+
258
+ # Outputs non-array value in the form of hash
259
+ # For object, use to_hash. Otherwise, just return the value
260
+ # @param [Object] value Any valid value
261
+ # @return [Hash] Returns the value in the form of hash
262
+ def _to_hash(value)
263
+ if value.is_a?(Array)
264
+ value.compact.map { |v| _to_hash(v) }
265
+ elsif value.is_a?(Hash)
266
+ {}.tap do |hash|
267
+ value.each { |k, v| hash[k] = _to_hash(v) }
268
+ end
269
+ elsif value.respond_to? :to_hash
270
+ value.to_hash
271
+ else
272
+ value
273
+ end
274
+ end
275
+ end
276
+ end
277
+ # rubocop:enable Lint/UnneededCopDisableDirective