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,282 @@
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
+ # The human interaction challenge settings. The human interaction challenge checks various event listeners in the user's browser to determine if there is a human user making a request.
9
+ class Waas::Models::HumanInteractionChallenge # rubocop:disable Metrics/LineLength
10
+ ACTION_ENUM = [
11
+ ACTION_DETECT = 'DETECT'.freeze,
12
+ ACTION_BLOCK = 'BLOCK'.freeze,
13
+ ACTION_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
14
+ ].freeze
15
+
16
+ # **[Required]** Enables or disables the human interaction challenge Web Application Firewall feature.
17
+ # @return [BOOLEAN]
18
+ attr_accessor :is_enabled
19
+
20
+ # The action to take against requests from detected bots. If unspecified, defaults to `DETECT`.
21
+ # @return [String]
22
+ attr_reader :action
23
+
24
+ # The number of failed requests before taking action. If unspecified, defaults to `10`.
25
+ # @return [Integer]
26
+ attr_accessor :failure_threshold
27
+
28
+ # The number of seconds between challenges for the same IP address. If unspecified, defaults to `60`.
29
+ # @return [Integer]
30
+ attr_accessor :action_expiration_in_seconds
31
+
32
+ # The number of seconds before the failure threshold resets. If unspecified, defaults to `60`.
33
+ # @return [Integer]
34
+ attr_accessor :failure_threshold_expiration_in_seconds
35
+
36
+ # The number of interactions required to pass the challenge. If unspecified, defaults to `3`.
37
+ # @return [Integer]
38
+ attr_accessor :interaction_threshold
39
+
40
+ # The number of seconds to record the interactions from the user. If unspecified, defaults to `15`.
41
+ # @return [Integer]
42
+ attr_accessor :recording_period_in_seconds
43
+
44
+ # Adds an additional HTTP header to requests that fail the challenge before being passed to the origin. Only applicable when the `action` is set to `DETECT`.
45
+ # @return [OCI::Waas::Models::Header]
46
+ attr_accessor :set_http_header
47
+
48
+ # @return [OCI::Waas::Models::BlockChallengeSettings]
49
+ attr_accessor :challenge_settings
50
+
51
+ # Attribute mapping from ruby-style variable name to JSON key.
52
+ def self.attribute_map
53
+ {
54
+ # rubocop:disable Style/SymbolLiteral
55
+ 'is_enabled': :'isEnabled',
56
+ 'action': :'action',
57
+ 'failure_threshold': :'failureThreshold',
58
+ 'action_expiration_in_seconds': :'actionExpirationInSeconds',
59
+ 'failure_threshold_expiration_in_seconds': :'failureThresholdExpirationInSeconds',
60
+ 'interaction_threshold': :'interactionThreshold',
61
+ 'recording_period_in_seconds': :'recordingPeriodInSeconds',
62
+ 'set_http_header': :'setHttpHeader',
63
+ 'challenge_settings': :'challengeSettings'
64
+ # rubocop:enable Style/SymbolLiteral
65
+ }
66
+ end
67
+
68
+ # Attribute type mapping.
69
+ def self.swagger_types
70
+ {
71
+ # rubocop:disable Style/SymbolLiteral
72
+ 'is_enabled': :'BOOLEAN',
73
+ 'action': :'String',
74
+ 'failure_threshold': :'Integer',
75
+ 'action_expiration_in_seconds': :'Integer',
76
+ 'failure_threshold_expiration_in_seconds': :'Integer',
77
+ 'interaction_threshold': :'Integer',
78
+ 'recording_period_in_seconds': :'Integer',
79
+ 'set_http_header': :'OCI::Waas::Models::Header',
80
+ 'challenge_settings': :'OCI::Waas::Models::BlockChallengeSettings'
81
+ # rubocop:enable Style/SymbolLiteral
82
+ }
83
+ end
84
+
85
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
86
+ # rubocop:disable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
87
+
88
+
89
+ # Initializes the object
90
+ # @param [Hash] attributes Model attributes in the form of hash
91
+ # @option attributes [BOOLEAN] :is_enabled The value to assign to the {#is_enabled} property
92
+ # @option attributes [String] :action The value to assign to the {#action} property
93
+ # @option attributes [Integer] :failure_threshold The value to assign to the {#failure_threshold} property
94
+ # @option attributes [Integer] :action_expiration_in_seconds The value to assign to the {#action_expiration_in_seconds} property
95
+ # @option attributes [Integer] :failure_threshold_expiration_in_seconds The value to assign to the {#failure_threshold_expiration_in_seconds} property
96
+ # @option attributes [Integer] :interaction_threshold The value to assign to the {#interaction_threshold} property
97
+ # @option attributes [Integer] :recording_period_in_seconds The value to assign to the {#recording_period_in_seconds} property
98
+ # @option attributes [OCI::Waas::Models::Header] :set_http_header The value to assign to the {#set_http_header} property
99
+ # @option attributes [OCI::Waas::Models::BlockChallengeSettings] :challenge_settings The value to assign to the {#challenge_settings} property
100
+ def initialize(attributes = {})
101
+ return unless attributes.is_a?(Hash)
102
+
103
+ # convert string to symbol for hash key
104
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
105
+
106
+ self.is_enabled = attributes[:'isEnabled'] unless attributes[:'isEnabled'].nil?
107
+
108
+ raise 'You cannot provide both :isEnabled and :is_enabled' if attributes.key?(:'isEnabled') && attributes.key?(:'is_enabled')
109
+
110
+ self.is_enabled = attributes[:'is_enabled'] unless attributes[:'is_enabled'].nil?
111
+
112
+ self.action = attributes[:'action'] if attributes[:'action']
113
+
114
+ self.failure_threshold = attributes[:'failureThreshold'] if attributes[:'failureThreshold']
115
+
116
+ raise 'You cannot provide both :failureThreshold and :failure_threshold' if attributes.key?(:'failureThreshold') && attributes.key?(:'failure_threshold')
117
+
118
+ self.failure_threshold = attributes[:'failure_threshold'] if attributes[:'failure_threshold']
119
+
120
+ self.action_expiration_in_seconds = attributes[:'actionExpirationInSeconds'] if attributes[:'actionExpirationInSeconds']
121
+
122
+ raise 'You cannot provide both :actionExpirationInSeconds and :action_expiration_in_seconds' if attributes.key?(:'actionExpirationInSeconds') && attributes.key?(:'action_expiration_in_seconds')
123
+
124
+ self.action_expiration_in_seconds = attributes[:'action_expiration_in_seconds'] if attributes[:'action_expiration_in_seconds']
125
+
126
+ self.failure_threshold_expiration_in_seconds = attributes[:'failureThresholdExpirationInSeconds'] if attributes[:'failureThresholdExpirationInSeconds']
127
+
128
+ raise 'You cannot provide both :failureThresholdExpirationInSeconds and :failure_threshold_expiration_in_seconds' if attributes.key?(:'failureThresholdExpirationInSeconds') && attributes.key?(:'failure_threshold_expiration_in_seconds')
129
+
130
+ self.failure_threshold_expiration_in_seconds = attributes[:'failure_threshold_expiration_in_seconds'] if attributes[:'failure_threshold_expiration_in_seconds']
131
+
132
+ self.interaction_threshold = attributes[:'interactionThreshold'] if attributes[:'interactionThreshold']
133
+
134
+ raise 'You cannot provide both :interactionThreshold and :interaction_threshold' if attributes.key?(:'interactionThreshold') && attributes.key?(:'interaction_threshold')
135
+
136
+ self.interaction_threshold = attributes[:'interaction_threshold'] if attributes[:'interaction_threshold']
137
+
138
+ self.recording_period_in_seconds = attributes[:'recordingPeriodInSeconds'] if attributes[:'recordingPeriodInSeconds']
139
+
140
+ raise 'You cannot provide both :recordingPeriodInSeconds and :recording_period_in_seconds' if attributes.key?(:'recordingPeriodInSeconds') && attributes.key?(:'recording_period_in_seconds')
141
+
142
+ self.recording_period_in_seconds = attributes[:'recording_period_in_seconds'] if attributes[:'recording_period_in_seconds']
143
+
144
+ self.set_http_header = attributes[:'setHttpHeader'] if attributes[:'setHttpHeader']
145
+
146
+ raise 'You cannot provide both :setHttpHeader and :set_http_header' if attributes.key?(:'setHttpHeader') && attributes.key?(:'set_http_header')
147
+
148
+ self.set_http_header = attributes[:'set_http_header'] if attributes[:'set_http_header']
149
+
150
+ self.challenge_settings = attributes[:'challengeSettings'] if attributes[:'challengeSettings']
151
+
152
+ raise 'You cannot provide both :challengeSettings and :challenge_settings' if attributes.key?(:'challengeSettings') && attributes.key?(:'challenge_settings')
153
+
154
+ self.challenge_settings = attributes[:'challenge_settings'] if attributes[:'challenge_settings']
155
+ end
156
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
157
+ # rubocop:enable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
158
+
159
+ # Custom attribute writer method checking allowed values (enum).
160
+ # @param [Object] action Object to be assigned
161
+ def action=(action)
162
+ # rubocop:disable Style/ConditionalAssignment
163
+ if action && !ACTION_ENUM.include?(action)
164
+ # rubocop: disable Metrics/LineLength
165
+ OCI.logger.debug("Unknown value for 'action' [" + action + "]. Mapping to 'ACTION_UNKNOWN_ENUM_VALUE'") if OCI.logger
166
+ # rubocop: enable Metrics/LineLength
167
+ @action = ACTION_UNKNOWN_ENUM_VALUE
168
+ else
169
+ @action = action
170
+ end
171
+ # rubocop:enable Style/ConditionalAssignment
172
+ end
173
+
174
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Metrics/LineLength, Layout/EmptyLines
175
+
176
+
177
+ # Checks equality by comparing each attribute.
178
+ # @param [Object] other the other object to be compared
179
+ def ==(other)
180
+ return true if equal?(other)
181
+
182
+ self.class == other.class &&
183
+ is_enabled == other.is_enabled &&
184
+ action == other.action &&
185
+ failure_threshold == other.failure_threshold &&
186
+ action_expiration_in_seconds == other.action_expiration_in_seconds &&
187
+ failure_threshold_expiration_in_seconds == other.failure_threshold_expiration_in_seconds &&
188
+ interaction_threshold == other.interaction_threshold &&
189
+ recording_period_in_seconds == other.recording_period_in_seconds &&
190
+ set_http_header == other.set_http_header &&
191
+ challenge_settings == other.challenge_settings
192
+ end
193
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Metrics/LineLength, Layout/EmptyLines
194
+
195
+ # @see the `==` method
196
+ # @param [Object] other the other object to be compared
197
+ def eql?(other)
198
+ self == other
199
+ end
200
+
201
+ # rubocop:disable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
202
+
203
+
204
+ # Calculates hash code according to all attributes.
205
+ # @return [Fixnum] Hash code
206
+ def hash
207
+ [is_enabled, action, failure_threshold, action_expiration_in_seconds, failure_threshold_expiration_in_seconds, interaction_threshold, recording_period_in_seconds, set_http_header, challenge_settings].hash
208
+ end
209
+ # rubocop:enable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
210
+
211
+ # rubocop:disable Metrics/AbcSize, Layout/EmptyLines
212
+
213
+
214
+ # Builds the object from hash
215
+ # @param [Hash] attributes Model attributes in the form of hash
216
+ # @return [Object] Returns the model itself
217
+ def build_from_hash(attributes)
218
+ return nil unless attributes.is_a?(Hash)
219
+
220
+ self.class.swagger_types.each_pair do |key, type|
221
+ if type =~ /^Array<(.*)>/i
222
+ # check to ensure the input is an array given that the the attribute
223
+ # is documented as an array but the input is not
224
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
225
+ public_method("#{key}=").call(
226
+ attributes[self.class.attribute_map[key]]
227
+ .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
228
+ )
229
+ end
230
+ elsif !attributes[self.class.attribute_map[key]].nil?
231
+ public_method("#{key}=").call(
232
+ OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
233
+ )
234
+ end
235
+ # or else data not found in attributes(hash), not an issue as the data can be optional
236
+ end
237
+
238
+ self
239
+ end
240
+ # rubocop:enable Metrics/AbcSize, Layout/EmptyLines
241
+
242
+ # Returns the string representation of the object
243
+ # @return [String] String presentation of the object
244
+ def to_s
245
+ to_hash.to_s
246
+ end
247
+
248
+ # Returns the object in the form of hash
249
+ # @return [Hash] Returns the object in the form of hash
250
+ def to_hash
251
+ hash = {}
252
+ self.class.attribute_map.each_pair do |attr, param|
253
+ value = public_method(attr).call
254
+ next if value.nil? && !instance_variable_defined?("@#{attr}")
255
+
256
+ hash[param] = _to_hash(value)
257
+ end
258
+ hash
259
+ end
260
+
261
+ private
262
+
263
+ # Outputs non-array value in the form of hash
264
+ # For object, use to_hash. Otherwise, just return the value
265
+ # @param [Object] value Any valid value
266
+ # @return [Hash] Returns the value in the form of hash
267
+ def _to_hash(value)
268
+ if value.is_a?(Array)
269
+ value.compact.map { |v| _to_hash(v) }
270
+ elsif value.is_a?(Hash)
271
+ {}.tap do |hash|
272
+ value.each { |k, v| hash[k] = _to_hash(v) }
273
+ end
274
+ elsif value.respond_to? :to_hash
275
+ value.to_hash
276
+ else
277
+ value
278
+ end
279
+ end
280
+ end
281
+ end
282
+ # rubocop:enable Lint/UnneededCopDisableDirective
@@ -0,0 +1,240 @@
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
+ # The JavaScript challenge settings. Javascript Challenge is the function to filter abnormal or malicious bots and allow access to real clients.
9
+ class Waas::Models::JsChallenge # rubocop:disable Metrics/LineLength
10
+ ACTION_ENUM = [
11
+ ACTION_DETECT = 'DETECT'.freeze,
12
+ ACTION_BLOCK = 'BLOCK'.freeze,
13
+ ACTION_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
14
+ ].freeze
15
+
16
+ # **[Required]** Enables or disables the JavaScript challenge Web Application Firewall feature.
17
+ # @return [BOOLEAN]
18
+ attr_accessor :is_enabled
19
+
20
+ # The action to take against requests from detected bots. If unspecified, defaults to `DETECT`.
21
+ # @return [String]
22
+ attr_reader :action
23
+
24
+ # The number of failed requests before taking action. If unspecified, defaults to `10`.
25
+ # @return [Integer]
26
+ attr_accessor :failure_threshold
27
+
28
+ # The number of seconds between challenges from the same IP address. If unspecified, defaults to `60`.
29
+ # @return [Integer]
30
+ attr_accessor :action_expiration_in_seconds
31
+
32
+ # Adds an additional HTTP header to requests that fail the challenge before being passed to the origin. Only applicable when the `action` is set to `DETECT`.
33
+ # @return [OCI::Waas::Models::Header]
34
+ attr_accessor :set_http_header
35
+
36
+ # @return [OCI::Waas::Models::BlockChallengeSettings]
37
+ attr_accessor :challenge_settings
38
+
39
+ # Attribute mapping from ruby-style variable name to JSON key.
40
+ def self.attribute_map
41
+ {
42
+ # rubocop:disable Style/SymbolLiteral
43
+ 'is_enabled': :'isEnabled',
44
+ 'action': :'action',
45
+ 'failure_threshold': :'failureThreshold',
46
+ 'action_expiration_in_seconds': :'actionExpirationInSeconds',
47
+ 'set_http_header': :'setHttpHeader',
48
+ 'challenge_settings': :'challengeSettings'
49
+ # rubocop:enable Style/SymbolLiteral
50
+ }
51
+ end
52
+
53
+ # Attribute type mapping.
54
+ def self.swagger_types
55
+ {
56
+ # rubocop:disable Style/SymbolLiteral
57
+ 'is_enabled': :'BOOLEAN',
58
+ 'action': :'String',
59
+ 'failure_threshold': :'Integer',
60
+ 'action_expiration_in_seconds': :'Integer',
61
+ 'set_http_header': :'OCI::Waas::Models::Header',
62
+ 'challenge_settings': :'OCI::Waas::Models::BlockChallengeSettings'
63
+ # rubocop:enable Style/SymbolLiteral
64
+ }
65
+ end
66
+
67
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
68
+ # rubocop:disable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
69
+
70
+
71
+ # Initializes the object
72
+ # @param [Hash] attributes Model attributes in the form of hash
73
+ # @option attributes [BOOLEAN] :is_enabled The value to assign to the {#is_enabled} property
74
+ # @option attributes [String] :action The value to assign to the {#action} property
75
+ # @option attributes [Integer] :failure_threshold The value to assign to the {#failure_threshold} property
76
+ # @option attributes [Integer] :action_expiration_in_seconds The value to assign to the {#action_expiration_in_seconds} property
77
+ # @option attributes [OCI::Waas::Models::Header] :set_http_header The value to assign to the {#set_http_header} property
78
+ # @option attributes [OCI::Waas::Models::BlockChallengeSettings] :challenge_settings The value to assign to the {#challenge_settings} property
79
+ def initialize(attributes = {})
80
+ return unless attributes.is_a?(Hash)
81
+
82
+ # convert string to symbol for hash key
83
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
84
+
85
+ self.is_enabled = attributes[:'isEnabled'] unless attributes[:'isEnabled'].nil?
86
+
87
+ raise 'You cannot provide both :isEnabled and :is_enabled' if attributes.key?(:'isEnabled') && attributes.key?(:'is_enabled')
88
+
89
+ self.is_enabled = attributes[:'is_enabled'] unless attributes[:'is_enabled'].nil?
90
+
91
+ self.action = attributes[:'action'] if attributes[:'action']
92
+
93
+ self.failure_threshold = attributes[:'failureThreshold'] if attributes[:'failureThreshold']
94
+
95
+ raise 'You cannot provide both :failureThreshold and :failure_threshold' if attributes.key?(:'failureThreshold') && attributes.key?(:'failure_threshold')
96
+
97
+ self.failure_threshold = attributes[:'failure_threshold'] if attributes[:'failure_threshold']
98
+
99
+ self.action_expiration_in_seconds = attributes[:'actionExpirationInSeconds'] if attributes[:'actionExpirationInSeconds']
100
+
101
+ raise 'You cannot provide both :actionExpirationInSeconds and :action_expiration_in_seconds' if attributes.key?(:'actionExpirationInSeconds') && attributes.key?(:'action_expiration_in_seconds')
102
+
103
+ self.action_expiration_in_seconds = attributes[:'action_expiration_in_seconds'] if attributes[:'action_expiration_in_seconds']
104
+
105
+ self.set_http_header = attributes[:'setHttpHeader'] if attributes[:'setHttpHeader']
106
+
107
+ raise 'You cannot provide both :setHttpHeader and :set_http_header' if attributes.key?(:'setHttpHeader') && attributes.key?(:'set_http_header')
108
+
109
+ self.set_http_header = attributes[:'set_http_header'] if attributes[:'set_http_header']
110
+
111
+ self.challenge_settings = attributes[:'challengeSettings'] if attributes[:'challengeSettings']
112
+
113
+ raise 'You cannot provide both :challengeSettings and :challenge_settings' if attributes.key?(:'challengeSettings') && attributes.key?(:'challenge_settings')
114
+
115
+ self.challenge_settings = attributes[:'challenge_settings'] if attributes[:'challenge_settings']
116
+ end
117
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
118
+ # rubocop:enable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
119
+
120
+ # Custom attribute writer method checking allowed values (enum).
121
+ # @param [Object] action Object to be assigned
122
+ def action=(action)
123
+ # rubocop:disable Style/ConditionalAssignment
124
+ if action && !ACTION_ENUM.include?(action)
125
+ # rubocop: disable Metrics/LineLength
126
+ OCI.logger.debug("Unknown value for 'action' [" + action + "]. Mapping to 'ACTION_UNKNOWN_ENUM_VALUE'") if OCI.logger
127
+ # rubocop: enable Metrics/LineLength
128
+ @action = ACTION_UNKNOWN_ENUM_VALUE
129
+ else
130
+ @action = action
131
+ end
132
+ # rubocop:enable Style/ConditionalAssignment
133
+ end
134
+
135
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Metrics/LineLength, Layout/EmptyLines
136
+
137
+
138
+ # Checks equality by comparing each attribute.
139
+ # @param [Object] other the other object to be compared
140
+ def ==(other)
141
+ return true if equal?(other)
142
+
143
+ self.class == other.class &&
144
+ is_enabled == other.is_enabled &&
145
+ action == other.action &&
146
+ failure_threshold == other.failure_threshold &&
147
+ action_expiration_in_seconds == other.action_expiration_in_seconds &&
148
+ set_http_header == other.set_http_header &&
149
+ challenge_settings == other.challenge_settings
150
+ end
151
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Metrics/LineLength, Layout/EmptyLines
152
+
153
+ # @see the `==` method
154
+ # @param [Object] other the other object to be compared
155
+ def eql?(other)
156
+ self == other
157
+ end
158
+
159
+ # rubocop:disable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
160
+
161
+
162
+ # Calculates hash code according to all attributes.
163
+ # @return [Fixnum] Hash code
164
+ def hash
165
+ [is_enabled, action, failure_threshold, action_expiration_in_seconds, set_http_header, challenge_settings].hash
166
+ end
167
+ # rubocop:enable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
168
+
169
+ # rubocop:disable Metrics/AbcSize, Layout/EmptyLines
170
+
171
+
172
+ # Builds the object from hash
173
+ # @param [Hash] attributes Model attributes in the form of hash
174
+ # @return [Object] Returns the model itself
175
+ def build_from_hash(attributes)
176
+ return nil unless attributes.is_a?(Hash)
177
+
178
+ self.class.swagger_types.each_pair do |key, type|
179
+ if type =~ /^Array<(.*)>/i
180
+ # check to ensure the input is an array given that the the attribute
181
+ # is documented as an array but the input is not
182
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
183
+ public_method("#{key}=").call(
184
+ attributes[self.class.attribute_map[key]]
185
+ .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
186
+ )
187
+ end
188
+ elsif !attributes[self.class.attribute_map[key]].nil?
189
+ public_method("#{key}=").call(
190
+ OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
191
+ )
192
+ end
193
+ # or else data not found in attributes(hash), not an issue as the data can be optional
194
+ end
195
+
196
+ self
197
+ end
198
+ # rubocop:enable Metrics/AbcSize, Layout/EmptyLines
199
+
200
+ # Returns the string representation of the object
201
+ # @return [String] String presentation of the object
202
+ def to_s
203
+ to_hash.to_s
204
+ end
205
+
206
+ # Returns the object in the form of hash
207
+ # @return [Hash] Returns the object in the form of hash
208
+ def to_hash
209
+ hash = {}
210
+ self.class.attribute_map.each_pair do |attr, param|
211
+ value = public_method(attr).call
212
+ next if value.nil? && !instance_variable_defined?("@#{attr}")
213
+
214
+ hash[param] = _to_hash(value)
215
+ end
216
+ hash
217
+ end
218
+
219
+ private
220
+
221
+ # Outputs non-array value in the form of hash
222
+ # For object, use to_hash. Otherwise, just return the value
223
+ # @param [Object] value Any valid value
224
+ # @return [Hash] Returns the value in the form of hash
225
+ def _to_hash(value)
226
+ if value.is_a?(Array)
227
+ value.compact.map { |v| _to_hash(v) }
228
+ elsif value.is_a?(Hash)
229
+ {}.tap do |hash|
230
+ value.each { |k, v| hash[k] = _to_hash(v) }
231
+ end
232
+ elsif value.respond_to? :to_hash
233
+ value.to_hash
234
+ else
235
+ value
236
+ end
237
+ end
238
+ end
239
+ end
240
+ # rubocop:enable Lint/UnneededCopDisableDirective