# 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).
import 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.config.from_file()
# Initialize service client with default config file
waas_client = oci.waas.WaasClient(config)
# Send the request to service, some parameters are not required, see API
# doc for more info
update_waf_config_response = waas_client.update_waf_config(
waas_policy_id="ocid1.test.oc1..<unique_ID>EXAMPLE-waasPolicyId-Value",
update_waf_config_details=oci.waas.models.WafConfig(
access_rules=[
oci.waas.models.AccessRule(
name="EXAMPLE-name-Value",
criteria=[
oci.waas.models.AccessRuleCriteria(
condition="URL_PART_ENDS_WITH",
value="EXAMPLE-value-Value",
is_case_sensitive=False)],
action="SHOW_CAPTCHA",
block_action="SHOW_ERROR_PAGE",
block_response_code=983,
block_error_page_message="EXAMPLE-blockErrorPageMessage-Value",
block_error_page_code="EXAMPLE-blockErrorPageCode-Value",
block_error_page_description="EXAMPLE-blockErrorPageDescription-Value",
bypass_challenges=["HUMAN_INTERACTION_CHALLENGE"],
redirect_url="EXAMPLE-redirectUrl-Value",
redirect_response_code="MOVED_PERMANENTLY",
captcha_title="EXAMPLE-captchaTitle-Value",
captcha_header="EXAMPLE-captchaHeader-Value",
captcha_footer="EXAMPLE-captchaFooter-Value",
captcha_submit_label="EXAMPLE-captchaSubmitLabel-Value",
response_header_manipulation=[
oci.waas.models.ExtendHttpResponseHeaderAction(
action="EXTEND_HTTP_RESPONSE_HEADER",
header="EXAMPLE-header-Value",
value="EXAMPLE-value-Value")])],
address_rate_limiting=oci.waas.models.AddressRateLimiting(
is_enabled=False,
allowed_rate_per_address=1593,
max_delayed_count_per_address=9631,
block_response_code=391),
captchas=[
oci.waas.models.Captcha(
url="EXAMPLE-url-Value",
session_expiration_in_seconds=100681,
title="EXAMPLE-title-Value",
failure_message="EXAMPLE-failureMessage-Value",
submit_label="EXAMPLE-submitLabel-Value",
header_text="EXAMPLE-headerText-Value",
footer_text="EXAMPLE-footerText-Value")],
device_fingerprint_challenge=oci.waas.models.DeviceFingerprintChallenge(
is_enabled=False,
action="BLOCK",
failure_threshold=739147,
action_expiration_in_seconds=374145,
failure_threshold_expiration_in_seconds=89655,
max_address_count=6444,
max_address_count_expiration_in_seconds=415928,
challenge_settings=oci.waas.models.BlockChallengeSettings(
block_action="SET_RESPONSE_CODE",
block_response_code=689,
block_error_page_message="EXAMPLE-blockErrorPageMessage-Value",
block_error_page_description="EXAMPLE-blockErrorPageDescription-Value",
block_error_page_code="EXAMPLE-blockErrorPageCode-Value",
captcha_title="EXAMPLE-captchaTitle-Value",
captcha_header="EXAMPLE-captchaHeader-Value",
captcha_footer="EXAMPLE-captchaFooter-Value",
captcha_submit_label="EXAMPLE-captchaSubmitLabel-Value")),
good_bots=[
oci.waas.models.GoodBot(
key="EXAMPLE-key-Value",
is_enabled=False,
name="EXAMPLE-name-Value",
description="EXAMPLE-description-Value")],
human_interaction_challenge=oci.waas.models.HumanInteractionChallenge(
is_enabled=False,
action="BLOCK",
failure_threshold=990946,
action_expiration_in_seconds=215059,
failure_threshold_expiration_in_seconds=431632,
interaction_threshold=90,
recording_period_in_seconds=14216,
set_http_header=oci.waas.models.Header(
name="EXAMPLE-name-Value",
value="EXAMPLE-value-Value"),
challenge_settings=oci.waas.models.BlockChallengeSettings(
block_action="SHOW_CAPTCHA",
block_response_code=379,
block_error_page_message="EXAMPLE-blockErrorPageMessage-Value",
block_error_page_description="EXAMPLE-blockErrorPageDescription-Value",
block_error_page_code="EXAMPLE-blockErrorPageCode-Value",
captcha_title="EXAMPLE-captchaTitle-Value",
captcha_header="EXAMPLE-captchaHeader-Value",
captcha_footer="EXAMPLE-captchaFooter-Value",
captcha_submit_label="EXAMPLE-captchaSubmitLabel-Value"),
is_nat_enabled=True),
js_challenge=oci.waas.models.JsChallenge(
is_enabled=False,
action="DETECT",
failure_threshold=956579,
action_expiration_in_seconds=38857,
set_http_header=oci.waas.models.Header(
name="EXAMPLE-name-Value",
value="EXAMPLE-value-Value"),
challenge_settings=oci.waas.models.BlockChallengeSettings(
block_action="SET_RESPONSE_CODE",
block_response_code=145,
block_error_page_message="EXAMPLE-blockErrorPageMessage-Value",
block_error_page_description="EXAMPLE-blockErrorPageDescription-Value",
block_error_page_code="EXAMPLE-blockErrorPageCode-Value",
captcha_title="EXAMPLE-captchaTitle-Value",
captcha_header="EXAMPLE-captchaHeader-Value",
captcha_footer="EXAMPLE-captchaFooter-Value",
captcha_submit_label="EXAMPLE-captchaSubmitLabel-Value"),
are_redirects_challenged=True,
criteria=[
oci.waas.models.AccessRuleCriteria(
condition="HTTP_METHOD_IS",
value="EXAMPLE-value-Value",
is_case_sensitive=False)],
is_nat_enabled=True),
origin="EXAMPLE-origin-Value",
caching_rules=[
oci.waas.models.CachingRule(
name="EXAMPLE-name-Value",
action="CACHE",
criteria=[
oci.waas.models.CachingRuleCriteria(
condition="URL_STARTS_WITH",
value="EXAMPLE-value-Value")],
key="EXAMPLE-key-Value",
caching_duration="EXAMPLE-cachingDuration-Value",
is_client_caching_enabled=False,
client_caching_duration="EXAMPLE-clientCachingDuration-Value")],
custom_protection_rules=[
oci.waas.models.CustomProtectionRuleSetting(
id="ocid1.test.oc1..<unique_ID>EXAMPLE-id-Value",
action="BLOCK",
exclusions=[
oci.waas.models.ProtectionRuleExclusion(
target="REQUEST_COOKIE_NAMES",
exclusions=["EXAMPLE--Value"])])],
origin_groups=["EXAMPLE--Value"],
protection_rules=[
oci.waas.models.ProtectionRule(
key="EXAMPLE-key-Value",
mod_security_rule_ids=["EXAMPLE--Value"],
name="EXAMPLE-name-Value",
description="EXAMPLE-description-Value",
action="OFF",
labels=["EXAMPLE--Value"],
exclusions=[
oci.waas.models.ProtectionRuleExclusion(
target="ARGS",
exclusions=["EXAMPLE--Value"])])],
protection_settings=oci.waas.models.ProtectionSettings(
block_action="SHOW_ERROR_PAGE",
block_response_code=587,
block_error_page_message="EXAMPLE-blockErrorPageMessage-Value",
block_error_page_code="EXAMPLE-blockErrorPageCode-Value",
block_error_page_description="EXAMPLE-blockErrorPageDescription-Value",
max_argument_count=1015,
max_name_length_per_argument=12436,
max_total_name_length_of_arguments=142650,
recommendations_period_in_days=67,
is_response_inspected=False,
max_response_size_in_ki_b=1470,
allowed_http_methods=["CONNECT"],
media_types=["EXAMPLE--Value"]),
threat_feeds=[
oci.waas.models.ThreatFeed(
key="EXAMPLE-key-Value",
name="EXAMPLE-name-Value",
action="BLOCK",
description="EXAMPLE-description-Value")],
whitelists=[
oci.waas.models.Whitelist(
name="EXAMPLE-name-Value",
addresses=["EXAMPLE--Value"],
address_lists=["EXAMPLE--Value"])]),
opc_request_id="U8MPZTCZQJDMECTXAMSL<unique_ID>",
opc_retry_token="EXAMPLE-opcRetryToken-Value",
if_match="EXAMPLE-ifMatch-Value")
# Get the data from response
print(update_waf_config_response.headers)