-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Anton Shchederkin
committed
Dec 17, 2024
1 parent
29b95ec
commit b0f2679
Showing
5 changed files
with
61 additions
and
2 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
export * from "./servicePrincipal"; | ||
export * from "./servicePrincipal"; | ||
export * from "./servicePrincipalSecrets"; |
23 changes: 23 additions & 0 deletions
23
typescript/src/resources/service-principals/servicePrincipalSecrets.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,23 @@ | ||
import { CustomResource } from "aws-cdk-lib"; | ||
import { Construct } from "constructs"; | ||
|
||
|
||
export interface ServicePrincipalSecretsProperties { | ||
service_principal_id: number | ||
} | ||
|
||
export interface ServicePrincipalSecretsProps extends ServicePrincipalSecretsProperties { | ||
readonly serviceToken: string | ||
} | ||
|
||
export class ServicePrincipalSecrets extends CustomResource { | ||
constructor(scope: Construct, id: string, props: ServicePrincipalSecretsProps) { | ||
super(scope, id, { | ||
serviceToken: props.serviceToken, | ||
properties: { | ||
action: "service-principal-secrets", | ||
service_principal_id: props.service_principal_id, | ||
} | ||
}); | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
typescript/tests/resources/service-principals/servicePrincipalSecrets.test.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,27 @@ | ||
import { Template } from "aws-cdk-lib/assertions"; | ||
import * as cdk from "aws-cdk-lib"; | ||
import { DatabricksDeployLambda, ServicePrincipalSecrets } from "../../../../typescript/src"; | ||
|
||
|
||
describe("ServicePrincipalSecrets", () => { | ||
test("RegisteredModel Custom Resource synthesizes the way we expect", () => { | ||
const app = new cdk.App(); | ||
const databricksStack = new cdk.Stack(app, "DatabricksStack"); | ||
const deployLambda = DatabricksDeployLambda.fromServiceToken(databricksStack, "DeployLambda", "some-arn"); | ||
new ServicePrincipalSecrets(databricksStack, "ServicePrincipalSecrets", { | ||
service_principal_id: 1234, | ||
serviceToken: deployLambda.serviceToken.toString(), | ||
}); | ||
|
||
const template = Template.fromStack(databricksStack); | ||
|
||
template.hasResourceProperties("AWS::CloudFormation::CustomResource", | ||
{ | ||
|
||
"ServiceToken": "some-arn", | ||
"action": "service-principal-secrets", | ||
"service_principal_id": 1234, | ||
}); | ||
}); | ||
}); | ||
|