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,185 @@
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
+ # A protection rule key and the associated action to apply to that rule.
8
+ class Waas::Models::ProtectionRuleAction # rubocop:disable Metrics/LineLength
9
+ ACTION_ENUM = [
10
+ ACTION_OFF = 'OFF'.freeze,
11
+ ACTION_DETECT = 'DETECT'.freeze,
12
+ ACTION_BLOCK = 'BLOCK'.freeze
13
+ ].freeze
14
+
15
+ # **[Required]** The unique key of the protection rule.
16
+ # @return [String]
17
+ attr_accessor :key
18
+
19
+ # **[Required]** The action to apply to the protection rule. If unspecified, defaults to `OFF`.
20
+ # @return [String]
21
+ attr_reader :action
22
+
23
+ # The types of requests excluded from the protection rule action. If the requests matches the criteria in the `exclusions`, the protection rule action will not be executed.
24
+ # @return [Array<OCI::Waas::Models::ProtectionRuleExclusion>]
25
+ attr_accessor :exclusions
26
+
27
+ # Attribute mapping from ruby-style variable name to JSON key.
28
+ def self.attribute_map
29
+ {
30
+ # rubocop:disable Style/SymbolLiteral
31
+ 'key': :'key',
32
+ 'action': :'action',
33
+ 'exclusions': :'exclusions'
34
+ # rubocop:enable Style/SymbolLiteral
35
+ }
36
+ end
37
+
38
+ # Attribute type mapping.
39
+ def self.swagger_types
40
+ {
41
+ # rubocop:disable Style/SymbolLiteral
42
+ 'key': :'String',
43
+ 'action': :'String',
44
+ 'exclusions': :'Array<OCI::Waas::Models::ProtectionRuleExclusion>'
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 [String] :key The value to assign to the {#key} property
56
+ # @option attributes [String] :action The value to assign to the {#action} property
57
+ # @option attributes [Array<OCI::Waas::Models::ProtectionRuleExclusion>] :exclusions The value to assign to the {#exclusions} property
58
+ def initialize(attributes = {})
59
+ return unless attributes.is_a?(Hash)
60
+
61
+ # convert string to symbol for hash key
62
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
63
+
64
+ self.key = attributes[:'key'] if attributes[:'key']
65
+
66
+ self.action = attributes[:'action'] if attributes[:'action']
67
+
68
+ self.exclusions = attributes[:'exclusions'] if attributes[:'exclusions']
69
+ end
70
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
71
+ # rubocop:enable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
72
+
73
+ # Custom attribute writer method checking allowed values (enum).
74
+ # @param [Object] action Object to be assigned
75
+ def action=(action)
76
+ # rubocop: disable Metrics/LineLength
77
+ raise "Invalid value for 'action': this must be one of the values in ACTION_ENUM." if action && !ACTION_ENUM.include?(action)
78
+
79
+ # rubocop: enable Metrics/LineLength
80
+ @action = action
81
+ end
82
+
83
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Metrics/LineLength, Layout/EmptyLines
84
+
85
+
86
+ # Checks equality by comparing each attribute.
87
+ # @param [Object] other the other object to be compared
88
+ def ==(other)
89
+ return true if equal?(other)
90
+
91
+ self.class == other.class &&
92
+ key == other.key &&
93
+ action == other.action &&
94
+ exclusions == other.exclusions
95
+ end
96
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Metrics/LineLength, Layout/EmptyLines
97
+
98
+ # @see the `==` method
99
+ # @param [Object] other the other object to be compared
100
+ def eql?(other)
101
+ self == other
102
+ end
103
+
104
+ # rubocop:disable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
105
+
106
+
107
+ # Calculates hash code according to all attributes.
108
+ # @return [Fixnum] Hash code
109
+ def hash
110
+ [key, action, exclusions].hash
111
+ end
112
+ # rubocop:enable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
113
+
114
+ # rubocop:disable Metrics/AbcSize, Layout/EmptyLines
115
+
116
+
117
+ # Builds the object from hash
118
+ # @param [Hash] attributes Model attributes in the form of hash
119
+ # @return [Object] Returns the model itself
120
+ def build_from_hash(attributes)
121
+ return nil unless attributes.is_a?(Hash)
122
+
123
+ self.class.swagger_types.each_pair do |key, type|
124
+ if type =~ /^Array<(.*)>/i
125
+ # check to ensure the input is an array given that the the attribute
126
+ # is documented as an array but the input is not
127
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
128
+ public_method("#{key}=").call(
129
+ attributes[self.class.attribute_map[key]]
130
+ .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
131
+ )
132
+ end
133
+ elsif !attributes[self.class.attribute_map[key]].nil?
134
+ public_method("#{key}=").call(
135
+ OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
136
+ )
137
+ end
138
+ # or else data not found in attributes(hash), not an issue as the data can be optional
139
+ end
140
+
141
+ self
142
+ end
143
+ # rubocop:enable Metrics/AbcSize, Layout/EmptyLines
144
+
145
+ # Returns the string representation of the object
146
+ # @return [String] String presentation of the object
147
+ def to_s
148
+ to_hash.to_s
149
+ end
150
+
151
+ # Returns the object in the form of hash
152
+ # @return [Hash] Returns the object in the form of hash
153
+ def to_hash
154
+ hash = {}
155
+ self.class.attribute_map.each_pair do |attr, param|
156
+ value = public_method(attr).call
157
+ next if value.nil? && !instance_variable_defined?("@#{attr}")
158
+
159
+ hash[param] = _to_hash(value)
160
+ end
161
+ hash
162
+ end
163
+
164
+ private
165
+
166
+ # Outputs non-array value in the form of hash
167
+ # For object, use to_hash. Otherwise, just return the value
168
+ # @param [Object] value Any valid value
169
+ # @return [Hash] Returns the value in the form of hash
170
+ def _to_hash(value)
171
+ if value.is_a?(Array)
172
+ value.compact.map { |v| _to_hash(v) }
173
+ elsif value.is_a?(Hash)
174
+ {}.tap do |hash|
175
+ value.each { |k, v| hash[k] = _to_hash(v) }
176
+ end
177
+ elsif value.respond_to? :to_hash
178
+ value.to_hash
179
+ else
180
+ value
181
+ end
182
+ end
183
+ end
184
+ end
185
+ # rubocop:enable Lint/UnneededCopDisableDirective
@@ -0,0 +1,182 @@
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
+ # Allows specified types of requests to bypass the protection rule. If the requests matches any of the criteria in the `exclusions` field, the protection rule will not be executed. Rules can have more than one exclusion and exclusions are applied to requests disjunctively.
9
+ class Waas::Models::ProtectionRuleExclusion # rubocop:disable Metrics/LineLength
10
+ TARGET_ENUM = [
11
+ TARGET_REQUEST_COOKIES = 'REQUEST_COOKIES'.freeze,
12
+ TARGET_REQUEST_COOKIE_NAMES = 'REQUEST_COOKIE_NAMES'.freeze,
13
+ TARGET_ARGS = 'ARGS'.freeze,
14
+ TARGET_ARGS_NAMES = 'ARGS_NAMES'.freeze,
15
+ TARGET_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
16
+ ].freeze
17
+
18
+ # The target of the exclusion.
19
+ # @return [String]
20
+ attr_reader :target
21
+
22
+ # @return [Array<String>]
23
+ attr_accessor :exclusions
24
+
25
+ # Attribute mapping from ruby-style variable name to JSON key.
26
+ def self.attribute_map
27
+ {
28
+ # rubocop:disable Style/SymbolLiteral
29
+ 'target': :'target',
30
+ 'exclusions': :'exclusions'
31
+ # rubocop:enable Style/SymbolLiteral
32
+ }
33
+ end
34
+
35
+ # Attribute type mapping.
36
+ def self.swagger_types
37
+ {
38
+ # rubocop:disable Style/SymbolLiteral
39
+ 'target': :'String',
40
+ 'exclusions': :'Array<String>'
41
+ # rubocop:enable Style/SymbolLiteral
42
+ }
43
+ end
44
+
45
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
46
+ # rubocop:disable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
47
+
48
+
49
+ # Initializes the object
50
+ # @param [Hash] attributes Model attributes in the form of hash
51
+ # @option attributes [String] :target The value to assign to the {#target} property
52
+ # @option attributes [Array<String>] :exclusions The value to assign to the {#exclusions} property
53
+ def initialize(attributes = {})
54
+ return unless attributes.is_a?(Hash)
55
+
56
+ # convert string to symbol for hash key
57
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
58
+
59
+ self.target = attributes[:'target'] if attributes[:'target']
60
+
61
+ self.exclusions = attributes[:'exclusions'] if attributes[:'exclusions']
62
+ end
63
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
64
+ # rubocop:enable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
65
+
66
+ # Custom attribute writer method checking allowed values (enum).
67
+ # @param [Object] target Object to be assigned
68
+ def target=(target)
69
+ # rubocop:disable Style/ConditionalAssignment
70
+ if target && !TARGET_ENUM.include?(target)
71
+ # rubocop: disable Metrics/LineLength
72
+ OCI.logger.debug("Unknown value for 'target' [" + target + "]. Mapping to 'TARGET_UNKNOWN_ENUM_VALUE'") if OCI.logger
73
+ # rubocop: enable Metrics/LineLength
74
+ @target = TARGET_UNKNOWN_ENUM_VALUE
75
+ else
76
+ @target = target
77
+ end
78
+ # rubocop:enable Style/ConditionalAssignment
79
+ end
80
+
81
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Metrics/LineLength, Layout/EmptyLines
82
+
83
+
84
+ # Checks equality by comparing each attribute.
85
+ # @param [Object] other the other object to be compared
86
+ def ==(other)
87
+ return true if equal?(other)
88
+
89
+ self.class == other.class &&
90
+ target == other.target &&
91
+ exclusions == other.exclusions
92
+ end
93
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Metrics/LineLength, Layout/EmptyLines
94
+
95
+ # @see the `==` method
96
+ # @param [Object] other the other object to be compared
97
+ def eql?(other)
98
+ self == other
99
+ end
100
+
101
+ # rubocop:disable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
102
+
103
+
104
+ # Calculates hash code according to all attributes.
105
+ # @return [Fixnum] Hash code
106
+ def hash
107
+ [target, exclusions].hash
108
+ end
109
+ # rubocop:enable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
110
+
111
+ # rubocop:disable Metrics/AbcSize, Layout/EmptyLines
112
+
113
+
114
+ # Builds the object from hash
115
+ # @param [Hash] attributes Model attributes in the form of hash
116
+ # @return [Object] Returns the model itself
117
+ def build_from_hash(attributes)
118
+ return nil unless attributes.is_a?(Hash)
119
+
120
+ self.class.swagger_types.each_pair do |key, type|
121
+ if type =~ /^Array<(.*)>/i
122
+ # check to ensure the input is an array given that the the attribute
123
+ # is documented as an array but the input is not
124
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
125
+ public_method("#{key}=").call(
126
+ attributes[self.class.attribute_map[key]]
127
+ .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
128
+ )
129
+ end
130
+ elsif !attributes[self.class.attribute_map[key]].nil?
131
+ public_method("#{key}=").call(
132
+ OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
133
+ )
134
+ end
135
+ # or else data not found in attributes(hash), not an issue as the data can be optional
136
+ end
137
+
138
+ self
139
+ end
140
+ # rubocop:enable Metrics/AbcSize, Layout/EmptyLines
141
+
142
+ # Returns the string representation of the object
143
+ # @return [String] String presentation of the object
144
+ def to_s
145
+ to_hash.to_s
146
+ end
147
+
148
+ # Returns the object in the form of hash
149
+ # @return [Hash] Returns the object in the form of hash
150
+ def to_hash
151
+ hash = {}
152
+ self.class.attribute_map.each_pair do |attr, param|
153
+ value = public_method(attr).call
154
+ next if value.nil? && !instance_variable_defined?("@#{attr}")
155
+
156
+ hash[param] = _to_hash(value)
157
+ end
158
+ hash
159
+ end
160
+
161
+ private
162
+
163
+ # Outputs non-array value in the form of hash
164
+ # For object, use to_hash. Otherwise, just return the value
165
+ # @param [Object] value Any valid value
166
+ # @return [Hash] Returns the value in the form of hash
167
+ def _to_hash(value)
168
+ if value.is_a?(Array)
169
+ value.compact.map { |v| _to_hash(v) }
170
+ elsif value.is_a?(Hash)
171
+ {}.tap do |hash|
172
+ value.each { |k, v| hash[k] = _to_hash(v) }
173
+ end
174
+ elsif value.respond_to? :to_hash
175
+ value.to_hash
176
+ else
177
+ value
178
+ end
179
+ end
180
+ end
181
+ end
182
+ # rubocop:enable Lint/UnneededCopDisableDirective
@@ -0,0 +1,404 @@
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 settings used for protection rules.
9
+ class Waas::Models::ProtectionSettings # rubocop:disable Metrics/LineLength
10
+ BLOCK_ACTION_ENUM = [
11
+ BLOCK_ACTION_SHOW_ERROR_PAGE = 'SHOW_ERROR_PAGE'.freeze,
12
+ BLOCK_ACTION_SET_RESPONSE_CODE = 'SET_RESPONSE_CODE'.freeze,
13
+ BLOCK_ACTION_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
14
+ ].freeze
15
+
16
+ ALLOWED_HTTP_METHODS_ENUM = [
17
+ ALLOWED_HTTP_METHODS_OPTIONS = 'OPTIONS'.freeze,
18
+ ALLOWED_HTTP_METHODS_GET = 'GET'.freeze,
19
+ ALLOWED_HTTP_METHODS_HEAD = 'HEAD'.freeze,
20
+ ALLOWED_HTTP_METHODS_POST = 'POST'.freeze,
21
+ ALLOWED_HTTP_METHODS_PUT = 'PUT'.freeze,
22
+ ALLOWED_HTTP_METHODS_DELETE = 'DELETE'.freeze,
23
+ ALLOWED_HTTP_METHODS_TRACE = 'TRACE'.freeze,
24
+ ALLOWED_HTTP_METHODS_CONNECT = 'CONNECT'.freeze,
25
+ ALLOWED_HTTP_METHODS_PATCH = 'PATCH'.freeze,
26
+ ALLOWED_HTTP_METHODS_PROPFIND = 'PROPFIND'.freeze,
27
+ ALLOWED_HTTP_METHODS_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
28
+ ].freeze
29
+
30
+ # If `action` is set to `BLOCK`, this specifies how the traffic is blocked when detected as malicious by a protection rule. If unspecified, defaults to `SET_RESPONSE_CODE`.
31
+ # @return [String]
32
+ attr_reader :block_action
33
+
34
+ # The response code returned when `action` is set to `BLOCK`, `blockAction` is set to `SET_RESPONSE_CODE`, and the traffic is detected as malicious by a protection rule. If unspecified, defaults to `403`.
35
+ # @return [Integer]
36
+ attr_accessor :block_response_code
37
+
38
+ # The message to show on the error page when `action` is set to `BLOCK`, `blockAction` is set to `SHOW_ERROR_PAGE`, and the traffic is detected as malicious by a protection rule. If unspecified, defaults to 'Access to the website is blocked.'
39
+ # @return [String]
40
+ attr_accessor :block_error_page_message
41
+
42
+ # The error code to show on the error page when `action` is set to `BLOCK`, `blockAction` is set to `SHOW_ERROR_PAGE`, and the traffic is detected as malicious by a protection rule. If unspecified, defaults to `403`.
43
+ # @return [String]
44
+ attr_accessor :block_error_page_code
45
+
46
+ # The description text to show on the error page when `action` is set to `BLOCK`, `blockAction` is set to `SHOW_ERROR_PAGE`, and the traffic is detected as malicious by a protection rule. If unspecified, defaults to `Access blocked by website owner. Please contact support.`
47
+ # @return [String]
48
+ attr_accessor :block_error_page_description
49
+
50
+ # The maximum number of arguments allowed to be passed to your application before an action is taken. If unspecified, defaults to `255`.
51
+ # @return [Integer]
52
+ attr_accessor :max_argument_count
53
+
54
+ # The maximum length allowed for each argument name, in characters. If unspecified, defaults to `400`.
55
+ # @return [Integer]
56
+ attr_accessor :max_name_length_per_argument
57
+
58
+ # The maximum length allowed for the sum of all argument names, in characters. If unspecified, defaults to `64000`.
59
+ # @return [Integer]
60
+ attr_accessor :max_total_name_length_of_arguments
61
+
62
+ # The length of time to analyze traffic traffic, in days. After the analysis period, `WafRecommendations` will be populated. If unspecified, defaults to `10`.
63
+ #
64
+ # Use `GET /waasPolicies/{waasPolicyId}/wafRecommendations` to view WAF recommendations.
65
+ # @return [Integer]
66
+ attr_accessor :recommendations_period_in_days
67
+
68
+ # Inspects the response body of origin responses. Can be used to detect leakage of sensitive data. If unspecified, defaults to `false`.
69
+ #
70
+ # **Note:** Only origin responses with a Content-Type matching a value in `mediaTypes` will be inspected.
71
+ # @return [BOOLEAN]
72
+ attr_accessor :is_response_inspected
73
+
74
+ # The maximum response size to be fully inspected, in binary kilobytes (KiB). Anything over this limit will be partially inspected. If unspecified, defaults to `1024`.
75
+ # @return [Integer]
76
+ attr_accessor :max_response_size_in_ki_b
77
+
78
+ # The list of allowed HTTP methods. If unspecified, default to `[OPTIONS, GET, HEAD, POST]`.
79
+ # @return [Array<String>]
80
+ attr_reader :allowed_http_methods
81
+
82
+ # The list of media types to allow for inspection, if `isResponseInspected` is enabled. Only responses with MIME types in this list will be inspected. If unspecified, defaults to `[`text/html`, `text/plain`, `text/xml`]`.
83
+ #
84
+ # Supported MIME types include:
85
+ #
86
+ # - text/html
87
+ # - text/plain
88
+ # - text/asp
89
+ # - text/css
90
+ # - text/x-script
91
+ # - application/json
92
+ # - text/webviewhtml
93
+ # - text/x-java-source
94
+ # - application/x-javascript
95
+ # - application/javascript
96
+ # - application/ecmascript
97
+ # - text/javascript
98
+ # - text/ecmascript
99
+ # - text/x-script.perl
100
+ # - text/x-script.phyton
101
+ # - application/plain
102
+ # - application/xml
103
+ # - text/xml
104
+ # @return [Array<String>]
105
+ attr_accessor :media_types
106
+
107
+ # Attribute mapping from ruby-style variable name to JSON key.
108
+ def self.attribute_map
109
+ {
110
+ # rubocop:disable Style/SymbolLiteral
111
+ 'block_action': :'blockAction',
112
+ 'block_response_code': :'blockResponseCode',
113
+ 'block_error_page_message': :'blockErrorPageMessage',
114
+ 'block_error_page_code': :'blockErrorPageCode',
115
+ 'block_error_page_description': :'blockErrorPageDescription',
116
+ 'max_argument_count': :'maxArgumentCount',
117
+ 'max_name_length_per_argument': :'maxNameLengthPerArgument',
118
+ 'max_total_name_length_of_arguments': :'maxTotalNameLengthOfArguments',
119
+ 'recommendations_period_in_days': :'recommendationsPeriodInDays',
120
+ 'is_response_inspected': :'isResponseInspected',
121
+ 'max_response_size_in_ki_b': :'maxResponseSizeInKiB',
122
+ 'allowed_http_methods': :'allowedHttpMethods',
123
+ 'media_types': :'mediaTypes'
124
+ # rubocop:enable Style/SymbolLiteral
125
+ }
126
+ end
127
+
128
+ # Attribute type mapping.
129
+ def self.swagger_types
130
+ {
131
+ # rubocop:disable Style/SymbolLiteral
132
+ 'block_action': :'String',
133
+ 'block_response_code': :'Integer',
134
+ 'block_error_page_message': :'String',
135
+ 'block_error_page_code': :'String',
136
+ 'block_error_page_description': :'String',
137
+ 'max_argument_count': :'Integer',
138
+ 'max_name_length_per_argument': :'Integer',
139
+ 'max_total_name_length_of_arguments': :'Integer',
140
+ 'recommendations_period_in_days': :'Integer',
141
+ 'is_response_inspected': :'BOOLEAN',
142
+ 'max_response_size_in_ki_b': :'Integer',
143
+ 'allowed_http_methods': :'Array<String>',
144
+ 'media_types': :'Array<String>'
145
+ # rubocop:enable Style/SymbolLiteral
146
+ }
147
+ end
148
+
149
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
150
+ # rubocop:disable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
151
+
152
+
153
+ # Initializes the object
154
+ # @param [Hash] attributes Model attributes in the form of hash
155
+ # @option attributes [String] :block_action The value to assign to the {#block_action} property
156
+ # @option attributes [Integer] :block_response_code The value to assign to the {#block_response_code} property
157
+ # @option attributes [String] :block_error_page_message The value to assign to the {#block_error_page_message} property
158
+ # @option attributes [String] :block_error_page_code The value to assign to the {#block_error_page_code} property
159
+ # @option attributes [String] :block_error_page_description The value to assign to the {#block_error_page_description} property
160
+ # @option attributes [Integer] :max_argument_count The value to assign to the {#max_argument_count} property
161
+ # @option attributes [Integer] :max_name_length_per_argument The value to assign to the {#max_name_length_per_argument} property
162
+ # @option attributes [Integer] :max_total_name_length_of_arguments The value to assign to the {#max_total_name_length_of_arguments} property
163
+ # @option attributes [Integer] :recommendations_period_in_days The value to assign to the {#recommendations_period_in_days} property
164
+ # @option attributes [BOOLEAN] :is_response_inspected The value to assign to the {#is_response_inspected} property
165
+ # @option attributes [Integer] :max_response_size_in_ki_b The value to assign to the {#max_response_size_in_ki_b} property
166
+ # @option attributes [Array<String>] :allowed_http_methods The value to assign to the {#allowed_http_methods} property
167
+ # @option attributes [Array<String>] :media_types The value to assign to the {#media_types} property
168
+ def initialize(attributes = {})
169
+ return unless attributes.is_a?(Hash)
170
+
171
+ # convert string to symbol for hash key
172
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
173
+
174
+ self.block_action = attributes[:'blockAction'] if attributes[:'blockAction']
175
+
176
+ raise 'You cannot provide both :blockAction and :block_action' if attributes.key?(:'blockAction') && attributes.key?(:'block_action')
177
+
178
+ self.block_action = attributes[:'block_action'] if attributes[:'block_action']
179
+
180
+ self.block_response_code = attributes[:'blockResponseCode'] if attributes[:'blockResponseCode']
181
+
182
+ raise 'You cannot provide both :blockResponseCode and :block_response_code' if attributes.key?(:'blockResponseCode') && attributes.key?(:'block_response_code')
183
+
184
+ self.block_response_code = attributes[:'block_response_code'] if attributes[:'block_response_code']
185
+
186
+ self.block_error_page_message = attributes[:'blockErrorPageMessage'] if attributes[:'blockErrorPageMessage']
187
+
188
+ raise 'You cannot provide both :blockErrorPageMessage and :block_error_page_message' if attributes.key?(:'blockErrorPageMessage') && attributes.key?(:'block_error_page_message')
189
+
190
+ self.block_error_page_message = attributes[:'block_error_page_message'] if attributes[:'block_error_page_message']
191
+
192
+ self.block_error_page_code = attributes[:'blockErrorPageCode'] if attributes[:'blockErrorPageCode']
193
+
194
+ raise 'You cannot provide both :blockErrorPageCode and :block_error_page_code' if attributes.key?(:'blockErrorPageCode') && attributes.key?(:'block_error_page_code')
195
+
196
+ self.block_error_page_code = attributes[:'block_error_page_code'] if attributes[:'block_error_page_code']
197
+
198
+ self.block_error_page_description = attributes[:'blockErrorPageDescription'] if attributes[:'blockErrorPageDescription']
199
+
200
+ raise 'You cannot provide both :blockErrorPageDescription and :block_error_page_description' if attributes.key?(:'blockErrorPageDescription') && attributes.key?(:'block_error_page_description')
201
+
202
+ self.block_error_page_description = attributes[:'block_error_page_description'] if attributes[:'block_error_page_description']
203
+
204
+ self.max_argument_count = attributes[:'maxArgumentCount'] if attributes[:'maxArgumentCount']
205
+
206
+ raise 'You cannot provide both :maxArgumentCount and :max_argument_count' if attributes.key?(:'maxArgumentCount') && attributes.key?(:'max_argument_count')
207
+
208
+ self.max_argument_count = attributes[:'max_argument_count'] if attributes[:'max_argument_count']
209
+
210
+ self.max_name_length_per_argument = attributes[:'maxNameLengthPerArgument'] if attributes[:'maxNameLengthPerArgument']
211
+
212
+ raise 'You cannot provide both :maxNameLengthPerArgument and :max_name_length_per_argument' if attributes.key?(:'maxNameLengthPerArgument') && attributes.key?(:'max_name_length_per_argument')
213
+
214
+ self.max_name_length_per_argument = attributes[:'max_name_length_per_argument'] if attributes[:'max_name_length_per_argument']
215
+
216
+ self.max_total_name_length_of_arguments = attributes[:'maxTotalNameLengthOfArguments'] if attributes[:'maxTotalNameLengthOfArguments']
217
+
218
+ raise 'You cannot provide both :maxTotalNameLengthOfArguments and :max_total_name_length_of_arguments' if attributes.key?(:'maxTotalNameLengthOfArguments') && attributes.key?(:'max_total_name_length_of_arguments')
219
+
220
+ self.max_total_name_length_of_arguments = attributes[:'max_total_name_length_of_arguments'] if attributes[:'max_total_name_length_of_arguments']
221
+
222
+ self.recommendations_period_in_days = attributes[:'recommendationsPeriodInDays'] if attributes[:'recommendationsPeriodInDays']
223
+
224
+ raise 'You cannot provide both :recommendationsPeriodInDays and :recommendations_period_in_days' if attributes.key?(:'recommendationsPeriodInDays') && attributes.key?(:'recommendations_period_in_days')
225
+
226
+ self.recommendations_period_in_days = attributes[:'recommendations_period_in_days'] if attributes[:'recommendations_period_in_days']
227
+
228
+ self.is_response_inspected = attributes[:'isResponseInspected'] unless attributes[:'isResponseInspected'].nil?
229
+
230
+ raise 'You cannot provide both :isResponseInspected and :is_response_inspected' if attributes.key?(:'isResponseInspected') && attributes.key?(:'is_response_inspected')
231
+
232
+ self.is_response_inspected = attributes[:'is_response_inspected'] unless attributes[:'is_response_inspected'].nil?
233
+
234
+ self.max_response_size_in_ki_b = attributes[:'maxResponseSizeInKiB'] if attributes[:'maxResponseSizeInKiB']
235
+
236
+ raise 'You cannot provide both :maxResponseSizeInKiB and :max_response_size_in_ki_b' if attributes.key?(:'maxResponseSizeInKiB') && attributes.key?(:'max_response_size_in_ki_b')
237
+
238
+ self.max_response_size_in_ki_b = attributes[:'max_response_size_in_ki_b'] if attributes[:'max_response_size_in_ki_b']
239
+
240
+ self.allowed_http_methods = attributes[:'allowedHttpMethods'] if attributes[:'allowedHttpMethods']
241
+
242
+ raise 'You cannot provide both :allowedHttpMethods and :allowed_http_methods' if attributes.key?(:'allowedHttpMethods') && attributes.key?(:'allowed_http_methods')
243
+
244
+ self.allowed_http_methods = attributes[:'allowed_http_methods'] if attributes[:'allowed_http_methods']
245
+
246
+ self.media_types = attributes[:'mediaTypes'] if attributes[:'mediaTypes']
247
+
248
+ raise 'You cannot provide both :mediaTypes and :media_types' if attributes.key?(:'mediaTypes') && attributes.key?(:'media_types')
249
+
250
+ self.media_types = attributes[:'media_types'] if attributes[:'media_types']
251
+ end
252
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
253
+ # rubocop:enable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
254
+
255
+ # Custom attribute writer method checking allowed values (enum).
256
+ # @param [Object] block_action Object to be assigned
257
+ def block_action=(block_action)
258
+ # rubocop:disable Style/ConditionalAssignment
259
+ if block_action && !BLOCK_ACTION_ENUM.include?(block_action)
260
+ # rubocop: disable Metrics/LineLength
261
+ OCI.logger.debug("Unknown value for 'block_action' [" + block_action + "]. Mapping to 'BLOCK_ACTION_UNKNOWN_ENUM_VALUE'") if OCI.logger
262
+ # rubocop: enable Metrics/LineLength
263
+ @block_action = BLOCK_ACTION_UNKNOWN_ENUM_VALUE
264
+ else
265
+ @block_action = block_action
266
+ end
267
+ # rubocop:enable Style/ConditionalAssignment
268
+ end
269
+
270
+ # Custom attribute writer method checking allowed values (enum).
271
+ # @param [Object] allowed_http_methods Object to be assigned
272
+ def allowed_http_methods=(allowed_http_methods)
273
+ # rubocop:disable Style/ConditionalAssignment
274
+ if allowed_http_methods.nil?
275
+ @allowed_http_methods = nil
276
+ else
277
+ @allowed_http_methods =
278
+ allowed_http_methods.collect do |item|
279
+ if ALLOWED_HTTP_METHODS_ENUM.include?(item)
280
+ item
281
+ else
282
+ # rubocop: disable Metrics/LineLength
283
+ OCI.logger.debug("Unknown value for 'allowed_http_methods' [#{item}]. Mapping to 'ALLOWED_HTTP_METHODS_UNKNOWN_ENUM_VALUE'") if OCI.logger
284
+ # rubocop: enable Metrics/LineLength
285
+ ALLOWED_HTTP_METHODS_UNKNOWN_ENUM_VALUE
286
+ end
287
+ end
288
+ end
289
+ # rubocop:enable Style/ConditionalAssignment
290
+ end
291
+
292
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Metrics/LineLength, Layout/EmptyLines
293
+
294
+
295
+ # Checks equality by comparing each attribute.
296
+ # @param [Object] other the other object to be compared
297
+ def ==(other)
298
+ return true if equal?(other)
299
+
300
+ self.class == other.class &&
301
+ block_action == other.block_action &&
302
+ block_response_code == other.block_response_code &&
303
+ block_error_page_message == other.block_error_page_message &&
304
+ block_error_page_code == other.block_error_page_code &&
305
+ block_error_page_description == other.block_error_page_description &&
306
+ max_argument_count == other.max_argument_count &&
307
+ max_name_length_per_argument == other.max_name_length_per_argument &&
308
+ max_total_name_length_of_arguments == other.max_total_name_length_of_arguments &&
309
+ recommendations_period_in_days == other.recommendations_period_in_days &&
310
+ is_response_inspected == other.is_response_inspected &&
311
+ max_response_size_in_ki_b == other.max_response_size_in_ki_b &&
312
+ allowed_http_methods == other.allowed_http_methods &&
313
+ media_types == other.media_types
314
+ end
315
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Metrics/LineLength, Layout/EmptyLines
316
+
317
+ # @see the `==` method
318
+ # @param [Object] other the other object to be compared
319
+ def eql?(other)
320
+ self == other
321
+ end
322
+
323
+ # rubocop:disable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
324
+
325
+
326
+ # Calculates hash code according to all attributes.
327
+ # @return [Fixnum] Hash code
328
+ def hash
329
+ [block_action, block_response_code, block_error_page_message, block_error_page_code, block_error_page_description, max_argument_count, max_name_length_per_argument, max_total_name_length_of_arguments, recommendations_period_in_days, is_response_inspected, max_response_size_in_ki_b, allowed_http_methods, media_types].hash
330
+ end
331
+ # rubocop:enable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
332
+
333
+ # rubocop:disable Metrics/AbcSize, Layout/EmptyLines
334
+
335
+
336
+ # Builds the object from hash
337
+ # @param [Hash] attributes Model attributes in the form of hash
338
+ # @return [Object] Returns the model itself
339
+ def build_from_hash(attributes)
340
+ return nil unless attributes.is_a?(Hash)
341
+
342
+ self.class.swagger_types.each_pair do |key, type|
343
+ if type =~ /^Array<(.*)>/i
344
+ # check to ensure the input is an array given that the the attribute
345
+ # is documented as an array but the input is not
346
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
347
+ public_method("#{key}=").call(
348
+ attributes[self.class.attribute_map[key]]
349
+ .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
350
+ )
351
+ end
352
+ elsif !attributes[self.class.attribute_map[key]].nil?
353
+ public_method("#{key}=").call(
354
+ OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
355
+ )
356
+ end
357
+ # or else data not found in attributes(hash), not an issue as the data can be optional
358
+ end
359
+
360
+ self
361
+ end
362
+ # rubocop:enable Metrics/AbcSize, Layout/EmptyLines
363
+
364
+ # Returns the string representation of the object
365
+ # @return [String] String presentation of the object
366
+ def to_s
367
+ to_hash.to_s
368
+ end
369
+
370
+ # Returns the object in the form of hash
371
+ # @return [Hash] Returns the object in the form of hash
372
+ def to_hash
373
+ hash = {}
374
+ self.class.attribute_map.each_pair do |attr, param|
375
+ value = public_method(attr).call
376
+ next if value.nil? && !instance_variable_defined?("@#{attr}")
377
+
378
+ hash[param] = _to_hash(value)
379
+ end
380
+ hash
381
+ end
382
+
383
+ private
384
+
385
+ # Outputs non-array value in the form of hash
386
+ # For object, use to_hash. Otherwise, just return the value
387
+ # @param [Object] value Any valid value
388
+ # @return [Hash] Returns the value in the form of hash
389
+ def _to_hash(value)
390
+ if value.is_a?(Array)
391
+ value.compact.map { |v| _to_hash(v) }
392
+ elsif value.is_a?(Hash)
393
+ {}.tap do |hash|
394
+ value.each { |k, v| hash[k] = _to_hash(v) }
395
+ end
396
+ elsif value.respond_to? :to_hash
397
+ value.to_hash
398
+ else
399
+ value
400
+ end
401
+ end
402
+ end
403
+ end
404
+ # rubocop:enable Lint/UnneededCopDisableDirective