Skip to content
v2.274.0

CrossStackReferences Class ​

Ergonomic API for configuring cross-stack reference strength on a construct.

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);

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) CrossStackReferencesstatic#
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.