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,206 @@
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
+ # AccessRuleCriteria model.
9
+ class Waas::Models::AccessRuleCriteria # rubocop:disable Metrics/LineLength
10
+ CONDITION_ENUM = [
11
+ CONDITION_URL_IS = 'URL_IS'.freeze,
12
+ CONDITION_URL_IS_NOT = 'URL_IS_NOT'.freeze,
13
+ CONDITION_URL_STARTS_WITH = 'URL_STARTS_WITH'.freeze,
14
+ CONDITION_URL_PART_ENDS_WITH = 'URL_PART_ENDS_WITH'.freeze,
15
+ CONDITION_URL_PART_CONTAINS = 'URL_PART_CONTAINS'.freeze,
16
+ CONDITION_URL_REGEX = 'URL_REGEX'.freeze,
17
+ CONDITION_IP_IS = 'IP_IS'.freeze,
18
+ CONDITION_IP_IS_NOT = 'IP_IS_NOT'.freeze,
19
+ CONDITION_HTTP_HEADER_CONTAINS = 'HTTP_HEADER_CONTAINS'.freeze,
20
+ CONDITION_COUNTRY_IS = 'COUNTRY_IS'.freeze,
21
+ CONDITION_COUNTRY_IS_NOT = 'COUNTRY_IS_NOT'.freeze,
22
+ CONDITION_USER_AGENT_IS = 'USER_AGENT_IS'.freeze,
23
+ CONDITION_USER_AGENT_IS_NOT = 'USER_AGENT_IS_NOT'.freeze,
24
+ CONDITION_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
25
+ ].freeze
26
+
27
+ # **[Required]** The criteria the access rule uses to determine if action should be taken on a request.
28
+ #
29
+ # - **URL_IS:** Matches if the concatenation of request URL path and query is identical to the contents of the `value` field.
30
+ # - **URL_IS_NOT:** Matches if the concatenation of request URL path and query is not identical to the contents of the `value` field.
31
+ # - **URL_STARTS_WITH:** Matches if the concatenation of request URL path and query starts with the contents of the `value` field.
32
+ # - **URL_PART_ENDS_WITH:** Matches if the concatenation of request URL path and query ends with the contents of the `value` field.
33
+ # - **URL_PART_CONTAINS:** Matches if the concatenation of request URL path and query contains the contents of the `value` field.
34
+ # - **URL_REGEX:** Matches if the request is described by the regular expression in the `value` field.
35
+ # - **IP_IS:** Matches if the request originates from an IP address in the `value` field.
36
+ # - **IP_IS_NOT:** Matches if the request does not originate from an IP address in the `value` field.
37
+ # - **HTTP_HEADER_CONTAINS:** Matches if the request includes an HTTP header field whose name and value correspond to data specified in the `value` field with a separating colon. **Example:** `host:test.example.com` where `host` is the name of the field and `test.example.com` is the value of the host field. Comparison is independently applied to every header field whose name is a case insensitive match, and the value is required to be case-sensitive identical.
38
+ # - **COUNTRY_IS:** Matches if the request originates from a country in the `value` field. Country codes are in ISO 3166-1 alpha-2 format. For a list of codes, see [ISO's website](https://www.iso.org/obp/ui/#search/code/).
39
+ # - **COUNTRY_IS_NOT:** Matches if the request does not originate from a country in the `value` field. Country codes are in ISO 3166-1 alpha-2 format. For a list of codes, see [ISO's website](https://www.iso.org/obp/ui/#search/code/).
40
+ # - **USER_AGENT_IS:** Matches if the requesting user agent is identical to the contents of the `value` field. Example: `Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:35.0) Gecko/20100101 Firefox/35.0`
41
+ # - **USER_AGENT_IS_NOT:** Matches if the requesting user agent is not identical to the contents of the `value` field. Example: `Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:35.0) Gecko/20100101 Firefox/35.0`
42
+ # @return [String]
43
+ attr_reader :condition
44
+
45
+ # **[Required]** The criteria value.
46
+ # @return [String]
47
+ attr_accessor :value
48
+
49
+ # Attribute mapping from ruby-style variable name to JSON key.
50
+ def self.attribute_map
51
+ {
52
+ # rubocop:disable Style/SymbolLiteral
53
+ 'condition': :'condition',
54
+ 'value': :'value'
55
+ # rubocop:enable Style/SymbolLiteral
56
+ }
57
+ end
58
+
59
+ # Attribute type mapping.
60
+ def self.swagger_types
61
+ {
62
+ # rubocop:disable Style/SymbolLiteral
63
+ 'condition': :'String',
64
+ 'value': :'String'
65
+ # rubocop:enable Style/SymbolLiteral
66
+ }
67
+ end
68
+
69
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
70
+ # rubocop:disable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
71
+
72
+
73
+ # Initializes the object
74
+ # @param [Hash] attributes Model attributes in the form of hash
75
+ # @option attributes [String] :condition The value to assign to the {#condition} property
76
+ # @option attributes [String] :value The value to assign to the {#value} property
77
+ def initialize(attributes = {})
78
+ return unless attributes.is_a?(Hash)
79
+
80
+ # convert string to symbol for hash key
81
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
82
+
83
+ self.condition = attributes[:'condition'] if attributes[:'condition']
84
+
85
+ self.value = attributes[:'value'] if attributes[:'value']
86
+ end
87
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
88
+ # rubocop:enable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
89
+
90
+ # Custom attribute writer method checking allowed values (enum).
91
+ # @param [Object] condition Object to be assigned
92
+ def condition=(condition)
93
+ # rubocop:disable Style/ConditionalAssignment
94
+ if condition && !CONDITION_ENUM.include?(condition)
95
+ # rubocop: disable Metrics/LineLength
96
+ OCI.logger.debug("Unknown value for 'condition' [" + condition + "]. Mapping to 'CONDITION_UNKNOWN_ENUM_VALUE'") if OCI.logger
97
+ # rubocop: enable Metrics/LineLength
98
+ @condition = CONDITION_UNKNOWN_ENUM_VALUE
99
+ else
100
+ @condition = condition
101
+ end
102
+ # rubocop:enable Style/ConditionalAssignment
103
+ end
104
+
105
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Metrics/LineLength, Layout/EmptyLines
106
+
107
+
108
+ # Checks equality by comparing each attribute.
109
+ # @param [Object] other the other object to be compared
110
+ def ==(other)
111
+ return true if equal?(other)
112
+
113
+ self.class == other.class &&
114
+ condition == other.condition &&
115
+ value == other.value
116
+ end
117
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Metrics/LineLength, Layout/EmptyLines
118
+
119
+ # @see the `==` method
120
+ # @param [Object] other the other object to be compared
121
+ def eql?(other)
122
+ self == other
123
+ end
124
+
125
+ # rubocop:disable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
126
+
127
+
128
+ # Calculates hash code according to all attributes.
129
+ # @return [Fixnum] Hash code
130
+ def hash
131
+ [condition, value].hash
132
+ end
133
+ # rubocop:enable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
134
+
135
+ # rubocop:disable Metrics/AbcSize, Layout/EmptyLines
136
+
137
+
138
+ # Builds the object from hash
139
+ # @param [Hash] attributes Model attributes in the form of hash
140
+ # @return [Object] Returns the model itself
141
+ def build_from_hash(attributes)
142
+ return nil unless attributes.is_a?(Hash)
143
+
144
+ self.class.swagger_types.each_pair do |key, type|
145
+ if type =~ /^Array<(.*)>/i
146
+ # check to ensure the input is an array given that the the attribute
147
+ # is documented as an array but the input is not
148
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
149
+ public_method("#{key}=").call(
150
+ attributes[self.class.attribute_map[key]]
151
+ .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
152
+ )
153
+ end
154
+ elsif !attributes[self.class.attribute_map[key]].nil?
155
+ public_method("#{key}=").call(
156
+ OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
157
+ )
158
+ end
159
+ # or else data not found in attributes(hash), not an issue as the data can be optional
160
+ end
161
+
162
+ self
163
+ end
164
+ # rubocop:enable Metrics/AbcSize, Layout/EmptyLines
165
+
166
+ # Returns the string representation of the object
167
+ # @return [String] String presentation of the object
168
+ def to_s
169
+ to_hash.to_s
170
+ end
171
+
172
+ # Returns the object in the form of hash
173
+ # @return [Hash] Returns the object in the form of hash
174
+ def to_hash
175
+ hash = {}
176
+ self.class.attribute_map.each_pair do |attr, param|
177
+ value = public_method(attr).call
178
+ next if value.nil? && !instance_variable_defined?("@#{attr}")
179
+
180
+ hash[param] = _to_hash(value)
181
+ end
182
+ hash
183
+ end
184
+
185
+ private
186
+
187
+ # Outputs non-array value in the form of hash
188
+ # For object, use to_hash. Otherwise, just return the value
189
+ # @param [Object] value Any valid value
190
+ # @return [Hash] Returns the value in the form of hash
191
+ def _to_hash(value)
192
+ if value.is_a?(Array)
193
+ value.compact.map { |v| _to_hash(v) }
194
+ elsif value.is_a?(Hash)
195
+ {}.tap do |hash|
196
+ value.each { |k, v| hash[k] = _to_hash(v) }
197
+ end
198
+ elsif value.respond_to? :to_hash
199
+ value.to_hash
200
+ else
201
+ value
202
+ end
203
+ end
204
+ end
205
+ end
206
+ # rubocop:enable Lint/UnneededCopDisableDirective
@@ -0,0 +1,195 @@
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 IP rate limiting configuration. Defines the amount of allowed requests from a unique IP address and the resulting block response code when that threshold is exceeded.
8
+ class Waas::Models::AddressRateLimiting # rubocop:disable Metrics/LineLength
9
+ # **[Required]** Enables or disables the address rate limiting Web Application Firewall feature.
10
+ # @return [BOOLEAN]
11
+ attr_accessor :is_enabled
12
+
13
+ # The number of allowed requests per second from one IP address. If unspecified, defaults to `1`.
14
+ # @return [Integer]
15
+ attr_accessor :allowed_rate_per_address
16
+
17
+ # The maximum number of requests allowed to be queued before subsequent requests are dropped. If unspecified, defaults to `10`.
18
+ # @return [Integer]
19
+ attr_accessor :max_delayed_count_per_address
20
+
21
+ # The response status code returned when a request is blocked. If unspecified, defaults to `503`.
22
+ # @return [Integer]
23
+ attr_accessor :block_response_code
24
+
25
+ # Attribute mapping from ruby-style variable name to JSON key.
26
+ def self.attribute_map
27
+ {
28
+ # rubocop:disable Style/SymbolLiteral
29
+ 'is_enabled': :'isEnabled',
30
+ 'allowed_rate_per_address': :'allowedRatePerAddress',
31
+ 'max_delayed_count_per_address': :'maxDelayedCountPerAddress',
32
+ 'block_response_code': :'blockResponseCode'
33
+ # rubocop:enable Style/SymbolLiteral
34
+ }
35
+ end
36
+
37
+ # Attribute type mapping.
38
+ def self.swagger_types
39
+ {
40
+ # rubocop:disable Style/SymbolLiteral
41
+ 'is_enabled': :'BOOLEAN',
42
+ 'allowed_rate_per_address': :'Integer',
43
+ 'max_delayed_count_per_address': :'Integer',
44
+ 'block_response_code': :'Integer'
45
+ # rubocop:enable Style/SymbolLiteral
46
+ }
47
+ end
48
+
49
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
50
+ # rubocop:disable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
51
+
52
+
53
+ # Initializes the object
54
+ # @param [Hash] attributes Model attributes in the form of hash
55
+ # @option attributes [BOOLEAN] :is_enabled The value to assign to the {#is_enabled} property
56
+ # @option attributes [Integer] :allowed_rate_per_address The value to assign to the {#allowed_rate_per_address} property
57
+ # @option attributes [Integer] :max_delayed_count_per_address The value to assign to the {#max_delayed_count_per_address} property
58
+ # @option attributes [Integer] :block_response_code The value to assign to the {#block_response_code} property
59
+ def initialize(attributes = {})
60
+ return unless attributes.is_a?(Hash)
61
+
62
+ # convert string to symbol for hash key
63
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
64
+
65
+ self.is_enabled = attributes[:'isEnabled'] unless attributes[:'isEnabled'].nil?
66
+
67
+ raise 'You cannot provide both :isEnabled and :is_enabled' if attributes.key?(:'isEnabled') && attributes.key?(:'is_enabled')
68
+
69
+ self.is_enabled = attributes[:'is_enabled'] unless attributes[:'is_enabled'].nil?
70
+
71
+ self.allowed_rate_per_address = attributes[:'allowedRatePerAddress'] if attributes[:'allowedRatePerAddress']
72
+
73
+ raise 'You cannot provide both :allowedRatePerAddress and :allowed_rate_per_address' if attributes.key?(:'allowedRatePerAddress') && attributes.key?(:'allowed_rate_per_address')
74
+
75
+ self.allowed_rate_per_address = attributes[:'allowed_rate_per_address'] if attributes[:'allowed_rate_per_address']
76
+
77
+ self.max_delayed_count_per_address = attributes[:'maxDelayedCountPerAddress'] if attributes[:'maxDelayedCountPerAddress']
78
+
79
+ raise 'You cannot provide both :maxDelayedCountPerAddress and :max_delayed_count_per_address' if attributes.key?(:'maxDelayedCountPerAddress') && attributes.key?(:'max_delayed_count_per_address')
80
+
81
+ self.max_delayed_count_per_address = attributes[:'max_delayed_count_per_address'] if attributes[:'max_delayed_count_per_address']
82
+
83
+ self.block_response_code = attributes[:'blockResponseCode'] if attributes[:'blockResponseCode']
84
+
85
+ raise 'You cannot provide both :blockResponseCode and :block_response_code' if attributes.key?(:'blockResponseCode') && attributes.key?(:'block_response_code')
86
+
87
+ self.block_response_code = attributes[:'block_response_code'] if attributes[:'block_response_code']
88
+ end
89
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
90
+ # rubocop:enable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
91
+
92
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Metrics/LineLength, Layout/EmptyLines
93
+
94
+
95
+ # Checks equality by comparing each attribute.
96
+ # @param [Object] other the other object to be compared
97
+ def ==(other)
98
+ return true if equal?(other)
99
+
100
+ self.class == other.class &&
101
+ is_enabled == other.is_enabled &&
102
+ allowed_rate_per_address == other.allowed_rate_per_address &&
103
+ max_delayed_count_per_address == other.max_delayed_count_per_address &&
104
+ block_response_code == other.block_response_code
105
+ end
106
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Metrics/LineLength, Layout/EmptyLines
107
+
108
+ # @see the `==` method
109
+ # @param [Object] other the other object to be compared
110
+ def eql?(other)
111
+ self == other
112
+ end
113
+
114
+ # rubocop:disable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
115
+
116
+
117
+ # Calculates hash code according to all attributes.
118
+ # @return [Fixnum] Hash code
119
+ def hash
120
+ [is_enabled, allowed_rate_per_address, max_delayed_count_per_address, block_response_code].hash
121
+ end
122
+ # rubocop:enable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
123
+
124
+ # rubocop:disable Metrics/AbcSize, Layout/EmptyLines
125
+
126
+
127
+ # Builds the object from hash
128
+ # @param [Hash] attributes Model attributes in the form of hash
129
+ # @return [Object] Returns the model itself
130
+ def build_from_hash(attributes)
131
+ return nil unless attributes.is_a?(Hash)
132
+
133
+ self.class.swagger_types.each_pair do |key, type|
134
+ if type =~ /^Array<(.*)>/i
135
+ # check to ensure the input is an array given that the the attribute
136
+ # is documented as an array but the input is not
137
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
138
+ public_method("#{key}=").call(
139
+ attributes[self.class.attribute_map[key]]
140
+ .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
141
+ )
142
+ end
143
+ elsif !attributes[self.class.attribute_map[key]].nil?
144
+ public_method("#{key}=").call(
145
+ OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
146
+ )
147
+ end
148
+ # or else data not found in attributes(hash), not an issue as the data can be optional
149
+ end
150
+
151
+ self
152
+ end
153
+ # rubocop:enable Metrics/AbcSize, Layout/EmptyLines
154
+
155
+ # Returns the string representation of the object
156
+ # @return [String] String presentation of the object
157
+ def to_s
158
+ to_hash.to_s
159
+ end
160
+
161
+ # Returns the object in the form of hash
162
+ # @return [Hash] Returns the object in the form of hash
163
+ def to_hash
164
+ hash = {}
165
+ self.class.attribute_map.each_pair do |attr, param|
166
+ value = public_method(attr).call
167
+ next if value.nil? && !instance_variable_defined?("@#{attr}")
168
+
169
+ hash[param] = _to_hash(value)
170
+ end
171
+ hash
172
+ end
173
+
174
+ private
175
+
176
+ # Outputs non-array value in the form of hash
177
+ # For object, use to_hash. Otherwise, just return the value
178
+ # @param [Object] value Any valid value
179
+ # @return [Hash] Returns the value in the form of hash
180
+ def _to_hash(value)
181
+ if value.is_a?(Array)
182
+ value.compact.map { |v| _to_hash(v) }
183
+ elsif value.is_a?(Hash)
184
+ {}.tap do |hash|
185
+ value.each { |k, v| hash[k] = _to_hash(v) }
186
+ end
187
+ elsif value.respond_to? :to_hash
188
+ value.to_hash
189
+ else
190
+ value
191
+ end
192
+ end
193
+ end
194
+ end
195
+ # rubocop:enable Lint/UnneededCopDisableDirective
@@ -0,0 +1,288 @@
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 challenge settings if `action` is set to `BLOCK`.
9
+ class Waas::Models::BlockChallengeSettings # rubocop:disable Metrics/LineLength
10
+ BLOCK_ACTION_ENUM = [
11
+ BLOCK_ACTION_SET_RESPONSE_CODE = 'SET_RESPONSE_CODE'.freeze,
12
+ BLOCK_ACTION_SHOW_ERROR_PAGE = 'SHOW_ERROR_PAGE'.freeze,
13
+ BLOCK_ACTION_SHOW_CAPTCHA = 'SHOW_CAPTCHA'.freeze,
14
+ BLOCK_ACTION_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
15
+ ].freeze
16
+
17
+ # The method used to block requests that fail the challenge, if `action` is set to `BLOCK`. If unspecified, defaults to `SHOW_ERROR_PAGE`.
18
+ # @return [String]
19
+ attr_reader :block_action
20
+
21
+ # The response status code to return when `action` is set to `BLOCK`, `blockAction` is set to `SET_RESPONSE_CODE` or `SHOW_ERROR_PAGE`, and the request is blocked. If unspecified, defaults to `403`.
22
+ # @return [Integer]
23
+ attr_accessor :block_response_code
24
+
25
+ # The message to show on the error page when `action` is set to `BLOCK`, `blockAction` is set to `SHOW_ERROR_PAGE`, and the request is blocked. If unspecified, defaults to `Access to the website is blocked`.
26
+ # @return [String]
27
+ attr_accessor :block_error_page_message
28
+
29
+ # The description text to show on the error page when `action` is set to `BLOCK`, `blockAction` is set to `SHOW_ERROR_PAGE`, and the request is blocked. If unspecified, defaults to `Access blocked by website owner. Please contact support.`
30
+ # @return [String]
31
+ attr_accessor :block_error_page_description
32
+
33
+ # The error code to show on the error page when `action` is set to `BLOCK`, `blockAction` is set to `SHOW_ERROR_PAGE` and the request is blocked. If unspecified, defaults to `403`.
34
+ # @return [String]
35
+ attr_accessor :block_error_page_code
36
+
37
+ # The title used when showing a CAPTCHA challenge when `action` is set to `BLOCK`, `blockAction` is set to `SHOW_CAPTCHA`, and the request is blocked. If unspecified, defaults to `Are you human?`
38
+ # @return [String]
39
+ attr_accessor :captcha_title
40
+
41
+ # The text to show in the header when showing a CAPTCHA challenge when `action` is set to `BLOCK`, `blockAction` is set to `SHOW_CAPTCHA`, and the request is blocked. If unspecified, defaults to `We have detected an increased number of attempts to access this webapp. To help us keep this webapp secure, please let us know that you are not a robot by entering the text from captcha below.`
42
+ # @return [String]
43
+ attr_accessor :captcha_header
44
+
45
+ # The text to show in the footer when showing a CAPTCHA challenge when `action` is set to `BLOCK`, `blockAction` is set to `SHOW_CAPTCHA`, and the request is blocked. If unspecified, default to `Enter the letters and numbers as they are shown in image above`.
46
+ # @return [String]
47
+ attr_accessor :captcha_footer
48
+
49
+ # The text to show on the label of the CAPTCHA challenge submit button when `action` is set to `BLOCK`, `blockAction` is set to `SHOW_CAPTCHA`, and the request is blocked. If unspecified, defaults to `Yes, I am human`.
50
+ # @return [String]
51
+ attr_accessor :captcha_submit_label
52
+
53
+ # Attribute mapping from ruby-style variable name to JSON key.
54
+ def self.attribute_map
55
+ {
56
+ # rubocop:disable Style/SymbolLiteral
57
+ 'block_action': :'blockAction',
58
+ 'block_response_code': :'blockResponseCode',
59
+ 'block_error_page_message': :'blockErrorPageMessage',
60
+ 'block_error_page_description': :'blockErrorPageDescription',
61
+ 'block_error_page_code': :'blockErrorPageCode',
62
+ 'captcha_title': :'captchaTitle',
63
+ 'captcha_header': :'captchaHeader',
64
+ 'captcha_footer': :'captchaFooter',
65
+ 'captcha_submit_label': :'captchaSubmitLabel'
66
+ # rubocop:enable Style/SymbolLiteral
67
+ }
68
+ end
69
+
70
+ # Attribute type mapping.
71
+ def self.swagger_types
72
+ {
73
+ # rubocop:disable Style/SymbolLiteral
74
+ 'block_action': :'String',
75
+ 'block_response_code': :'Integer',
76
+ 'block_error_page_message': :'String',
77
+ 'block_error_page_description': :'String',
78
+ 'block_error_page_code': :'String',
79
+ 'captcha_title': :'String',
80
+ 'captcha_header': :'String',
81
+ 'captcha_footer': :'String',
82
+ 'captcha_submit_label': :'String'
83
+ # rubocop:enable Style/SymbolLiteral
84
+ }
85
+ end
86
+
87
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
88
+ # rubocop:disable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
89
+
90
+
91
+ # Initializes the object
92
+ # @param [Hash] attributes Model attributes in the form of hash
93
+ # @option attributes [String] :block_action The value to assign to the {#block_action} property
94
+ # @option attributes [Integer] :block_response_code The value to assign to the {#block_response_code} property
95
+ # @option attributes [String] :block_error_page_message The value to assign to the {#block_error_page_message} property
96
+ # @option attributes [String] :block_error_page_description The value to assign to the {#block_error_page_description} property
97
+ # @option attributes [String] :block_error_page_code The value to assign to the {#block_error_page_code} property
98
+ # @option attributes [String] :captcha_title The value to assign to the {#captcha_title} property
99
+ # @option attributes [String] :captcha_header The value to assign to the {#captcha_header} property
100
+ # @option attributes [String] :captcha_footer The value to assign to the {#captcha_footer} property
101
+ # @option attributes [String] :captcha_submit_label The value to assign to the {#captcha_submit_label} property
102
+ def initialize(attributes = {})
103
+ return unless attributes.is_a?(Hash)
104
+
105
+ # convert string to symbol for hash key
106
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
107
+
108
+ self.block_action = attributes[:'blockAction'] if attributes[:'blockAction']
109
+
110
+ raise 'You cannot provide both :blockAction and :block_action' if attributes.key?(:'blockAction') && attributes.key?(:'block_action')
111
+
112
+ self.block_action = attributes[:'block_action'] if attributes[:'block_action']
113
+
114
+ self.block_response_code = attributes[:'blockResponseCode'] if attributes[:'blockResponseCode']
115
+
116
+ raise 'You cannot provide both :blockResponseCode and :block_response_code' if attributes.key?(:'blockResponseCode') && attributes.key?(:'block_response_code')
117
+
118
+ self.block_response_code = attributes[:'block_response_code'] if attributes[:'block_response_code']
119
+
120
+ self.block_error_page_message = attributes[:'blockErrorPageMessage'] if attributes[:'blockErrorPageMessage']
121
+
122
+ raise 'You cannot provide both :blockErrorPageMessage and :block_error_page_message' if attributes.key?(:'blockErrorPageMessage') && attributes.key?(:'block_error_page_message')
123
+
124
+ self.block_error_page_message = attributes[:'block_error_page_message'] if attributes[:'block_error_page_message']
125
+
126
+ self.block_error_page_description = attributes[:'blockErrorPageDescription'] if attributes[:'blockErrorPageDescription']
127
+
128
+ raise 'You cannot provide both :blockErrorPageDescription and :block_error_page_description' if attributes.key?(:'blockErrorPageDescription') && attributes.key?(:'block_error_page_description')
129
+
130
+ self.block_error_page_description = attributes[:'block_error_page_description'] if attributes[:'block_error_page_description']
131
+
132
+ self.block_error_page_code = attributes[:'blockErrorPageCode'] if attributes[:'blockErrorPageCode']
133
+
134
+ raise 'You cannot provide both :blockErrorPageCode and :block_error_page_code' if attributes.key?(:'blockErrorPageCode') && attributes.key?(:'block_error_page_code')
135
+
136
+ self.block_error_page_code = attributes[:'block_error_page_code'] if attributes[:'block_error_page_code']
137
+
138
+ self.captcha_title = attributes[:'captchaTitle'] if attributes[:'captchaTitle']
139
+
140
+ raise 'You cannot provide both :captchaTitle and :captcha_title' if attributes.key?(:'captchaTitle') && attributes.key?(:'captcha_title')
141
+
142
+ self.captcha_title = attributes[:'captcha_title'] if attributes[:'captcha_title']
143
+
144
+ self.captcha_header = attributes[:'captchaHeader'] if attributes[:'captchaHeader']
145
+
146
+ raise 'You cannot provide both :captchaHeader and :captcha_header' if attributes.key?(:'captchaHeader') && attributes.key?(:'captcha_header')
147
+
148
+ self.captcha_header = attributes[:'captcha_header'] if attributes[:'captcha_header']
149
+
150
+ self.captcha_footer = attributes[:'captchaFooter'] if attributes[:'captchaFooter']
151
+
152
+ raise 'You cannot provide both :captchaFooter and :captcha_footer' if attributes.key?(:'captchaFooter') && attributes.key?(:'captcha_footer')
153
+
154
+ self.captcha_footer = attributes[:'captcha_footer'] if attributes[:'captcha_footer']
155
+
156
+ self.captcha_submit_label = attributes[:'captchaSubmitLabel'] if attributes[:'captchaSubmitLabel']
157
+
158
+ raise 'You cannot provide both :captchaSubmitLabel and :captcha_submit_label' if attributes.key?(:'captchaSubmitLabel') && attributes.key?(:'captcha_submit_label')
159
+
160
+ self.captcha_submit_label = attributes[:'captcha_submit_label'] if attributes[:'captcha_submit_label']
161
+ end
162
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
163
+ # rubocop:enable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
164
+
165
+ # Custom attribute writer method checking allowed values (enum).
166
+ # @param [Object] block_action Object to be assigned
167
+ def block_action=(block_action)
168
+ # rubocop:disable Style/ConditionalAssignment
169
+ if block_action && !BLOCK_ACTION_ENUM.include?(block_action)
170
+ # rubocop: disable Metrics/LineLength
171
+ OCI.logger.debug("Unknown value for 'block_action' [" + block_action + "]. Mapping to 'BLOCK_ACTION_UNKNOWN_ENUM_VALUE'") if OCI.logger
172
+ # rubocop: enable Metrics/LineLength
173
+ @block_action = BLOCK_ACTION_UNKNOWN_ENUM_VALUE
174
+ else
175
+ @block_action = block_action
176
+ end
177
+ # rubocop:enable Style/ConditionalAssignment
178
+ end
179
+
180
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Metrics/LineLength, Layout/EmptyLines
181
+
182
+
183
+ # Checks equality by comparing each attribute.
184
+ # @param [Object] other the other object to be compared
185
+ def ==(other)
186
+ return true if equal?(other)
187
+
188
+ self.class == other.class &&
189
+ block_action == other.block_action &&
190
+ block_response_code == other.block_response_code &&
191
+ block_error_page_message == other.block_error_page_message &&
192
+ block_error_page_description == other.block_error_page_description &&
193
+ block_error_page_code == other.block_error_page_code &&
194
+ captcha_title == other.captcha_title &&
195
+ captcha_header == other.captcha_header &&
196
+ captcha_footer == other.captcha_footer &&
197
+ captcha_submit_label == other.captcha_submit_label
198
+ end
199
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Metrics/LineLength, Layout/EmptyLines
200
+
201
+ # @see the `==` method
202
+ # @param [Object] other the other object to be compared
203
+ def eql?(other)
204
+ self == other
205
+ end
206
+
207
+ # rubocop:disable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
208
+
209
+
210
+ # Calculates hash code according to all attributes.
211
+ # @return [Fixnum] Hash code
212
+ def hash
213
+ [block_action, block_response_code, block_error_page_message, block_error_page_description, block_error_page_code, captcha_title, captcha_header, captcha_footer, captcha_submit_label].hash
214
+ end
215
+ # rubocop:enable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
216
+
217
+ # rubocop:disable Metrics/AbcSize, Layout/EmptyLines
218
+
219
+
220
+ # Builds the object from hash
221
+ # @param [Hash] attributes Model attributes in the form of hash
222
+ # @return [Object] Returns the model itself
223
+ def build_from_hash(attributes)
224
+ return nil unless attributes.is_a?(Hash)
225
+
226
+ self.class.swagger_types.each_pair do |key, type|
227
+ if type =~ /^Array<(.*)>/i
228
+ # check to ensure the input is an array given that the the attribute
229
+ # is documented as an array but the input is not
230
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
231
+ public_method("#{key}=").call(
232
+ attributes[self.class.attribute_map[key]]
233
+ .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
234
+ )
235
+ end
236
+ elsif !attributes[self.class.attribute_map[key]].nil?
237
+ public_method("#{key}=").call(
238
+ OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
239
+ )
240
+ end
241
+ # or else data not found in attributes(hash), not an issue as the data can be optional
242
+ end
243
+
244
+ self
245
+ end
246
+ # rubocop:enable Metrics/AbcSize, Layout/EmptyLines
247
+
248
+ # Returns the string representation of the object
249
+ # @return [String] String presentation of the object
250
+ def to_s
251
+ to_hash.to_s
252
+ end
253
+
254
+ # Returns the object in the form of hash
255
+ # @return [Hash] Returns the object in the form of hash
256
+ def to_hash
257
+ hash = {}
258
+ self.class.attribute_map.each_pair do |attr, param|
259
+ value = public_method(attr).call
260
+ next if value.nil? && !instance_variable_defined?("@#{attr}")
261
+
262
+ hash[param] = _to_hash(value)
263
+ end
264
+ hash
265
+ end
266
+
267
+ private
268
+
269
+ # Outputs non-array value in the form of hash
270
+ # For object, use to_hash. Otherwise, just return the value
271
+ # @param [Object] value Any valid value
272
+ # @return [Hash] Returns the value in the form of hash
273
+ def _to_hash(value)
274
+ if value.is_a?(Array)
275
+ value.compact.map { |v| _to_hash(v) }
276
+ elsif value.is_a?(Hash)
277
+ {}.tap do |hash|
278
+ value.each { |k, v| hash[k] = _to_hash(v) }
279
+ end
280
+ elsif value.respond_to? :to_hash
281
+ value.to_hash
282
+ else
283
+ value
284
+ end
285
+ end
286
+ end
287
+ end
288
+ # rubocop:enable Lint/UnneededCopDisableDirective