class Annotations
Language | Type name |
---|---|
.NET | Amazon.CDK.Assertions.Annotations |
Go | github.com/aws/aws-cdk-go/awscdk/v2/assertions#Annotations |
Java | software.amazon.awscdk.assertions.Annotations |
Python | aws_cdk.assertions.Annotations |
TypeScript (source) | aws-cdk-lib » assertions » Annotations |
Suite of assertions that can be run on a CDK Stack.
Focused on asserting annotations.
Example
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import * as cdk from 'aws-cdk-lib';
import { assertions } from 'aws-cdk-lib';
declare const stack: cdk.Stack;
const annotations = assertions.Annotations.fromStack(stack);
Methods
Name | Description |
---|---|
find | Get the set of matching errors of a given construct path and message. |
find | Get the set of matching infos of a given construct path and message. |
find | Get the set of matching warning of a given construct path and message. |
has | Assert that an error with the given message exists in the synthesized CDK Stack . |
has | Assert that an info with the given message exists in the synthesized CDK Stack . |
has | Assert that an error with the given message does not exist in the synthesized CDK Stack . |
has | Assert that an info with the given message does not exist in the synthesized CDK Stack . |
has | Assert that an warning with the given message does not exist in the synthesized CDK Stack . |
has | Assert that an warning with the given message exists in the synthesized CDK Stack . |
static from | Base your assertions on the messages returned by a synthesized CDK Stack . |
findError(constructPath, message)
public findError(constructPath: string, message: any): SynthesisMessage[]
Parameters
- constructPath
string
— the construct path to the error, provide'*'
to match all errors in the template. - message
any
— the error message as should be expected.
Returns
Get the set of matching errors of a given construct path and message.
findInfo(constructPath, message)
public findInfo(constructPath: string, message: any): SynthesisMessage[]
Parameters
- constructPath
string
— the construct path to the info, provide'*'
to match all infos in the template. - message
any
— the info message as should be expected.
Returns
Get the set of matching infos of a given construct path and message.
findWarning(constructPath, message)
public findWarning(constructPath: string, message: any): SynthesisMessage[]
Parameters
- constructPath
string
— the construct path to the warning, provide'*'
to match all warnings in the template. - message
any
— the warning message as should be expected.
Returns
Get the set of matching warning of a given construct path and message.
hasError(constructPath, message)
public hasError(constructPath: string, message: any): void
Parameters
- constructPath
string
— the construct path to the error, provide'*'
to match all errors in the template. - message
any
— the error message as should be expected.
Assert that an error with the given message exists in the synthesized CDK Stack
.
hasInfo(constructPath, message)
public hasInfo(constructPath: string, message: any): void
Parameters
- constructPath
string
— the construct path to the info, provide'*'
to match all info in the template. - message
any
— the info message as should be expected.
Assert that an info with the given message exists in the synthesized CDK Stack
.
hasNoError(constructPath, message)
public hasNoError(constructPath: string, message: any): void
Parameters
- constructPath
string
— the construct path to the error, provide'*'
to match all errors in the template. - message
any
— the error message as should be expected.
Assert that an error with the given message does not exist in the synthesized CDK Stack
.
hasNoInfo(constructPath, message)
public hasNoInfo(constructPath: string, message: any): void
Parameters
- constructPath
string
— the construct path to the info, provide'*'
to match all info in the template. - message
any
— the info message as should be expected.
Assert that an info with the given message does not exist in the synthesized CDK Stack
.
hasNoWarning(constructPath, message)
public hasNoWarning(constructPath: string, message: any): void
Parameters
- constructPath
string
— the construct path to the warning, provide'*'
to match all warnings in the template. - message
any
— the warning message as should be expected.
Assert that an warning with the given message does not exist in the synthesized CDK Stack
.
hasWarning(constructPath, message)
public hasWarning(constructPath: string, message: any): void
Parameters
- constructPath
string
— the construct path to the warning, provide'*'
to match all warnings in the template. - message
any
— the warning message as should be expected.
Assert that an warning with the given message exists in the synthesized CDK Stack
.
static fromStack(stack)
public static fromStack(stack: Stack): Annotations
Parameters
- stack
Stack
— the CDK Stack to run assertions on.
Returns
Base your assertions on the messages returned by a synthesized CDK Stack
.