UNPKG

@pulumi/aws

Version:

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

123 lines 4.79 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.LogResourcePolicy = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("../utilities"); /** * Provides a resource to manage a CloudWatch log resource policy. * * ## Example Usage * * ### Elasticsearch Log Publishing * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const elasticsearch_log_publishing_policy = aws.iam.getPolicyDocument({ * statements: [{ * actions: [ * "logs:CreateLogStream", * "logs:PutLogEvents", * "logs:PutLogEventsBatch", * ], * resources: ["arn:aws:logs:*"], * principals: [{ * identifiers: ["es.amazonaws.com"], * type: "Service", * }], * }], * }); * const elasticsearch_log_publishing_policyLogResourcePolicy = new aws.cloudwatch.LogResourcePolicy("elasticsearch-log-publishing-policy", { * policyDocument: elasticsearch_log_publishing_policy.then(elasticsearch_log_publishing_policy => elasticsearch_log_publishing_policy.json), * policyName: "elasticsearch-log-publishing-policy", * }); * ``` * * ### Route53 Query Logging * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const route53_query_logging_policy = aws.iam.getPolicyDocument({ * statements: [{ * actions: [ * "logs:CreateLogStream", * "logs:PutLogEvents", * ], * resources: ["arn:aws:logs:*:*:log-group:/aws/route53/*"], * principals: [{ * identifiers: ["route53.amazonaws.com"], * type: "Service", * }], * }], * }); * const route53_query_logging_policyLogResourcePolicy = new aws.cloudwatch.LogResourcePolicy("route53-query-logging-policy", { * policyDocument: route53_query_logging_policy.then(route53_query_logging_policy => route53_query_logging_policy.json), * policyName: "route53-query-logging-policy", * }); * ``` * * ## Import * * Using `pulumi import`, import CloudWatch log resource policies using the policy name. For example: * * ```sh * $ pulumi import aws:cloudwatch/logResourcePolicy:LogResourcePolicy MyPolicy MyPolicy * ``` */ class LogResourcePolicy extends pulumi.CustomResource { /** * Get an existing LogResourcePolicy 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 LogResourcePolicy(name, state, { ...opts, id: id }); } /** * Returns true if the given object is an instance of LogResourcePolicy. 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'] === LogResourcePolicy.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["policyDocument"] = state?.policyDocument; resourceInputs["policyName"] = state?.policyName; resourceInputs["region"] = state?.region; } 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'"); } resourceInputs["policyDocument"] = args?.policyDocument; resourceInputs["policyName"] = args?.policyName; resourceInputs["region"] = args?.region; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(LogResourcePolicy.__pulumiType, name, resourceInputs, opts); } } exports.LogResourcePolicy = LogResourcePolicy; /** @internal */ LogResourcePolicy.__pulumiType = 'aws:cloudwatch/logResourcePolicy:LogResourcePolicy'; //# sourceMappingURL=logResourcePolicy.js.map