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

Rebase dev #91

Closed
wants to merge 4 commits into from
Closed
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
5 changes: 5 additions & 0 deletions .github/copyright.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
one_date_re: ' Copyright (?P<year>[0-9]{4})'
two_date_re: ' Copyright (?P<from>[0-9]{4})-(?P<to>[0-9]{4})'
one_date_format: ' Copyright {year}'
two_date_format: ' Copyright {from}-{to}'
license_file: LICENSE
28 changes: 28 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,31 @@ repos:
stages: [ manual ]
# uncomment the line below if using "finch" on MacOS
# args: [ "-f" ]

- repo: https://github.com/sbrunner/pre-commit-copyright
rev: 0.7.0
hooks:
- id: copyright
name: update copyright
exclude: |
(?x)^(
^\..+|
.+\.md|
jest.config.js|
LICENSE|
package.json|
package-lock.json
tsconfig.json|
)$
- id: copyright-required
name: require copyright
exclude: |
(?x)^(
^\..+|
.+\.md|
jest.config.js|
LICENSE|
package.json|
package-lock.json|
tsconfig.json|
)$
6 changes: 6 additions & 0 deletions lib/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/*
* Copyright 2023-2024 Amazon.com, Inc. or its affiliates.
*/

export * from "./osml/model_runner/autoscaling/mr_autoscaling";
export * from "./osml/model_runner/mr_dataplane";
export * from "./osml/model_runner/mr_container";
Expand All @@ -20,3 +24,5 @@ export * from "./osml/osml_vpc";
export * from "./osml/tile_server/ts_container";
export * from "./osml/tile_server/ts_dataplane";
export * from "./osml/tile_server/roles/ts_task_role";
export * from "./osml/tile_server/testing/ts_test_runner";
export * from "./osml/tile_server/testing/ts_imagery";
3 changes: 2 additions & 1 deletion lib/osml/model_endpoint/me_container.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/*
* Copyright 2023 Amazon.com, Inc. or its affiliates.
* Copyright 2023-2024 Amazon.com, Inc. or its affiliates.
*/

import { RemovalPolicy, SymlinkFollowMode } from "aws-cdk-lib";
import { DockerImageAsset } from "aws-cdk-lib/aws-ecr-assets";
import { ContainerImage } from "aws-cdk-lib/aws-ecs";
Expand Down
2 changes: 1 addition & 1 deletion lib/osml/model_endpoint/me_http_endpoint.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2023 Amazon.com, Inc. or its affiliates.
* Copyright 2023-2024 Amazon.com, Inc. or its affiliates.
*/

import { Duration, RemovalPolicy } from "aws-cdk-lib";
Expand Down
2 changes: 1 addition & 1 deletion lib/osml/model_endpoint/me_sm_endpoint.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2023 Amazon.com, Inc. or its affiliates.
* Copyright 2023-2024 Amazon.com, Inc. or its affiliates.
*/

import {
Expand Down
3 changes: 2 additions & 1 deletion lib/osml/model_endpoint/roles/me_http_role.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/*
* Copyright 2023 Amazon.com, Inc. or its affiliates.
* Copyright 2023-2024 Amazon.com, Inc. or its affiliates.
*/

import { region_info } from "aws-cdk-lib";
import {
CompositePrincipal,
Expand Down
3 changes: 2 additions & 1 deletion lib/osml/model_endpoint/roles/me_sm_role.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/*
* Copyright 2023 Amazon.com, Inc. or its affiliates.
* Copyright 2023-2024 Amazon.com, Inc. or its affiliates.
*/

import { ManagedPolicy, Role, ServicePrincipal } from "aws-cdk-lib/aws-iam";
import { Construct } from "constructs";

Expand Down
2 changes: 1 addition & 1 deletion lib/osml/model_runner/autoscaling/mr_autoscaling.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2023 Amazon.com, Inc. or its affiliates.
* Copyright 2023-2024 Amazon.com, Inc. or its affiliates.
*/

import { EcsIsoServiceAutoscaler } from "@cdklabs/cdk-enterprise-iac";
Expand Down
3 changes: 2 additions & 1 deletion lib/osml/model_runner/monitoring/mr_monitoring.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/*
* Copyright 2023 Amazon.com, Inc. or its affiliates.
* Copyright 2023-2024 Amazon.com, Inc. or its affiliates.
*/

import {
Dashboard,
GraphWidget,
Expand Down
2 changes: 1 addition & 1 deletion lib/osml/model_runner/mr_container.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2023 Amazon.com, Inc. or its affiliates.
* Copyright 2023-2024 Amazon.com, Inc. or its affiliates.
*/

import { RemovalPolicy, SymlinkFollowMode } from "aws-cdk-lib";
Expand Down
2 changes: 1 addition & 1 deletion lib/osml/model_runner/mr_dataplane.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2023 Amazon.com, Inc. or its affiliates.
* Copyright 2023-2024 Amazon.com, Inc. or its affiliates.
*/

import { Duration, region_info, RemovalPolicy } from "aws-cdk-lib";
Expand Down
3 changes: 2 additions & 1 deletion lib/osml/model_runner/roles/mr_task_role.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/*
* Copyright 2023 Amazon.com, Inc. or its affiliates.
* Copyright 2023-2024 Amazon.com, Inc. or its affiliates.
*/

import { region_info } from "aws-cdk-lib";
import {
CompositePrincipal,
Expand Down
3 changes: 2 additions & 1 deletion lib/osml/model_runner/testing/mr_endpoints.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/*
* Copyright 2023 Amazon.com, Inc. or its affiliates.
* Copyright 2023-2024 Amazon.com, Inc. or its affiliates.
*/

import { RemovalPolicy } from "aws-cdk-lib";
import { ContainerImage } from "aws-cdk-lib/aws-ecs";
import { IRole } from "aws-cdk-lib/aws-iam";
Expand Down
4 changes: 2 additions & 2 deletions lib/osml/model_runner/testing/mr_imagery.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2023 Amazon.com, Inc. or its affiliates.
* Copyright 2023-2024 Amazon.com, Inc. or its affiliates.
*/

import { RemovalPolicy } from "aws-cdk-lib";
Expand All @@ -26,7 +26,7 @@ export class MRImageryConfig {
*/
constructor(
public S3_IMAGE_BUCKET: string = "test-images",
public S3_TEST_IMAGES_PATH: string = "assets/images"
public S3_TEST_IMAGES_PATH: string = "assets/images/model-runner"
) {}
}

Expand Down
2 changes: 1 addition & 1 deletion lib/osml/model_runner/testing/mr_sync.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2023 Amazon.com, Inc. or its affiliates.
* Copyright 2023-2024 Amazon.com, Inc. or its affiliates.
*/

import { RemovalPolicy } from "aws-cdk-lib";
Expand Down
2 changes: 1 addition & 1 deletion lib/osml/osml_account.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2023 Amazon.com, Inc. or its affiliates.
* Copyright 2023-2024 Amazon.com, Inc. or its affiliates.
*/

/**
Expand Down
4 changes: 4 additions & 0 deletions lib/osml/osml_bucket.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/*
* Copyright 2023-2024 Amazon.com, Inc. or its affiliates.
*/

import { RemovalPolicy } from "aws-cdk-lib";
import {
BlockPublicAccess,
Expand Down
2 changes: 1 addition & 1 deletion lib/osml/osml_ecr_deployment.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2023 Amazon.com, Inc. or its affiliates.
* Copyright 2023-2024 Amazon.com, Inc. or its affiliates.
*/

import { RemovalPolicy } from "aws-cdk-lib";
Expand Down
2 changes: 1 addition & 1 deletion lib/osml/osml_queue.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2023 Amazon.com, Inc. or its affiliates.
* Copyright 2023-2024 Amazon.com, Inc. or its affiliates.
*/

import { Duration } from "aws-cdk-lib";
Expand Down
2 changes: 1 addition & 1 deletion lib/osml/osml_repository.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2023 Amazon.com, Inc. or its affiliates.
* Copyright 2023-2024 Amazon.com, Inc. or its affiliates.
*/

import { RemovalPolicy } from "aws-cdk-lib";
Expand Down
2 changes: 1 addition & 1 deletion lib/osml/osml_table.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2023 Amazon.com, Inc. or its affiliates.
* Copyright 2023-2024 Amazon.com, Inc. or its affiliates.
*/

import { RemovalPolicy } from "aws-cdk-lib";
Expand Down
2 changes: 1 addition & 1 deletion lib/osml/osml_topic.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2023 Amazon.com, Inc. or its affiliates.
* Copyright 2023-2024 Amazon.com, Inc. or its affiliates.
*/

import { Key } from "aws-cdk-lib/aws-kms";
Expand Down
3 changes: 2 additions & 1 deletion lib/osml/osml_vpc.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/*
* Copyright 2023 Amazon.com, Inc. or its affiliates.
* Copyright 2023-2024 Amazon.com, Inc. or its affiliates.
*/

import {
GatewayVpcEndpointAwsService,
InterfaceVpcEndpointAwsService,
Expand Down
3 changes: 2 additions & 1 deletion lib/osml/tile_server/roles/ts_lambda_role.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/*
* Copyright 2023 Amazon.com, Inc. or its affiliates.
* Copyright 2023-2024 Amazon.com, Inc. or its affiliates.
*/

import { region_info } from "aws-cdk-lib";
import {
CompositePrincipal,
Expand Down
3 changes: 2 additions & 1 deletion lib/osml/tile_server/roles/ts_task_role.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/*
* Copyright 2023 Amazon.com, Inc. or its affiliates.
* Copyright 2023-2024 Amazon.com, Inc. or its affiliates.
*/

import { region_info } from "aws-cdk-lib";
import {
AccountPrincipal,
Expand Down
134 changes: 134 additions & 0 deletions lib/osml/tile_server/testing/ts_imagery.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
/*
* Copyright 2023-2024 Amazon.com, Inc. or its affiliates.
*/

import { RemovalPolicy } from "aws-cdk-lib";
import { IVpc } from "aws-cdk-lib/aws-ec2";
import { BucketAccessControl } from "aws-cdk-lib/aws-s3";
import {
BucketDeployment,
ServerSideEncryption,
Source
} from "aws-cdk-lib/aws-s3-deployment";
import { Construct } from "constructs";

import { OSMLAccount } from "../../osml_account";
import { OSMLBucket } from "../../osml_bucket";

/**
* Configuration class for TSImagery Construct.
*/
export class TSImageryConfig {
/**
* Creates an instance of TSImageryConfig.
* @param {string} S3_IMAGE_BUCKET - The name of the S3 bucket where images will be stored.
* @param {string} S3_TEST_IMAGES_PATH - The local path to the test imager to deploy.
*/
constructor(
public S3_IMAGE_BUCKET: string = "tile-server-test-images",
public S3_TEST_IMAGES_PATH: string = "assets/images/tile-server"
) {}
}

/**
* Represents the properties for configuring the TSImagery Construct.
*
* @interface TSImageryProps
* @property {OSMLAccount} account - The OSML account to use.
* @property {IVpc} vpc - The Model Runner VPC configuration.
* @property {TSImageryConfig|undefined} [tsImageryConfig] - Optional configuration for TS Imagery.
* @property {string|undefined} [securityGroupId] - Optional security group ID to apply to the VPC config for SM endpoints.
*/
export interface TSImageryProps {
/**
* The OSML account to use.
*
* @type {OSMLAccount}
*/
account: OSMLAccount;

/**
* The target vpc for the s3 bucket deployment.
*
* @type {IVpc}
*/
vpc: IVpc;

/**
* Optional custom configuration for TSImagery.
*
* @type {TSImageryConfig|undefined}
*/
tsImageryConfig?: TSImageryConfig;

/**
* Optional security group ID to apply to the VPC config for SM endpoints.
*
* @type {string|undefined}
*/
securityGroupId?: string;
}

/**
* Represents an TSImagery construct for managing imagery resources.
*/
export class TSImagery extends Construct {
/**
* The image bucket where TS imagery data is stored.
*/
public imageBucket: OSMLBucket;

/**
* The removal policy for this TSImagery resource.
* @default RemovalPolicy.DESTROY
*/
public removalPolicy: RemovalPolicy;

/**
* Configuration options for TSImagery.
*/
public tsImageryConfig: TSImageryConfig;

/**
* Creates an TSImagery cdk construct.
* @param scope The scope/stack in which to define this construct.
* @param id The id of this construct within the current scope.
* @param props The properties of this construct.
*/
constructor(scope: Construct, id: string, props: TSImageryProps) {
super(scope, id);

// Check if a custom configuration was provided
if (props.tsImageryConfig != undefined) {
// Import existing TS configuration
this.tsImageryConfig = props.tsImageryConfig;
} else {
// Create a new default configuration
this.tsImageryConfig = new TSImageryConfig();
}

// Setup a removal policy based on the 'prodLike' property
this.removalPolicy = props.account.prodLike
? RemovalPolicy.RETAIN
: RemovalPolicy.DESTROY;

// Create an image bucket to store TS imagery data
this.imageBucket = new OSMLBucket(this, `TSTestImageBucket`, {
bucketName: `${this.tsImageryConfig.S3_IMAGE_BUCKET}-${props.account.id}`,
prodLike: props.account.prodLike,
removalPolicy: this.removalPolicy
});

// Deploy test images into the bucket
new BucketDeployment(this, "TSTestImageDeployment", {
sources: [Source.asset(this.tsImageryConfig.S3_TEST_IMAGES_PATH)],
destinationBucket: this.imageBucket.bucket,
accessControl: BucketAccessControl.BUCKET_OWNER_FULL_CONTROL,
memoryLimit: 10240,
useEfs: true,
vpc: props.vpc,
retainOnDelete: props.account.prodLike,
serverSideEncryption: ServerSideEncryption.AES_256
});
}
}
Loading
Loading