@pulumi/aws
Version:
A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.
137 lines • 5.82 kB
JavaScript
;
// *** 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.ProtectionGroup = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Creates a grouping of protected resources so they can be handled as a collective.
* This resource grouping improves the accuracy of detection and reduces false positives. For more information see
* [Managing AWS Shield Advanced protection groups](https://docs.aws.amazon.com/waf/latest/developerguide/manage-protection-group.html)
*
* ## Example Usage
*
* ### Create protection group for all resources
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const example = new aws.shield.ProtectionGroup("example", {
* protectionGroupId: "example",
* aggregation: "MAX",
* pattern: "ALL",
* });
* ```
*
* ### Create protection group for arbitrary number of resources
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const current = aws.getRegion({});
* const currentGetCallerIdentity = aws.getCallerIdentity({});
* const example = new aws.ec2.Eip("example", {domain: "vpc"});
* const exampleProtection = new aws.shield.Protection("example", {
* name: "example",
* resourceArn: pulumi.all([current, currentGetCallerIdentity, example.id]).apply(([current, currentGetCallerIdentity, id]) => `arn:aws:ec2:${current.region}:${currentGetCallerIdentity.accountId}:eip-allocation/${id}`),
* });
* const exampleProtectionGroup = new aws.shield.ProtectionGroup("example", {
* protectionGroupId: "example",
* aggregation: "MEAN",
* pattern: "ARBITRARY",
* members: [pulumi.all([current, currentGetCallerIdentity, example.id]).apply(([current, currentGetCallerIdentity, id]) => `arn:aws:ec2:${current.region}:${currentGetCallerIdentity.accountId}:eip-allocation/${id}`)],
* }, {
* dependsOn: [exampleProtection],
* });
* ```
*
* ### Create protection group for a type of resource
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const example = new aws.shield.ProtectionGroup("example", {
* protectionGroupId: "example",
* aggregation: "SUM",
* pattern: "BY_RESOURCE_TYPE",
* resourceType: "ELASTIC_IP_ALLOCATION",
* });
* ```
*
* ## Import
*
* Using `pulumi import`, import Shield protection group resources using their protection group id. For example:
*
* ```sh
* $ pulumi import aws:shield/protectionGroup:ProtectionGroup example example
* ```
*/
class ProtectionGroup extends pulumi.CustomResource {
/**
* Get an existing ProtectionGroup 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 ProtectionGroup(name, state, { ...opts, id: id });
}
/**
* Returns true if the given object is an instance of ProtectionGroup. 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'] === ProtectionGroup.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["aggregation"] = state?.aggregation;
resourceInputs["members"] = state?.members;
resourceInputs["pattern"] = state?.pattern;
resourceInputs["protectionGroupArn"] = state?.protectionGroupArn;
resourceInputs["protectionGroupId"] = state?.protectionGroupId;
resourceInputs["resourceType"] = state?.resourceType;
resourceInputs["tags"] = state?.tags;
resourceInputs["tagsAll"] = state?.tagsAll;
}
else {
const args = argsOrState;
if (args?.aggregation === undefined && !opts.urn) {
throw new Error("Missing required property 'aggregation'");
}
if (args?.pattern === undefined && !opts.urn) {
throw new Error("Missing required property 'pattern'");
}
if (args?.protectionGroupId === undefined && !opts.urn) {
throw new Error("Missing required property 'protectionGroupId'");
}
resourceInputs["aggregation"] = args?.aggregation;
resourceInputs["members"] = args?.members;
resourceInputs["pattern"] = args?.pattern;
resourceInputs["protectionGroupId"] = args?.protectionGroupId;
resourceInputs["resourceType"] = args?.resourceType;
resourceInputs["tags"] = args?.tags;
resourceInputs["protectionGroupArn"] = undefined /*out*/;
resourceInputs["tagsAll"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(ProtectionGroup.__pulumiType, name, resourceInputs, opts);
}
}
exports.ProtectionGroup = ProtectionGroup;
/** @internal */
ProtectionGroup.__pulumiType = 'aws:shield/protectionGroup:ProtectionGroup';
//# sourceMappingURL=protectionGroup.js.map