Class: AWSCDK::Assertions::Tags
- Inherits:
-
Jsii::Object
- Object
- Jsii::Object
- AWSCDK::Assertions::Tags
- Defined in:
- assertions/tags.rb
Overview
Allows assertions on the tags associated with a synthesized CDK stack's manifest.
Stack tags are not part of the synthesized template, so can only be checked from the manifest in this manner.
Class Method Summary collapse
-
.from_stack(stack) ⇒ AWSCDK::Assertions::Tags
Find tags associated with a synthesized CDK
Stack. - .jsii_overridable_methods ⇒ Object
Instance Method Summary collapse
-
#all ⇒ Hash{String => String}
Get the tags associated with the manifest.
-
#has_none ⇒ void
Assert that the there are no tags associated with the synthesized CDK Stack's manifest.
-
#has_values(tags) ⇒ void
Assert that the given Matcher or object matches the tags associated with the synthesized CDK Stack's manifest.
-
#initialize(*args) ⇒ Tags
constructor
A new instance of Tags.
Constructor Details
#initialize(*args) ⇒ Tags
Returns a new instance of Tags.
11 12 13 |
# File 'assertions/tags.rb', line 11 def initialize(*args) raise NoMethodError, "aws-cdk-lib.assertions.Tags does not have a visible constructor; use the provided factory methods" end |
Class Method Details
.from_stack(stack) ⇒ AWSCDK::Assertions::Tags
Find tags associated with a synthesized CDK Stack.
27 28 29 30 |
# File 'assertions/tags.rb', line 27 def self.from_stack(stack) Jsii::Type.check_type(stack, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5TdGFjayJ9")), "stack") Jsii::Kernel.instance.call_static("aws-cdk-lib.assertions.Tags", "fromStack", [stack]) end |
.jsii_overridable_methods ⇒ Object
15 16 17 18 19 20 21 |
# File 'assertions/tags.rb', line 15 def self.jsii_overridable_methods { :all => { kind: :method, name: "all", is_optional: false }, :has_none => { kind: :method, name: "hasNone", is_optional: false }, :has_values => { kind: :method, name: "hasValues", is_optional: false }, } end |
Instance Method Details
#all ⇒ Hash{String => String}
Get the tags associated with the manifest.
This will be an empty object if no tags were supplied.
38 39 40 |
# File 'assertions/tags.rb', line 38 def all() jsii_call_method("all", []) end |
#has_none ⇒ void
This method returns an undefined value.
Assert that the there are no tags associated with the synthesized CDK Stack's manifest.
This is a convenience method over hasValues(Match.exact({})), and is
present because the more obvious method of detecting no tags
(Match.absent()) will not work. Manifests default the tag set to an empty
object.
50 51 52 |
# File 'assertions/tags.rb', line 50 def has_none() jsii_call_method("hasNone", []) end |
#has_values(tags) ⇒ void
This method returns an undefined value.
Assert that the given Matcher or object matches the tags associated with the synthesized CDK Stack's manifest.
58 59 60 61 |
# File 'assertions/tags.rb', line 58 def has_values() Jsii::Type.check_type(, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJhbnkifQ==")), "tags") jsii_call_method("hasValues", []) end |