Skip to content

Commit

Permalink
chore(servicecatalogappregistry): providing default values for Create…
Browse files Browse the repository at this point in the history
…ApplicationTargetOptions (#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*
  • Loading branch information
rohitagg0807 committed Nov 15, 2022
1 parent 76a56ad commit 8b20446
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
3 changes: 3 additions & 0 deletions packages/@aws-cdk/aws-servicecatalogappregistry/README.md
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
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

0 comments on commit 8b20446

Please sign in to comment.