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

change to custom resource provider #1068

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
35 changes: 26 additions & 9 deletions typescript/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

33 changes: 21 additions & 12 deletions typescript/src/resources/tokens/token.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import {Construct} from "constructs";
import {CustomResource} from "aws-cdk-lib";
import {
CustomResource,
custom_resources as cr,
} from "aws-cdk-lib";
import { IFunction } from "aws-cdk-lib/aws-lambda";

export interface TokenProperties {
workspaceUrl: string
Expand All @@ -9,13 +13,23 @@
}

export interface TokenProps extends TokenProperties {
readonly serviceToken: string
readonly databricksDeployLambda: IFunction
}

export class Token extends CustomResource {
export class Token extends Construct {
readonly customResource: CustomResource;
readonly tokenSecretArn: string;

constructor(scope: Construct, id: string, props: TokenProps) {
super(scope, id, {
serviceToken: props.serviceToken,
super(scope, id);

const cr_provider = new cr.Provider(this, 'Provider',

Check failure on line 26 in typescript/src/resources/tokens/token.ts

View workflow job for this annotation

GitHub Actions / linting

Strings must use doublequote
{

Check failure on line 27 in typescript/src/resources/tokens/token.ts

View workflow job for this annotation

GitHub Actions / linting

Expected indentation of 12 spaces but found 8
onEventHandler: props.databricksDeployLambda,

Check failure on line 28 in typescript/src/resources/tokens/token.ts

View workflow job for this annotation

GitHub Actions / linting

Expected indentation of 16 spaces but found 12
});

Check failure on line 29 in typescript/src/resources/tokens/token.ts

View workflow job for this annotation

GitHub Actions / linting

Expected indentation of 12 spaces but found 8

this.customResource = new CustomResource(this, 'Resource', {

Check failure on line 31 in typescript/src/resources/tokens/token.ts

View workflow job for this annotation

GitHub Actions / linting

Strings must use doublequote
serviceToken: cr_provider.serviceToken,
properties: {
action: "token",
token_name: props.tokenName,
Expand All @@ -24,12 +38,7 @@
lifetime_seconds: props.lifetimeSeconds,
}
});
}
public tokenSecretArn(): string {
/**
* Returns the secrets manager ARN. Can only be returned
* when creating the token
*/
return this.getAttString("token_secrets_arn");

this.tokenSecretArn = this.customResource.getAttString("token_secrets_arn");
}
}
32 changes: 25 additions & 7 deletions typescript/src/resources/unity-catalog/unityCatalogSchema.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import {CustomResource} from "aws-cdk-lib";
import {
CustomResource,
custom_resources as cr,
} from "aws-cdk-lib";
import { IFunction } from "aws-cdk-lib/aws-lambda";
import {Construct} from "constructs";

export interface UnityCatalogSchemaSettings {
Expand All @@ -15,18 +19,32 @@
}

export interface UnityCatalogSchemaProps extends UnityCatalogSchemaProperties {
readonly serviceToken: string
readonly databricksDeployLambda: IFunction
}

export class UnityCatalogSchema extends CustomResource {
export class UnityCatalogSchema extends Construct {
readonly customResource: CustomResource;
readonly catalogName: string;
readonly name: string;

constructor(scope: Construct, id: string, props: UnityCatalogSchemaProps) {
super(scope, id, {
serviceToken: props.serviceToken,
super(scope, id);
this.catalogName = props.schema.catalog_name;
this.name = props.schema.name;


const cr_provider = new cr.Provider(this, 'Provider',

Check failure on line 36 in typescript/src/resources/unity-catalog/unityCatalogSchema.ts

View workflow job for this annotation

GitHub Actions / linting

Strings must use doublequote
{

Check failure on line 37 in typescript/src/resources/unity-catalog/unityCatalogSchema.ts

View workflow job for this annotation

GitHub Actions / linting

Expected indentation of 12 spaces but found 8
onEventHandler: props.databricksDeployLambda,

Check failure on line 38 in typescript/src/resources/unity-catalog/unityCatalogSchema.ts

View workflow job for this annotation

GitHub Actions / linting

Expected indentation of 16 spaces but found 12
});

Check failure on line 39 in typescript/src/resources/unity-catalog/unityCatalogSchema.ts

View workflow job for this annotation

GitHub Actions / linting

Expected indentation of 12 spaces but found 8

this.customResource = new CustomResource(this, 'Resource', {

Check failure on line 41 in typescript/src/resources/unity-catalog/unityCatalogSchema.ts

View workflow job for this annotation

GitHub Actions / linting

Strings must use doublequote
serviceToken: cr_provider.serviceToken,
properties: {
action: "unity-schema",
workspace_url: props.workspace_url,
schema: props.schema,
schema: props.schema
}
});

}
}
Loading