From 5256de755b51c420d4357afa48d01aebf34fef85 Mon Sep 17 00:00:00 2001 From: Kaizen Conroy <36202692+kaizencc@users.noreply.github.com> Date: Wed, 8 Nov 2023 18:43:13 -0500 Subject: [PATCH] fix(appconfig): turn on awslint and fix linter errors (#27893) Most issues center around doc strings. I know nothing about appconfig, but I feel like there's massive value added to this module by providing even the cloudformation docs within cdk, so that they are accessible within the IDE. Some other linter rules I've added as exceptions, because I don't have the capacity to audit them, but they should be audited. Issue to track that work: #27894. Labeled as a fix because technically, some public facing code has changed and also I want to make sure this ends up on the changelog. BREAKING CHANGE: `Environment.fromEnvironmentAttributes` function signature changed; property called `attr` is now `attrs`. This should affect only Python users. - **appconfig**: `Extension.fromExtensionAttributes` function signature changed; property called `attr` is now `attrs`. This should affect only Python users. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license* --- .../@aws-cdk/aws-appconfig-alpha/README.md | 51 +++++++++---- .../@aws-cdk/aws-appconfig-alpha/awslint.json | 35 ++++++++- .../aws-appconfig-alpha/lib/application.ts | 9 +++ .../aws-appconfig-alpha/lib/configuration.ts | 46 +++++++++++- .../lib/deployment-strategy.ts | 72 ++++++++++++++++++- .../aws-appconfig-alpha/lib/environment.ts | 40 ++++++++--- .../aws-appconfig-alpha/lib/extension.ts | 39 +++++++--- 7 files changed, 255 insertions(+), 37 deletions(-) diff --git a/packages/@aws-cdk/aws-appconfig-alpha/README.md b/packages/@aws-cdk/aws-appconfig-alpha/README.md index dabcd2f4d27a9..bc4db6df7c992 100644 --- a/packages/@aws-cdk/aws-appconfig-alpha/README.md +++ b/packages/@aws-cdk/aws-appconfig-alpha/README.md @@ -22,7 +22,10 @@ Use AWS AppConfig, a capability of AWS Systems Manager, to create, manage, and q ## Application -In AWS AppConfig, an application is simply an organizational construct like a folder. This organizational construct has a relationship with some unit of executable code. For example, you could create an application called MyMobileApp to organize and manage configuration data for a mobile application installed by your users. Configurations and environments are associated with the application. +In AWS AppConfig, an application is simply an organizational construct like a folder. This organizational construct has a +relationship with some unit of executable code. For example, you could create an application called MyMobileApp to organize and +manage configuration data for a mobile application installed by your users. Configurations and environments are associated with +the application. The name and description of an application are optional. @@ -43,7 +46,8 @@ new appconfig.Application(this, 'MyApplication', { ## Deployment Strategy -A deployment strategy defines how a configuration will roll out. The roll out is defined by four parameters: deployment type, step percentage, deployment time, and bake time. +A deployment strategy defines how a configuration will roll out. The roll out is defined by four parameters: deployment type, +step percentage, deployment time, and bake time. See: https://docs.aws.amazon.com/appconfig/latest/userguide/appconfig-creating-deployment-strategy.html Deployment strategy with predefined values: @@ -68,11 +72,15 @@ new appconfig.DeploymentStrategy(this, 'MyDeploymentStrategy', { ## Configuration -A configuration is a higher-level construct that can either be a `HostedConfiguration` (stored internally through AWS AppConfig) or a `SourcedConfiguration` (stored in an Amazon S3 bucket, AWS Secrets Manager secrets, Systems Manager (SSM) Parameter Store parameters, SSM documents, or AWS CodePipeline). This construct manages deployments on creation. +A configuration is a higher-level construct that can either be a `HostedConfiguration` (stored internally through AWS +AppConfig) or a `SourcedConfiguration` (stored in an Amazon S3 bucket, AWS Secrets Manager secrets, Systems Manager (SSM) +Parameter Store parameters, SSM documents, or AWS CodePipeline). This construct manages deployments on creation. ### HostedConfiguration -A hosted configuration represents configuration stored in the AWS AppConfig hosted configuration store. A hosted configuration takes in the configuration content and associated AWS AppConfig application. On construction of a hosted configuration, the configuration is deployed. +A hosted configuration represents configuration stored in the AWS AppConfig hosted configuration store. A hosted configuration +takes in the configuration content and associated AWS AppConfig application. On construction of a hosted configuration, the +configuration is deployed. ```ts declare const application: appconfig.Application; @@ -108,7 +116,9 @@ new appconfig.HostedConfiguration(this, 'MyHostedConfiguration', { }); ``` -When you create a configuration and configuration profile, you can specify up to two validators. A validator ensures that your configuration data is syntactically and semantically correct. You can create validators in either JSON Schema or as an AWS Lambda function. +When you create a configuration and configuration profile, you can specify up to two validators. A validator ensures that your +configuration data is syntactically and semantically correct. You can create validators in either JSON Schema or as an AWS +Lambda function. See [About validators](https://docs.aws.amazon.com/appconfig/latest/userguide/appconfig-creating-configuration-and-profile.html#appconfig-creating-configuration-and-profile-validators) for more information. A hosted configuration with validators: @@ -127,7 +137,8 @@ new appconfig.HostedConfiguration(this, 'MyHostedConfiguration', { }); ``` -You can attach a deployment strategy (as described in the previous section) to your configuration to specify how you want your configuration to roll out. +You can attach a deployment strategy (as described in the previous section) to your configuration to specify how you want your +configuration to roll out. A hosted configuration with a deployment strategy: @@ -147,7 +158,8 @@ new appconfig.HostedConfiguration(this, 'MyHostedConfiguration', { }); ``` -The `deployTo` parameter is used to specify which environments to deploy the configuration to. If this parameter is not specified, there will not be a deployment. +The `deployTo` parameter is used to specify which environments to deploy the configuration to. If this parameter is not +specified, there will not be a deployment. A hosted configuration with `deployTo`: @@ -164,7 +176,10 @@ new appconfig.HostedConfiguration(this, 'MyHostedConfiguration', { ### SourcedConfiguration -A sourced configuration represents configuration stored in an Amazon S3 bucket, AWS Secrets Manager secret, Systems Manager (SSM) Parameter Store parameter, SSM document, or AWS CodePipeline. A sourced configuration takes in the location source construct and optionally a version number to deploy. On construction of a sourced configuration, the configuration is deployed only if a version number is specified. +A sourced configuration represents configuration stored in an Amazon S3 bucket, AWS Secrets Manager secret, Systems Manager +(SSM) Parameter Store parameter, SSM document, or AWS CodePipeline. A sourced configuration takes in the location source +construct and optionally a version number to deploy. On construction of a sourced configuration, the configuration is deployed +only if a version number is specified. ### S3 @@ -309,7 +324,8 @@ new appconfig.SourcedConfiguration(this, 'MySourcedConfiguration', { }); ``` -The `deployTo` parameter is used to specify which environments to deploy the configuration to. If this parameter is not specified, there will not be a deployment. +The `deployTo` parameter is used to specify which environments to deploy the configuration to. If this parameter is not +specified, there will not be a deployment. A sourced configuration with `deployTo`: @@ -327,7 +343,11 @@ new appconfig.SourcedConfiguration(this, 'MySourcedConfiguration', { ## Environment -For each AWS AppConfig application, you define one or more environments. An environment is a logical deployment group of AWS AppConfig targets, such as applications in a Beta or Production environment. You can also define environments for application subcomponents such as the Web, Mobile, and Back-end components for your application. You can configure Amazon CloudWatch alarms for each environment. The system monitors alarms during a configuration deployment. If an alarm is triggered, the system rolls back the configuration. +For each AWS AppConfig application, you define one or more environments. An environment is a logical deployment group of AWS +AppConfig targets, such as applications in a Beta or Production environment. You can also define environments for application +subcomponents such as the Web, Mobile, and Back-end components for your application. You can configure Amazon CloudWatch alarms +for each environment. The system monitors alarms during a configuration deployment. If an alarm is triggered, the system rolls +back the configuration. Basic environment with monitors: @@ -343,11 +363,13 @@ new appconfig.Environment(this, 'MyEnvironment', { }); ``` -Environment monitors also support L1 CfnEnvironment.MonitorsProperty constructs. However, this is not the recommended approach for CloudWatch alarms because a role will not be auto-generated if not provided. +Environment monitors also support L1 CfnEnvironment.MonitorsProperty constructs. However, this is not the recommended approach +for CloudWatch alarms because a role will not be auto-generated if not provided. ## Extension -An extension augments your ability to inject logic or behavior at different points during the AWS AppConfig workflow of creating or deploying a configuration. +An extension augments your ability to inject logic or behavior at different points during the AWS AppConfig workflow of +creating or deploying a configuration. See: https://docs.aws.amazon.com/appconfig/latest/userguide/working-with-appconfig-extensions.html ### AWS Lambda destination @@ -438,7 +460,9 @@ new appconfig.Extension(this, 'MyExtension', { }); ``` -You can also add extensions and their associations directly by calling `onDeploymentComplete()` or any other action point method on the AWS AppConfig application, configuration, or environment resource. To add an association to an existing extension, you can call `addExtension()` on the resource. +You can also add extensions and their associations directly by calling `onDeploymentComplete()` or any other action point +method on the AWS AppConfig application, configuration, or environment resource. To add an association to an existing +extension, you can call `addExtension()` on the resource. Adding an association to an AWS AppConfig application: @@ -450,4 +474,3 @@ declare const lambdaDestination: appconfig.LambdaDestination; application.addExtension(extension); application.onDeploymentComplete(lambdaDestination); ``` - diff --git a/packages/@aws-cdk/aws-appconfig-alpha/awslint.json b/packages/@aws-cdk/aws-appconfig-alpha/awslint.json index dd97030f36303..d5b37fa1cc5b6 100644 --- a/packages/@aws-cdk/aws-appconfig-alpha/awslint.json +++ b/packages/@aws-cdk/aws-appconfig-alpha/awslint.json @@ -1,5 +1,38 @@ { "exclude": [ - "*:*" + "docs-public-apis:@aws-cdk/aws-appconfig-alpha.ConfigurationSourceType.S3", + "docs-public-apis:@aws-cdk/aws-appconfig-alpha.ConfigurationSourceType.SSM_DOCUMENT", + "docs-public-apis:@aws-cdk/aws-appconfig-alpha.ConfigurationSourceType.SSM_PARAMETER", + "docs-public-apis:@aws-cdk/aws-appconfig-alpha.ConfigurationSourceType.SECRETS_MANAGER", + "docs-public-apis:@aws-cdk/aws-appconfig-alpha.ConfigurationSourceType.CODE_PIPELINE", + "docs-public-apis:@aws-cdk/aws-appconfig-alpha.SourceType.LAMBDA", + "docs-public-apis:@aws-cdk/aws-appconfig-alpha.SourceType.SQS", + "docs-public-apis:@aws-cdk/aws-appconfig-alpha.SourceType.SNS", + "docs-public-apis:@aws-cdk/aws-appconfig-alpha.SourceType.EVENTS", + "docs-public-apis:@aws-cdk/aws-appconfig-alpha.Platform.ARM_64", + "docs-public-apis:@aws-cdk/aws-appconfig-alpha.Platform.X86_64", + "docs-public-apis:@aws-cdk/aws-appconfig-alpha.ActionPoint.PRE_CREATE_HOSTED_CONFIGURATION_VERSION", + "docs-public-apis:@aws-cdk/aws-appconfig-alpha.ActionPoint.PRE_START_DEPLOYMENT", + "docs-public-apis:@aws-cdk/aws-appconfig-alpha.ActionPoint.ON_DEPLOYMENT_START", + "docs-public-apis:@aws-cdk/aws-appconfig-alpha.ActionPoint.ON_DEPLOYMENT_STEP", + "docs-public-apis:@aws-cdk/aws-appconfig-alpha.ActionPoint.ON_DEPLOYMENT_BAKING", + "docs-public-apis:@aws-cdk/aws-appconfig-alpha.ActionPoint.ON_DEPLOYMENT_COMPLETE", + "docs-public-apis:@aws-cdk/aws-appconfig-alpha.ActionPoint.ON_DEPLOYMENT_ROLLED_BACK", + "docs-public-apis:@aws-cdk/aws-appconfig-alpha.IValidator", + "docs-public-apis:@aws-cdk/aws-appconfig-alpha.IExtension", + "docs-public-apis:@aws-cdk/aws-appconfig-alpha.IEnvironment", + "docs-public-apis:@aws-cdk/aws-appconfig-alpha.IDeploymentStrategy", + "docs-public-apis:@aws-cdk/aws-appconfig-alpha.IConfiguration", + "docs-public-apis:@aws-cdk/aws-appconfig-alpha.IApplication", + + "no-unused-type:@aws-cdk/aws-appconfig-alpha.PredefinedDeploymentStrategyId", + "ref-via-interface:@aws-cdk/aws-appconfig-alpha.Application.addAgentToEcs.taskDef", + "props-physical-name:@aws-cdk/aws-appconfig-alpha.ApplicationProps", + "props-physical-name:@aws-cdk/aws-appconfig-alpha.DeploymentStrategyProps", + "props-physical-name:@aws-cdk/aws-appconfig-alpha.EnvironmentProps", + "props-physical-name:@aws-cdk/aws-appconfig-alpha.ExtensionProps", + "events-in-interface", + "events-method-signature", + "events-generic" ] } \ No newline at end of file diff --git a/packages/@aws-cdk/aws-appconfig-alpha/lib/application.ts b/packages/@aws-cdk/aws-appconfig-alpha/lib/application.ts index 9ad5cafd5d599..cd6eb38adcbb2 100644 --- a/packages/@aws-cdk/aws-appconfig-alpha/lib/application.ts +++ b/packages/@aws-cdk/aws-appconfig-alpha/lib/application.ts @@ -28,11 +28,13 @@ export interface IApplication extends cdk.IResource { /** * The ID of the application. + * @attribute */ readonly applicationId: string; /** * The Amazon Resource Name (ARN) of the application. + * @attribute */ readonly applicationArn: string; @@ -73,6 +75,9 @@ export interface IApplication extends cdk.IResource { get environments(): IEnvironment[]; } +/** + * Properties for the Application construct + */ export interface ApplicationProps { /** * The name of the application. @@ -312,11 +317,15 @@ export class Application extends ApplicationBase { /** * The ID of the application. + * + * @attribute */ public readonly applicationId: string; /** * The Amazon Resource Name (ARN) of the application. + * + * @attribute */ public readonly applicationArn: string; diff --git a/packages/@aws-cdk/aws-appconfig-alpha/lib/configuration.ts b/packages/@aws-cdk/aws-appconfig-alpha/lib/configuration.ts index 25eb4adbacc02..de9f661b5c488 100644 --- a/packages/@aws-cdk/aws-appconfig-alpha/lib/configuration.ts +++ b/packages/@aws-cdk/aws-appconfig-alpha/lib/configuration.ts @@ -16,6 +16,9 @@ import { IEnvironment } from './environment'; import { ActionPoint, IEventDestination, ExtensionOptions, IExtension, IExtensible, ExtensibleBase } from './extension'; import { getHash } from './private/hash'; +/** + * Options for the Configuration construct + */ export interface ConfigurationOptions { /** * The deployment strategy for the configuration. @@ -71,6 +74,9 @@ export interface ConfigurationOptions { readonly deploymentKey?: kms.IKey; } +/** + * Properties for the Configuration construct. + */ export interface ConfigurationProps extends ConfigurationOptions { /** * The application associated with the configuration. @@ -327,6 +333,9 @@ abstract class ConfigurationBase extends Construct implements IConfiguration, IE } } +/** + * Options for HostedConfiguration + */ export interface HostedConfigurationOptions extends ConfigurationOptions { /** * The content of the hosted configuration. @@ -348,6 +357,9 @@ export interface HostedConfigurationOptions extends ConfigurationOptions { readonly versionLabel?: string; } +/** + * Properties for HostedConfiguration + */ export interface HostedConfigurationProps extends ConfigurationProps { /** * The content of the hosted configuration. @@ -369,6 +381,9 @@ export interface HostedConfigurationProps extends ConfigurationProps { readonly versionLabel?: string; } +/** + * A hosted configuration represents configuration stored in the AWS AppConfig hosted configuration store. + */ export class HostedConfiguration extends ConfigurationBase { /** * The content of the hosted configuration. @@ -469,6 +484,9 @@ export class HostedConfiguration extends ConfigurationBase { } } +/** + * Options for SourcedConfiguration + */ export interface SourcedConfigurationOptions extends ConfigurationOptions { /** * The location where the configuration is stored. @@ -491,6 +509,9 @@ export interface SourcedConfigurationOptions extends ConfigurationOptions { readonly retrievalRole?: iam.IRole; } +/** + * Properties for SourcedConfiguration. + */ export interface SourcedConfigurationProps extends ConfigurationProps { /** * The location where the configuration is stored. @@ -513,6 +534,10 @@ export interface SourcedConfigurationProps extends ConfigurationProps { readonly retrievalRole?: iam.IRole; } +/** + * A sourced configuration represents configuration stored in an Amazon S3 bucket, AWS Secrets Manager secret, Systems Manager + * (SSM) Parameter Store parameter, SSM document, or AWS CodePipeline. + */ export class SourcedConfiguration extends ConfigurationBase { /** * The location where the configuration is stored. @@ -680,7 +705,19 @@ export class SourcedConfiguration extends ConfigurationBase { * The configuration type. */ export enum ConfigurationType { + /** + * Freeform configuration profile. Allows you to store your data in the AWS AppConfig + * hosted configuration store or another Systems Manager capability or AWS service that integrates + * with AWS AppConfig. + * + * @see https://docs.aws.amazon.com/appconfig/latest/userguide/appconfig-free-form-configurations-creating.html + */ FREEFORM = 'AWS.Freeform', + + /** + * Feature flag configuration profile. This configuration stores its data + * in the AWS AppConfig hosted configuration store and the URI is simply hosted. + */ FEATURE_FLAGS = 'AWS.AppConfig.FeatureFlags', } @@ -688,7 +725,14 @@ export enum ConfigurationType { * The validator type. */ export enum ValidatorType { + /** + * JSON Scema validator. + */ JSON_SCHEMA = 'JSON_SCHEMA', + + /** + * Validate using a Lambda function. + */ LAMBDA = 'LAMBDA', } @@ -700,7 +744,7 @@ export enum ConfigurationSourceType { SECRETS_MANAGER = 'SECRETS_MANAGER', SSM_PARAMETER = 'SSM_PARAMETER', SSM_DOCUMENT = 'SSM_DOCUMENT', - CODE_PIPELINE = 'CODE_PIPELINE' + CODE_PIPELINE = 'CODE_PIPELINE', } export interface IValidator { diff --git a/packages/@aws-cdk/aws-appconfig-alpha/lib/deployment-strategy.ts b/packages/@aws-cdk/aws-appconfig-alpha/lib/deployment-strategy.ts index 3bc454de41f91..a97c6ff02d038 100644 --- a/packages/@aws-cdk/aws-appconfig-alpha/lib/deployment-strategy.ts +++ b/packages/@aws-cdk/aws-appconfig-alpha/lib/deployment-strategy.ts @@ -2,6 +2,9 @@ import { Resource, IResource, Stack, ArnFormat, Names, Duration } from 'aws-cdk- import { CfnDeploymentStrategy } from 'aws-cdk-lib/aws-appconfig'; import { Construct } from 'constructs'; +/** + * Properties for DeploymentStrategy. + */ export interface DeploymentStrategyProps { /** * The rollout strategy for the deployment strategy. You can use predefined deployment @@ -118,6 +121,8 @@ export class DeploymentStrategy extends Resource implements IDeploymentStrategy /** * The Amazon Resource Name (ARN) of the deployment strategy. + * + * @attribute */ public readonly deploymentStrategyArn: string; @@ -162,20 +167,56 @@ export class DeploymentStrategy extends Resource implements IDeploymentStrategy * Defines the growth type of the deployment strategy. */ export enum GrowthType { + /** + * AWS AppConfig will process the deployment by increments of the growth factor + * evenly distributed over the deployment. + */ LINEAR = 'LINEAR', + + /** + * AWS AppConfig will process the deployment exponentially using the following formula: + * `G*(2^N)`. In this formula, `G` is the step percentage specified by the user and `N` + * is the number of steps until the configuration is deployed to all targets. + */ EXPONENTIAL = 'EXPONENTIAL', } /** * Defines the deployment strategy ID's of AWS AppConfig predefined strategies. + * + * @see https://docs.aws.amazon.com/appconfig/latest/userguide/appconfig-creating-deployment-strategy.html */ export enum PredefinedDeploymentStrategyId { + /** + * **AWS Recommended**. This strategy processes the deployment exponentially using a 10% growth factor over 20 minutes. + * AWS AppConfig recommends using this strategy for production deployments because it aligns with AWS best practices + * for configuration deployments. + */ CANARY_10_PERCENT_20_MINUTES = 'AppConfig.Canary10Percent20Minutes', + + /** + * **Testing/Demonstration**. This strategy deploys the configuration to half of all targets every 30 seconds for a + * one-minute deployment. AWS AppConfig recommends using this strategy only for testing or demonstration purposes because + * it has a short duration and bake time. + */ LINEAR_50_PERCENT_EVERY_30_SECONDS = 'AppConfig.Linear50PercentEvery30Seconds', + + /** + * **AWS Recommended**. This strategy deploys the configuration to 20% of all targets every six minutes for a 30 minute deployment. + * AWS AppConfig recommends using this strategy for production deployments because it aligns with AWS best practices + * for configuration deployments. + */ LINEAR_20_PERCENT_EVERY_6_MINUTES = 'AppConfig.Linear20PercentEvery6Minutes', + + /** + * **Quick**. This strategy deploys the configuration to all targets immediately. + */ ALL_AT_ONCE = 'AppConfig.AllAtOnce', } +/** + * Properties for the Rollout Strategy. + */ export interface RolloutStrategyProps { /** * The growth factor of the deployment strategy. This defines @@ -207,23 +248,46 @@ export interface RolloutStrategyProps { /** * Defines the rollout strategy for a deployment strategy and includes the growth factor, * deployment duration, growth type, and optionally final bake time. + * + * @see https://docs.aws.amazon.com/appconfig/latest/userguide/appconfig-creating-deployment-strategy.html */ export abstract class RolloutStrategy { + /** + * **AWS Recommended**. This strategy processes the deployment exponentially using a 10% growth factor over 20 minutes. + * AWS AppConfig recommends using this strategy for production deployments because it aligns with AWS best practices + * for configuration deployments. + */ public static readonly CANARY_10_PERCENT_20_MINUTES = RolloutStrategy.exponential({ growthFactor: 10, deploymentDuration: Duration.minutes(20), finalBakeTime: Duration.minutes(10), }); + + /** + * **Testing/Demonstration**. This strategy deploys the configuration to half of all targets every 30 seconds for a + * one-minute deployment. AWS AppConfig recommends using this strategy only for testing or demonstration purposes because + * it has a short duration and bake time. + */ public static readonly LINEAR_50_PERCENT_EVERY_30_SECONDS = RolloutStrategy.linear({ growthFactor: 50, deploymentDuration: Duration.minutes(1), finalBakeTime: Duration.minutes(1), }); + + /** + * **AWS Recommended**. This strategy deploys the configuration to 20% of all targets every six minutes for a 30 minute deployment. + * AWS AppConfig recommends using this strategy for production deployments because it aligns with AWS best practices + * for configuration deployments. + */ public static readonly LINEAR_20_PERCENT_EVERY_6_MINUTES = RolloutStrategy.linear({ growthFactor: 20, deploymentDuration: Duration.minutes(30), finalBakeTime: Duration.minutes(30), }); + + /** + * **Quick**. This strategy deploys the configuration to all targets immediately. + */ public static readonly ALL_AT_ONCE = RolloutStrategy.linear({ growthFactor: 100, deploymentDuration: Duration.minutes(0), @@ -231,7 +295,7 @@ export abstract class RolloutStrategy { }); /** - * @returns A linear rollout strategy. + * Build your own linear rollout strategy. */ public static linear(props: RolloutStrategyProps): RolloutStrategy { return { @@ -243,7 +307,7 @@ export abstract class RolloutStrategy { } /** - * @returns An exponential rollout strategy. + * Build your own exponential rollout strategy. */ public static exponential(props: RolloutStrategyProps): RolloutStrategy { return { @@ -308,11 +372,13 @@ export interface IDeploymentStrategy extends IResource { /** * The ID of the deployment strategy. + * @attribute */ readonly deploymentStrategyId: string; /** * The Amazon Resource Name (ARN) of the deployment strategy. + * @attribute */ readonly deploymentStrategyArn: string; -} \ No newline at end of file +} diff --git a/packages/@aws-cdk/aws-appconfig-alpha/lib/environment.ts b/packages/@aws-cdk/aws-appconfig-alpha/lib/environment.ts index cbe4c1ebbebb7..c77bbe8975106 100644 --- a/packages/@aws-cdk/aws-appconfig-alpha/lib/environment.ts +++ b/packages/@aws-cdk/aws-appconfig-alpha/lib/environment.ts @@ -85,6 +85,9 @@ abstract class EnvironmentBase extends Resource implements IEnvironment, IExtens } } +/** + * Options for the Environment construct. + */ export interface EnvironmentOptions { /** * The name of the environment. @@ -108,6 +111,9 @@ export interface EnvironmentOptions { readonly monitors?: Monitor[]; } +/** + * Properties for the Environment construct. + */ export interface EnvironmentProps extends EnvironmentOptions { /** * The application to be associated with the environment. @@ -159,11 +165,11 @@ export class Environment extends EnvironmentBase { * * @param scope The parent construct * @param id The name of the environment construct - * @param attr The attributes of the environment + * @param attrs The attributes of the environment */ - public static fromEnvironmentAttributes(scope: Construct, id: string, attr: EnvironmentAttributes): IEnvironment { - const applicationId = attr.application.applicationId; - const environmentId = attr.environmentId; + public static fromEnvironmentAttributes(scope: Construct, id: string, attrs: EnvironmentAttributes): IEnvironment { + const applicationId = attrs.application.applicationId; + const environmentId = attrs.environmentId; const stack = Stack.of(scope); const environmentArn = stack.formatArn({ @@ -173,13 +179,13 @@ export class Environment extends EnvironmentBase { }); class Import extends EnvironmentBase { - public readonly application = attr.application; - public readonly applicationId = attr.application.applicationId; - public readonly name = attr.name; + public readonly application = attrs.application; + public readonly applicationId = attrs.application.applicationId; + public readonly name = attrs.name; public readonly environmentId = environmentId; public readonly environmentArn = environmentArn; - public readonly description = attr.description; - public readonly monitors = attr.monitors; + public readonly description = attrs.description; + public readonly monitors = attrs.monitors; } return new Import(scope, id, { @@ -209,11 +215,15 @@ export class Environment extends EnvironmentBase { /** * The ID of the environment. + * + * @attribute */ public readonly environmentId: string; /** * The Amazon Resource Name (ARN) of the environment. + * + * @attribute */ public readonly environmentArn: string; @@ -284,8 +294,18 @@ export class Environment extends EnvironmentBase { } } +/** + * The type of Monitor. + */ export enum MonitorType { + /** + * A Monitor from a CloudWatch alarm. + */ CLOUDWATCH, + + /** + * A Monitor from a CfnEnvironment.MonitorsProperty construct. + */ CFN_MONITORS_PROPERTY, } @@ -365,11 +385,13 @@ export interface IEnvironment extends IResource { /** * The ID of the environment. + * @attribute */ readonly environmentId: string; /** * The Amazon Resource Name (ARN) of the environment. + * @attribute */ readonly environmentArn: string; diff --git a/packages/@aws-cdk/aws-appconfig-alpha/lib/extension.ts b/packages/@aws-cdk/aws-appconfig-alpha/lib/extension.ts index d378214ffc799..3f21307843370 100644 --- a/packages/@aws-cdk/aws-appconfig-alpha/lib/extension.ts +++ b/packages/@aws-cdk/aws-appconfig-alpha/lib/extension.ts @@ -23,6 +23,9 @@ export enum ActionPoint { ON_DEPLOYMENT_ROLLED_BACK = 'ON_DEPLOYMENT_ROLLED_BACK', } +/** + * Defines the source type for event destinations. + */ export enum SourceType { LAMBDA = 'lambda', SQS = 'sqs', @@ -132,6 +135,9 @@ export class EventBridgeDestination implements IEventDestination { } } +/** + * Properties for the Action construct + */ export interface ActionProps { /** * The action points that will trigger the extension action. @@ -317,6 +323,9 @@ export interface ExtensionAttributes { readonly description?: string; } +/** + * Options for the Extension construct. + */ export interface ExtensionOptions { /** * The name of the extension. @@ -349,6 +358,9 @@ export interface ExtensionOptions { readonly parameters?: Parameter[]; } +/** + * Properties for the Extension construct. + */ export interface ExtensionProps extends ExtensionOptions { /** * The actions for the extension. @@ -400,23 +412,23 @@ export class Extension extends Resource implements IExtension { * * @param scope The parent construct * @param id The name of the extension construct - * @param attr The attributes of the extension + * @param attrs The attributes of the extension */ - public static fromExtensionAttributes(scope: Construct, id: string, attr: ExtensionAttributes): IExtension { + public static fromExtensionAttributes(scope: Construct, id: string, attrs: ExtensionAttributes): IExtension { const stack = Stack.of(scope); - const extensionArn = attr.extensionArn || stack.formatArn({ + const extensionArn = attrs.extensionArn || stack.formatArn({ service: 'appconfig', resource: 'extension', - resourceName: `${attr.extensionId}/${attr.extensionVersionNumber}`, + resourceName: `${attrs.extensionId}/${attrs.extensionVersionNumber}`, }); class Import extends Resource implements IExtension { - public readonly extensionId = attr.extensionId; - public readonly extensionVersionNumber = attr.extensionVersionNumber; + public readonly extensionId = attrs.extensionId; + public readonly extensionVersionNumber = attrs.extensionVersionNumber; public readonly extensionArn = extensionArn; - public readonly name = attr.name; - public readonly actions = attr.actions; - public readonly description = attr.description; + public readonly name = attrs.name; + public readonly actions = attrs.actions; + public readonly description = attrs.description; } return new Import(scope, id, { @@ -451,16 +463,22 @@ export class Extension extends Resource implements IExtension { /** * The Amazon Resource Name (ARN) of the extension. + * + * @attribute */ public readonly extensionArn: string; /** * The ID of the extension. + * + * @attribute */ public readonly extensionId: string; /** * The version number of the extension. + * + * @attribute */ public readonly extensionVersionNumber: number; @@ -566,16 +584,19 @@ export interface IExtension extends IResource { /** * The Amazon Resource Name (ARN) of the extension. + * @attribute */ readonly extensionArn: string; /** * The ID of the extension. + * @attribute */ readonly extensionId: string; /** * The version number of the extension. + * @attribute */ readonly extensionVersionNumber: number; }