VaultNotifications class
Provides an AWS Backup vault notifications resource.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const testTopic = new aws.sns.Topic("test", {name: "backup-vault-events"});
const test = aws.iam.getPolicyDocumentOutput({
statements: [{
principals: [{
type: "Service",
identifiers: ["backup.amazonaws.com"],
}],
actions: ["SNS:Publish"],
effect: "Allow",
resources: [testTopic.arn],
sid: "__default_statement_ID",
}],
policyId: "__default_policy_ID",
});
const testTopicPolicy = new aws.sns.TopicPolicy("test", {
arn: testTopic.arn,
policy: test.json,
});
const testVaultNotifications = new aws.backup.VaultNotifications("test", {
backupVaultName: "example_backup_vault",
snsTopicArn: testTopic.arn,
backupVaultEvents: [
"BACKUP_JOB_STARTED",
"RESTORE_JOB_COMPLETED",
],
});
import pulumi
import pulumi_aws as aws
test_topic = aws.sns.Topic("test", name="backup-vault-events")
test = aws.iam.get_policy_document_output(statements=[{
"principals": [{
"type": "Service",
"identifiers": ["backup.amazonaws.com"],
}],
"actions": ["SNS:Publish"],
"effect": "Allow",
"resources": [test_topic.arn],
"sid": "__default_statement_ID",
}],
policy_id="__default_policy_ID")
test_topic_policy = aws.sns.TopicPolicy("test",
arn=test_topic.arn,
policy=test.json)
test_vault_notifications = aws.backup.VaultNotifications("test",
backup_vault_name="example_backup_vault",
sns_topic_arn=test_topic.arn,
backup_vault_events=[
"BACKUP_JOB_STARTED",
"RESTORE_JOB_COMPLETED",
])
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var testTopic = new Aws.Sns.Topic("test", new()
{
Name = "backup-vault-events",
});
var test = Aws.Iam.GetPolicyDocument.Invoke(new()
{
Statements = new[]
{
new Aws.Iam.Inputs.GetPolicyDocumentStatementInputArgs
{
Principals = new[]
{
new Aws.Iam.Inputs.GetPolicyDocumentStatementPrincipalInputArgs
{
Type = "Service",
Identifiers = new[]
{
"backup.amazonaws.com",
},
},
},
Actions = new[]
{
"SNS:Publish",
},
Effect = "Allow",
Resources = new[]
{
testTopic.Arn,
},
Sid = "__default_statement_ID",
},
},
PolicyId = "__default_policy_ID",
});
var testTopicPolicy = new Aws.Sns.TopicPolicy("test", new()
{
Arn = testTopic.Arn,
Policy = test.Apply(getPolicyDocumentResult => getPolicyDocumentResult.Json),
});
var testVaultNotifications = new Aws.Backup.VaultNotifications("test", new()
{
BackupVaultName = "example_backup_vault",
SnsTopicArn = testTopic.Arn,
BackupVaultEvents = new[]
{
"BACKUP_JOB_STARTED",
"RESTORE_JOB_COMPLETED",
},
});
});
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/backup"
"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/iam"
"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 {
testTopic, err := sns.NewTopic(ctx, "test", &sns.TopicArgs{
Name: pulumi.String("backup-vault-events"),
})
if err != nil {
return err
}
test := iam.GetPolicyDocumentOutput(ctx, iam.GetPolicyDocumentOutputArgs{
Statements: iam.GetPolicyDocumentStatementArray{
&iam.GetPolicyDocumentStatementArgs{
Principals: iam.GetPolicyDocumentStatementPrincipalArray{
&iam.GetPolicyDocumentStatementPrincipalArgs{
Type: pulumi.String("Service"),
Identifiers: pulumi.StringArray{
pulumi.String("backup.amazonaws.com"),
},
},
},
Actions: pulumi.StringArray{
pulumi.String("SNS:Publish"),
},
Effect: pulumi.String("Allow"),
Resources: pulumi.StringArray{
testTopic.Arn,
},
Sid: pulumi.String("__default_statement_ID"),
},
},
PolicyId: pulumi.String("__default_policy_ID"),
}, nil)
_, err = sns.NewTopicPolicy(ctx, "test", &sns.TopicPolicyArgs{
Arn: testTopic.Arn,
Policy: test.Json(),
})
if err != nil {
return err
}
_, err = backup.NewVaultNotifications(ctx, "test", &backup.VaultNotificationsArgs{
BackupVaultName: pulumi.String("example_backup_vault"),
SnsTopicArn: testTopic.Arn,
BackupVaultEvents: pulumi.StringArray{
pulumi.String("BACKUP_JOB_STARTED"),
pulumi.String("RESTORE_JOB_COMPLETED"),
},
})
if err != nil {
return err
}
return nil
})
}
pulumi {
required_providers {
aws = {
source = "pulumi/aws"
}
}
}
data "aws_iam_getpolicydocument" "test" {
statements {
principals {
type = "Service"
identifiers = ["backup.amazonaws.com"]
}
actions = ["SNS:Publish"]
effect = "Allow"
resources = [aws_sns_topic.test.arn]
sid = "__default_statement_ID"
}
policy_id = "__default_policy_ID"
}
resource "aws_sns_topic" "test" {
name = "backup-vault-events"
}
resource "aws_sns_topicpolicy" "test" {
arn = aws_sns_topic.test.arn
policy = data.aws_iam_getpolicydocument.test.json
}
resource "aws_backup_vaultnotifications" "test" {
backup_vault_name = "example_backup_vault"
sns_topic_arn = aws_sns_topic.test.arn
backup_vault_events = ["BACKUP_JOB_STARTED", "RESTORE_JOB_COMPLETED"]
}
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.iam.IamFunctions;
import com.pulumi.aws.iam.inputs.GetPolicyDocumentArgs;
import com.pulumi.aws.iam.inputs.GetPolicyDocumentStatementArgs;
import com.pulumi.aws.iam.inputs.GetPolicyDocumentStatementPrincipalArgs;
import com.pulumi.aws.sns.TopicPolicy;
import com.pulumi.aws.sns.TopicPolicyArgs;
import com.pulumi.aws.backup.VaultNotifications;
import com.pulumi.aws.backup.VaultNotificationsArgs;
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 testTopic = new Topic("testTopic", TopicArgs.builder()
.name("backup-vault-events")
.build());
final var test = IamFunctions.getPolicyDocument(GetPolicyDocumentArgs.builder()
.statements(GetPolicyDocumentStatementArgs.builder()
.principals(GetPolicyDocumentStatementPrincipalArgs.builder()
.type("Service")
.identifiers("backup.amazonaws.com")
.build())
.actions("SNS:Publish")
.effect("Allow")
.resources(testTopic.arn())
.sid("__default_statement_ID")
.build())
.policyId("__default_policy_ID")
.build());
var testTopicPolicy = new TopicPolicy("testTopicPolicy", TopicPolicyArgs.builder()
.arn(testTopic.arn())
.policy(test.applyValue(_test -> _test.json()))
.build());
var testVaultNotifications = new VaultNotifications("testVaultNotifications", VaultNotificationsArgs.builder()
.backupVaultName("example_backup_vault")
.snsTopicArn(testTopic.arn())
.backupVaultEvents(
"BACKUP_JOB_STARTED",
"RESTORE_JOB_COMPLETED")
.build());
}
}
resources:
testTopic:
type: aws:sns:Topic
name: test
properties:
name: backup-vault-events
testTopicPolicy:
type: aws:sns:TopicPolicy
name: test
properties:
arn: ${testTopic.arn}
policy: ${test.json}
testVaultNotifications:
type: aws:backup:VaultNotifications
name: test
properties:
backupVaultName: example_backup_vault
snsTopicArn: ${testTopic.arn}
backupVaultEvents:
- BACKUP_JOB_STARTED
- RESTORE_JOB_COMPLETED
variables:
test:
fn::invoke:
function: aws:iam:getPolicyDocument
arguments:
statements:
- principals:
- type: Service
identifiers:
- backup.amazonaws.com
actions:
- SNS:Publish
effect: Allow
resources:
- ${testTopic.arn}
sid: __default_statement_ID
policyId: __default_policy_ID
Import
Using pulumi import, import Backup vault notifications using the name. For example:
$ pulumi import aws:backup/vaultNotifications:VaultNotifications test TestVault
Constructors
- VaultNotifications(String name, {VaultNotificationsArgs? args, CustomResourceOptions? options})
-
Creates a new VaultNotifications.
nameThe Pulumi resource name.argsArguments used to configure this VaultNotifications. The set of arguments for VaultNotifications.optionsResource options controlling this resource's behavior. - VaultNotifications.reference(String urn)
- Creates a typed reference to an existing VaultNotifications resource.
Properties
-
backupVaultArn
↔ Output<
String> -
The ARN of the vault.
latefinal
-
backupVaultEvents
↔ Output<
List< String> > -
An array of events that indicate the status of jobs to back up resources to the backup vault.
latefinal
-
backupVaultName
↔ Output<
String> -
Name of the backup vault to add notifications for.
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
-
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
-
snsTopicArn
↔ Output<
String> -
ARN that specifies the topic for a backup vault’s events
latefinal
-
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, {VaultNotificationsState? state, CustomResourceOptions? options}) → VaultNotifications -
Gets an existing VaultNotifications resource's state with the given
nameandid.