Documentation ¶
Index ¶
- func Capture_IsMatcher(x interface{}) *bool
- func Matcher_IsMatcher(x interface{}) *bool
- func NewCapture_Override(c Capture, pattern interface{})
- func NewMatchResult_Override(m MatchResult, target interface{})
- func NewMatch_Override(m Match)
- func NewMatcher_Override(m Matcher)
- type Capture
- type Match
- type MatchCapture
- type MatchFailure
- type MatchResult
- type Matcher
- func Match_Absent() Matcher
- func Match_AnyValue() Matcher
- func Match_ArrayEquals(pattern *[]interface{}) Matcher
- func Match_ArrayWith(pattern *[]interface{}) Matcher
- func Match_Exact(pattern interface{}) Matcher
- func Match_Not(pattern interface{}) Matcher
- func Match_ObjectEquals(pattern *map[string]interface{}) Matcher
- func Match_ObjectLike(pattern *map[string]interface{}) Matcher
- func Match_SerializedJson(pattern interface{}) Matcher
- type Template
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Capture_IsMatcher ¶
func Capture_IsMatcher(x interface{}) *bool
Check whether the provided object is a subtype of the `IMatcher`. Experimental.
func Matcher_IsMatcher ¶
func Matcher_IsMatcher(x interface{}) *bool
Check whether the provided object is a subtype of the `IMatcher`. Experimental.
func NewCapture_Override ¶
func NewCapture_Override(c Capture, pattern interface{})
Initialize a new capture. Experimental.
func NewMatchResult_Override ¶
func NewMatchResult_Override(m MatchResult, target interface{})
Experimental.
Types ¶
type Capture ¶
type Capture interface { Matcher Name() *string AsArray() *[]interface{} AsBoolean() *bool AsNumber() *float64 AsObject() *map[string]interface{} AsString() *string Next() *bool Test(actual interface{}) MatchResult }
Capture values while matching templates.
Using an instance of this class within a Matcher will capture the matching value. The `as*()` APIs on the instance can be used to get the captured value.
TODO: EXAMPLE
Experimental.
func NewCapture ¶
func NewCapture(pattern interface{}) Capture
Initialize a new capture. Experimental.
type Match ¶
type Match interface { }
Partial and special matching during template assertions. Experimental.
type MatchCapture ¶
type MatchCapture struct { // The instance of Capture class to which this capture is associated with. // Experimental. Capture Capture `json:"capture"` // The value that was captured. // Experimental. Value interface{} `json:"value"` }
Information about a value captured during match.
TODO: EXAMPLE
Experimental.
type MatchFailure ¶
type MatchFailure struct { // The matcher that had the failure. // Experimental. Matcher Matcher `json:"matcher"` // Failure message. // Experimental. Message *string `json:"message"` // The relative path in the target where the failure occurred. // // If the failure occurred at root of the match tree, set the path to an empty list. // If it occurs in the 5th index of an array nested within the 'foo' key of an object, // set the path as `['/foo', '[5]']`. // Experimental. Path *[]*string `json:"path"` }
Match failure details.
TODO: EXAMPLE
Experimental.
type MatchResult ¶
type MatchResult interface { FailCount() *float64 Target() interface{} Compose(id *string, inner MatchResult) MatchResult Finished() MatchResult HasFailed() *bool Push(matcher Matcher, path *[]*string, message *string) MatchResult RecordCapture(options *MatchCapture) RecordFailure(failure *MatchFailure) MatchResult ToHumanStrings() *[]*string }
The result of `Match.test()`.
TODO: EXAMPLE
Experimental.
type Matcher ¶
type Matcher interface { Name() *string Test(actual interface{}) MatchResult }
Represents a matcher that can perform special data matching capabilities between a given pattern and a target.
TODO: EXAMPLE
Experimental.
func Match_Absent ¶
func Match_Absent() Matcher
Use this matcher in the place of a field's value, if the field must not be present. Experimental.
func Match_AnyValue ¶
func Match_AnyValue() Matcher
Matches any non-null value at the target. Experimental.
func Match_ArrayEquals ¶
func Match_ArrayEquals(pattern *[]interface{}) Matcher
Matches the specified pattern with the array found in the same relative path of the target.
The set of elements (or matchers) must match exactly and in order. Experimental.
func Match_ArrayWith ¶
func Match_ArrayWith(pattern *[]interface{}) Matcher
Matches the specified pattern with the array found in the same relative path of the target.
The set of elements (or matchers) must be in the same order as would be found. Experimental.
func Match_Exact ¶
func Match_Exact(pattern interface{}) Matcher
Deep exact matching of the specified pattern to the target. Experimental.
func Match_Not ¶
func Match_Not(pattern interface{}) Matcher
Matches any target which does NOT follow the specified pattern. Experimental.
func Match_ObjectEquals ¶
Matches the specified pattern to an object found in the same relative path of the target.
The keys and their values (or matchers) must match exactly with the target. Experimental.
func Match_ObjectLike ¶
Matches the specified pattern to an object found in the same relative path of the target.
The keys and their values (or matchers) must be present in the target but the target can be a superset. Experimental.
func Match_SerializedJson ¶
func Match_SerializedJson(pattern interface{}) Matcher
Matches any string-encoded JSON and applies the specified pattern after parsing it. Experimental.
type Template ¶
type Template interface { FindMappings(logicalId *string, props interface{}) *map[string]*map[string]interface{} FindOutputs(logicalId *string, props interface{}) *map[string]*map[string]interface{} FindResources(type_ *string, props interface{}) *map[string]*map[string]interface{} HasMapping(logicalId *string, props interface{}) HasOutput(logicalId *string, props interface{}) HasResource(type_ *string, props interface{}) HasResourceProperties(type_ *string, props interface{}) ResourceCountIs(type_ *string, count *float64) TemplateMatches(expected interface{}) ToJSON() *map[string]interface{} }
Suite of assertions that can be run on a CDK stack.
Typically used, as part of unit tests, to validate that the rendered CloudFormation template has expected resources and properties.
TODO: EXAMPLE
Experimental.
func Template_FromJSON ¶
Base your assertions from an existing CloudFormation template formatted as an in-memory JSON object. Experimental.
func Template_FromStack ¶
Base your assertions on the CloudFormation template synthesized by a CDK `Stack`. Experimental.
func Template_FromString ¶
Base your assertions from an existing CloudFormation template formatted as a JSON string. Experimental.