UNPKG

@pulumi/aws

Version:

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

153 lines 5.87 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.Link = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("../utilities"); /** * Resource for managing an AWS CloudWatch Observability Access Manager Link. * * > **NOTE:** Creating an `aws.oam.Link` may sometimes fail if the `aws.oam.SinkPolicy` for the attached `aws.oam.Sink` is not created before the `aws.oam.Link`. To prevent this, declare an explicit dependency using a `dependsOn` meta-argument. * * ## Example Usage * * ### Basic Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const exampleSink = new aws.oam.Sink("example", {}); * const exampleSinkPolicy = new aws.oam.SinkPolicy("example", {sinkIdentifier: exampleSink.arn}); * const example = new aws.oam.Link("example", { * labelTemplate: "$AccountName", * resourceTypes: ["AWS::CloudWatch::Metric"], * sinkIdentifier: exampleSink.arn, * tags: { * Env: "prod", * }, * }, { * dependsOn: [exampleSinkPolicy], * }); * ``` * * ### Log Group Filtering * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const example = new aws.oam.Link("example", { * labelTemplate: "$AccountName", * linkConfiguration: { * logGroupConfiguration: { * filter: "LogGroupName LIKE 'aws/lambda/%' OR LogGroupName LIKE 'AWSLogs%'", * }, * }, * resourceTypes: ["AWS::Logs::LogGroup"], * sinkIdentifier: exampleAwsOamSink.arn, * }, { * dependsOn: [exampleAwsOamSinkPolicy], * }); * ``` * * ### Metric Filtering * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const example = new aws.oam.Link("example", { * labelTemplate: "$AccountName", * linkConfiguration: { * metricConfiguration: { * filter: "Namespace IN ('AWS/EC2', 'AWS/ELB', 'AWS/S3')", * }, * }, * resourceTypes: ["AWS::CloudWatch::Metric"], * sinkIdentifier: exampleAwsOamSink.arn, * }, { * dependsOn: [exampleAwsOamSinkPolicy], * }); * ``` * * ## Import * * Using `pulumi import`, import CloudWatch Observability Access Manager Link using the `arn`. For example: * * ```sh * $ pulumi import aws:oam/link:Link example arn:aws:oam:us-west-2:123456789012:link/link-id * ``` */ class Link extends pulumi.CustomResource { /** * Get an existing Link 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 Link(name, state, { ...opts, id: id }); } /** * Returns true if the given object is an instance of Link. 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'] === Link.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["arn"] = state?.arn; resourceInputs["label"] = state?.label; resourceInputs["labelTemplate"] = state?.labelTemplate; resourceInputs["linkConfiguration"] = state?.linkConfiguration; resourceInputs["linkId"] = state?.linkId; resourceInputs["region"] = state?.region; resourceInputs["resourceTypes"] = state?.resourceTypes; resourceInputs["sinkArn"] = state?.sinkArn; resourceInputs["sinkIdentifier"] = state?.sinkIdentifier; resourceInputs["tags"] = state?.tags; resourceInputs["tagsAll"] = state?.tagsAll; } else { const args = argsOrState; if (args?.labelTemplate === undefined && !opts.urn) { throw new Error("Missing required property 'labelTemplate'"); } if (args?.resourceTypes === undefined && !opts.urn) { throw new Error("Missing required property 'resourceTypes'"); } if (args?.sinkIdentifier === undefined && !opts.urn) { throw new Error("Missing required property 'sinkIdentifier'"); } resourceInputs["labelTemplate"] = args?.labelTemplate; resourceInputs["linkConfiguration"] = args?.linkConfiguration; resourceInputs["region"] = args?.region; resourceInputs["resourceTypes"] = args?.resourceTypes; resourceInputs["sinkIdentifier"] = args?.sinkIdentifier; resourceInputs["tags"] = args?.tags; resourceInputs["arn"] = undefined /*out*/; resourceInputs["label"] = undefined /*out*/; resourceInputs["linkId"] = undefined /*out*/; resourceInputs["sinkArn"] = undefined /*out*/; resourceInputs["tagsAll"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(Link.__pulumiType, name, resourceInputs, opts); } } exports.Link = Link; /** @internal */ Link.__pulumiType = 'aws:oam/link:Link'; //# sourceMappingURL=link.js.map