class CfnMapping (construct)
Language | Type name |
---|---|
.NET | Amazon.CDK.CfnMapping |
Go | github.com/aws/aws-cdk-go/awscdk/v2#CfnMapping |
Java | software.amazon.awscdk.CfnMapping |
Python | aws_cdk.CfnMapping |
TypeScript (source) | aws-cdk-lib » CfnMapping |
Implements
IConstruct
, IDependable
Represents a CloudFormation mapping.
Example
const regionTable = new CfnMapping(this, 'RegionTable', {
mapping: {
'us-east-1': {
regionName: 'US East (N. Virginia)',
// ...
},
'us-east-2': {
regionName: 'US East (Ohio)',
// ...
},
// ...
}
});
regionTable.findInMap(Aws.REGION, 'regionName')
Initializer
new CfnMapping(scope: Construct, id: string, props?: CfnMappingProps)
Parameters
- scope
Construct
- id
string
- props
Cfn
Mapping Props
Construct Props
Name | Type | Description |
---|---|---|
lazy? | boolean | |
mapping? | { [string]: { [string]: any } } | Mapping of key to a set of corresponding set of named values. |
lazy?
Type:
boolean
(optional)
mapping?
Type:
{ [string]: { [string]: any } }
(optional, default: No mapping.)
Mapping of key to a set of corresponding set of named values.
The key identifies a map of name-value pairs and must be unique within the mapping.
For example, if you want to set values based on a region, you can create a mapping that uses the region name as a key and contains the values you want to specify for each specific region.
Properties
Name | Type | Description |
---|---|---|
creation | string[] | |
logical | string | The logical ID for this CloudFormation stack element. |
node | Node | The tree node. |
ref | string | Return a string that will be resolved to a CloudFormation { Ref } for this element. |
stack | Stack | The stack in which this element is defined. |
creationStack
Type:
string[]
logicalId
Type:
string
The logical ID for this CloudFormation stack element.
The logical ID of the element is calculated from the path of the resource node in the construct tree.
To override this value, use overrideLogicalId(newLogicalId)
.
node
Type:
Node
The tree node.
ref
Type:
string
Return a string that will be resolved to a CloudFormation { Ref }
for this element.
If, by any chance, the intrinsic reference of a resource is not a string, you could
coerce it to an IResolvable through Lazy.any({ produce: resource.ref })
.
stack
Type:
Stack
The stack in which this element is defined.
CfnElements must be defined within a stack scope (directly or indirectly).
Methods
Name | Description |
---|---|
find | |
override | Overrides the auto-generated logical ID with a specific ID. |
set | Sets a value in the map based on the two keys. |
to | Returns a string representation of this construct. |
InMap(key1, key2, defaultValue?)
findpublic findInMap(key1: string, key2: string, defaultValue?: string): string
Parameters
- key1
string
- key2
string
- defaultValue
string
Returns
string
LogicalId(newLogicalId)
overridepublic overrideLogicalId(newLogicalId: string): void
Parameters
- newLogicalId
string
— The new logical ID to use for this stack element.
Overrides the auto-generated logical ID with a specific ID.
Value(key1, key2, value)
setpublic setValue(key1: string, key2: string, value: any): void
Parameters
- key1
string
- key2
string
- value
any
Sets a value in the map based on the two keys.
String()
topublic toString(): string
Returns
string
Returns a string representation of this construct.