1
0
mirror of https://github.com/openshift/installer.git synced 2026-02-05 15:47:14 +01:00
Files
John Hixson 4cd576b464 vendor: use openshift fork of terraform-provider-aws and bump to v2.60.0
This is to address the "NoSuchBucket: The specified bucket does not exist"
error as explained in https://bugzilla.redhat.com/show_bug.cgi?id=1759617 and
many other similar bugs. This bug has been "fixed" several times over the
years, yet it continues to rear its ugly self. The ultimate problem is a race
condition with S3 eventual consistency. As described in the bug above, the
bucket does not yet exist when trying to reference tags. The openshift fork
that this commit references, contains an upstream patch as described in
https://github.com/terraform-providers/terraform-provider-aws/pull/13009 that
should address this issue.
2020-05-28 13:25:43 -07:00

50 lines
1.4 KiB
Go

package jmespath
import "strconv"
// JMESPath is the representation of a compiled JMES path query. A JMESPath is
// safe for concurrent use by multiple goroutines.
type JMESPath struct {
ast ASTNode
intr *treeInterpreter
}
// Compile parses a JMESPath expression and returns, if successful, a JMESPath
// object that can be used to match against data.
func Compile(expression string) (*JMESPath, error) {
parser := NewParser()
ast, err := parser.Parse(expression)
if err != nil {
return nil, err
}
jmespath := &JMESPath{ast: ast, intr: newInterpreter()}
return jmespath, nil
}
// MustCompile is like Compile but panics if the expression cannot be parsed.
// It simplifies safe initialization of global variables holding compiled
// JMESPaths.
func MustCompile(expression string) *JMESPath {
jmespath, err := Compile(expression)
if err != nil {
panic(`jmespath: Compile(` + strconv.Quote(expression) + `): ` + err.Error())
}
return jmespath
}
// Search evaluates a JMESPath expression against input data and returns the result.
func (jp *JMESPath) Search(data interface{}) (interface{}, error) {
return jp.intr.Execute(jp.ast, data)
}
// Search evaluates a JMESPath expression against input data and returns the result.
func Search(expression string, data interface{}) (interface{}, error) {
intr := newInterpreter()
parser := NewParser()
ast, err := parser.Parse(expression)
if err != nil {
return nil, err
}
return intr.Execute(ast, data)
}