@pulumi/aws
Version:
A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.
152 lines • 5.65 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.LogAccountPolicy = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Provides a CloudWatch Log Account Policy resource.
*
* ## Example Usage
*
* ### Account Data Protection Policy
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const dataProtection = new aws.cloudwatch.LogAccountPolicy("data_protection", {
* policyName: "data-protection",
* policyType: "DATA_PROTECTION_POLICY",
* policyDocument: JSON.stringify({
* Name: "DataProtection",
* Version: "2021-06-01",
* Statement: [
* {
* Sid: "Audit",
* DataIdentifier: ["arn:aws:dataprotection::aws:data-identifier/EmailAddress"],
* Operation: {
* Audit: {
* FindingsDestination: {},
* },
* },
* },
* {
* Sid: "Redact",
* DataIdentifier: ["arn:aws:dataprotection::aws:data-identifier/EmailAddress"],
* Operation: {
* Deidentify: {
* MaskConfig: {},
* },
* },
* },
* ],
* }),
* });
* ```
*
* ### Subscription Filter Policy
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const subscriptionFilter = new aws.cloudwatch.LogAccountPolicy("subscription_filter", {
* policyName: "subscription-filter",
* policyType: "SUBSCRIPTION_FILTER_POLICY",
* policyDocument: JSON.stringify({
* DestinationArn: test.arn,
* FilterPattern: "test",
* }),
* selectionCriteria: "LogGroupName NOT IN [\"excluded_log_group_name\"]",
* });
* ```
*
* ### Field Index Policy
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const fieldIndex = new aws.cloudwatch.LogAccountPolicy("field_index", {
* policyName: "field-index",
* policyType: "FIELD_INDEX_POLICY",
* policyDocument: JSON.stringify({
* Fields: [
* "field1",
* "field2",
* ],
* }),
* });
* ```
*
* ## Import
*
* Using `pulumi import`, import this resource using the `policy_name` and `policy_type` separated by `:`. For example:
*
* ```sh
* $ pulumi import aws:cloudwatch/logAccountPolicy:LogAccountPolicy example "my-account-policy:SUBSCRIPTION_FILTER_POLICY"
* ```
*/
class LogAccountPolicy extends pulumi.CustomResource {
/**
* Get an existing LogAccountPolicy 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 LogAccountPolicy(name, state, { ...opts, id: id });
}
/**
* Returns true if the given object is an instance of LogAccountPolicy. 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'] === LogAccountPolicy.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["policyDocument"] = state?.policyDocument;
resourceInputs["policyName"] = state?.policyName;
resourceInputs["policyType"] = state?.policyType;
resourceInputs["region"] = state?.region;
resourceInputs["scope"] = state?.scope;
resourceInputs["selectionCriteria"] = state?.selectionCriteria;
}
else {
const args = argsOrState;
if (args?.policyDocument === undefined && !opts.urn) {
throw new Error("Missing required property 'policyDocument'");
}
if (args?.policyName === undefined && !opts.urn) {
throw new Error("Missing required property 'policyName'");
}
if (args?.policyType === undefined && !opts.urn) {
throw new Error("Missing required property 'policyType'");
}
resourceInputs["policyDocument"] = args?.policyDocument;
resourceInputs["policyName"] = args?.policyName;
resourceInputs["policyType"] = args?.policyType;
resourceInputs["region"] = args?.region;
resourceInputs["scope"] = args?.scope;
resourceInputs["selectionCriteria"] = args?.selectionCriteria;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(LogAccountPolicy.__pulumiType, name, resourceInputs, opts);
}
}
exports.LogAccountPolicy = LogAccountPolicy;
/** @internal */
LogAccountPolicy.__pulumiType = 'aws:cloudwatch/logAccountPolicy:LogAccountPolicy';
//# sourceMappingURL=logAccountPolicy.js.map