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
@@ -259,6 +259,45 @@ module OCI
259
259
  # rubocop:disable Layout/EmptyLines
260
260
 
261
261
 
262
+ # Calls {OCI::Identity::IdentityClient#create_mfa_totp_device} and then waits for the {OCI::Identity::Models::MfaTotpDevice} acted upon
263
+ # to enter the given state(s).
264
+ #
265
+ # @param [String] user_id The OCID of the user.
266
+ # @param [Array<String>] wait_for_states An array of states to wait on. These should be valid values for {OCI::Identity::Models::MfaTotpDevice#lifecycle_state}
267
+ # @param [Hash] base_operation_opts Any optional arguments accepted by {OCI::Identity::IdentityClient#create_mfa_totp_device}
268
+ # @param [Hash] waiter_opts Optional arguments for the waiter. Keys should be symbols, and the following keys are supported:
269
+ # * max_interval_seconds: The maximum interval between queries, in seconds.
270
+ # * max_wait_seconds The maximum time to wait, in seconds
271
+ #
272
+ # @return [OCI::Response] A {OCI::Response} object with data of type {OCI::Identity::Models::MfaTotpDevice}
273
+ def create_mfa_totp_device_and_wait_for_state(user_id, wait_for_states = [], base_operation_opts = {}, waiter_opts = {})
274
+ operation_result = @service_client.create_mfa_totp_device(user_id, base_operation_opts)
275
+
276
+ return operation_result if wait_for_states.empty?
277
+
278
+ lowered_wait_for_states = wait_for_states.map(&:downcase)
279
+ wait_for_resource_id = operation_result.data.id
280
+
281
+ begin
282
+ waiter_result = @service_client.get_mfa_totp_device(wait_for_resource_id).wait_until(
283
+ eval_proc: ->(response) { response.data.respond_to?(:lifecycle_state) && lowered_wait_for_states.include?(response.data.lifecycle_state.downcase) },
284
+ max_interval_seconds: waiter_opts.key?(:max_interval_seconds) ? waiter_opts[:max_interval_seconds] : 30,
285
+ max_wait_seconds: waiter_opts.key?(:max_wait_seconds) ? waiter_opts[:max_wait_seconds] : 1200
286
+ )
287
+ result_to_return = waiter_result
288
+
289
+ return result_to_return
290
+ rescue StandardError
291
+ raise OCI::Errors::CompositeOperationError.new(partial_results: [operation_result])
292
+ end
293
+ end
294
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/ParameterLists, Metrics/PerceivedComplexity
295
+ # rubocop:enable Layout/EmptyLines
296
+
297
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/ParameterLists, Metrics/PerceivedComplexity
298
+ # rubocop:disable Layout/EmptyLines
299
+
300
+
262
301
  # Calls {OCI::Identity::IdentityClient#create_policy} and then waits for the {OCI::Identity::Models::Policy} acted upon
263
302
  # to enter the given state(s).
264
303
  #
@@ -586,6 +625,46 @@ module OCI
586
625
  # rubocop:disable Layout/EmptyLines
587
626
 
588
627
 
628
+ # Calls {OCI::Identity::IdentityClient#generate_totp_seed} and then waits for the {OCI::Identity::Models::MfaTotpDevice} acted upon
629
+ # to enter the given state(s).
630
+ #
631
+ # @param [String] user_id The OCID of the user.
632
+ # @param [String] mfa_totp_device_id The OCID of the MFA TOTP device.
633
+ # @param [Array<String>] wait_for_states An array of states to wait on. These should be valid values for {OCI::Identity::Models::MfaTotpDevice#lifecycle_state}
634
+ # @param [Hash] base_operation_opts Any optional arguments accepted by {OCI::Identity::IdentityClient#generate_totp_seed}
635
+ # @param [Hash] waiter_opts Optional arguments for the waiter. Keys should be symbols, and the following keys are supported:
636
+ # * max_interval_seconds: The maximum interval between queries, in seconds.
637
+ # * max_wait_seconds The maximum time to wait, in seconds
638
+ #
639
+ # @return [OCI::Response] A {OCI::Response} object with data of type {OCI::Identity::Models::MfaTotpDevice}
640
+ def generate_totp_seed_and_wait_for_state(user_id, mfa_totp_device_id, wait_for_states = [], base_operation_opts = {}, waiter_opts = {})
641
+ operation_result = @service_client.generate_totp_seed(user_id, mfa_totp_device_id, base_operation_opts)
642
+
643
+ return operation_result if wait_for_states.empty?
644
+
645
+ lowered_wait_for_states = wait_for_states.map(&:downcase)
646
+ wait_for_resource_id = operation_result.data.id
647
+
648
+ begin
649
+ waiter_result = @service_client.get_mfa_totp_device(wait_for_resource_id).wait_until(
650
+ eval_proc: ->(response) { response.data.respond_to?(:lifecycle_state) && lowered_wait_for_states.include?(response.data.lifecycle_state.downcase) },
651
+ max_interval_seconds: waiter_opts.key?(:max_interval_seconds) ? waiter_opts[:max_interval_seconds] : 30,
652
+ max_wait_seconds: waiter_opts.key?(:max_wait_seconds) ? waiter_opts[:max_wait_seconds] : 1200
653
+ )
654
+ result_to_return = waiter_result
655
+
656
+ return result_to_return
657
+ rescue StandardError
658
+ raise OCI::Errors::CompositeOperationError.new(partial_results: [operation_result])
659
+ end
660
+ end
661
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/ParameterLists, Metrics/PerceivedComplexity
662
+ # rubocop:enable Layout/EmptyLines
663
+
664
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/ParameterLists, Metrics/PerceivedComplexity
665
+ # rubocop:disable Layout/EmptyLines
666
+
667
+
589
668
  # Calls {OCI::Identity::IdentityClient#update_compartment} and then waits for the {OCI::Identity::Models::Compartment} acted upon
590
669
  # to enter the given state(s).
591
670
  #
@@ -0,0 +1,154 @@
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
+ # Details of the compartment the resource is being moved to.
8
+ #
9
+ class Identity::Models::ChangeTagNamespaceCompartmentDetail # rubocop:disable Metrics/LineLength
10
+ # **[Required]** The Oracle Cloud ID (OCID) of the destination compartment.
11
+ # @return [String]
12
+ attr_accessor :compartment_id
13
+
14
+ # Attribute mapping from ruby-style variable name to JSON key.
15
+ def self.attribute_map
16
+ {
17
+ # rubocop:disable Style/SymbolLiteral
18
+ 'compartment_id': :'compartmentId'
19
+ # rubocop:enable Style/SymbolLiteral
20
+ }
21
+ end
22
+
23
+ # Attribute type mapping.
24
+ def self.swagger_types
25
+ {
26
+ # rubocop:disable Style/SymbolLiteral
27
+ 'compartment_id': :'String'
28
+ # rubocop:enable Style/SymbolLiteral
29
+ }
30
+ end
31
+
32
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
33
+ # rubocop:disable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
34
+
35
+
36
+ # Initializes the object
37
+ # @param [Hash] attributes Model attributes in the form of hash
38
+ # @option attributes [String] :compartment_id The value to assign to the {#compartment_id} property
39
+ def initialize(attributes = {})
40
+ return unless attributes.is_a?(Hash)
41
+
42
+ # convert string to symbol for hash key
43
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
44
+
45
+ self.compartment_id = attributes[:'compartmentId'] if attributes[:'compartmentId']
46
+
47
+ raise 'You cannot provide both :compartmentId and :compartment_id' if attributes.key?(:'compartmentId') && attributes.key?(:'compartment_id')
48
+
49
+ self.compartment_id = attributes[:'compartment_id'] if attributes[:'compartment_id']
50
+ end
51
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
52
+ # rubocop:enable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
53
+
54
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Metrics/LineLength, Layout/EmptyLines
55
+
56
+
57
+ # Checks equality by comparing each attribute.
58
+ # @param [Object] other the other object to be compared
59
+ def ==(other)
60
+ return true if equal?(other)
61
+
62
+ self.class == other.class &&
63
+ compartment_id == other.compartment_id
64
+ end
65
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Metrics/LineLength, Layout/EmptyLines
66
+
67
+ # @see the `==` method
68
+ # @param [Object] other the other object to be compared
69
+ def eql?(other)
70
+ self == other
71
+ end
72
+
73
+ # rubocop:disable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
74
+
75
+
76
+ # Calculates hash code according to all attributes.
77
+ # @return [Fixnum] Hash code
78
+ def hash
79
+ [compartment_id].hash
80
+ end
81
+ # rubocop:enable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
82
+
83
+ # rubocop:disable Metrics/AbcSize, Layout/EmptyLines
84
+
85
+
86
+ # Builds the object from hash
87
+ # @param [Hash] attributes Model attributes in the form of hash
88
+ # @return [Object] Returns the model itself
89
+ def build_from_hash(attributes)
90
+ return nil unless attributes.is_a?(Hash)
91
+
92
+ self.class.swagger_types.each_pair do |key, type|
93
+ if type =~ /^Array<(.*)>/i
94
+ # check to ensure the input is an array given that the the attribute
95
+ # is documented as an array but the input is not
96
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
97
+ public_method("#{key}=").call(
98
+ attributes[self.class.attribute_map[key]]
99
+ .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
100
+ )
101
+ end
102
+ elsif !attributes[self.class.attribute_map[key]].nil?
103
+ public_method("#{key}=").call(
104
+ OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
105
+ )
106
+ end
107
+ # or else data not found in attributes(hash), not an issue as the data can be optional
108
+ end
109
+
110
+ self
111
+ end
112
+ # rubocop:enable Metrics/AbcSize, Layout/EmptyLines
113
+
114
+ # Returns the string representation of the object
115
+ # @return [String] String presentation of the object
116
+ def to_s
117
+ to_hash.to_s
118
+ end
119
+
120
+ # Returns the object in the form of hash
121
+ # @return [Hash] Returns the object in the form of hash
122
+ def to_hash
123
+ hash = {}
124
+ self.class.attribute_map.each_pair do |attr, param|
125
+ value = public_method(attr).call
126
+ next if value.nil? && !instance_variable_defined?("@#{attr}")
127
+
128
+ hash[param] = _to_hash(value)
129
+ end
130
+ hash
131
+ end
132
+
133
+ private
134
+
135
+ # Outputs non-array value in the form of hash
136
+ # For object, use to_hash. Otherwise, just return the value
137
+ # @param [Object] value Any valid value
138
+ # @return [Hash] Returns the value in the form of hash
139
+ def _to_hash(value)
140
+ if value.is_a?(Array)
141
+ value.compact.map { |v| _to_hash(v) }
142
+ elsif value.is_a?(Hash)
143
+ {}.tap do |hash|
144
+ value.each { |k, v| hash[k] = _to_hash(v) }
145
+ end
146
+ elsif value.respond_to? :to_hash
147
+ value.to_hash
148
+ else
149
+ value
150
+ end
151
+ end
152
+ end
153
+ end
154
+ # rubocop:enable Lint/UnneededCopDisableDirective
@@ -13,7 +13,8 @@ module OCI
13
13
  ].freeze
14
14
 
15
15
  PROTOCOL_ENUM = [
16
- PROTOCOL_SAML2 = 'SAML2'.freeze
16
+ PROTOCOL_SAML2 = 'SAML2'.freeze,
17
+ PROTOCOL_ADFS = 'ADFS'.freeze
17
18
  ].freeze
18
19
 
19
20
  # **[Required]** The OCID of your tenancy.
@@ -0,0 +1,279 @@
1
+ # Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
2
+
3
+ require 'date'
4
+ require 'logger'
5
+
6
+ # rubocop:disable Lint/UnneededCopDisableDirective
7
+ module OCI
8
+ # A `MfaTotpDevice` is an Mfa Totp device that the user can use to authenticate with OCI (Leslie will add more details here)
9
+ #
10
+ class Identity::Models::MfaTotpDevice # rubocop:disable Metrics/LineLength
11
+ LIFECYCLE_STATE_ENUM = [
12
+ LIFECYCLE_STATE_CREATING = 'CREATING'.freeze,
13
+ LIFECYCLE_STATE_ACTIVE = 'ACTIVE'.freeze,
14
+ LIFECYCLE_STATE_INACTIVE = 'INACTIVE'.freeze,
15
+ LIFECYCLE_STATE_DELETING = 'DELETING'.freeze,
16
+ LIFECYCLE_STATE_DELETED = 'DELETED'.freeze,
17
+ LIFECYCLE_STATE_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
18
+ ].freeze
19
+
20
+ # **[Required]** The OCID of the Mfa Totp Device.
21
+ # @return [String]
22
+ attr_accessor :id
23
+
24
+ # **[Required]** The seed for the Mfa Totp device (Base32 encoded)
25
+ #
26
+ # @return [String]
27
+ attr_accessor :seed
28
+
29
+ # **[Required]** The OCID of the user the Mfa Totp Device belongs to.
30
+ # @return [String]
31
+ attr_accessor :user_id
32
+
33
+ # **[Required]** Date and time the `Mfa Totp Device` object was created, in the format defined by RFC3339.
34
+ #
35
+ # Example: `2016-08-25T21:10:29.600Z`
36
+ #
37
+ # @return [DateTime]
38
+ attr_accessor :time_created
39
+
40
+ # Date and time when this Mfa Totp device will expire, in the format defined by RFC3339.
41
+ # Null if it never expires.
42
+ #
43
+ # Example: `2016-08-25T21:10:29.600Z`
44
+ #
45
+ # @return [DateTime]
46
+ attr_accessor :time_expires
47
+
48
+ # **[Required]** The Mfa Totp Device's current state. After creating a Mfa Totp Device, make sure its `lifecycleState` changes from
49
+ # CREATING to ACTIVE before using it.
50
+ #
51
+ # @return [String]
52
+ attr_reader :lifecycle_state
53
+
54
+ # The detailed status of INACTIVE lifecycleState. Possible values are 1(SUSPENDED), 2(DISABLED), 4(BLOCKED) and 8(LOCKED).
55
+ # @return [Integer]
56
+ attr_accessor :inactive_status
57
+
58
+ # **[Required]** Flag to indicate if the Mfa Totp Device has been isActivated
59
+ # @return [BOOLEAN]
60
+ attr_accessor :is_activated
61
+
62
+ # Attribute mapping from ruby-style variable name to JSON key.
63
+ def self.attribute_map
64
+ {
65
+ # rubocop:disable Style/SymbolLiteral
66
+ 'id': :'id',
67
+ 'seed': :'seed',
68
+ 'user_id': :'userId',
69
+ 'time_created': :'timeCreated',
70
+ 'time_expires': :'timeExpires',
71
+ 'lifecycle_state': :'lifecycleState',
72
+ 'inactive_status': :'inactiveStatus',
73
+ 'is_activated': :'isActivated'
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
+ 'id': :'String',
83
+ 'seed': :'String',
84
+ 'user_id': :'String',
85
+ 'time_created': :'DateTime',
86
+ 'time_expires': :'DateTime',
87
+ 'lifecycle_state': :'String',
88
+ 'inactive_status': :'Integer',
89
+ 'is_activated': :'BOOLEAN'
90
+ # rubocop:enable Style/SymbolLiteral
91
+ }
92
+ end
93
+
94
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
95
+ # rubocop:disable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
96
+
97
+
98
+ # Initializes the object
99
+ # @param [Hash] attributes Model attributes in the form of hash
100
+ # @option attributes [String] :id The value to assign to the {#id} property
101
+ # @option attributes [String] :seed The value to assign to the {#seed} property
102
+ # @option attributes [String] :user_id The value to assign to the {#user_id} property
103
+ # @option attributes [DateTime] :time_created The value to assign to the {#time_created} property
104
+ # @option attributes [DateTime] :time_expires The value to assign to the {#time_expires} property
105
+ # @option attributes [String] :lifecycle_state The value to assign to the {#lifecycle_state} property
106
+ # @option attributes [Integer] :inactive_status The value to assign to the {#inactive_status} property
107
+ # @option attributes [BOOLEAN] :is_activated The value to assign to the {#is_activated} property
108
+ def initialize(attributes = {})
109
+ return unless attributes.is_a?(Hash)
110
+
111
+ # convert string to symbol for hash key
112
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
113
+
114
+ self.id = attributes[:'id'] if attributes[:'id']
115
+
116
+ self.seed = attributes[:'seed'] if attributes[:'seed']
117
+
118
+ self.user_id = attributes[:'userId'] if attributes[:'userId']
119
+
120
+ raise 'You cannot provide both :userId and :user_id' if attributes.key?(:'userId') && attributes.key?(:'user_id')
121
+
122
+ self.user_id = attributes[:'user_id'] if attributes[:'user_id']
123
+
124
+ self.time_created = attributes[:'timeCreated'] if attributes[:'timeCreated']
125
+
126
+ raise 'You cannot provide both :timeCreated and :time_created' if attributes.key?(:'timeCreated') && attributes.key?(:'time_created')
127
+
128
+ self.time_created = attributes[:'time_created'] if attributes[:'time_created']
129
+
130
+ self.time_expires = attributes[:'timeExpires'] if attributes[:'timeExpires']
131
+
132
+ raise 'You cannot provide both :timeExpires and :time_expires' if attributes.key?(:'timeExpires') && attributes.key?(:'time_expires')
133
+
134
+ self.time_expires = attributes[:'time_expires'] if attributes[:'time_expires']
135
+
136
+ self.lifecycle_state = attributes[:'lifecycleState'] if attributes[:'lifecycleState']
137
+
138
+ raise 'You cannot provide both :lifecycleState and :lifecycle_state' if attributes.key?(:'lifecycleState') && attributes.key?(:'lifecycle_state')
139
+
140
+ self.lifecycle_state = attributes[:'lifecycle_state'] if attributes[:'lifecycle_state']
141
+
142
+ self.inactive_status = attributes[:'inactiveStatus'] if attributes[:'inactiveStatus']
143
+
144
+ raise 'You cannot provide both :inactiveStatus and :inactive_status' if attributes.key?(:'inactiveStatus') && attributes.key?(:'inactive_status')
145
+
146
+ self.inactive_status = attributes[:'inactive_status'] if attributes[:'inactive_status']
147
+
148
+ self.is_activated = attributes[:'isActivated'] unless attributes[:'isActivated'].nil?
149
+
150
+ raise 'You cannot provide both :isActivated and :is_activated' if attributes.key?(:'isActivated') && attributes.key?(:'is_activated')
151
+
152
+ self.is_activated = attributes[:'is_activated'] unless attributes[:'is_activated'].nil?
153
+ end
154
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
155
+ # rubocop:enable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
156
+
157
+ # Custom attribute writer method checking allowed values (enum).
158
+ # @param [Object] lifecycle_state Object to be assigned
159
+ def lifecycle_state=(lifecycle_state)
160
+ # rubocop:disable Style/ConditionalAssignment
161
+ if lifecycle_state && !LIFECYCLE_STATE_ENUM.include?(lifecycle_state)
162
+ # rubocop: disable Metrics/LineLength
163
+ OCI.logger.debug("Unknown value for 'lifecycle_state' [" + lifecycle_state + "]. Mapping to 'LIFECYCLE_STATE_UNKNOWN_ENUM_VALUE'") if OCI.logger
164
+ # rubocop: enable Metrics/LineLength
165
+ @lifecycle_state = LIFECYCLE_STATE_UNKNOWN_ENUM_VALUE
166
+ else
167
+ @lifecycle_state = lifecycle_state
168
+ end
169
+ # rubocop:enable Style/ConditionalAssignment
170
+ end
171
+
172
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Metrics/LineLength, Layout/EmptyLines
173
+
174
+
175
+ # Checks equality by comparing each attribute.
176
+ # @param [Object] other the other object to be compared
177
+ def ==(other)
178
+ return true if equal?(other)
179
+
180
+ self.class == other.class &&
181
+ id == other.id &&
182
+ seed == other.seed &&
183
+ user_id == other.user_id &&
184
+ time_created == other.time_created &&
185
+ time_expires == other.time_expires &&
186
+ lifecycle_state == other.lifecycle_state &&
187
+ inactive_status == other.inactive_status &&
188
+ is_activated == other.is_activated
189
+ end
190
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Metrics/LineLength, Layout/EmptyLines
191
+
192
+ # @see the `==` method
193
+ # @param [Object] other the other object to be compared
194
+ def eql?(other)
195
+ self == other
196
+ end
197
+
198
+ # rubocop:disable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
199
+
200
+
201
+ # Calculates hash code according to all attributes.
202
+ # @return [Fixnum] Hash code
203
+ def hash
204
+ [id, seed, user_id, time_created, time_expires, lifecycle_state, inactive_status, is_activated].hash
205
+ end
206
+ # rubocop:enable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
207
+
208
+ # rubocop:disable Metrics/AbcSize, Layout/EmptyLines
209
+
210
+
211
+ # Builds the object from hash
212
+ # @param [Hash] attributes Model attributes in the form of hash
213
+ # @return [Object] Returns the model itself
214
+ def build_from_hash(attributes)
215
+ return nil unless attributes.is_a?(Hash)
216
+
217
+ self.class.swagger_types.each_pair do |key, type|
218
+ if type =~ /^Array<(.*)>/i
219
+ # check to ensure the input is an array given that the the attribute
220
+ # is documented as an array but the input is not
221
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
222
+ public_method("#{key}=").call(
223
+ attributes[self.class.attribute_map[key]]
224
+ .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
225
+ )
226
+ end
227
+ elsif !attributes[self.class.attribute_map[key]].nil?
228
+ public_method("#{key}=").call(
229
+ OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
230
+ )
231
+ end
232
+ # or else data not found in attributes(hash), not an issue as the data can be optional
233
+ end
234
+
235
+ self
236
+ end
237
+ # rubocop:enable Metrics/AbcSize, Layout/EmptyLines
238
+
239
+ # Returns the string representation of the object
240
+ # @return [String] String presentation of the object
241
+ def to_s
242
+ to_hash.to_s
243
+ end
244
+
245
+ # Returns the object in the form of hash
246
+ # @return [Hash] Returns the object in the form of hash
247
+ def to_hash
248
+ hash = {}
249
+ self.class.attribute_map.each_pair do |attr, param|
250
+ value = public_method(attr).call
251
+ next if value.nil? && !instance_variable_defined?("@#{attr}")
252
+
253
+ hash[param] = _to_hash(value)
254
+ end
255
+ hash
256
+ end
257
+
258
+ private
259
+
260
+ # Outputs non-array value in the form of hash
261
+ # For object, use to_hash. Otherwise, just return the value
262
+ # @param [Object] value Any valid value
263
+ # @return [Hash] Returns the value in the form of hash
264
+ def _to_hash(value)
265
+ if value.is_a?(Array)
266
+ value.compact.map { |v| _to_hash(v) }
267
+ elsif value.is_a?(Hash)
268
+ {}.tap do |hash|
269
+ value.each { |k, v| hash[k] = _to_hash(v) }
270
+ end
271
+ elsif value.respond_to? :to_hash
272
+ value.to_hash
273
+ else
274
+ value
275
+ end
276
+ end
277
+ end
278
+ end
279
+ # rubocop:enable Lint/UnneededCopDisableDirective