Skip to content

Commit

Permalink
Merge branch 'main' into add-scheduling-a-redshift-query-to-event-tar…
Browse files Browse the repository at this point in the history
…gets-for-amazon-eventbridge
  • Loading branch information
mergify[bot] authored Aug 30, 2024
2 parents d3e575e + a45230f commit 2f310e0
Show file tree
Hide file tree
Showing 21 changed files with 748 additions and 27 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.v2.alpha.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

## [2.155.0-alpha.0](https://github.com/aws/aws-cdk/compare/v2.154.1-alpha.0...v2.155.0-alpha.0) (2024-08-29)


### Features

* **ec2:** `ipv6AddressCount` property for an instance ([#31076](https://github.com/aws/aws-cdk/issues/31076)) ([e3e5e1c](https://github.com/aws/aws-cdk/commit/e3e5e1c5a29a5da8759c2e821ef108eade8b87ea)), closes [#31075](https://github.com/aws/aws-cdk/issues/31075)
* **ec2:** support throughput on LaunchTemplate EBS volumes ([#30716](https://github.com/aws/aws-cdk/issues/30716)) ([6ed0bed](https://github.com/aws/aws-cdk/commit/6ed0bed61088765b9f0aa736d7daea4cbea05b3d)), closes [#24341](https://github.com/aws/aws-cdk/issues/24341) [#22441](https://github.com/aws/aws-cdk/issues/22441)
* **location:** support GeofenceCollection ([#30711](https://github.com/aws/aws-cdk/issues/30711)) ([04d73ac](https://github.com/aws/aws-cdk/commit/04d73acc5e95568bd410a714ef00e7edb192681a)), closes [#30710](https://github.com/aws/aws-cdk/issues/30710)

## [2.154.1-alpha.0](https://github.com/aws/aws-cdk/compare/v2.154.0-alpha.0...v2.154.1-alpha.0) (2024-08-23)

## [2.154.0-alpha.0](https://github.com/aws/aws-cdk/compare/v2.153.0-alpha.0...v2.154.0-alpha.0) (2024-08-22)
Expand Down
22 changes: 22 additions & 0 deletions CHANGELOG.v2.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,28 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

## [2.155.0](https://github.com/aws/aws-cdk/compare/v2.154.1...v2.155.0) (2024-08-29)


### Features

* **codebuild:** macOS codebuild support ([#31203](https://github.com/aws/aws-cdk/issues/31203)) ([823ff6e](https://github.com/aws/aws-cdk/commit/823ff6e03899f790a4cb1c43f92a02cc906ac356)), closes [#31170](https://github.com/aws/aws-cdk/issues/31170)
* **eks:** `preserveOnDelete` for EKS addon ([#30776](https://github.com/aws/aws-cdk/issues/30776)) ([23fba1c](https://github.com/aws/aws-cdk/commit/23fba1c7ea49def9fc5c0f558246d8ec1879c91e))
* **kms:** add `multiRegion` property to a `Key` ([#31125](https://github.com/aws/aws-cdk/issues/31125)) ([3dc4c50](https://github.com/aws/aws-cdk/commit/3dc4c502340610c573125a3d44d74bf2dfd944a9))
* **stepfunctions-tasks:** add cpu and memory parameters to EcsRunTask ([#30140](https://github.com/aws/aws-cdk/issues/30140)) ([986e378](https://github.com/aws/aws-cdk/commit/986e378a27b19271695f735ad01603a4c1386d25)), closes [#30027](https://github.com/aws/aws-cdk/issues/30027)
* **synthetics:** add syn-python-selenium-4.0 runtime ([#31101](https://github.com/aws/aws-cdk/issues/31101)) ([cc75ded](https://github.com/aws/aws-cdk/commit/cc75dedcb35850250dcf27bc06ba2c08a7f9bfff)), closes [#30137](https://github.com/aws/aws-cdk/issues/30137) [/docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch_Synthetics_Library_python_selenium.html#CloudWatch_Synthetics_runtimeversion-syn-python-selenium-4](https://github.com/aws//docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch_Synthetics_Library_python_selenium.html/issues/CloudWatch_Synthetics_runtimeversion-syn-python-selenium-4)
* update L1 CloudFormation resource definitions ([#31193](https://github.com/aws/aws-cdk/issues/31193)) ([e942b67](https://github.com/aws/aws-cdk/commit/e942b67a64bcd78abf6029e501bc6ca260441bf0))
* update L1 CloudFormation resource definitions ([#31194](https://github.com/aws/aws-cdk/issues/31194)) ([5468983](https://github.com/aws/aws-cdk/commit/5468983944fa3e2783c39813e0bcb47a5fb82811))
* update L1 CloudFormation resource definitions ([#31221](https://github.com/aws/aws-cdk/issues/31221)) ([b754353](https://github.com/aws/aws-cdk/commit/b7543532fb9c80bf69e197242bd55febafcd84f5))


### Bug Fixes

* **cloudfront:** requirement of domainNames prevents moving a domain name between distributions ([#31001](https://github.com/aws/aws-cdk/issues/31001)) ([acdf7d3](https://github.com/aws/aws-cdk/commit/acdf7d3a1ffe2cbc8239cd0b788dc47b99e35184)), closes [#29960](https://github.com/aws/aws-cdk/issues/29960) [#29329](https://github.com/aws/aws-cdk/issues/29329)
* **eks:** can't update authMode with the same mode ([#31043](https://github.com/aws/aws-cdk/issues/31043)) ([64df08b](https://github.com/aws/aws-cdk/commit/64df08b80ad8c69c99c9e0178ccd58bd177fbd78))
* **lambda-event-source:** allow dynamodb filtering on boolean value ([#31011](https://github.com/aws/aws-cdk/issues/31011)) ([9946ab0](https://github.com/aws/aws-cdk/commit/9946ab03672bf6664e8ec95a81ddb67c3bb2f63b)), closes [#30734](https://github.com/aws/aws-cdk/issues/30734)
* **s3:** bucket notifications in owning stack deletes bucket notifications from other stacks ([#31091](https://github.com/aws/aws-cdk/issues/31091)) ([0b09e52](https://github.com/aws/aws-cdk/commit/0b09e528b4565d4e4cce9a965578a537aac96b1f))

## [2.154.1](https://github.com/aws/aws-cdk/compare/v2.154.0...v2.154.1) (2024-08-23)


Expand Down
27 changes: 27 additions & 0 deletions packages/@aws-cdk/aws-location-alpha/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,30 @@ const geofenceCollection = new location.GeofenceCollection(this, 'GeofenceCollec

geofenceCollection.grantRead(role);
```

## Route Calculator

Route calculator resources allow you to find routes and estimate travel time based on up-to-date road network and live traffic information from your chosen data provider.

For more information, see [Routes](https://docs.aws.amazon.com/location/latest/developerguide/route-concepts.html).

To create a route calculator, define a `RouteCalculator`:

```ts
new location.RouteCalculator(this, 'RouteCalculator', {
routeCalculatorName: 'MyRouteCalculator', // optional, defaults to a generated name
dataSource: location.DataSource.ESRI,
});
```

Use the `grant()` or `grantRead()` method to grant the given identity permissions to perform actions
on the route calculator:

```ts
declare const role: iam.Role;

const routeCalculator = new location.RouteCalculator(this, 'RouteCalculator', {
dataSource: location.DataSource.ESRI,
});
routeCalculator.grantRead(role);
```
2 changes: 2 additions & 0 deletions packages/@aws-cdk/aws-location-alpha/lib/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
export * from './geofence-collection';
export * from './place-index';
export * from './route-calculator';
export * from './util';

// AWS::Location CloudFormation Resources:
21 changes: 1 addition & 20 deletions packages/@aws-cdk/aws-location-alpha/lib/place-index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as iam from 'aws-cdk-lib/aws-iam';
import { ArnFormat, IResource, Lazy, Resource, Stack, Token } from 'aws-cdk-lib/core';
import { Construct } from 'constructs';
import { CfnPlaceIndex } from 'aws-cdk-lib/aws-location';
import { generateUniqueId } from './util';
import { DataSource, generateUniqueId } from './util';

/**
* A Place Index
Expand Down Expand Up @@ -59,25 +59,6 @@ export interface PlaceIndexProps {
readonly description?: string;
}

/**
* Data source for a place index
*/
export enum DataSource {
/**
* Esri
*
* @see https://docs.aws.amazon.com/location/latest/developerguide/esri.html
*/
ESRI = 'Esri',

/**
* HERE
*
* @see https://docs.aws.amazon.com/location/latest/developerguide/HERE.html
*/
HERE = 'Here',
}

/**
* Intend use for the results of an operation
*/
Expand Down
158 changes: 158 additions & 0 deletions packages/@aws-cdk/aws-location-alpha/lib/route-calculator.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,158 @@
import * as iam from 'aws-cdk-lib/aws-iam';
import { ArnFormat, IResource, Lazy, Resource, Stack, Token } from 'aws-cdk-lib/core';
import { Construct } from 'constructs';
import { CfnRouteCalculator } from 'aws-cdk-lib/aws-location';
import { generateUniqueId, DataSource } from './util';

/**
* A Route Calculator
*/
export interface IRouteCalculator extends IResource {
/**
* The name of the route calculator
*
* @attribute
*/
readonly routeCalculatorName: string;

/**
* The Amazon Resource Name (ARN) of the route calculator resource
*
* @attribute Arn,CalculatorArn
*/
readonly routeCalculatorArn: string;
}

/**
* Properties for a route calculator
*/
export interface RouteCalculatorProps {
/**
* A name for the route calculator
*
* Must be between 1 and 100 characters and contain only alphanumeric characters,
* hyphens, periods and underscores.
*
* @default - A name is automatically generated
*/
readonly routeCalculatorName?: string;

/**
* Data source for the route calculator
*/
readonly dataSource: DataSource;

/**
* A description for the route calculator
*
* @default - no description
*/
readonly description?: string;
}

/**
* A Route Calculator
*
* @see https://docs.aws.amazon.com/location/latest/developerguide/places-concepts.html
*/
export class RouteCalculator extends Resource implements IRouteCalculator {
/**
* Use an existing route calculator by name
*/
public static fromRouteCalculatorName(scope: Construct, id: string, routeCalculatorName: string): IRouteCalculator {
const routeCalculatorArn = Stack.of(scope).formatArn({
service: 'geo',
resource: 'route-calculator',
resourceName: routeCalculatorName,
});

return RouteCalculator.fromRouteCalculatorArn(scope, id, routeCalculatorArn);
}

/**
* Use an existing route calculator by ARN
*/
public static fromRouteCalculatorArn(scope: Construct, id: string, routeCalculatorArn: string): IRouteCalculator {
const parsedArn = Stack.of(scope).splitArn(routeCalculatorArn, ArnFormat.SLASH_RESOURCE_NAME);

if (!parsedArn.resourceName) {
throw new Error(`Route Calculator Arn ${routeCalculatorArn} does not have a resource name.`);
}

class Import extends Resource implements IRouteCalculator {
public readonly routeCalculatorName = parsedArn.resourceName!;
public readonly routeCalculatorArn = routeCalculatorArn;
}

return new Import(scope, id, {
account: parsedArn.account,
region: parsedArn.region,
});
}

public readonly routeCalculatorName: string;

public readonly routeCalculatorArn: string;

/**
* The timestamp for when the route calculator resource was created in ISO 8601 format
*
* @attribute
*/
public readonly routeCalculatorCreateTime: string;

/**
* The timestamp for when the route calculator resource was last updated in ISO 8601 format
*
* @attribute
*/
public readonly routeCalculatorUpdateTime: string;

constructor(scope: Construct, id: string, props: RouteCalculatorProps) {

if (props.description && !Token.isUnresolved(props.description) && props.description.length > 1000) {
throw new Error(`\`description\` must be between 0 and 1000 characters. Received: ${props.description.length} characters`);
}

if (props.routeCalculatorName && !Token.isUnresolved(props.routeCalculatorName) && !/^[-.\w]{1,100}$/.test(props.routeCalculatorName)) {
throw new Error(`Invalid route calculator name. The route calculator name must be between 1 and 100 characters and contain only alphanumeric characters, hyphens, periods and underscores. Received: ${props.routeCalculatorName}`);
}

super(scope, id, {
physicalName: props.routeCalculatorName ?? Lazy.string({ produce: () => generateUniqueId(this) }),
});

const routeCalculator = new CfnRouteCalculator(this, 'Resource', {
calculatorName: this.physicalName,
dataSource: props.dataSource ?? DataSource.ESRI,
description: props.description,
});

this.routeCalculatorName = routeCalculator.ref;
this.routeCalculatorArn = routeCalculator.attrArn;
this.routeCalculatorCreateTime = routeCalculator.attrCreateTime;
this.routeCalculatorUpdateTime = routeCalculator.attrUpdateTime;
}

/**
* Grant the given principal identity permissions to perform the actions on this route calculator.
*/
public grant(grantee: iam.IGrantable, ...actions: string[]): iam.Grant {
return iam.Grant.addToPrincipal({
grantee: grantee,
actions: actions,
resourceArns: [this.routeCalculatorArn],
});
}

/**
* Grant the given identity permissions to access to a route calculator resource to calculate a route.
*
* @see https://docs.aws.amazon.com/location/latest/developerguide/security_iam_id-based-policy-examples.html#security_iam_id-based-policy-examples-calculate-route
*/
public grantRead(grantee: iam.IGrantable): iam.Grant {
return this.grant(grantee,
'geo:CalculateRoute',
);
}
}
26 changes: 26 additions & 0 deletions packages/@aws-cdk/aws-location-alpha/lib/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,29 @@ export function generateUniqueId(context: IConstruct): string {
}
return name;
}

/**
* Data source for a place index
*/
export enum DataSource {
/**
* Esri
*
* @see https://docs.aws.amazon.com/location/latest/developerguide/esri.html
*/
ESRI = 'Esri',

/**
* Grab provides routing functionality for Southeast Asia.
*
* @see https://docs.aws.amazon.com/location/latest/developerguide/grab.html
*/
GRAB = 'Grab',

/**
* HERE
*
* @see https://docs.aws.amazon.com/location/latest/developerguide/HERE.html
*/
HERE = 'Here',
}

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

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

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

Loading

0 comments on commit 2f310e0

Please sign in to comment.