-
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 13, 2024
1 parent
fda3baa
commit 0afe3a5
Showing
4 changed files
with
80 additions
and
26 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 |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from "./servicePrincipal"; |
40 changes: 40 additions & 0 deletions
40
typescript/src/resources/service-principals/servicePrincipal.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,40 @@ | ||
import { CustomResource } from "aws-cdk-lib"; | ||
import { Construct } from "constructs"; | ||
|
||
export interface ComplexValue { | ||
value?: string, | ||
} | ||
|
||
|
||
export interface ServicePrincipalSettings { | ||
active?: boolean | ||
application_id?: string | ||
display_name?: string | ||
entitlements?: ComplexValue[] | ||
external_id?: string | ||
groups?: ComplexValue[] | ||
id?: string | ||
roles?: ComplexValue[] | ||
} | ||
|
||
export interface ServicePrincipalProperties { | ||
workspace_url: string | ||
service_principal: ServicePrincipalSettings | ||
} | ||
|
||
export interface ServicePrincipalProps extends ServicePrincipalProperties { | ||
readonly serviceToken: string | ||
} | ||
|
||
export class ServicePrincipal extends CustomResource { | ||
constructor(scope: Construct, id: string, props: ServicePrincipalProps) { | ||
super(scope, id, { | ||
serviceToken: props.serviceToken, | ||
properties: { | ||
action: "service-principal", | ||
workspace_url: props.workspace_url, | ||
service_principal: props.service_principal, | ||
} | ||
}); | ||
} | ||
} |