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,166 @@
1
+ # Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
2
+
3
+ require 'date'
4
+ require_relative 'create_config_source_details'
5
+
6
+ # rubocop:disable Lint/UnneededCopDisableDirective
7
+ module OCI
8
+ # Property details for uploading the configuration zip file.
9
+ #
10
+ class ResourceManager::Models::CreateZipUploadConfigSourceDetails < ResourceManager::Models::CreateConfigSourceDetails # rubocop:disable Metrics/LineLength
11
+ # This attribute is required.
12
+ # @return [String]
13
+ attr_accessor :zip_file_base64_encoded
14
+
15
+ # Attribute mapping from ruby-style variable name to JSON key.
16
+ def self.attribute_map
17
+ {
18
+ # rubocop:disable Style/SymbolLiteral
19
+ 'config_source_type': :'configSourceType',
20
+ 'working_directory': :'workingDirectory',
21
+ 'zip_file_base64_encoded': :'zipFileBase64Encoded'
22
+ # rubocop:enable Style/SymbolLiteral
23
+ }
24
+ end
25
+
26
+ # Attribute type mapping.
27
+ def self.swagger_types
28
+ {
29
+ # rubocop:disable Style/SymbolLiteral
30
+ 'config_source_type': :'String',
31
+ 'working_directory': :'String',
32
+ 'zip_file_base64_encoded': :'String'
33
+ # rubocop:enable Style/SymbolLiteral
34
+ }
35
+ end
36
+
37
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
38
+ # rubocop:disable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
39
+
40
+
41
+ # Initializes the object
42
+ # @param [Hash] attributes Model attributes in the form of hash
43
+ # @option attributes [String] :working_directory The value to assign to the {OCI::ResourceManager::Models::CreateConfigSourceDetails#working_directory #working_directory} proprety
44
+ # @option attributes [String] :zip_file_base64_encoded The value to assign to the {#zip_file_base64_encoded} property
45
+ def initialize(attributes = {})
46
+ return unless attributes.is_a?(Hash)
47
+
48
+ attributes['configSourceType'] = 'ZIP_UPLOAD'
49
+
50
+ super(attributes)
51
+
52
+ # convert string to symbol for hash key
53
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
54
+
55
+ self.zip_file_base64_encoded = attributes[:'zipFileBase64Encoded'] if attributes[:'zipFileBase64Encoded']
56
+
57
+ raise 'You cannot provide both :zipFileBase64Encoded and :zip_file_base64_encoded' if attributes.key?(:'zipFileBase64Encoded') && attributes.key?(:'zip_file_base64_encoded')
58
+
59
+ self.zip_file_base64_encoded = attributes[:'zip_file_base64_encoded'] if attributes[:'zip_file_base64_encoded']
60
+ end
61
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
62
+ # rubocop:enable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
63
+
64
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Metrics/LineLength, Layout/EmptyLines
65
+
66
+
67
+ # Checks equality by comparing each attribute.
68
+ # @param [Object] other the other object to be compared
69
+ def ==(other)
70
+ return true if equal?(other)
71
+
72
+ self.class == other.class &&
73
+ config_source_type == other.config_source_type &&
74
+ working_directory == other.working_directory &&
75
+ zip_file_base64_encoded == other.zip_file_base64_encoded
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
+ [config_source_type, working_directory, zip_file_base64_encoded].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,185 @@
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
+ # FailureDetails model.
9
+ class ResourceManager::Models::FailureDetails # rubocop:disable Metrics/LineLength
10
+ CODE_ENUM = [
11
+ CODE_INTERNAL_SERVICE_ERROR = 'INTERNAL_SERVICE_ERROR'.freeze,
12
+ CODE_TERRAFORM_EXECUTION_ERROR = 'TERRAFORM_EXECUTION_ERROR'.freeze,
13
+ CODE_TERRAFORM_CONFIG_UNZIP_FAILED = 'TERRAFORM_CONFIG_UNZIP_FAILED'.freeze,
14
+ CODE_INVALID_WORKING_DIRECTORY = 'INVALID_WORKING_DIRECTORY'.freeze,
15
+ CODE_JOB_TIMEOUT = 'JOB_TIMEOUT'.freeze,
16
+ CODE_TERRAFORM_CONFIG_VIRUS_FOUND = 'TERRAFORM_CONFIG_VIRUS_FOUND'.freeze,
17
+ CODE_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
18
+ ].freeze
19
+
20
+ # **[Required]** Job failure reason.
21
+ # @return [String]
22
+ attr_reader :code
23
+
24
+ # **[Required]** A human-readable error string.
25
+ # @return [String]
26
+ attr_accessor :message
27
+
28
+ # Attribute mapping from ruby-style variable name to JSON key.
29
+ def self.attribute_map
30
+ {
31
+ # rubocop:disable Style/SymbolLiteral
32
+ 'code': :'code',
33
+ 'message': :'message'
34
+ # rubocop:enable Style/SymbolLiteral
35
+ }
36
+ end
37
+
38
+ # Attribute type mapping.
39
+ def self.swagger_types
40
+ {
41
+ # rubocop:disable Style/SymbolLiteral
42
+ 'code': :'String',
43
+ 'message': :'String'
44
+ # rubocop:enable Style/SymbolLiteral
45
+ }
46
+ end
47
+
48
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
49
+ # rubocop:disable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
50
+
51
+
52
+ # Initializes the object
53
+ # @param [Hash] attributes Model attributes in the form of hash
54
+ # @option attributes [String] :code The value to assign to the {#code} property
55
+ # @option attributes [String] :message The value to assign to the {#message} property
56
+ def initialize(attributes = {})
57
+ return unless attributes.is_a?(Hash)
58
+
59
+ # convert string to symbol for hash key
60
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
61
+
62
+ self.code = attributes[:'code'] if attributes[:'code']
63
+
64
+ self.message = attributes[:'message'] if attributes[:'message']
65
+ end
66
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
67
+ # rubocop:enable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
68
+
69
+ # Custom attribute writer method checking allowed values (enum).
70
+ # @param [Object] code Object to be assigned
71
+ def code=(code)
72
+ # rubocop:disable Style/ConditionalAssignment
73
+ if code && !CODE_ENUM.include?(code)
74
+ # rubocop: disable Metrics/LineLength
75
+ OCI.logger.debug("Unknown value for 'code' [" + code + "]. Mapping to 'CODE_UNKNOWN_ENUM_VALUE'") if OCI.logger
76
+ # rubocop: enable Metrics/LineLength
77
+ @code = CODE_UNKNOWN_ENUM_VALUE
78
+ else
79
+ @code = code
80
+ end
81
+ # rubocop:enable Style/ConditionalAssignment
82
+ end
83
+
84
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Metrics/LineLength, Layout/EmptyLines
85
+
86
+
87
+ # Checks equality by comparing each attribute.
88
+ # @param [Object] other the other object to be compared
89
+ def ==(other)
90
+ return true if equal?(other)
91
+
92
+ self.class == other.class &&
93
+ code == other.code &&
94
+ message == other.message
95
+ end
96
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Metrics/LineLength, Layout/EmptyLines
97
+
98
+ # @see the `==` method
99
+ # @param [Object] other the other object to be compared
100
+ def eql?(other)
101
+ self == other
102
+ end
103
+
104
+ # rubocop:disable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
105
+
106
+
107
+ # Calculates hash code according to all attributes.
108
+ # @return [Fixnum] Hash code
109
+ def hash
110
+ [code, message].hash
111
+ end
112
+ # rubocop:enable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
113
+
114
+ # rubocop:disable Metrics/AbcSize, Layout/EmptyLines
115
+
116
+
117
+ # Builds the object from hash
118
+ # @param [Hash] attributes Model attributes in the form of hash
119
+ # @return [Object] Returns the model itself
120
+ def build_from_hash(attributes)
121
+ return nil unless attributes.is_a?(Hash)
122
+
123
+ self.class.swagger_types.each_pair do |key, type|
124
+ if type =~ /^Array<(.*)>/i
125
+ # check to ensure the input is an array given that the the attribute
126
+ # is documented as an array but the input is not
127
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
128
+ public_method("#{key}=").call(
129
+ attributes[self.class.attribute_map[key]]
130
+ .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
131
+ )
132
+ end
133
+ elsif !attributes[self.class.attribute_map[key]].nil?
134
+ public_method("#{key}=").call(
135
+ OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
136
+ )
137
+ end
138
+ # or else data not found in attributes(hash), not an issue as the data can be optional
139
+ end
140
+
141
+ self
142
+ end
143
+ # rubocop:enable Metrics/AbcSize, Layout/EmptyLines
144
+
145
+ # Returns the string representation of the object
146
+ # @return [String] String presentation of the object
147
+ def to_s
148
+ to_hash.to_s
149
+ end
150
+
151
+ # Returns the object in the form of hash
152
+ # @return [Hash] Returns the object in the form of hash
153
+ def to_hash
154
+ hash = {}
155
+ self.class.attribute_map.each_pair do |attr, param|
156
+ value = public_method(attr).call
157
+ next if value.nil? && !instance_variable_defined?("@#{attr}")
158
+
159
+ hash[param] = _to_hash(value)
160
+ end
161
+ hash
162
+ end
163
+
164
+ private
165
+
166
+ # Outputs non-array value in the form of hash
167
+ # For object, use to_hash. Otherwise, just return the value
168
+ # @param [Object] value Any valid value
169
+ # @return [Hash] Returns the value in the form of hash
170
+ def _to_hash(value)
171
+ if value.is_a?(Array)
172
+ value.compact.map { |v| _to_hash(v) }
173
+ elsif value.is_a?(Hash)
174
+ {}.tap do |hash|
175
+ value.each { |k, v| hash[k] = _to_hash(v) }
176
+ end
177
+ elsif value.respond_to? :to_hash
178
+ value.to_hash
179
+ else
180
+ value
181
+ end
182
+ end
183
+ end
184
+ end
185
+ # rubocop:enable Lint/UnneededCopDisableDirective
@@ -0,0 +1,399 @@
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
+ # Jobs perform the actions that are defined in your configuration. There are three job types
9
+ # - **Plan job**. A plan job takes your Terraform configuration, parses it, and creates an execution plan.
10
+ # - **Apply job**. The apply job takes your execution plan, applies it to the associated stack, then executes
11
+ # the configuration's instructions.
12
+ # - **Destroy job**. To clean up the infrastructure controlled by the stack, you run a destroy job.
13
+ # A destroy job does not delete the stack or associated job resources,
14
+ # but instead releases the resources managed by the stack.
15
+ #
16
+ class ResourceManager::Models::Job # rubocop:disable Metrics/LineLength
17
+ OPERATION_ENUM = [
18
+ OPERATION_PLAN = 'PLAN'.freeze,
19
+ OPERATION_APPLY = 'APPLY'.freeze,
20
+ OPERATION_DESTROY = 'DESTROY'.freeze,
21
+ OPERATION_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
22
+ ].freeze
23
+
24
+ LIFECYCLE_STATE_ENUM = [
25
+ LIFECYCLE_STATE_ACCEPTED = 'ACCEPTED'.freeze,
26
+ LIFECYCLE_STATE_IN_PROGRESS = 'IN_PROGRESS'.freeze,
27
+ LIFECYCLE_STATE_FAILED = 'FAILED'.freeze,
28
+ LIFECYCLE_STATE_SUCCEEDED = 'SUCCEEDED'.freeze,
29
+ LIFECYCLE_STATE_CANCELING = 'CANCELING'.freeze,
30
+ LIFECYCLE_STATE_CANCELED = 'CANCELED'.freeze,
31
+ LIFECYCLE_STATE_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
32
+ ].freeze
33
+
34
+ # The job's OCID.
35
+ # @return [String]
36
+ attr_accessor :id
37
+
38
+ # The OCID of the stack that is associated with the job.
39
+ # @return [String]
40
+ attr_accessor :stack_id
41
+
42
+ # The OCID of the compartment in which the job's associated stack resides.
43
+ # @return [String]
44
+ attr_accessor :compartment_id
45
+
46
+ # The job's display name.
47
+ # @return [String]
48
+ attr_accessor :display_name
49
+
50
+ # The type of job executing.
51
+ # @return [String]
52
+ attr_reader :operation
53
+
54
+ # @return [OCI::ResourceManager::Models::ApplyJobPlanResolution]
55
+ attr_accessor :apply_job_plan_resolution
56
+
57
+ # The plan job OCID that was used (if this was an apply job and was not auto-approved).
58
+ # @return [String]
59
+ attr_accessor :resolved_plan_job_id
60
+
61
+ # The date and time at which the job was created.
62
+ # @return [DateTime]
63
+ attr_accessor :time_created
64
+
65
+ # The date and time at which the job stopped running, irrespective of whether the job ran successfully.
66
+ # @return [DateTime]
67
+ attr_accessor :time_finished
68
+
69
+ # @return [String]
70
+ attr_reader :lifecycle_state
71
+
72
+ # @return [OCI::ResourceManager::Models::FailureDetails]
73
+ attr_accessor :failure_details
74
+
75
+ # The file path to the directory within the configuration from which the job runs.
76
+ # @return [String]
77
+ attr_accessor :working_directory
78
+
79
+ # Terraform variables associated with this resource.
80
+ # Maximum number of variables supported is 100.
81
+ # The maximum size of each variable, including both name and value, is 4096 bytes.
82
+ # Example: `{\"CompartmentId\": \"compartment-id-value\"}`
83
+ #
84
+ # @return [Hash<String, String>]
85
+ attr_accessor :variables
86
+
87
+ # Free-form tags associated with this resource. Each tag is a key-value pair with no predefined name, type, or namespace.
88
+ # For more information, see [Resource Tags](https://docs.us-phoenix-1.oraclecloud.com/iaas/Content/General/Concepts/resourcetags.htm).
89
+ # Example: `{\"Department\": \"Finance\"}`
90
+ #
91
+ # @return [Hash<String, String>]
92
+ attr_accessor :freeform_tags
93
+
94
+ # Defined tags for this resource. Each key is predefined and scoped to a namespace.
95
+ # For more information, see [Resource Tags](https://docs.us-phoenix-1.oraclecloud.com/iaas/Content/General/Concepts/resourcetags.htm).
96
+ # Example: `{\"Operations\": {\"CostCenter\": \"42\"}}`
97
+ #
98
+ # @return [Hash<String, Hash<String, Object>>]
99
+ attr_accessor :defined_tags
100
+
101
+ # Attribute mapping from ruby-style variable name to JSON key.
102
+ def self.attribute_map
103
+ {
104
+ # rubocop:disable Style/SymbolLiteral
105
+ 'id': :'id',
106
+ 'stack_id': :'stackId',
107
+ 'compartment_id': :'compartmentId',
108
+ 'display_name': :'displayName',
109
+ 'operation': :'operation',
110
+ 'apply_job_plan_resolution': :'applyJobPlanResolution',
111
+ 'resolved_plan_job_id': :'resolvedPlanJobId',
112
+ 'time_created': :'timeCreated',
113
+ 'time_finished': :'timeFinished',
114
+ 'lifecycle_state': :'lifecycleState',
115
+ 'failure_details': :'failureDetails',
116
+ 'working_directory': :'workingDirectory',
117
+ 'variables': :'variables',
118
+ 'freeform_tags': :'freeformTags',
119
+ 'defined_tags': :'definedTags'
120
+ # rubocop:enable Style/SymbolLiteral
121
+ }
122
+ end
123
+
124
+ # Attribute type mapping.
125
+ def self.swagger_types
126
+ {
127
+ # rubocop:disable Style/SymbolLiteral
128
+ 'id': :'String',
129
+ 'stack_id': :'String',
130
+ 'compartment_id': :'String',
131
+ 'display_name': :'String',
132
+ 'operation': :'String',
133
+ 'apply_job_plan_resolution': :'OCI::ResourceManager::Models::ApplyJobPlanResolution',
134
+ 'resolved_plan_job_id': :'String',
135
+ 'time_created': :'DateTime',
136
+ 'time_finished': :'DateTime',
137
+ 'lifecycle_state': :'String',
138
+ 'failure_details': :'OCI::ResourceManager::Models::FailureDetails',
139
+ 'working_directory': :'String',
140
+ 'variables': :'Hash<String, String>',
141
+ 'freeform_tags': :'Hash<String, String>',
142
+ 'defined_tags': :'Hash<String, Hash<String, Object>>'
143
+ # rubocop:enable Style/SymbolLiteral
144
+ }
145
+ end
146
+
147
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
148
+ # rubocop:disable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
149
+
150
+
151
+ # Initializes the object
152
+ # @param [Hash] attributes Model attributes in the form of hash
153
+ # @option attributes [String] :id The value to assign to the {#id} property
154
+ # @option attributes [String] :stack_id The value to assign to the {#stack_id} property
155
+ # @option attributes [String] :compartment_id The value to assign to the {#compartment_id} property
156
+ # @option attributes [String] :display_name The value to assign to the {#display_name} property
157
+ # @option attributes [String] :operation The value to assign to the {#operation} property
158
+ # @option attributes [OCI::ResourceManager::Models::ApplyJobPlanResolution] :apply_job_plan_resolution The value to assign to the {#apply_job_plan_resolution} property
159
+ # @option attributes [String] :resolved_plan_job_id The value to assign to the {#resolved_plan_job_id} property
160
+ # @option attributes [DateTime] :time_created The value to assign to the {#time_created} property
161
+ # @option attributes [DateTime] :time_finished The value to assign to the {#time_finished} property
162
+ # @option attributes [String] :lifecycle_state The value to assign to the {#lifecycle_state} property
163
+ # @option attributes [OCI::ResourceManager::Models::FailureDetails] :failure_details The value to assign to the {#failure_details} property
164
+ # @option attributes [String] :working_directory The value to assign to the {#working_directory} property
165
+ # @option attributes [Hash<String, String>] :variables The value to assign to the {#variables} property
166
+ # @option attributes [Hash<String, String>] :freeform_tags The value to assign to the {#freeform_tags} property
167
+ # @option attributes [Hash<String, Hash<String, Object>>] :defined_tags The value to assign to the {#defined_tags} property
168
+ def initialize(attributes = {})
169
+ return unless attributes.is_a?(Hash)
170
+
171
+ # convert string to symbol for hash key
172
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
173
+
174
+ self.id = attributes[:'id'] if attributes[:'id']
175
+
176
+ self.stack_id = attributes[:'stackId'] if attributes[:'stackId']
177
+
178
+ raise 'You cannot provide both :stackId and :stack_id' if attributes.key?(:'stackId') && attributes.key?(:'stack_id')
179
+
180
+ self.stack_id = attributes[:'stack_id'] if attributes[:'stack_id']
181
+
182
+ self.compartment_id = attributes[:'compartmentId'] if attributes[:'compartmentId']
183
+
184
+ raise 'You cannot provide both :compartmentId and :compartment_id' if attributes.key?(:'compartmentId') && attributes.key?(:'compartment_id')
185
+
186
+ self.compartment_id = attributes[:'compartment_id'] if attributes[:'compartment_id']
187
+
188
+ self.display_name = attributes[:'displayName'] if attributes[:'displayName']
189
+
190
+ raise 'You cannot provide both :displayName and :display_name' if attributes.key?(:'displayName') && attributes.key?(:'display_name')
191
+
192
+ self.display_name = attributes[:'display_name'] if attributes[:'display_name']
193
+
194
+ self.operation = attributes[:'operation'] if attributes[:'operation']
195
+
196
+ self.apply_job_plan_resolution = attributes[:'applyJobPlanResolution'] if attributes[:'applyJobPlanResolution']
197
+
198
+ raise 'You cannot provide both :applyJobPlanResolution and :apply_job_plan_resolution' if attributes.key?(:'applyJobPlanResolution') && attributes.key?(:'apply_job_plan_resolution')
199
+
200
+ self.apply_job_plan_resolution = attributes[:'apply_job_plan_resolution'] if attributes[:'apply_job_plan_resolution']
201
+
202
+ self.resolved_plan_job_id = attributes[:'resolvedPlanJobId'] if attributes[:'resolvedPlanJobId']
203
+
204
+ raise 'You cannot provide both :resolvedPlanJobId and :resolved_plan_job_id' if attributes.key?(:'resolvedPlanJobId') && attributes.key?(:'resolved_plan_job_id')
205
+
206
+ self.resolved_plan_job_id = attributes[:'resolved_plan_job_id'] if attributes[:'resolved_plan_job_id']
207
+
208
+ self.time_created = attributes[:'timeCreated'] if attributes[:'timeCreated']
209
+
210
+ raise 'You cannot provide both :timeCreated and :time_created' if attributes.key?(:'timeCreated') && attributes.key?(:'time_created')
211
+
212
+ self.time_created = attributes[:'time_created'] if attributes[:'time_created']
213
+
214
+ self.time_finished = attributes[:'timeFinished'] if attributes[:'timeFinished']
215
+
216
+ raise 'You cannot provide both :timeFinished and :time_finished' if attributes.key?(:'timeFinished') && attributes.key?(:'time_finished')
217
+
218
+ self.time_finished = attributes[:'time_finished'] if attributes[:'time_finished']
219
+
220
+ self.lifecycle_state = attributes[:'lifecycleState'] if attributes[:'lifecycleState']
221
+
222
+ raise 'You cannot provide both :lifecycleState and :lifecycle_state' if attributes.key?(:'lifecycleState') && attributes.key?(:'lifecycle_state')
223
+
224
+ self.lifecycle_state = attributes[:'lifecycle_state'] if attributes[:'lifecycle_state']
225
+
226
+ self.failure_details = attributes[:'failureDetails'] if attributes[:'failureDetails']
227
+
228
+ raise 'You cannot provide both :failureDetails and :failure_details' if attributes.key?(:'failureDetails') && attributes.key?(:'failure_details')
229
+
230
+ self.failure_details = attributes[:'failure_details'] if attributes[:'failure_details']
231
+
232
+ self.working_directory = attributes[:'workingDirectory'] if attributes[:'workingDirectory']
233
+
234
+ raise 'You cannot provide both :workingDirectory and :working_directory' if attributes.key?(:'workingDirectory') && attributes.key?(:'working_directory')
235
+
236
+ self.working_directory = attributes[:'working_directory'] if attributes[:'working_directory']
237
+
238
+ self.variables = attributes[:'variables'] if attributes[:'variables']
239
+
240
+ self.freeform_tags = attributes[:'freeformTags'] if attributes[:'freeformTags']
241
+
242
+ raise 'You cannot provide both :freeformTags and :freeform_tags' if attributes.key?(:'freeformTags') && attributes.key?(:'freeform_tags')
243
+
244
+ self.freeform_tags = attributes[:'freeform_tags'] if attributes[:'freeform_tags']
245
+
246
+ self.defined_tags = attributes[:'definedTags'] if attributes[:'definedTags']
247
+
248
+ raise 'You cannot provide both :definedTags and :defined_tags' if attributes.key?(:'definedTags') && attributes.key?(:'defined_tags')
249
+
250
+ self.defined_tags = attributes[:'defined_tags'] if attributes[:'defined_tags']
251
+ end
252
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
253
+ # rubocop:enable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
254
+
255
+ # Custom attribute writer method checking allowed values (enum).
256
+ # @param [Object] operation Object to be assigned
257
+ def operation=(operation)
258
+ # rubocop:disable Style/ConditionalAssignment
259
+ if operation && !OPERATION_ENUM.include?(operation)
260
+ # rubocop: disable Metrics/LineLength
261
+ OCI.logger.debug("Unknown value for 'operation' [" + operation + "]. Mapping to 'OPERATION_UNKNOWN_ENUM_VALUE'") if OCI.logger
262
+ # rubocop: enable Metrics/LineLength
263
+ @operation = OPERATION_UNKNOWN_ENUM_VALUE
264
+ else
265
+ @operation = operation
266
+ end
267
+ # rubocop:enable Style/ConditionalAssignment
268
+ end
269
+
270
+ # Custom attribute writer method checking allowed values (enum).
271
+ # @param [Object] lifecycle_state Object to be assigned
272
+ def lifecycle_state=(lifecycle_state)
273
+ # rubocop:disable Style/ConditionalAssignment
274
+ if lifecycle_state && !LIFECYCLE_STATE_ENUM.include?(lifecycle_state)
275
+ # rubocop: disable Metrics/LineLength
276
+ OCI.logger.debug("Unknown value for 'lifecycle_state' [" + lifecycle_state + "]. Mapping to 'LIFECYCLE_STATE_UNKNOWN_ENUM_VALUE'") if OCI.logger
277
+ # rubocop: enable Metrics/LineLength
278
+ @lifecycle_state = LIFECYCLE_STATE_UNKNOWN_ENUM_VALUE
279
+ else
280
+ @lifecycle_state = lifecycle_state
281
+ end
282
+ # rubocop:enable Style/ConditionalAssignment
283
+ end
284
+
285
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Metrics/LineLength, Layout/EmptyLines
286
+
287
+
288
+ # Checks equality by comparing each attribute.
289
+ # @param [Object] other the other object to be compared
290
+ def ==(other)
291
+ return true if equal?(other)
292
+
293
+ self.class == other.class &&
294
+ id == other.id &&
295
+ stack_id == other.stack_id &&
296
+ compartment_id == other.compartment_id &&
297
+ display_name == other.display_name &&
298
+ operation == other.operation &&
299
+ apply_job_plan_resolution == other.apply_job_plan_resolution &&
300
+ resolved_plan_job_id == other.resolved_plan_job_id &&
301
+ time_created == other.time_created &&
302
+ time_finished == other.time_finished &&
303
+ lifecycle_state == other.lifecycle_state &&
304
+ failure_details == other.failure_details &&
305
+ working_directory == other.working_directory &&
306
+ variables == other.variables &&
307
+ freeform_tags == other.freeform_tags &&
308
+ defined_tags == other.defined_tags
309
+ end
310
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Metrics/LineLength, Layout/EmptyLines
311
+
312
+ # @see the `==` method
313
+ # @param [Object] other the other object to be compared
314
+ def eql?(other)
315
+ self == other
316
+ end
317
+
318
+ # rubocop:disable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
319
+
320
+
321
+ # Calculates hash code according to all attributes.
322
+ # @return [Fixnum] Hash code
323
+ def hash
324
+ [id, stack_id, compartment_id, display_name, operation, apply_job_plan_resolution, resolved_plan_job_id, time_created, time_finished, lifecycle_state, failure_details, working_directory, variables, freeform_tags, defined_tags].hash
325
+ end
326
+ # rubocop:enable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
327
+
328
+ # rubocop:disable Metrics/AbcSize, Layout/EmptyLines
329
+
330
+
331
+ # Builds the object from hash
332
+ # @param [Hash] attributes Model attributes in the form of hash
333
+ # @return [Object] Returns the model itself
334
+ def build_from_hash(attributes)
335
+ return nil unless attributes.is_a?(Hash)
336
+
337
+ self.class.swagger_types.each_pair do |key, type|
338
+ if type =~ /^Array<(.*)>/i
339
+ # check to ensure the input is an array given that the the attribute
340
+ # is documented as an array but the input is not
341
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
342
+ public_method("#{key}=").call(
343
+ attributes[self.class.attribute_map[key]]
344
+ .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
345
+ )
346
+ end
347
+ elsif !attributes[self.class.attribute_map[key]].nil?
348
+ public_method("#{key}=").call(
349
+ OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
350
+ )
351
+ end
352
+ # or else data not found in attributes(hash), not an issue as the data can be optional
353
+ end
354
+
355
+ self
356
+ end
357
+ # rubocop:enable Metrics/AbcSize, Layout/EmptyLines
358
+
359
+ # Returns the string representation of the object
360
+ # @return [String] String presentation of the object
361
+ def to_s
362
+ to_hash.to_s
363
+ end
364
+
365
+ # Returns the object in the form of hash
366
+ # @return [Hash] Returns the object in the form of hash
367
+ def to_hash
368
+ hash = {}
369
+ self.class.attribute_map.each_pair do |attr, param|
370
+ value = public_method(attr).call
371
+ next if value.nil? && !instance_variable_defined?("@#{attr}")
372
+
373
+ hash[param] = _to_hash(value)
374
+ end
375
+ hash
376
+ end
377
+
378
+ private
379
+
380
+ # Outputs non-array value in the form of hash
381
+ # For object, use to_hash. Otherwise, just return the value
382
+ # @param [Object] value Any valid value
383
+ # @return [Hash] Returns the value in the form of hash
384
+ def _to_hash(value)
385
+ if value.is_a?(Array)
386
+ value.compact.map { |v| _to_hash(v) }
387
+ elsif value.is_a?(Hash)
388
+ {}.tap do |hash|
389
+ value.each { |k, v| hash[k] = _to_hash(v) }
390
+ end
391
+ elsif value.respond_to? :to_hash
392
+ value.to_hash
393
+ else
394
+ value
395
+ end
396
+ end
397
+ end
398
+ end
399
+ # rubocop:enable Lint/UnneededCopDisableDirective