@pulumi/aws
Version:
A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.
100 lines • 4.34 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.LogDestinationPolicy = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Provides a CloudWatch Logs destination policy resource.
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const testDestination = new aws.cloudwatch.LogDestination("test_destination", {
* name: "test_destination",
* roleArn: iamForCloudwatch.arn,
* targetArn: kinesisForCloudwatch.arn,
* });
* const testDestinationPolicy = aws.iam.getPolicyDocumentOutput({
* statements: [{
* effect: "Allow",
* principals: [{
* type: "AWS",
* identifiers: ["123456789012"],
* }],
* actions: ["logs:PutSubscriptionFilter"],
* resources: [testDestination.arn],
* }],
* });
* const testDestinationPolicyLogDestinationPolicy = new aws.cloudwatch.LogDestinationPolicy("test_destination_policy", {
* destinationName: testDestination.name,
* accessPolicy: testDestinationPolicy.apply(testDestinationPolicy => testDestinationPolicy.json),
* });
* ```
*
* ## Import
*
* Using `pulumi import`, import CloudWatch Logs destination policies using the `destination_name`. For example:
*
* ```sh
* $ pulumi import aws:cloudwatch/logDestinationPolicy:LogDestinationPolicy test_destination_policy test_destination
* ```
*/
class LogDestinationPolicy extends pulumi.CustomResource {
/**
* Get an existing LogDestinationPolicy 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 LogDestinationPolicy(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of LogDestinationPolicy. 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'] === LogDestinationPolicy.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["accessPolicy"] = state ? state.accessPolicy : undefined;
resourceInputs["destinationName"] = state ? state.destinationName : undefined;
resourceInputs["forceUpdate"] = state ? state.forceUpdate : undefined;
resourceInputs["region"] = state ? state.region : undefined;
}
else {
const args = argsOrState;
if ((!args || args.accessPolicy === undefined) && !opts.urn) {
throw new Error("Missing required property 'accessPolicy'");
}
if ((!args || args.destinationName === undefined) && !opts.urn) {
throw new Error("Missing required property 'destinationName'");
}
resourceInputs["accessPolicy"] = args ? args.accessPolicy : undefined;
resourceInputs["destinationName"] = args ? args.destinationName : undefined;
resourceInputs["forceUpdate"] = args ? args.forceUpdate : undefined;
resourceInputs["region"] = args ? args.region : undefined;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(LogDestinationPolicy.__pulumiType, name, resourceInputs, opts);
}
}
exports.LogDestinationPolicy = LogDestinationPolicy;
/** @internal */
LogDestinationPolicy.__pulumiType = 'aws:cloudwatch/logDestinationPolicy:LogDestinationPolicy';
//# sourceMappingURL=logDestinationPolicy.js.map