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 . |
Error(constructPath, message)
findpublic 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.
Info(constructPath, message)
findpublic 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.
Warning(constructPath, message)
findpublic 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.
Error(constructPath, message)
haspublic 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
.
Info(constructPath, message)
haspublic 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
.
NoError(constructPath, message)
haspublic 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
.
NoInfo(constructPath, message)
haspublic 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
.
NoWarning(constructPath, message)
haspublic 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
.
Warning(constructPath, message)
haspublic 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
.
Stack(stack)
static frompublic 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
.