@pulumiverse/time
Version:
A Pulumi package for creating and managing Time resources
133 lines • 5.09 kB
JavaScript
;
// *** 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.Sleep = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("./utilities");
/**
* ## Example Usage
*
* ### Delay Create Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as _null from "@pulumi/null";
* import * as time from "@pulumiverse/time";
*
* // This resource will destroy (potentially immediately) after null_resource.next
* const previous = new _null.Resource("previous", {});
* const wait30Seconds = new time.Sleep("wait30Seconds", {createDuration: "30s"}, {
* dependsOn: [previous],
* });
* // This resource will create (at least) 30 seconds after null_resource.previous
* const next = new _null.Resource("next", {}, {
* dependsOn: [wait30Seconds],
* });
* ```
*
* ### Delay Destroy Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as _null from "@pulumi/null";
* import * as time from "@pulumiverse/time";
*
* // This resource will destroy (at least) 30 seconds after null_resource.next
* const previous = new _null.Resource("previous", {});
* const wait30Seconds = new time.Sleep("wait30Seconds", {destroyDuration: "30s"}, {
* dependsOn: [previous],
* });
* // This resource will create (potentially immediately) after null_resource.previous
* const next = new _null.Resource("next", {}, {
* dependsOn: [wait30Seconds],
* });
* ```
*
* ### Triggers Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
* import * as time from "@pulumiverse/time";
*
* const exampleResourceAssociation = new aws.ram.ResourceAssociation("exampleResourceAssociation", {
* resourceArn: aws_subnet.example.arn,
* resourceShareArn: aws_ram_resource_share.example.arn,
* });
* // AWS resources shared via Resource Access Manager can take a few seconds to
* // propagate across AWS accounts after RAM returns a successful association.
* const ramResourcePropagation = new time.Sleep("ramResourcePropagation", {
* createDuration: "60s",
* triggers: {
* subnet_arn: exampleResourceAssociation.resourceArn,
* subnet_id: aws_subnet.example.id,
* },
* });
* const exampleSubnetGroup = new aws.rds.SubnetGroup("exampleSubnetGroup", {subnetIds: [ramResourcePropagation.triggers.apply(triggers => triggers?.subnet_id)]});
* ```
*
* ## Import
*
* This resource can be imported with the `create_duration` and `destroy_duration`, separated by a comma (`,`).
*
* e.g. For 30 seconds create duration with no destroy duration:
*
* ```sh
* $ pulumi import time:index/sleep:Sleep example 30s,
* ```
*
* e.g. For 30 seconds destroy duration with no create duration:
*
* ```sh
* $ pulumi import time:index/sleep:Sleep example ,30s
* ```
*
* The `triggers` argument cannot be imported.
*/
class Sleep extends pulumi.CustomResource {
/**
* Get an existing Sleep 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 Sleep(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of Sleep. 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'] === Sleep.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["createDuration"] = state ? state.createDuration : undefined;
resourceInputs["destroyDuration"] = state ? state.destroyDuration : undefined;
resourceInputs["triggers"] = state ? state.triggers : undefined;
}
else {
const args = argsOrState;
resourceInputs["createDuration"] = args ? args.createDuration : undefined;
resourceInputs["destroyDuration"] = args ? args.destroyDuration : undefined;
resourceInputs["triggers"] = args ? args.triggers : undefined;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(Sleep.__pulumiType, name, resourceInputs, opts);
}
}
exports.Sleep = Sleep;
/** @internal */
Sleep.__pulumiType = 'time:index/sleep:Sleep';
//# sourceMappingURL=sleep.js.map