-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(component-workflows): build a sdk for general purpose usage
- Loading branch information
1 parent
dbb1247
commit af63168
Showing
23 changed files
with
197 additions
and
45 deletions.
There are no files selected for viewing
Binary file added
BIN
+104 KB
.yarn/cache/@aws-codecatalyst-workflows-sdk-npm-0.1.5-preview.5-026acbc5a3-9d4449c3b7.zip
Binary file not shown.
Binary file not shown.
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
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
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
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
2 changes: 1 addition & 1 deletion
2
packages/components/workflows/src/actions/action-cfn-cleanup.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
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
2 changes: 1 addition & 1 deletion
2
packages/components/workflows/src/actions/action-test-reports.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
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
37 changes: 37 additions & 0 deletions
37
packages/components/workflows/src/generated-sdk/action-group-builder.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,37 @@ | ||
import { Blueprint } from '@amazon-codecatalyst/blueprints.blueprint'; | ||
import * as sdk from '@aws/codecatalyst-workflows-sdk'; | ||
import { getDefaultActionIdentifier } from '../actions/action'; | ||
|
||
/** | ||
* This wraps the generated codecatalyst workflows sdk [@aws/codecatalyst-workflows-sdk]. | ||
* @experimental | ||
*/ | ||
export class ActionGroupDefinitionBuilder { | ||
blueprint: Blueprint; | ||
definition: sdk.ActionGroup; | ||
|
||
constructor( | ||
blueprint: Blueprint, | ||
options: { | ||
starterDefinition?: Partial<sdk.ActionGroup>; | ||
}, | ||
) { | ||
this.blueprint = blueprint; | ||
this.definition = { | ||
...options.starterDefinition, | ||
Actions: {}, | ||
}; | ||
} | ||
|
||
setDependsOn(dependsOn: string[]) { | ||
this.definition.DependsOn = dependsOn; | ||
} | ||
|
||
addAction<T extends sdk.Action>(name: string, action: T, _options?: {} | undefined): void { | ||
this.definition.Actions = this.definition.Actions || {}; | ||
this.definition.Actions[name] = { | ||
...action, | ||
Identifier: getDefaultActionIdentifier(action.Identifier, this.blueprint.context.environmentId) as any, | ||
}; | ||
} | ||
} |
51 changes: 51 additions & 0 deletions
51
packages/components/workflows/src/generated-sdk/workflow-definition-builder.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,51 @@ | ||
import { Blueprint } from '@amazon-codecatalyst/blueprints.blueprint'; | ||
import * as sdk from '@aws/codecatalyst-workflows-sdk'; | ||
import { getDefaultActionIdentifier } from '../actions/action'; | ||
|
||
/** | ||
* This wraps the generated codecatalyst workflows sdk [@aws/codecatalyst-workflows-sdk]. | ||
* @experimental | ||
*/ | ||
export class WorkflowDefinitionBuilder { | ||
blueprint: Blueprint; | ||
genericBuilder: sdk.WorkflowDefinition; | ||
|
||
constructor( | ||
blueprint: Blueprint, | ||
options: { | ||
starterDefinition?: Partial<sdk.Workflow>; | ||
}, | ||
) { | ||
const name = options.starterDefinition?.Name || 'build-workflow'; | ||
|
||
this.genericBuilder = new sdk.WorkflowDefinition(name, { | ||
workflow: options.starterDefinition, | ||
}); | ||
this.blueprint = blueprint; | ||
} | ||
|
||
setName(name: string) { | ||
this.genericBuilder.definition.Name = name; | ||
} | ||
|
||
getDefinition(): sdk.Workflow { | ||
return this.genericBuilder.definition; | ||
} | ||
|
||
setDefinition(definition: sdk.Workflow) { | ||
this.genericBuilder.definition = definition; | ||
} | ||
|
||
addAction<T extends sdk.Action>(name: string, action: T, _options?: {} | undefined): void { | ||
this.genericBuilder.addAction(name, { | ||
...action, | ||
Identifier: getDefaultActionIdentifier(action.Identifier, this.blueprint.context.environmentId), | ||
}); | ||
} | ||
|
||
addActionGroup<T extends sdk.ActionGroup>(name: string, actionGroup: T, _options?: {} | undefined): void { | ||
this.genericBuilder.addAction(name, { | ||
...actionGroup, | ||
}); | ||
} | ||
} |
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
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
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
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
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
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
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
21 changes: 21 additions & 0 deletions
21
packages/components/workflows/src/workflow/workflow-definition.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,21 @@ | ||
import { ComputeDefintion } from './compute'; | ||
import { SourceDefiniton } from './sources'; | ||
import { TriggerDefiniton } from './triggers'; | ||
|
||
export enum RunModeDefiniton { | ||
PARALLEL = 'PARALLEL', | ||
QUEUED = 'QUEUED', | ||
SUPERSEDED = 'SUPERSEDED', | ||
} | ||
|
||
export interface WorkflowDefinition { | ||
Name: string; | ||
SchemaVersion?: string; | ||
RunMode?: RunModeDefiniton; | ||
Sources?: SourceDefiniton; | ||
Triggers?: TriggerDefiniton[]; | ||
Compute?: ComputeDefintion; | ||
Actions?: { | ||
[id: string]: any; | ||
}; | ||
} |
Oops, something went wrong.