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,292 @@
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 request body used to update a ping monitor.
8
+ class Healthchecks::Models::UpdatePingMonitorDetails # rubocop:disable Metrics/LineLength
9
+ PROTOCOL_ENUM = [
10
+ PROTOCOL_ICMP = 'ICMP'.freeze,
11
+ PROTOCOL_TCP = 'TCP'.freeze
12
+ ].freeze
13
+
14
+ # @return [Array<String>]
15
+ attr_accessor :targets
16
+
17
+ # @return [Array<String>]
18
+ attr_accessor :vantage_point_names
19
+
20
+ # The port on which to probe endpoints. If unspecified, probes will use the
21
+ # default port of their protocol.
22
+ #
23
+ # @return [Integer]
24
+ attr_accessor :port
25
+
26
+ # The probe timeout in seconds. Valid values: 10, 20, 30, and 60.
27
+ # The probe timeout must be less than or equal to `intervalInSeconds` for monitors.
28
+ #
29
+ # @return [Integer]
30
+ attr_accessor :timeout_in_seconds
31
+
32
+ # @return [String]
33
+ attr_reader :protocol
34
+
35
+ # A user-friendly and mutable name suitable for display in a user interface.
36
+ # @return [String]
37
+ attr_accessor :display_name
38
+
39
+ # The monitor interval in seconds. Valid values: 10, 30, and 60.
40
+ #
41
+ # @return [Integer]
42
+ attr_accessor :interval_in_seconds
43
+
44
+ # Enables or disables the monitor. Set to 'true' to launch monitoring.
45
+ #
46
+ # @return [BOOLEAN]
47
+ attr_accessor :is_enabled
48
+
49
+ # Free-form tags for this resource. Each tag is a simple key-value pair with no
50
+ # predefined name, type, or namespace. For more information,
51
+ # see [Resource Tags](https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm).
52
+ # Example: `{\"Department\": \"Finance\"}`
53
+ #
54
+ # @return [Hash<String, String>]
55
+ attr_accessor :freeform_tags
56
+
57
+ # Defined tags for this resource. Each key is predefined and scoped to a namespace.
58
+ # For more information, see [Resource Tags](https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm).
59
+ # Example: `{\"Operations\": {\"CostCenter\": \"42\"}}`
60
+ #
61
+ # @return [Hash<String, Hash<String, Object>>]
62
+ attr_accessor :defined_tags
63
+
64
+ # Attribute mapping from ruby-style variable name to JSON key.
65
+ def self.attribute_map
66
+ {
67
+ # rubocop:disable Style/SymbolLiteral
68
+ 'targets': :'targets',
69
+ 'vantage_point_names': :'vantagePointNames',
70
+ 'port': :'port',
71
+ 'timeout_in_seconds': :'timeoutInSeconds',
72
+ 'protocol': :'protocol',
73
+ 'display_name': :'displayName',
74
+ 'interval_in_seconds': :'intervalInSeconds',
75
+ 'is_enabled': :'isEnabled',
76
+ 'freeform_tags': :'freeformTags',
77
+ 'defined_tags': :'definedTags'
78
+ # rubocop:enable Style/SymbolLiteral
79
+ }
80
+ end
81
+
82
+ # Attribute type mapping.
83
+ def self.swagger_types
84
+ {
85
+ # rubocop:disable Style/SymbolLiteral
86
+ 'targets': :'Array<String>',
87
+ 'vantage_point_names': :'Array<String>',
88
+ 'port': :'Integer',
89
+ 'timeout_in_seconds': :'Integer',
90
+ 'protocol': :'String',
91
+ 'display_name': :'String',
92
+ 'interval_in_seconds': :'Integer',
93
+ 'is_enabled': :'BOOLEAN',
94
+ 'freeform_tags': :'Hash<String, String>',
95
+ 'defined_tags': :'Hash<String, Hash<String, Object>>'
96
+ # rubocop:enable Style/SymbolLiteral
97
+ }
98
+ end
99
+
100
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
101
+ # rubocop:disable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
102
+
103
+
104
+ # Initializes the object
105
+ # @param [Hash] attributes Model attributes in the form of hash
106
+ # @option attributes [Array<String>] :targets The value to assign to the {#targets} property
107
+ # @option attributes [Array<String>] :vantage_point_names The value to assign to the {#vantage_point_names} property
108
+ # @option attributes [Integer] :port The value to assign to the {#port} property
109
+ # @option attributes [Integer] :timeout_in_seconds The value to assign to the {#timeout_in_seconds} property
110
+ # @option attributes [String] :protocol The value to assign to the {#protocol} property
111
+ # @option attributes [String] :display_name The value to assign to the {#display_name} property
112
+ # @option attributes [Integer] :interval_in_seconds The value to assign to the {#interval_in_seconds} property
113
+ # @option attributes [BOOLEAN] :is_enabled The value to assign to the {#is_enabled} property
114
+ # @option attributes [Hash<String, String>] :freeform_tags The value to assign to the {#freeform_tags} property
115
+ # @option attributes [Hash<String, Hash<String, Object>>] :defined_tags The value to assign to the {#defined_tags} property
116
+ def initialize(attributes = {})
117
+ return unless attributes.is_a?(Hash)
118
+
119
+ # convert string to symbol for hash key
120
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
121
+
122
+ self.targets = attributes[:'targets'] if attributes[:'targets']
123
+
124
+ self.vantage_point_names = attributes[:'vantagePointNames'] if attributes[:'vantagePointNames']
125
+
126
+ raise 'You cannot provide both :vantagePointNames and :vantage_point_names' if attributes.key?(:'vantagePointNames') && attributes.key?(:'vantage_point_names')
127
+
128
+ self.vantage_point_names = attributes[:'vantage_point_names'] if attributes[:'vantage_point_names']
129
+
130
+ self.port = attributes[:'port'] if attributes[:'port']
131
+
132
+ self.timeout_in_seconds = attributes[:'timeoutInSeconds'] if attributes[:'timeoutInSeconds']
133
+
134
+ raise 'You cannot provide both :timeoutInSeconds and :timeout_in_seconds' if attributes.key?(:'timeoutInSeconds') && attributes.key?(:'timeout_in_seconds')
135
+
136
+ self.timeout_in_seconds = attributes[:'timeout_in_seconds'] if attributes[:'timeout_in_seconds']
137
+
138
+ self.protocol = attributes[:'protocol'] if attributes[:'protocol']
139
+
140
+ self.display_name = attributes[:'displayName'] if attributes[:'displayName']
141
+
142
+ raise 'You cannot provide both :displayName and :display_name' if attributes.key?(:'displayName') && attributes.key?(:'display_name')
143
+
144
+ self.display_name = attributes[:'display_name'] if attributes[:'display_name']
145
+
146
+ self.interval_in_seconds = attributes[:'intervalInSeconds'] if attributes[:'intervalInSeconds']
147
+
148
+ raise 'You cannot provide both :intervalInSeconds and :interval_in_seconds' if attributes.key?(:'intervalInSeconds') && attributes.key?(:'interval_in_seconds')
149
+
150
+ self.interval_in_seconds = attributes[:'interval_in_seconds'] if attributes[:'interval_in_seconds']
151
+
152
+ self.is_enabled = attributes[:'isEnabled'] unless attributes[:'isEnabled'].nil?
153
+
154
+ raise 'You cannot provide both :isEnabled and :is_enabled' if attributes.key?(:'isEnabled') && attributes.key?(:'is_enabled')
155
+
156
+ self.is_enabled = attributes[:'is_enabled'] unless attributes[:'is_enabled'].nil?
157
+
158
+ self.freeform_tags = attributes[:'freeformTags'] if attributes[:'freeformTags']
159
+
160
+ raise 'You cannot provide both :freeformTags and :freeform_tags' if attributes.key?(:'freeformTags') && attributes.key?(:'freeform_tags')
161
+
162
+ self.freeform_tags = attributes[:'freeform_tags'] if attributes[:'freeform_tags']
163
+
164
+ self.defined_tags = attributes[:'definedTags'] if attributes[:'definedTags']
165
+
166
+ raise 'You cannot provide both :definedTags and :defined_tags' if attributes.key?(:'definedTags') && attributes.key?(:'defined_tags')
167
+
168
+ self.defined_tags = attributes[:'defined_tags'] if attributes[:'defined_tags']
169
+ end
170
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
171
+ # rubocop:enable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
172
+
173
+ # Custom attribute writer method checking allowed values (enum).
174
+ # @param [Object] protocol Object to be assigned
175
+ def protocol=(protocol)
176
+ # rubocop: disable Metrics/LineLength
177
+ raise "Invalid value for 'protocol': this must be one of the values in PROTOCOL_ENUM." if protocol && !PROTOCOL_ENUM.include?(protocol)
178
+
179
+ # rubocop: enable Metrics/LineLength
180
+ @protocol = protocol
181
+ end
182
+
183
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Metrics/LineLength, Layout/EmptyLines
184
+
185
+
186
+ # Checks equality by comparing each attribute.
187
+ # @param [Object] other the other object to be compared
188
+ def ==(other)
189
+ return true if equal?(other)
190
+
191
+ self.class == other.class &&
192
+ targets == other.targets &&
193
+ vantage_point_names == other.vantage_point_names &&
194
+ port == other.port &&
195
+ timeout_in_seconds == other.timeout_in_seconds &&
196
+ protocol == other.protocol &&
197
+ display_name == other.display_name &&
198
+ interval_in_seconds == other.interval_in_seconds &&
199
+ is_enabled == other.is_enabled &&
200
+ freeform_tags == other.freeform_tags &&
201
+ defined_tags == other.defined_tags
202
+ end
203
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Metrics/LineLength, Layout/EmptyLines
204
+
205
+ # @see the `==` method
206
+ # @param [Object] other the other object to be compared
207
+ def eql?(other)
208
+ self == other
209
+ end
210
+
211
+ # rubocop:disable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
212
+
213
+
214
+ # Calculates hash code according to all attributes.
215
+ # @return [Fixnum] Hash code
216
+ def hash
217
+ [targets, vantage_point_names, port, timeout_in_seconds, protocol, display_name, interval_in_seconds, is_enabled, freeform_tags, defined_tags].hash
218
+ end
219
+ # rubocop:enable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
220
+
221
+ # rubocop:disable Metrics/AbcSize, Layout/EmptyLines
222
+
223
+
224
+ # Builds the object from hash
225
+ # @param [Hash] attributes Model attributes in the form of hash
226
+ # @return [Object] Returns the model itself
227
+ def build_from_hash(attributes)
228
+ return nil unless attributes.is_a?(Hash)
229
+
230
+ self.class.swagger_types.each_pair do |key, type|
231
+ if type =~ /^Array<(.*)>/i
232
+ # check to ensure the input is an array given that the the attribute
233
+ # is documented as an array but the input is not
234
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
235
+ public_method("#{key}=").call(
236
+ attributes[self.class.attribute_map[key]]
237
+ .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
238
+ )
239
+ end
240
+ elsif !attributes[self.class.attribute_map[key]].nil?
241
+ public_method("#{key}=").call(
242
+ OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
243
+ )
244
+ end
245
+ # or else data not found in attributes(hash), not an issue as the data can be optional
246
+ end
247
+
248
+ self
249
+ end
250
+ # rubocop:enable Metrics/AbcSize, Layout/EmptyLines
251
+
252
+ # Returns the string representation of the object
253
+ # @return [String] String presentation of the object
254
+ def to_s
255
+ to_hash.to_s
256
+ end
257
+
258
+ # Returns the object in the form of hash
259
+ # @return [Hash] Returns the object in the form of hash
260
+ def to_hash
261
+ hash = {}
262
+ self.class.attribute_map.each_pair do |attr, param|
263
+ value = public_method(attr).call
264
+ next if value.nil? && !instance_variable_defined?("@#{attr}")
265
+
266
+ hash[param] = _to_hash(value)
267
+ end
268
+ hash
269
+ end
270
+
271
+ private
272
+
273
+ # Outputs non-array value in the form of hash
274
+ # For object, use to_hash. Otherwise, just return the value
275
+ # @param [Object] value Any valid value
276
+ # @return [Hash] Returns the value in the form of hash
277
+ def _to_hash(value)
278
+ if value.is_a?(Array)
279
+ value.compact.map { |v| _to_hash(v) }
280
+ elsif value.is_a?(Hash)
281
+ {}.tap do |hash|
282
+ value.each { |k, v| hash[k] = _to_hash(v) }
283
+ end
284
+ elsif value.respond_to? :to_hash
285
+ value.to_hash
286
+ else
287
+ value
288
+ end
289
+ end
290
+ end
291
+ end
292
+ # rubocop:enable Lint/UnneededCopDisableDirective
@@ -0,0 +1,2 @@
1
+ # Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
2
+
@@ -48,12 +48,14 @@ module OCI
48
48
  DnsClient: 'dns',
49
49
  EmailClient: 'email',
50
50
  FileStorageClient: 'filestorage',
51
+ HealthChecksClient: 'healthchecks',
51
52
  IdentityClient: 'identity',
52
53
  KmsVaultClient: 'kms',
53
54
  LoadBalancerClient: 'iaas',
54
55
  ObjectStorageClient: 'objectstorage',
55
56
  ResourceSearchClient: 'query',
56
- VirtualNetworkClient: 'iaas'
57
+ VirtualNetworkClient: 'iaas',
58
+ WaasClient: 'waas'
57
59
  }.freeze
58
60
  # --- End of service prefixes ---
59
61
 
@@ -1,5 +1,5 @@
1
1
  # Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
2
2
 
3
3
  module OCI
4
- VERSION = '2.4.6'.freeze
4
+ VERSION = '2.4.7'.freeze
5
5
  end
@@ -0,0 +1,283 @@
1
+ # Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
2
+
3
+ require 'date'
4
+ require 'logger'
5
+
6
+ # rubocop:disable Lint/UnneededCopDisableDirective
7
+ module OCI
8
+ # A content access rule. An access rule specifies an action to take if a set of criteria is matched by a request.
9
+ class Waas::Models::AccessRule # rubocop:disable Metrics/LineLength
10
+ ACTION_ENUM = [
11
+ ACTION_ALLOW = 'ALLOW'.freeze,
12
+ ACTION_DETECT = 'DETECT'.freeze,
13
+ ACTION_BLOCK = 'BLOCK'.freeze,
14
+ ACTION_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
15
+ ].freeze
16
+
17
+ BLOCK_ACTION_ENUM = [
18
+ BLOCK_ACTION_SET_RESPONSE_CODE = 'SET_RESPONSE_CODE'.freeze,
19
+ BLOCK_ACTION_SHOW_ERROR_PAGE = 'SHOW_ERROR_PAGE'.freeze,
20
+ BLOCK_ACTION_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
21
+ ].freeze
22
+
23
+ # **[Required]** The unique name of the access rule.
24
+ # @return [String]
25
+ attr_accessor :name
26
+
27
+ # **[Required]** The list of access rule criteria.
28
+ # @return [Array<OCI::Waas::Models::AccessRuleCriteria>]
29
+ attr_accessor :criteria
30
+
31
+ # **[Required]** The action to take when the access criteria are met for a rule. If unspecified, defaults to `ALLOW`.
32
+ # @return [String]
33
+ attr_reader :action
34
+
35
+ # The method used to block requests if `action` is set to `BLOCK` and the access criteria are met. If unspecified, defaults to `SET_RESPONSE_CODE`.
36
+ # @return [String]
37
+ attr_reader :block_action
38
+
39
+ # The response status code to return when `action` is set to `BLOCK`, `blockAction` is set to `SET_RESPONSE_CODE`, and the access criteria are met. If unspecified, defaults to `403`.
40
+ # @return [Integer]
41
+ attr_accessor :block_response_code
42
+
43
+ # The message to show on the error page when `action` is set to `BLOCK`, `blockAction` is set to `SHOW_ERROR_PAGE`, and the access criteria are met. If unspecified, defaults to 'Access to the website is blocked.'
44
+ # @return [String]
45
+ attr_accessor :block_error_page_message
46
+
47
+ # The error code to show on the error page when `action` is set to `BLOCK`, `blockAction` is set to `SHOW_ERROR_PAGE`, and the access criteria are met. If unspecified, defaults to 'Access rules'.
48
+ # @return [String]
49
+ attr_accessor :block_error_page_code
50
+
51
+ # The description text to show on the error page when `action` is set to `BLOCK`, `blockAction` is set to `SHOW_ERROR_PAGE`, and the access criteria are met. If unspecified, defaults to 'Access blocked by website owner. Please contact support.'
52
+ # @return [String]
53
+ attr_accessor :block_error_page_description
54
+
55
+ # Attribute mapping from ruby-style variable name to JSON key.
56
+ def self.attribute_map
57
+ {
58
+ # rubocop:disable Style/SymbolLiteral
59
+ 'name': :'name',
60
+ 'criteria': :'criteria',
61
+ 'action': :'action',
62
+ 'block_action': :'blockAction',
63
+ 'block_response_code': :'blockResponseCode',
64
+ 'block_error_page_message': :'blockErrorPageMessage',
65
+ 'block_error_page_code': :'blockErrorPageCode',
66
+ 'block_error_page_description': :'blockErrorPageDescription'
67
+ # rubocop:enable Style/SymbolLiteral
68
+ }
69
+ end
70
+
71
+ # Attribute type mapping.
72
+ def self.swagger_types
73
+ {
74
+ # rubocop:disable Style/SymbolLiteral
75
+ 'name': :'String',
76
+ 'criteria': :'Array<OCI::Waas::Models::AccessRuleCriteria>',
77
+ 'action': :'String',
78
+ 'block_action': :'String',
79
+ 'block_response_code': :'Integer',
80
+ 'block_error_page_message': :'String',
81
+ 'block_error_page_code': :'String',
82
+ 'block_error_page_description': :'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] :name The value to assign to the {#name} property
94
+ # @option attributes [Array<OCI::Waas::Models::AccessRuleCriteria>] :criteria The value to assign to the {#criteria} property
95
+ # @option attributes [String] :action The value to assign to the {#action} property
96
+ # @option attributes [String] :block_action The value to assign to the {#block_action} property
97
+ # @option attributes [Integer] :block_response_code The value to assign to the {#block_response_code} property
98
+ # @option attributes [String] :block_error_page_message The value to assign to the {#block_error_page_message} property
99
+ # @option attributes [String] :block_error_page_code The value to assign to the {#block_error_page_code} property
100
+ # @option attributes [String] :block_error_page_description The value to assign to the {#block_error_page_description} property
101
+ def initialize(attributes = {})
102
+ return unless attributes.is_a?(Hash)
103
+
104
+ # convert string to symbol for hash key
105
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
106
+
107
+ self.name = attributes[:'name'] if attributes[:'name']
108
+
109
+ self.criteria = attributes[:'criteria'] if attributes[:'criteria']
110
+
111
+ self.action = attributes[:'action'] if attributes[:'action']
112
+
113
+ self.block_action = attributes[:'blockAction'] if attributes[:'blockAction']
114
+
115
+ raise 'You cannot provide both :blockAction and :block_action' if attributes.key?(:'blockAction') && attributes.key?(:'block_action')
116
+
117
+ self.block_action = attributes[:'block_action'] if attributes[:'block_action']
118
+
119
+ self.block_response_code = attributes[:'blockResponseCode'] if attributes[:'blockResponseCode']
120
+
121
+ raise 'You cannot provide both :blockResponseCode and :block_response_code' if attributes.key?(:'blockResponseCode') && attributes.key?(:'block_response_code')
122
+
123
+ self.block_response_code = attributes[:'block_response_code'] if attributes[:'block_response_code']
124
+
125
+ self.block_error_page_message = attributes[:'blockErrorPageMessage'] if attributes[:'blockErrorPageMessage']
126
+
127
+ raise 'You cannot provide both :blockErrorPageMessage and :block_error_page_message' if attributes.key?(:'blockErrorPageMessage') && attributes.key?(:'block_error_page_message')
128
+
129
+ self.block_error_page_message = attributes[:'block_error_page_message'] if attributes[:'block_error_page_message']
130
+
131
+ self.block_error_page_code = attributes[:'blockErrorPageCode'] if attributes[:'blockErrorPageCode']
132
+
133
+ raise 'You cannot provide both :blockErrorPageCode and :block_error_page_code' if attributes.key?(:'blockErrorPageCode') && attributes.key?(:'block_error_page_code')
134
+
135
+ self.block_error_page_code = attributes[:'block_error_page_code'] if attributes[:'block_error_page_code']
136
+
137
+ self.block_error_page_description = attributes[:'blockErrorPageDescription'] if attributes[:'blockErrorPageDescription']
138
+
139
+ raise 'You cannot provide both :blockErrorPageDescription and :block_error_page_description' if attributes.key?(:'blockErrorPageDescription') && attributes.key?(:'block_error_page_description')
140
+
141
+ self.block_error_page_description = attributes[:'block_error_page_description'] if attributes[:'block_error_page_description']
142
+ end
143
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
144
+ # rubocop:enable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
145
+
146
+ # Custom attribute writer method checking allowed values (enum).
147
+ # @param [Object] action Object to be assigned
148
+ def action=(action)
149
+ # rubocop:disable Style/ConditionalAssignment
150
+ if action && !ACTION_ENUM.include?(action)
151
+ # rubocop: disable Metrics/LineLength
152
+ OCI.logger.debug("Unknown value for 'action' [" + action + "]. Mapping to 'ACTION_UNKNOWN_ENUM_VALUE'") if OCI.logger
153
+ # rubocop: enable Metrics/LineLength
154
+ @action = ACTION_UNKNOWN_ENUM_VALUE
155
+ else
156
+ @action = action
157
+ end
158
+ # rubocop:enable Style/ConditionalAssignment
159
+ end
160
+
161
+ # Custom attribute writer method checking allowed values (enum).
162
+ # @param [Object] block_action Object to be assigned
163
+ def block_action=(block_action)
164
+ # rubocop:disable Style/ConditionalAssignment
165
+ if block_action && !BLOCK_ACTION_ENUM.include?(block_action)
166
+ # rubocop: disable Metrics/LineLength
167
+ OCI.logger.debug("Unknown value for 'block_action' [" + block_action + "]. Mapping to 'BLOCK_ACTION_UNKNOWN_ENUM_VALUE'") if OCI.logger
168
+ # rubocop: enable Metrics/LineLength
169
+ @block_action = BLOCK_ACTION_UNKNOWN_ENUM_VALUE
170
+ else
171
+ @block_action = block_action
172
+ end
173
+ # rubocop:enable Style/ConditionalAssignment
174
+ end
175
+
176
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Metrics/LineLength, Layout/EmptyLines
177
+
178
+
179
+ # Checks equality by comparing each attribute.
180
+ # @param [Object] other the other object to be compared
181
+ def ==(other)
182
+ return true if equal?(other)
183
+
184
+ self.class == other.class &&
185
+ name == other.name &&
186
+ criteria == other.criteria &&
187
+ action == other.action &&
188
+ block_action == other.block_action &&
189
+ block_response_code == other.block_response_code &&
190
+ block_error_page_message == other.block_error_page_message &&
191
+ block_error_page_code == other.block_error_page_code &&
192
+ block_error_page_description == other.block_error_page_description
193
+ end
194
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Metrics/LineLength, Layout/EmptyLines
195
+
196
+ # @see the `==` method
197
+ # @param [Object] other the other object to be compared
198
+ def eql?(other)
199
+ self == other
200
+ end
201
+
202
+ # rubocop:disable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
203
+
204
+
205
+ # Calculates hash code according to all attributes.
206
+ # @return [Fixnum] Hash code
207
+ def hash
208
+ [name, criteria, action, block_action, block_response_code, block_error_page_message, block_error_page_code, block_error_page_description].hash
209
+ end
210
+ # rubocop:enable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
211
+
212
+ # rubocop:disable Metrics/AbcSize, Layout/EmptyLines
213
+
214
+
215
+ # Builds the object from hash
216
+ # @param [Hash] attributes Model attributes in the form of hash
217
+ # @return [Object] Returns the model itself
218
+ def build_from_hash(attributes)
219
+ return nil unless attributes.is_a?(Hash)
220
+
221
+ self.class.swagger_types.each_pair do |key, type|
222
+ if type =~ /^Array<(.*)>/i
223
+ # check to ensure the input is an array given that the the attribute
224
+ # is documented as an array but the input is not
225
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
226
+ public_method("#{key}=").call(
227
+ attributes[self.class.attribute_map[key]]
228
+ .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
229
+ )
230
+ end
231
+ elsif !attributes[self.class.attribute_map[key]].nil?
232
+ public_method("#{key}=").call(
233
+ OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
234
+ )
235
+ end
236
+ # or else data not found in attributes(hash), not an issue as the data can be optional
237
+ end
238
+
239
+ self
240
+ end
241
+ # rubocop:enable Metrics/AbcSize, Layout/EmptyLines
242
+
243
+ # Returns the string representation of the object
244
+ # @return [String] String presentation of the object
245
+ def to_s
246
+ to_hash.to_s
247
+ end
248
+
249
+ # Returns the object in the form of hash
250
+ # @return [Hash] Returns the object in the form of hash
251
+ def to_hash
252
+ hash = {}
253
+ self.class.attribute_map.each_pair do |attr, param|
254
+ value = public_method(attr).call
255
+ next if value.nil? && !instance_variable_defined?("@#{attr}")
256
+
257
+ hash[param] = _to_hash(value)
258
+ end
259
+ hash
260
+ end
261
+
262
+ private
263
+
264
+ # Outputs non-array value in the form of hash
265
+ # For object, use to_hash. Otherwise, just return the value
266
+ # @param [Object] value Any valid value
267
+ # @return [Hash] Returns the value in the form of hash
268
+ def _to_hash(value)
269
+ if value.is_a?(Array)
270
+ value.compact.map { |v| _to_hash(v) }
271
+ elsif value.is_a?(Hash)
272
+ {}.tap do |hash|
273
+ value.each { |k, v| hash[k] = _to_hash(v) }
274
+ end
275
+ elsif value.respond_to? :to_hash
276
+ value.to_hash
277
+ else
278
+ value
279
+ end
280
+ end
281
+ end
282
+ end
283
+ # rubocop:enable Lint/UnneededCopDisableDirective