UNPKG

@pulumi/aws

Version:

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

144 lines 5.69 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.LifecyclePolicy = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("../utilities"); /** * Manages an Image Builder Lifecycle Policy. * * ## Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const current = aws.getRegion({}); * const currentGetPartition = aws.getPartition({}); * const example = new aws.iam.Role("example", { * assumeRolePolicy: JSON.stringify({ * Version: "2012-10-17", * Statement: [{ * Action: "sts:AssumeRole", * Effect: "Allow", * Principal: { * Service: currentGetPartition.then(currentGetPartition => `imagebuilder.${currentGetPartition.dnsSuffix}`), * }, * }], * }), * name: "example", * }); * const exampleRolePolicyAttachment = new aws.iam.RolePolicyAttachment("example", { * policyArn: currentGetPartition.then(currentGetPartition => `arn:${currentGetPartition.partition}:iam::aws:policy/service-role/EC2ImageBuilderLifecycleExecutionPolicy`), * role: example.name, * }); * const exampleLifecyclePolicy = new aws.imagebuilder.LifecyclePolicy("example", { * name: "name", * description: "Example description", * executionRole: example.arn, * resourceType: "AMI_IMAGE", * policyDetails: [{ * action: { * type: "DELETE", * }, * filter: { * type: "AGE", * value: 6, * retainAtLeast: 10, * unit: "YEARS", * }, * }], * resourceSelection: { * tagMap: { * key1: "value1", * key2: "value2", * }, * }, * }, { * dependsOn: [exampleRolePolicyAttachment], * }); * ``` * * ## Import * * ### Identity Schema * * #### Required * * - `arn` (String) Amazon Resource Name (ARN) of the Image Builder lifecycle policy. * * Using `pulumi import`, import `aws_imagebuilder_lifecycle_policy` using the Amazon Resource Name (ARN). For example: * * console * * % pulumi import aws_imagebuilder_lifecycle_policy.example arn:aws:imagebuilder:us-east-1:123456789012:lifecycle-policy/example */ class LifecyclePolicy extends pulumi.CustomResource { /** * Get an existing LifecyclePolicy 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 LifecyclePolicy(name, state, { ...opts, id: id }); } /** * Returns true if the given object is an instance of LifecyclePolicy. 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'] === LifecyclePolicy.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["arn"] = state?.arn; resourceInputs["description"] = state?.description; resourceInputs["executionRole"] = state?.executionRole; resourceInputs["name"] = state?.name; resourceInputs["policyDetails"] = state?.policyDetails; resourceInputs["region"] = state?.region; resourceInputs["resourceSelection"] = state?.resourceSelection; resourceInputs["resourceType"] = state?.resourceType; resourceInputs["status"] = state?.status; resourceInputs["tags"] = state?.tags; resourceInputs["tagsAll"] = state?.tagsAll; } else { const args = argsOrState; if (args?.executionRole === undefined && !opts.urn) { throw new Error("Missing required property 'executionRole'"); } if (args?.resourceType === undefined && !opts.urn) { throw new Error("Missing required property 'resourceType'"); } resourceInputs["description"] = args?.description; resourceInputs["executionRole"] = args?.executionRole; resourceInputs["name"] = args?.name; resourceInputs["policyDetails"] = args?.policyDetails; resourceInputs["region"] = args?.region; resourceInputs["resourceSelection"] = args?.resourceSelection; resourceInputs["resourceType"] = args?.resourceType; resourceInputs["status"] = args?.status; resourceInputs["tags"] = args?.tags; resourceInputs["arn"] = undefined /*out*/; resourceInputs["tagsAll"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(LifecyclePolicy.__pulumiType, name, resourceInputs, opts); } } exports.LifecyclePolicy = LifecyclePolicy; /** @internal */ LifecyclePolicy.__pulumiType = 'aws:imagebuilder/lifecyclePolicy:LifecyclePolicy'; //# sourceMappingURL=lifecyclePolicy.js.map