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,210 @@
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 recommended protection rule for a web application. This recommendation can be accepted to apply it to the Web Application Firewall configuration for this policy.
8
+ #
9
+ # Use the `POST /waasPolicies/{waasPolicyId}/actions/acceptWafConfigRecommendations` method to accept recommended protection rules.
10
+ class Waas::Models::Recommendation # rubocop:disable Metrics/LineLength
11
+ # The unique key for the recommended protection rule.
12
+ # @return [String]
13
+ attr_accessor :key
14
+
15
+ # The list of the ModSecurity rule IDs associated with the protection rule.
16
+ # For more information about ModSecurity's open source WAF rules, see [Mod Security's documentation](https://www.modsecurity.org/CRS/Documentation/index.html).
17
+ # @return [Array<String>]
18
+ attr_accessor :mod_security_rule_ids
19
+
20
+ # The name of the recommended protection rule.
21
+ # @return [String]
22
+ attr_accessor :name
23
+
24
+ # The description of the recommended protection rule.
25
+ # @return [String]
26
+ attr_accessor :description
27
+
28
+ # The list of labels for the recommended protection rule.
29
+ # @return [Array<String>]
30
+ attr_accessor :labels
31
+
32
+ # The recommended action to apply to the protection rule.
33
+ # @return [String]
34
+ attr_accessor :recommended_action
35
+
36
+ # Attribute mapping from ruby-style variable name to JSON key.
37
+ def self.attribute_map
38
+ {
39
+ # rubocop:disable Style/SymbolLiteral
40
+ 'key': :'key',
41
+ 'mod_security_rule_ids': :'modSecurityRuleIds',
42
+ 'name': :'name',
43
+ 'description': :'description',
44
+ 'labels': :'labels',
45
+ 'recommended_action': :'recommendedAction'
46
+ # rubocop:enable Style/SymbolLiteral
47
+ }
48
+ end
49
+
50
+ # Attribute type mapping.
51
+ def self.swagger_types
52
+ {
53
+ # rubocop:disable Style/SymbolLiteral
54
+ 'key': :'String',
55
+ 'mod_security_rule_ids': :'Array<String>',
56
+ 'name': :'String',
57
+ 'description': :'String',
58
+ 'labels': :'Array<String>',
59
+ 'recommended_action': :'String'
60
+ # rubocop:enable Style/SymbolLiteral
61
+ }
62
+ end
63
+
64
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
65
+ # rubocop:disable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
66
+
67
+
68
+ # Initializes the object
69
+ # @param [Hash] attributes Model attributes in the form of hash
70
+ # @option attributes [String] :key The value to assign to the {#key} property
71
+ # @option attributes [Array<String>] :mod_security_rule_ids The value to assign to the {#mod_security_rule_ids} property
72
+ # @option attributes [String] :name The value to assign to the {#name} property
73
+ # @option attributes [String] :description The value to assign to the {#description} property
74
+ # @option attributes [Array<String>] :labels The value to assign to the {#labels} property
75
+ # @option attributes [String] :recommended_action The value to assign to the {#recommended_action} property
76
+ def initialize(attributes = {})
77
+ return unless attributes.is_a?(Hash)
78
+
79
+ # convert string to symbol for hash key
80
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
81
+
82
+ self.key = attributes[:'key'] if attributes[:'key']
83
+
84
+ self.mod_security_rule_ids = attributes[:'modSecurityRuleIds'] if attributes[:'modSecurityRuleIds']
85
+
86
+ raise 'You cannot provide both :modSecurityRuleIds and :mod_security_rule_ids' if attributes.key?(:'modSecurityRuleIds') && attributes.key?(:'mod_security_rule_ids')
87
+
88
+ self.mod_security_rule_ids = attributes[:'mod_security_rule_ids'] if attributes[:'mod_security_rule_ids']
89
+
90
+ self.name = attributes[:'name'] if attributes[:'name']
91
+
92
+ self.description = attributes[:'description'] if attributes[:'description']
93
+
94
+ self.labels = attributes[:'labels'] if attributes[:'labels']
95
+
96
+ self.recommended_action = attributes[:'recommendedAction'] if attributes[:'recommendedAction']
97
+
98
+ raise 'You cannot provide both :recommendedAction and :recommended_action' if attributes.key?(:'recommendedAction') && attributes.key?(:'recommended_action')
99
+
100
+ self.recommended_action = attributes[:'recommended_action'] if attributes[:'recommended_action']
101
+ end
102
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
103
+ # rubocop:enable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
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
+ key == other.key &&
115
+ mod_security_rule_ids == other.mod_security_rule_ids &&
116
+ name == other.name &&
117
+ description == other.description &&
118
+ labels == other.labels &&
119
+ recommended_action == other.recommended_action
120
+ end
121
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Metrics/LineLength, Layout/EmptyLines
122
+
123
+ # @see the `==` method
124
+ # @param [Object] other the other object to be compared
125
+ def eql?(other)
126
+ self == other
127
+ end
128
+
129
+ # rubocop:disable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
130
+
131
+
132
+ # Calculates hash code according to all attributes.
133
+ # @return [Fixnum] Hash code
134
+ def hash
135
+ [key, mod_security_rule_ids, name, description, labels, recommended_action].hash
136
+ end
137
+ # rubocop:enable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
138
+
139
+ # rubocop:disable Metrics/AbcSize, Layout/EmptyLines
140
+
141
+
142
+ # Builds the object from hash
143
+ # @param [Hash] attributes Model attributes in the form of hash
144
+ # @return [Object] Returns the model itself
145
+ def build_from_hash(attributes)
146
+ return nil unless attributes.is_a?(Hash)
147
+
148
+ self.class.swagger_types.each_pair do |key, type|
149
+ if type =~ /^Array<(.*)>/i
150
+ # check to ensure the input is an array given that the the attribute
151
+ # is documented as an array but the input is not
152
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
153
+ public_method("#{key}=").call(
154
+ attributes[self.class.attribute_map[key]]
155
+ .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
156
+ )
157
+ end
158
+ elsif !attributes[self.class.attribute_map[key]].nil?
159
+ public_method("#{key}=").call(
160
+ OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
161
+ )
162
+ end
163
+ # or else data not found in attributes(hash), not an issue as the data can be optional
164
+ end
165
+
166
+ self
167
+ end
168
+ # rubocop:enable Metrics/AbcSize, Layout/EmptyLines
169
+
170
+ # Returns the string representation of the object
171
+ # @return [String] String presentation of the object
172
+ def to_s
173
+ to_hash.to_s
174
+ end
175
+
176
+ # Returns the object in the form of hash
177
+ # @return [Hash] Returns the object in the form of hash
178
+ def to_hash
179
+ hash = {}
180
+ self.class.attribute_map.each_pair do |attr, param|
181
+ value = public_method(attr).call
182
+ next if value.nil? && !instance_variable_defined?("@#{attr}")
183
+
184
+ hash[param] = _to_hash(value)
185
+ end
186
+ hash
187
+ end
188
+
189
+ private
190
+
191
+ # Outputs non-array value in the form of hash
192
+ # For object, use to_hash. Otherwise, just return the value
193
+ # @param [Object] value Any valid value
194
+ # @return [Hash] Returns the value in the form of hash
195
+ def _to_hash(value)
196
+ if value.is_a?(Array)
197
+ value.compact.map { |v| _to_hash(v) }
198
+ elsif value.is_a?(Hash)
199
+ {}.tap do |hash|
200
+ value.each { |k, v| hash[k] = _to_hash(v) }
201
+ end
202
+ elsif value.respond_to? :to_hash
203
+ value.to_hash
204
+ else
205
+ value
206
+ end
207
+ end
208
+ end
209
+ end
210
+ # rubocop:enable Lint/UnneededCopDisableDirective
@@ -0,0 +1,202 @@
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 of the threat intelligence feed. You can block requests from IP addresses based on their reputations with various commercial and open source threat feeds.
9
+ class Waas::Models::ThreatFeed # rubocop:disable Metrics/LineLength
10
+ ACTION_ENUM = [
11
+ ACTION_OFF = 'OFF'.freeze,
12
+ ACTION_DETECT = 'DETECT'.freeze,
13
+ ACTION_BLOCK = 'BLOCK'.freeze,
14
+ ACTION_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
15
+ ].freeze
16
+
17
+ # The unique key of the threat intelligence feed.
18
+ # @return [String]
19
+ attr_accessor :key
20
+
21
+ # The name of the threat intelligence feed.
22
+ # @return [String]
23
+ attr_accessor :name
24
+
25
+ # The action to take when traffic is flagged as malicious by data from the threat intelligence feed. If unspecified, defaults to `OFF`.
26
+ # @return [String]
27
+ attr_reader :action
28
+
29
+ # The description of the threat intelligence feed.
30
+ # @return [String]
31
+ attr_accessor :description
32
+
33
+ # Attribute mapping from ruby-style variable name to JSON key.
34
+ def self.attribute_map
35
+ {
36
+ # rubocop:disable Style/SymbolLiteral
37
+ 'key': :'key',
38
+ 'name': :'name',
39
+ 'action': :'action',
40
+ 'description': :'description'
41
+ # rubocop:enable Style/SymbolLiteral
42
+ }
43
+ end
44
+
45
+ # Attribute type mapping.
46
+ def self.swagger_types
47
+ {
48
+ # rubocop:disable Style/SymbolLiteral
49
+ 'key': :'String',
50
+ 'name': :'String',
51
+ 'action': :'String',
52
+ 'description': :'String'
53
+ # rubocop:enable Style/SymbolLiteral
54
+ }
55
+ end
56
+
57
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
58
+ # rubocop:disable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
59
+
60
+
61
+ # Initializes the object
62
+ # @param [Hash] attributes Model attributes in the form of hash
63
+ # @option attributes [String] :key The value to assign to the {#key} property
64
+ # @option attributes [String] :name The value to assign to the {#name} property
65
+ # @option attributes [String] :action The value to assign to the {#action} property
66
+ # @option attributes [String] :description The value to assign to the {#description} property
67
+ def initialize(attributes = {})
68
+ return unless attributes.is_a?(Hash)
69
+
70
+ # convert string to symbol for hash key
71
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
72
+
73
+ self.key = attributes[:'key'] if attributes[:'key']
74
+
75
+ self.name = attributes[:'name'] if attributes[:'name']
76
+
77
+ self.action = attributes[:'action'] if attributes[:'action']
78
+
79
+ self.description = attributes[:'description'] if attributes[:'description']
80
+ end
81
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
82
+ # rubocop:enable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
83
+
84
+ # Custom attribute writer method checking allowed values (enum).
85
+ # @param [Object] action Object to be assigned
86
+ def action=(action)
87
+ # rubocop:disable Style/ConditionalAssignment
88
+ if action && !ACTION_ENUM.include?(action)
89
+ # rubocop: disable Metrics/LineLength
90
+ OCI.logger.debug("Unknown value for 'action' [" + action + "]. Mapping to 'ACTION_UNKNOWN_ENUM_VALUE'") if OCI.logger
91
+ # rubocop: enable Metrics/LineLength
92
+ @action = ACTION_UNKNOWN_ENUM_VALUE
93
+ else
94
+ @action = action
95
+ end
96
+ # rubocop:enable Style/ConditionalAssignment
97
+ end
98
+
99
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Metrics/LineLength, Layout/EmptyLines
100
+
101
+
102
+ # Checks equality by comparing each attribute.
103
+ # @param [Object] other the other object to be compared
104
+ def ==(other)
105
+ return true if equal?(other)
106
+
107
+ self.class == other.class &&
108
+ key == other.key &&
109
+ name == other.name &&
110
+ action == other.action &&
111
+ description == other.description
112
+ end
113
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Metrics/LineLength, Layout/EmptyLines
114
+
115
+ # @see the `==` method
116
+ # @param [Object] other the other object to be compared
117
+ def eql?(other)
118
+ self == other
119
+ end
120
+
121
+ # rubocop:disable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
122
+
123
+
124
+ # Calculates hash code according to all attributes.
125
+ # @return [Fixnum] Hash code
126
+ def hash
127
+ [key, name, action, description].hash
128
+ end
129
+ # rubocop:enable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
130
+
131
+ # rubocop:disable Metrics/AbcSize, Layout/EmptyLines
132
+
133
+
134
+ # Builds the object from hash
135
+ # @param [Hash] attributes Model attributes in the form of hash
136
+ # @return [Object] Returns the model itself
137
+ def build_from_hash(attributes)
138
+ return nil unless attributes.is_a?(Hash)
139
+
140
+ self.class.swagger_types.each_pair do |key, type|
141
+ if type =~ /^Array<(.*)>/i
142
+ # check to ensure the input is an array given that the the attribute
143
+ # is documented as an array but the input is not
144
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
145
+ public_method("#{key}=").call(
146
+ attributes[self.class.attribute_map[key]]
147
+ .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
148
+ )
149
+ end
150
+ elsif !attributes[self.class.attribute_map[key]].nil?
151
+ public_method("#{key}=").call(
152
+ OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
153
+ )
154
+ end
155
+ # or else data not found in attributes(hash), not an issue as the data can be optional
156
+ end
157
+
158
+ self
159
+ end
160
+ # rubocop:enable Metrics/AbcSize, Layout/EmptyLines
161
+
162
+ # Returns the string representation of the object
163
+ # @return [String] String presentation of the object
164
+ def to_s
165
+ to_hash.to_s
166
+ end
167
+
168
+ # Returns the object in the form of hash
169
+ # @return [Hash] Returns the object in the form of hash
170
+ def to_hash
171
+ hash = {}
172
+ self.class.attribute_map.each_pair do |attr, param|
173
+ value = public_method(attr).call
174
+ next if value.nil? && !instance_variable_defined?("@#{attr}")
175
+
176
+ hash[param] = _to_hash(value)
177
+ end
178
+ hash
179
+ end
180
+
181
+ private
182
+
183
+ # Outputs non-array value in the form of hash
184
+ # For object, use to_hash. Otherwise, just return the value
185
+ # @param [Object] value Any valid value
186
+ # @return [Hash] Returns the value in the form of hash
187
+ def _to_hash(value)
188
+ if value.is_a?(Array)
189
+ value.compact.map { |v| _to_hash(v) }
190
+ elsif value.is_a?(Hash)
191
+ {}.tap do |hash|
192
+ value.each { |k, v| hash[k] = _to_hash(v) }
193
+ end
194
+ elsif value.respond_to? :to_hash
195
+ value.to_hash
196
+ else
197
+ value
198
+ end
199
+ end
200
+ end
201
+ end
202
+ # rubocop:enable Lint/UnneededCopDisableDirective
@@ -0,0 +1,175 @@
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 action to take for a request that has been determined to be potentially malicious.
8
+ class Waas::Models::ThreatFeedAction # 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 object for which the action applies.
16
+ # @return [String]
17
+ attr_accessor :key
18
+
19
+ # **[Required]** The selected action. If unspecified, defaults to `OFF`.
20
+ # @return [String]
21
+ attr_reader :action
22
+
23
+ # Attribute mapping from ruby-style variable name to JSON key.
24
+ def self.attribute_map
25
+ {
26
+ # rubocop:disable Style/SymbolLiteral
27
+ 'key': :'key',
28
+ 'action': :'action'
29
+ # rubocop:enable Style/SymbolLiteral
30
+ }
31
+ end
32
+
33
+ # Attribute type mapping.
34
+ def self.swagger_types
35
+ {
36
+ # rubocop:disable Style/SymbolLiteral
37
+ 'key': :'String',
38
+ 'action': :'String'
39
+ # rubocop:enable Style/SymbolLiteral
40
+ }
41
+ end
42
+
43
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
44
+ # rubocop:disable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
45
+
46
+
47
+ # Initializes the object
48
+ # @param [Hash] attributes Model attributes in the form of hash
49
+ # @option attributes [String] :key The value to assign to the {#key} property
50
+ # @option attributes [String] :action The value to assign to the {#action} property
51
+ def initialize(attributes = {})
52
+ return unless attributes.is_a?(Hash)
53
+
54
+ # convert string to symbol for hash key
55
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
56
+
57
+ self.key = attributes[:'key'] if attributes[:'key']
58
+
59
+ self.action = attributes[:'action'] if attributes[:'action']
60
+ end
61
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
62
+ # rubocop:enable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
63
+
64
+ # Custom attribute writer method checking allowed values (enum).
65
+ # @param [Object] action Object to be assigned
66
+ def action=(action)
67
+ # rubocop: disable Metrics/LineLength
68
+ raise "Invalid value for 'action': this must be one of the values in ACTION_ENUM." if action && !ACTION_ENUM.include?(action)
69
+
70
+ # rubocop: enable Metrics/LineLength
71
+ @action = action
72
+ end
73
+
74
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Metrics/LineLength, Layout/EmptyLines
75
+
76
+
77
+ # Checks equality by comparing each attribute.
78
+ # @param [Object] other the other object to be compared
79
+ def ==(other)
80
+ return true if equal?(other)
81
+
82
+ self.class == other.class &&
83
+ key == other.key &&
84
+ action == other.action
85
+ end
86
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Metrics/LineLength, Layout/EmptyLines
87
+
88
+ # @see the `==` method
89
+ # @param [Object] other the other object to be compared
90
+ def eql?(other)
91
+ self == other
92
+ end
93
+
94
+ # rubocop:disable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
95
+
96
+
97
+ # Calculates hash code according to all attributes.
98
+ # @return [Fixnum] Hash code
99
+ def hash
100
+ [key, action].hash
101
+ end
102
+ # rubocop:enable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
103
+
104
+ # rubocop:disable Metrics/AbcSize, Layout/EmptyLines
105
+
106
+
107
+ # Builds the object from hash
108
+ # @param [Hash] attributes Model attributes in the form of hash
109
+ # @return [Object] Returns the model itself
110
+ def build_from_hash(attributes)
111
+ return nil unless attributes.is_a?(Hash)
112
+
113
+ self.class.swagger_types.each_pair do |key, type|
114
+ if type =~ /^Array<(.*)>/i
115
+ # check to ensure the input is an array given that the the attribute
116
+ # is documented as an array but the input is not
117
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
118
+ public_method("#{key}=").call(
119
+ attributes[self.class.attribute_map[key]]
120
+ .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
121
+ )
122
+ end
123
+ elsif !attributes[self.class.attribute_map[key]].nil?
124
+ public_method("#{key}=").call(
125
+ OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
126
+ )
127
+ end
128
+ # or else data not found in attributes(hash), not an issue as the data can be optional
129
+ end
130
+
131
+ self
132
+ end
133
+ # rubocop:enable Metrics/AbcSize, Layout/EmptyLines
134
+
135
+ # Returns the string representation of the object
136
+ # @return [String] String presentation of the object
137
+ def to_s
138
+ to_hash.to_s
139
+ end
140
+
141
+ # Returns the object in the form of hash
142
+ # @return [Hash] Returns the object in the form of hash
143
+ def to_hash
144
+ hash = {}
145
+ self.class.attribute_map.each_pair do |attr, param|
146
+ value = public_method(attr).call
147
+ next if value.nil? && !instance_variable_defined?("@#{attr}")
148
+
149
+ hash[param] = _to_hash(value)
150
+ end
151
+ hash
152
+ end
153
+
154
+ private
155
+
156
+ # Outputs non-array value in the form of hash
157
+ # For object, use to_hash. Otherwise, just return the value
158
+ # @param [Object] value Any valid value
159
+ # @return [Hash] Returns the value in the form of hash
160
+ def _to_hash(value)
161
+ if value.is_a?(Array)
162
+ value.compact.map { |v| _to_hash(v) }
163
+ elsif value.is_a?(Hash)
164
+ {}.tap do |hash|
165
+ value.each { |k, v| hash[k] = _to_hash(v) }
166
+ end
167
+ elsif value.respond_to? :to_hash
168
+ value.to_hash
169
+ else
170
+ value
171
+ end
172
+ end
173
+ end
174
+ end
175
+ # rubocop:enable Lint/UnneededCopDisableDirective