UNPKG

@pulumi/aws

Version:

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

157 lines 5.83 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.ScheduledAction = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("../utilities"); /** * ## Example Usage * * ### Pause Cluster Action * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const assumeRole = aws.iam.getPolicyDocument({ * statements: [{ * effect: "Allow", * principals: [{ * type: "Service", * identifiers: ["scheduler.redshift.amazonaws.com"], * }], * actions: ["sts:AssumeRole"], * }], * }); * const exampleRole = new aws.iam.Role("example", { * name: "redshift_scheduled_action", * assumeRolePolicy: assumeRole.then(assumeRole => assumeRole.json), * }); * const example = aws.iam.getPolicyDocument({ * statements: [{ * effect: "Allow", * actions: [ * "redshift:PauseCluster", * "redshift:ResumeCluster", * "redshift:ResizeCluster", * ], * resources: ["*"], * }], * }); * const examplePolicy = new aws.iam.Policy("example", { * name: "redshift_scheduled_action", * policy: example.then(example => example.json), * }); * const exampleRolePolicyAttachment = new aws.iam.RolePolicyAttachment("example", { * policyArn: examplePolicy.arn, * role: exampleRole.name, * }); * const exampleScheduledAction = new aws.redshift.ScheduledAction("example", { * name: "tf-redshift-scheduled-action", * schedule: "cron(00 23 * * ? *)", * iamRole: exampleRole.arn, * targetAction: { * pauseCluster: { * clusterIdentifier: "tf-redshift001", * }, * }, * }); * ``` * * ### Resize Cluster Action * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const example = new aws.redshift.ScheduledAction("example", { * name: "tf-redshift-scheduled-action", * schedule: "cron(00 23 * * ? *)", * iamRole: exampleAwsIamRole.arn, * targetAction: { * resizeCluster: { * clusterIdentifier: "tf-redshift001", * clusterType: "multi-node", * nodeType: "dc1.large", * numberOfNodes: 2, * }, * }, * }); * ``` * * ## Import * * Using `pulumi import`, import Redshift Scheduled Action using the `name`. For example: * * ```sh * $ pulumi import aws:redshift/scheduledAction:ScheduledAction example tf-redshift-scheduled-action * ``` */ class ScheduledAction extends pulumi.CustomResource { /** * Get an existing ScheduledAction 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 ScheduledAction(name, state, { ...opts, id: id }); } /** * Returns true if the given object is an instance of ScheduledAction. 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'] === ScheduledAction.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["description"] = state?.description; resourceInputs["enable"] = state?.enable; resourceInputs["endTime"] = state?.endTime; resourceInputs["iamRole"] = state?.iamRole; resourceInputs["name"] = state?.name; resourceInputs["region"] = state?.region; resourceInputs["schedule"] = state?.schedule; resourceInputs["startTime"] = state?.startTime; resourceInputs["targetAction"] = state?.targetAction; } else { const args = argsOrState; if (args?.iamRole === undefined && !opts.urn) { throw new Error("Missing required property 'iamRole'"); } if (args?.schedule === undefined && !opts.urn) { throw new Error("Missing required property 'schedule'"); } if (args?.targetAction === undefined && !opts.urn) { throw new Error("Missing required property 'targetAction'"); } resourceInputs["description"] = args?.description; resourceInputs["enable"] = args?.enable; resourceInputs["endTime"] = args?.endTime; resourceInputs["iamRole"] = args?.iamRole; resourceInputs["name"] = args?.name; resourceInputs["region"] = args?.region; resourceInputs["schedule"] = args?.schedule; resourceInputs["startTime"] = args?.startTime; resourceInputs["targetAction"] = args?.targetAction; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(ScheduledAction.__pulumiType, name, resourceInputs, opts); } } exports.ScheduledAction = ScheduledAction; /** @internal */ ScheduledAction.__pulumiType = 'aws:redshift/scheduledAction:ScheduledAction'; //# sourceMappingURL=scheduledAction.js.map