Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix(Set outputBucket property on aws-kinesisstreams-gluejob): Issue #448 to include S3 bucket for Glue Job that the consturct creates #452

Merged
merged 23 commits into from
Oct 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
f8df24e
update glue max allocation units to 2
knihit Jul 5, 2021
1ab1c91
update glue max allocation units to 2
knihit Jul 5, 2021
3365c6e
resolving workerType and maxCapacity config related rules
knihit Jul 7, 2021
aee778f
resolving workerType and maxCapacity config related rules
knihit Jul 7, 2021
6ac636d
resolving workerType and maxCapacity config related rules
knihit Jul 7, 2021
7cb2b02
removing additional lines from the file
knihit Jul 7, 2021
0ed148d
fix snapshots for glue helper
knihit Jul 7, 2021
4342f77
fix snapshots for glue helper
knihit Jul 7, 2021
55d1720
fix snapshots for glue helper
knihit Jul 7, 2021
804cf0c
fix snapshots for glue helper
knihit Jul 7, 2021
91a17ba
fix snapshots for glue helper
knihit Jul 7, 2021
f5a9a21
fix snapshots for glue helper
knihit Jul 7, 2021
1328b67
documentation rephrase
knihit Jul 7, 2021
0d9d2fb
merging incoming changes
knihit Jul 27, 2021
04ebe40
new construct first commit with README and architecture
knihit Jul 27, 2021
5a7a232
adding minimal deployable code to README
knihit Jul 27, 2021
079f6f2
adding minimal deployable code to README
knihit Jul 27, 2021
409d26e
Merge branch 'awslabs:main' into master
knihit Sep 1, 2021
d00ae18
Merge branch 'awslabs:main' into master
knihit Oct 12, 2021
1629501
Merge branch 'awslabs:main' into master
knihit Oct 12, 2021
3c0b58f
fix for github issue #448
knihit Oct 12, 2021
059ad93
Merge branch 'master' of github.com:knihit/aws-solutions-constructs
knihit Oct 12, 2021
ac352b2
Merge branch 'main' into master
biffgaut Oct 12, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,11 @@ export class KinesisstreamsToGluejob extends Construct {
public readonly glueJobRole: IRole;
public readonly database: glue.CfnDatabase;
public readonly table: glue.CfnTable;
/**
* This property is only set if the Glue Job is created by the construct. If an exisiting Glue Job
* configuraton is supplied, the construct does not create an S3 bucket and hence the @outputBucket
* property is undefined
*/
public readonly outputBucket?: [Bucket, (Bucket | undefined)?];
public readonly cloudwatchAlarms?: cloudwatch.Alarm[];

Expand Down Expand Up @@ -159,7 +164,7 @@ export class KinesisstreamsToGluejob extends Construct {
});
}

[ this.glueJob, this.glueJobRole ] = defaults.buildGlueJob(this, {
[ this.glueJob, this.glueJobRole, this.outputBucket ] = defaults.buildGlueJob(this, {
existingCfnJob: props.existingGlueJob,
glueJobProps: props.glueJobProps,
table: this.table!,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export interface BuildGlueJobProps {
readonly outputDataStore?: SinkDataStoreProps
}

export function buildGlueJob(scope: Construct, props: BuildGlueJobProps): [glue.CfnJob, IRole] {
export function buildGlueJob(scope: Construct, props: BuildGlueJobProps): [glue.CfnJob, IRole, [Bucket, (Bucket | undefined)?]?] {
if (!props.existingCfnJob) {
if (props.glueJobProps) {
if (props.glueJobProps.glueVersion === '2.0' && props.glueJobProps.maxCapacity) {
Expand All @@ -101,7 +101,7 @@ export function buildGlueJob(scope: Construct, props: BuildGlueJobProps): [glue.
}

export function deployGlueJob(scope: Construct, glueJobProps: glue.CfnJobProps, database: glue.CfnDatabase, table: glue.CfnTable,
outputDataStore: SinkDataStoreProps): [glue.CfnJob, IRole] {
outputDataStore: SinkDataStoreProps): [glue.CfnJob, IRole, [Bucket, (Bucket | undefined)?]] {

let _glueSecurityConfigName: string;

Expand Down Expand Up @@ -183,7 +183,7 @@ export function deployGlueJob(scope: Construct, glueJobProps: glue.CfnJobProps,
_scriptBucketLocation.grantRead(_jobRole);

const _glueJob: glue.CfnJob = new glue.CfnJob(scope, 'KinesisETLJob', _newGlueJobProps);
return [_glueJob, _jobRole];
return [_glueJob, _jobRole, _outputLocation];
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ test('Test deployment with role creation', () => {

const _database = defaults.createGlueDatabase(stack, defaults.DefaultGlueDatabaseProps());

defaults.buildGlueJob(stack, {
const _glueJob = defaults.buildGlueJob(stack, {
glueJobProps: cfnJobProps,
database: _database,
table: defaults.createGlueTable(stack, _database, undefined, [{
Expand All @@ -52,6 +52,8 @@ test('Test deployment with role creation', () => {
}], 'kinesis', {STREAM_NAME: 'testStream'})
});

expect(_glueJob[2]?.[0]).toBeDefined();
expect(_glueJob[2]?.[0]).toBeInstanceOf(Bucket);
expect(stack).toHaveResourceLike('AWS::Glue::Job', {
Type: "AWS::Glue::Job",
Properties: {
Expand Down Expand Up @@ -99,7 +101,7 @@ test('Create a Glue Job outside the construct', () => {

const _database = defaults.createGlueDatabase(stack, defaults.DefaultGlueDatabaseProps());

defaults.buildGlueJob(stack, {
const _glueJob = defaults.buildGlueJob(stack, {
existingCfnJob: _existingCfnJob,
outputDataStore: {
datastoreType: defaults.SinkStoreType.S3
Expand All @@ -111,6 +113,8 @@ test('Create a Glue Job outside the construct', () => {
comment: ""
}], 'kinesis', {STREAM_NAME: 'testStream'})
});

expect(_glueJob[2]).not.toBeDefined();
expect(stack).toHaveResourceLike('AWS::Glue::Job', {
Type: "AWS::Glue::Job",
Properties: {
Expand Down