-
Notifications
You must be signed in to change notification settings - Fork 0
/
osml_repository.ts
54 lines (49 loc) · 1.58 KB
/
osml_repository.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/*
* Copyright 2023-2024 Amazon.com, Inc. or its affiliates.
*/
import { RemovalPolicy } from "aws-cdk-lib";
import { Repository, RepositoryEncryption } from "aws-cdk-lib/aws-ecr";
import { Construct } from "constructs";
/**
* Represents the properties required to configure the OSMLRepository Construct.
* @interface
*/
export interface OSMLRepositoryProps {
/**
* The name of the repository.
* @type {string}
*/
repositoryName: string;
/**
* The removal policy for the repository.
* @type {RemovalPolicy}
*/
removalPolicy: RemovalPolicy;
}
/**
* Represents an OSML (Open Source Machine Learning) Repository in AWS Elastic Container Registry (ECR).
*/
export class OSMLRepository extends Construct {
public repository: Repository;
/**
* Creates a new OSMLRepository (ECR).
* @param {Construct} scope - The scope/stack in which to define this construct.
* @param {string} id - The id of this construct within the current scope.
* @param {OSMLRepositoryProps} props - The properties of this construct.
* @returns OSMLRepository - The OSMLRepository construct.
*/
constructor(scope: Construct, id: string, props: OSMLRepositoryProps) {
super(scope, id);
/**
* The AWS ECR Repository associated with this OSMLRepository.
* @type {Repository}
*/
this.repository = new Repository(this, id, {
repositoryName: props.repositoryName,
removalPolicy: props.removalPolicy,
imageScanOnPush: true,
encryption: RepositoryEncryption.KMS,
autoDeleteImages: props.removalPolicy == RemovalPolicy.DESTROY
});
}
}