Class Tags
Allows assertions on the tags associated with a synthesized CDK stack's manifest.
Inheritance
Namespace: Amazon.CDK.Assertions
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class Tags : DeputyBase
Syntax (vb)
Public Class Tags
Inherits DeputyBase
Remarks
Stack tags are not part of the synthesized template, so can only be checked from the manifest in this manner.
ExampleMetadata: infused
Examples
var tags = Tags.FromStack(stack);
// using a default 'objectLike' Matcher
tags.HasValues(new Dictionary<string, string> {
{ "tag-name", "tag-value" }
});
// ... with Matchers embedded
tags.HasValues(new Dictionary<string, Matcher> {
{ "tag-name", Match.StringLikeRegexp("value") }
});
// or another object Matcher at the top level
tags.HasValues(Match.ObjectEquals(new Dictionary<string, object> {
{ "tag-name", Match.AnyValue() }
}));
Synopsis
Constructors
Tags(ByRefValue) | Used by jsii to construct an instance of this class from a Javascript-owned object reference |
Tags(DeputyBase.DeputyProps) | Used by jsii to construct an instance of this class from DeputyProps |
Methods
All() | Get the tags associated with the manifest. |
FromStack(Stack) | Find tags associated with a synthesized CDK |
HasNone() | Assert that the there are no tags associated with the synthesized CDK Stack's manifest. |
HasValues(Object) | Assert that the given Matcher or object matches the tags associated with the synthesized CDK Stack's manifest. |
Constructors
Tags(ByRefValue)
Used by jsii to construct an instance of this class from a Javascript-owned object reference
protected Tags(ByRefValue reference)
Parameters
- reference Amazon.JSII.Runtime.Deputy.ByRefValue
The Javascript-owned object reference
Tags(DeputyBase.DeputyProps)
Used by jsii to construct an instance of this class from DeputyProps
protected Tags(DeputyBase.DeputyProps props)
Parameters
- props Amazon.JSII.Runtime.Deputy.DeputyBase.DeputyProps
The deputy props
Methods
All()
Get the tags associated with the manifest.
public virtual IDictionary<string, string> All()
Returns
System.Collections.Generic.IDictionary<System.String, System.String>
The tags associated with the stack's synthesized manifest.
Remarks
This will be an empty object if no tags were supplied.
FromStack(Stack)
Find tags associated with a synthesized CDK Stack
.
public static Tags FromStack(Stack stack)
Parameters
- stack Stack
the CDK Stack to find tags on.
Returns
HasNone()
Assert that the there are no tags associated with the synthesized CDK Stack's manifest.
public virtual void HasNone()
Remarks
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(Object)
Assert that the given Matcher or object matches the tags associated with the synthesized CDK Stack's manifest.
public virtual void HasValues(object tags)
Parameters
- tags System.Object
the expected set of tags.