@pulumi/aws
Version:
A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.
145 lines • 6.36 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.Schedule = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Provides an EventBridge Scheduler Schedule resource.
*
* You can find out more about EventBridge Scheduler in the [User Guide](https://docs.aws.amazon.com/scheduler/latest/UserGuide/what-is-scheduler.html).
*
* > **Note:** EventBridge was formerly known as CloudWatch Events. The functionality is identical.
*
* ## Example Usage
*
* ### Basic Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const example = new aws.scheduler.Schedule("example", {
* name: "my-schedule",
* groupName: "default",
* flexibleTimeWindow: {
* mode: "OFF",
* },
* scheduleExpression: "rate(1 hours)",
* target: {
* arn: exampleAwsSqsQueue.arn,
* roleArn: exampleAwsIamRole.arn,
* },
* });
* ```
*
* ### Universal Target
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const example = new aws.sqs.Queue("example", {});
* const exampleSchedule = new aws.scheduler.Schedule("example", {
* name: "my-schedule",
* flexibleTimeWindow: {
* mode: "OFF",
* },
* scheduleExpression: "rate(1 hours)",
* target: {
* arn: "arn:aws:scheduler:::aws-sdk:sqs:sendMessage",
* roleArn: exampleAwsIamRole.arn,
* input: pulumi.jsonStringify({
* MessageBody: "Greetings, programs!",
* QueueUrl: example.url,
* }),
* },
* });
* ```
*
* ## Import
*
* Using `pulumi import`, import schedules using the combination `group_name/name`. For example:
*
* ```sh
* $ pulumi import aws:scheduler/schedule:Schedule example my-schedule-group/my-schedule
* ```
*/
class Schedule extends pulumi.CustomResource {
/**
* Get an existing Schedule 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 Schedule(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of Schedule. 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'] === Schedule.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["arn"] = state ? state.arn : undefined;
resourceInputs["description"] = state ? state.description : undefined;
resourceInputs["endDate"] = state ? state.endDate : undefined;
resourceInputs["flexibleTimeWindow"] = state ? state.flexibleTimeWindow : undefined;
resourceInputs["groupName"] = state ? state.groupName : undefined;
resourceInputs["kmsKeyArn"] = state ? state.kmsKeyArn : undefined;
resourceInputs["name"] = state ? state.name : undefined;
resourceInputs["namePrefix"] = state ? state.namePrefix : undefined;
resourceInputs["region"] = state ? state.region : undefined;
resourceInputs["scheduleExpression"] = state ? state.scheduleExpression : undefined;
resourceInputs["scheduleExpressionTimezone"] = state ? state.scheduleExpressionTimezone : undefined;
resourceInputs["startDate"] = state ? state.startDate : undefined;
resourceInputs["state"] = state ? state.state : undefined;
resourceInputs["target"] = state ? state.target : undefined;
}
else {
const args = argsOrState;
if ((!args || args.flexibleTimeWindow === undefined) && !opts.urn) {
throw new Error("Missing required property 'flexibleTimeWindow'");
}
if ((!args || args.scheduleExpression === undefined) && !opts.urn) {
throw new Error("Missing required property 'scheduleExpression'");
}
if ((!args || args.target === undefined) && !opts.urn) {
throw new Error("Missing required property 'target'");
}
resourceInputs["description"] = args ? args.description : undefined;
resourceInputs["endDate"] = args ? args.endDate : undefined;
resourceInputs["flexibleTimeWindow"] = args ? args.flexibleTimeWindow : undefined;
resourceInputs["groupName"] = args ? args.groupName : undefined;
resourceInputs["kmsKeyArn"] = args ? args.kmsKeyArn : undefined;
resourceInputs["name"] = args ? args.name : undefined;
resourceInputs["namePrefix"] = args ? args.namePrefix : undefined;
resourceInputs["region"] = args ? args.region : undefined;
resourceInputs["scheduleExpression"] = args ? args.scheduleExpression : undefined;
resourceInputs["scheduleExpressionTimezone"] = args ? args.scheduleExpressionTimezone : undefined;
resourceInputs["startDate"] = args ? args.startDate : undefined;
resourceInputs["state"] = args ? args.state : undefined;
resourceInputs["target"] = args ? args.target : undefined;
resourceInputs["arn"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(Schedule.__pulumiType, name, resourceInputs, opts);
}
}
exports.Schedule = Schedule;
/** @internal */
Schedule.__pulumiType = 'aws:scheduler/schedule:Schedule';
//# sourceMappingURL=schedule.js.map