Akamai

Pulumi Official
Package maintained by Pulumi
v3.0.0 published on Monday, Jul 25, 2022 by Pulumi

getAppSecCustomRules

Scopes: Security configuration; custom rule

Returns a list of the custom rules defined for a security configuration; you can also use this resource to return information for an individual custom rule. Custom rules are rules you have created yourself and are not part of the Kona Rule Set.

Related API Endpoint:/appsec/v1/configs/{configId}/versions/{versionNumber}/security-policies/{policyId}/custom-rules

Output Options

The following options can be used to determine the information returned, and how that returned information is formatted:

  • output_text. Tabular report showing the ID and name of the custom rule information.
  • json. JSON-formatted report of the custom rule information.

Example Usage

using Pulumi;
using Akamai = Pulumi.Akamai;

class MyStack : Stack
{
    public MyStack()
    {
        var configuration = Output.Create(Akamai.GetAppSecConfiguration.InvokeAsync(new Akamai.GetAppSecConfigurationArgs
        {
            Name = "Documentation",
        }));
        var customRules = configuration.Apply(configuration => Output.Create(Akamai.GetAppSecCustomRules.InvokeAsync(new Akamai.GetAppSecCustomRulesArgs
        {
            ConfigId = configuration.ConfigId,
        })));
        this.CustomRulesOutputText = customRules.Apply(customRules => customRules.OutputText);
        this.CustomRulesJson = customRules.Apply(customRules => customRules.Json);
        this.CustomRulesConfigId = customRules.Apply(customRules => customRules.ConfigId);
        var specificCustomRule = configuration.Apply(configuration => Output.Create(Akamai.GetAppSecCustomRules.InvokeAsync(new Akamai.GetAppSecCustomRulesArgs
        {
            ConfigId = configuration.ConfigId,
            CustomRuleId = 60029316,
        })));
        this.SpecificCustomRuleJson = specificCustomRule.Apply(specificCustomRule => specificCustomRule.Json);
    }

    [Output("customRulesOutputText")]
    public Output<string> CustomRulesOutputText { get; set; }
    [Output("customRulesJson")]
    public Output<string> CustomRulesJson { get; set; }
    [Output("customRulesConfigId")]
    public Output<string> CustomRulesConfigId { get; set; }
    [Output("specificCustomRuleJson")]
    public Output<string> SpecificCustomRuleJson { get; set; }
}
package main

import (
	"github.com/pulumi/pulumi-akamai/sdk/v3/go/akamai"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		configuration, err := akamai.LookupAppSecConfiguration(ctx, &GetAppSecConfigurationArgs{
			Name: pulumi.StringRef("Documentation"),
		}, nil)
		if err != nil {
			return err
		}
		customRules, err := akamai.GetAppSecCustomRules(ctx, &GetAppSecCustomRulesArgs{
			ConfigId: configuration.ConfigId,
		}, nil)
		if err != nil {
			return err
		}
		ctx.Export("customRulesOutputText", customRules.OutputText)
		ctx.Export("customRulesJson", customRules.Json)
		ctx.Export("customRulesConfigId", customRules.ConfigId)
		specificCustomRule, err := akamai.GetAppSecCustomRules(ctx, &GetAppSecCustomRulesArgs{
			ConfigId:     configuration.ConfigId,
			CustomRuleId: pulumi.IntRef(60029316),
		}, nil)
		if err != nil {
			return err
		}
		ctx.Export("specificCustomRuleJson", specificCustomRule.Json)
		return nil
	})
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.akamai.AkamaiFunctions;
import com.pulumi.akamai.inputs.GetAppSecConfigurationArgs;
import com.pulumi.akamai.inputs.GetAppSecCustomRulesArgs;
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 configuration = AkamaiFunctions.getAppSecConfiguration(GetAppSecConfigurationArgs.builder()
            .name("Documentation")
            .build());

        final var customRules = AkamaiFunctions.getAppSecCustomRules(GetAppSecCustomRulesArgs.builder()
            .configId(configuration.applyValue(getAppSecConfigurationResult -> getAppSecConfigurationResult.configId()))
            .build());

        ctx.export("customRulesOutputText", customRules.applyValue(getAppSecCustomRulesResult -> getAppSecCustomRulesResult.outputText()));
        ctx.export("customRulesJson", customRules.applyValue(getAppSecCustomRulesResult -> getAppSecCustomRulesResult.json()));
        ctx.export("customRulesConfigId", customRules.applyValue(getAppSecCustomRulesResult -> getAppSecCustomRulesResult.configId()));
        final var specificCustomRule = AkamaiFunctions.getAppSecCustomRules(GetAppSecCustomRulesArgs.builder()
            .configId(configuration.applyValue(getAppSecConfigurationResult -> getAppSecConfigurationResult.configId()))
            .customRuleId("60029316")
            .build());

        ctx.export("specificCustomRuleJson", specificCustomRule.applyValue(getAppSecCustomRulesResult -> getAppSecCustomRulesResult.json()));
    }
}
import pulumi
import pulumi_akamai as akamai

configuration = akamai.get_app_sec_configuration(name="Documentation")
custom_rules = akamai.get_app_sec_custom_rules(config_id=configuration.config_id)
pulumi.export("customRulesOutputText", custom_rules.output_text)
pulumi.export("customRulesJson", custom_rules.json)
pulumi.export("customRulesConfigId", custom_rules.config_id)
specific_custom_rule = akamai.get_app_sec_custom_rules(config_id=configuration.config_id,
    custom_rule_id=60029316)
pulumi.export("specificCustomRuleJson", specific_custom_rule.json)
import * as pulumi from "@pulumi/pulumi";
import * as akamai from "@pulumi/akamai";

const configuration = akamai.getAppSecConfiguration({
    name: "Documentation",
});
const customRules = configuration.then(configuration => akamai.getAppSecCustomRules({
    configId: configuration.configId,
}));
export const customRulesOutputText = customRules.then(customRules => customRules.outputText);
export const customRulesJson = customRules.then(customRules => customRules.json);
export const customRulesConfigId = customRules.then(customRules => customRules.configId);
const specificCustomRule = configuration.then(configuration => akamai.getAppSecCustomRules({
    configId: configuration.configId,
    customRuleId: 60029316,
}));
export const specificCustomRuleJson = specificCustomRule.then(specificCustomRule => specificCustomRule.json);
variables:
  configuration:
    Fn::Invoke:
      Function: akamai:getAppSecConfiguration
      Arguments:
        name: Documentation
  customRules:
    Fn::Invoke:
      Function: akamai:getAppSecCustomRules
      Arguments:
        configId: ${configuration.configId}
  specificCustomRule:
    Fn::Invoke:
      Function: akamai:getAppSecCustomRules
      Arguments:
        configId: ${configuration.configId}
        customRuleId: 60029316
outputs:
  customRulesOutputText: ${customRules.outputText}
  customRulesJson: ${customRules.json}
  customRulesConfigId: ${customRules.configId} # USE CASE: User wants to view a specific custom rule.
  specificCustomRuleJson: ${specificCustomRule.json}

Using getAppSecCustomRules

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 getAppSecCustomRules(args: GetAppSecCustomRulesArgs, opts?: InvokeOptions): Promise<GetAppSecCustomRulesResult>
function getAppSecCustomRulesOutput(args: GetAppSecCustomRulesOutputArgs, opts?: InvokeOptions): Output<GetAppSecCustomRulesResult>
def get_app_sec_custom_rules(config_id: Optional[int] = None,
                             custom_rule_id: Optional[int] = None,
                             opts: Optional[InvokeOptions] = None) -> GetAppSecCustomRulesResult
def get_app_sec_custom_rules_output(config_id: Optional[pulumi.Input[int]] = None,
                             custom_rule_id: Optional[pulumi.Input[int]] = None,
                             opts: Optional[InvokeOptions] = None) -> Output[GetAppSecCustomRulesResult]
func GetAppSecCustomRules(ctx *Context, args *GetAppSecCustomRulesArgs, opts ...InvokeOption) (*GetAppSecCustomRulesResult, error)
func GetAppSecCustomRulesOutput(ctx *Context, args *GetAppSecCustomRulesOutputArgs, opts ...InvokeOption) GetAppSecCustomRulesResultOutput

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

public static class GetAppSecCustomRules 
{
    public static Task<GetAppSecCustomRulesResult> InvokeAsync(GetAppSecCustomRulesArgs args, InvokeOptions? opts = null)
    public static Output<GetAppSecCustomRulesResult> Invoke(GetAppSecCustomRulesInvokeArgs args, InvokeOptions? opts = null)
}
public static CompletableFuture<GetAppSecCustomRulesResult> getAppSecCustomRules(GetAppSecCustomRulesArgs args, InvokeOptions options)
// Output-based functions aren't available in Java yet
Fn::Invoke:
  Function: akamai:index/getAppSecCustomRules:getAppSecCustomRules
  Arguments:
    # Arguments dictionary

The following arguments are supported:

ConfigId int

. Unique identifier of the security configuration associated with the custom rules.

CustomRuleId int

. Unique identifier of the custom rule you want to return information for. If not included, information is returned for all your custom rules.

ConfigId int

. Unique identifier of the security configuration associated with the custom rules.

CustomRuleId int

. Unique identifier of the custom rule you want to return information for. If not included, information is returned for all your custom rules.

configId Integer

. Unique identifier of the security configuration associated with the custom rules.

customRuleId Integer

. Unique identifier of the custom rule you want to return information for. If not included, information is returned for all your custom rules.

configId number

. Unique identifier of the security configuration associated with the custom rules.

customRuleId number

. Unique identifier of the custom rule you want to return information for. If not included, information is returned for all your custom rules.

config_id int

. Unique identifier of the security configuration associated with the custom rules.

custom_rule_id int

. Unique identifier of the custom rule you want to return information for. If not included, information is returned for all your custom rules.

configId Number

. Unique identifier of the security configuration associated with the custom rules.

customRuleId Number

. Unique identifier of the custom rule you want to return information for. If not included, information is returned for all your custom rules.

getAppSecCustomRules Result

The following output properties are available:

ConfigId int
Id string

The provider-assigned unique ID for this managed resource.

Json string
OutputText string
CustomRuleId int
ConfigId int
Id string

The provider-assigned unique ID for this managed resource.

Json string
OutputText string
CustomRuleId int
configId Integer
id String

The provider-assigned unique ID for this managed resource.

json String
outputText String
customRuleId Integer
configId number
id string

The provider-assigned unique ID for this managed resource.

json string
outputText string
customRuleId number
config_id int
id str

The provider-assigned unique ID for this managed resource.

json str
output_text str
custom_rule_id int
configId Number
id String

The provider-assigned unique ID for this managed resource.

json String
outputText String
customRuleId Number

Package Details

Repository
https://github.com/pulumi/pulumi-akamai
License
Apache-2.0
Notes

This Pulumi package is based on the akamai Terraform Provider.