Class Tags

java.lang.Object
software.amazon.jsii.JsiiObject
software.amazon.awscdk.assertions.Tags
All Implemented Interfaces:
software.amazon.jsii.JsiiSerializable

@Generated(value="jsii-pacmak/1.104.0 (build e79254c)", date="2024-11-21T06:34:02.306Z") @Stability(Stable) public class Tags extends software.amazon.jsii.JsiiObject
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:

 Tags tags = Tags.fromStack(stack);
 // using a default 'objectLike' Matcher
 tags.hasValues(Map.of(
         "tag-name", "tag-value"));
 // ... with Matchers embedded
 tags.hasValues(Map.of(
         "tag-name", Match.stringLikeRegexp("value")));
 // or another object Matcher at the top level
 tags.hasValues(Match.objectEquals(Map.of(
         "tag-name", Match.anyValue())));
 
  • Nested Class Summary

    Nested classes/interfaces inherited from class software.amazon.jsii.JsiiObject

    software.amazon.jsii.JsiiObject.InitializationMode
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    Tags(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
     
    protected
    Tags(software.amazon.jsii.JsiiObjectRef objRef)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    all()
    Get the tags associated with the manifest.
    static Tags
    Find tags associated with a synthesized CDK Stack.
    void
    Assert that the there are no tags associated with the synthesized CDK Stack's manifest.
    void
    Assert that the given Matcher or object matches the tags associated with the synthesized CDK Stack's manifest.

    Methods inherited from class software.amazon.jsii.JsiiObject

    jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSet

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface software.amazon.jsii.JsiiSerializable

    $jsii$toJson
  • Constructor Details

    • Tags

      protected Tags(software.amazon.jsii.JsiiObjectRef objRef)
    • Tags

      protected Tags(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
  • Method Details

    • fromStack

      @Stability(Stable) @NotNull public static Tags fromStack(@NotNull Stack stack)
      Find tags associated with a synthesized CDK Stack.

      Parameters:
      stack - the CDK Stack to find tags on. This parameter is required.
    • all

      @Stability(Stable) @NotNull public Map<String,String> all()
      Get the tags associated with the manifest.

      This will be an empty object if no tags were supplied.

      Returns:
      The tags associated with the stack's synthesized manifest.
    • hasNone

      @Stability(Stable) public void 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

      @Stability(Stable) public void hasValues(@NotNull Object tags)
      Assert that the given Matcher or object matches the tags associated with the synthesized CDK Stack's manifest.

      Parameters:
      tags - the expected set of tags. This parameter is required.