# This is an automatically generated code sample.
# To make this code sample work in your Oracle Cloud tenancy,
# please replace the values for any parameters whose current values do not fit
# your use case (such as resource IDs, strings containing ‘EXAMPLE’ or ‘unique_id’, and
# boolean, number, and enum parameters with values not fitting your use case).
require 'oci'
# Create a default config using DEFAULT profile in default location
# Refer to https://docs.cloud.oracle.com/en-us/iaas/Content/API/Concepts/sdkconfig.htm#SDK_and_CLI_Configuration_File for more info
config = OCI::ConfigFileLoader.load_config
# Initialize service client with default config file
waf_client = OCI::Waf::WafClient.new(config: config)
# Send the request to service, some parameters are not required, see API doc for more info
update_web_app_firewall_policy_response =
waf_client.update_web_app_firewall_policy(
'ocid1.test.oc1..<unique_ID>EXAMPLE-webAppFirewallPolicyId-Value',
OCI::Waf::Models::UpdateWebAppFirewallPolicyDetails.new(
display_name: 'EXAMPLE-displayName-Value',
actions: [
OCI::Waf::Models::CheckAction.new(
type: 'CHECK', name: 'EXAMPLE-name-Value'
)
],
request_access_control:
OCI::Waf::Models::RequestAccessControl.new(
default_action_name: 'EXAMPLE-defaultActionName-Value',
rules: [
OCI::Waf::Models::AccessControlRule.new(
type: 'ACCESS_CONTROL',
name: 'EXAMPLE-name-Value',
action_name: 'EXAMPLE-actionName-Value',
condition_language: 'JMESPATH',
condition: 'EXAMPLE-condition-Value'
)
]
),
request_rate_limiting:
OCI::Waf::Models::RequestRateLimiting.new(
rules: [
OCI::Waf::Models::RequestRateLimitingRule.new(
type: 'REQUEST_RATE_LIMITING',
name: 'EXAMPLE-name-Value',
action_name: 'EXAMPLE-actionName-Value',
configurations: [
OCI::Waf::Models::RequestRateLimitingConfiguration.new(
period_in_seconds: 9896,
requests_limit: 523,
action_duration_in_seconds: 16_101
)
],
condition_language: 'JMESPATH',
condition: 'EXAMPLE-condition-Value'
)
]
),
request_protection:
OCI::Waf::Models::RequestProtection.new(
rules: [
OCI::Waf::Models::ProtectionRule.new(
type: 'PROTECTION',
name: 'EXAMPLE-name-Value',
action_name: 'EXAMPLE-actionName-Value',
protection_capabilities: [
OCI::Waf::Models::ProtectionCapability.new(
key: 'EXAMPLE-key-Value',
version: 573,
exclusions:
OCI::Waf::Models::ProtectionCapabilityExclusions.new(
request_cookies: %w[EXAMPLE--Value],
args: %w[EXAMPLE--Value]
),
action_name: 'EXAMPLE-actionName-Value',
collaborative_action_threshold: 20,
collaborative_weights: [
OCI::Waf::Models::CollaborativeCapabilityWeightOverride.new(
key: 'EXAMPLE-key-Value', weight: 715
)
]
)
],
condition_language: 'JMESPATH',
condition: 'EXAMPLE-condition-Value',
protection_capability_settings:
OCI::Waf::Models::ProtectionCapabilitySettings.new(
max_number_of_arguments: 5489,
max_single_argument_length: 193_584,
max_total_argument_length: 30_198_072,
max_http_request_headers: 214,
max_http_request_header_length: 793_089,
allowed_http_methods: %w[EXAMPLE--Value]
),
is_body_inspection_enabled: true
)
],
body_inspection_size_limit_in_bytes: 854,
body_inspection_size_limit_exceeded_action_name:
'EXAMPLE-bodyInspectionSizeLimitExceededActionName-Value'
),
response_access_control:
OCI::Waf::Models::ResponseAccessControl.new(
rules: [
OCI::Waf::Models::AccessControlRule.new(
type: 'ACCESS_CONTROL',
name: 'EXAMPLE-name-Value',
action_name: 'EXAMPLE-actionName-Value',
condition_language: 'JMESPATH',
condition: 'EXAMPLE-condition-Value'
)
]
),
response_protection:
OCI::Waf::Models::ResponseProtection.new(
rules: [
OCI::Waf::Models::ProtectionRule.new(
type: 'PROTECTION',
name: 'EXAMPLE-name-Value',
action_name: 'EXAMPLE-actionName-Value',
protection_capabilities: [
OCI::Waf::Models::ProtectionCapability.new(
key: 'EXAMPLE-key-Value',
version: 699,
exclusions:
OCI::Waf::Models::ProtectionCapabilityExclusions.new(
request_cookies: %w[EXAMPLE--Value],
args: %w[EXAMPLE--Value]
),
action_name: 'EXAMPLE-actionName-Value',
collaborative_action_threshold: 562,
collaborative_weights: [
OCI::Waf::Models::CollaborativeCapabilityWeightOverride.new(
key: 'EXAMPLE-key-Value', weight: 518
)
]
)
],
condition_language: 'JMESPATH',
condition: 'EXAMPLE-condition-Value',
protection_capability_settings:
OCI::Waf::Models::ProtectionCapabilitySettings.new(
max_number_of_arguments: 6611,
max_single_argument_length: 796_814,
max_total_argument_length: 37_274_360,
max_http_request_headers: 669,
max_http_request_header_length: 732_032,
allowed_http_methods: %w[EXAMPLE--Value]
),
is_body_inspection_enabled: false
)
]
),
freeform_tags: {
'EXAMPLE_KEY_ycO4Y' => 'EXAMPLE_VALUE_QYV8CZFw2hE6FhkwlHCm'
},
defined_tags: {
'EXAMPLE_KEY_02S7c' => { 'EXAMPLE_KEY_zlKsf' => 'EXAMPLE--Value' }
},
system_tags: {
'EXAMPLE_KEY_yxb6T' => { 'EXAMPLE_KEY_pLOEl' => 'EXAMPLE--Value' }
}
)
)
# Get the data from response
puts "#{update_web_app_firewall_policy_response.headers}"