UNPKG

2.12 kBTypeScriptView Raw
1import { IConstruct } from 'constructs';
2/**
3 * Includes API for attaching annotations such as warning messages to constructs.
4 */
5export declare class Annotations {
6 private readonly scope;
7 /**
8 * Returns the annotations API for a construct scope.
9 * @param scope The scope
10 */
11 static of(scope: IConstruct): Annotations;
12 private constructor();
13 /**
14 * Adds a warning metadata entry to this construct.
15 *
16 * The CLI will display the warning when an app is synthesized, or fail if run
17 * in --strict mode.
18 *
19 * @param message The warning message.
20 */
21 addWarning(message: string): void;
22 /**
23 * Adds an info metadata entry to this construct.
24 *
25 * The CLI will display the info message when apps are synthesized.
26 *
27 * @param message The info message.
28 */
29 addInfo(message: string): void;
30 /**
31 * Adds an { "error": <message> } metadata entry to this construct.
32 * The toolkit will fail deployment of any stack that has errors reported against it.
33 * @param message The error message.
34 */
35 addError(message: string): void;
36 /**
37 * Adds a deprecation warning for a specific API.
38 *
39 * Deprecations will be added only once per construct as a warning and will be
40 * deduplicated based on the `api`.
41 *
42 * If the environment variable `CDK_BLOCK_DEPRECATIONS` is set, this method
43 * will throw an error instead with the deprecation message.
44 *
45 * @param api The API being deprecated in the format `module.Class.property`
46 * (e.g. `@aws-cdk/core.Construct.node`).
47 * @param message The deprecation message to display, with information about
48 * alternatives.
49 */
50 addDeprecation(api: string, message: string): void;
51 /**
52 * Adds a message metadata entry to the construct node, to be displayed by the CDK CLI.
53 * @param level The message level
54 * @param message The message itself
55 */
56 private addMessage;
57 /**
58 * Returns the set of deprecations reported on this construct.
59 */
60 private get deprecationsReported();
61}