Tags Class
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
ts
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
all(): { [key: string]: string }def all(self, ) -> typing.Mapping[str, str]public Map<String, String> all()public IDictionary<string, string> All()func All() *map[string]*string#Get the tags associated with the manifest.
This will be an empty object if no tags were supplied.
returns
Returns: The tags associated with the stack's synthesized manifest.
fromStack(stack: Stack): Tags // chainable@staticmethod def from_stack(stack: Stack) -> Tagspublic static Tags fromStack(Stack stack)public static Tags FromStack(Stack stack)func FromStack(Stack Stack) Tagsstatic#Find tags associated with a synthesized CDK `Stack`.
1 parameter
Parameters
stackstackstackstackStack— the CDK Stack to find tags on.
hasNone(): voiddef has_none(self, ) -> Nonepublic void hasNone()public void HasNone()func HasNone()#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.
hasValues(tags: any): voiddef has_values(self, tags: Any) -> Nonepublic void hasValues(Object tags)public void HasValues(object tags)func HasValues(Tags interface{})#Assert that the given Matcher or object matches the tags associated with the synthesized CDK Stack's manifest.
1 parameter
Parameters
tagstagstagstagsTags— the expected set of tags.