@pulumi/aws
Version:
A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.
145 lines • 5.79 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, { ...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?.arn;
resourceInputs["description"] = state?.description;
resourceInputs["endDate"] = state?.endDate;
resourceInputs["flexibleTimeWindow"] = state?.flexibleTimeWindow;
resourceInputs["groupName"] = state?.groupName;
resourceInputs["kmsKeyArn"] = state?.kmsKeyArn;
resourceInputs["name"] = state?.name;
resourceInputs["namePrefix"] = state?.namePrefix;
resourceInputs["region"] = state?.region;
resourceInputs["scheduleExpression"] = state?.scheduleExpression;
resourceInputs["scheduleExpressionTimezone"] = state?.scheduleExpressionTimezone;
resourceInputs["startDate"] = state?.startDate;
resourceInputs["state"] = state?.state;
resourceInputs["target"] = state?.target;
}
else {
const args = argsOrState;
if (args?.flexibleTimeWindow === undefined && !opts.urn) {
throw new Error("Missing required property 'flexibleTimeWindow'");
}
if (args?.scheduleExpression === undefined && !opts.urn) {
throw new Error("Missing required property 'scheduleExpression'");
}
if (args?.target === undefined && !opts.urn) {
throw new Error("Missing required property 'target'");
}
resourceInputs["description"] = args?.description;
resourceInputs["endDate"] = args?.endDate;
resourceInputs["flexibleTimeWindow"] = args?.flexibleTimeWindow;
resourceInputs["groupName"] = args?.groupName;
resourceInputs["kmsKeyArn"] = args?.kmsKeyArn;
resourceInputs["name"] = args?.name;
resourceInputs["namePrefix"] = args?.namePrefix;
resourceInputs["region"] = args?.region;
resourceInputs["scheduleExpression"] = args?.scheduleExpression;
resourceInputs["scheduleExpressionTimezone"] = args?.scheduleExpressionTimezone;
resourceInputs["startDate"] = args?.startDate;
resourceInputs["state"] = args?.state;
resourceInputs["target"] = args?.target;
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
;