# 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
waf_client = oci.waf.WafClient(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(
    web_app_firewall_policy_id="ocid1.test.oc1..<unique_ID>EXAMPLE-webAppFirewallPolicyId-Value",
    update_web_app_firewall_policy_details=oci.waf.models.UpdateWebAppFirewallPolicyDetails(
        display_name="EXAMPLE-displayName-Value",
        actions=[
            oci.waf.models.ReturnHttpResponseAction(
                type="RETURN_HTTP_RESPONSE",
                name="EXAMPLE-name-Value",
                code=418,
                headers=[
                    oci.waf.models.ResponseHeader(
                        name="EXAMPLE-name-Value",
                        value="EXAMPLE-value-Value")],
                body=oci.waf.models.StaticTextHttpResponseBody(
                    type="STATIC_TEXT",
                    text="EXAMPLE-text-Value"))],
        request_access_control=oci.waf.models.RequestAccessControl(
            default_action_name="EXAMPLE-defaultActionName-Value",
            rules=[
                oci.waf.models.AccessControlRule(
                    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(
            rules=[
                oci.waf.models.RequestRateLimitingRule(
                    type="REQUEST_RATE_LIMITING",
                    name="EXAMPLE-name-Value",
                    action_name="EXAMPLE-actionName-Value",
                    configurations=[
                        oci.waf.models.RequestRateLimitingConfiguration(
                            period_in_seconds=27297,
                            requests_limit=843,
                            action_duration_in_seconds=16025)],
                    condition_language="JMESPATH",
                    condition="EXAMPLE-condition-Value")]),
        request_protection=oci.waf.models.RequestProtection(
            rules=[
                oci.waf.models.ProtectionRule(
                    type="PROTECTION",
                    name="EXAMPLE-name-Value",
                    action_name="EXAMPLE-actionName-Value",
                    protection_capabilities=[
                        oci.waf.models.ProtectionCapability(
                            key="EXAMPLE-key-Value",
                            version=135,
                            exclusions=oci.waf.models.ProtectionCapabilityExclusions(
                                request_cookies=["EXAMPLE--Value"],
                                args=["EXAMPLE--Value"]),
                            action_name="EXAMPLE-actionName-Value",
                            collaborative_action_threshold=626,
                            collaborative_weights=[
                                oci.waf.models.CollaborativeCapabilityWeightOverride(
                                    key="EXAMPLE-key-Value",
                                    weight=343)])],
                    condition_language="JMESPATH",
                    condition="EXAMPLE-condition-Value",
                    protection_capability_settings=oci.waf.models.ProtectionCapabilitySettings(
                        max_number_of_arguments=4042,
                        max_single_argument_length=214661,
                        max_total_argument_length=49612587,
                        max_http_request_headers=548,
                        max_http_request_header_length=686061,
                        allowed_http_methods=["EXAMPLE--Value"]),
                    is_body_inspection_enabled=False)],
            body_inspection_size_limit_in_bytes=707,
            body_inspection_size_limit_exceeded_action_name="EXAMPLE-bodyInspectionSizeLimitExceededActionName-Value"),
        response_access_control=oci.waf.models.ResponseAccessControl(
            rules=[
                oci.waf.models.AccessControlRule(
                    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(
            rules=[
                oci.waf.models.ProtectionRule(
                    type="PROTECTION",
                    name="EXAMPLE-name-Value",
                    action_name="EXAMPLE-actionName-Value",
                    protection_capabilities=[
                        oci.waf.models.ProtectionCapability(
                            key="EXAMPLE-key-Value",
                            version=267,
                            exclusions=oci.waf.models.ProtectionCapabilityExclusions(
                                request_cookies=["EXAMPLE--Value"],
                                args=["EXAMPLE--Value"]),
                            action_name="EXAMPLE-actionName-Value",
                            collaborative_action_threshold=882,
                            collaborative_weights=[
                                oci.waf.models.CollaborativeCapabilityWeightOverride(
                                    key="EXAMPLE-key-Value",
                                    weight=282)])],
                    condition_language="JMESPATH",
                    condition="EXAMPLE-condition-Value",
                    protection_capability_settings=oci.waf.models.ProtectionCapabilitySettings(
                        max_number_of_arguments=2123,
                        max_single_argument_length=840370,
                        max_total_argument_length=49176834,
                        max_http_request_headers=648,
                        max_http_request_header_length=98644,
                        allowed_http_methods=["EXAMPLE--Value"]),
                    is_body_inspection_enabled=True)]),
        freeform_tags={
            'EXAMPLE_KEY_TR55q': 'EXAMPLE_VALUE_9ycO4YQYV8CZFw2hE6Fh'},
        defined_tags={
            'EXAMPLE_KEY_mzlKs': {
                'EXAMPLE_KEY_kwlHC': 'EXAMPLE--Value'}},
        system_tags={
            'EXAMPLE_KEY_cpLOE': {
                'EXAMPLE_KEY_f02S7': 'EXAMPLE--Value'}}),
    if_match="EXAMPLE-ifMatch-Value",
    opc_request_id="LYXB6TWARSYCXFW63ENE<unique_ID>")

# Get the data from response
print(update_web_app_firewall_policy_response.headers)

Was this article helpful?