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,179 @@
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
+ # Metric value for a specific timestamp.
8
+ #
9
+ class Monitoring::Models::Datapoint # rubocop:disable Metrics/LineLength
10
+ # **[Required]** Timestamp for this metric value. 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.23`
20
+ #
21
+ # @return [Float]
22
+ attr_accessor :value
23
+
24
+ # The number of occurrences of the associated value in the set of data.
25
+ #
26
+ # Optional. Default is 1.
27
+ #
28
+ # @return [Integer]
29
+ attr_accessor :count
30
+
31
+ # Attribute mapping from ruby-style variable name to JSON key.
32
+ def self.attribute_map
33
+ {
34
+ # rubocop:disable Style/SymbolLiteral
35
+ 'timestamp': :'timestamp',
36
+ 'value': :'value',
37
+ 'count': :'count'
38
+ # rubocop:enable Style/SymbolLiteral
39
+ }
40
+ end
41
+
42
+ # Attribute type mapping.
43
+ def self.swagger_types
44
+ {
45
+ # rubocop:disable Style/SymbolLiteral
46
+ 'timestamp': :'DateTime',
47
+ 'value': :'Float',
48
+ 'count': :'Integer'
49
+ # rubocop:enable Style/SymbolLiteral
50
+ }
51
+ end
52
+
53
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
54
+ # rubocop:disable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
55
+
56
+
57
+ # Initializes the object
58
+ # @param [Hash] attributes Model attributes in the form of hash
59
+ # @option attributes [DateTime] :timestamp The value to assign to the {#timestamp} property
60
+ # @option attributes [Float] :value The value to assign to the {#value} property
61
+ # @option attributes [Integer] :count The value to assign to the {#count} property
62
+ def initialize(attributes = {})
63
+ return unless attributes.is_a?(Hash)
64
+
65
+ # convert string to symbol for hash key
66
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
67
+
68
+ self.timestamp = attributes[:'timestamp'] if attributes[:'timestamp']
69
+
70
+ self.value = attributes[:'value'] if attributes[:'value']
71
+
72
+ self.count = attributes[:'count'] if attributes[:'count']
73
+ end
74
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
75
+ # rubocop:enable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
76
+
77
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Metrics/LineLength, Layout/EmptyLines
78
+
79
+
80
+ # Checks equality by comparing each attribute.
81
+ # @param [Object] other the other object to be compared
82
+ def ==(other)
83
+ return true if equal?(other)
84
+
85
+ self.class == other.class &&
86
+ timestamp == other.timestamp &&
87
+ value == other.value &&
88
+ count == other.count
89
+ end
90
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Metrics/LineLength, Layout/EmptyLines
91
+
92
+ # @see the `==` method
93
+ # @param [Object] other the other object to be compared
94
+ def eql?(other)
95
+ self == other
96
+ end
97
+
98
+ # rubocop:disable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
99
+
100
+
101
+ # Calculates hash code according to all attributes.
102
+ # @return [Fixnum] Hash code
103
+ def hash
104
+ [timestamp, value, count].hash
105
+ end
106
+ # rubocop:enable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
107
+
108
+ # rubocop:disable Metrics/AbcSize, Layout/EmptyLines
109
+
110
+
111
+ # Builds the object from hash
112
+ # @param [Hash] attributes Model attributes in the form of hash
113
+ # @return [Object] Returns the model itself
114
+ def build_from_hash(attributes)
115
+ return nil unless attributes.is_a?(Hash)
116
+
117
+ self.class.swagger_types.each_pair do |key, type|
118
+ if type =~ /^Array<(.*)>/i
119
+ # check to ensure the input is an array given that the the attribute
120
+ # is documented as an array but the input is not
121
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
122
+ public_method("#{key}=").call(
123
+ attributes[self.class.attribute_map[key]]
124
+ .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
125
+ )
126
+ end
127
+ elsif !attributes[self.class.attribute_map[key]].nil?
128
+ public_method("#{key}=").call(
129
+ OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
130
+ )
131
+ end
132
+ # or else data not found in attributes(hash), not an issue as the data can be optional
133
+ end
134
+
135
+ self
136
+ end
137
+ # rubocop:enable Metrics/AbcSize, Layout/EmptyLines
138
+
139
+ # Returns the string representation of the object
140
+ # @return [String] String presentation of the object
141
+ def to_s
142
+ to_hash.to_s
143
+ end
144
+
145
+ # Returns the object in the form of hash
146
+ # @return [Hash] Returns the object in the form of hash
147
+ def to_hash
148
+ hash = {}
149
+ self.class.attribute_map.each_pair do |attr, param|
150
+ value = public_method(attr).call
151
+ next if value.nil? && !instance_variable_defined?("@#{attr}")
152
+
153
+ hash[param] = _to_hash(value)
154
+ end
155
+ hash
156
+ end
157
+
158
+ private
159
+
160
+ # Outputs non-array value in the form of hash
161
+ # For object, use to_hash. Otherwise, just return the value
162
+ # @param [Object] value Any valid value
163
+ # @return [Hash] Returns the value in the form of hash
164
+ def _to_hash(value)
165
+ if value.is_a?(Array)
166
+ value.compact.map { |v| _to_hash(v) }
167
+ elsif value.is_a?(Hash)
168
+ {}.tap do |hash|
169
+ value.each { |k, v| hash[k] = _to_hash(v) }
170
+ end
171
+ elsif value.respond_to? :to_hash
172
+ value.to_hash
173
+ else
174
+ value
175
+ end
176
+ end
177
+ end
178
+ end
179
+ # rubocop:enable Lint/UnneededCopDisableDirective
@@ -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
+ # The record of a single metric object that failed input validation and the reason for the failure.
8
+ #
9
+ class Monitoring::Models::FailedMetricRecord # rubocop:disable Metrics/LineLength
10
+ # **[Required]** An error message indicating the reason that the indicated metric object failed input validation.
11
+ #
12
+ # @return [String]
13
+ attr_accessor :message
14
+
15
+ # **[Required]** Identifier of a metric object that failed input validation.
16
+ #
17
+ # @return [OCI::Monitoring::Models::MetricDataDetails]
18
+ attr_accessor :metric_data
19
+
20
+ # Attribute mapping from ruby-style variable name to JSON key.
21
+ def self.attribute_map
22
+ {
23
+ # rubocop:disable Style/SymbolLiteral
24
+ 'message': :'message',
25
+ 'metric_data': :'metricData'
26
+ # rubocop:enable Style/SymbolLiteral
27
+ }
28
+ end
29
+
30
+ # Attribute type mapping.
31
+ def self.swagger_types
32
+ {
33
+ # rubocop:disable Style/SymbolLiteral
34
+ 'message': :'String',
35
+ 'metric_data': :'OCI::Monitoring::Models::MetricDataDetails'
36
+ # rubocop:enable Style/SymbolLiteral
37
+ }
38
+ end
39
+
40
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
41
+ # rubocop:disable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
42
+
43
+
44
+ # Initializes the object
45
+ # @param [Hash] attributes Model attributes in the form of hash
46
+ # @option attributes [String] :message The value to assign to the {#message} property
47
+ # @option attributes [OCI::Monitoring::Models::MetricDataDetails] :metric_data The value to assign to the {#metric_data} property
48
+ def initialize(attributes = {})
49
+ return unless attributes.is_a?(Hash)
50
+
51
+ # convert string to symbol for hash key
52
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
53
+
54
+ self.message = attributes[:'message'] if attributes[:'message']
55
+
56
+ self.metric_data = attributes[:'metricData'] if attributes[:'metricData']
57
+
58
+ raise 'You cannot provide both :metricData and :metric_data' if attributes.key?(:'metricData') && attributes.key?(:'metric_data')
59
+
60
+ self.metric_data = attributes[:'metric_data'] if attributes[:'metric_data']
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
+ message == other.message &&
75
+ metric_data == other.metric_data
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
+ [message, metric_data].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,271 @@
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 request details for retrieving metric definitions. Specify optional properties to filter the returned results.
8
+ # Use an asterisk (\"\\*\") as a wildcard character, placed anywhere in the string.
9
+ # For example, to search for all metrics with names that begin with \"disk\", specify \"name\" as \"disk\\*\".
10
+ # If no properties are specified, then all metric definitions within the request scope are returned.
11
+ #
12
+ class Monitoring::Models::ListMetricsDetails # rubocop:disable Metrics/LineLength
13
+ SORT_BY_ENUM = [
14
+ SORT_BY_NAMESPACE = 'NAMESPACE'.freeze,
15
+ SORT_BY_NAME = 'NAME'.freeze
16
+ ].freeze
17
+
18
+ SORT_ORDER_ENUM = [
19
+ SORT_ORDER_ASC = 'ASC'.freeze,
20
+ SORT_ORDER_DESC = 'DESC'.freeze
21
+ ].freeze
22
+
23
+ # The metric name to use when searching for metric definitions.
24
+ #
25
+ # Example: `CpuUtilization`
26
+ #
27
+ # @return [String]
28
+ attr_accessor :name
29
+
30
+ # The source service or application to use when searching for metric definitions.
31
+ #
32
+ # Example: `oci_computeagent`
33
+ #
34
+ # @return [String]
35
+ attr_accessor :namespace
36
+
37
+ # Qualifiers that you want to use when searching for metric definitions.
38
+ # Available dimensions vary by metric namespace. Each dimension takes the form of a key-value pair.
39
+ #
40
+ # Example: { \"resourceId\": \"<var>&lt;instance_OCID&gt;</var>\" }
41
+ #
42
+ # @return [Hash<String, String>]
43
+ attr_accessor :dimension_filters
44
+
45
+ # Group metrics by these fields in the response. For example, to list all metric namespaces available
46
+ # in a compartment, groupBy the \"namespace\" field.
47
+ #
48
+ # Example - group by namespace and resource:
49
+ # `[ \"namespace\", \"resourceId\" ]`
50
+ #
51
+ # @return [Array<String>]
52
+ attr_accessor :group_by
53
+
54
+ # The field to use when sorting returned metric definitions. Only one sorting level is provided.
55
+ #
56
+ # Example: `NAMESPACE`
57
+ #
58
+ # @return [String]
59
+ attr_reader :sort_by
60
+
61
+ # The sort order to use when sorting returned metric definitions. Ascending (ASC) or
62
+ # descending (DESC).
63
+ #
64
+ # Example: `ASC`
65
+ #
66
+ # @return [String]
67
+ attr_reader :sort_order
68
+
69
+ # Attribute mapping from ruby-style variable name to JSON key.
70
+ def self.attribute_map
71
+ {
72
+ # rubocop:disable Style/SymbolLiteral
73
+ 'name': :'name',
74
+ 'namespace': :'namespace',
75
+ 'dimension_filters': :'dimensionFilters',
76
+ 'group_by': :'groupBy',
77
+ 'sort_by': :'sortBy',
78
+ 'sort_order': :'sortOrder'
79
+ # rubocop:enable Style/SymbolLiteral
80
+ }
81
+ end
82
+
83
+ # Attribute type mapping.
84
+ def self.swagger_types
85
+ {
86
+ # rubocop:disable Style/SymbolLiteral
87
+ 'name': :'String',
88
+ 'namespace': :'String',
89
+ 'dimension_filters': :'Hash<String, String>',
90
+ 'group_by': :'Array<String>',
91
+ 'sort_by': :'String',
92
+ 'sort_order': :'String'
93
+ # rubocop:enable Style/SymbolLiteral
94
+ }
95
+ end
96
+
97
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
98
+ # rubocop:disable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
99
+
100
+
101
+ # Initializes the object
102
+ # @param [Hash] attributes Model attributes in the form of hash
103
+ # @option attributes [String] :name The value to assign to the {#name} property
104
+ # @option attributes [String] :namespace The value to assign to the {#namespace} property
105
+ # @option attributes [Hash<String, String>] :dimension_filters The value to assign to the {#dimension_filters} property
106
+ # @option attributes [Array<String>] :group_by The value to assign to the {#group_by} property
107
+ # @option attributes [String] :sort_by The value to assign to the {#sort_by} property
108
+ # @option attributes [String] :sort_order The value to assign to the {#sort_order} property
109
+ def initialize(attributes = {})
110
+ return unless attributes.is_a?(Hash)
111
+
112
+ # convert string to symbol for hash key
113
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
114
+
115
+ self.name = attributes[:'name'] if attributes[:'name']
116
+
117
+ self.namespace = attributes[:'namespace'] if attributes[:'namespace']
118
+
119
+ self.dimension_filters = attributes[:'dimensionFilters'] if attributes[:'dimensionFilters']
120
+
121
+ raise 'You cannot provide both :dimensionFilters and :dimension_filters' if attributes.key?(:'dimensionFilters') && attributes.key?(:'dimension_filters')
122
+
123
+ self.dimension_filters = attributes[:'dimension_filters'] if attributes[:'dimension_filters']
124
+
125
+ self.group_by = attributes[:'groupBy'] if attributes[:'groupBy']
126
+
127
+ raise 'You cannot provide both :groupBy and :group_by' if attributes.key?(:'groupBy') && attributes.key?(:'group_by')
128
+
129
+ self.group_by = attributes[:'group_by'] if attributes[:'group_by']
130
+
131
+ self.sort_by = attributes[:'sortBy'] if attributes[:'sortBy']
132
+
133
+ raise 'You cannot provide both :sortBy and :sort_by' if attributes.key?(:'sortBy') && attributes.key?(:'sort_by')
134
+
135
+ self.sort_by = attributes[:'sort_by'] if attributes[:'sort_by']
136
+
137
+ self.sort_order = attributes[:'sortOrder'] if attributes[:'sortOrder']
138
+
139
+ raise 'You cannot provide both :sortOrder and :sort_order' if attributes.key?(:'sortOrder') && attributes.key?(:'sort_order')
140
+
141
+ self.sort_order = attributes[:'sort_order'] if attributes[:'sort_order']
142
+ end
143
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
144
+ # rubocop:enable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
145
+
146
+ # Custom attribute writer method checking allowed values (enum).
147
+ # @param [Object] sort_by Object to be assigned
148
+ def sort_by=(sort_by)
149
+ # rubocop: disable Metrics/LineLength
150
+ raise "Invalid value for 'sort_by': this must be one of the values in SORT_BY_ENUM." if sort_by && !SORT_BY_ENUM.include?(sort_by)
151
+
152
+ # rubocop: enable Metrics/LineLength
153
+ @sort_by = sort_by
154
+ end
155
+
156
+ # Custom attribute writer method checking allowed values (enum).
157
+ # @param [Object] sort_order Object to be assigned
158
+ def sort_order=(sort_order)
159
+ # rubocop: disable Metrics/LineLength
160
+ raise "Invalid value for 'sort_order': this must be one of the values in SORT_ORDER_ENUM." if sort_order && !SORT_ORDER_ENUM.include?(sort_order)
161
+
162
+ # rubocop: enable Metrics/LineLength
163
+ @sort_order = sort_order
164
+ end
165
+
166
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Metrics/LineLength, Layout/EmptyLines
167
+
168
+
169
+ # Checks equality by comparing each attribute.
170
+ # @param [Object] other the other object to be compared
171
+ def ==(other)
172
+ return true if equal?(other)
173
+
174
+ self.class == other.class &&
175
+ name == other.name &&
176
+ namespace == other.namespace &&
177
+ dimension_filters == other.dimension_filters &&
178
+ group_by == other.group_by &&
179
+ sort_by == other.sort_by &&
180
+ sort_order == other.sort_order
181
+ end
182
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Metrics/LineLength, Layout/EmptyLines
183
+
184
+ # @see the `==` method
185
+ # @param [Object] other the other object to be compared
186
+ def eql?(other)
187
+ self == other
188
+ end
189
+
190
+ # rubocop:disable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
191
+
192
+
193
+ # Calculates hash code according to all attributes.
194
+ # @return [Fixnum] Hash code
195
+ def hash
196
+ [name, namespace, dimension_filters, group_by, sort_by, sort_order].hash
197
+ end
198
+ # rubocop:enable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
199
+
200
+ # rubocop:disable Metrics/AbcSize, Layout/EmptyLines
201
+
202
+
203
+ # Builds the object from hash
204
+ # @param [Hash] attributes Model attributes in the form of hash
205
+ # @return [Object] Returns the model itself
206
+ def build_from_hash(attributes)
207
+ return nil unless attributes.is_a?(Hash)
208
+
209
+ self.class.swagger_types.each_pair do |key, type|
210
+ if type =~ /^Array<(.*)>/i
211
+ # check to ensure the input is an array given that the the attribute
212
+ # is documented as an array but the input is not
213
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
214
+ public_method("#{key}=").call(
215
+ attributes[self.class.attribute_map[key]]
216
+ .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
217
+ )
218
+ end
219
+ elsif !attributes[self.class.attribute_map[key]].nil?
220
+ public_method("#{key}=").call(
221
+ OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
222
+ )
223
+ end
224
+ # or else data not found in attributes(hash), not an issue as the data can be optional
225
+ end
226
+
227
+ self
228
+ end
229
+ # rubocop:enable Metrics/AbcSize, Layout/EmptyLines
230
+
231
+ # Returns the string representation of the object
232
+ # @return [String] String presentation of the object
233
+ def to_s
234
+ to_hash.to_s
235
+ end
236
+
237
+ # Returns the object in the form of hash
238
+ # @return [Hash] Returns the object in the form of hash
239
+ def to_hash
240
+ hash = {}
241
+ self.class.attribute_map.each_pair do |attr, param|
242
+ value = public_method(attr).call
243
+ next if value.nil? && !instance_variable_defined?("@#{attr}")
244
+
245
+ hash[param] = _to_hash(value)
246
+ end
247
+ hash
248
+ end
249
+
250
+ private
251
+
252
+ # Outputs non-array value in the form of hash
253
+ # For object, use to_hash. Otherwise, just return the value
254
+ # @param [Object] value Any valid value
255
+ # @return [Hash] Returns the value in the form of hash
256
+ def _to_hash(value)
257
+ if value.is_a?(Array)
258
+ value.compact.map { |v| _to_hash(v) }
259
+ elsif value.is_a?(Hash)
260
+ {}.tap do |hash|
261
+ value.each { |k, v| hash[k] = _to_hash(v) }
262
+ end
263
+ elsif value.respond_to? :to_hash
264
+ value.to_hash
265
+ else
266
+ value
267
+ end
268
+ end
269
+ end
270
+ end
271
+ # rubocop:enable Lint/UnneededCopDisableDirective