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,197 @@
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 properties that define a metric.
8
+ # For information about metrics, see [Metrics Overview](https://docs.us-phoenix-1.oraclecloud.com/iaas/Content/Monitoring/Concepts/monitoringoverview.htm#MetricsOverview).
9
+ #
10
+ class Monitoring::Models::Metric # rubocop:disable Metrics/LineLength
11
+ # The name of the metric.
12
+ #
13
+ # Example: `CpuUtilization`
14
+ #
15
+ # @return [String]
16
+ attr_accessor :name
17
+
18
+ # The source service or application emitting the metric.
19
+ #
20
+ # Example: `oci_computeagent`
21
+ #
22
+ # @return [String]
23
+ attr_accessor :namespace
24
+
25
+ # The [OCID](https://docs.us-phoenix-1.oraclecloud.com/iaas/Content/General/Concepts/identifiers.htm) of the compartment containing
26
+ # the resources monitored by the metric.
27
+ #
28
+ # @return [String]
29
+ attr_accessor :compartment_id
30
+
31
+ # Qualifiers provided in a metric definition. Available dimensions vary by metric namespace.
32
+ # Each dimension takes the form of a key-value pair.
33
+ #
34
+ # Example: `\"resourceId\": \"ocid1.instance.region1.phx.exampleuniqueID\"`
35
+ #
36
+ # @return [Hash<String, String>]
37
+ attr_accessor :dimensions
38
+
39
+ # Attribute mapping from ruby-style variable name to JSON key.
40
+ def self.attribute_map
41
+ {
42
+ # rubocop:disable Style/SymbolLiteral
43
+ 'name': :'name',
44
+ 'namespace': :'namespace',
45
+ 'compartment_id': :'compartmentId',
46
+ 'dimensions': :'dimensions'
47
+ # rubocop:enable Style/SymbolLiteral
48
+ }
49
+ end
50
+
51
+ # Attribute type mapping.
52
+ def self.swagger_types
53
+ {
54
+ # rubocop:disable Style/SymbolLiteral
55
+ 'name': :'String',
56
+ 'namespace': :'String',
57
+ 'compartment_id': :'String',
58
+ 'dimensions': :'Hash<String, String>'
59
+ # rubocop:enable Style/SymbolLiteral
60
+ }
61
+ end
62
+
63
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
64
+ # rubocop:disable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
65
+
66
+
67
+ # Initializes the object
68
+ # @param [Hash] attributes Model attributes in the form of hash
69
+ # @option attributes [String] :name The value to assign to the {#name} property
70
+ # @option attributes [String] :namespace The value to assign to the {#namespace} property
71
+ # @option attributes [String] :compartment_id The value to assign to the {#compartment_id} property
72
+ # @option attributes [Hash<String, String>] :dimensions The value to assign to the {#dimensions} property
73
+ def initialize(attributes = {})
74
+ return unless attributes.is_a?(Hash)
75
+
76
+ # convert string to symbol for hash key
77
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
78
+
79
+ self.name = attributes[:'name'] if attributes[:'name']
80
+
81
+ self.namespace = attributes[:'namespace'] if attributes[:'namespace']
82
+
83
+ self.compartment_id = attributes[:'compartmentId'] if attributes[:'compartmentId']
84
+
85
+ raise 'You cannot provide both :compartmentId and :compartment_id' if attributes.key?(:'compartmentId') && attributes.key?(:'compartment_id')
86
+
87
+ self.compartment_id = attributes[:'compartment_id'] if attributes[:'compartment_id']
88
+
89
+ self.dimensions = attributes[:'dimensions'] if attributes[:'dimensions']
90
+ end
91
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
92
+ # rubocop:enable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
93
+
94
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Metrics/LineLength, Layout/EmptyLines
95
+
96
+
97
+ # Checks equality by comparing each attribute.
98
+ # @param [Object] other the other object to be compared
99
+ def ==(other)
100
+ return true if equal?(other)
101
+
102
+ self.class == other.class &&
103
+ name == other.name &&
104
+ namespace == other.namespace &&
105
+ compartment_id == other.compartment_id &&
106
+ dimensions == other.dimensions
107
+ end
108
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Metrics/LineLength, Layout/EmptyLines
109
+
110
+ # @see the `==` method
111
+ # @param [Object] other the other object to be compared
112
+ def eql?(other)
113
+ self == other
114
+ end
115
+
116
+ # rubocop:disable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
117
+
118
+
119
+ # Calculates hash code according to all attributes.
120
+ # @return [Fixnum] Hash code
121
+ def hash
122
+ [name, namespace, compartment_id, dimensions].hash
123
+ end
124
+ # rubocop:enable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
125
+
126
+ # rubocop:disable Metrics/AbcSize, Layout/EmptyLines
127
+
128
+
129
+ # Builds the object from hash
130
+ # @param [Hash] attributes Model attributes in the form of hash
131
+ # @return [Object] Returns the model itself
132
+ def build_from_hash(attributes)
133
+ return nil unless attributes.is_a?(Hash)
134
+
135
+ self.class.swagger_types.each_pair do |key, type|
136
+ if type =~ /^Array<(.*)>/i
137
+ # check to ensure the input is an array given that the the attribute
138
+ # is documented as an array but the input is not
139
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
140
+ public_method("#{key}=").call(
141
+ attributes[self.class.attribute_map[key]]
142
+ .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
143
+ )
144
+ end
145
+ elsif !attributes[self.class.attribute_map[key]].nil?
146
+ public_method("#{key}=").call(
147
+ OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
148
+ )
149
+ end
150
+ # or else data not found in attributes(hash), not an issue as the data can be optional
151
+ end
152
+
153
+ self
154
+ end
155
+ # rubocop:enable Metrics/AbcSize, Layout/EmptyLines
156
+
157
+ # Returns the string representation of the object
158
+ # @return [String] String presentation of the object
159
+ def to_s
160
+ to_hash.to_s
161
+ end
162
+
163
+ # Returns the object in the form of hash
164
+ # @return [Hash] Returns the object in the form of hash
165
+ def to_hash
166
+ hash = {}
167
+ self.class.attribute_map.each_pair do |attr, param|
168
+ value = public_method(attr).call
169
+ next if value.nil? && !instance_variable_defined?("@#{attr}")
170
+
171
+ hash[param] = _to_hash(value)
172
+ end
173
+ hash
174
+ end
175
+
176
+ private
177
+
178
+ # Outputs non-array value in the form of hash
179
+ # For object, use to_hash. Otherwise, just return the value
180
+ # @param [Object] value Any valid value
181
+ # @return [Hash] Returns the value in the form of hash
182
+ def _to_hash(value)
183
+ if value.is_a?(Array)
184
+ value.compact.map { |v| _to_hash(v) }
185
+ elsif value.is_a?(Hash)
186
+ {}.tap do |hash|
187
+ value.each { |k, v| hash[k] = _to_hash(v) }
188
+ end
189
+ elsif value.respond_to? :to_hash
190
+ value.to_hash
191
+ else
192
+ value
193
+ end
194
+ end
195
+ end
196
+ end
197
+ # rubocop:enable Lint/UnneededCopDisableDirective
@@ -0,0 +1,243 @@
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 set of aggregated data returned for a metric.
8
+ # For information about metrics, see [Metrics Overview](https://docs.us-phoenix-1.oraclecloud.com/iaas/Content/Monitoring/Concepts/monitoringoverview.htm#MetricsOverview).
9
+ #
10
+ class Monitoring::Models::MetricData # rubocop:disable Metrics/LineLength
11
+ # **[Required]** The reference provided in a metric definition to indicate the source service or
12
+ # application that emitted the metric.
13
+ #
14
+ # Example: `oci_computeagent`
15
+ #
16
+ # @return [String]
17
+ attr_accessor :namespace
18
+
19
+ # **[Required]** The [OCID](https://docs.us-phoenix-1.oraclecloud.com/iaas/Content/General/Concepts/identifiers.htm) of the compartment containing the
20
+ # resources from which the aggregated data was returned.
21
+ #
22
+ # @return [String]
23
+ attr_accessor :compartment_id
24
+
25
+ # **[Required]** The name of the metric.
26
+ #
27
+ # Example: `CpuUtilization`
28
+ #
29
+ # @return [String]
30
+ attr_accessor :name
31
+
32
+ # **[Required]** Qualifiers provided in the definition of the returned metric.
33
+ # Available dimensions vary by metric namespace. Each dimension takes the form of a key-value pair.
34
+ #
35
+ # Example: `\"resourceId\": \"ocid1.instance.region1.phx.exampleuniqueID\"`
36
+ #
37
+ # @return [Hash<String, String>]
38
+ attr_accessor :dimensions
39
+
40
+ # The references provided in a metric definition to indicate extra information about the metric.
41
+ #
42
+ # Example: `\"unit\": \"bytes\"`
43
+ #
44
+ # @return [Hash<String, String>]
45
+ attr_accessor :metadata
46
+
47
+ # The time between calculated aggregation windows. Use with the query interval to vary the
48
+ # frequency at which aggregated data points are returned. For example, use a query interval of
49
+ # 5 minutes with a resolution of 1 minute to retrieve five-minute aggregations at a one-minute
50
+ # frequency. The resolution must be equal or less than the interval in the query. The default
51
+ # resolution is 1m (one minute). Supported values: `1m`-`60m` (also `1h`).
52
+ #
53
+ # Example: `5m`
54
+ #
55
+ # @return [String]
56
+ attr_accessor :resolution
57
+
58
+ # **[Required]** The list of timestamp-value pairs returned for the specified request. Metric values are rolled up to the start time specified in the request.
59
+ #
60
+ # @return [Array<OCI::Monitoring::Models::AggregatedDatapoint>]
61
+ attr_accessor :aggregated_datapoints
62
+
63
+ # Attribute mapping from ruby-style variable name to JSON key.
64
+ def self.attribute_map
65
+ {
66
+ # rubocop:disable Style/SymbolLiteral
67
+ 'namespace': :'namespace',
68
+ 'compartment_id': :'compartmentId',
69
+ 'name': :'name',
70
+ 'dimensions': :'dimensions',
71
+ 'metadata': :'metadata',
72
+ 'resolution': :'resolution',
73
+ 'aggregated_datapoints': :'aggregatedDatapoints'
74
+ # rubocop:enable Style/SymbolLiteral
75
+ }
76
+ end
77
+
78
+ # Attribute type mapping.
79
+ def self.swagger_types
80
+ {
81
+ # rubocop:disable Style/SymbolLiteral
82
+ 'namespace': :'String',
83
+ 'compartment_id': :'String',
84
+ 'name': :'String',
85
+ 'dimensions': :'Hash<String, String>',
86
+ 'metadata': :'Hash<String, String>',
87
+ 'resolution': :'String',
88
+ 'aggregated_datapoints': :'Array<OCI::Monitoring::Models::AggregatedDatapoint>'
89
+ # rubocop:enable Style/SymbolLiteral
90
+ }
91
+ end
92
+
93
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
94
+ # rubocop:disable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
95
+
96
+
97
+ # Initializes the object
98
+ # @param [Hash] attributes Model attributes in the form of hash
99
+ # @option attributes [String] :namespace The value to assign to the {#namespace} property
100
+ # @option attributes [String] :compartment_id The value to assign to the {#compartment_id} property
101
+ # @option attributes [String] :name The value to assign to the {#name} property
102
+ # @option attributes [Hash<String, String>] :dimensions The value to assign to the {#dimensions} property
103
+ # @option attributes [Hash<String, String>] :metadata The value to assign to the {#metadata} property
104
+ # @option attributes [String] :resolution The value to assign to the {#resolution} property
105
+ # @option attributes [Array<OCI::Monitoring::Models::AggregatedDatapoint>] :aggregated_datapoints The value to assign to the {#aggregated_datapoints} property
106
+ def initialize(attributes = {})
107
+ return unless attributes.is_a?(Hash)
108
+
109
+ # convert string to symbol for hash key
110
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
111
+
112
+ self.namespace = attributes[:'namespace'] if attributes[:'namespace']
113
+
114
+ self.compartment_id = attributes[:'compartmentId'] if attributes[:'compartmentId']
115
+
116
+ raise 'You cannot provide both :compartmentId and :compartment_id' if attributes.key?(:'compartmentId') && attributes.key?(:'compartment_id')
117
+
118
+ self.compartment_id = attributes[:'compartment_id'] if attributes[:'compartment_id']
119
+
120
+ self.name = attributes[:'name'] if attributes[:'name']
121
+
122
+ self.dimensions = attributes[:'dimensions'] if attributes[:'dimensions']
123
+
124
+ self.metadata = attributes[:'metadata'] if attributes[:'metadata']
125
+
126
+ self.resolution = attributes[:'resolution'] if attributes[:'resolution']
127
+
128
+ self.aggregated_datapoints = attributes[:'aggregatedDatapoints'] if attributes[:'aggregatedDatapoints']
129
+
130
+ raise 'You cannot provide both :aggregatedDatapoints and :aggregated_datapoints' if attributes.key?(:'aggregatedDatapoints') && attributes.key?(:'aggregated_datapoints')
131
+
132
+ self.aggregated_datapoints = attributes[:'aggregated_datapoints'] if attributes[:'aggregated_datapoints']
133
+ end
134
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
135
+ # rubocop:enable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
136
+
137
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Metrics/LineLength, Layout/EmptyLines
138
+
139
+
140
+ # Checks equality by comparing each attribute.
141
+ # @param [Object] other the other object to be compared
142
+ def ==(other)
143
+ return true if equal?(other)
144
+
145
+ self.class == other.class &&
146
+ namespace == other.namespace &&
147
+ compartment_id == other.compartment_id &&
148
+ name == other.name &&
149
+ dimensions == other.dimensions &&
150
+ metadata == other.metadata &&
151
+ resolution == other.resolution &&
152
+ aggregated_datapoints == other.aggregated_datapoints
153
+ end
154
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Metrics/LineLength, Layout/EmptyLines
155
+
156
+ # @see the `==` method
157
+ # @param [Object] other the other object to be compared
158
+ def eql?(other)
159
+ self == other
160
+ end
161
+
162
+ # rubocop:disable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
163
+
164
+
165
+ # Calculates hash code according to all attributes.
166
+ # @return [Fixnum] Hash code
167
+ def hash
168
+ [namespace, compartment_id, name, dimensions, metadata, resolution, aggregated_datapoints].hash
169
+ end
170
+ # rubocop:enable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
171
+
172
+ # rubocop:disable Metrics/AbcSize, Layout/EmptyLines
173
+
174
+
175
+ # Builds the object from hash
176
+ # @param [Hash] attributes Model attributes in the form of hash
177
+ # @return [Object] Returns the model itself
178
+ def build_from_hash(attributes)
179
+ return nil unless attributes.is_a?(Hash)
180
+
181
+ self.class.swagger_types.each_pair do |key, type|
182
+ if type =~ /^Array<(.*)>/i
183
+ # check to ensure the input is an array given that the the attribute
184
+ # is documented as an array but the input is not
185
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
186
+ public_method("#{key}=").call(
187
+ attributes[self.class.attribute_map[key]]
188
+ .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
189
+ )
190
+ end
191
+ elsif !attributes[self.class.attribute_map[key]].nil?
192
+ public_method("#{key}=").call(
193
+ OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
194
+ )
195
+ end
196
+ # or else data not found in attributes(hash), not an issue as the data can be optional
197
+ end
198
+
199
+ self
200
+ end
201
+ # rubocop:enable Metrics/AbcSize, Layout/EmptyLines
202
+
203
+ # Returns the string representation of the object
204
+ # @return [String] String presentation of the object
205
+ def to_s
206
+ to_hash.to_s
207
+ end
208
+
209
+ # Returns the object in the form of hash
210
+ # @return [Hash] Returns the object in the form of hash
211
+ def to_hash
212
+ hash = {}
213
+ self.class.attribute_map.each_pair do |attr, param|
214
+ value = public_method(attr).call
215
+ next if value.nil? && !instance_variable_defined?("@#{attr}")
216
+
217
+ hash[param] = _to_hash(value)
218
+ end
219
+ hash
220
+ end
221
+
222
+ private
223
+
224
+ # Outputs non-array value in the form of hash
225
+ # For object, use to_hash. Otherwise, just return the value
226
+ # @param [Object] value Any valid value
227
+ # @return [Hash] Returns the value in the form of hash
228
+ def _to_hash(value)
229
+ if value.is_a?(Array)
230
+ value.compact.map { |v| _to_hash(v) }
231
+ elsif value.is_a?(Hash)
232
+ {}.tap do |hash|
233
+ value.each { |k, v| hash[k] = _to_hash(v) }
234
+ end
235
+ elsif value.respond_to? :to_hash
236
+ value.to_hash
237
+ else
238
+ value
239
+ end
240
+ end
241
+ end
242
+ end
243
+ # rubocop:enable Lint/UnneededCopDisableDirective
@@ -0,0 +1,227 @@
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 metric object containing raw metric data points to be posted to the Monitoring service.
8
+ #
9
+ class Monitoring::Models::MetricDataDetails # rubocop:disable Metrics/LineLength
10
+ # **[Required]** The source service or application emitting the metric.
11
+ #
12
+ # A valid namespace value starts with an alphabetical character and includes only alphanumeric characters and underscores. The \"oci_\" prefix is reserved.
13
+ # Avoid entering confidential information.
14
+ #
15
+ # Example: `my_namespace`
16
+ #
17
+ # @return [String]
18
+ attr_accessor :namespace
19
+
20
+ # **[Required]** The [OCID](https://docs.us-phoenix-1.oraclecloud.com/iaas/Content/General/Concepts/identifiers.htm) of the compartment to use for metrics.
21
+ #
22
+ # @return [String]
23
+ attr_accessor :compartment_id
24
+
25
+ # **[Required]** The name of the metric.
26
+ #
27
+ # A valid name value starts with an alphabetical character and includes only alphanumeric characters, dots, underscores, hyphens, and dollar signs.
28
+ # Avoid entering confidential information.
29
+ #
30
+ # Example: `my_app.success_rate`
31
+ #
32
+ # @return [String]
33
+ attr_accessor :name
34
+
35
+ # Qualifiers provided in a metric definition. Available dimensions vary by metric namespace.
36
+ #
37
+ # Each dimension takes the form of a key-value pair. A valid dimension key includes only printable ASCII, excluding periods (.) and spaces. A valid dimension value includes only Unicode characters.
38
+ # Empty strings are not allowed for keys or values. Avoid entering confidential information.
39
+ #
40
+ # Example: `\"resourceId\": \"ocid1.instance.region1.phx.exampleuniqueID\"`
41
+ #
42
+ # @return [Hash<String, String>]
43
+ attr_accessor :dimensions
44
+
45
+ # Properties describing metrics. These are not part of the unique fields identifying the metric.
46
+ #
47
+ # Example: `\"unit\": \"bytes\"`
48
+ #
49
+ # @return [Hash<String, String>]
50
+ attr_accessor :metadata
51
+
52
+ # **[Required]** A list of metric values with timestamps. At least one data point is required per call.
53
+ #
54
+ # @return [Array<OCI::Monitoring::Models::Datapoint>]
55
+ attr_accessor :datapoints
56
+
57
+ # Attribute mapping from ruby-style variable name to JSON key.
58
+ def self.attribute_map
59
+ {
60
+ # rubocop:disable Style/SymbolLiteral
61
+ 'namespace': :'namespace',
62
+ 'compartment_id': :'compartmentId',
63
+ 'name': :'name',
64
+ 'dimensions': :'dimensions',
65
+ 'metadata': :'metadata',
66
+ 'datapoints': :'datapoints'
67
+ # rubocop:enable Style/SymbolLiteral
68
+ }
69
+ end
70
+
71
+ # Attribute type mapping.
72
+ def self.swagger_types
73
+ {
74
+ # rubocop:disable Style/SymbolLiteral
75
+ 'namespace': :'String',
76
+ 'compartment_id': :'String',
77
+ 'name': :'String',
78
+ 'dimensions': :'Hash<String, String>',
79
+ 'metadata': :'Hash<String, String>',
80
+ 'datapoints': :'Array<OCI::Monitoring::Models::Datapoint>'
81
+ # rubocop:enable Style/SymbolLiteral
82
+ }
83
+ end
84
+
85
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
86
+ # rubocop:disable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
87
+
88
+
89
+ # Initializes the object
90
+ # @param [Hash] attributes Model attributes in the form of hash
91
+ # @option attributes [String] :namespace The value to assign to the {#namespace} property
92
+ # @option attributes [String] :compartment_id The value to assign to the {#compartment_id} property
93
+ # @option attributes [String] :name The value to assign to the {#name} property
94
+ # @option attributes [Hash<String, String>] :dimensions The value to assign to the {#dimensions} property
95
+ # @option attributes [Hash<String, String>] :metadata The value to assign to the {#metadata} property
96
+ # @option attributes [Array<OCI::Monitoring::Models::Datapoint>] :datapoints The value to assign to the {#datapoints} property
97
+ def initialize(attributes = {})
98
+ return unless attributes.is_a?(Hash)
99
+
100
+ # convert string to symbol for hash key
101
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
102
+
103
+ self.namespace = attributes[:'namespace'] if attributes[:'namespace']
104
+
105
+ self.compartment_id = attributes[:'compartmentId'] if attributes[:'compartmentId']
106
+
107
+ raise 'You cannot provide both :compartmentId and :compartment_id' if attributes.key?(:'compartmentId') && attributes.key?(:'compartment_id')
108
+
109
+ self.compartment_id = attributes[:'compartment_id'] if attributes[:'compartment_id']
110
+
111
+ self.name = attributes[:'name'] if attributes[:'name']
112
+
113
+ self.dimensions = attributes[:'dimensions'] if attributes[:'dimensions']
114
+
115
+ self.metadata = attributes[:'metadata'] if attributes[:'metadata']
116
+
117
+ self.datapoints = attributes[:'datapoints'] if attributes[:'datapoints']
118
+ end
119
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
120
+ # rubocop:enable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
121
+
122
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Metrics/LineLength, Layout/EmptyLines
123
+
124
+
125
+ # Checks equality by comparing each attribute.
126
+ # @param [Object] other the other object to be compared
127
+ def ==(other)
128
+ return true if equal?(other)
129
+
130
+ self.class == other.class &&
131
+ namespace == other.namespace &&
132
+ compartment_id == other.compartment_id &&
133
+ name == other.name &&
134
+ dimensions == other.dimensions &&
135
+ metadata == other.metadata &&
136
+ datapoints == other.datapoints
137
+ end
138
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Metrics/LineLength, Layout/EmptyLines
139
+
140
+ # @see the `==` method
141
+ # @param [Object] other the other object to be compared
142
+ def eql?(other)
143
+ self == other
144
+ end
145
+
146
+ # rubocop:disable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
147
+
148
+
149
+ # Calculates hash code according to all attributes.
150
+ # @return [Fixnum] Hash code
151
+ def hash
152
+ [namespace, compartment_id, name, dimensions, metadata, datapoints].hash
153
+ end
154
+ # rubocop:enable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
155
+
156
+ # rubocop:disable Metrics/AbcSize, Layout/EmptyLines
157
+
158
+
159
+ # Builds the object from hash
160
+ # @param [Hash] attributes Model attributes in the form of hash
161
+ # @return [Object] Returns the model itself
162
+ def build_from_hash(attributes)
163
+ return nil unless attributes.is_a?(Hash)
164
+
165
+ self.class.swagger_types.each_pair do |key, type|
166
+ if type =~ /^Array<(.*)>/i
167
+ # check to ensure the input is an array given that the the attribute
168
+ # is documented as an array but the input is not
169
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
170
+ public_method("#{key}=").call(
171
+ attributes[self.class.attribute_map[key]]
172
+ .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
173
+ )
174
+ end
175
+ elsif !attributes[self.class.attribute_map[key]].nil?
176
+ public_method("#{key}=").call(
177
+ OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
178
+ )
179
+ end
180
+ # or else data not found in attributes(hash), not an issue as the data can be optional
181
+ end
182
+
183
+ self
184
+ end
185
+ # rubocop:enable Metrics/AbcSize, Layout/EmptyLines
186
+
187
+ # Returns the string representation of the object
188
+ # @return [String] String presentation of the object
189
+ def to_s
190
+ to_hash.to_s
191
+ end
192
+
193
+ # Returns the object in the form of hash
194
+ # @return [Hash] Returns the object in the form of hash
195
+ def to_hash
196
+ hash = {}
197
+ self.class.attribute_map.each_pair do |attr, param|
198
+ value = public_method(attr).call
199
+ next if value.nil? && !instance_variable_defined?("@#{attr}")
200
+
201
+ hash[param] = _to_hash(value)
202
+ end
203
+ hash
204
+ end
205
+
206
+ private
207
+
208
+ # Outputs non-array value in the form of hash
209
+ # For object, use to_hash. Otherwise, just return the value
210
+ # @param [Object] value Any valid value
211
+ # @return [Hash] Returns the value in the form of hash
212
+ def _to_hash(value)
213
+ if value.is_a?(Array)
214
+ value.compact.map { |v| _to_hash(v) }
215
+ elsif value.is_a?(Hash)
216
+ {}.tap do |hash|
217
+ value.each { |k, v| hash[k] = _to_hash(v) }
218
+ end
219
+ elsif value.respond_to? :to_hash
220
+ value.to_hash
221
+ else
222
+ value
223
+ end
224
+ end
225
+ end
226
+ end
227
+ # rubocop:enable Lint/UnneededCopDisableDirective