81 lines
2.8 KiB
TypeScript
81 lines
2.8 KiB
TypeScript
import * as iam from '../../aws-iam';
|
|
import type { ISchedule, ScheduleTargetConfig, ScheduleTargetInput } from '../../aws-scheduler';
|
|
import type * as sqs from '../../aws-sqs';
|
|
import { Duration } from '../../core';
|
|
/**
|
|
* Base properties for a Schedule Target
|
|
*/
|
|
export interface ScheduleTargetBaseProps {
|
|
/**
|
|
* An execution role is an IAM role that EventBridge Scheduler assumes in order to interact with other AWS services on your behalf.
|
|
*
|
|
* If none provided templates target will automatically create an IAM role with all the minimum necessary
|
|
* permissions to interact with the templated target. If you wish you may specify your own IAM role, then the templated targets
|
|
* will grant minimal required permissions.
|
|
*
|
|
* @default - created by target
|
|
*/
|
|
readonly role?: iam.IRole;
|
|
/**
|
|
* The SQS queue to be used as deadLetterQueue.
|
|
*
|
|
* The events not successfully delivered are automatically retried for a specified period of time,
|
|
* depending on the retry policy of the target.
|
|
* If an event is not delivered before all retry attempts are exhausted, it will be sent to the dead letter queue.
|
|
*
|
|
* @default - no dead-letter queue
|
|
*/
|
|
readonly deadLetterQueue?: sqs.IQueue;
|
|
/**
|
|
* Input passed to the target.
|
|
*
|
|
* @default - no input.
|
|
*/
|
|
readonly input?: ScheduleTargetInput;
|
|
/**
|
|
* The maximum age of a request that Scheduler sends to a target for processing.
|
|
*
|
|
* Minimum value of 60.
|
|
* Maximum value of 86400.
|
|
*
|
|
* @default Duration.hours(24)
|
|
*/
|
|
readonly maxEventAge?: Duration;
|
|
/**
|
|
* The maximum number of times to retry when the target returns an error.
|
|
*
|
|
* Minimum value of 0.
|
|
* Maximum value of 185.
|
|
*
|
|
* @default 185
|
|
*/
|
|
readonly retryAttempts?: number;
|
|
}
|
|
/**
|
|
* Base class for Schedule Targets
|
|
*/
|
|
export declare abstract class ScheduleTargetBase {
|
|
private readonly baseProps;
|
|
protected readonly targetArn: string;
|
|
constructor(baseProps: ScheduleTargetBaseProps, targetArn: string);
|
|
protected abstract addTargetActionToRole(role: iam.IRole): void;
|
|
protected bindBaseTargetConfig(_schedule: ISchedule): ScheduleTargetConfig;
|
|
/**
|
|
* Create a return a Schedule Target Configuration for the given schedule
|
|
* @returns a Schedule Target Configuration
|
|
*/
|
|
bind(schedule: ISchedule): ScheduleTargetConfig;
|
|
/**
|
|
* Get or create the Role for the EventBridge Scheduler event
|
|
*
|
|
* If a role already exists, it will be returned. This ensures that if multiple
|
|
* schedules have the same target, they will share a role.
|
|
*/
|
|
private createOrGetScheduleTargetRole;
|
|
/**
|
|
* Allow schedule to send events with failed invocation to an Amazon SQS queue.
|
|
*/
|
|
private addDeadLetterQueueActionToRole;
|
|
private renderRetryPolicy;
|
|
}
|