UNPKG

@pulumi/aws

Version:

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

145 lines 5.38 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.MaintenanceWindowTarget = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("../utilities"); /** * Provides an SSM Maintenance Window Target resource * * ## Example Usage * * ### Instance Target * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const window = new aws.ssm.MaintenanceWindow("window", { * name: "maintenance-window-webapp", * schedule: "cron(0 16 ? * TUE *)", * duration: 3, * cutoff: 1, * }); * const target1 = new aws.ssm.MaintenanceWindowTarget("target1", { * windowId: window.id, * name: "maintenance-window-target", * description: "This is a maintenance window target", * resourceType: "INSTANCE", * targets: [{ * key: "tag:Name", * values: ["acceptance_test"], * }], * }); * ``` * * ### Resource Group Target * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const window = new aws.ssm.MaintenanceWindow("window", { * name: "maintenance-window-webapp", * schedule: "cron(0 16 ? * TUE *)", * duration: 3, * cutoff: 1, * }); * const target1 = new aws.ssm.MaintenanceWindowTarget("target1", { * windowId: window.id, * name: "maintenance-window-target", * description: "This is a maintenance window target", * resourceType: "RESOURCE_GROUP", * targets: [{ * key: "resource-groups:ResourceTypeFilters", * values: ["AWS::EC2::Instance"], * }], * }); * ``` * * ## Import * * ### Identity Schema * * #### Required * * * `window_id` - (String) ID of the maintenance window. * * * `id` - (String) ID of the maintenance window target. * * #### Optional * * * `account_id` (String) AWS Account where this resource is managed. * * * `region` (String) Region where this resource is managed. * * Using `pulumi import`, import SSM Maintenance Window targets using `WINDOW_ID/WINDOW_TARGET_ID`. For example: * * console * * % pulumi import aws_ssm_maintenance_window_target.example mw-0c50858d01EXAMPLE/23639a0b-ddbc-4bca-9e72-78d96EXAMPLE */ class MaintenanceWindowTarget extends pulumi.CustomResource { /** * Get an existing MaintenanceWindowTarget 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 MaintenanceWindowTarget(name, state, { ...opts, id: id }); } /** * Returns true if the given object is an instance of MaintenanceWindowTarget. 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'] === MaintenanceWindowTarget.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["description"] = state?.description; resourceInputs["name"] = state?.name; resourceInputs["ownerInformation"] = state?.ownerInformation; resourceInputs["region"] = state?.region; resourceInputs["resourceType"] = state?.resourceType; resourceInputs["targets"] = state?.targets; resourceInputs["windowId"] = state?.windowId; } else { const args = argsOrState; if (args?.resourceType === undefined && !opts.urn) { throw new Error("Missing required property 'resourceType'"); } if (args?.targets === undefined && !opts.urn) { throw new Error("Missing required property 'targets'"); } if (args?.windowId === undefined && !opts.urn) { throw new Error("Missing required property 'windowId'"); } resourceInputs["description"] = args?.description; resourceInputs["name"] = args?.name; resourceInputs["ownerInformation"] = args?.ownerInformation; resourceInputs["region"] = args?.region; resourceInputs["resourceType"] = args?.resourceType; resourceInputs["targets"] = args?.targets; resourceInputs["windowId"] = args?.windowId; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(MaintenanceWindowTarget.__pulumiType, name, resourceInputs, opts); } } exports.MaintenanceWindowTarget = MaintenanceWindowTarget; /** @internal */ MaintenanceWindowTarget.__pulumiType = 'aws:ssm/maintenanceWindowTarget:MaintenanceWindowTarget'; //# sourceMappingURL=maintenanceWindowTarget.js.map