1. Packages
  2. Oracle Cloud Infrastructure
  3. API Docs
  4. Waas
  5. getProtectionRule
Oracle Cloud Infrastructure v2.31.0 published on Thursday, Apr 17, 2025 by Pulumi

oci.Waas.getProtectionRule

Explore with Pulumi AI

Oracle Cloud Infrastructure v2.31.0 published on Thursday, Apr 17, 2025 by Pulumi

This data source provides details about a specific Protection Rule resource in Oracle Cloud Infrastructure Web Application Acceleration and Security service.

Gets the details of a protection rule in the Web Application Firewall configuration for a WAAS policy.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as oci from "@pulumi/oci";

const testProtectionRule = oci.Waas.getProtectionRule({
    protectionRuleKey: protectionRuleProtectionRuleKey,
    waasPolicyId: testWaasPolicy.id,
});
Copy
import pulumi
import pulumi_oci as oci

test_protection_rule = oci.Waas.get_protection_rule(protection_rule_key=protection_rule_protection_rule_key,
    waas_policy_id=test_waas_policy["id"])
Copy
package main

import (
	"github.com/pulumi/pulumi-oci/sdk/v2/go/oci/waas"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := waas.GetProtectionRule(ctx, &waas.GetProtectionRuleArgs{
			ProtectionRuleKey: protectionRuleProtectionRuleKey,
			WaasPolicyId:      testWaasPolicy.Id,
		}, nil)
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Oci = Pulumi.Oci;

return await Deployment.RunAsync(() => 
{
    var testProtectionRule = Oci.Waas.GetProtectionRule.Invoke(new()
    {
        ProtectionRuleKey = protectionRuleProtectionRuleKey,
        WaasPolicyId = testWaasPolicy.Id,
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.oci.Waas.WaasFunctions;
import com.pulumi.oci.Waas.inputs.GetProtectionRuleArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        final var testProtectionRule = WaasFunctions.getProtectionRule(GetProtectionRuleArgs.builder()
            .protectionRuleKey(protectionRuleProtectionRuleKey)
            .waasPolicyId(testWaasPolicy.id())
            .build());

    }
}
Copy
variables:
  testProtectionRule:
    fn::invoke:
      function: oci:Waas:getProtectionRule
      arguments:
        protectionRuleKey: ${protectionRuleProtectionRuleKey}
        waasPolicyId: ${testWaasPolicy.id}
Copy

Using getProtectionRule

Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

function getProtectionRule(args: GetProtectionRuleArgs, opts?: InvokeOptions): Promise<GetProtectionRuleResult>
function getProtectionRuleOutput(args: GetProtectionRuleOutputArgs, opts?: InvokeOptions): Output<GetProtectionRuleResult>
Copy
def get_protection_rule(protection_rule_key: Optional[str] = None,
                        waas_policy_id: Optional[str] = None,
                        opts: Optional[InvokeOptions] = None) -> GetProtectionRuleResult
def get_protection_rule_output(protection_rule_key: Optional[pulumi.Input[str]] = None,
                        waas_policy_id: Optional[pulumi.Input[str]] = None,
                        opts: Optional[InvokeOptions] = None) -> Output[GetProtectionRuleResult]
Copy
func GetProtectionRule(ctx *Context, args *GetProtectionRuleArgs, opts ...InvokeOption) (*GetProtectionRuleResult, error)
func GetProtectionRuleOutput(ctx *Context, args *GetProtectionRuleOutputArgs, opts ...InvokeOption) GetProtectionRuleResultOutput
Copy

> Note: This function is named GetProtectionRule in the Go SDK.

public static class GetProtectionRule 
{
    public static Task<GetProtectionRuleResult> InvokeAsync(GetProtectionRuleArgs args, InvokeOptions? opts = null)
    public static Output<GetProtectionRuleResult> Invoke(GetProtectionRuleInvokeArgs args, InvokeOptions? opts = null)
}
Copy
public static CompletableFuture<GetProtectionRuleResult> getProtectionRule(GetProtectionRuleArgs args, InvokeOptions options)
public static Output<GetProtectionRuleResult> getProtectionRule(GetProtectionRuleArgs args, InvokeOptions options)
Copy
fn::invoke:
  function: oci:Waas/getProtectionRule:getProtectionRule
  arguments:
    # arguments dictionary
Copy

The following arguments are supported:

ProtectionRuleKey This property is required. string
The protection rule key.
WaasPolicyId This property is required. string
The OCID of the WAAS policy.
ProtectionRuleKey This property is required. string
The protection rule key.
WaasPolicyId This property is required. string
The OCID of the WAAS policy.
protectionRuleKey This property is required. String
The protection rule key.
waasPolicyId This property is required. String
The OCID of the WAAS policy.
protectionRuleKey This property is required. string
The protection rule key.
waasPolicyId This property is required. string
The OCID of the WAAS policy.
protection_rule_key This property is required. str
The protection rule key.
waas_policy_id This property is required. str
The OCID of the WAAS policy.
protectionRuleKey This property is required. String
The protection rule key.
waasPolicyId This property is required. String
The OCID of the WAAS policy.

getProtectionRule Result

The following output properties are available:

Action string
The action to take when the traffic is detected as malicious. If unspecified, defaults to OFF.
Description string
The description of the protection rule.
Exclusions List<GetProtectionRuleExclusion>
An array of The target property of a request that would allow it to bypass the protection rule. For example, when target is REQUEST_COOKIE_NAMES, the list may include names of cookies to exclude from the protection rule. When the target is ARGS, the list may include strings of URL query parameters and values from form-urlencoded XML, JSON, AMP, or POST payloads to exclude from the protection rule. Exclusions properties must not contain whitespace, comma or |. Note: If protection rules have been enabled that utilize the maxArgumentCount or maxTotalNameLengthOfArguments properties, and the target property has been set to ARGS, it is important that the exclusions properties be defined to honor those protection rule settings in a consistent manner.
Id string
The provider-assigned unique ID for this managed resource.
Key string
The unique key of the protection rule.
Labels List<string>
The list of labels for the protection rule.
ModSecurityRuleIds List<string>
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.
Name string
The name of the protection rule.
ProtectionRuleKey string
WaasPolicyId string
Action string
The action to take when the traffic is detected as malicious. If unspecified, defaults to OFF.
Description string
The description of the protection rule.
Exclusions []GetProtectionRuleExclusion
An array of The target property of a request that would allow it to bypass the protection rule. For example, when target is REQUEST_COOKIE_NAMES, the list may include names of cookies to exclude from the protection rule. When the target is ARGS, the list may include strings of URL query parameters and values from form-urlencoded XML, JSON, AMP, or POST payloads to exclude from the protection rule. Exclusions properties must not contain whitespace, comma or |. Note: If protection rules have been enabled that utilize the maxArgumentCount or maxTotalNameLengthOfArguments properties, and the target property has been set to ARGS, it is important that the exclusions properties be defined to honor those protection rule settings in a consistent manner.
Id string
The provider-assigned unique ID for this managed resource.
Key string
The unique key of the protection rule.
Labels []string
The list of labels for the protection rule.
ModSecurityRuleIds []string
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.
Name string
The name of the protection rule.
ProtectionRuleKey string
WaasPolicyId string
action String
The action to take when the traffic is detected as malicious. If unspecified, defaults to OFF.
description String
The description of the protection rule.
exclusions List<GetProtectionRuleExclusion>
An array of The target property of a request that would allow it to bypass the protection rule. For example, when target is REQUEST_COOKIE_NAMES, the list may include names of cookies to exclude from the protection rule. When the target is ARGS, the list may include strings of URL query parameters and values from form-urlencoded XML, JSON, AMP, or POST payloads to exclude from the protection rule. Exclusions properties must not contain whitespace, comma or |. Note: If protection rules have been enabled that utilize the maxArgumentCount or maxTotalNameLengthOfArguments properties, and the target property has been set to ARGS, it is important that the exclusions properties be defined to honor those protection rule settings in a consistent manner.
id String
The provider-assigned unique ID for this managed resource.
key String
The unique key of the protection rule.
labels List<String>
The list of labels for the protection rule.
modSecurityRuleIds List<String>
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.
name String
The name of the protection rule.
protectionRuleKey String
waasPolicyId String
action string
The action to take when the traffic is detected as malicious. If unspecified, defaults to OFF.
description string
The description of the protection rule.
exclusions GetProtectionRuleExclusion[]
An array of The target property of a request that would allow it to bypass the protection rule. For example, when target is REQUEST_COOKIE_NAMES, the list may include names of cookies to exclude from the protection rule. When the target is ARGS, the list may include strings of URL query parameters and values from form-urlencoded XML, JSON, AMP, or POST payloads to exclude from the protection rule. Exclusions properties must not contain whitespace, comma or |. Note: If protection rules have been enabled that utilize the maxArgumentCount or maxTotalNameLengthOfArguments properties, and the target property has been set to ARGS, it is important that the exclusions properties be defined to honor those protection rule settings in a consistent manner.
id string
The provider-assigned unique ID for this managed resource.
key string
The unique key of the protection rule.
labels string[]
The list of labels for the protection rule.
modSecurityRuleIds string[]
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.
name string
The name of the protection rule.
protectionRuleKey string
waasPolicyId string
action str
The action to take when the traffic is detected as malicious. If unspecified, defaults to OFF.
description str
The description of the protection rule.
exclusions Sequence[waas.GetProtectionRuleExclusion]
An array of The target property of a request that would allow it to bypass the protection rule. For example, when target is REQUEST_COOKIE_NAMES, the list may include names of cookies to exclude from the protection rule. When the target is ARGS, the list may include strings of URL query parameters and values from form-urlencoded XML, JSON, AMP, or POST payloads to exclude from the protection rule. Exclusions properties must not contain whitespace, comma or |. Note: If protection rules have been enabled that utilize the maxArgumentCount or maxTotalNameLengthOfArguments properties, and the target property has been set to ARGS, it is important that the exclusions properties be defined to honor those protection rule settings in a consistent manner.
id str
The provider-assigned unique ID for this managed resource.
key str
The unique key of the protection rule.
labels Sequence[str]
The list of labels for the protection rule.
mod_security_rule_ids Sequence[str]
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.
name str
The name of the protection rule.
protection_rule_key str
waas_policy_id str
action String
The action to take when the traffic is detected as malicious. If unspecified, defaults to OFF.
description String
The description of the protection rule.
exclusions List<Property Map>
An array of The target property of a request that would allow it to bypass the protection rule. For example, when target is REQUEST_COOKIE_NAMES, the list may include names of cookies to exclude from the protection rule. When the target is ARGS, the list may include strings of URL query parameters and values from form-urlencoded XML, JSON, AMP, or POST payloads to exclude from the protection rule. Exclusions properties must not contain whitespace, comma or |. Note: If protection rules have been enabled that utilize the maxArgumentCount or maxTotalNameLengthOfArguments properties, and the target property has been set to ARGS, it is important that the exclusions properties be defined to honor those protection rule settings in a consistent manner.
id String
The provider-assigned unique ID for this managed resource.
key String
The unique key of the protection rule.
labels List<String>
The list of labels for the protection rule.
modSecurityRuleIds List<String>
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.
name String
The name of the protection rule.
protectionRuleKey String
waasPolicyId String

Supporting Types

GetProtectionRuleExclusion

Exclusions This property is required. List<string>
An array of The target property of a request that would allow it to bypass the protection rule. For example, when target is REQUEST_COOKIE_NAMES, the list may include names of cookies to exclude from the protection rule. When the target is ARGS, the list may include strings of URL query parameters and values from form-urlencoded XML, JSON, AMP, or POST payloads to exclude from the protection rule. Exclusions properties must not contain whitespace, comma or |. Note: If protection rules have been enabled that utilize the maxArgumentCount or maxTotalNameLengthOfArguments properties, and the target property has been set to ARGS, it is important that the exclusions properties be defined to honor those protection rule settings in a consistent manner.
Target This property is required. string
The target of the exclusion.
Exclusions This property is required. []string
An array of The target property of a request that would allow it to bypass the protection rule. For example, when target is REQUEST_COOKIE_NAMES, the list may include names of cookies to exclude from the protection rule. When the target is ARGS, the list may include strings of URL query parameters and values from form-urlencoded XML, JSON, AMP, or POST payloads to exclude from the protection rule. Exclusions properties must not contain whitespace, comma or |. Note: If protection rules have been enabled that utilize the maxArgumentCount or maxTotalNameLengthOfArguments properties, and the target property has been set to ARGS, it is important that the exclusions properties be defined to honor those protection rule settings in a consistent manner.
Target This property is required. string
The target of the exclusion.
exclusions This property is required. List<String>
An array of The target property of a request that would allow it to bypass the protection rule. For example, when target is REQUEST_COOKIE_NAMES, the list may include names of cookies to exclude from the protection rule. When the target is ARGS, the list may include strings of URL query parameters and values from form-urlencoded XML, JSON, AMP, or POST payloads to exclude from the protection rule. Exclusions properties must not contain whitespace, comma or |. Note: If protection rules have been enabled that utilize the maxArgumentCount or maxTotalNameLengthOfArguments properties, and the target property has been set to ARGS, it is important that the exclusions properties be defined to honor those protection rule settings in a consistent manner.
target This property is required. String
The target of the exclusion.
exclusions This property is required. string[]
An array of The target property of a request that would allow it to bypass the protection rule. For example, when target is REQUEST_COOKIE_NAMES, the list may include names of cookies to exclude from the protection rule. When the target is ARGS, the list may include strings of URL query parameters and values from form-urlencoded XML, JSON, AMP, or POST payloads to exclude from the protection rule. Exclusions properties must not contain whitespace, comma or |. Note: If protection rules have been enabled that utilize the maxArgumentCount or maxTotalNameLengthOfArguments properties, and the target property has been set to ARGS, it is important that the exclusions properties be defined to honor those protection rule settings in a consistent manner.
target This property is required. string
The target of the exclusion.
exclusions This property is required. Sequence[str]
An array of The target property of a request that would allow it to bypass the protection rule. For example, when target is REQUEST_COOKIE_NAMES, the list may include names of cookies to exclude from the protection rule. When the target is ARGS, the list may include strings of URL query parameters and values from form-urlencoded XML, JSON, AMP, or POST payloads to exclude from the protection rule. Exclusions properties must not contain whitespace, comma or |. Note: If protection rules have been enabled that utilize the maxArgumentCount or maxTotalNameLengthOfArguments properties, and the target property has been set to ARGS, it is important that the exclusions properties be defined to honor those protection rule settings in a consistent manner.
target This property is required. str
The target of the exclusion.
exclusions This property is required. List<String>
An array of The target property of a request that would allow it to bypass the protection rule. For example, when target is REQUEST_COOKIE_NAMES, the list may include names of cookies to exclude from the protection rule. When the target is ARGS, the list may include strings of URL query parameters and values from form-urlencoded XML, JSON, AMP, or POST payloads to exclude from the protection rule. Exclusions properties must not contain whitespace, comma or |. Note: If protection rules have been enabled that utilize the maxArgumentCount or maxTotalNameLengthOfArguments properties, and the target property has been set to ARGS, it is important that the exclusions properties be defined to honor those protection rule settings in a consistent manner.
target This property is required. String
The target of the exclusion.

Package Details

Repository
oci pulumi/pulumi-oci
License
Apache-2.0
Notes
This Pulumi package is based on the oci Terraform Provider.
Oracle Cloud Infrastructure v2.31.0 published on Thursday, Apr 17, 2025 by Pulumi