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,14 @@
1
+ # Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
2
+
3
+ module OCI
4
+ module Waas::Models
5
+ LIFECYCLE_STATES_ENUM = [
6
+ LIFECYCLE_STATES_CREATING = 'CREATING'.freeze,
7
+ LIFECYCLE_STATES_ACTIVE = 'ACTIVE'.freeze,
8
+ LIFECYCLE_STATES_FAILED = 'FAILED'.freeze,
9
+ LIFECYCLE_STATES_UPDATING = 'UPDATING'.freeze,
10
+ LIFECYCLE_STATES_DELETING = 'DELETING'.freeze,
11
+ LIFECYCLE_STATES_DELETED = 'DELETED'.freeze
12
+ ].freeze
13
+ end
14
+ end
@@ -0,0 +1,191 @@
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 detailed description of your web application's origin host server. An origin must be defined to set up WAF rules.
8
+ class Waas::Models::Origin # rubocop:disable Metrics/LineLength
9
+ # **[Required]** The URI of the origin. Does not support paths. Port numbers should be specified in the `httpPort` and `httpsPort` fields.
10
+ # @return [String]
11
+ attr_accessor :uri
12
+
13
+ # The HTTP port on the origin that the web application listens on. If unspecified, defaults to `80`.
14
+ # @return [Integer]
15
+ attr_accessor :http_port
16
+
17
+ # The HTTPS port on the origin that the web application listens on. If unspecified, defaults to `443`.
18
+ # @return [Integer]
19
+ attr_accessor :https_port
20
+
21
+ # A list of HTTP headers to forward to your origin.
22
+ # @return [Array<OCI::Waas::Models::Header>]
23
+ attr_accessor :custom_headers
24
+
25
+ # Attribute mapping from ruby-style variable name to JSON key.
26
+ def self.attribute_map
27
+ {
28
+ # rubocop:disable Style/SymbolLiteral
29
+ 'uri': :'uri',
30
+ 'http_port': :'httpPort',
31
+ 'https_port': :'httpsPort',
32
+ 'custom_headers': :'customHeaders'
33
+ # rubocop:enable Style/SymbolLiteral
34
+ }
35
+ end
36
+
37
+ # Attribute type mapping.
38
+ def self.swagger_types
39
+ {
40
+ # rubocop:disable Style/SymbolLiteral
41
+ 'uri': :'String',
42
+ 'http_port': :'Integer',
43
+ 'https_port': :'Integer',
44
+ 'custom_headers': :'Array<OCI::Waas::Models::Header>'
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] :uri The value to assign to the {#uri} property
56
+ # @option attributes [Integer] :http_port The value to assign to the {#http_port} property
57
+ # @option attributes [Integer] :https_port The value to assign to the {#https_port} property
58
+ # @option attributes [Array<OCI::Waas::Models::Header>] :custom_headers The value to assign to the {#custom_headers} property
59
+ def initialize(attributes = {})
60
+ return unless attributes.is_a?(Hash)
61
+
62
+ # convert string to symbol for hash key
63
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
64
+
65
+ self.uri = attributes[:'uri'] if attributes[:'uri']
66
+
67
+ self.http_port = attributes[:'httpPort'] if attributes[:'httpPort']
68
+
69
+ raise 'You cannot provide both :httpPort and :http_port' if attributes.key?(:'httpPort') && attributes.key?(:'http_port')
70
+
71
+ self.http_port = attributes[:'http_port'] if attributes[:'http_port']
72
+
73
+ self.https_port = attributes[:'httpsPort'] if attributes[:'httpsPort']
74
+
75
+ raise 'You cannot provide both :httpsPort and :https_port' if attributes.key?(:'httpsPort') && attributes.key?(:'https_port')
76
+
77
+ self.https_port = attributes[:'https_port'] if attributes[:'https_port']
78
+
79
+ self.custom_headers = attributes[:'customHeaders'] if attributes[:'customHeaders']
80
+
81
+ raise 'You cannot provide both :customHeaders and :custom_headers' if attributes.key?(:'customHeaders') && attributes.key?(:'custom_headers')
82
+
83
+ self.custom_headers = attributes[:'custom_headers'] if attributes[:'custom_headers']
84
+ end
85
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
86
+ # rubocop:enable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
87
+
88
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Metrics/LineLength, Layout/EmptyLines
89
+
90
+
91
+ # Checks equality by comparing each attribute.
92
+ # @param [Object] other the other object to be compared
93
+ def ==(other)
94
+ return true if equal?(other)
95
+
96
+ self.class == other.class &&
97
+ uri == other.uri &&
98
+ http_port == other.http_port &&
99
+ https_port == other.https_port &&
100
+ custom_headers == other.custom_headers
101
+ end
102
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Metrics/LineLength, Layout/EmptyLines
103
+
104
+ # @see the `==` method
105
+ # @param [Object] other the other object to be compared
106
+ def eql?(other)
107
+ self == other
108
+ end
109
+
110
+ # rubocop:disable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
111
+
112
+
113
+ # Calculates hash code according to all attributes.
114
+ # @return [Fixnum] Hash code
115
+ def hash
116
+ [uri, http_port, https_port, custom_headers].hash
117
+ end
118
+ # rubocop:enable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
119
+
120
+ # rubocop:disable Metrics/AbcSize, Layout/EmptyLines
121
+
122
+
123
+ # Builds the object from hash
124
+ # @param [Hash] attributes Model attributes in the form of hash
125
+ # @return [Object] Returns the model itself
126
+ def build_from_hash(attributes)
127
+ return nil unless attributes.is_a?(Hash)
128
+
129
+ self.class.swagger_types.each_pair do |key, type|
130
+ if type =~ /^Array<(.*)>/i
131
+ # check to ensure the input is an array given that the the attribute
132
+ # is documented as an array but the input is not
133
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
134
+ public_method("#{key}=").call(
135
+ attributes[self.class.attribute_map[key]]
136
+ .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
137
+ )
138
+ end
139
+ elsif !attributes[self.class.attribute_map[key]].nil?
140
+ public_method("#{key}=").call(
141
+ OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
142
+ )
143
+ end
144
+ # or else data not found in attributes(hash), not an issue as the data can be optional
145
+ end
146
+
147
+ self
148
+ end
149
+ # rubocop:enable Metrics/AbcSize, Layout/EmptyLines
150
+
151
+ # Returns the string representation of the object
152
+ # @return [String] String presentation of the object
153
+ def to_s
154
+ to_hash.to_s
155
+ end
156
+
157
+ # Returns the object in the form of hash
158
+ # @return [Hash] Returns the object in the form of hash
159
+ def to_hash
160
+ hash = {}
161
+ self.class.attribute_map.each_pair do |attr, param|
162
+ value = public_method(attr).call
163
+ next if value.nil? && !instance_variable_defined?("@#{attr}")
164
+
165
+ hash[param] = _to_hash(value)
166
+ end
167
+ hash
168
+ end
169
+
170
+ private
171
+
172
+ # Outputs non-array value in the form of hash
173
+ # For object, use to_hash. Otherwise, just return the value
174
+ # @param [Object] value Any valid value
175
+ # @return [Hash] Returns the value in the form of hash
176
+ def _to_hash(value)
177
+ if value.is_a?(Array)
178
+ value.compact.map { |v| _to_hash(v) }
179
+ elsif value.is_a?(Hash)
180
+ {}.tap do |hash|
181
+ value.each { |k, v| hash[k] = _to_hash(v) }
182
+ end
183
+ elsif value.respond_to? :to_hash
184
+ value.to_hash
185
+ else
186
+ value
187
+ end
188
+ end
189
+ end
190
+ end
191
+ # rubocop:enable Lint/UnneededCopDisableDirective
@@ -0,0 +1,181 @@
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 configuration details for the WAAS policy.
8
+ class Waas::Models::PolicyConfig # rubocop:disable Metrics/LineLength
9
+ # The OCID of the SSL certificate to use if HTTPS is supported.
10
+ # @return [String]
11
+ attr_accessor :certificate_id
12
+
13
+ # Enable or disable HTTPS support. If true, a `certificateId` is required. If unspecified, defaults to `false`.
14
+ # @return [BOOLEAN]
15
+ attr_accessor :is_https_enabled
16
+
17
+ # Force HTTP to HTTPS redirection. If unspecified, defaults to `false`.
18
+ # @return [BOOLEAN]
19
+ attr_accessor :is_https_forced
20
+
21
+ # Attribute mapping from ruby-style variable name to JSON key.
22
+ def self.attribute_map
23
+ {
24
+ # rubocop:disable Style/SymbolLiteral
25
+ 'certificate_id': :'certificateId',
26
+ 'is_https_enabled': :'isHttpsEnabled',
27
+ 'is_https_forced': :'isHttpsForced'
28
+ # rubocop:enable Style/SymbolLiteral
29
+ }
30
+ end
31
+
32
+ # Attribute type mapping.
33
+ def self.swagger_types
34
+ {
35
+ # rubocop:disable Style/SymbolLiteral
36
+ 'certificate_id': :'String',
37
+ 'is_https_enabled': :'BOOLEAN',
38
+ 'is_https_forced': :'BOOLEAN'
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] :certificate_id The value to assign to the {#certificate_id} property
50
+ # @option attributes [BOOLEAN] :is_https_enabled The value to assign to the {#is_https_enabled} property
51
+ # @option attributes [BOOLEAN] :is_https_forced The value to assign to the {#is_https_forced} property
52
+ def initialize(attributes = {})
53
+ return unless attributes.is_a?(Hash)
54
+
55
+ # convert string to symbol for hash key
56
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
57
+
58
+ self.certificate_id = attributes[:'certificateId'] if attributes[:'certificateId']
59
+
60
+ raise 'You cannot provide both :certificateId and :certificate_id' if attributes.key?(:'certificateId') && attributes.key?(:'certificate_id')
61
+
62
+ self.certificate_id = attributes[:'certificate_id'] if attributes[:'certificate_id']
63
+
64
+ self.is_https_enabled = attributes[:'isHttpsEnabled'] unless attributes[:'isHttpsEnabled'].nil?
65
+
66
+ raise 'You cannot provide both :isHttpsEnabled and :is_https_enabled' if attributes.key?(:'isHttpsEnabled') && attributes.key?(:'is_https_enabled')
67
+
68
+ self.is_https_enabled = attributes[:'is_https_enabled'] unless attributes[:'is_https_enabled'].nil?
69
+
70
+ self.is_https_forced = attributes[:'isHttpsForced'] unless attributes[:'isHttpsForced'].nil?
71
+
72
+ raise 'You cannot provide both :isHttpsForced and :is_https_forced' if attributes.key?(:'isHttpsForced') && attributes.key?(:'is_https_forced')
73
+
74
+ self.is_https_forced = attributes[:'is_https_forced'] unless attributes[:'is_https_forced'].nil?
75
+ end
76
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
77
+ # rubocop:enable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
78
+
79
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Metrics/LineLength, Layout/EmptyLines
80
+
81
+
82
+ # Checks equality by comparing each attribute.
83
+ # @param [Object] other the other object to be compared
84
+ def ==(other)
85
+ return true if equal?(other)
86
+
87
+ self.class == other.class &&
88
+ certificate_id == other.certificate_id &&
89
+ is_https_enabled == other.is_https_enabled &&
90
+ is_https_forced == other.is_https_forced
91
+ end
92
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Metrics/LineLength, Layout/EmptyLines
93
+
94
+ # @see the `==` method
95
+ # @param [Object] other the other object to be compared
96
+ def eql?(other)
97
+ self == other
98
+ end
99
+
100
+ # rubocop:disable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
101
+
102
+
103
+ # Calculates hash code according to all attributes.
104
+ # @return [Fixnum] Hash code
105
+ def hash
106
+ [certificate_id, is_https_enabled, is_https_forced].hash
107
+ end
108
+ # rubocop:enable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
109
+
110
+ # rubocop:disable Metrics/AbcSize, Layout/EmptyLines
111
+
112
+
113
+ # Builds the object from hash
114
+ # @param [Hash] attributes Model attributes in the form of hash
115
+ # @return [Object] Returns the model itself
116
+ def build_from_hash(attributes)
117
+ return nil unless attributes.is_a?(Hash)
118
+
119
+ self.class.swagger_types.each_pair do |key, type|
120
+ if type =~ /^Array<(.*)>/i
121
+ # check to ensure the input is an array given that the the attribute
122
+ # is documented as an array but the input is not
123
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
124
+ public_method("#{key}=").call(
125
+ attributes[self.class.attribute_map[key]]
126
+ .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
127
+ )
128
+ end
129
+ elsif !attributes[self.class.attribute_map[key]].nil?
130
+ public_method("#{key}=").call(
131
+ OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
132
+ )
133
+ end
134
+ # or else data not found in attributes(hash), not an issue as the data can be optional
135
+ end
136
+
137
+ self
138
+ end
139
+ # rubocop:enable Metrics/AbcSize, Layout/EmptyLines
140
+
141
+ # Returns the string representation of the object
142
+ # @return [String] String presentation of the object
143
+ def to_s
144
+ to_hash.to_s
145
+ end
146
+
147
+ # Returns the object in the form of hash
148
+ # @return [Hash] Returns the object in the form of hash
149
+ def to_hash
150
+ hash = {}
151
+ self.class.attribute_map.each_pair do |attr, param|
152
+ value = public_method(attr).call
153
+ next if value.nil? && !instance_variable_defined?("@#{attr}")
154
+
155
+ hash[param] = _to_hash(value)
156
+ end
157
+ hash
158
+ end
159
+
160
+ private
161
+
162
+ # Outputs non-array value in the form of hash
163
+ # For object, use to_hash. Otherwise, just return the value
164
+ # @param [Object] value Any valid value
165
+ # @return [Hash] Returns the value in the form of hash
166
+ def _to_hash(value)
167
+ if value.is_a?(Array)
168
+ value.compact.map { |v| _to_hash(v) }
169
+ elsif value.is_a?(Hash)
170
+ {}.tap do |hash|
171
+ value.each { |k, v| hash[k] = _to_hash(v) }
172
+ end
173
+ elsif value.respond_to? :to_hash
174
+ value.to_hash
175
+ else
176
+ value
177
+ end
178
+ end
179
+ end
180
+ end
181
+ # rubocop:enable Lint/UnneededCopDisableDirective
@@ -0,0 +1,237 @@
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 protection rule settings. Protection rules can allow, block, or trigger an alert if a request meets the parameters of an applied rule.
9
+ class Waas::Models::ProtectionRule # 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 protection rule.
18
+ # @return [String]
19
+ attr_accessor :key
20
+
21
+ # The list of the ModSecurity rule IDs that apply to this protection rule. For more information about ModSecurity's open source WAF rules, see [Mod Security's documentation](https://www.modsecurity.org/CRS/Documentation/index.html).
22
+ # @return [Array<String>]
23
+ attr_accessor :mod_security_rule_ids
24
+
25
+ # The name of the protection rule.
26
+ # @return [String]
27
+ attr_accessor :name
28
+
29
+ # The description of the protection rule.
30
+ # @return [String]
31
+ attr_accessor :description
32
+
33
+ # The action to take when the traffic is detected as malicious. If unspecified, defaults to `OFF`.
34
+ # @return [String]
35
+ attr_reader :action
36
+
37
+ # The list of labels for the protection rule.
38
+ #
39
+ # **Note:** Protection rules with a `ResponseBody` label will have no effect unless `isResponseInspected` is true.
40
+ # @return [Array<String>]
41
+ attr_accessor :labels
42
+
43
+ # @return [Array<OCI::Waas::Models::ProtectionRuleExclusion>]
44
+ attr_accessor :exclusions
45
+
46
+ # Attribute mapping from ruby-style variable name to JSON key.
47
+ def self.attribute_map
48
+ {
49
+ # rubocop:disable Style/SymbolLiteral
50
+ 'key': :'key',
51
+ 'mod_security_rule_ids': :'modSecurityRuleIds',
52
+ 'name': :'name',
53
+ 'description': :'description',
54
+ 'action': :'action',
55
+ 'labels': :'labels',
56
+ 'exclusions': :'exclusions'
57
+ # rubocop:enable Style/SymbolLiteral
58
+ }
59
+ end
60
+
61
+ # Attribute type mapping.
62
+ def self.swagger_types
63
+ {
64
+ # rubocop:disable Style/SymbolLiteral
65
+ 'key': :'String',
66
+ 'mod_security_rule_ids': :'Array<String>',
67
+ 'name': :'String',
68
+ 'description': :'String',
69
+ 'action': :'String',
70
+ 'labels': :'Array<String>',
71
+ 'exclusions': :'Array<OCI::Waas::Models::ProtectionRuleExclusion>'
72
+ # rubocop:enable Style/SymbolLiteral
73
+ }
74
+ end
75
+
76
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
77
+ # rubocop:disable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
78
+
79
+
80
+ # Initializes the object
81
+ # @param [Hash] attributes Model attributes in the form of hash
82
+ # @option attributes [String] :key The value to assign to the {#key} property
83
+ # @option attributes [Array<String>] :mod_security_rule_ids The value to assign to the {#mod_security_rule_ids} property
84
+ # @option attributes [String] :name The value to assign to the {#name} property
85
+ # @option attributes [String] :description The value to assign to the {#description} property
86
+ # @option attributes [String] :action The value to assign to the {#action} property
87
+ # @option attributes [Array<String>] :labels The value to assign to the {#labels} property
88
+ # @option attributes [Array<OCI::Waas::Models::ProtectionRuleExclusion>] :exclusions The value to assign to the {#exclusions} property
89
+ def initialize(attributes = {})
90
+ return unless attributes.is_a?(Hash)
91
+
92
+ # convert string to symbol for hash key
93
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
94
+
95
+ self.key = attributes[:'key'] if attributes[:'key']
96
+
97
+ self.mod_security_rule_ids = attributes[:'modSecurityRuleIds'] if attributes[:'modSecurityRuleIds']
98
+
99
+ raise 'You cannot provide both :modSecurityRuleIds and :mod_security_rule_ids' if attributes.key?(:'modSecurityRuleIds') && attributes.key?(:'mod_security_rule_ids')
100
+
101
+ self.mod_security_rule_ids = attributes[:'mod_security_rule_ids'] if attributes[:'mod_security_rule_ids']
102
+
103
+ self.name = attributes[:'name'] if attributes[:'name']
104
+
105
+ self.description = attributes[:'description'] if attributes[:'description']
106
+
107
+ self.action = attributes[:'action'] if attributes[:'action']
108
+
109
+ self.labels = attributes[:'labels'] if attributes[:'labels']
110
+
111
+ self.exclusions = attributes[:'exclusions'] if attributes[:'exclusions']
112
+ end
113
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
114
+ # rubocop:enable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
115
+
116
+ # Custom attribute writer method checking allowed values (enum).
117
+ # @param [Object] action Object to be assigned
118
+ def action=(action)
119
+ # rubocop:disable Style/ConditionalAssignment
120
+ if action && !ACTION_ENUM.include?(action)
121
+ # rubocop: disable Metrics/LineLength
122
+ OCI.logger.debug("Unknown value for 'action' [" + action + "]. Mapping to 'ACTION_UNKNOWN_ENUM_VALUE'") if OCI.logger
123
+ # rubocop: enable Metrics/LineLength
124
+ @action = ACTION_UNKNOWN_ENUM_VALUE
125
+ else
126
+ @action = action
127
+ end
128
+ # rubocop:enable Style/ConditionalAssignment
129
+ end
130
+
131
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Metrics/LineLength, Layout/EmptyLines
132
+
133
+
134
+ # Checks equality by comparing each attribute.
135
+ # @param [Object] other the other object to be compared
136
+ def ==(other)
137
+ return true if equal?(other)
138
+
139
+ self.class == other.class &&
140
+ key == other.key &&
141
+ mod_security_rule_ids == other.mod_security_rule_ids &&
142
+ name == other.name &&
143
+ description == other.description &&
144
+ action == other.action &&
145
+ labels == other.labels &&
146
+ exclusions == other.exclusions
147
+ end
148
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Metrics/LineLength, Layout/EmptyLines
149
+
150
+ # @see the `==` method
151
+ # @param [Object] other the other object to be compared
152
+ def eql?(other)
153
+ self == other
154
+ end
155
+
156
+ # rubocop:disable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
157
+
158
+
159
+ # Calculates hash code according to all attributes.
160
+ # @return [Fixnum] Hash code
161
+ def hash
162
+ [key, mod_security_rule_ids, name, description, action, labels, exclusions].hash
163
+ end
164
+ # rubocop:enable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
165
+
166
+ # rubocop:disable Metrics/AbcSize, Layout/EmptyLines
167
+
168
+
169
+ # Builds the object from hash
170
+ # @param [Hash] attributes Model attributes in the form of hash
171
+ # @return [Object] Returns the model itself
172
+ def build_from_hash(attributes)
173
+ return nil unless attributes.is_a?(Hash)
174
+
175
+ self.class.swagger_types.each_pair do |key, type|
176
+ if type =~ /^Array<(.*)>/i
177
+ # check to ensure the input is an array given that the the attribute
178
+ # is documented as an array but the input is not
179
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
180
+ public_method("#{key}=").call(
181
+ attributes[self.class.attribute_map[key]]
182
+ .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
183
+ )
184
+ end
185
+ elsif !attributes[self.class.attribute_map[key]].nil?
186
+ public_method("#{key}=").call(
187
+ OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
188
+ )
189
+ end
190
+ # or else data not found in attributes(hash), not an issue as the data can be optional
191
+ end
192
+
193
+ self
194
+ end
195
+ # rubocop:enable Metrics/AbcSize, Layout/EmptyLines
196
+
197
+ # Returns the string representation of the object
198
+ # @return [String] String presentation of the object
199
+ def to_s
200
+ to_hash.to_s
201
+ end
202
+
203
+ # Returns the object in the form of hash
204
+ # @return [Hash] Returns the object in the form of hash
205
+ def to_hash
206
+ hash = {}
207
+ self.class.attribute_map.each_pair do |attr, param|
208
+ value = public_method(attr).call
209
+ next if value.nil? && !instance_variable_defined?("@#{attr}")
210
+
211
+ hash[param] = _to_hash(value)
212
+ end
213
+ hash
214
+ end
215
+
216
+ private
217
+
218
+ # Outputs non-array value in the form of hash
219
+ # For object, use to_hash. Otherwise, just return the value
220
+ # @param [Object] value Any valid value
221
+ # @return [Hash] Returns the value in the form of hash
222
+ def _to_hash(value)
223
+ if value.is_a?(Array)
224
+ value.compact.map { |v| _to_hash(v) }
225
+ elsif value.is_a?(Hash)
226
+ {}.tap do |hash|
227
+ value.each { |k, v| hash[k] = _to_hash(v) }
228
+ end
229
+ elsif value.respond_to? :to_hash
230
+ value.to_hash
231
+ else
232
+ value
233
+ end
234
+ end
235
+ end
236
+ end
237
+ # rubocop:enable Lint/UnneededCopDisableDirective