oci 2.4.6 → 2.4.7

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 (123) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +3 -1
  3. data/lib/oci.rb +2 -0
  4. data/lib/oci/database/database.rb +1 -0
  5. data/lib/oci/database/models/database.rb +18 -4
  6. data/lib/oci/database/models/database_connection_strings.rb +182 -0
  7. data/lib/oci/database/models/database_summary.rb +18 -4
  8. data/lib/oci/dns/dns.rb +23 -0
  9. data/lib/oci/dns/dns_client.rb +802 -75
  10. data/lib/oci/dns/dns_client_composite_operations.rb +238 -0
  11. data/lib/oci/dns/models/create_steering_policy_attachment_details.rb +205 -0
  12. data/lib/oci/dns/models/create_steering_policy_details.rb +333 -0
  13. data/lib/oci/dns/models/steering_policy.rb +418 -0
  14. data/lib/oci/dns/models/steering_policy_answer.rb +205 -0
  15. data/lib/oci/dns/models/steering_policy_attachment.rb +308 -0
  16. data/lib/oci/dns/models/steering_policy_attachment_summary.rb +304 -0
  17. data/lib/oci/dns/models/steering_policy_filter_answer_data.rb +168 -0
  18. data/lib/oci/dns/models/steering_policy_filter_rule.rb +178 -0
  19. data/lib/oci/dns/models/steering_policy_filter_rule_case.rb +165 -0
  20. data/lib/oci/dns/models/steering_policy_health_rule.rb +160 -0
  21. data/lib/oci/dns/models/steering_policy_health_rule_case.rb +152 -0
  22. data/lib/oci/dns/models/steering_policy_limit_rule.rb +179 -0
  23. data/lib/oci/dns/models/steering_policy_limit_rule_case.rb +162 -0
  24. data/lib/oci/dns/models/steering_policy_priority_answer_data.rb +161 -0
  25. data/lib/oci/dns/models/steering_policy_priority_rule.rb +178 -0
  26. data/lib/oci/dns/models/steering_policy_priority_rule_case.rb +165 -0
  27. data/lib/oci/dns/models/steering_policy_rule.rb +237 -0
  28. data/lib/oci/dns/models/steering_policy_summary.rb +391 -0
  29. data/lib/oci/dns/models/steering_policy_weighted_answer_data.rb +161 -0
  30. data/lib/oci/dns/models/steering_policy_weighted_rule.rb +178 -0
  31. data/lib/oci/dns/models/steering_policy_weighted_rule_case.rb +165 -0
  32. data/lib/oci/dns/models/update_steering_policy_attachment_details.rb +156 -0
  33. data/lib/oci/dns/models/update_steering_policy_details.rb +319 -0
  34. data/lib/oci/email/email.rb +1 -0
  35. data/lib/oci/email/email_client.rb +87 -16
  36. data/lib/oci/email/email_client_composite_operations.rb +40 -0
  37. data/lib/oci/email/models/create_sender_details.rb +40 -6
  38. data/lib/oci/email/models/create_suppression_details.rb +2 -2
  39. data/lib/oci/email/models/sender.rb +53 -5
  40. data/lib/oci/email/models/sender_summary.rb +38 -4
  41. data/lib/oci/email/models/suppression.rb +20 -3
  42. data/lib/oci/email/models/update_sender_details.rb +174 -0
  43. data/lib/oci/healthchecks/health_checks_client.rb +1137 -0
  44. data/lib/oci/healthchecks/health_checks_client_composite_operations.rb +24 -0
  45. data/lib/oci/healthchecks/healthchecks.rb +41 -0
  46. data/lib/oci/healthchecks/models/connection.rb +159 -0
  47. data/lib/oci/healthchecks/models/create_http_monitor_details.rb +359 -0
  48. data/lib/oci/healthchecks/models/create_on_demand_http_probe_details.rb +278 -0
  49. data/lib/oci/healthchecks/models/create_on_demand_ping_probe_details.rb +229 -0
  50. data/lib/oci/healthchecks/models/create_ping_monitor_details.rb +310 -0
  51. data/lib/oci/healthchecks/models/dns.rb +165 -0
  52. data/lib/oci/healthchecks/models/geolocation.rb +239 -0
  53. data/lib/oci/healthchecks/models/health_checks_vantage_point_summary.rb +211 -0
  54. data/lib/oci/healthchecks/models/http_monitor.rb +395 -0
  55. data/lib/oci/healthchecks/models/http_monitor_summary.rb +290 -0
  56. data/lib/oci/healthchecks/models/http_probe.rb +314 -0
  57. data/lib/oci/healthchecks/models/http_probe_method.rb +10 -0
  58. data/lib/oci/healthchecks/models/http_probe_protocol.rb +10 -0
  59. data/lib/oci/healthchecks/models/http_probe_result_summary.rb +542 -0
  60. data/lib/oci/healthchecks/models/ping_monitor.rb +340 -0
  61. data/lib/oci/healthchecks/models/ping_monitor_summary.rb +290 -0
  62. data/lib/oci/healthchecks/models/ping_probe.rb +259 -0
  63. data/lib/oci/healthchecks/models/ping_probe_protocol.rb +10 -0
  64. data/lib/oci/healthchecks/models/ping_probe_result_summary.rb +418 -0
  65. data/lib/oci/healthchecks/models/routing.rb +192 -0
  66. data/lib/oci/healthchecks/models/tcp_connection.rb +189 -0
  67. data/lib/oci/healthchecks/models/update_http_monitor_details.rb +339 -0
  68. data/lib/oci/healthchecks/models/update_ping_monitor_details.rb +292 -0
  69. data/lib/oci/healthchecks/util.rb +2 -0
  70. data/lib/oci/regions.rb +3 -1
  71. data/lib/oci/version.rb +1 -1
  72. data/lib/oci/waas/models/access_rule.rb +283 -0
  73. data/lib/oci/waas/models/access_rule_criteria.rb +206 -0
  74. data/lib/oci/waas/models/address_rate_limiting.rb +195 -0
  75. data/lib/oci/waas/models/block_challenge_settings.rb +288 -0
  76. data/lib/oci/waas/models/captcha.rb +231 -0
  77. data/lib/oci/waas/models/certificate.rb +383 -0
  78. data/lib/oci/waas/models/certificate_extensions.rb +170 -0
  79. data/lib/oci/waas/models/certificate_public_key_info.rb +170 -0
  80. data/lib/oci/waas/models/certificate_subject_name.rb +218 -0
  81. data/lib/oci/waas/models/certificate_summary.rb +274 -0
  82. data/lib/oci/waas/models/create_certificate_details.rb +241 -0
  83. data/lib/oci/waas/models/create_waas_policy_details.rb +257 -0
  84. data/lib/oci/waas/models/device_fingerprint_challenge.rb +268 -0
  85. data/lib/oci/waas/models/edge_subnet.rb +173 -0
  86. data/lib/oci/waas/models/good_bot.rb +183 -0
  87. data/lib/oci/waas/models/header.rb +159 -0
  88. data/lib/oci/waas/models/human_interaction_challenge.rb +282 -0
  89. data/lib/oci/waas/models/js_challenge.rb +240 -0
  90. data/lib/oci/waas/models/lifecycle_states.rb +14 -0
  91. data/lib/oci/waas/models/origin.rb +191 -0
  92. data/lib/oci/waas/models/policy_config.rb +181 -0
  93. data/lib/oci/waas/models/protection_rule.rb +237 -0
  94. data/lib/oci/waas/models/protection_rule_action.rb +185 -0
  95. data/lib/oci/waas/models/protection_rule_exclusion.rb +182 -0
  96. data/lib/oci/waas/models/protection_settings.rb +404 -0
  97. data/lib/oci/waas/models/recommendation.rb +210 -0
  98. data/lib/oci/waas/models/threat_feed.rb +202 -0
  99. data/lib/oci/waas/models/threat_feed_action.rb +175 -0
  100. data/lib/oci/waas/models/update_certificate_details.rb +183 -0
  101. data/lib/oci/waas/models/update_waas_policy_details.rb +233 -0
  102. data/lib/oci/waas/models/waas_policy.rb +331 -0
  103. data/lib/oci/waas/models/waas_policy_summary.rb +271 -0
  104. data/lib/oci/waas/models/waf_blocked_request.rb +219 -0
  105. data/lib/oci/waas/models/waf_config.rb +295 -0
  106. data/lib/oci/waas/models/waf_config_details.rb +253 -0
  107. data/lib/oci/waas/models/waf_log.rb +510 -0
  108. data/lib/oci/waas/models/waf_meter_datum.rb +279 -0
  109. data/lib/oci/waas/models/waf_request.rb +177 -0
  110. data/lib/oci/waas/models/waf_traffic_datum.rb +223 -0
  111. data/lib/oci/waas/models/whitelist.rb +159 -0
  112. data/lib/oci/waas/models/work_request.rb +322 -0
  113. data/lib/oci/waas/models/work_request_error.rb +170 -0
  114. data/lib/oci/waas/models/work_request_log_entry.rb +159 -0
  115. data/lib/oci/waas/models/work_request_operation_types.rb +12 -0
  116. data/lib/oci/waas/models/work_request_resource.rb +217 -0
  117. data/lib/oci/waas/models/work_request_status_values.rb +14 -0
  118. data/lib/oci/waas/models/work_request_summary.rb +302 -0
  119. data/lib/oci/waas/util.rb +2 -0
  120. data/lib/oci/waas/waas.rb +66 -0
  121. data/lib/oci/waas/waas_client.rb +3044 -0
  122. data/lib/oci/waas/waas_client_composite_operations.rb +990 -0
  123. metadata +105 -2
@@ -0,0 +1,333 @@
1
+ # Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
2
+
3
+ require 'date'
4
+
5
+ # rubocop:disable Lint/UnneededCopDisableDirective
6
+ module OCI
7
+ # The body for defining a new steering policy.
8
+ #
9
+ # *Warning:* Oracle recommends that you avoid using any confidential information when you supply string values using the API.
10
+ #
11
+ class Dns::Models::CreateSteeringPolicyDetails # rubocop:disable Metrics/LineLength
12
+ TEMPLATE_ENUM = [
13
+ TEMPLATE_FAILOVER = 'FAILOVER'.freeze,
14
+ TEMPLATE_LOAD_BALANCE = 'LOAD_BALANCE'.freeze,
15
+ TEMPLATE_ROUTE_BY_GEO = 'ROUTE_BY_GEO'.freeze,
16
+ TEMPLATE_ROUTE_BY_ASN = 'ROUTE_BY_ASN'.freeze,
17
+ TEMPLATE_ROUTE_BY_IP = 'ROUTE_BY_IP'.freeze,
18
+ TEMPLATE_CUSTOM = 'CUSTOM'.freeze
19
+ ].freeze
20
+
21
+ # **[Required]** The OCID of the compartment containing the steering policy.
22
+ # @return [String]
23
+ attr_accessor :compartment_id
24
+
25
+ # **[Required]** A user-friendly name for the steering policy.
26
+ # Does not have to be unique, and it's changeable.
27
+ # Avoid entering confidential information.
28
+ #
29
+ # @return [String]
30
+ attr_accessor :display_name
31
+
32
+ # The Time To Live for responses from the steering policy, in seconds.
33
+ # If not specified during creation, a value of 30 seconds will be used.
34
+ #
35
+ # @return [Integer]
36
+ attr_accessor :ttl
37
+
38
+ # The OCID of the health check monitor providing health data about the answers of the
39
+ # steering policy.
40
+ # A steering policy answer with `rdata` matching a monitored endpoint will use the health
41
+ # data of that endpoint.
42
+ # A steering policy answer with `rdata` not matching any monitored endpoint will be assumed
43
+ # healthy.
44
+ #
45
+ # @return [String]
46
+ attr_accessor :health_check_monitor_id
47
+
48
+ # **[Required]** The common pattern (or lack thereof) to which the steering policy adheres. This
49
+ # value restricts the possible configurations of rules, but thereby supports
50
+ # specifically tailored interfaces. Values other than \"CUSTOM\" require the rules to
51
+ # begin with an unconditional FILTER that keeps answers contingent upon
52
+ # `answer.isDisabled != true`, followed
53
+ # _if and only if the policy references a health check monitor_ by an unconditional
54
+ # HEALTH rule, and require the last rule to be an unconditional LIMIT.
55
+ # What must precede the LIMIT rule is determined by the template value:
56
+ # - FAILOVER requires exactly an unconditional PRIORITY rule that ranks answers by pool.
57
+ # Each answer pool must have a unique priority value assigned to it. Answer data must
58
+ # be defined in the `defaultAnswerData` property for the rule and the `cases` property
59
+ # must not be defined.
60
+ # - LOAD_BALANCE requires exactly an unconditional WEIGHTED rule that shuffles answers
61
+ # by name. Answer data must be defined in the `defaultAnswerData` property for the
62
+ # rule and the `cases` property must not be defined.
63
+ # - ROUTE_BY_GEO requires exactly one PRIORITY rule that ranks answers by pool using the
64
+ # geographical location of the client as a condition. Within that rule you may only
65
+ # use `query.client.geoKey` in the `caseCondition` expressions for defining the cases.
66
+ # For each case in the PRIORITY rule each answer pool must have a unique priority
67
+ # value assigned to it. Answer data can only be defined within cases and
68
+ # `defaultAnswerData` cannot be used in the PRIORITY rule.
69
+ # - ROUTE_BY_ASN requires exactly one PRIORITY rule that ranks answers by pool using the
70
+ # ASN of the client as a condition. Within that rule you may only use
71
+ # `query.client.asn` in the `caseCondition` expressions for defining the cases.
72
+ # For each case in the PRIORITY rule each answer pool must have a unique priority
73
+ # value assigned to it. Answer data can only be defined within cases and
74
+ # `defaultAnswerData` cannot be used in the PRIORITY rule.
75
+ # - ROUTE_BY_IP requires exactly one PRIORITY rule that ranks answers by pool using the
76
+ # IP subnet of the client as a condition. Within that rule you may only use
77
+ # `query.client.address` in the `caseCondition` expressions for defining the cases.
78
+ # For each case in the PRIORITY rule each answer pool must have a unique priority
79
+ # value assigned to it. Answer data can only be defined within cases and
80
+ # `defaultAnswerData` cannot be used in the PRIORITY rule.
81
+ # - CUSTOM allows an arbitrary configuration of rules.
82
+ #
83
+ # For an existing steering policy, the template value may be changed to any of the
84
+ # supported options but the resulting policy must conform to the requirements for the
85
+ # new template type or else a Bad Request error will be returned.
86
+ #
87
+ # @return [String]
88
+ attr_reader :template
89
+
90
+ # Simple key-value pair that is applied without any predefined name, type, or scope.
91
+ # For more information, see [Resource Tags](https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm).
92
+ # Example: `{\"bar-key\": \"value\"}`
93
+ #
94
+ # @return [Hash<String, String>]
95
+ attr_accessor :freeform_tags
96
+
97
+ # Usage of predefined tag keys. These predefined keys are scoped to a namespace.
98
+ # Example: `{\"foo-namespace\": {\"bar-key\": \"value\"}}`
99
+ #
100
+ # @return [Hash<String, Hash<String, Object>>]
101
+ attr_accessor :defined_tags
102
+
103
+ # The set of all answers that can potentially issue from the steering policy.
104
+ #
105
+ # @return [Array<OCI::Dns::Models::SteeringPolicyAnswer>]
106
+ attr_accessor :answers
107
+
108
+ # The pipeline of rules that will be processed in sequence to reduce the pool of answers
109
+ # to a response for any given request.
110
+ #
111
+ # The first rule receives a shuffled list of all answers, and every other rule receives
112
+ # the list of answers emitted by the one preceding it. The last rule populates the
113
+ # response.
114
+ #
115
+ # @return [Array<OCI::Dns::Models::SteeringPolicyRule>]
116
+ attr_accessor :rules
117
+
118
+ # Attribute mapping from ruby-style variable name to JSON key.
119
+ def self.attribute_map
120
+ {
121
+ # rubocop:disable Style/SymbolLiteral
122
+ 'compartment_id': :'compartmentId',
123
+ 'display_name': :'displayName',
124
+ 'ttl': :'ttl',
125
+ 'health_check_monitor_id': :'healthCheckMonitorId',
126
+ 'template': :'template',
127
+ 'freeform_tags': :'freeformTags',
128
+ 'defined_tags': :'definedTags',
129
+ 'answers': :'answers',
130
+ 'rules': :'rules'
131
+ # rubocop:enable Style/SymbolLiteral
132
+ }
133
+ end
134
+
135
+ # Attribute type mapping.
136
+ def self.swagger_types
137
+ {
138
+ # rubocop:disable Style/SymbolLiteral
139
+ 'compartment_id': :'String',
140
+ 'display_name': :'String',
141
+ 'ttl': :'Integer',
142
+ 'health_check_monitor_id': :'String',
143
+ 'template': :'String',
144
+ 'freeform_tags': :'Hash<String, String>',
145
+ 'defined_tags': :'Hash<String, Hash<String, Object>>',
146
+ 'answers': :'Array<OCI::Dns::Models::SteeringPolicyAnswer>',
147
+ 'rules': :'Array<OCI::Dns::Models::SteeringPolicyRule>'
148
+ # rubocop:enable Style/SymbolLiteral
149
+ }
150
+ end
151
+
152
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
153
+ # rubocop:disable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
154
+
155
+
156
+ # Initializes the object
157
+ # @param [Hash] attributes Model attributes in the form of hash
158
+ # @option attributes [String] :compartment_id The value to assign to the {#compartment_id} property
159
+ # @option attributes [String] :display_name The value to assign to the {#display_name} property
160
+ # @option attributes [Integer] :ttl The value to assign to the {#ttl} property
161
+ # @option attributes [String] :health_check_monitor_id The value to assign to the {#health_check_monitor_id} property
162
+ # @option attributes [String] :template The value to assign to the {#template} property
163
+ # @option attributes [Hash<String, String>] :freeform_tags The value to assign to the {#freeform_tags} property
164
+ # @option attributes [Hash<String, Hash<String, Object>>] :defined_tags The value to assign to the {#defined_tags} property
165
+ # @option attributes [Array<OCI::Dns::Models::SteeringPolicyAnswer>] :answers The value to assign to the {#answers} property
166
+ # @option attributes [Array<OCI::Dns::Models::SteeringPolicyRule>] :rules The value to assign to the {#rules} property
167
+ def initialize(attributes = {})
168
+ return unless attributes.is_a?(Hash)
169
+
170
+ # convert string to symbol for hash key
171
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
172
+
173
+ self.compartment_id = attributes[:'compartmentId'] if attributes[:'compartmentId']
174
+
175
+ raise 'You cannot provide both :compartmentId and :compartment_id' if attributes.key?(:'compartmentId') && attributes.key?(:'compartment_id')
176
+
177
+ self.compartment_id = attributes[:'compartment_id'] if attributes[:'compartment_id']
178
+
179
+ self.display_name = attributes[:'displayName'] if attributes[:'displayName']
180
+
181
+ raise 'You cannot provide both :displayName and :display_name' if attributes.key?(:'displayName') && attributes.key?(:'display_name')
182
+
183
+ self.display_name = attributes[:'display_name'] if attributes[:'display_name']
184
+
185
+ self.ttl = attributes[:'ttl'] if attributes[:'ttl']
186
+ self.ttl = 30 if ttl.nil? && !attributes.key?(:'ttl') # rubocop:disable Style/StringLiterals
187
+
188
+ self.health_check_monitor_id = attributes[:'healthCheckMonitorId'] if attributes[:'healthCheckMonitorId']
189
+
190
+ raise 'You cannot provide both :healthCheckMonitorId and :health_check_monitor_id' if attributes.key?(:'healthCheckMonitorId') && attributes.key?(:'health_check_monitor_id')
191
+
192
+ self.health_check_monitor_id = attributes[:'health_check_monitor_id'] if attributes[:'health_check_monitor_id']
193
+
194
+ self.template = attributes[:'template'] if attributes[:'template']
195
+
196
+ self.freeform_tags = attributes[:'freeformTags'] if attributes[:'freeformTags']
197
+
198
+ raise 'You cannot provide both :freeformTags and :freeform_tags' if attributes.key?(:'freeformTags') && attributes.key?(:'freeform_tags')
199
+
200
+ self.freeform_tags = attributes[:'freeform_tags'] if attributes[:'freeform_tags']
201
+
202
+ self.defined_tags = attributes[:'definedTags'] if attributes[:'definedTags']
203
+
204
+ raise 'You cannot provide both :definedTags and :defined_tags' if attributes.key?(:'definedTags') && attributes.key?(:'defined_tags')
205
+
206
+ self.defined_tags = attributes[:'defined_tags'] if attributes[:'defined_tags']
207
+
208
+ self.answers = attributes[:'answers'] if attributes[:'answers']
209
+
210
+ self.rules = attributes[:'rules'] if attributes[:'rules']
211
+ end
212
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
213
+ # rubocop:enable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
214
+
215
+ # Custom attribute writer method checking allowed values (enum).
216
+ # @param [Object] template Object to be assigned
217
+ def template=(template)
218
+ # rubocop: disable Metrics/LineLength
219
+ raise "Invalid value for 'template': this must be one of the values in TEMPLATE_ENUM." if template && !TEMPLATE_ENUM.include?(template)
220
+
221
+ # rubocop: enable Metrics/LineLength
222
+ @template = template
223
+ end
224
+
225
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Metrics/LineLength, Layout/EmptyLines
226
+
227
+
228
+ # Checks equality by comparing each attribute.
229
+ # @param [Object] other the other object to be compared
230
+ def ==(other)
231
+ return true if equal?(other)
232
+
233
+ self.class == other.class &&
234
+ compartment_id == other.compartment_id &&
235
+ display_name == other.display_name &&
236
+ ttl == other.ttl &&
237
+ health_check_monitor_id == other.health_check_monitor_id &&
238
+ template == other.template &&
239
+ freeform_tags == other.freeform_tags &&
240
+ defined_tags == other.defined_tags &&
241
+ answers == other.answers &&
242
+ rules == other.rules
243
+ end
244
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Metrics/LineLength, Layout/EmptyLines
245
+
246
+ # @see the `==` method
247
+ # @param [Object] other the other object to be compared
248
+ def eql?(other)
249
+ self == other
250
+ end
251
+
252
+ # rubocop:disable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
253
+
254
+
255
+ # Calculates hash code according to all attributes.
256
+ # @return [Fixnum] Hash code
257
+ def hash
258
+ [compartment_id, display_name, ttl, health_check_monitor_id, template, freeform_tags, defined_tags, answers, rules].hash
259
+ end
260
+ # rubocop:enable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
261
+
262
+ # rubocop:disable Metrics/AbcSize, Layout/EmptyLines
263
+
264
+
265
+ # Builds the object from hash
266
+ # @param [Hash] attributes Model attributes in the form of hash
267
+ # @return [Object] Returns the model itself
268
+ def build_from_hash(attributes)
269
+ return nil unless attributes.is_a?(Hash)
270
+
271
+ self.class.swagger_types.each_pair do |key, type|
272
+ if type =~ /^Array<(.*)>/i
273
+ # check to ensure the input is an array given that the the attribute
274
+ # is documented as an array but the input is not
275
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
276
+ public_method("#{key}=").call(
277
+ attributes[self.class.attribute_map[key]]
278
+ .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
279
+ )
280
+ end
281
+ elsif !attributes[self.class.attribute_map[key]].nil?
282
+ public_method("#{key}=").call(
283
+ OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
284
+ )
285
+ end
286
+ # or else data not found in attributes(hash), not an issue as the data can be optional
287
+ end
288
+
289
+ self
290
+ end
291
+ # rubocop:enable Metrics/AbcSize, Layout/EmptyLines
292
+
293
+ # Returns the string representation of the object
294
+ # @return [String] String presentation of the object
295
+ def to_s
296
+ to_hash.to_s
297
+ end
298
+
299
+ # Returns the object in the form of hash
300
+ # @return [Hash] Returns the object in the form of hash
301
+ def to_hash
302
+ hash = {}
303
+ self.class.attribute_map.each_pair do |attr, param|
304
+ value = public_method(attr).call
305
+ next if value.nil? && !instance_variable_defined?("@#{attr}")
306
+
307
+ hash[param] = _to_hash(value)
308
+ end
309
+ hash
310
+ end
311
+
312
+ private
313
+
314
+ # Outputs non-array value in the form of hash
315
+ # For object, use to_hash. Otherwise, just return the value
316
+ # @param [Object] value Any valid value
317
+ # @return [Hash] Returns the value in the form of hash
318
+ def _to_hash(value)
319
+ if value.is_a?(Array)
320
+ value.compact.map { |v| _to_hash(v) }
321
+ elsif value.is_a?(Hash)
322
+ {}.tap do |hash|
323
+ value.each { |k, v| hash[k] = _to_hash(v) }
324
+ end
325
+ elsif value.respond_to? :to_hash
326
+ value.to_hash
327
+ else
328
+ value
329
+ end
330
+ end
331
+ end
332
+ end
333
+ # rubocop:enable Lint/UnneededCopDisableDirective
@@ -0,0 +1,418 @@
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 DNS steering policy.
9
+ #
10
+ # *Warning:* Oracle recommends that you avoid using any confidential information when you supply string values using the API.
11
+ #
12
+ class Dns::Models::SteeringPolicy # rubocop:disable Metrics/LineLength
13
+ TEMPLATE_ENUM = [
14
+ TEMPLATE_FAILOVER = 'FAILOVER'.freeze,
15
+ TEMPLATE_LOAD_BALANCE = 'LOAD_BALANCE'.freeze,
16
+ TEMPLATE_ROUTE_BY_GEO = 'ROUTE_BY_GEO'.freeze,
17
+ TEMPLATE_ROUTE_BY_ASN = 'ROUTE_BY_ASN'.freeze,
18
+ TEMPLATE_ROUTE_BY_IP = 'ROUTE_BY_IP'.freeze,
19
+ TEMPLATE_CUSTOM = 'CUSTOM'.freeze,
20
+ TEMPLATE_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
21
+ ].freeze
22
+
23
+ LIFECYCLE_STATE_ENUM = [
24
+ LIFECYCLE_STATE_ACTIVE = 'ACTIVE'.freeze,
25
+ LIFECYCLE_STATE_CREATING = 'CREATING'.freeze,
26
+ LIFECYCLE_STATE_DELETED = 'DELETED'.freeze,
27
+ LIFECYCLE_STATE_DELETING = 'DELETING'.freeze,
28
+ LIFECYCLE_STATE_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
29
+ ].freeze
30
+
31
+ # The OCID of the compartment containing the steering policy.
32
+ # @return [String]
33
+ attr_accessor :compartment_id
34
+
35
+ # A user-friendly name for the steering policy.
36
+ # Does not have to be unique, and it's changeable.
37
+ # Avoid entering confidential information.
38
+ #
39
+ # @return [String]
40
+ attr_accessor :display_name
41
+
42
+ # The Time To Live for responses from the steering policy, in seconds.
43
+ # If not specified during creation, a value of 30 seconds will be used.
44
+ #
45
+ # @return [Integer]
46
+ attr_accessor :ttl
47
+
48
+ # The OCID of the health check monitor providing health data about the answers of the
49
+ # steering policy.
50
+ # A steering policy answer with `rdata` matching a monitored endpoint will use the health
51
+ # data of that endpoint.
52
+ # A steering policy answer with `rdata` not matching any monitored endpoint will be assumed
53
+ # healthy.
54
+ #
55
+ # @return [String]
56
+ attr_accessor :health_check_monitor_id
57
+
58
+ # The common pattern (or lack thereof) to which the steering policy adheres. This
59
+ # value restricts the possible configurations of rules, but thereby supports
60
+ # specifically tailored interfaces. Values other than \"CUSTOM\" require the rules to
61
+ # begin with an unconditional FILTER that keeps answers contingent upon
62
+ # `answer.isDisabled != true`, followed
63
+ # _if and only if the policy references a health check monitor_ by an unconditional
64
+ # HEALTH rule, and require the last rule to be an unconditional LIMIT.
65
+ # What must precede the LIMIT rule is determined by the template value:
66
+ # - FAILOVER requires exactly an unconditional PRIORITY rule that ranks answers by pool.
67
+ # Each answer pool must have a unique priority value assigned to it. Answer data must
68
+ # be defined in the `defaultAnswerData` property for the rule and the `cases` property
69
+ # must not be defined.
70
+ # - LOAD_BALANCE requires exactly an unconditional WEIGHTED rule that shuffles answers
71
+ # by name. Answer data must be defined in the `defaultAnswerData` property for the
72
+ # rule and the `cases` property must not be defined.
73
+ # - ROUTE_BY_GEO requires exactly one PRIORITY rule that ranks answers by pool using the
74
+ # geographical location of the client as a condition. Within that rule you may only
75
+ # use `query.client.geoKey` in the `caseCondition` expressions for defining the cases.
76
+ # For each case in the PRIORITY rule each answer pool must have a unique priority
77
+ # value assigned to it. Answer data can only be defined within cases and
78
+ # `defaultAnswerData` cannot be used in the PRIORITY rule.
79
+ # - ROUTE_BY_ASN requires exactly one PRIORITY rule that ranks answers by pool using the
80
+ # ASN of the client as a condition. Within that rule you may only use
81
+ # `query.client.asn` in the `caseCondition` expressions for defining the cases.
82
+ # For each case in the PRIORITY rule each answer pool must have a unique priority
83
+ # value assigned to it. Answer data can only be defined within cases and
84
+ # `defaultAnswerData` cannot be used in the PRIORITY rule.
85
+ # - ROUTE_BY_IP requires exactly one PRIORITY rule that ranks answers by pool using the
86
+ # IP subnet of the client as a condition. Within that rule you may only use
87
+ # `query.client.address` in the `caseCondition` expressions for defining the cases.
88
+ # For each case in the PRIORITY rule each answer pool must have a unique priority
89
+ # value assigned to it. Answer data can only be defined within cases and
90
+ # `defaultAnswerData` cannot be used in the PRIORITY rule.
91
+ # - CUSTOM allows an arbitrary configuration of rules.
92
+ #
93
+ # For an existing steering policy, the template value may be changed to any of the
94
+ # supported options but the resulting policy must conform to the requirements for the
95
+ # new template type or else a Bad Request error will be returned.
96
+ #
97
+ # @return [String]
98
+ attr_reader :template
99
+
100
+ # Simple key-value pair that is applied without any predefined name, type, or scope.
101
+ # For more information, see [Resource Tags](https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm).
102
+ # Example: `{\"bar-key\": \"value\"}`
103
+ #
104
+ # @return [Hash<String, String>]
105
+ attr_accessor :freeform_tags
106
+
107
+ # Usage of predefined tag keys. These predefined keys are scoped to a namespace.
108
+ # Example: `{\"foo-namespace\": {\"bar-key\": \"value\"}}`
109
+ #
110
+ # @return [Hash<String, Hash<String, Object>>]
111
+ attr_accessor :defined_tags
112
+
113
+ # The set of all answers that can potentially issue from the steering policy.
114
+ #
115
+ # @return [Array<OCI::Dns::Models::SteeringPolicyAnswer>]
116
+ attr_accessor :answers
117
+
118
+ # The pipeline of rules that will be processed in sequence to reduce the pool of answers
119
+ # to a response for any given request.
120
+ #
121
+ # The first rule receives a shuffled list of all answers, and every other rule receives
122
+ # the list of answers emitted by the one preceding it. The last rule populates the
123
+ # response.
124
+ #
125
+ # @return [Array<OCI::Dns::Models::SteeringPolicyRule>]
126
+ attr_accessor :rules
127
+
128
+ # The canonical absolute URL of the resource.
129
+ # @return [String]
130
+ attr_accessor :_self
131
+
132
+ # The OCID of the resource.
133
+ # @return [String]
134
+ attr_accessor :id
135
+
136
+ # The date and time the resource was created in \"YYYY-MM-ddThh:mmZ\" format
137
+ # with a Z offset, as defined by RFC 3339.
138
+ #
139
+ # **Example:** `2016-07-22T17:23:59:60Z`
140
+ #
141
+ # @return [DateTime]
142
+ attr_accessor :time_created
143
+
144
+ # The current state of the resource.
145
+ # @return [String]
146
+ attr_reader :lifecycle_state
147
+
148
+ # Attribute mapping from ruby-style variable name to JSON key.
149
+ def self.attribute_map
150
+ {
151
+ # rubocop:disable Style/SymbolLiteral
152
+ 'compartment_id': :'compartmentId',
153
+ 'display_name': :'displayName',
154
+ 'ttl': :'ttl',
155
+ 'health_check_monitor_id': :'healthCheckMonitorId',
156
+ 'template': :'template',
157
+ 'freeform_tags': :'freeformTags',
158
+ 'defined_tags': :'definedTags',
159
+ 'answers': :'answers',
160
+ 'rules': :'rules',
161
+ '_self': :'self',
162
+ 'id': :'id',
163
+ 'time_created': :'timeCreated',
164
+ 'lifecycle_state': :'lifecycleState'
165
+ # rubocop:enable Style/SymbolLiteral
166
+ }
167
+ end
168
+
169
+ # Attribute type mapping.
170
+ def self.swagger_types
171
+ {
172
+ # rubocop:disable Style/SymbolLiteral
173
+ 'compartment_id': :'String',
174
+ 'display_name': :'String',
175
+ 'ttl': :'Integer',
176
+ 'health_check_monitor_id': :'String',
177
+ 'template': :'String',
178
+ 'freeform_tags': :'Hash<String, String>',
179
+ 'defined_tags': :'Hash<String, Hash<String, Object>>',
180
+ 'answers': :'Array<OCI::Dns::Models::SteeringPolicyAnswer>',
181
+ 'rules': :'Array<OCI::Dns::Models::SteeringPolicyRule>',
182
+ '_self': :'String',
183
+ 'id': :'String',
184
+ 'time_created': :'DateTime',
185
+ 'lifecycle_state': :'String'
186
+ # rubocop:enable Style/SymbolLiteral
187
+ }
188
+ end
189
+
190
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
191
+ # rubocop:disable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
192
+
193
+
194
+ # Initializes the object
195
+ # @param [Hash] attributes Model attributes in the form of hash
196
+ # @option attributes [String] :compartment_id The value to assign to the {#compartment_id} property
197
+ # @option attributes [String] :display_name The value to assign to the {#display_name} property
198
+ # @option attributes [Integer] :ttl The value to assign to the {#ttl} property
199
+ # @option attributes [String] :health_check_monitor_id The value to assign to the {#health_check_monitor_id} property
200
+ # @option attributes [String] :template The value to assign to the {#template} property
201
+ # @option attributes [Hash<String, String>] :freeform_tags The value to assign to the {#freeform_tags} property
202
+ # @option attributes [Hash<String, Hash<String, Object>>] :defined_tags The value to assign to the {#defined_tags} property
203
+ # @option attributes [Array<OCI::Dns::Models::SteeringPolicyAnswer>] :answers The value to assign to the {#answers} property
204
+ # @option attributes [Array<OCI::Dns::Models::SteeringPolicyRule>] :rules The value to assign to the {#rules} property
205
+ # @option attributes [String] :_self The value to assign to the {#_self} property
206
+ # @option attributes [String] :id The value to assign to the {#id} property
207
+ # @option attributes [DateTime] :time_created The value to assign to the {#time_created} property
208
+ # @option attributes [String] :lifecycle_state The value to assign to the {#lifecycle_state} property
209
+ def initialize(attributes = {})
210
+ return unless attributes.is_a?(Hash)
211
+
212
+ # convert string to symbol for hash key
213
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
214
+
215
+ self.compartment_id = attributes[:'compartmentId'] if attributes[:'compartmentId']
216
+
217
+ raise 'You cannot provide both :compartmentId and :compartment_id' if attributes.key?(:'compartmentId') && attributes.key?(:'compartment_id')
218
+
219
+ self.compartment_id = attributes[:'compartment_id'] if attributes[:'compartment_id']
220
+
221
+ self.display_name = attributes[:'displayName'] if attributes[:'displayName']
222
+
223
+ raise 'You cannot provide both :displayName and :display_name' if attributes.key?(:'displayName') && attributes.key?(:'display_name')
224
+
225
+ self.display_name = attributes[:'display_name'] if attributes[:'display_name']
226
+
227
+ self.ttl = attributes[:'ttl'] if attributes[:'ttl']
228
+
229
+ self.health_check_monitor_id = attributes[:'healthCheckMonitorId'] if attributes[:'healthCheckMonitorId']
230
+
231
+ raise 'You cannot provide both :healthCheckMonitorId and :health_check_monitor_id' if attributes.key?(:'healthCheckMonitorId') && attributes.key?(:'health_check_monitor_id')
232
+
233
+ self.health_check_monitor_id = attributes[:'health_check_monitor_id'] if attributes[:'health_check_monitor_id']
234
+
235
+ self.template = attributes[:'template'] if attributes[:'template']
236
+
237
+ self.freeform_tags = attributes[:'freeformTags'] if attributes[:'freeformTags']
238
+
239
+ raise 'You cannot provide both :freeformTags and :freeform_tags' if attributes.key?(:'freeformTags') && attributes.key?(:'freeform_tags')
240
+
241
+ self.freeform_tags = attributes[:'freeform_tags'] if attributes[:'freeform_tags']
242
+
243
+ self.defined_tags = attributes[:'definedTags'] if attributes[:'definedTags']
244
+
245
+ raise 'You cannot provide both :definedTags and :defined_tags' if attributes.key?(:'definedTags') && attributes.key?(:'defined_tags')
246
+
247
+ self.defined_tags = attributes[:'defined_tags'] if attributes[:'defined_tags']
248
+
249
+ self.answers = attributes[:'answers'] if attributes[:'answers']
250
+
251
+ self.rules = attributes[:'rules'] if attributes[:'rules']
252
+
253
+ self._self = attributes[:'self'] if attributes[:'self']
254
+
255
+ raise 'You cannot provide both :self and :_self' if attributes.key?(:'self') && attributes.key?(:'_self')
256
+
257
+ self._self = attributes[:'_self'] if attributes[:'_self']
258
+
259
+ self.id = attributes[:'id'] if attributes[:'id']
260
+
261
+ self.time_created = attributes[:'timeCreated'] if attributes[:'timeCreated']
262
+
263
+ raise 'You cannot provide both :timeCreated and :time_created' if attributes.key?(:'timeCreated') && attributes.key?(:'time_created')
264
+
265
+ self.time_created = attributes[:'time_created'] if attributes[:'time_created']
266
+
267
+ self.lifecycle_state = attributes[:'lifecycleState'] if attributes[:'lifecycleState']
268
+
269
+ raise 'You cannot provide both :lifecycleState and :lifecycle_state' if attributes.key?(:'lifecycleState') && attributes.key?(:'lifecycle_state')
270
+
271
+ self.lifecycle_state = attributes[:'lifecycle_state'] if attributes[:'lifecycle_state']
272
+ end
273
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
274
+ # rubocop:enable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
275
+
276
+ # Custom attribute writer method checking allowed values (enum).
277
+ # @param [Object] template Object to be assigned
278
+ def template=(template)
279
+ # rubocop:disable Style/ConditionalAssignment
280
+ if template && !TEMPLATE_ENUM.include?(template)
281
+ # rubocop: disable Metrics/LineLength
282
+ OCI.logger.debug("Unknown value for 'template' [" + template + "]. Mapping to 'TEMPLATE_UNKNOWN_ENUM_VALUE'") if OCI.logger
283
+ # rubocop: enable Metrics/LineLength
284
+ @template = TEMPLATE_UNKNOWN_ENUM_VALUE
285
+ else
286
+ @template = template
287
+ end
288
+ # rubocop:enable Style/ConditionalAssignment
289
+ end
290
+
291
+ # Custom attribute writer method checking allowed values (enum).
292
+ # @param [Object] lifecycle_state Object to be assigned
293
+ def lifecycle_state=(lifecycle_state)
294
+ # rubocop:disable Style/ConditionalAssignment
295
+ if lifecycle_state && !LIFECYCLE_STATE_ENUM.include?(lifecycle_state)
296
+ # rubocop: disable Metrics/LineLength
297
+ OCI.logger.debug("Unknown value for 'lifecycle_state' [" + lifecycle_state + "]. Mapping to 'LIFECYCLE_STATE_UNKNOWN_ENUM_VALUE'") if OCI.logger
298
+ # rubocop: enable Metrics/LineLength
299
+ @lifecycle_state = LIFECYCLE_STATE_UNKNOWN_ENUM_VALUE
300
+ else
301
+ @lifecycle_state = lifecycle_state
302
+ end
303
+ # rubocop:enable Style/ConditionalAssignment
304
+ end
305
+
306
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Metrics/LineLength, Layout/EmptyLines
307
+
308
+
309
+ # Checks equality by comparing each attribute.
310
+ # @param [Object] other the other object to be compared
311
+ def ==(other)
312
+ return true if equal?(other)
313
+
314
+ self.class == other.class &&
315
+ compartment_id == other.compartment_id &&
316
+ display_name == other.display_name &&
317
+ ttl == other.ttl &&
318
+ health_check_monitor_id == other.health_check_monitor_id &&
319
+ template == other.template &&
320
+ freeform_tags == other.freeform_tags &&
321
+ defined_tags == other.defined_tags &&
322
+ answers == other.answers &&
323
+ rules == other.rules &&
324
+ _self == other._self &&
325
+ id == other.id &&
326
+ time_created == other.time_created &&
327
+ lifecycle_state == other.lifecycle_state
328
+ end
329
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Metrics/LineLength, Layout/EmptyLines
330
+
331
+ # @see the `==` method
332
+ # @param [Object] other the other object to be compared
333
+ def eql?(other)
334
+ self == other
335
+ end
336
+
337
+ # rubocop:disable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
338
+
339
+
340
+ # Calculates hash code according to all attributes.
341
+ # @return [Fixnum] Hash code
342
+ def hash
343
+ [compartment_id, display_name, ttl, health_check_monitor_id, template, freeform_tags, defined_tags, answers, rules, _self, id, time_created, lifecycle_state].hash
344
+ end
345
+ # rubocop:enable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
346
+
347
+ # rubocop:disable Metrics/AbcSize, Layout/EmptyLines
348
+
349
+
350
+ # Builds the object from hash
351
+ # @param [Hash] attributes Model attributes in the form of hash
352
+ # @return [Object] Returns the model itself
353
+ def build_from_hash(attributes)
354
+ return nil unless attributes.is_a?(Hash)
355
+
356
+ self.class.swagger_types.each_pair do |key, type|
357
+ if type =~ /^Array<(.*)>/i
358
+ # check to ensure the input is an array given that the the attribute
359
+ # is documented as an array but the input is not
360
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
361
+ public_method("#{key}=").call(
362
+ attributes[self.class.attribute_map[key]]
363
+ .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
364
+ )
365
+ end
366
+ elsif !attributes[self.class.attribute_map[key]].nil?
367
+ public_method("#{key}=").call(
368
+ OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
369
+ )
370
+ end
371
+ # or else data not found in attributes(hash), not an issue as the data can be optional
372
+ end
373
+
374
+ self
375
+ end
376
+ # rubocop:enable Metrics/AbcSize, Layout/EmptyLines
377
+
378
+ # Returns the string representation of the object
379
+ # @return [String] String presentation of the object
380
+ def to_s
381
+ to_hash.to_s
382
+ end
383
+
384
+ # Returns the object in the form of hash
385
+ # @return [Hash] Returns the object in the form of hash
386
+ def to_hash
387
+ hash = {}
388
+ self.class.attribute_map.each_pair do |attr, param|
389
+ value = public_method(attr).call
390
+ next if value.nil? && !instance_variable_defined?("@#{attr}")
391
+
392
+ hash[param] = _to_hash(value)
393
+ end
394
+ hash
395
+ end
396
+
397
+ private
398
+
399
+ # Outputs non-array value in the form of hash
400
+ # For object, use to_hash. Otherwise, just return the value
401
+ # @param [Object] value Any valid value
402
+ # @return [Hash] Returns the value in the form of hash
403
+ def _to_hash(value)
404
+ if value.is_a?(Array)
405
+ value.compact.map { |v| _to_hash(v) }
406
+ elsif value.is_a?(Hash)
407
+ {}.tap do |hash|
408
+ value.each { |k, v| hash[k] = _to_hash(v) }
409
+ end
410
+ elsif value.respond_to? :to_hash
411
+ value.to_hash
412
+ else
413
+ value
414
+ end
415
+ end
416
+ end
417
+ end
418
+ # rubocop:enable Lint/UnneededCopDisableDirective