Experimental
@aws-cdk/aws-servicecatalogappregistry-alpha is an experimental (alpha) package: its API may change in any release, without a major version bump.
ApplicationAssociator
An AppRegistry construct to automatically create an application with the given name and description.
The application name must be unique at the account level per region and it's immutable. This construct will automatically associate all stacks in the given scope, however in case of a Pipeline stack, stage underneath the pipeline will not automatically be associated and needs to be associated separately.
If cross account stack is detected and associateCrossAccountStacks in TargetApplicationOptions is true, then the application will automatically be shared with the consumer accounts to allow associations. Otherwise, the application will not be shared. Cross account feature will only work for non environment agnostic stacks.
| Stability | Experimental |
|---|---|
| Source | lib/application-associator.ts |
Example
import * as cdk from "aws-cdk-lib";
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' },
})],
});
// Associate application to the attribute group.
associatedApp.appRegistryApplication.addAttributeGroup('MyAttributeGroup' , {
attributeGroupName: 'MyAttributeGroupName',
description: 'Test attribute group',
attributes: {},
});
import aws_cdk as cdk
app = App()
associated_app = appreg.ApplicationAssociator(app, "AssociatedApplication",
applications=[appreg.TargetApplication.create_application_stack(
application_name="MyAssociatedApplication",
# 'Application containing stacks deployed via CDK.' is the default
application_description="Associated Application description",
stack_name="MyAssociatedApplicationStack",
# AWS Account and Region that are implied by the current CLI configuration is the default
env=cdk.Environment(account="123456789012", region="us-east-1")
)]
)
# Associate application to the attribute group.
associated_app.app_registry_application.add_attribute_group("MyAttributeGroup",
attribute_group_name="MyAttributeGroupName",
description="Test attribute group",
attributes={}
)
import software.amazon.awscdk.*;
App app = new App();
ApplicationAssociator associatedApp = ApplicationAssociator.Builder.create(app, "AssociatedApplication")
.applications(List.of(TargetApplication.createApplicationStack(CreateTargetApplicationOptions.builder()
.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(Environment.builder().account("123456789012").region("us-east-1").build())
.build())))
.build();
// Associate application to the attribute group.
associatedApp.appRegistryApplication.addAttributeGroup("MyAttributeGroup", AttributeGroupAssociationProps.builder()
.attributeGroupName("MyAttributeGroupName")
.description("Test attribute group")
.attributes(Map.of())
.build());
// Install: dotnet add package Amazon.CDK.AWS.ServiceCatalogAppRegistry.Alpha
using Amazon.CDK;
var app = new App();
var associatedApp = new ApplicationAssociator(app, "AssociatedApplication", new ApplicationAssociatorProps {
Applications = new [] { TargetApplication.CreateApplicationStack(new CreateTargetApplicationOptions {
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 = new Environment { Account = "123456789012", Region = "us-east-1" }
}) }
});
// Associate application to the attribute group.
associatedApp.AppRegistryApplication.AddAttributeGroup("MyAttributeGroup", new AttributeGroupAssociationProps {
AttributeGroupName = "MyAttributeGroupName",
Description = "Test attribute group",
Attributes = new Dictionary<string, object> { }
});
// Install: go get github.com/aws/aws-cdk-go/awscdkservicecatalogappregistryalpha/v2
import cdk "github.com/aws/aws-cdk-go/awscdk"
app := awscdk.NewApp()
associatedApp := appreg.NewApplicationAssociator(app, jsii.String("AssociatedApplication"), &ApplicationAssociatorProps{
Applications: []TargetApplication{
appreg.TargetApplication_CreateApplicationStack(&CreateTargetApplicationOptions{
ApplicationName: jsii.String("MyAssociatedApplication"),
// 'Application containing stacks deployed via CDK.' is the default
ApplicationDescription: jsii.String("Associated Application description"),
StackName: jsii.String("MyAssociatedApplicationStack"),
// AWS Account and Region that are implied by the current CLI configuration is the default
Env: &Environment{
Account: jsii.String("123456789012"),
Region: jsii.String("us-east-1"),
},
}),
},
})
// Associate application to the attribute group.
associatedApp.appRegistryApplication.AddAttributeGroup(jsii.String("MyAttributeGroup"), &AttributeGroupAssociationProps{
AttributeGroupName: jsii.String("MyAttributeGroupName"),
Description: jsii.String("Test attribute group"),
Attributes: map[string]interface{}{
},
})
Initializer
new ApplicationAssociator(scope: App, id: string, props: ApplicationAssociatorProps)
ApplicationAssociator(scope: App, id: str, props: ApplicationAssociatorProps)
new ApplicationAssociator(App scope, String id, ApplicationAssociatorProps props)
new ApplicationAssociator(App scope, string id, ApplicationAssociatorProps props)
NewApplicationAssociator(Scope App, Id *string, Props ApplicationAssociatorProps)
Construct Props
applicationsTargetApplication[]applicationstyping.List[TargetApplication]applicationsList<TargetApplication>ApplicationsTargetApplication[]Applications*[]TargetApplication required #Default: Empty array.
Properties
appRegistryApplicationIApplicationapp_registry_applicationIApplicationappRegistryApplicationIApplicationAppRegistryApplicationIApplicationAppRegistryApplicationIApplication #Methods
associateStage(stage: Stage): Stagedef associate_stage(self, stage: Stage) -> Stagepublic Stage associateStage(Stage stage)public Stage AssociateStage(Stage stage)func AssociateStage(Stage Stage) Stage #isConstruct(x: any): boolean@staticmethod def is_construct(x: Any) -> boolpublic static Boolean isConstruct(Object x)public static bool IsConstruct(object x)func IsConstruct(X interface{}) *bool static #notes · 1 parameter · returns
Use this method instead of instanceof to properly detect Construct instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the constructs library on disk are seen as independent, completely different libraries. As a consequence, the class Construct in each copy of the constructs library is seen as a different class, and an instance of one class will not test as instanceof the other class. npm install will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the constructs library can be accidentally installed, and instanceof will behave unpredictably. It is safest to avoid using instanceof, and using this type-testing method instead.
Parameters
xxxxX— Any object.
Returns: true if x is an object created from a class which extends Construct.
isStageAssociated(stage: Stage): booleandef is_stage_associated(self, stage: Stage) -> boolpublic Boolean isStageAssociated(Stage stage)public bool IsStageAssociated(Stage stage)func IsStageAssociated(Stage Stage) *bool #toString(): stringdef to_string(self, ) -> strpublic String toString()public string ToString()func ToString() *string #with(...mixins: IMixin[]): IConstructdef with(self, mixins: IMixin) -> IConstructpublic IConstruct with(IMixin mixins)public IConstruct With(IMixin mixins)func With(Mixins IMixin) IConstruct #Mixins are applied in order. The list of constructs is captured at the start of the call, so constructs added by a mixin will not be visited. Use multiple with() calls if subsequent mixins should apply to added constructs.
1 parameter · returns
Parameters
mixinsmixinsmixinsmixinsMixins— The mixins to apply.
Returns: This construct for chaining