CrossStackReferences Class
Ergonomic API for configuring cross-stack reference strength on a construct.
| Source | core/lib/cross-stack-reference-strength.ts |
|---|---|
| Type last changed |
Example
ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import * as cdk from 'aws-cdk-lib';
const crossStackReferences = cdk.CrossStackReferences.of(this);
python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk as cdk
cross_stack_references = cdk.CrossStackReferences.of(self)
java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.*;
CrossStackReferences crossStackReferences = CrossStackReferences.of(this);
csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK;
var crossStackReferences = CrossStackReferences.Of(this);
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import cdk "github.com/aws/aws-cdk-go/awscdk"
crossStackReferences := cdk.CrossStackReferences_Of(this)
Methods
consume(strength: ReferenceStrength): voiddef consume(self, strength: ReferenceStrength) -> Nonepublic void consume(ReferenceStrength strength)public void Consume(ReferenceStrength strength)func Consume(Strength ReferenceStrength) #Set the default reference strength used when this scope consumes references from other stacks.
This controls the consuming side: sets the context key that determines how incoming cross-stack references are resolved for this scope and its descendants.
Equivalent to scope.node.setContext(DEFAULT_CROSS_STACK_REFERENCES, strength).
1 parameter
Parameters
strengthstrengthstrengthstrengthStrength— - The reference strength to use.
of(scope: IConstruct): CrossStackReferences // chainable@staticmethod def of(scope: IConstruct) -> CrossStackReferencespublic static CrossStackReferences of(IConstruct scope)public static CrossStackReferences Of(IConstruct scope)func Of(Scope IConstruct) CrossStackReferences static #Returns a `CrossStackReferences` configurator for the given construct.
1 parameter
Parameters
scopescopescopescopeScope— The construct to configure.
produce(strength: ReferenceStrength): voiddef produce(self, strength: ReferenceStrength) -> Nonepublic void produce(ReferenceStrength strength)public void Produce(ReferenceStrength strength)func Produce(Strength ReferenceStrength) #Set how this resource is referenced when consumed from another stack.
This controls the producing side: any cross-stack reference pointing at this resource will use the specified strength instead of the global default.
Equivalent to scope.applyCrossStackReferenceStrength(strength).
1 parameter
Parameters
strengthstrengthstrengthstrengthStrength— - The reference strength to use.