@pulumi/aws
Version:
A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.
106 lines • 4.25 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.LogSubscription = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Provides a Log subscription for AWS Directory Service that pushes logs to cloudwatch.
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const example = new aws.cloudwatch.LogGroup("example", {
* name: `/aws/directoryservice/${exampleAwsDirectoryServiceDirectory.id}`,
* retentionInDays: 14,
* });
* const ad_log_policy = aws.iam.getPolicyDocumentOutput({
* statements: [{
* actions: [
* "logs:CreateLogStream",
* "logs:PutLogEvents",
* ],
* principals: [{
* identifiers: ["ds.amazonaws.com"],
* type: "Service",
* }],
* resources: [pulumi.interpolate`${example.arn}:*`],
* effect: "Allow",
* }],
* });
* const ad_log_policyLogResourcePolicy = new aws.cloudwatch.LogResourcePolicy("ad-log-policy", {
* policyDocument: ad_log_policy.apply(ad_log_policy => ad_log_policy.json),
* policyName: "ad-log-policy",
* });
* const exampleLogSubscription = new aws.directoryservice.LogSubscription("example", {
* directoryId: exampleAwsDirectoryServiceDirectory.id,
* logGroupName: example.name,
* });
* ```
*
* ## Import
*
* Using `pulumi import`, import Directory Service Log Subscriptions using the directory id. For example:
*
* ```sh
* $ pulumi import aws:directoryservice/logSubscription:LogSubscription msad d-1234567890
* ```
*/
class LogSubscription extends pulumi.CustomResource {
/**
* Get an existing LogSubscription 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 LogSubscription(name, state, { ...opts, id: id });
}
/**
* Returns true if the given object is an instance of LogSubscription. 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'] === LogSubscription.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["directoryId"] = state?.directoryId;
resourceInputs["logGroupName"] = state?.logGroupName;
resourceInputs["region"] = state?.region;
}
else {
const args = argsOrState;
if (args?.directoryId === undefined && !opts.urn) {
throw new Error("Missing required property 'directoryId'");
}
if (args?.logGroupName === undefined && !opts.urn) {
throw new Error("Missing required property 'logGroupName'");
}
resourceInputs["directoryId"] = args?.directoryId;
resourceInputs["logGroupName"] = args?.logGroupName;
resourceInputs["region"] = args?.region;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
const aliasOpts = { aliases: [{ type: "aws:directoryservice/logService:LogService" }] };
opts = pulumi.mergeOptions(opts, aliasOpts);
super(LogSubscription.__pulumiType, name, resourceInputs, opts);
}
}
exports.LogSubscription = LogSubscription;
/** @internal */
LogSubscription.__pulumiType = 'aws:directoryservice/logSubscription:LogSubscription';
//# sourceMappingURL=logSubscription.js.map