@pulumi/aws
Version:
A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.
157 lines • 6.22 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.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, Object.assign(Object.assign({}, 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 ? state.description : undefined;
resourceInputs["enable"] = state ? state.enable : undefined;
resourceInputs["endTime"] = state ? state.endTime : undefined;
resourceInputs["iamRole"] = state ? state.iamRole : undefined;
resourceInputs["name"] = state ? state.name : undefined;
resourceInputs["region"] = state ? state.region : undefined;
resourceInputs["schedule"] = state ? state.schedule : undefined;
resourceInputs["startTime"] = state ? state.startTime : undefined;
resourceInputs["targetAction"] = state ? state.targetAction : undefined;
}
else {
const args = argsOrState;
if ((!args || args.iamRole === undefined) && !opts.urn) {
throw new Error("Missing required property 'iamRole'");
}
if ((!args || args.schedule === undefined) && !opts.urn) {
throw new Error("Missing required property 'schedule'");
}
if ((!args || args.targetAction === undefined) && !opts.urn) {
throw new Error("Missing required property 'targetAction'");
}
resourceInputs["description"] = args ? args.description : undefined;
resourceInputs["enable"] = args ? args.enable : undefined;
resourceInputs["endTime"] = args ? args.endTime : undefined;
resourceInputs["iamRole"] = args ? args.iamRole : undefined;
resourceInputs["name"] = args ? args.name : undefined;
resourceInputs["region"] = args ? args.region : undefined;
resourceInputs["schedule"] = args ? args.schedule : undefined;
resourceInputs["startTime"] = args ? args.startTime : undefined;
resourceInputs["targetAction"] = args ? args.targetAction : undefined;
}
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