Show / Hide Table of Contents

Class Tags

Allows assertions on the tags associated with a synthesized CDK stack's manifest.

Inheritance
object
Tags
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

Methods

All()

Get the tags associated with the manifest.

FromStack(Stack)

Find tags associated with a synthesized CDK Stack.

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.

Methods

All()

Get the tags associated with the manifest.

public virtual IDictionary<string, string> All()
Returns

IDictionary<string, 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

Tags

Remarks

Stack tags are not part of the synthesized template, so can only be checked from the manifest in this manner.

ExampleMetadata: infused

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 object

the expected set of tags.

Remarks

Stack tags are not part of the synthesized template, so can only be checked from the manifest in this manner.

ExampleMetadata: infused

Back to top Generated by DocFX