UNPKG

@pulumi/aws

Version:

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

141 lines 5.79 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"); /** * Provides an Application AutoScaling ScheduledAction resource. * * ## Example Usage * * ### DynamoDB Table Autoscaling * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const dynamodb = new aws.appautoscaling.Target("dynamodb", { * maxCapacity: 100, * minCapacity: 5, * resourceId: "table/tableName", * scalableDimension: "dynamodb:table:ReadCapacityUnits", * serviceNamespace: "dynamodb", * }); * const dynamodbScheduledAction = new aws.appautoscaling.ScheduledAction("dynamodb", { * name: "dynamodb", * serviceNamespace: dynamodb.serviceNamespace, * resourceId: dynamodb.resourceId, * scalableDimension: dynamodb.scalableDimension, * schedule: "at(2006-01-02T15:04:05)", * scalableTargetAction: { * minCapacity: 1, * maxCapacity: 200, * }, * }); * ``` * * ### ECS Service Autoscaling * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const ecs = new aws.appautoscaling.Target("ecs", { * maxCapacity: 4, * minCapacity: 1, * resourceId: "service/clusterName/serviceName", * scalableDimension: "ecs:service:DesiredCount", * serviceNamespace: "ecs", * }); * const ecsScheduledAction = new aws.appautoscaling.ScheduledAction("ecs", { * name: "ecs", * serviceNamespace: ecs.serviceNamespace, * resourceId: ecs.resourceId, * scalableDimension: ecs.scalableDimension, * schedule: "at(2006-01-02T15:04:05)", * scalableTargetAction: { * minCapacity: 1, * maxCapacity: 10, * }, * }); * ``` */ 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["arn"] = state?.arn; resourceInputs["endTime"] = state?.endTime; resourceInputs["name"] = state?.name; resourceInputs["region"] = state?.region; resourceInputs["resourceId"] = state?.resourceId; resourceInputs["scalableDimension"] = state?.scalableDimension; resourceInputs["scalableTargetAction"] = state?.scalableTargetAction; resourceInputs["schedule"] = state?.schedule; resourceInputs["serviceNamespace"] = state?.serviceNamespace; resourceInputs["startTime"] = state?.startTime; resourceInputs["timezone"] = state?.timezone; } else { const args = argsOrState; if (args?.resourceId === undefined && !opts.urn) { throw new Error("Missing required property 'resourceId'"); } if (args?.scalableDimension === undefined && !opts.urn) { throw new Error("Missing required property 'scalableDimension'"); } if (args?.scalableTargetAction === undefined && !opts.urn) { throw new Error("Missing required property 'scalableTargetAction'"); } if (args?.schedule === undefined && !opts.urn) { throw new Error("Missing required property 'schedule'"); } if (args?.serviceNamespace === undefined && !opts.urn) { throw new Error("Missing required property 'serviceNamespace'"); } resourceInputs["endTime"] = args?.endTime; resourceInputs["name"] = args?.name; resourceInputs["region"] = args?.region; resourceInputs["resourceId"] = args?.resourceId; resourceInputs["scalableDimension"] = args?.scalableDimension; resourceInputs["scalableTargetAction"] = args?.scalableTargetAction; resourceInputs["schedule"] = args?.schedule; resourceInputs["serviceNamespace"] = args?.serviceNamespace; resourceInputs["startTime"] = args?.startTime; resourceInputs["timezone"] = args?.timezone; resourceInputs["arn"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(ScheduledAction.__pulumiType, name, resourceInputs, opts); } } exports.ScheduledAction = ScheduledAction; /** @internal */ ScheduledAction.__pulumiType = 'aws:appautoscaling/scheduledAction:ScheduledAction'; //# sourceMappingURL=scheduledAction.js.map