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,186 @@
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
+ # Metric threshold details
9
+ #
10
+ class Autoscaling::Models::Metric # rubocop:disable Metrics/LineLength
11
+ METRIC_TYPE_ENUM = [
12
+ METRIC_TYPE_CPU_UTILIZATION = 'CPU_UTILIZATION'.freeze,
13
+ METRIC_TYPE_MEMORY_UTILIZATION = 'MEMORY_UTILIZATION'.freeze,
14
+ METRIC_TYPE_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
15
+ ].freeze
16
+
17
+ # This attribute is required.
18
+ # @return [String]
19
+ attr_reader :metric_type
20
+
21
+ # This attribute is required.
22
+ # @return [OCI::Autoscaling::Models::Threshold]
23
+ attr_accessor :threshold
24
+
25
+ # Attribute mapping from ruby-style variable name to JSON key.
26
+ def self.attribute_map
27
+ {
28
+ # rubocop:disable Style/SymbolLiteral
29
+ 'metric_type': :'metricType',
30
+ 'threshold': :'threshold'
31
+ # rubocop:enable Style/SymbolLiteral
32
+ }
33
+ end
34
+
35
+ # Attribute type mapping.
36
+ def self.swagger_types
37
+ {
38
+ # rubocop:disable Style/SymbolLiteral
39
+ 'metric_type': :'String',
40
+ 'threshold': :'OCI::Autoscaling::Models::Threshold'
41
+ # rubocop:enable Style/SymbolLiteral
42
+ }
43
+ end
44
+
45
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
46
+ # rubocop:disable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
47
+
48
+
49
+ # Initializes the object
50
+ # @param [Hash] attributes Model attributes in the form of hash
51
+ # @option attributes [String] :metric_type The value to assign to the {#metric_type} property
52
+ # @option attributes [OCI::Autoscaling::Models::Threshold] :threshold The value to assign to the {#threshold} property
53
+ def initialize(attributes = {})
54
+ return unless attributes.is_a?(Hash)
55
+
56
+ # convert string to symbol for hash key
57
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
58
+
59
+ self.metric_type = attributes[:'metricType'] if attributes[:'metricType']
60
+
61
+ raise 'You cannot provide both :metricType and :metric_type' if attributes.key?(:'metricType') && attributes.key?(:'metric_type')
62
+
63
+ self.metric_type = attributes[:'metric_type'] if attributes[:'metric_type']
64
+
65
+ self.threshold = attributes[:'threshold'] if attributes[:'threshold']
66
+ end
67
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
68
+ # rubocop:enable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
69
+
70
+ # Custom attribute writer method checking allowed values (enum).
71
+ # @param [Object] metric_type Object to be assigned
72
+ def metric_type=(metric_type)
73
+ # rubocop:disable Style/ConditionalAssignment
74
+ if metric_type && !METRIC_TYPE_ENUM.include?(metric_type)
75
+ # rubocop: disable Metrics/LineLength
76
+ OCI.logger.debug("Unknown value for 'metric_type' [" + metric_type + "]. Mapping to 'METRIC_TYPE_UNKNOWN_ENUM_VALUE'") if OCI.logger
77
+ # rubocop: enable Metrics/LineLength
78
+ @metric_type = METRIC_TYPE_UNKNOWN_ENUM_VALUE
79
+ else
80
+ @metric_type = metric_type
81
+ end
82
+ # rubocop:enable Style/ConditionalAssignment
83
+ end
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
+ metric_type == other.metric_type &&
95
+ threshold == other.threshold
96
+ end
97
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Metrics/LineLength, Layout/EmptyLines
98
+
99
+ # @see the `==` method
100
+ # @param [Object] other the other object to be compared
101
+ def eql?(other)
102
+ self == other
103
+ end
104
+
105
+ # rubocop:disable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
106
+
107
+
108
+ # Calculates hash code according to all attributes.
109
+ # @return [Fixnum] Hash code
110
+ def hash
111
+ [metric_type, threshold].hash
112
+ end
113
+ # rubocop:enable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
114
+
115
+ # rubocop:disable Metrics/AbcSize, Layout/EmptyLines
116
+
117
+
118
+ # Builds the object from hash
119
+ # @param [Hash] attributes Model attributes in the form of hash
120
+ # @return [Object] Returns the model itself
121
+ def build_from_hash(attributes)
122
+ return nil unless attributes.is_a?(Hash)
123
+
124
+ self.class.swagger_types.each_pair do |key, type|
125
+ if type =~ /^Array<(.*)>/i
126
+ # check to ensure the input is an array given that the the attribute
127
+ # is documented as an array but the input is not
128
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
129
+ public_method("#{key}=").call(
130
+ attributes[self.class.attribute_map[key]]
131
+ .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
132
+ )
133
+ end
134
+ elsif !attributes[self.class.attribute_map[key]].nil?
135
+ public_method("#{key}=").call(
136
+ OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
137
+ )
138
+ end
139
+ # or else data not found in attributes(hash), not an issue as the data can be optional
140
+ end
141
+
142
+ self
143
+ end
144
+ # rubocop:enable Metrics/AbcSize, Layout/EmptyLines
145
+
146
+ # Returns the string representation of the object
147
+ # @return [String] String presentation of the object
148
+ def to_s
149
+ to_hash.to_s
150
+ end
151
+
152
+ # Returns the object in the form of hash
153
+ # @return [Hash] Returns the object in the form of hash
154
+ def to_hash
155
+ hash = {}
156
+ self.class.attribute_map.each_pair do |attr, param|
157
+ value = public_method(attr).call
158
+ next if value.nil? && !instance_variable_defined?("@#{attr}")
159
+
160
+ hash[param] = _to_hash(value)
161
+ end
162
+ hash
163
+ end
164
+
165
+ private
166
+
167
+ # Outputs non-array value in the form of hash
168
+ # For object, use to_hash. Otherwise, just return the value
169
+ # @param [Object] value Any valid value
170
+ # @return [Hash] Returns the value in the form of hash
171
+ def _to_hash(value)
172
+ if value.is_a?(Array)
173
+ value.compact.map { |v| _to_hash(v) }
174
+ elsif value.is_a?(Hash)
175
+ {}.tap do |hash|
176
+ value.each { |k, v| hash[k] = _to_hash(v) }
177
+ end
178
+ elsif value.respond_to? :to_hash
179
+ value.to_hash
180
+ else
181
+ value
182
+ end
183
+ end
184
+ end
185
+ end
186
+ # rubocop:enable Lint/UnneededCopDisableDirective
@@ -0,0 +1,177 @@
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 resource that the AutoScalingConfiguration manages. The only supported type is 'instancePool'
8
+ #
9
+ # This class has direct subclasses. If you are using this class as input to a service operations then you should favor using a subclass over the base class
10
+ class Autoscaling::Models::Resource # rubocop:disable Metrics/LineLength
11
+ # **[Required]** Indicates type of derived class
12
+ # @return [String]
13
+ attr_accessor :type
14
+
15
+ # **[Required]** The OCID of resource that the AutoScalingConfiguration will manage.
16
+ #
17
+ # @return [String]
18
+ attr_accessor :id
19
+
20
+ # Attribute mapping from ruby-style variable name to JSON key.
21
+ def self.attribute_map
22
+ {
23
+ # rubocop:disable Style/SymbolLiteral
24
+ 'type': :'type',
25
+ 'id': :'id'
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
+ 'type': :'String',
35
+ 'id': :'String'
36
+ # rubocop:enable Style/SymbolLiteral
37
+ }
38
+ end
39
+
40
+ # rubocop:disable Metrics/CyclomaticComplexity, Layout/EmptyLines
41
+
42
+
43
+ # Given the hash representation of a subtype of this class,
44
+ # use the info in the hash to return the class of the subtype.
45
+ def self.get_subtype(object_hash)
46
+ type = object_hash[:'type'] # rubocop:disable Style/SymbolLiteral
47
+
48
+ return 'OCI::Autoscaling::Models::InstancePoolResource' if type == 'instancePool'
49
+
50
+ # TODO: Log a warning when the subtype is not found.
51
+ 'OCI::Autoscaling::Models::Resource'
52
+ end
53
+ # rubocop:enable Metrics/CyclomaticComplexity, Layout/EmptyLines
54
+
55
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
56
+ # rubocop:disable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
57
+
58
+
59
+ # Initializes the object
60
+ # @param [Hash] attributes Model attributes in the form of hash
61
+ # @option attributes [String] :type The value to assign to the {#type} property
62
+ # @option attributes [String] :id The value to assign to the {#id} property
63
+ def initialize(attributes = {})
64
+ return unless attributes.is_a?(Hash)
65
+
66
+ # convert string to symbol for hash key
67
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
68
+
69
+ self.type = attributes[:'type'] if attributes[:'type']
70
+
71
+ self.id = attributes[:'id'] if attributes[:'id']
72
+ end
73
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
74
+ # rubocop:enable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
75
+
76
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Metrics/LineLength, Layout/EmptyLines
77
+
78
+
79
+ # Checks equality by comparing each attribute.
80
+ # @param [Object] other the other object to be compared
81
+ def ==(other)
82
+ return true if equal?(other)
83
+
84
+ self.class == other.class &&
85
+ type == other.type &&
86
+ id == other.id
87
+ end
88
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Metrics/LineLength, Layout/EmptyLines
89
+
90
+ # @see the `==` method
91
+ # @param [Object] other the other object to be compared
92
+ def eql?(other)
93
+ self == other
94
+ end
95
+
96
+ # rubocop:disable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
97
+
98
+
99
+ # Calculates hash code according to all attributes.
100
+ # @return [Fixnum] Hash code
101
+ def hash
102
+ [type, id].hash
103
+ end
104
+ # rubocop:enable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
105
+
106
+ # rubocop:disable Metrics/AbcSize, Layout/EmptyLines
107
+
108
+
109
+ # Builds the object from hash
110
+ # @param [Hash] attributes Model attributes in the form of hash
111
+ # @return [Object] Returns the model itself
112
+ def build_from_hash(attributes)
113
+ return nil unless attributes.is_a?(Hash)
114
+
115
+ self.class.swagger_types.each_pair do |key, type|
116
+ if type =~ /^Array<(.*)>/i
117
+ # check to ensure the input is an array given that the the attribute
118
+ # is documented as an array but the input is not
119
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
120
+ public_method("#{key}=").call(
121
+ attributes[self.class.attribute_map[key]]
122
+ .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
123
+ )
124
+ end
125
+ elsif !attributes[self.class.attribute_map[key]].nil?
126
+ public_method("#{key}=").call(
127
+ OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
128
+ )
129
+ end
130
+ # or else data not found in attributes(hash), not an issue as the data can be optional
131
+ end
132
+
133
+ self
134
+ end
135
+ # rubocop:enable Metrics/AbcSize, Layout/EmptyLines
136
+
137
+ # Returns the string representation of the object
138
+ # @return [String] String presentation of the object
139
+ def to_s
140
+ to_hash.to_s
141
+ end
142
+
143
+ # Returns the object in the form of hash
144
+ # @return [Hash] Returns the object in the form of hash
145
+ def to_hash
146
+ hash = {}
147
+ self.class.attribute_map.each_pair do |attr, param|
148
+ value = public_method(attr).call
149
+ next if value.nil? && !instance_variable_defined?("@#{attr}")
150
+
151
+ hash[param] = _to_hash(value)
152
+ end
153
+ hash
154
+ end
155
+
156
+ private
157
+
158
+ # Outputs non-array value in the form of hash
159
+ # For object, use to_hash. Otherwise, just return the value
160
+ # @param [Object] value Any valid value
161
+ # @return [Hash] Returns the value in the form of hash
162
+ def _to_hash(value)
163
+ if value.is_a?(Array)
164
+ value.compact.map { |v| _to_hash(v) }
165
+ elsif value.is_a?(Hash)
166
+ {}.tap do |hash|
167
+ value.each { |k, v| hash[k] = _to_hash(v) }
168
+ end
169
+ elsif value.respond_to? :to_hash
170
+ value.to_hash
171
+ else
172
+ value
173
+ end
174
+ end
175
+ end
176
+ end
177
+ # rubocop:enable Lint/UnneededCopDisableDirective
@@ -0,0 +1,188 @@
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
+ # Threshold model.
9
+ class Autoscaling::Models::Threshold # rubocop:disable Metrics/LineLength
10
+ OPERATOR_ENUM = [
11
+ OPERATOR_GT = 'GT'.freeze,
12
+ OPERATOR_GTE = 'GTE'.freeze,
13
+ OPERATOR_LT = 'LT'.freeze,
14
+ OPERATOR_LTE = 'LTE'.freeze,
15
+ OPERATOR_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
16
+ ].freeze
17
+
18
+ # **[Required]** Support for the following operators
19
+ # GT - Greater than
20
+ # GTE - Greater than equal to
21
+ # LT - Less than
22
+ # LTE - Less than equal to
23
+ #
24
+ # @return [String]
25
+ attr_reader :operator
26
+
27
+ # This attribute is required.
28
+ # @return [Integer]
29
+ attr_accessor :value
30
+
31
+ # Attribute mapping from ruby-style variable name to JSON key.
32
+ def self.attribute_map
33
+ {
34
+ # rubocop:disable Style/SymbolLiteral
35
+ 'operator': :'operator',
36
+ 'value': :'value'
37
+ # rubocop:enable Style/SymbolLiteral
38
+ }
39
+ end
40
+
41
+ # Attribute type mapping.
42
+ def self.swagger_types
43
+ {
44
+ # rubocop:disable Style/SymbolLiteral
45
+ 'operator': :'String',
46
+ 'value': :'Integer'
47
+ # rubocop:enable Style/SymbolLiteral
48
+ }
49
+ end
50
+
51
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
52
+ # rubocop:disable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
53
+
54
+
55
+ # Initializes the object
56
+ # @param [Hash] attributes Model attributes in the form of hash
57
+ # @option attributes [String] :operator The value to assign to the {#operator} property
58
+ # @option attributes [Integer] :value The value to assign to the {#value} property
59
+ def initialize(attributes = {})
60
+ return unless attributes.is_a?(Hash)
61
+
62
+ # convert string to symbol for hash key
63
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
64
+
65
+ self.operator = attributes[:'operator'] if attributes[:'operator']
66
+
67
+ self.value = attributes[:'value'] if attributes[:'value']
68
+ end
69
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
70
+ # rubocop:enable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
71
+
72
+ # Custom attribute writer method checking allowed values (enum).
73
+ # @param [Object] operator Object to be assigned
74
+ def operator=(operator)
75
+ # rubocop:disable Style/ConditionalAssignment
76
+ if operator && !OPERATOR_ENUM.include?(operator)
77
+ # rubocop: disable Metrics/LineLength
78
+ OCI.logger.debug("Unknown value for 'operator' [" + operator + "]. Mapping to 'OPERATOR_UNKNOWN_ENUM_VALUE'") if OCI.logger
79
+ # rubocop: enable Metrics/LineLength
80
+ @operator = OPERATOR_UNKNOWN_ENUM_VALUE
81
+ else
82
+ @operator = operator
83
+ end
84
+ # rubocop:enable Style/ConditionalAssignment
85
+ end
86
+
87
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Metrics/LineLength, Layout/EmptyLines
88
+
89
+
90
+ # Checks equality by comparing each attribute.
91
+ # @param [Object] other the other object to be compared
92
+ def ==(other)
93
+ return true if equal?(other)
94
+
95
+ self.class == other.class &&
96
+ operator == other.operator &&
97
+ value == other.value
98
+ end
99
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Metrics/LineLength, Layout/EmptyLines
100
+
101
+ # @see the `==` method
102
+ # @param [Object] other the other object to be compared
103
+ def eql?(other)
104
+ self == other
105
+ end
106
+
107
+ # rubocop:disable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
108
+
109
+
110
+ # Calculates hash code according to all attributes.
111
+ # @return [Fixnum] Hash code
112
+ def hash
113
+ [operator, value].hash
114
+ end
115
+ # rubocop:enable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
116
+
117
+ # rubocop:disable Metrics/AbcSize, Layout/EmptyLines
118
+
119
+
120
+ # Builds the object from hash
121
+ # @param [Hash] attributes Model attributes in the form of hash
122
+ # @return [Object] Returns the model itself
123
+ def build_from_hash(attributes)
124
+ return nil unless attributes.is_a?(Hash)
125
+
126
+ self.class.swagger_types.each_pair do |key, type|
127
+ if type =~ /^Array<(.*)>/i
128
+ # check to ensure the input is an array given that the the attribute
129
+ # is documented as an array but the input is not
130
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
131
+ public_method("#{key}=").call(
132
+ attributes[self.class.attribute_map[key]]
133
+ .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
134
+ )
135
+ end
136
+ elsif !attributes[self.class.attribute_map[key]].nil?
137
+ public_method("#{key}=").call(
138
+ OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
139
+ )
140
+ end
141
+ # or else data not found in attributes(hash), not an issue as the data can be optional
142
+ end
143
+
144
+ self
145
+ end
146
+ # rubocop:enable Metrics/AbcSize, Layout/EmptyLines
147
+
148
+ # Returns the string representation of the object
149
+ # @return [String] String presentation of the object
150
+ def to_s
151
+ to_hash.to_s
152
+ end
153
+
154
+ # Returns the object in the form of hash
155
+ # @return [Hash] Returns the object in the form of hash
156
+ def to_hash
157
+ hash = {}
158
+ self.class.attribute_map.each_pair do |attr, param|
159
+ value = public_method(attr).call
160
+ next if value.nil? && !instance_variable_defined?("@#{attr}")
161
+
162
+ hash[param] = _to_hash(value)
163
+ end
164
+ hash
165
+ end
166
+
167
+ private
168
+
169
+ # Outputs non-array value in the form of hash
170
+ # For object, use to_hash. Otherwise, just return the value
171
+ # @param [Object] value Any valid value
172
+ # @return [Hash] Returns the value in the form of hash
173
+ def _to_hash(value)
174
+ if value.is_a?(Array)
175
+ value.compact.map { |v| _to_hash(v) }
176
+ elsif value.is_a?(Hash)
177
+ {}.tap do |hash|
178
+ value.each { |k, v| hash[k] = _to_hash(v) }
179
+ end
180
+ elsif value.respond_to? :to_hash
181
+ value.to_hash
182
+ else
183
+ value
184
+ end
185
+ end
186
+ end
187
+ end
188
+ # rubocop:enable Lint/UnneededCopDisableDirective