DataProtectionPolicy class
Provides an SNS data protection topic policy resource
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const example = new aws.sns.Topic("example", {name: "example"});
const exampleDataProtectionPolicy = new aws.sns.DataProtectionPolicy("example", {
arn: example.arn,
policy: JSON.stringify({
Description: "Example data protection policy",
Name: "__example_data_protection_policy",
Statement: [{
DataDirection: "Inbound",
DataIdentifier: ["arn:aws:dataprotection::aws:data-identifier/EmailAddress"],
Operation: {
Deny: {},
},
Principal: ["*"],
Sid: "__deny_statement_11ba9d96",
}],
Version: "2021-06-01",
}),
});
import pulumi
import json
import pulumi_aws as aws
example = aws.sns.Topic("example", name="example")
example_data_protection_policy = aws.sns.DataProtectionPolicy("example",
arn=example.arn,
policy=json.dumps({
"Description": "Example data protection policy",
"Name": "__example_data_protection_policy",
"Statement": [{
"DataDirection": "Inbound",
"DataIdentifier": ["arn:aws:dataprotection::aws:data-identifier/EmailAddress"],
"Operation": {
"Deny": {},
},
"Principal": ["*"],
"Sid": "__deny_statement_11ba9d96",
}],
"Version": "2021-06-01",
}))
using System.Collections.Generic;
using System.Linq;
using System.Text.Json;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var example = new Aws.Sns.Topic("example", new()
{
Name = "example",
});
var exampleDataProtectionPolicy = new Aws.Sns.DataProtectionPolicy("example", new()
{
Arn = example.Arn,
Policy = JsonSerializer.Serialize(new Dictionary<string, object?>
{
["Description"] = "Example data protection policy",
["Name"] = "__example_data_protection_policy",
["Statement"] = new[]
{
new Dictionary<string, object?>
{
["DataDirection"] = "Inbound",
["DataIdentifier"] = new[]
{
"arn:aws:dataprotection::aws:data-identifier/EmailAddress",
},
["Operation"] = new Dictionary<string, object?>
{
["Deny"] = new Dictionary<string, object?>
{
},
},
["Principal"] = new[]
{
"*",
},
["Sid"] = "__deny_statement_11ba9d96",
},
},
["Version"] = "2021-06-01",
}),
});
});
package main
import (
"encoding/json"
"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/sns"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
example, err := sns.NewTopic(ctx, "example", &sns.TopicArgs{
Name: pulumi.String("example"),
})
if err != nil {
return err
}
tmpJSON0, err := json.Marshal(map[string]interface{}{
"Description": "Example data protection policy",
"Name": "__example_data_protection_policy",
"Statement": []map[string]interface{}{
map[string]interface{}{
"DataDirection": "Inbound",
"DataIdentifier": []string{
"arn:aws:dataprotection::aws:data-identifier/EmailAddress",
},
"Operation": map[string]map[string]interface{}{
"Deny": map[string]interface{}{},
},
"Principal": []string{
"*",
},
"Sid": "__deny_statement_11ba9d96",
},
},
"Version": "2021-06-01",
})
if err != nil {
return err
}
json0 := string(tmpJSON0)
_, err = sns.NewDataProtectionPolicy(ctx, "example", &sns.DataProtectionPolicyArgs{
Arn: example.Arn,
Policy: pulumi.String(json0),
})
if err != nil {
return err
}
return nil
})
}
pulumi {
required_providers {
aws = {
source = "pulumi/aws"
}
}
}
resource "aws_sns_topic" "example" {
name = "example"
}
resource "aws_sns_dataprotectionpolicy" "example" {
arn = aws_sns_topic.example.arn
policy = jsonencode({
"Description" = "Example data protection policy"
"Name" = "__example_data_protection_policy"
"Statement" = [{
"DataDirection" = "Inbound"
"DataIdentifier" = ["arn:aws:dataprotection::aws:data-identifier/EmailAddress"]
"Operation" = {
"Deny" = {}
}
"Principal" = ["*"]
"Sid" = "__deny_statement_11ba9d96"
}]
"Version" = "2021-06-01"
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.sns.Topic;
import com.pulumi.aws.sns.TopicArgs;
import com.pulumi.aws.sns.DataProtectionPolicy;
import com.pulumi.aws.sns.DataProtectionPolicyArgs;
import static com.pulumi.codegen.internal.Serialization.*;
import java.util.ArrayList;
import java.util.Arrays;
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) {
var example = new Topic("example", TopicArgs.builder()
.name("example")
.build());
var exampleDataProtectionPolicy = new DataProtectionPolicy("exampleDataProtectionPolicy", DataProtectionPolicyArgs.builder()
.arn(example.arn())
.policy(serializeJson(
jsonObject(
jsonProperty("Description", "Example data protection policy"),
jsonProperty("Name", "__example_data_protection_policy"),
jsonProperty("Statement", jsonArray(jsonObject(
jsonProperty("DataDirection", "Inbound"),
jsonProperty("DataIdentifier", jsonArray("arn:aws:dataprotection::aws:data-identifier/EmailAddress")),
jsonProperty("Operation", jsonObject(
jsonProperty("Deny", jsonObject(
))
)),
jsonProperty("Principal", jsonArray("*")),
jsonProperty("Sid", "__deny_statement_11ba9d96")
))),
jsonProperty("Version", "2021-06-01")
)))
.build());
}
}
resources:
example:
type: aws:sns:Topic
properties:
name: example
exampleDataProtectionPolicy:
type: aws:sns:DataProtectionPolicy
name: example
properties:
arn: ${example.arn}
policy:
fn::toJSON:
Description: Example data protection policy
Name: __example_data_protection_policy
Statement:
- DataDirection: Inbound
DataIdentifier:
- arn:aws:dataprotection::aws:data-identifier/EmailAddress
Operation:
Deny: {}
Principal:
- '*'
Sid: __deny_statement_11ba9d96
Version: 2021-06-01
Import
Identity Schema
Required
arn(String) ARN of the SNS topic.
Using pulumi import, import SNS Data Protection Topic Policy using the topic ARN. For example:
$ pulumi import aws:sns/dataProtectionPolicy:DataProtectionPolicy example arn:aws:sns:us-west-2:123456789012:example
Constructors
- DataProtectionPolicy(String name, {DataProtectionPolicyArgs? args, CustomResourceOptions? options})
-
Creates a new DataProtectionPolicy.
nameThe Pulumi resource name.argsArguments used to configure this DataProtectionPolicy. The set of arguments for DataProtectionPolicy.optionsResource options controlling this resource's behavior. - DataProtectionPolicy.reference(String urn)
- Creates a typed reference to an existing DataProtectionPolicy resource.
Properties
-
arn
↔ Output<
String> -
The ARN of the SNS topic
latefinal
-
childResources
→ Set<
Resource> -
finalinherited
-
completionSources
↔ Map<
String, IOutputCompletionSource> -
latefinalinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
-
id
↔ Output<
String> -
getter/setter pairinherited
- isCustom → bool
-
Returns whether this resource is provider-managed.
no setterinherited
- isProtected → bool
-
Returns whether this resource is protected from deletion.
no setterinherited
- isRemote → bool
-
Whether this resource is registered as remote.
no setterinherited
- isResourceReference → bool
-
Whether this instance represents a resource value returned over RPC.
finalinherited
-
policy
↔ Output<
String> -
The fully-formed AWS policy as JSON. For more information about building AWS IAM policy documents with this provider, see the AWS IAM Policy Document Guide.
latefinal
-
region
↔ Output<
String> -
Region where this resource will be managed. Defaults to the Region set in the provider configuration.
latefinal
-
resourceTransforms
→ List<
ResourceTransform> -
Inherited/explicit async transforms.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
transformations
→ List<
ResourceTransformation> -
Inherited/explicit legacy transformations.
no setterinherited
-
urn
↔ Output<
String> -
latefinalinherited
Methods
-
failId(
Object error) → void -
Completes this resource ID with an error when registration fails.
inherited
-
failOutputs(
Object error) → void -
Completes all output properties with
error.inherited -
failUrn(
Object error) → void -
Completes this resource URN with an error when registration fails.
inherited
-
getProvider(
String moduleMember) → ProviderResource? -
Returns provider for
moduleMember's package, if configured.inherited -
getResourceName(
) → String -
Returns this resource's logical name.
inherited
-
getResourceType(
) → String -
Returns this resource's Pulumi type token.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
registerOutput<
T> (String propertyName, {Object? decoder(Object?)?, bool isSecret = false}) → Output< T> -
Registers a dynamic output property for this resource.
inherited
-
resolveId(
String? value, {required bool isKnown}) → void -
Resolves the provider-assigned ID for this resource.
inherited
-
resolveOutputs(
Struct outputs) → void -
Resolves all output properties from a monitor response payload.
inherited
-
resolveUrn(
String value) → void -
Resolves this resource's URN once assigned by the engine.
inherited
-
serializeProperties(
Map< String, dynamic> properties) → Future<Struct> -
Serializes resource properties for RPC transmission.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
get(
String name, Input< String> id, {DataProtectionPolicyState? state, CustomResourceOptions? options}) → DataProtectionPolicy -
Gets an existing DataProtectionPolicy resource's state with the given
nameandid.