UNPKG

@pulumi/aws

Version:

A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.

106 lines 4.13 kB
"use strict"; // *** WARNING: this file was generated by pulumi-language-nodejs. *** // *** Do not edit by hand unless you're certain you know what you are doing! *** Object.defineProperty(exports, "__esModule", { value: true }); exports.VaultPolicy = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("../utilities"); /** * Provides an AWS Backup vault policy resource. * * ## Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const current = aws.getCallerIdentity({}); * const exampleVault = new aws.backup.Vault("example", {name: "example"}); * const example = pulumi.all([current, exampleVault.arn]).apply(([current, arn]) => aws.iam.getPolicyDocumentOutput({ * statements: [{ * effect: "Allow", * principals: [{ * type: "AWS", * identifiers: [current.accountId], * }], * actions: [ * "backup:DescribeBackupVault", * "backup:DeleteBackupVault", * "backup:PutBackupVaultAccessPolicy", * "backup:DeleteBackupVaultAccessPolicy", * "backup:GetBackupVaultAccessPolicy", * "backup:StartBackupJob", * "backup:GetBackupVaultNotifications", * "backup:PutBackupVaultNotifications", * ], * resources: [arn], * }], * })); * const exampleVaultPolicy = new aws.backup.VaultPolicy("example", { * backupVaultName: exampleVault.name, * policy: example.apply(example => example.json), * }); * ``` * * ## Import * * Using `pulumi import`, import Backup vault policy using the `name`. For example: * * ```sh * $ pulumi import aws:backup/vaultPolicy:VaultPolicy test TestVault * ``` */ class VaultPolicy extends pulumi.CustomResource { /** * Get an existing VaultPolicy resource's state with the given name, ID, and optional extra * properties used to qualify the lookup. * * @param name The _unique_ name of the resulting resource. * @param id The _unique_ provider ID of the resource to lookup. * @param state Any extra arguments used during the lookup. * @param opts Optional settings to control the behavior of the CustomResource. */ static get(name, id, state, opts) { return new VaultPolicy(name, state, { ...opts, id: id }); } /** * Returns true if the given object is an instance of VaultPolicy. This is designed to work even * when multiple copies of the Pulumi SDK have been loaded into the same process. */ static isInstance(obj) { if (obj === undefined || obj === null) { return false; } return obj['__pulumiType'] === VaultPolicy.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["backupVaultArn"] = state?.backupVaultArn; resourceInputs["backupVaultName"] = state?.backupVaultName; resourceInputs["policy"] = state?.policy; resourceInputs["region"] = state?.region; } else { const args = argsOrState; if (args?.backupVaultName === undefined && !opts.urn) { throw new Error("Missing required property 'backupVaultName'"); } if (args?.policy === undefined && !opts.urn) { throw new Error("Missing required property 'policy'"); } resourceInputs["backupVaultName"] = args?.backupVaultName; resourceInputs["policy"] = args?.policy; resourceInputs["region"] = args?.region; resourceInputs["backupVaultArn"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(VaultPolicy.__pulumiType, name, resourceInputs, opts); } } exports.VaultPolicy = VaultPolicy; /** @internal */ VaultPolicy.__pulumiType = 'aws:backup/vaultPolicy:VaultPolicy'; //# sourceMappingURL=vaultPolicy.js.map