@pulumi/aws
Version:
A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.
220 lines • 8.12 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.MaintenanceWindowTask = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Provides an SSM Maintenance Window Task resource
*
* ## Example Usage
*
* ### Automation Tasks
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const example = new aws.ssm.MaintenanceWindowTask("example", {
* maxConcurrency: "2",
* maxErrors: "1",
* priority: 1,
* taskArn: "AWS-RestartEC2Instance",
* taskType: "AUTOMATION",
* windowId: exampleAwsSsmMaintenanceWindow.id,
* targets: [{
* key: "InstanceIds",
* values: [exampleAwsInstance.id],
* }],
* taskInvocationParameters: {
* automationParameters: {
* documentVersion: "$LATEST",
* parameters: [{
* name: "InstanceId",
* values: [exampleAwsInstance.id],
* }],
* },
* },
* });
* ```
*
* ### Lambda Tasks
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
* import * as std from "@pulumi/std";
*
* const example = new aws.ssm.MaintenanceWindowTask("example", {
* maxConcurrency: "2",
* maxErrors: "1",
* priority: 1,
* taskArn: exampleAwsLambdaFunction.arn,
* taskType: "LAMBDA",
* windowId: exampleAwsSsmMaintenanceWindow.id,
* targets: [{
* key: "InstanceIds",
* values: [exampleAwsInstance.id],
* }],
* taskInvocationParameters: {
* lambdaParameters: {
* clientContext: std.base64encode({
* input: "{\"key1\":\"value1\"}",
* }).then(invoke => invoke.result),
* payload: "{\"key1\":\"value1\"}",
* },
* },
* });
* ```
*
* ### Run Command Tasks
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const example = new aws.ssm.MaintenanceWindowTask("example", {
* maxConcurrency: "2",
* maxErrors: "1",
* priority: 1,
* taskArn: "AWS-RunShellScript",
* taskType: "RUN_COMMAND",
* windowId: exampleAwsSsmMaintenanceWindow.id,
* targets: [{
* key: "InstanceIds",
* values: [exampleAwsInstance.id],
* }],
* taskInvocationParameters: {
* runCommandParameters: {
* outputS3Bucket: exampleAwsS3Bucket.id,
* outputS3KeyPrefix: "output",
* serviceRoleArn: exampleAwsIamRole.arn,
* timeoutSeconds: 600,
* notificationConfig: {
* notificationArn: exampleAwsSnsTopic.arn,
* notificationEvents: ["All"],
* notificationType: "Command",
* },
* parameters: [{
* name: "commands",
* values: ["date"],
* }],
* },
* },
* });
* ```
*
* ### Step Function Tasks
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const example = new aws.ssm.MaintenanceWindowTask("example", {
* maxConcurrency: "2",
* maxErrors: "1",
* priority: 1,
* taskArn: exampleAwsSfnActivity.id,
* taskType: "STEP_FUNCTIONS",
* windowId: exampleAwsSsmMaintenanceWindow.id,
* targets: [{
* key: "InstanceIds",
* values: [exampleAwsInstance.id],
* }],
* taskInvocationParameters: {
* stepFunctionsParameters: {
* input: "{\"key1\":\"value1\"}",
* name: "example",
* },
* },
* });
* ```
*
* ## Import
*
* Using `pulumi import`, import AWS Maintenance Window Task using the `window_id` and `window_task_id` separated by `/`. For example:
*
* ```sh
* $ pulumi import aws:ssm/maintenanceWindowTask:MaintenanceWindowTask task <window_id>/<window_task_id>
* ```
*/
class MaintenanceWindowTask extends pulumi.CustomResource {
/**
* Get an existing MaintenanceWindowTask 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 MaintenanceWindowTask(name, state, { ...opts, id: id });
}
/**
* Returns true if the given object is an instance of MaintenanceWindowTask. 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'] === MaintenanceWindowTask.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["arn"] = state?.arn;
resourceInputs["cutoffBehavior"] = state?.cutoffBehavior;
resourceInputs["description"] = state?.description;
resourceInputs["maxConcurrency"] = state?.maxConcurrency;
resourceInputs["maxErrors"] = state?.maxErrors;
resourceInputs["name"] = state?.name;
resourceInputs["priority"] = state?.priority;
resourceInputs["region"] = state?.region;
resourceInputs["serviceRoleArn"] = state?.serviceRoleArn;
resourceInputs["targets"] = state?.targets;
resourceInputs["taskArn"] = state?.taskArn;
resourceInputs["taskInvocationParameters"] = state?.taskInvocationParameters;
resourceInputs["taskType"] = state?.taskType;
resourceInputs["windowId"] = state?.windowId;
resourceInputs["windowTaskId"] = state?.windowTaskId;
}
else {
const args = argsOrState;
if (args?.taskArn === undefined && !opts.urn) {
throw new Error("Missing required property 'taskArn'");
}
if (args?.taskType === undefined && !opts.urn) {
throw new Error("Missing required property 'taskType'");
}
if (args?.windowId === undefined && !opts.urn) {
throw new Error("Missing required property 'windowId'");
}
resourceInputs["cutoffBehavior"] = args?.cutoffBehavior;
resourceInputs["description"] = args?.description;
resourceInputs["maxConcurrency"] = args?.maxConcurrency;
resourceInputs["maxErrors"] = args?.maxErrors;
resourceInputs["name"] = args?.name;
resourceInputs["priority"] = args?.priority;
resourceInputs["region"] = args?.region;
resourceInputs["serviceRoleArn"] = args?.serviceRoleArn;
resourceInputs["targets"] = args?.targets;
resourceInputs["taskArn"] = args?.taskArn;
resourceInputs["taskInvocationParameters"] = args?.taskInvocationParameters;
resourceInputs["taskType"] = args?.taskType;
resourceInputs["windowId"] = args?.windowId;
resourceInputs["arn"] = undefined /*out*/;
resourceInputs["windowTaskId"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(MaintenanceWindowTask.__pulumiType, name, resourceInputs, opts);
}
}
exports.MaintenanceWindowTask = MaintenanceWindowTask;
/** @internal */
MaintenanceWindowTask.__pulumiType = 'aws:ssm/maintenanceWindowTask:MaintenanceWindowTask';
//# sourceMappingURL=maintenanceWindowTask.js.map
;