Skip to content

Commit 8b20446

Browse files
authored
chore(servicecatalogappregistry): providing default values for CreateApplicationTargetOptions (#22890)
---- ### All Submissions: * [ X] Have you followed the guidelines in our [Contributing guide?](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) ### Adding new Unconventional Dependencies: * [ ] This PR adds new unconventional dependencies following the process described [here](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md/#adding-new-unconventional-dependencies) ### New Features * [ ] Have you added the new feature to an [integration test](https://github.com/aws/aws-cdk/blob/main/INTEGRATION_TESTS.md)? * [x] Did you use `yarn integ` to deploy the infrastructure and generate the snapshot (i.e. `yarn integ` without `--dry-run`)? *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
1 parent 76a56ad commit 8b20446

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

packages/@aws-cdk/aws-servicecatalogappregistry/README.md

+3
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,10 @@ const app = new App();
7575
const associatedApp = new appreg.ApplicationAssociator(app, 'AssociatedApplication', {
7676
applications: [appreg.TargetApplication.createApplicationStack({
7777
applicationName: 'MyAssociatedApplication',
78+
// 'Application containing stacks deployed via CDK.' is the default
79+
applicationDescription: 'Associated Application description',
7880
stackName: 'MyAssociatedApplicationStack',
81+
// AWS Account and Region that are implied by the current CLI configuration is the default
7982
env: { account: '123456789012', region: 'us-east-1' },
8083
})],
8184
});

packages/@aws-cdk/aws-servicecatalogappregistry/lib/target-application.ts

+6-2
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export interface CreateTargetApplicationOptions extends TargetApplicationCommonO
2727
/**
2828
* Application description.
2929
*
30-
* @default - No description.
30+
* @default - Application containing stacks deployed via CDK.
3131
*/
3232
readonly applicationDescription?: string;
3333
}
@@ -90,10 +90,14 @@ class CreateTargetApplication extends TargetApplication {
9090
}
9191
public bind(scope: Construct): BindTargetApplicationResult {
9292
const stackId = this.applicationOptions.stackId ?? 'ApplicationAssociatorStack';
93+
(this.applicationOptions.description as string) =
94+
this.applicationOptions.description || `Stack that holds the ${this.applicationOptions.applicationName} application`;
95+
(this.applicationOptions.env as cdk.Environment) =
96+
this.applicationOptions.env || { account: process.env.CDK_DEFAULT_ACCOUNT, region: process.env.CDK_DEFAULT_REGION };
9397
const applicationStack = new cdk.Stack(scope, stackId, this.applicationOptions);
9498
const appRegApplication = new Application(applicationStack, 'DefaultCdkApplication', {
9599
applicationName: this.applicationOptions.applicationName,
96-
description: this.applicationOptions.applicationDescription,
100+
description: this.applicationOptions.applicationDescription || 'Application containing stacks deployed via CDK.',
97101
});
98102

99103
return {

0 commit comments

Comments
 (0)