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
+ # AutoScalingPolicySummary model.
8
+ class Autoscaling::Models::AutoScalingPolicySummary # rubocop:disable Metrics/LineLength
9
+ # **[Required]** The ID of the policy that is assigned after creation
10
+ # @return [String]
11
+ attr_accessor :id
12
+
13
+ # A user-friendly name for the Policy. Does not have to be unique, and it's changeable. Avoid entering
14
+ # confidential information.
15
+ #
16
+ # @return [String]
17
+ attr_accessor :display_name
18
+
19
+ # **[Required]** Indicates type of Policy
20
+ # @return [String]
21
+ attr_accessor :policy_type
22
+
23
+ # Attribute mapping from ruby-style variable name to JSON key.
24
+ def self.attribute_map
25
+ {
26
+ # rubocop:disable Style/SymbolLiteral
27
+ 'id': :'id',
28
+ 'display_name': :'displayName',
29
+ 'policy_type': :'policyType'
30
+ # rubocop:enable Style/SymbolLiteral
31
+ }
32
+ end
33
+
34
+ # Attribute type mapping.
35
+ def self.swagger_types
36
+ {
37
+ # rubocop:disable Style/SymbolLiteral
38
+ 'id': :'String',
39
+ 'display_name': :'String',
40
+ 'policy_type': :'String'
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] :id The value to assign to the {#id} property
52
+ # @option attributes [String] :display_name The value to assign to the {#display_name} property
53
+ # @option attributes [String] :policy_type The value to assign to the {#policy_type} property
54
+ def initialize(attributes = {})
55
+ return unless attributes.is_a?(Hash)
56
+
57
+ # convert string to symbol for hash key
58
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
59
+
60
+ self.id = attributes[:'id'] if attributes[:'id']
61
+
62
+ self.display_name = attributes[:'displayName'] if attributes[:'displayName']
63
+
64
+ raise 'You cannot provide both :displayName and :display_name' if attributes.key?(:'displayName') && attributes.key?(:'display_name')
65
+
66
+ self.display_name = attributes[:'display_name'] if attributes[:'display_name']
67
+
68
+ self.policy_type = attributes[:'policyType'] if attributes[:'policyType']
69
+
70
+ raise 'You cannot provide both :policyType and :policy_type' if attributes.key?(:'policyType') && attributes.key?(:'policy_type')
71
+
72
+ self.policy_type = attributes[:'policy_type'] if attributes[:'policy_type']
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
+ id == other.id &&
87
+ display_name == other.display_name &&
88
+ policy_type == other.policy_type
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
+ [id, display_name, policy_type].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,170 @@
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
+ # Capacity boundaries for the pool
8
+ #
9
+ class Autoscaling::Models::Capacity # rubocop:disable Metrics/LineLength
10
+ # **[Required]** The maximum size the pool is allowed to increase to
11
+ # @return [Integer]
12
+ attr_accessor :max
13
+
14
+ # **[Required]** The minimum size the pool is allowed to decrease to
15
+ # @return [Integer]
16
+ attr_accessor :min
17
+
18
+ # **[Required]** The initial size of the pool
19
+ # @return [Integer]
20
+ attr_accessor :initial
21
+
22
+ # Attribute mapping from ruby-style variable name to JSON key.
23
+ def self.attribute_map
24
+ {
25
+ # rubocop:disable Style/SymbolLiteral
26
+ 'max': :'max',
27
+ 'min': :'min',
28
+ 'initial': :'initial'
29
+ # rubocop:enable Style/SymbolLiteral
30
+ }
31
+ end
32
+
33
+ # Attribute type mapping.
34
+ def self.swagger_types
35
+ {
36
+ # rubocop:disable Style/SymbolLiteral
37
+ 'max': :'Integer',
38
+ 'min': :'Integer',
39
+ 'initial': :'Integer'
40
+ # rubocop:enable Style/SymbolLiteral
41
+ }
42
+ end
43
+
44
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
45
+ # rubocop:disable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
46
+
47
+
48
+ # Initializes the object
49
+ # @param [Hash] attributes Model attributes in the form of hash
50
+ # @option attributes [Integer] :max The value to assign to the {#max} property
51
+ # @option attributes [Integer] :min The value to assign to the {#min} property
52
+ # @option attributes [Integer] :initial The value to assign to the {#initial} 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.max = attributes[:'max'] if attributes[:'max']
60
+
61
+ self.min = attributes[:'min'] if attributes[:'min']
62
+
63
+ self.initial = attributes[:'initial'] if attributes[:'initial']
64
+ end
65
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
66
+ # rubocop:enable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
67
+
68
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Metrics/LineLength, Layout/EmptyLines
69
+
70
+
71
+ # Checks equality by comparing each attribute.
72
+ # @param [Object] other the other object to be compared
73
+ def ==(other)
74
+ return true if equal?(other)
75
+
76
+ self.class == other.class &&
77
+ max == other.max &&
78
+ min == other.min &&
79
+ initial == other.initial
80
+ end
81
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Metrics/LineLength, Layout/EmptyLines
82
+
83
+ # @see the `==` method
84
+ # @param [Object] other the other object to be compared
85
+ def eql?(other)
86
+ self == other
87
+ end
88
+
89
+ # rubocop:disable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
90
+
91
+
92
+ # Calculates hash code according to all attributes.
93
+ # @return [Fixnum] Hash code
94
+ def hash
95
+ [max, min, initial].hash
96
+ end
97
+ # rubocop:enable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
98
+
99
+ # rubocop:disable Metrics/AbcSize, Layout/EmptyLines
100
+
101
+
102
+ # Builds the object from hash
103
+ # @param [Hash] attributes Model attributes in the form of hash
104
+ # @return [Object] Returns the model itself
105
+ def build_from_hash(attributes)
106
+ return nil unless attributes.is_a?(Hash)
107
+
108
+ self.class.swagger_types.each_pair do |key, type|
109
+ if type =~ /^Array<(.*)>/i
110
+ # check to ensure the input is an array given that the the attribute
111
+ # is documented as an array but the input is not
112
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
113
+ public_method("#{key}=").call(
114
+ attributes[self.class.attribute_map[key]]
115
+ .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
116
+ )
117
+ end
118
+ elsif !attributes[self.class.attribute_map[key]].nil?
119
+ public_method("#{key}=").call(
120
+ OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
121
+ )
122
+ end
123
+ # or else data not found in attributes(hash), not an issue as the data can be optional
124
+ end
125
+
126
+ self
127
+ end
128
+ # rubocop:enable Metrics/AbcSize, Layout/EmptyLines
129
+
130
+ # Returns the string representation of the object
131
+ # @return [String] String presentation of the object
132
+ def to_s
133
+ to_hash.to_s
134
+ end
135
+
136
+ # Returns the object in the form of hash
137
+ # @return [Hash] Returns the object in the form of hash
138
+ def to_hash
139
+ hash = {}
140
+ self.class.attribute_map.each_pair do |attr, param|
141
+ value = public_method(attr).call
142
+ next if value.nil? && !instance_variable_defined?("@#{attr}")
143
+
144
+ hash[param] = _to_hash(value)
145
+ end
146
+ hash
147
+ end
148
+
149
+ private
150
+
151
+ # Outputs non-array value in the form of hash
152
+ # For object, use to_hash. Otherwise, just return the value
153
+ # @param [Object] value Any valid value
154
+ # @return [Hash] Returns the value in the form of hash
155
+ def _to_hash(value)
156
+ if value.is_a?(Array)
157
+ value.compact.map { |v| _to_hash(v) }
158
+ elsif value.is_a?(Hash)
159
+ {}.tap do |hash|
160
+ value.each { |k, v| hash[k] = _to_hash(v) }
161
+ end
162
+ elsif value.respond_to? :to_hash
163
+ value.to_hash
164
+ else
165
+ value
166
+ end
167
+ end
168
+ end
169
+ end
170
+ # rubocop:enable Lint/UnneededCopDisableDirective
@@ -0,0 +1,186 @@
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 container for metric and action details
8
+ #
9
+ class Autoscaling::Models::Condition # rubocop:disable Metrics/LineLength
10
+ # This attribute is required.
11
+ # @return [OCI::Autoscaling::Models::Action]
12
+ attr_accessor :action
13
+
14
+ # A user-friendly name for the AutoScalingConfiguration condition details. Does not have to be unique, and
15
+ # it's changeable. Avoid entering confidential information.
16
+ #
17
+ # @return [String]
18
+ attr_accessor :display_name
19
+
20
+ # Id of the condition that is assigned after creation
21
+ # @return [String]
22
+ attr_accessor :id
23
+
24
+ # This attribute is required.
25
+ # @return [OCI::Autoscaling::Models::Metric]
26
+ attr_accessor :metric
27
+
28
+ # Attribute mapping from ruby-style variable name to JSON key.
29
+ def self.attribute_map
30
+ {
31
+ # rubocop:disable Style/SymbolLiteral
32
+ 'action': :'action',
33
+ 'display_name': :'displayName',
34
+ 'id': :'id',
35
+ 'metric': :'metric'
36
+ # rubocop:enable Style/SymbolLiteral
37
+ }
38
+ end
39
+
40
+ # Attribute type mapping.
41
+ def self.swagger_types
42
+ {
43
+ # rubocop:disable Style/SymbolLiteral
44
+ 'action': :'OCI::Autoscaling::Models::Action',
45
+ 'display_name': :'String',
46
+ 'id': :'String',
47
+ 'metric': :'OCI::Autoscaling::Models::Metric'
48
+ # rubocop:enable Style/SymbolLiteral
49
+ }
50
+ end
51
+
52
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
53
+ # rubocop:disable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
54
+
55
+
56
+ # Initializes the object
57
+ # @param [Hash] attributes Model attributes in the form of hash
58
+ # @option attributes [OCI::Autoscaling::Models::Action] :action The value to assign to the {#action} property
59
+ # @option attributes [String] :display_name The value to assign to the {#display_name} property
60
+ # @option attributes [String] :id The value to assign to the {#id} property
61
+ # @option attributes [OCI::Autoscaling::Models::Metric] :metric The value to assign to the {#metric} 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.action = attributes[:'action'] if attributes[:'action']
69
+
70
+ self.display_name = attributes[:'displayName'] if attributes[:'displayName']
71
+
72
+ raise 'You cannot provide both :displayName and :display_name' if attributes.key?(:'displayName') && attributes.key?(:'display_name')
73
+
74
+ self.display_name = attributes[:'display_name'] if attributes[:'display_name']
75
+
76
+ self.id = attributes[:'id'] if attributes[:'id']
77
+
78
+ self.metric = attributes[:'metric'] if attributes[:'metric']
79
+ end
80
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
81
+ # rubocop:enable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
82
+
83
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Metrics/LineLength, Layout/EmptyLines
84
+
85
+
86
+ # Checks equality by comparing each attribute.
87
+ # @param [Object] other the other object to be compared
88
+ def ==(other)
89
+ return true if equal?(other)
90
+
91
+ self.class == other.class &&
92
+ action == other.action &&
93
+ display_name == other.display_name &&
94
+ id == other.id &&
95
+ metric == other.metric
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
+ [action, display_name, id, metric].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