class Tags
Language | Type name |
---|---|
.NET | Amazon.CDK.Assertions.Tags |
Go | github.com/aws/aws-cdk-go/awscdk/v2/assertions#Tags |
Java | software.amazon.awscdk.assertions.Tags |
Python | aws_cdk.assertions.Tags |
TypeScript (source) | aws-cdk-lib » assertions » Tags |
Allows assertions on the tags associated with a synthesized CDK stack's manifest.
Stack tags are not part of the synthesized template, so can only be checked from the manifest in this manner.
Example
const tags = Tags.fromStack(stack);
// using a default 'objectLike' Matcher
tags.hasValues({
'tag-name': 'tag-value',
});
// ... with Matchers embedded
tags.hasValues({
'tag-name': Match.stringLikeRegexp('value'),
});
// or another object Matcher at the top level
tags.hasValues(Match.objectEquals({
'tag-name': Match.anyValue(),
}));
Methods
Name | Description |
---|---|
all() | Get the tags associated with the manifest. |
has | Assert that the there are no tags associated with the synthesized CDK Stack's manifest. |
has | Assert that the given Matcher or object matches the tags associated with the synthesized CDK Stack's manifest. |
static from | Find tags associated with a synthesized CDK Stack . |
all()
public all(): { [string]: string }
Returns
{ [string]: string }
Get the tags associated with the manifest.
This will be an empty object if no tags were supplied.
None()
haspublic hasNone(): void
Assert that the there are no tags associated with the synthesized CDK Stack's manifest.
This is a convenience method over hasValues(Match.exact({}))
, and is
present because the more obvious method of detecting no tags
(Match.absent()
) will not work. Manifests default the tag set to an empty
object.
Values(tags)
haspublic hasValues(tags: any): void
Parameters
- tags
any
— the expected set of tags.
Assert that the given Matcher or object matches the tags associated with the synthesized CDK Stack's manifest.
Stack(stack)
static frompublic static fromStack(stack: Stack): Tags
Parameters
- stack
Stack
— the CDK Stack to find tags on.
Returns
Find tags associated with a synthesized CDK Stack
.