akamai.AppSecMalwarePolicy

Scopes: Security configuration; malware protection

Creates, modifies, or deletes malware policies. Malware polices help you control what happens when a request is made to upload files of various types. These policies help you control how your website is protected from malicious uploads.

Output Options

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

  • malware_policy_id. Unique identifier of the modified or newly-created malware policy.

Example Usage

Basic usage

using System.Collections.Generic;
using System.IO;
using Pulumi;
using Akamai = Pulumi.Akamai;

return await Deployment.RunAsync(() => 
{
    var configuration = Akamai.GetAppSecConfiguration.Invoke(new()
    {
        Name = "Documentation",
    });

    var malwarePolicy = new Akamai.AppSecMalwarePolicy("malwarePolicy", new()
    {
        ConfigId = configuration.Apply(getAppSecConfigurationResult => getAppSecConfigurationResult.ConfigId),
        MalwarePolicy = File.ReadAllText($"{path.Module}/malware_policy.json"),
    });

    return new Dictionary<string, object?>
    {
        ["malwarePolicyId"] = malwarePolicy.MalwarePolicyId,
    };
});
package main

import (
	"fmt"
	"os"

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

func readFileOrPanic(path string) pulumi.StringPtrInput {
	data, err := os.ReadFile(path)
	if err != nil {
		panic(err.Error())
	}
	return pulumi.String(string(data))
}

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		configuration, err := akamai.LookupAppSecConfiguration(ctx, &akamai.LookupAppSecConfigurationArgs{
			Name: pulumi.StringRef("Documentation"),
		}, nil)
		if err != nil {
			return err
		}
		malwarePolicy, err := akamai.NewAppSecMalwarePolicy(ctx, "malwarePolicy", &akamai.AppSecMalwarePolicyArgs{
			ConfigId:      *pulumi.Int(configuration.ConfigId),
			MalwarePolicy: readFileOrPanic(fmt.Sprintf("%v/malware_policy.json", path.Module)),
		})
		if err != nil {
			return err
		}
		ctx.Export("malwarePolicyId", malwarePolicy.MalwarePolicyId)
		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.AppSecMalwarePolicy;
import com.pulumi.akamai.AppSecMalwarePolicyArgs;
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());

        var malwarePolicy = new AppSecMalwarePolicy("malwarePolicy", AppSecMalwarePolicyArgs.builder()        
            .configId(configuration.applyValue(getAppSecConfigurationResult -> getAppSecConfigurationResult.configId()))
            .malwarePolicy(Files.readString(Paths.get(String.format("%s/malware_policy.json", path.module()))))
            .build());

        ctx.export("malwarePolicyId", malwarePolicy.malwarePolicyId());
    }
}
import pulumi
import pulumi_akamai as akamai

configuration = akamai.get_app_sec_configuration(name="Documentation")
malware_policy = akamai.AppSecMalwarePolicy("malwarePolicy",
    config_id=configuration.config_id,
    malware_policy=(lambda path: open(path).read())(f"{path['module']}/malware_policy.json"))
pulumi.export("malwarePolicyId", malware_policy.malware_policy_id)
import * as pulumi from "@pulumi/pulumi";
import * as akamai from "@pulumi/akamai";
import * as fs from "fs";

const configuration = akamai.getAppSecConfiguration({
    name: "Documentation",
});
const malwarePolicy = new akamai.AppSecMalwarePolicy("malwarePolicy", {
    configId: configuration.then(configuration => configuration.configId),
    malwarePolicy: fs.readFileSync(`${path.module}/malware_policy.json`),
});
export const malwarePolicyId = malwarePolicy.malwarePolicyId;
resources:
  malwarePolicy:
    type: akamai:AppSecMalwarePolicy
    properties:
      configId: ${configuration.configId}
      malwarePolicy:
        fn::readFile: ${path.module}/malware_policy.json
variables:
  configuration:
    fn::invoke:
      Function: akamai:getAppSecConfiguration
      Arguments:
        name: Documentation
outputs:
  malwarePolicyId: ${malwarePolicy.malwarePolicyId}

Create AppSecMalwarePolicy Resource

new AppSecMalwarePolicy(name: string, args: AppSecMalwarePolicyArgs, opts?: CustomResourceOptions);
@overload
def AppSecMalwarePolicy(resource_name: str,
                        opts: Optional[ResourceOptions] = None,
                        config_id: Optional[int] = None,
                        malware_policy: Optional[str] = None)
@overload
def AppSecMalwarePolicy(resource_name: str,
                        args: AppSecMalwarePolicyArgs,
                        opts: Optional[ResourceOptions] = None)
func NewAppSecMalwarePolicy(ctx *Context, name string, args AppSecMalwarePolicyArgs, opts ...ResourceOption) (*AppSecMalwarePolicy, error)
public AppSecMalwarePolicy(string name, AppSecMalwarePolicyArgs args, CustomResourceOptions? opts = null)
public AppSecMalwarePolicy(String name, AppSecMalwarePolicyArgs args)
public AppSecMalwarePolicy(String name, AppSecMalwarePolicyArgs args, CustomResourceOptions options)
type: akamai:AppSecMalwarePolicy
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

name string
The unique name of the resource.
args AppSecMalwarePolicyArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name str
The unique name of the resource.
args AppSecMalwarePolicyArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name string
The unique name of the resource.
args AppSecMalwarePolicyArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args AppSecMalwarePolicyArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name String
The unique name of the resource.
args AppSecMalwarePolicyArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

AppSecMalwarePolicy Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

The AppSecMalwarePolicy resource accepts the following input properties:

ConfigId int

. Unique identifier of the security configuration associated with the malware policy being modified.

MalwarePolicy string

. Path to a JSON file containing a malware policy definition. You can view a sample malware policy JSON file in the MalwarePolicy section of the Application Security API documentation.

ConfigId int

. Unique identifier of the security configuration associated with the malware policy being modified.

MalwarePolicy string

. Path to a JSON file containing a malware policy definition. You can view a sample malware policy JSON file in the MalwarePolicy section of the Application Security API documentation.

configId Integer

. Unique identifier of the security configuration associated with the malware policy being modified.

malwarePolicy String

. Path to a JSON file containing a malware policy definition. You can view a sample malware policy JSON file in the MalwarePolicy section of the Application Security API documentation.

configId number

. Unique identifier of the security configuration associated with the malware policy being modified.

malwarePolicy string

. Path to a JSON file containing a malware policy definition. You can view a sample malware policy JSON file in the MalwarePolicy section of the Application Security API documentation.

config_id int

. Unique identifier of the security configuration associated with the malware policy being modified.

malware_policy str

. Path to a JSON file containing a malware policy definition. You can view a sample malware policy JSON file in the MalwarePolicy section of the Application Security API documentation.

configId Number

. Unique identifier of the security configuration associated with the malware policy being modified.

malwarePolicy String

. Path to a JSON file containing a malware policy definition. You can view a sample malware policy JSON file in the MalwarePolicy section of the Application Security API documentation.

Outputs

All input properties are implicitly available as output properties. Additionally, the AppSecMalwarePolicy resource produces the following output properties:

Id string

The provider-assigned unique ID for this managed resource.

MalwarePolicyId int

Unique identifier of the malware policy

Id string

The provider-assigned unique ID for this managed resource.

MalwarePolicyId int

Unique identifier of the malware policy

id String

The provider-assigned unique ID for this managed resource.

malwarePolicyId Integer

Unique identifier of the malware policy

id string

The provider-assigned unique ID for this managed resource.

malwarePolicyId number

Unique identifier of the malware policy

id str

The provider-assigned unique ID for this managed resource.

malware_policy_id int

Unique identifier of the malware policy

id String

The provider-assigned unique ID for this managed resource.

malwarePolicyId Number

Unique identifier of the malware policy

Look up Existing AppSecMalwarePolicy Resource

Get an existing AppSecMalwarePolicy resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: AppSecMalwarePolicyState, opts?: CustomResourceOptions): AppSecMalwarePolicy
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        config_id: Optional[int] = None,
        malware_policy: Optional[str] = None,
        malware_policy_id: Optional[int] = None) -> AppSecMalwarePolicy
func GetAppSecMalwarePolicy(ctx *Context, name string, id IDInput, state *AppSecMalwarePolicyState, opts ...ResourceOption) (*AppSecMalwarePolicy, error)
public static AppSecMalwarePolicy Get(string name, Input<string> id, AppSecMalwarePolicyState? state, CustomResourceOptions? opts = null)
public static AppSecMalwarePolicy get(String name, Output<String> id, AppSecMalwarePolicyState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
ConfigId int

. Unique identifier of the security configuration associated with the malware policy being modified.

MalwarePolicy string

. Path to a JSON file containing a malware policy definition. You can view a sample malware policy JSON file in the MalwarePolicy section of the Application Security API documentation.

MalwarePolicyId int

Unique identifier of the malware policy

ConfigId int

. Unique identifier of the security configuration associated with the malware policy being modified.

MalwarePolicy string

. Path to a JSON file containing a malware policy definition. You can view a sample malware policy JSON file in the MalwarePolicy section of the Application Security API documentation.

MalwarePolicyId int

Unique identifier of the malware policy

configId Integer

. Unique identifier of the security configuration associated with the malware policy being modified.

malwarePolicy String

. Path to a JSON file containing a malware policy definition. You can view a sample malware policy JSON file in the MalwarePolicy section of the Application Security API documentation.

malwarePolicyId Integer

Unique identifier of the malware policy

configId number

. Unique identifier of the security configuration associated with the malware policy being modified.

malwarePolicy string

. Path to a JSON file containing a malware policy definition. You can view a sample malware policy JSON file in the MalwarePolicy section of the Application Security API documentation.

malwarePolicyId number

Unique identifier of the malware policy

config_id int

. Unique identifier of the security configuration associated with the malware policy being modified.

malware_policy str

. Path to a JSON file containing a malware policy definition. You can view a sample malware policy JSON file in the MalwarePolicy section of the Application Security API documentation.

malware_policy_id int

Unique identifier of the malware policy

configId Number

. Unique identifier of the security configuration associated with the malware policy being modified.

malwarePolicy String

. Path to a JSON file containing a malware policy definition. You can view a sample malware policy JSON file in the MalwarePolicy section of the Application Security API documentation.

malwarePolicyId Number

Unique identifier of the malware policy

Package Details

Repository
Akamai pulumi/pulumi-akamai
License
Apache-2.0
Notes

This Pulumi package is based on the akamai Terraform Provider.