Class: AWSCDK::Assertions::Annotations

Inherits:
Jsii::Object
  • Object
show all
Defined in:
assertions/annotations.rb

Overview

Suite of assertions that can be run on a CDK Stack.

Focused on asserting annotations.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ Annotations

Returns a new instance of Annotations.

Raises:

  • (NoMethodError)


10
11
12
# File 'assertions/annotations.rb', line 10

def initialize(*args)
  raise NoMethodError, "aws-cdk-lib.assertions.Annotations does not have a visible constructor; use the provided factory methods"
end

Class Method Details

.from_stack(stack) ⇒ AWSCDK::Assertions::Annotations

Base your assertions on the messages returned by a synthesized CDK Stack.

Parameters:

Returns:

  • (AWSCDK::Assertions::Annotations)


32
33
34
35
# File 'assertions/annotations.rb', line 32

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.Annotations", "fromStack", [stack])
end

.jsii_overridable_methodsObject



14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'assertions/annotations.rb', line 14

def self.jsii_overridable_methods
  {
    :find_error => { kind: :method, name: "findError", is_optional: false },
    :find_info => { kind: :method, name: "findInfo", is_optional: false },
    :find_warning => { kind: :method, name: "findWarning", is_optional: false },
    :has_error => { kind: :method, name: "hasError", is_optional: false },
    :has_info => { kind: :method, name: "hasInfo", is_optional: false },
    :has_no_error => { kind: :method, name: "hasNoError", is_optional: false },
    :has_no_info => { kind: :method, name: "hasNoInfo", is_optional: false },
    :has_no_warning => { kind: :method, name: "hasNoWarning", is_optional: false },
    :has_warning => { kind: :method, name: "hasWarning", is_optional: false },
  }
end

Instance Method Details

#find_error(construct_path, message) ⇒ Array<AWSCDK::CXAPI::SynthesisMessage>

Get the set of matching errors of a given construct path and message.

Parameters:

  • construct_path (String)

    the construct path to the error, provide '*' to match all errors in the template.

  • message (Object)

    the error message as should be expected.

Returns:



42
43
44
45
46
# File 'assertions/annotations.rb', line 42

def find_error(construct_path, message)
  Jsii::Type.check_type(construct_path, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "constructPath")
  Jsii::Type.check_type(message, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJhbnkifQ==")), "message")
  jsii_call_method("findError", [construct_path, message])
end

#find_info(construct_path, message) ⇒ Array<AWSCDK::CXAPI::SynthesisMessage>

Get the set of matching infos of a given construct path and message.

Parameters:

  • construct_path (String)

    the construct path to the info, provide '*' to match all infos in the template.

  • message (Object)

    the info message as should be expected.

Returns:



53
54
55
56
57
# File 'assertions/annotations.rb', line 53

def find_info(construct_path, message)
  Jsii::Type.check_type(construct_path, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "constructPath")
  Jsii::Type.check_type(message, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJhbnkifQ==")), "message")
  jsii_call_method("findInfo", [construct_path, message])
end

#find_warning(construct_path, message) ⇒ Array<AWSCDK::CXAPI::SynthesisMessage>

Get the set of matching warning of a given construct path and message.

Parameters:

  • construct_path (String)

    the construct path to the warning, provide '*' to match all warnings in the template.

  • message (Object)

    the warning message as should be expected.

Returns:



64
65
66
67
68
# File 'assertions/annotations.rb', line 64

def find_warning(construct_path, message)
  Jsii::Type.check_type(construct_path, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "constructPath")
  Jsii::Type.check_type(message, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJhbnkifQ==")), "message")
  jsii_call_method("findWarning", [construct_path, message])
end

#has_error(construct_path, message) ⇒ void

This method returns an undefined value.

Assert that an error with the given message exists in the synthesized CDK Stack.

Parameters:

  • construct_path (String)

    the construct path to the error, provide '*' to match all errors in the template.

  • message (Object)

    the error message as should be expected.



75
76
77
78
79
# File 'assertions/annotations.rb', line 75

def has_error(construct_path, message)
  Jsii::Type.check_type(construct_path, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "constructPath")
  Jsii::Type.check_type(message, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJhbnkifQ==")), "message")
  jsii_call_method("hasError", [construct_path, message])
end

#has_info(construct_path, message) ⇒ void

This method returns an undefined value.

Assert that an info with the given message exists in the synthesized CDK Stack.

Parameters:

  • construct_path (String)

    the construct path to the info, provide '*' to match all info in the template.

  • message (Object)

    the info message as should be expected.



86
87
88
89
90
# File 'assertions/annotations.rb', line 86

def has_info(construct_path, message)
  Jsii::Type.check_type(construct_path, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "constructPath")
  Jsii::Type.check_type(message, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJhbnkifQ==")), "message")
  jsii_call_method("hasInfo", [construct_path, message])
end

#has_no_error(construct_path, message) ⇒ void

This method returns an undefined value.

Assert that an error with the given message does not exist in the synthesized CDK Stack.

Parameters:

  • construct_path (String)

    the construct path to the error, provide '*' to match all errors in the template.

  • message (Object)

    the error message as should be expected.



97
98
99
100
101
# File 'assertions/annotations.rb', line 97

def has_no_error(construct_path, message)
  Jsii::Type.check_type(construct_path, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "constructPath")
  Jsii::Type.check_type(message, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJhbnkifQ==")), "message")
  jsii_call_method("hasNoError", [construct_path, message])
end

#has_no_info(construct_path, message) ⇒ void

This method returns an undefined value.

Assert that an info with the given message does not exist in the synthesized CDK Stack.

Parameters:

  • construct_path (String)

    the construct path to the info, provide '*' to match all info in the template.

  • message (Object)

    the info message as should be expected.



108
109
110
111
112
# File 'assertions/annotations.rb', line 108

def has_no_info(construct_path, message)
  Jsii::Type.check_type(construct_path, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "constructPath")
  Jsii::Type.check_type(message, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJhbnkifQ==")), "message")
  jsii_call_method("hasNoInfo", [construct_path, message])
end

#has_no_warning(construct_path, message) ⇒ void

This method returns an undefined value.

Assert that a warning with the given message does not exist in the synthesized CDK Stack.

Parameters:

  • construct_path (String)

    the construct path to the warning, provide '*' to match all warnings in the template.

  • message (Object)

    the warning message as should be expected.



119
120
121
122
123
# File 'assertions/annotations.rb', line 119

def has_no_warning(construct_path, message)
  Jsii::Type.check_type(construct_path, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "constructPath")
  Jsii::Type.check_type(message, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJhbnkifQ==")), "message")
  jsii_call_method("hasNoWarning", [construct_path, message])
end

#has_warning(construct_path, message) ⇒ void

This method returns an undefined value.

Assert that a warning with the given message exists in the synthesized CDK Stack.

Parameters:

  • construct_path (String)

    the construct path to the warning, provide '*' to match all warnings in the template.

  • message (Object)

    the warning message as should be expected.



130
131
132
133
134
# File 'assertions/annotations.rb', line 130

def has_warning(construct_path, message)
  Jsii::Type.check_type(construct_path, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "constructPath")
  Jsii::Type.check_type(message, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJhbnkifQ==")), "message")
  jsii_call_method("hasWarning", [construct_path, message])
end