Skip to content

Commit

Permalink
Merge branch 'main' into apprunner-private-access-22850
Browse files Browse the repository at this point in the history
  • Loading branch information
mergify[bot] authored Oct 30, 2024
2 parents be95278 + 579041e commit 0dd75ad
Show file tree
Hide file tree
Showing 34 changed files with 479 additions and 107 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ export class ReleasePackageSource implements IPackageSource {
return this.version.split('.')[0] as string;
}

public requestedCliVersion() {
return this.version;
}

public requestedFrameworkVersion() {
return process.env.FRAMEWORK_VERSION!;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ export class RepoPackageSource implements IPackageSource {
return releaseJson.majorVersion;
}

public requestedCliVersion(): string {
return '*';
}

public requestedFrameworkVersion(): string {
return '*';
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ export interface IPackageSource {

initializeDotnetPackages(targetDir: string): Promise<void>;

/**
* CLI version
*/
requestedCliVersion(): string;

/**
* Framework version if it's different than the CLI version
*
Expand Down
8 changes: 4 additions & 4 deletions packages/@aws-cdk-testing/cli-integ/lib/with-aws.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ export type AwsContext = { readonly aws: AwsClients };
*
* Allocate the next region from the REGION pool and dispose it afterwards.
*/
export function withAws(
block: (context: TestContext & AwsContext & DisableBootstrapContext) => Promise<void>,
export function withAws<A extends TestContext>(
block: (context: A & AwsContext & DisableBootstrapContext) => Promise<void>,
disableBootstrap: boolean = false,
): (context: TestContext) => Promise<void> {
return (context: TestContext) => regionPool().using(async (region) => {
): (context: A) => Promise<void> {
return (context: A) => regionPool().using(async (region) => {
const aws = await AwsClients.forRegion(region, context.output);
await sanityCheck(aws);

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import { promises as fs } from 'fs';
import * as path from 'path';
import { withToolContext } from './with-tool-context';
import { integTest, ShellHelper, TemporaryDirectoryContext } from '../../lib';

const TIMEOUT = 1800_000;

integTest('amplify integration', withToolContext(async (context) => {
const shell = ShellHelper.fromContext(context);

await shell.shell(['npm', 'create', '-y', 'amplify@latest']);
await shell.shell(['npx', 'ampx', 'configure', 'telemetry', 'disable']);

// This will create 'package.json' implicating a certain version of the CDK
await updateCdkDependency(context, context.packages.requestedCliVersion(), context.packages.requestedFrameworkVersion());
await shell.shell(['npm', 'install']);

await shell.shell(['npx', 'ampx', 'sandbox', '--once'], {
modEnv: {
AWS_REGION: context.aws.region,
},
});
try {

// Future code goes here, putting the try/finally here already so it doesn't
// get forgotten.

} finally {
await shell.shell(['npx', 'ampx', 'sandbox', 'delete', '--yes'], {
modEnv: {
AWS_REGION: context.aws.region,
},
});
}
}), TIMEOUT);

async function updateCdkDependency(context: TemporaryDirectoryContext, cliVersion: string, libVersion: string) {
const filename = path.join(context.integTestDir, 'package.json');
const pj = JSON.parse(await fs.readFile(filename, { encoding: 'utf-8' }));
pj.devDependencies['aws-cdk'] = cliVersion;
pj.devDependencies['aws-cdk-lib'] = libVersion;
await fs.writeFile(filename, JSON.stringify(pj, undefined, 2), { encoding: 'utf-8' });
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { TestContext } from '../../lib/integ-test';
import { AwsContext, withAws } from '../../lib/with-aws';
import { DisableBootstrapContext } from '../../lib/with-cdk-app';
import { PackageContext, withPackages } from '../../lib/with-packages';
import { TemporaryDirectoryContext, withTemporaryDirectory } from '../../lib/with-temporary-directory';

/**
* The default prerequisites for tests running tool integrations
*/
export function withToolContext<A extends TestContext>(
block: (context: A & TemporaryDirectoryContext & PackageContext & AwsContext & DisableBootstrapContext
) => Promise<void>) {
return withAws(withTemporaryDirectory(withPackages(block)));
}

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.

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.

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

Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,17 @@ class TestStack extends Stack {

const user = new iam.User(this, 'MyUser');
asset.grantRead(user);

new assets.Asset(this, 'BundledAssetWithoutExtension', {
path: path.join(__dirname, 'markdown-asset'),
bundling: {
image: DockerImage.fromBuild(path.join(__dirname, 'alpine-markdown')),
outputType: BundlingOutput.SINGLE_FILE,
command: [
'sh', '-c', 'echo 123 > /asset-output/main',
],
},
});
}
}

Expand Down
7 changes: 7 additions & 0 deletions packages/@aws-cdk/aws-ec2-alpha/lib/vpc-v2-base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,13 @@ export abstract class VpcV2Base extends Resource implements IVpcV2 {
*/
public abstract readonly ownerAccountId: string;

/**
* IPv4 CIDR provisioned under pool
* Required to check for overlapping CIDRs after provisioning
* is complete under IPAM pool
*/
public abstract readonly ipv4IpamProvisionedCidrs?: string[];

/**
* If this is set to true, don't error out on trying to select subnets
*/
Expand Down
52 changes: 23 additions & 29 deletions packages/@aws-cdk/aws-location-alpha/lib/place-index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,39 +74,12 @@ export enum IntendedUse {
STORAGE = 'Storage',
}

abstract class PlaceIndexBase extends Resource implements IPlaceIndex {
public abstract readonly placeIndexName: string;
public abstract readonly placeIndexArn: string;

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

/**
* Grant the given identity permissions to search using this index
*/
public grantSearch(grantee: iam.IGrantable): iam.Grant {
return this.grant(grantee,
'geo:SearchPlaceIndexForPosition',
'geo:SearchPlaceIndexForSuggestions',
'geo:SearchPlaceIndexForText',
);
}
}

/**
* A Place Index
*
* @see https://docs.aws.amazon.com/location/latest/developerguide/places-concepts.html
*/
export class PlaceIndex extends PlaceIndexBase {
export class PlaceIndex extends Resource implements IPlaceIndex {
/**
* Use an existing place index by name
*/
Expand All @@ -130,7 +103,7 @@ export class PlaceIndex extends PlaceIndexBase {
throw new Error(`Place Index Arn ${placeIndexArn} does not have a resource name.`);
}

class Import extends PlaceIndexBase {
class Import extends Resource implements IPlaceIndex {
public readonly placeIndexName = parsedArn.resourceName!;
public readonly placeIndexArn = placeIndexArn;
}
Expand Down Expand Up @@ -187,4 +160,25 @@ export class PlaceIndex extends PlaceIndexBase {
this.placeIndexUpdateTime = placeIndex.attrUpdateTime;
}

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

/**
* Grant the given identity permissions to search using this index
*/
public grantSearch(grantee: iam.IGrantable): iam.Grant {
return this.grant(grantee,
'geo:SearchPlaceIndexForPosition',
'geo:SearchPlaceIndexForSuggestions',
'geo:SearchPlaceIndexForText',
);
}
}
7 changes: 0 additions & 7 deletions packages/@aws-cdk/aws-scheduler-alpha/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,6 @@ const cronBasedSchedule = new Schedule(this, 'Schedule', {
A one-time schedule is a schedule that invokes a target only once. You configure a one-time schedule when by specifying the time of the day, date,
and time zone in which EventBridge Scheduler evaluates the schedule.

[comment]: <> (TODO: Switch to `ts` once Schedule is implemented)

```ts
declare const target: targets.LambdaInvoke;

Expand Down Expand Up @@ -208,11 +206,6 @@ const target = new targets.LambdaInvoke(fn, {
});
```


### Cross-account and cross-region targets

Executing cross-account and cross-region targets are not supported yet.

### Specifying Encryption key

EventBridge Scheduler integrates with AWS Key Management Service (AWS KMS) to encrypt and decrypt your data using an AWS KMS key.
Expand Down
Loading

0 comments on commit 0dd75ad

Please sign in to comment.