UNPKG

@volcengine/pulumi

Version:

A Pulumi package for creating and managing volcengine cloud resources.

134 lines 6.26 kB
"use strict"; // *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. *** // *** Do not edit by hand unless you're certain you know what you are doing! *** Object.defineProperty(exports, "__esModule", { value: true }); exports.ScalingLifecycleHook = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("../utilities"); /** * Provides a resource to manage scaling lifecycle hook * ## Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as volcengine from "@pulumi/volcengine"; * import * as volcengine from "@volcengine/pulumi"; * * const fooZones = volcengine.ecs.getZones({}); * const fooVpc = new volcengine.vpc.Vpc("fooVpc", { * vpcName: "acc-test-vpc", * cidrBlock: "172.16.0.0/16", * }); * const fooSubnet = new volcengine.vpc.Subnet("fooSubnet", { * subnetName: "acc-test-subnet", * cidrBlock: "172.16.0.0/24", * zoneId: fooZones.then(fooZones => fooZones.zones?.[0]?.id), * vpcId: fooVpc.id, * }); * const fooCommand = new volcengine.ecs.Command("fooCommand", { * description: "tf", * workingDir: "/home", * username: "root", * timeout: 100, * commandContent: "IyEvYmluL2Jhc2gKCgplY2hvICJvcGVyYXRpb24gc3VjY2VzcyEi", * }); * const fooScalingGroup = new volcengine.autoscaling.ScalingGroup("fooScalingGroup", { * scalingGroupName: "acc-test-scaling-group-lifecycle", * subnetIds: [fooSubnet.id], * multiAzPolicy: "BALANCE", * desireInstanceNumber: 0, * minInstanceNumber: 0, * maxInstanceNumber: 1, * instanceTerminatePolicy: "OldestInstance", * defaultCooldown: 10, * }); * const fooScalingLifecycleHook = new volcengine.autoscaling.ScalingLifecycleHook("fooScalingLifecycleHook", { * lifecycleHookName: "acc-test-lifecycle", * lifecycleHookPolicy: "ROLLBACK", * lifecycleHookTimeout: 300, * lifecycleHookType: "SCALE_OUT", * scalingGroupId: fooScalingGroup.id, * }); * // lifecycle_command { * // command_id = volcengine_ecs_command.foo.id * // parameters = "{}" * // } * ``` * * ## Import * * ScalingLifecycleHook can be imported using the ScalingGroupId:LifecycleHookId, e.g. * * ```sh * $ pulumi import volcengine:autoscaling/scalingLifecycleHook:ScalingLifecycleHook default scg-yblfbfhy7agh9zn72iaz:sgh-ybqholahe4gso0ee88sd * ``` */ class ScalingLifecycleHook extends pulumi.CustomResource { /** * Get an existing ScalingLifecycleHook 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 ScalingLifecycleHook(name, state, Object.assign(Object.assign({}, opts), { id: id })); } /** * Returns true if the given object is an instance of ScalingLifecycleHook. 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'] === ScalingLifecycleHook.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["lifecycleCommand"] = state ? state.lifecycleCommand : undefined; resourceInputs["lifecycleHookId"] = state ? state.lifecycleHookId : undefined; resourceInputs["lifecycleHookName"] = state ? state.lifecycleHookName : undefined; resourceInputs["lifecycleHookPolicy"] = state ? state.lifecycleHookPolicy : undefined; resourceInputs["lifecycleHookTimeout"] = state ? state.lifecycleHookTimeout : undefined; resourceInputs["lifecycleHookType"] = state ? state.lifecycleHookType : undefined; resourceInputs["scalingGroupId"] = state ? state.scalingGroupId : undefined; } else { const args = argsOrState; if ((!args || args.lifecycleHookName === undefined) && !opts.urn) { throw new Error("Missing required property 'lifecycleHookName'"); } if ((!args || args.lifecycleHookPolicy === undefined) && !opts.urn) { throw new Error("Missing required property 'lifecycleHookPolicy'"); } if ((!args || args.lifecycleHookTimeout === undefined) && !opts.urn) { throw new Error("Missing required property 'lifecycleHookTimeout'"); } if ((!args || args.lifecycleHookType === undefined) && !opts.urn) { throw new Error("Missing required property 'lifecycleHookType'"); } if ((!args || args.scalingGroupId === undefined) && !opts.urn) { throw new Error("Missing required property 'scalingGroupId'"); } resourceInputs["lifecycleCommand"] = args ? args.lifecycleCommand : undefined; resourceInputs["lifecycleHookName"] = args ? args.lifecycleHookName : undefined; resourceInputs["lifecycleHookPolicy"] = args ? args.lifecycleHookPolicy : undefined; resourceInputs["lifecycleHookTimeout"] = args ? args.lifecycleHookTimeout : undefined; resourceInputs["lifecycleHookType"] = args ? args.lifecycleHookType : undefined; resourceInputs["scalingGroupId"] = args ? args.scalingGroupId : undefined; resourceInputs["lifecycleHookId"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(ScalingLifecycleHook.__pulumiType, name, resourceInputs, opts); } } exports.ScalingLifecycleHook = ScalingLifecycleHook; /** @internal */ ScalingLifecycleHook.__pulumiType = 'volcengine:autoscaling/scalingLifecycleHook:ScalingLifecycleHook'; //# sourceMappingURL=scalingLifecycleHook.js.map