Annotations

class aws_cdk.assertions.Annotations(*args: Any, **kwargs)

Bases: object

Suite of assertions that can be run on a CDK Stack.

Focused on asserting annotations.

ExampleMetadata:

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk.assertions as assertions
import aws_cdk.core as cdk

# stack: cdk.Stack

annotations = assertions.Annotations.from_stack(stack)

Methods

find_error(construct_path, message)

Get the set of matching errors of a given construct path and message.

Parameters:
  • construct_path (str) – the construct path to the error. Provide '*' to match all errors in the template.

  • message (Any) – the error message as should be expected. This should be a string or Matcher object.

Return type:

List[SynthesisMessage]

find_info(construct_path, message)

Get the set of matching infos of a given construct path and message.

Parameters:
  • construct_path (str) – the construct path to the info. Provide '*' to match all infos in the template.

  • message (Any) – the info message as should be expected. This should be a string or Matcher object.

Return type:

List[SynthesisMessage]

find_warning(construct_path, message)

Get the set of matching warning of a given construct path and message.

Parameters:
  • construct_path (str) – the construct path to the warning. Provide '*' to match all warnings in the template.

  • message (Any) – the warning message as should be expected. This should be a string or Matcher object.

Return type:

List[SynthesisMessage]

has_error(construct_path, message)

Assert that an error with the given message exists in the synthesized CDK Stack.

Parameters:
  • construct_path (str) – the construct path to the error. Provide '*' to match all errors in the template.

  • message (Any) – the error message as should be expected. This should be a string or Matcher object.

Return type:

None

has_info(construct_path, message)

Assert that an info with the given message exists in the synthesized CDK Stack.

Parameters:
  • construct_path (str) – the construct path to the info. Provide '*' to match all info in the template.

  • message (Any) – the info message as should be expected. This should be a string or Matcher object.

Return type:

None

has_no_error(construct_path, message)

Assert that an error with the given message does not exist in the synthesized CDK Stack.

Parameters:
  • construct_path (str) – the construct path to the error. Provide '*' to match all errors in the template.

  • message (Any) – the error message as should be expected. This should be a string or Matcher object.

Return type:

None

has_no_info(construct_path, message)

Assert that an info with the given message does not exist in the synthesized CDK Stack.

Parameters:
  • construct_path (str) – the construct path to the info. Provide '*' to match all info in the template.

  • message (Any) – the info message as should be expected. This should be a string or Matcher object.

Return type:

None

has_no_warning(construct_path, message)

Assert that an warning with the given message does not exist in the synthesized CDK Stack.

Parameters:
  • construct_path (str) – the construct path to the warning. Provide '*' to match all warnings in the template.

  • message (Any) – the warning message as should be expected. This should be a string or Matcher object.

Return type:

None

has_warning(construct_path, message)

Assert that an warning with the given message exists in the synthesized CDK Stack.

Parameters:
  • construct_path (str) – the construct path to the warning. Provide '*' to match all warnings in the template.

  • message (Any) – the warning message as should be expected. This should be a string or Matcher object.

Return type:

None

Static Methods

classmethod from_stack(stack)

Base your assertions on the messages returned by a synthesized CDK Stack.

Parameters:

stack (Stack) – the CDK Stack to run assertions on.

Return type:

Annotations