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

chore(aws-cdk-lib): add metadata import and statement updater #32895

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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 2 additions & 0 deletions packages/@aws-cdk/aws-amplify-alpha/lib/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { BasicAuth } from './basic-auth';
import { Branch, BranchOptions } from './branch';
import { Domain, DomainOptions } from './domain';
import { renderEnvironmentVariables } from './utils';
import { MetadataType } from 'aws-cdk-lib/core/lib/metadata-resource';

/**
* An Amplify Console application
Expand Down Expand Up @@ -224,6 +225,7 @@ export class App extends Resource implements IApp, iam.IGrantable {

constructor(scope: Construct, id: string, props: AppProps) {
super(scope, id);
this.node.addMetadata(MetadataType.CONSTRUCT, props);

this.customRules = props.customRules || [];
this.environmentVariables = props.environmentVariables || {};
Expand Down
2 changes: 2 additions & 0 deletions packages/@aws-cdk/aws-amplify-alpha/lib/branch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { IApp } from './app';
import { BasicAuth } from './basic-auth';
import { renderEnvironmentVariables } from './utils';
import { AssetDeploymentIsCompleteFunction, AssetDeploymentOnEventFunction } from '../custom-resource-handlers/dist/aws-amplify-alpha/asset-deployment-provider.generated';
import { MetadataType } from 'aws-cdk-lib/core/lib/metadata-resource';

/**
* A branch
Expand Down Expand Up @@ -162,6 +163,7 @@ export class Branch extends Resource implements IBranch {

constructor(scope: Construct, id: string, props: BranchProps) {
super(scope, id);
this.node.addMetadata(MetadataType.CONSTRUCT, props);

this.environmentVariables = props.environmentVariables || {};

Expand Down
2 changes: 2 additions & 0 deletions packages/@aws-cdk/aws-amplify-alpha/lib/domain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { Construct } from 'constructs';
import { CfnDomain } from 'aws-cdk-lib/aws-amplify';
import { IApp } from './app';
import { IBranch } from './branch';
import { MetadataType } from 'aws-cdk-lib/core/lib/metadata-resource';

/**
* Options to add a domain to an application
Expand Down Expand Up @@ -127,6 +128,7 @@ export class Domain extends Resource {

constructor(scope: Construct, id: string, props: DomainProps) {
super(scope, id);
this.node.addMetadata(MetadataType.CONSTRUCT, props);

this.subDomains = props.subDomains || [];

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import * as cdk from 'aws-cdk-lib/core';
import { Construct } from 'constructs';
import { CfnAutoScalingConfiguration } from 'aws-cdk-lib/aws-apprunner';
import { MetadataType } from 'aws-cdk-lib/core/lib/metadata-resource';

/**
* Properties of the App Runner Auto Scaling Configuration.
Expand Down Expand Up @@ -154,6 +155,7 @@ export class AutoScalingConfiguration extends cdk.Resource implements IAutoScali
super(scope, id, {
physicalName: props.autoScalingConfigurationName,
});
this.node.addMetadata(MetadataType.CONSTRUCT, props);

this.validateAutoScalingConfiguration(props);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import * as cdk from 'aws-cdk-lib/core';
import { Construct } from 'constructs';
import { CfnObservabilityConfiguration } from 'aws-cdk-lib/aws-apprunner';
import { MetadataType } from 'aws-cdk-lib/core/lib/metadata-resource';

/**
* The implementation provider chosen for tracing App Runner services
Expand Down Expand Up @@ -140,6 +141,7 @@ export class ObservabilityConfiguration extends cdk.Resource implements IObserva
super(scope, id, {
physicalName: props.observabilityConfigurationName,
});
this.node.addMetadata(MetadataType.CONSTRUCT, props);

if (props.observabilityConfigurationName !== undefined && !cdk.Token.isUnresolved(props.observabilityConfigurationName)) {

Expand Down
2 changes: 2 additions & 0 deletions packages/@aws-cdk/aws-apprunner-alpha/lib/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { CfnService } from 'aws-cdk-lib/aws-apprunner';
import { IVpcConnector } from './vpc-connector';
import { IAutoScalingConfiguration } from './auto-scaling-configuration';
import { IObservabilityConfiguration } from './observability-configuration';
import { MetadataType } from 'aws-cdk-lib/core/lib/metadata-resource';

/**
* The image repository types
Expand Down Expand Up @@ -1267,6 +1268,7 @@ export class Service extends cdk.Resource implements IService, iam.IGrantable {

public constructor(scope: Construct, id: string, props: ServiceProps) {
super(scope, id);
this.node.addMetadata(MetadataType.CONSTRUCT, props);

const source = props.source.bind(this);
this.source = source;
Expand Down
2 changes: 2 additions & 0 deletions packages/@aws-cdk/aws-apprunner-alpha/lib/vpc-connector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { Connections } from 'aws-cdk-lib/aws-ec2';
import * as cdk from 'aws-cdk-lib/core';
import { Construct } from 'constructs';
import { CfnVpcConnector } from 'aws-cdk-lib/aws-apprunner';
import { MetadataType } from 'aws-cdk-lib/core/lib/metadata-resource';

/**
* Properties of the AppRunner VPC Connector
Expand Down Expand Up @@ -135,6 +136,7 @@ export class VpcConnector extends cdk.Resource implements IVpcConnector {
super(scope, id, {
physicalName: props.vpcConnectorName,
});
this.node.addMetadata(MetadataType.CONSTRUCT, props);

if (props.vpcConnectorName !== undefined && !cdk.Token.isUnresolved(props.vpcConnectorName)) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import * as cdk from 'aws-cdk-lib/core';
import { Construct } from 'constructs';
import { IService } from './service';
import { CfnVpcIngressConnection } from 'aws-cdk-lib/aws-apprunner';
import { MetadataType } from 'aws-cdk-lib/core/lib/metadata-resource';

/**
* Properties of the AppRunner VPC Ingress Connection
Expand Down Expand Up @@ -142,6 +143,7 @@ export class VpcIngressConnection extends cdk.Resource implements IVpcIngressCon
super(scope, id, {
physicalName: props.vpcIngressConnectionName,
});
this.node.addMetadata(MetadataType.CONSTRUCT, props);

if (props.vpcIngressConnectionName !== undefined && !cdk.Token.isUnresolved(props.vpcIngressConnectionName)) {

Expand Down
2 changes: 2 additions & 0 deletions packages/@aws-cdk/aws-cloud9-alpha/lib/environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { IUser } from 'aws-cdk-lib/aws-iam';
import * as cdk from 'aws-cdk-lib/core';
import { Construct } from 'constructs';
import { CfnEnvironmentEC2 } from 'aws-cdk-lib/aws-cloud9';
import { MetadataType } from 'aws-cdk-lib/core/lib/metadata-resource';

/**
* A Cloud9 Environment
Expand Down Expand Up @@ -197,6 +198,7 @@ export class Ec2Environment extends cdk.Resource implements IEc2Environment {

constructor(scope: Construct, id: string, props: Ec2EnvironmentProps) {
super(scope, id);
this.node.addMetadata(MetadataType.CONSTRUCT, props);

this.vpc = props.vpc;
if (!props.subnetSelection && this.vpc.publicSubnets.length === 0) {
Expand Down
2 changes: 2 additions & 0 deletions packages/@aws-cdk/aws-codestar-alpha/lib/github-repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import * as s3 from 'aws-cdk-lib/aws-s3';
import * as cdk from 'aws-cdk-lib/core';
import { Construct } from 'constructs';
import * as codestar from 'aws-cdk-lib/aws-codestar';
import { MetadataType } from 'aws-cdk-lib/core/lib/metadata-resource';

/**
* GitHubRepository resource interface
Expand Down Expand Up @@ -90,6 +91,7 @@ export class GitHubRepository extends cdk.Resource implements IGitHubRepository

constructor(scope: Construct, id: string, props: GitHubRepositoryProps) {
super(scope, id);
this.node.addMetadata(MetadataType.CONSTRUCT, props);

const resource = new codestar.CfnGitHubRepository(this, 'Resource', {
repositoryOwner: props.owner,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { IRole } from 'aws-cdk-lib/aws-iam';
import { Resource, IResource, Token } from 'aws-cdk-lib/core';
import { Construct } from 'constructs';
import { IIdentityPool, IdentityPoolProviderUrl } from './identitypool';
import { MetadataType } from 'aws-cdk-lib/core/lib/metadata-resource';

/**
* Represents an Identity Pool Role Attachment
Expand Down Expand Up @@ -144,6 +145,7 @@ export class IdentityPoolRoleAttachment extends Resource implements IIdentityPoo

constructor(scope: Construct, id: string, props: IdentityPoolRoleAttachmentProps) {
super(scope, id);
this.node.addMetadata(MetadataType.CONSTRUCT, props);
this.identityPoolId = props.identityPool.identityPoolId;
const mappings = props.roleMappings || [];
let roles: any = undefined, roleMappings: any = undefined;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { Resource, IResource, Stack, ArnFormat, Lazy, Token } from 'aws-cdk-lib/
import { Construct } from 'constructs';
import { IdentityPoolRoleAttachment, IdentityPoolRoleMapping } from './identitypool-role-attachment';
import { IUserPoolAuthenticationProvider } from './identitypool-user-pool-authentication-provider';
import { MetadataType } from 'aws-cdk-lib/core/lib/metadata-resource';

/**
* Represents a Cognito Identity Pool
Expand Down Expand Up @@ -362,6 +363,7 @@ export class IdentityPool extends Resource implements IIdentityPool {
super(scope, id, {
physicalName: props.identityPoolName,
});
this.node.addMetadata(MetadataType.CONSTRUCT, props);
const authProviders: IdentityPoolAuthenticationProviders = props.authenticationProviders || {};
const providers = authProviders.userPools ? authProviders.userPools.map(userPool => userPool.bind(this, this)) : undefined;
if (providers && providers.length) this.cognitoIdentityProviders = providers;
Expand Down
2 changes: 2 additions & 0 deletions packages/@aws-cdk/aws-ec2-alpha/lib/ipam.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { CfnIPAM, CfnIPAMPool, CfnIPAMPoolCidr, CfnIPAMScope } from 'aws-cdk-lib/aws-ec2';
import { Construct } from 'constructs';
import { Lazy, Names, Resource, Stack, Tags } from 'aws-cdk-lib';
import { MetadataType } from 'aws-cdk-lib/core/lib/metadata-resource';

/**
* Represents the address family for IP addresses in an IPAM pool.
Expand Down Expand Up @@ -340,6 +341,7 @@ class IpamPool extends Resource implements IIpamPool {
produce: () => Names.uniqueResourceName(this, { maxLength: 128, allowedSpecialCharacters: '_' }),
}),
});
this.node.addMetadata(MetadataType.CONSTRUCT, props);

if (props.addressFamily === AddressFamily.IP_V6 && !props.awsService) {
throw new Error('awsService is required when addressFamily is set to ipv6');
Expand Down
2 changes: 2 additions & 0 deletions packages/@aws-cdk/aws-ec2-alpha/lib/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { Annotations, Duration, IResource, Resource, Tags } from 'aws-cdk-lib/co
import { IVpcV2, VPNGatewayV2Options } from './vpc-v2-base';
import { NetworkUtils, allRouteTableIds, CidrBlock } from './util';
import { ISubnetV2 } from './subnet-v2';
import { MetadataType } from 'aws-cdk-lib/core/lib/metadata-resource';

/**
* Indicates whether the NAT gateway supports public or private connectivity.
Expand Down Expand Up @@ -236,6 +237,7 @@ export class EgressOnlyInternetGateway extends Resource implements IRouteTarget

constructor(scope: Construct, id: string, props: EgressOnlyInternetGatewayProps) {
super(scope, id);
this.node.addMetadata(MetadataType.CONSTRUCT, props);

if (props.egressOnlyInternetGatewayName) {
Tags.of(this).add(NAME_TAG, props.egressOnlyInternetGatewayName);
Expand Down
2 changes: 2 additions & 0 deletions packages/@aws-cdk/aws-ec2-alpha/lib/subnet-v2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { Construct, DependencyGroup, IDependable } from 'constructs';
import { IVpcV2 } from './vpc-v2-base';
import { CidrBlock, CidrBlockIpv6 } from './util';
import { RouteTable } from './route';
import { MetadataType } from 'aws-cdk-lib/core/lib/metadata-resource';

/**
* Interface to define subnet CIDR
Expand Down Expand Up @@ -249,6 +250,7 @@ export class SubnetV2 extends Resource implements ISubnetV2 {
produce: () => Names.uniqueResourceName(this, { maxLength: 128, allowedSpecialCharacters: '_' }),
}),
});
this.node.addMetadata(MetadataType.CONSTRUCT, props);

const ipv4CidrBlock = props.ipv4CidrBlock.cidr;
const ipv6CidrBlock = props.ipv6CidrBlock?.cidr;
Expand Down
3 changes: 3 additions & 0 deletions packages/@aws-cdk/aws-ec2-alpha/lib/vpc-v2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { IpamOptions, IIpamPool } from './ipam';
import { IVpcV2, VpcV2Base } from './vpc-v2-base';
import { ISubnetV2, SubnetV2, SubnetV2Attributes } from './subnet-v2';
import { region_info } from 'aws-cdk-lib';
import { MetadataType } from 'aws-cdk-lib/core/lib/metadata-resource';

/**
* Additional props needed for secondary Address
Expand Down Expand Up @@ -457,6 +458,8 @@ export class VpcV2 extends VpcV2Base {
produce: () => Names.uniqueResourceName(this, { maxLength: 128, allowedSpecialCharacters: '_' }),
}),
});
this.node.addMetadata(MetadataType.CONSTRUCT, props);

this.vpcName = props.vpcName;
this.ipAddresses = props.primaryAddressBlock ?? IpAddresses.ipv4('10.0.0.0/16');
const vpcOptions = this.ipAddresses.allocateVpcCidr();
Expand Down
16 changes: 16 additions & 0 deletions packages/@aws-cdk/aws-eks-v2-alpha/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
# EKS Alpha Module
<!--BEGIN STABILITY BANNER-->

---

![cdk-constructs: Experimental](https://img.shields.io/badge/cdk--constructs-experimental-important.svg?style=for-the-badge)

> The APIs of higher level constructs in this module are experimental and under active development.
> They are subject to non-backward compatible changes or removal in any future version. These are
> not subject to the [Semantic Versioning](https://semver.org/) model and breaking changes will be
> announced in the release notes. This means that while you may use them, you may need to update
> your source code when upgrading to a newer version of this package.

---

<!--END STABILITY BANNER-->


Under development
2 changes: 2 additions & 0 deletions packages/@aws-cdk/aws-eks-v2-alpha/lib/access-entry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { CfnAccessEntry } from 'aws-cdk-lib/aws-eks';
import {
Resource, IResource, Aws, Lazy,
} from 'aws-cdk-lib/core';
import { MetadataType } from 'aws-cdk-lib/core/lib/metadata-resource';

/**
* Represents an access entry in an Amazon EKS cluster.
Expand Down Expand Up @@ -327,6 +328,7 @@ export class AccessEntry extends Resource implements IAccessEntry {

constructor(scope: Construct, id: string, props: AccessEntryProps ) {
super(scope, id);
this.node.addMetadata(MetadataType.CONSTRUCT, props);

this.cluster = props.cluster;
this.principal = props.principal;
Expand Down
2 changes: 2 additions & 0 deletions packages/@aws-cdk/aws-eks-v2-alpha/lib/addon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Construct } from 'constructs';
import { ICluster } from './cluster';
import { CfnAddon } from 'aws-cdk-lib/aws-eks';
import { ArnFormat, IResource, Resource, Stack, Fn } from 'aws-cdk-lib/core';
import { MetadataType } from 'aws-cdk-lib/core/lib/metadata-resource';

/**
* Represents an Amazon EKS Add-On.
Expand Down Expand Up @@ -127,6 +128,7 @@ export class Addon extends Resource implements IAddon {
super(scope, id, {
physicalName: props.addonName,
});
this.node.addMetadata(MetadataType.CONSTRUCT, props);

this.clusterName = props.cluster.clusterName;
this.addonName = props.addonName;
Expand Down
2 changes: 2 additions & 0 deletions packages/@aws-cdk/aws-eks-v2-alpha/lib/cluster.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import * as lambda from 'aws-cdk-lib/aws-lambda';
import * as ssm from 'aws-cdk-lib/aws-ssm';
import { Annotations, CfnOutput, CfnResource, IResource, Resource, Stack, Tags, Token, Duration, Size, CfnTag, ArnComponents } from 'aws-cdk-lib/core';
import { CfnCluster } from 'aws-cdk-lib/aws-eks';
import { MetadataType } from 'aws-cdk-lib/core/lib/metadata-resource';

// defaults are based on https://eksctl.io
const DEFAULT_CAPACITY_COUNT = 2;
Expand Down Expand Up @@ -1516,6 +1517,7 @@ export class Cluster extends ClusterBase {
super(scope, id, {
physicalName: props.clusterName,
});
this.node.addMetadata(MetadataType.CONSTRUCT, props);

const stack = Stack.of(this);

Expand Down
2 changes: 2 additions & 0 deletions packages/@aws-cdk/aws-eks-v2-alpha/lib/fargate-cluster.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Construct } from 'constructs';
import { Cluster, ClusterOptions, CoreDnsComputeType } from './cluster';
import { FargateProfile, FargateProfileOptions } from './fargate-profile';
import { MetadataType } from 'aws-cdk-lib/core/lib/metadata-resource';

/**
* Configuration props for EKS Fargate.
Expand Down Expand Up @@ -35,6 +36,7 @@ export class FargateCluster extends Cluster {
coreDnsComputeType: props.coreDnsComputeType ?? CoreDnsComputeType.FARGATE,
version: props.version,
});
this.node.addMetadata(MetadataType.CONSTRUCT, props);

this.defaultProfile = this.addFargateProfile(
props.defaultProfile?.fargateProfileName ?? (props.defaultProfile ? 'custom' : 'default'),
Expand Down
2 changes: 2 additions & 0 deletions packages/@aws-cdk/aws-eks-v2-alpha/lib/managed-nodegroup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { InstanceType, ISecurityGroup, SubnetSelection, InstanceArchitecture, In
import { IRole, ManagedPolicy, PolicyStatement, Role, ServicePrincipal } from 'aws-cdk-lib/aws-iam';
import { IResource, Resource, Annotations, withResolved, FeatureFlags } from 'aws-cdk-lib/core';
import * as cxapi from 'aws-cdk-lib/cx-api';
import { MetadataType } from 'aws-cdk-lib/core/lib/metadata-resource';

/**
* NodeGroup interface
Expand Down Expand Up @@ -390,6 +391,7 @@ export class Nodegroup extends Resource implements INodegroup {
super(scope, id, {
physicalName: props.nodegroupName,
});
this.node.addMetadata(MetadataType.CONSTRUCT, props);

this.cluster = props.cluster;

Expand Down
2 changes: 2 additions & 0 deletions packages/@aws-cdk/aws-eks-v2-alpha/lib/oidc-provider.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Construct } from 'constructs';
import * as iam from 'aws-cdk-lib/aws-iam';
import { MetadataType } from 'aws-cdk-lib/core/lib/metadata-resource';

/**
* Initialization properties for `OpenIdConnectProvider`.
Expand Down Expand Up @@ -48,5 +49,6 @@ export class OpenIdConnectProvider extends iam.OpenIdConnectProvider {
url: props.url,
clientIds,
});
this.node.addMetadata(MetadataType.CONSTRUCT, props);
}
}
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-eks-v2-alpha/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@aws-cdk/aws-eks-v2-alpha",
"version": "0.0.0",
"private": true,
"private": false,
"description": "The CDK Construct Library for AWS::EKS",
"main": "lib/index.js",
"types": "lib/index.d.ts",
Expand Down
2 changes: 2 additions & 0 deletions packages/@aws-cdk/aws-gamelift-alpha/lib/alias.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { Construct } from 'constructs';
import { IFleet } from './fleet-base';
import { IGameSessionQueueDestination } from './game-session-queue';
import { CfnAlias } from 'aws-cdk-lib/aws-gamelift';
import { MetadataType } from 'aws-cdk-lib/core/lib/metadata-resource';

/**
* Represents a Gamelift Alias for a Gamelift fleet destination.
Expand Down Expand Up @@ -199,6 +200,7 @@ export class Alias extends AliasBase {
super(scope, id, {
physicalName: props.aliasName,
});
this.node.addMetadata(MetadataType.CONSTRUCT, props);

if (!cdk.Token.isUnresolved(props.aliasName)) {
if (props.aliasName.length > 1024) {
Expand Down
Loading
Loading