Class: AWSCDK::Annotations
- Inherits:
-
Jsii::Object
- Object
- Jsii::Object
- AWSCDK::Annotations
- Defined in:
- annotations.rb
Overview
Includes API for attaching annotations such as warning messages to constructs.
Class Method Summary collapse
- .jsii_overridable_methods ⇒ Object
-
.of(scope) ⇒ AWSCDK::Annotations
Returns the annotations API for a construct scope.
Instance Method Summary collapse
-
#acknowledge_info(id, message = nil) ⇒ void
Acknowledge a info.
-
#acknowledge_warning(id, message = nil) ⇒ void
Acknowledge a warning.
-
#add_deprecation(api, message) ⇒ void
Adds a deprecation warning for a specific API.
-
#add_error(message) ⇒ void
Adds an { "error":
} metadata entry to this construct. -
#add_info(message) ⇒ void
Adds an info metadata entry to this construct.
-
#add_info_v2(id, message) ⇒ void
Adds an acknowledgeable info metadata entry to this construct.
-
#add_warning(message) ⇒ void
Adds a warning metadata entry to this construct.
-
#add_warning_v2(id, message) ⇒ void
Adds an acknowledgeable warning metadata entry to this construct.
-
#initialize(*args) ⇒ Annotations
constructor
A new instance of Annotations.
Constructor Details
#initialize(*args) ⇒ Annotations
Returns a new instance of Annotations.
8 9 10 |
# File 'annotations.rb', line 8 def initialize(*args) raise NoMethodError, "aws-cdk-lib.Annotations does not have a visible constructor; use the provided factory methods" end |
Class Method Details
.jsii_overridable_methods ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'annotations.rb', line 12 def self.jsii_overridable_methods { :acknowledge_info => { kind: :method, name: "acknowledgeInfo", is_optional: false }, :acknowledge_warning => { kind: :method, name: "acknowledgeWarning", is_optional: false }, :add_deprecation => { kind: :method, name: "addDeprecation", is_optional: false }, :add_error => { kind: :method, name: "addError", is_optional: false }, :add_info => { kind: :method, name: "addInfo", is_optional: false }, :add_info_v2 => { kind: :method, name: "addInfoV2", is_optional: false }, :add_warning => { kind: :method, name: "addWarning", is_optional: false }, :add_warning_v2 => { kind: :method, name: "addWarningV2", is_optional: false }, } end |
.of(scope) ⇒ AWSCDK::Annotations
Returns the annotations API for a construct scope.
29 30 31 32 |
# File 'annotations.rb', line 29 def self.of(scope) Jsii::Type.check_type(scope, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJjb25zdHJ1Y3RzLklDb25zdHJ1Y3QifQ==")), "scope") Jsii::Kernel.instance.call_static("aws-cdk-lib.Annotations", "of", [scope]) end |
Instance Method Details
#acknowledge_info(id, message = nil) ⇒ void
This method returns an undefined value.
Acknowledge a info. When a info is acknowledged for a scope all infos that match the id will be ignored.
The acknowledgement will apply to all child scopes
45 46 47 48 49 |
# File 'annotations.rb', line 45 def acknowledge_info(id, = nil) Jsii::Type.check_type(id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "id") Jsii::Type.check_type(, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "message") unless .nil? jsii_call_method("acknowledgeInfo", [id, ]) end |
#acknowledge_warning(id, message = nil) ⇒ void
This method returns an undefined value.
Acknowledge a warning. When a warning is acknowledged for a scope all warnings that match the id will be ignored.
The acknowledgement will apply to all child scopes
62 63 64 65 66 |
# File 'annotations.rb', line 62 def acknowledge_warning(id, = nil) Jsii::Type.check_type(id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "id") Jsii::Type.check_type(, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "message") unless .nil? jsii_call_method("acknowledgeWarning", [id, ]) end |
#add_deprecation(api, message) ⇒ void
This method returns an undefined value.
Adds a deprecation warning for a specific API.
Deprecations will be added only once per construct as a warning and will be
deduplicated based on the api.
If the environment variable CDK_BLOCK_DEPRECATIONS is set, this method
will throw an error instead with the deprecation message.
79 80 81 82 83 |
# File 'annotations.rb', line 79 def add_deprecation(api, ) Jsii::Type.check_type(api, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "api") Jsii::Type.check_type(, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "message") jsii_call_method("addDeprecation", [api, ]) end |
#add_error(message) ⇒ void
This method returns an undefined value.
Adds an { "error":
The toolkit will fail deployment of any stack that has errors reported against it.
Prefer using Validations.of(scope).addError() instead.
92 93 94 95 |
# File 'annotations.rb', line 92 def add_error() Jsii::Type.check_type(, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "message") jsii_call_method("addError", []) end |
#add_info(message) ⇒ void
This method returns an undefined value.
Adds an info metadata entry to this construct.
The CLI will display the info message when apps are synthesized.
103 104 105 106 |
# File 'annotations.rb', line 103 def add_info() Jsii::Type.check_type(, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "message") jsii_call_method("addInfo", []) end |
#add_info_v2(id, message) ⇒ void
This method returns an undefined value.
Adds an acknowledgeable info metadata entry to this construct.
The CLI will display the info when an app is synthesized.
If the info is acknowledged using acknowledge_info(), it will not be shown by the CLI.
121 122 123 124 125 |
# File 'annotations.rb', line 121 def add_info_v2(id, ) Jsii::Type.check_type(id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "id") Jsii::Type.check_type(, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "message") jsii_call_method("addInfoV2", [id, ]) end |
#add_warning(message) ⇒ void
This method returns an undefined value.
Adds a warning metadata entry to this construct. Prefer using Validations.of(scope).addWarning().
The CLI will display the warning when an app is synthesized, or fail if run
in --strict mode.
Warnings added by this call cannot be acknowledged. This will block users from
running in --strict mode until the deal with the warning, which makes it
effectively not very different from add_error. Prefer using add_warning_v2 instead.
138 139 140 141 |
# File 'annotations.rb', line 138 def add_warning() Jsii::Type.check_type(, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "message") jsii_call_method("addWarning", []) end |
#add_warning_v2(id, message) ⇒ void
This method returns an undefined value.
Adds an acknowledgeable warning metadata entry to this construct.
The CLI will display the warning when an app is synthesized, or fail if run
in --strict mode.
If the warning is acknowledged using acknowledge_warning(), it will not be shown by
the CLI, and will not cause --strict mode to fail synthesis.
Prefer using Validations.of(scope).addWarning() instead.
160 161 162 163 164 |
# File 'annotations.rb', line 160 def add_warning_v2(id, ) Jsii::Type.check_type(id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "id") Jsii::Type.check_type(, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "message") jsii_call_method("addWarningV2", [id, ]) end |