-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into otaviom/appsync-ttl-required
- Loading branch information
Showing
119 changed files
with
6,064 additions
and
732 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
129 changes: 72 additions & 57 deletions
129
...cdk-containers/ecs-service-extensions/lib/extensions/assign-public-ip/lambda/Pipfile.lock
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
76 changes: 76 additions & 0 deletions
76
packages/@aws-cdk/aws-amplify/lib/asset-deployment-handler/common.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
export interface AmplifyJobId { | ||
/** | ||
* If this field is included in an event passed to "IsComplete", it means we | ||
* initiated an Amplify deployment that should be monitored using | ||
* amplify:GetJob | ||
*/ | ||
AmplifyJobId?: string; | ||
} | ||
|
||
export type ResourceEvent = AWSLambda.CloudFormationCustomResourceEvent & AmplifyJobId; | ||
|
||
export interface IsCompleteResponse { | ||
/** | ||
* Indicates if the resource operation is complete or should we retry. | ||
*/ | ||
readonly IsComplete: boolean; | ||
|
||
/** | ||
* Additional/changes to resource attributes. | ||
*/ | ||
readonly Data?: { [name: string]: any }; | ||
}; | ||
|
||
export abstract class ResourceHandler { | ||
protected readonly requestId: string; | ||
protected readonly logicalResourceId: string; | ||
protected readonly requestType: 'Create' | 'Update' | 'Delete'; | ||
protected readonly physicalResourceId?: string; | ||
protected readonly event: ResourceEvent; | ||
|
||
constructor(event: ResourceEvent) { | ||
this.requestType = event.RequestType; | ||
this.requestId = event.RequestId; | ||
this.logicalResourceId = event.LogicalResourceId; | ||
this.physicalResourceId = (event as any).PhysicalResourceId; | ||
this.event = event; | ||
} | ||
|
||
public onEvent() { | ||
switch (this.requestType) { | ||
case 'Create': | ||
return this.onCreate(); | ||
case 'Update': | ||
return this.onUpdate(); | ||
case 'Delete': | ||
return this.onDelete(); | ||
} | ||
|
||
throw new Error(`Invalid request type ${this.requestType}`); | ||
} | ||
|
||
public isComplete() { | ||
switch (this.requestType) { | ||
case 'Create': | ||
return this.isCreateComplete(); | ||
case 'Update': | ||
return this.isUpdateComplete(); | ||
case 'Delete': | ||
return this.isDeleteComplete(); | ||
} | ||
|
||
throw new Error(`Invalid request type ${this.requestType}`); | ||
} | ||
|
||
protected log(x: any) { | ||
// eslint-disable-next-line no-console | ||
console.log(JSON.stringify(x, undefined, 2)); | ||
} | ||
|
||
protected abstract async onCreate(): Promise<AmplifyJobId>; | ||
protected abstract async onDelete(): Promise<void>; | ||
protected abstract async onUpdate(): Promise<AmplifyJobId>; | ||
protected abstract async isCreateComplete(): Promise<IsCompleteResponse>; | ||
protected abstract async isDeleteComplete(): Promise<IsCompleteResponse>; | ||
protected abstract async isUpdateComplete(): Promise<IsCompleteResponse>; | ||
} |
Oops, something went wrong.