Skip to main content
Includes API for attaching annotations such as warning messages to constructs.

Methods

NameDescription
add_errorAdds an { “error”: < message > } metadata entry to this construct.
add_infoAdds an info metadata entry to this construct.
add_warningAdds a warning metadata entry to this construct.

add_error

def add_error(
  message: str
) -> None
Adds an { “error”: < message > } metadata entry to this construct. The toolkit will fail synthesis when errors are reported.

messageRequired

  • Type: str
The error message.

add_info

def add_info(
  message: str
) -> None
Adds an info metadata entry to this construct. The CLI will display the info message when apps are synthesized.

messageRequired

  • Type: str
The info message.

add_warning

def add_warning(
  message: str
) -> None
Adds a warning metadata entry to this construct. The CLI will display the warning when an app is synthesized. In a future release the CLI might introduce a —strict flag which will then fail the synthesis if it encounters a warning.

messageRequired

  • Type: str
The warning message.

Static Functions

NameDescription
ofReturns the annotations API for a construct scope.

of

import cdktn

cdktn.Annotations.of(
  scope: IConstruct
)
Returns the annotations API for a construct scope.

scopeRequired

  • Type: constructs.IConstruct
The scope.