# 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.

- Source: [`assertions/lib/tags.ts`](https://github.com/aws/aws-cdk/blob/v2.274.0/packages/aws-cdk-lib/assertions/lib/tags.ts#L14)
- Type last changed: v2.137.0 · 11 Apr 2024

## 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 }` — 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.

- `fromStack(stack: Stack): Tags // chainable` (static) — Find tags associated with a synthesized CDK `Stack`.

  **Parameters**

  - `stack` — the CDK Stack to find tags on.

- `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.

- `hasValues(tags: any): void` — 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.
