Skip to content

chore(servicecatalogappregistry): providing default values for CreateApplicationTargetOptions #22890

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

Merged
merged 4 commits into from
Nov 15, 2022
Merged
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions packages/@aws-cdk/aws-servicecatalogappregistry/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,10 @@ const app = new App();
const associatedApp = new appreg.ApplicationAssociator(app, 'AssociatedApplication', {
applications: [appreg.TargetApplication.createApplicationStack({
applicationName: 'MyAssociatedApplication',
// 'Application containing stacks deployed via CDK.' is the default
applicationDescription: 'Associated Application description',
stackName: 'MyAssociatedApplicationStack',
// AWS Account and Region that are implied by the current CLI configuration is the default
env: { account: '123456789012', region: 'us-east-1' },
})],
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export interface CreateTargetApplicationOptions extends TargetApplicationCommonO
/**
* Application description.
*
* @default - No description.
* @default - Application containing stacks deployed via CDK.
*/
readonly applicationDescription?: string;
}
Expand Down Expand Up @@ -90,10 +90,14 @@ class CreateTargetApplication extends TargetApplication {
}
public bind(scope: Construct): BindTargetApplicationResult {
const stackId = this.applicationOptions.stackId ?? 'ApplicationAssociatorStack';
(this.applicationOptions.description as string) =
this.applicationOptions.description || `Stack that holds the ${this.applicationOptions.applicationName} application`;
(this.applicationOptions.env as cdk.Environment) =
this.applicationOptions.env || { account: process.env.CDK_DEFAULT_ACCOUNT, region: process.env.CDK_DEFAULT_REGION };
const applicationStack = new cdk.Stack(scope, stackId, this.applicationOptions);
const appRegApplication = new Application(applicationStack, 'DefaultCdkApplication', {
applicationName: this.applicationOptions.applicationName,
description: this.applicationOptions.applicationDescription,
description: this.applicationOptions.applicationDescription || 'Application containing stacks deployed via CDK.',
});

return {
Expand Down