Skip to content

Commit

Permalink
feat(client-scheduler): This release introduces automatic deletion of…
Browse files Browse the repository at this point in the history
… schedules in EventBridge Scheduler. If configured, EventBridge Scheduler automatically deletes a schedule after the schedule has completed its last invocation.
  • Loading branch information
awstools committed Jul 31, 2023
1 parent d50fb3f commit a1403dd
Show file tree
Hide file tree
Showing 8 changed files with 319 additions and 200 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ export interface CreateScheduleCommandOutput extends CreateScheduleOutput, __Met
* MaximumWindowInMinutes: Number("int"),
* },
* ClientToken: "STRING_VALUE",
* ActionAfterCompletion: "STRING_VALUE",
* };
* const command = new CreateScheduleCommand(input);
* const response = await client.send(command);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ export interface GetScheduleCommandOutput extends GetScheduleOutput, __MetadataB
* // Mode: "STRING_VALUE", // required
* // MaximumWindowInMinutes: Number("int"),
* // },
* // ActionAfterCompletion: "STRING_VALUE",
* // };
*
* ```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ export interface UpdateScheduleCommandOutput extends UpdateScheduleOutput, __Met
* MaximumWindowInMinutes: Number("int"),
* },
* ClientToken: "STRING_VALUE",
* ActionAfterCompletion: "STRING_VALUE",
* };
* const command = new UpdateScheduleCommand(input);
* const response = await client.send(command);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export const resolveClientEndpointParameters = <T>(
};

export interface EndpointParameters extends __EndpointParameters {
Region: string;
Region?: string;
UseDualStack?: boolean;
UseFIPS?: boolean;
Endpoint?: string;
Expand Down
39 changes: 20 additions & 19 deletions clients/client-scheduler/src/endpoint/ruleset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,25 @@ import { RuleSetObject } from "@smithy/types";
or see "smithy.rules#endpointRuleSet"
in codegen/sdk-codegen/aws-models/scheduler.json */

const q="fn",
r="argv",
s="ref";
const a=true,
b=false,
c="String",
d="PartitionResult",
e="tree",
f="error",
g="endpoint",
h={"required":true,"default":false,"type":"Boolean"},
i={[s]:"Endpoint"},
j={[q]:"booleanEquals",[r]:[{[s]:"UseFIPS"},true]},
k={[q]:"booleanEquals",[r]:[{[s]:"UseDualStack"},true]},
l={},
m={[q]:"booleanEquals",[r]:[true,{[q]:"getAttr",[r]:[{[s]:d},"supportsFIPS"]}]},
n={[q]:"booleanEquals",[r]:[true,{[q]:"getAttr",[r]:[{[s]:d},"supportsDualStack"]}]},
const q="required",
r="fn",
s="argv",
t="ref";
const a="isSet",
b="tree",
c="error",
d="endpoint",
e="PartitionResult",
f={[q]:false,"type":"String"},
g={[q]:true,"default":false,"type":"Boolean"},
h={[t]:"Endpoint"},
i={[r]:"booleanEquals",[s]:[{[t]:"UseFIPS"},true]},
j={[r]:"booleanEquals",[s]:[{[t]:"UseDualStack"},true]},
k={},
l={[r]:"booleanEquals",[s]:[true,{[r]:"getAttr",[s]:[{[t]:e},"supportsFIPS"]}]},
m={[r]:"booleanEquals",[s]:[true,{[r]:"getAttr",[s]:[{[t]:e},"supportsDualStack"]}]},
n=[i],
o=[j],
p=[k];
const _data={version:"1.0",parameters:{Region:{required:a,type:c},UseDualStack:h,UseFIPS:h,Endpoint:{required:b,type:c}},rules:[{conditions:[{[q]:"aws.partition",[r]:[{[s]:"Region"}],assign:d}],type:e,rules:[{conditions:[{[q]:"isSet",[r]:[i]}],type:e,rules:[{conditions:o,error:"Invalid Configuration: FIPS and custom endpoint are not supported",type:f},{type:e,rules:[{conditions:p,error:"Invalid Configuration: Dualstack and custom endpoint are not supported",type:f},{endpoint:{url:i,properties:l,headers:l},type:g}]}]},{conditions:[j,k],type:e,rules:[{conditions:[m,n],type:e,rules:[{endpoint:{url:"https://scheduler-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:l,headers:l},type:g}]},{error:"FIPS and DualStack are enabled, but this partition does not support one or both",type:f}]},{conditions:o,type:e,rules:[{conditions:[m],type:e,rules:[{endpoint:{url:"https://scheduler-fips.{Region}.{PartitionResult#dnsSuffix}",properties:l,headers:l},type:g}]},{error:"FIPS is enabled but this partition does not support FIPS",type:f}]},{conditions:p,type:e,rules:[{conditions:[n],type:e,rules:[{endpoint:{url:"https://scheduler.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:l,headers:l},type:g}]},{error:"DualStack is enabled but this partition does not support DualStack",type:f}]},{endpoint:{url:"https://scheduler.{Region}.{PartitionResult#dnsSuffix}",properties:l,headers:l},type:g}]}]};
p=[{[t]:"Region"}];
const _data={version:"1.0",parameters:{Region:f,UseDualStack:g,UseFIPS:g,Endpoint:f},rules:[{conditions:[{[r]:a,[s]:[h]}],type:b,rules:[{conditions:n,error:"Invalid Configuration: FIPS and custom endpoint are not supported",type:c},{type:b,rules:[{conditions:o,error:"Invalid Configuration: Dualstack and custom endpoint are not supported",type:c},{endpoint:{url:h,properties:k,headers:k},type:d}]}]},{type:b,rules:[{conditions:[{[r]:a,[s]:p}],type:b,rules:[{conditions:[{[r]:"aws.partition",[s]:p,assign:e}],type:b,rules:[{conditions:[i,j],type:b,rules:[{conditions:[l,m],type:b,rules:[{type:b,rules:[{endpoint:{url:"https://scheduler-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:k,headers:k},type:d}]}]},{error:"FIPS and DualStack are enabled, but this partition does not support one or both",type:c}]},{conditions:n,type:b,rules:[{conditions:[l],type:b,rules:[{type:b,rules:[{endpoint:{url:"https://scheduler-fips.{Region}.{PartitionResult#dnsSuffix}",properties:k,headers:k},type:d}]}]},{error:"FIPS is enabled but this partition does not support FIPS",type:c}]},{conditions:o,type:b,rules:[{conditions:[m],type:b,rules:[{type:b,rules:[{endpoint:{url:"https://scheduler.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:k,headers:k},type:d}]}]},{error:"DualStack is enabled but this partition does not support DualStack",type:c}]},{type:b,rules:[{endpoint:{url:"https://scheduler.{Region}.{PartitionResult#dnsSuffix}",properties:k,headers:k},type:d}]}]}]},{error:"Invalid Configuration: Missing Region",type:c}]}]};
export const ruleSet: RuleSetObject = _data;
35 changes: 32 additions & 3 deletions clients/client-scheduler/src/models/models_0.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,20 @@ import { ExceptionOptionType as __ExceptionOptionType } from "@smithy/smithy-cli

import { SchedulerServiceException as __BaseException } from "./SchedulerServiceException";

/**
* @public
* @enum
*/
export const ActionAfterCompletion = {
DELETE: "DELETE",
NONE: "NONE",
} as const;

/**
* @public
*/
export type ActionAfterCompletion = (typeof ActionAfterCompletion)[keyof typeof ActionAfterCompletion];

/**
* @public
* @enum
Expand Down Expand Up @@ -650,7 +664,7 @@ export interface CreateScheduleInput {
* </li>
* <li>
* <p>
* <code>rate</code> expression - <code>rate(unit value)</code>
* <code>rate</code> expression - <code>rate(value unit)</code>
* </p>
* </li>
* <li>
Expand Down Expand Up @@ -727,6 +741,11 @@ export interface CreateScheduleInput {
* </p>
*/
ClientToken?: string;

/**
* <p>Specifies the action that EventBridge Scheduler applies to the schedule after the schedule completes invoking the target.</p>
*/
ActionAfterCompletion?: ActionAfterCompletion | string;
}

/**
Expand Down Expand Up @@ -835,7 +854,7 @@ export interface GetScheduleOutput {
* </li>
* <li>
* <p>
* <code>rate</code> expression - <code>rate(unit value)</code>
* <code>rate</code> expression - <code>rate(value unit)</code>
* </p>
* </li>
* <li>
Expand Down Expand Up @@ -914,6 +933,11 @@ export interface GetScheduleOutput {
* <p>Allows you to configure a time window during which EventBridge Scheduler invokes the schedule.</p>
*/
FlexibleTimeWindow?: FlexibleTimeWindow;

/**
* <p>Indicates the action that EventBridge Scheduler applies to the schedule after the schedule completes invoking the target.</p>
*/
ActionAfterCompletion?: ActionAfterCompletion | string;
}

/**
Expand Down Expand Up @@ -1040,7 +1064,7 @@ export interface UpdateScheduleInput {
* </li>
* <li>
* <p>
* <code>rate</code> expression - <code>rate(unit value)</code>
* <code>rate</code> expression - <code>rate(value unit)</code>
* </p>
* </li>
* <li>
Expand Down Expand Up @@ -1117,6 +1141,11 @@ export interface UpdateScheduleInput {
* </p>
*/
ClientToken?: string;

/**
* <p>Specifies the action that EventBridge Scheduler applies to the schedule after the schedule completes invoking the target.</p>
*/
ActionAfterCompletion?: ActionAfterCompletion | string;
}

/**
Expand Down
3 changes: 3 additions & 0 deletions clients/client-scheduler/src/protocols/Aws_restJson1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ export const se_CreateScheduleCommand = async (
let body: any;
body = JSON.stringify(
take(input, {
ActionAfterCompletion: [],
ClientToken: [true, (_) => _ ?? generateIdempotencyToken()],
Description: [],
EndDate: (_) => Math.round(_.getTime() / 1000),
Expand Down Expand Up @@ -404,6 +405,7 @@ export const se_UpdateScheduleCommand = async (
let body: any;
body = JSON.stringify(
take(input, {
ActionAfterCompletion: [],
ClientToken: [true, (_) => _ ?? generateIdempotencyToken()],
Description: [],
EndDate: (_) => Math.round(_.getTime() / 1000),
Expand Down Expand Up @@ -674,6 +676,7 @@ export const de_GetScheduleCommand = async (
});
const data: Record<string, any> = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
const doc = take(data, {
ActionAfterCompletion: __expectString,
Arn: __expectString,
CreationDate: (_) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))),
Description: __expectString,
Expand Down
Loading

0 comments on commit a1403dd

Please sign in to comment.