UNPKG

@spacelift-io/pulumi-spacelift

Version:

A Pulumi package for creating and managing Spacelift resources.

104 lines 4.55 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.ScheduledTask = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("./utilities"); /** * `spacelift.ScheduledTask` represents a scheduling configuration for a Stack. It will trigger task on the given schedule or timestamp * * ## Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as spacelift from "@spacelift-io/pulumi-spacelift"; * * const k8s_core = new spacelift.Stack("k8s-core", {}); * // ... * // create the resources of a stack on a given schedule * const k8s_core_create = new spacelift.ScheduledTask("k8s-core-create", { * stackId: k8s_core.id, * command: "pulumi up -auto-approve", * everies: ["0 7 * * 1-5"], * timezone: "CET", * }); * // destroy the resources of a stack on a given schedule * const k8s_core_destroyScheduledTask = new spacelift.ScheduledTask("k8s-core-destroyScheduledTask", { * stackId: k8s_core.id, * command: "terraform destroy -auto-approve", * everies: ["0 21 * * 1-5"], * timezone: "CET", * }); * // at a given timestamp (unix) * const k8s_core_destroyIndex_scheduledTaskScheduledTask = new spacelift.ScheduledTask("k8s-core-destroyIndex/scheduledTaskScheduledTask", { * stackId: k8s_core.id, * command: "terraform destroy -auto-approve", * at: 1663336895, * }); * ``` * * ## Import * * ```sh * $ pulumi import spacelift:index/scheduledTask:ScheduledTask ireland-kubeconfig $STACK_ID/$SCHEDULED_TASK_ID * ``` */ class ScheduledTask extends pulumi.CustomResource { /** * Get an existing ScheduledTask 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 ScheduledTask(name, state, Object.assign(Object.assign({}, opts), { id: id })); } /** * Returns true if the given object is an instance of ScheduledTask. 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'] === ScheduledTask.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["at"] = state ? state.at : undefined; resourceInputs["command"] = state ? state.command : undefined; resourceInputs["everies"] = state ? state.everies : undefined; resourceInputs["scheduleId"] = state ? state.scheduleId : undefined; resourceInputs["stackId"] = state ? state.stackId : undefined; resourceInputs["timezone"] = state ? state.timezone : undefined; } else { const args = argsOrState; if ((!args || args.command === undefined) && !opts.urn) { throw new Error("Missing required property 'command'"); } if ((!args || args.stackId === undefined) && !opts.urn) { throw new Error("Missing required property 'stackId'"); } resourceInputs["at"] = args ? args.at : undefined; resourceInputs["command"] = args ? args.command : undefined; resourceInputs["everies"] = args ? args.everies : undefined; resourceInputs["scheduleId"] = args ? args.scheduleId : undefined; resourceInputs["stackId"] = args ? args.stackId : undefined; resourceInputs["timezone"] = args ? args.timezone : undefined; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(ScheduledTask.__pulumiType, name, resourceInputs, opts); } } exports.ScheduledTask = ScheduledTask; /** @internal */ ScheduledTask.__pulumiType = 'spacelift:index/scheduledTask:ScheduledTask'; //# sourceMappingURL=scheduledTask.js.map