diff --git a/.gitignore b/.gitignore index 0ac42cbcb4b..3aa23b45149 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ node_modules +npm-debug.log coverage/ .aws-config.json awsconfig diff --git a/CHANGELOG.md b/CHANGELOG.md index e9fb3a21e4f..d4f292a2205 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,51 @@ -# 2.5 (unreleased) +# 3.0.0 (unrelased master branch) + + +### Breaking changes +**InfluxDB 0.8.x** The data source for the old version of influxdb (0.8.x) is no longer included in default builds. Can easily be installed via improved plugin system, closes #3523 +**KairosDB** The data source is no longer included in default builds. Can easily be installed via improved plugin system, closes #3524 + +# 2.6.1 (unrelased, 2.6.x branch) + +### New Features +* **Elasticsearch**: Support for derivative unit option, closes [#3512](https://github.com/grafana/grafana/issues/3512) + +# 2.6.0 (2015-12-14) + +### New Features +* **Elasticsearch**: Support for pipeline aggregations Moving average and derivative, closes [#2715](https://github.com/grafana/grafana/issues/2715) +* **Elasticsearch**: Support for inline script and missing options for metrics, closes [#3500](https://github.com/grafana/grafana/issues/3500) +* **Syslog**: Support for syslog logging, closes [#3161](https://github.com/grafana/grafana/pull/3161) +* **Timepicker**: Always show refresh button even with refresh rate, closes [#3498](https://github.com/grafana/grafana/pull/3498) +* **Login**: Make it possible to change the login hint on the login page, closes [#2571](https://github.com/grafana/grafana/pull/2571) + +### Bug Fixes +* **metric editors**: Fix for clicking typeahead auto dropdown option, fixes [#3428](https://github.com/grafana/grafana/issues/3428) +* **influxdb**: Fixed issue showing Group By label only on first query, fixes [#3453](https://github.com/grafana/grafana/issues/3453) +* **logging**: Add more verbose info logging for http reqeusts, closes [#3405](https://github.com/grafana/grafana/pull/3405) + +# 2.6.0-Beta1 (2015-12-04) + +### New Table Panel +* **table**: New powerful and flexible table panel, closes [#215](https://github.com/grafana/grafana/issues/215) + +### Enhancements +* **CloudWatch**: Support for multiple AWS Credentials, closes [#3053](https://github.com/grafana/grafana/issues/3053), [#3080](https://github.com/grafana/grafana/issues/3080) +* **Elasticsearch**: Support for dynamic daily indices for annotations, closes [#3061](https://github.com/grafana/grafana/issues/3061) +* **Elasticsearch**: Support for setting min_doc_count for date histogram, closes [#3416](https://github.com/grafana/grafana/issues/3416) +* **Graph Panel**: Option to hide series with all zeroes from legend and tooltip, closes [#1381](https://github.com/grafana/grafana/issues/1381), [#3336](https://github.com/grafana/grafana/issues/3336) + +### Bug Fixes +* **cloudwatch**: fix for handling of period for long time ranges, fixes [#3086](https://github.com/grafana/grafana/issues/3086) +* **dashboard**: fix for collapse row by clicking on row title, fixes [#3065](https://github.com/grafana/grafana/issues/3065) +* **influxdb**: fix for relative time ranges `last x months` and `last x years`, fixes [#3067](https://github.com/grafana/grafana/issues/3067) +* **graph**: layout fix for color picker when right side legend was enabled, fixes [#3093](https://github.com/grafana/grafana/issues/3093) +* **elasticsearch**: disabling elastic query (via eye) caused error, fixes [#3300](https://github.com/grafana/grafana/issues/3300) + +### Breaking changes +* **elasticsearch**: Manual json edited queries are not supported any more (They very barely worked in 2.5) + +# 2.5 (2015-10-28) **New Feature: Mix data sources** - A built in data source is now available named `-- Mixed --`, When picked in the metrics tab, @@ -11,12 +58,12 @@ it allows you to add queries of differnet data source types & instances to the s **New Feature: New and much improved time picker** - Support for quick ranges like `Today`, `This day last week`, `This week`, `The day so far`, etc. -- Muck improved UI and improved support for UTC, [Issue #2761](https://github.com/grafana/grafana/issues/2761) for more info. +- Improved UI and improved support for UTC, [Issue #2761](https://github.com/grafana/grafana/issues/2761) for more info. **User Onboarding** - Org admin can now send email invites (or invite links) to people who are not yet Grafana users - Sign up flow now supports email verification (if enabled) -- See [Issue #2353](https://github.com/grafana/grafana/issues/2354) for more info. +- See [Issue #2353](https://github.com/grafana/grafana/issues/2353) for more info. **Other new Features && Enhancements** - [Pull #2720](https://github.com/grafana/grafana/pull/2720). Admin: Initial basic quota support (per Org) diff --git a/Godeps/Godeps.json b/Godeps/Godeps.json index 104bff7d5f1..73c38fffec0 100644 --- a/Godeps/Godeps.json +++ b/Godeps/Godeps.json @@ -20,53 +20,63 @@ }, { "ImportPath": "github.com/aws/aws-sdk-go/aws", - "Comment": "v0.9.16-3-g4944a94", - "Rev": "4944a94a3b092d1dad8a964415700a70f55e580a" + "Comment": "v1.0.0", + "Rev": "abb928e07c4108683d6b4d0b6ca08fe6bc0eee5f" }, { "ImportPath": "github.com/aws/aws-sdk-go/private/endpoints", - "Comment": "v0.9.16-3-g4944a94", - "Rev": "4944a94a3b092d1dad8a964415700a70f55e580a" + "Comment": "v1.0.0", + "Rev": "abb928e07c4108683d6b4d0b6ca08fe6bc0eee5f" }, { "ImportPath": "github.com/aws/aws-sdk-go/private/protocol/ec2query", - "Comment": "v0.9.16-3-g4944a94", - "Rev": "4944a94a3b092d1dad8a964415700a70f55e580a" + "Comment": "v1.0.0", + "Rev": "abb928e07c4108683d6b4d0b6ca08fe6bc0eee5f" }, { "ImportPath": "github.com/aws/aws-sdk-go/private/protocol/query", - "Comment": "v0.9.16-3-g4944a94", - "Rev": "4944a94a3b092d1dad8a964415700a70f55e580a" + "Comment": "v1.0.0", + "Rev": "abb928e07c4108683d6b4d0b6ca08fe6bc0eee5f" }, { "ImportPath": "github.com/aws/aws-sdk-go/private/protocol/rest", - "Comment": "v0.9.16-3-g4944a94", - "Rev": "4944a94a3b092d1dad8a964415700a70f55e580a" + "Comment": "v1.0.0", + "Rev": "abb928e07c4108683d6b4d0b6ca08fe6bc0eee5f" }, { "ImportPath": "github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil", - "Comment": "v0.9.16-3-g4944a94", - "Rev": "4944a94a3b092d1dad8a964415700a70f55e580a" + "Comment": "v1.0.0", + "Rev": "abb928e07c4108683d6b4d0b6ca08fe6bc0eee5f" }, { "ImportPath": "github.com/aws/aws-sdk-go/private/signer/v4", - "Comment": "v0.9.16-3-g4944a94", - "Rev": "4944a94a3b092d1dad8a964415700a70f55e580a" + "Comment": "v1.0.0", + "Rev": "abb928e07c4108683d6b4d0b6ca08fe6bc0eee5f" + }, + { + "ImportPath": "github.com/aws/aws-sdk-go/private/waiter", + "Comment": "v1.0.0", + "Rev": "abb928e07c4108683d6b4d0b6ca08fe6bc0eee5f" }, { "ImportPath": "github.com/aws/aws-sdk-go/service/cloudwatch", - "Comment": "v0.9.16-3-g4944a94", - "Rev": "4944a94a3b092d1dad8a964415700a70f55e580a" + "Comment": "v1.0.0", + "Rev": "abb928e07c4108683d6b4d0b6ca08fe6bc0eee5f" }, { "ImportPath": "github.com/aws/aws-sdk-go/service/ec2", - "Comment": "v0.9.16-3-g4944a94", - "Rev": "4944a94a3b092d1dad8a964415700a70f55e580a" + "Comment": "v1.0.0", + "Rev": "abb928e07c4108683d6b4d0b6ca08fe6bc0eee5f" }, { "ImportPath": "github.com/davecgh/go-spew/spew", "Rev": "2df174808ee097f90d259e432cc04442cf60be21" }, + { + "ImportPath": "github.com/go-ini/ini", + "Comment": "v0-48-g060d7da", + "Rev": "060d7da055ba6ec5ea7a31f116332fe5efa04ce0" + }, { "ImportPath": "github.com/go-ldap/ldap", "Comment": "v1-19-g83e6542", @@ -90,6 +100,11 @@ "ImportPath": "github.com/gosimple/slug", "Rev": "8d258463b4459f161f51d6a357edacd3eef9d663" }, + { + "ImportPath": "github.com/jmespath/go-jmespath", + "Comment": "0.2.2", + "Rev": "3433f3ea46d9f8019119e7dd41274e112a2359a9" + }, { "ImportPath": "github.com/jtolds/gls", "Rev": "f1ac7f4f24f50328e6bc838ca4437d1612a0243c" @@ -124,10 +139,6 @@ "ImportPath": "github.com/streadway/amqp", "Rev": "150b7f24d6ad507e6026c13d85ce1f1391ac7400" }, - { - "ImportPath": "github.com/vaughan0/go-ini", - "Rev": "a98ad7ee00ec53921f08832bc06ecf7fd600e6a1" - }, { "ImportPath": "golang.org/x/net/context", "Rev": "972f0c5fbe4ae29e666c3f78c3ed42ae7a448b0a" diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/awsutil/copy.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/awsutil/copy.go index f91743c6e1d..8429470b9d7 100644 --- a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/awsutil/copy.go +++ b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/awsutil/copy.go @@ -57,16 +57,13 @@ func rcopy(dst, src reflect.Value, root bool) { } } case reflect.Struct: - if !root { - dst.Set(reflect.New(src.Type()).Elem()) - } - t := dst.Type() for i := 0; i < t.NumField(); i++ { name := t.Field(i).Name - srcval := src.FieldByName(name) - if srcval.IsValid() { - rcopy(dst.FieldByName(name), srcval, false) + srcVal := src.FieldByName(name) + dstVal := dst.FieldByName(name) + if srcVal.IsValid() && dstVal.CanSet() { + rcopy(dstVal, srcVal, false) } } case reflect.Slice: diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/awsutil/copy_test.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/awsutil/copy_test.go index 4f26241a2b8..84b7e3f34aa 100644 --- a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/awsutil/copy_test.go +++ b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/awsutil/copy_test.go @@ -77,6 +77,28 @@ func TestCopy(t *testing.T) { assert.NotEqual(t, f2.C, f1.C) } +func TestCopyNestedWithUnexported(t *testing.T) { + type Bar struct { + a int + B int + } + type Foo struct { + A string + B Bar + } + + f1 := &Foo{A: "string", B: Bar{a: 1, B: 2}} + + var f2 Foo + awsutil.Copy(&f2, f1) + + // Values match + assert.Equal(t, f2.A, f1.A) + assert.NotEqual(t, f2.B, f1.B) + assert.NotEqual(t, f2.B.a, f1.B.a) + assert.Equal(t, f2.B.B, f2.B.B) +} + func TestCopyIgnoreNilMembers(t *testing.T) { type Foo struct { A *string @@ -136,6 +158,8 @@ func TestCopyDifferentStructs(t *testing.T) { C map[string]*int SrcUnique string SameNameDiffType int + unexportedPtr *int + ExportedPtr *int } type DstFoo struct { A int @@ -143,6 +167,8 @@ func TestCopyDifferentStructs(t *testing.T) { C map[string]*int DstUnique int SameNameDiffType string + unexportedPtr *int + ExportedPtr *int } // Create the initial value @@ -159,6 +185,8 @@ func TestCopyDifferentStructs(t *testing.T) { }, SrcUnique: "unique", SameNameDiffType: 1, + unexportedPtr: &int1, + ExportedPtr: &int2, } // Do the copy @@ -173,6 +201,10 @@ func TestCopyDifferentStructs(t *testing.T) { assert.Equal(t, 1, f1.SameNameDiffType) assert.Equal(t, 0, f2.DstUnique) assert.Equal(t, "", f2.SameNameDiffType) + assert.Equal(t, int1, *f1.unexportedPtr) + assert.Nil(t, f2.unexportedPtr) + assert.Equal(t, int2, *f1.ExportedPtr) + assert.Equal(t, int2, *f2.ExportedPtr) } func ExampleCopyOf() { diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/awsutil/equal.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/awsutil/equal.go new file mode 100644 index 00000000000..59fa4a558a9 --- /dev/null +++ b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/awsutil/equal.go @@ -0,0 +1,27 @@ +package awsutil + +import ( + "reflect" +) + +// DeepEqual returns if the two values are deeply equal like reflect.DeepEqual. +// In addition to this, this method will also dereference the input values if +// possible so the DeepEqual performed will not fail if one parameter is a +// pointer and the other is not. +// +// DeepEqual will not perform indirection of nested values of the input parameters. +func DeepEqual(a, b interface{}) bool { + ra := reflect.Indirect(reflect.ValueOf(a)) + rb := reflect.Indirect(reflect.ValueOf(b)) + + if raValid, rbValid := ra.IsValid(), rb.IsValid(); !raValid && !rbValid { + // If the elements are both nil, and of the same type the are equal + // If they are of different types they are not equal + return reflect.TypeOf(a) == reflect.TypeOf(b) + } else if raValid != rbValid { + // Both values must be valid to be equal + return false + } + + return reflect.DeepEqual(ra.Interface(), rb.Interface()) +} diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/awsutil/equal_test.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/awsutil/equal_test.go new file mode 100644 index 00000000000..7a5db6e49bc --- /dev/null +++ b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/awsutil/equal_test.go @@ -0,0 +1,29 @@ +package awsutil_test + +import ( + "testing" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/awsutil" + "github.com/stretchr/testify/assert" +) + +func TestDeepEqual(t *testing.T) { + cases := []struct { + a, b interface{} + equal bool + }{ + {"a", "a", true}, + {"a", "b", false}, + {"a", aws.String(""), false}, + {"a", nil, false}, + {"a", aws.String("a"), true}, + {(*bool)(nil), (*bool)(nil), true}, + {(*bool)(nil), (*string)(nil), false}, + {nil, nil, true}, + } + + for i, c := range cases { + assert.Equal(t, c.equal, awsutil.DeepEqual(c.a, c.b), "%d, a:%v b:%v, %t", i, c.a, c.b, c.equal) + } +} diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/awsutil/path_value.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/awsutil/path_value.go index 905d82385ec..4d2a01e8c41 100644 --- a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/awsutil/path_value.go +++ b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/awsutil/path_value.go @@ -5,18 +5,20 @@ import ( "regexp" "strconv" "strings" + + "github.com/jmespath/go-jmespath" ) var indexRe = regexp.MustCompile(`(.+)\[(-?\d+)?\]$`) // rValuesAtPath returns a slice of values found in value v. The values // in v are explored recursively so all nested values are collected. -func rValuesAtPath(v interface{}, path string, create bool, caseSensitive bool) []reflect.Value { +func rValuesAtPath(v interface{}, path string, createPath, caseSensitive, nilTerm bool) []reflect.Value { pathparts := strings.Split(path, "||") if len(pathparts) > 1 { for _, pathpart := range pathparts { - vals := rValuesAtPath(v, pathpart, create, caseSensitive) - if vals != nil && len(vals) > 0 { + vals := rValuesAtPath(v, pathpart, createPath, caseSensitive, nilTerm) + if len(vals) > 0 { return vals } } @@ -74,7 +76,16 @@ func rValuesAtPath(v interface{}, path string, create bool, caseSensitive bool) return false }) - if create && value.Kind() == reflect.Ptr && value.IsNil() { + if nilTerm && value.Kind() == reflect.Ptr && len(components[1:]) == 0 { + if !value.IsNil() { + value.Set(reflect.Zero(value.Type())) + } + return []reflect.Value{value} + } + + if createPath && value.Kind() == reflect.Ptr && value.IsNil() { + // TODO if the value is the terminus it should not be created + // if the value to be set to its position is nil. value.Set(reflect.New(value.Type().Elem())) value = value.Elem() } else { @@ -82,7 +93,7 @@ func rValuesAtPath(v interface{}, path string, create bool, caseSensitive bool) } if value.Kind() == reflect.Slice || value.Kind() == reflect.Map { - if !create && value.IsNil() { + if !createPath && value.IsNil() { value = reflect.ValueOf(nil) } } @@ -114,7 +125,7 @@ func rValuesAtPath(v interface{}, path string, create bool, caseSensitive bool) // pull out index i := int(*index) if i >= value.Len() { // check out of bounds - if create { + if createPath { // TODO resize slice } else { continue @@ -125,7 +136,7 @@ func rValuesAtPath(v interface{}, path string, create bool, caseSensitive bool) value = reflect.Indirect(value.Index(i)) if value.Kind() == reflect.Slice || value.Kind() == reflect.Map { - if !create && value.IsNil() { + if !createPath && value.IsNil() { value = reflect.ValueOf(nil) } } @@ -142,46 +153,70 @@ func rValuesAtPath(v interface{}, path string, create bool, caseSensitive bool) return values } -// ValuesAtPath returns a list of objects at the lexical path inside of a structure -func ValuesAtPath(i interface{}, path string) []interface{} { - if rvals := rValuesAtPath(i, path, false, true); rvals != nil { - vals := make([]interface{}, len(rvals)) - for i, rval := range rvals { - vals[i] = rval.Interface() - } - return vals +// ValuesAtPath returns a list of values at the case insensitive lexical +// path inside of a structure. +func ValuesAtPath(i interface{}, path string) ([]interface{}, error) { + result, err := jmespath.Search(path, i) + if err != nil { + return nil, err } - return nil + + v := reflect.ValueOf(result) + if !v.IsValid() || (v.Kind() == reflect.Ptr && v.IsNil()) { + return nil, nil + } + if s, ok := result.([]interface{}); ok { + return s, err + } + if v.Kind() == reflect.Map && v.Len() == 0 { + return nil, nil + } + if v.Kind() == reflect.Slice { + out := make([]interface{}, v.Len()) + for i := 0; i < v.Len(); i++ { + out[i] = v.Index(i).Interface() + } + return out, nil + } + + return []interface{}{result}, nil } -// ValuesAtAnyPath returns a list of objects at the case-insensitive lexical -// path inside of a structure -func ValuesAtAnyPath(i interface{}, path string) []interface{} { - if rvals := rValuesAtPath(i, path, false, false); rvals != nil { - vals := make([]interface{}, len(rvals)) - for i, rval := range rvals { - vals[i] = rval.Interface() - } - return vals - } - return nil -} - -// SetValueAtPath sets an object at the lexical path inside of a structure +// SetValueAtPath sets a value at the case insensitive lexical path inside +// of a structure. func SetValueAtPath(i interface{}, path string, v interface{}) { - if rvals := rValuesAtPath(i, path, true, true); rvals != nil { + if rvals := rValuesAtPath(i, path, true, false, v == nil); rvals != nil { for _, rval := range rvals { - rval.Set(reflect.ValueOf(v)) + if rval.Kind() == reflect.Ptr && rval.IsNil() { + continue + } + setValue(rval, v) } } } -// SetValueAtAnyPath sets an object at the case insensitive lexical path inside -// of a structure -func SetValueAtAnyPath(i interface{}, path string, v interface{}) { - if rvals := rValuesAtPath(i, path, true, false); rvals != nil { - for _, rval := range rvals { - rval.Set(reflect.ValueOf(v)) - } +func setValue(dstVal reflect.Value, src interface{}) { + if dstVal.Kind() == reflect.Ptr { + dstVal = reflect.Indirect(dstVal) } + srcVal := reflect.ValueOf(src) + + if !srcVal.IsValid() { // src is literal nil + if dstVal.CanAddr() { + // Convert to pointer so that pointer's value can be nil'ed + // dstVal = dstVal.Addr() + } + dstVal.Set(reflect.Zero(dstVal.Type())) + + } else if srcVal.Kind() == reflect.Ptr { + if srcVal.IsNil() { + srcVal = reflect.Zero(dstVal.Type()) + } else { + srcVal = reflect.ValueOf(src).Elem() + } + dstVal.Set(srcVal) + } else { + dstVal.Set(srcVal) + } + } diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/awsutil/path_value_test.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/awsutil/path_value_test.go index 0da6b06fddc..b2225566fa3 100644 --- a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/awsutil/path_value_test.go +++ b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/awsutil/path_value_test.go @@ -13,6 +13,7 @@ type Struct struct { B *Struct D *Struct C string + E map[string]string } var data = Struct{ @@ -21,30 +22,69 @@ var data = Struct{ B: &Struct{B: &Struct{C: "terminal"}, D: &Struct{C: "terminal2"}}, C: "initial", } +var data2 = Struct{A: []Struct{ + {A: []Struct{{C: "1"}, {C: "1"}, {C: "1"}, {C: "1"}, {C: "1"}}}, + {A: []Struct{{C: "2"}, {C: "2"}, {C: "2"}, {C: "2"}, {C: "2"}}}, +}} func TestValueAtPathSuccess(t *testing.T) { - assert.Equal(t, []interface{}{"initial"}, awsutil.ValuesAtPath(data, "C")) - assert.Equal(t, []interface{}{"value1"}, awsutil.ValuesAtPath(data, "A[0].C")) - assert.Equal(t, []interface{}{"value2"}, awsutil.ValuesAtPath(data, "A[1].C")) - assert.Equal(t, []interface{}{"value3"}, awsutil.ValuesAtPath(data, "A[2].C")) - assert.Equal(t, []interface{}{"value3"}, awsutil.ValuesAtAnyPath(data, "a[2].c")) - assert.Equal(t, []interface{}{"value3"}, awsutil.ValuesAtPath(data, "A[-1].C")) - assert.Equal(t, []interface{}{"value1", "value2", "value3"}, awsutil.ValuesAtPath(data, "A[].C")) - assert.Equal(t, []interface{}{"terminal"}, awsutil.ValuesAtPath(data, "B . B . C")) - assert.Equal(t, []interface{}{"terminal", "terminal2"}, awsutil.ValuesAtPath(data, "B.*.C")) - assert.Equal(t, []interface{}{"initial"}, awsutil.ValuesAtPath(data, "A.D.X || C")) + var testCases = []struct { + expect []interface{} + data interface{} + path string + }{ + {[]interface{}{"initial"}, data, "C"}, + {[]interface{}{"value1"}, data, "A[0].C"}, + {[]interface{}{"value2"}, data, "A[1].C"}, + {[]interface{}{"value3"}, data, "A[2].C"}, + {[]interface{}{"value3"}, data, "a[2].c"}, + {[]interface{}{"value3"}, data, "A[-1].C"}, + {[]interface{}{"value1", "value2", "value3"}, data, "A[].C"}, + {[]interface{}{"terminal"}, data, "B . B . C"}, + {[]interface{}{"initial"}, data, "A.D.X || C"}, + {[]interface{}{"initial"}, data, "A[0].B || C"}, + {[]interface{}{ + Struct{A: []Struct{{C: "1"}, {C: "1"}, {C: "1"}, {C: "1"}, {C: "1"}}}, + Struct{A: []Struct{{C: "2"}, {C: "2"}, {C: "2"}, {C: "2"}, {C: "2"}}}, + }, data2, "A"}, + } + for i, c := range testCases { + v, err := awsutil.ValuesAtPath(c.data, c.path) + assert.NoError(t, err, "case %d, expected no error, %s", i, c.path) + assert.Equal(t, c.expect, v, "case %d, %s", i, c.path) + } } func TestValueAtPathFailure(t *testing.T) { - assert.Equal(t, []interface{}(nil), awsutil.ValuesAtPath(data, "C.x")) - assert.Equal(t, []interface{}(nil), awsutil.ValuesAtPath(data, ".x")) - assert.Equal(t, []interface{}{}, awsutil.ValuesAtPath(data, "X.Y.Z")) - assert.Equal(t, []interface{}{}, awsutil.ValuesAtPath(data, "A[100].C")) - assert.Equal(t, []interface{}{}, awsutil.ValuesAtPath(data, "A[3].C")) - assert.Equal(t, []interface{}{}, awsutil.ValuesAtPath(data, "B.B.C.Z")) - assert.Equal(t, []interface{}(nil), awsutil.ValuesAtPath(data, "z[-1].C")) - assert.Equal(t, []interface{}{}, awsutil.ValuesAtPath(nil, "A.B.C")) - assert.Equal(t, []interface{}{}, awsutil.ValuesAtPath(Struct{}, "A")) + var testCases = []struct { + expect []interface{} + errContains string + data interface{} + path string + }{ + {nil, "", data, "C.x"}, + {nil, "SyntaxError: Invalid token: tDot", data, ".x"}, + {nil, "", data, "X.Y.Z"}, + {nil, "", data, "A[100].C"}, + {nil, "", data, "A[3].C"}, + {nil, "", data, "B.B.C.Z"}, + {nil, "", data, "z[-1].C"}, + {nil, "", nil, "A.B.C"}, + {[]interface{}{}, "", Struct{}, "A"}, + {nil, "", data, "A[0].B.C"}, + {nil, "", data, "D"}, + } + + for i, c := range testCases { + v, err := awsutil.ValuesAtPath(c.data, c.path) + if c.errContains != "" { + assert.Contains(t, err.Error(), c.errContains, "case %d, expected error, %s", i, c.path) + continue + } else { + assert.NoError(t, err, "case %d, expected no error, %s", i, c.path) + } + assert.Equal(t, c.expect, v, "case %d, %s", i, c.path) + } } func TestSetValueAtPathSuccess(t *testing.T) { @@ -61,8 +101,42 @@ func TestSetValueAtPathSuccess(t *testing.T) { assert.Equal(t, "test0", s.B.D.C) var s2 Struct - awsutil.SetValueAtAnyPath(&s2, "b.b.c", "test0") + awsutil.SetValueAtPath(&s2, "b.b.c", "test0") assert.Equal(t, "test0", s2.B.B.C) - awsutil.SetValueAtAnyPath(&s2, "A", []Struct{{}}) + awsutil.SetValueAtPath(&s2, "A", []Struct{{}}) assert.Equal(t, []Struct{{}}, s2.A) + + str := "foo" + + s3 := Struct{} + awsutil.SetValueAtPath(&s3, "b.b.c", str) + assert.Equal(t, "foo", s3.B.B.C) + + s3 = Struct{B: &Struct{B: &Struct{C: str}}} + awsutil.SetValueAtPath(&s3, "b.b.c", nil) + assert.Equal(t, "", s3.B.B.C) + + s3 = Struct{} + awsutil.SetValueAtPath(&s3, "b.b.c", nil) + assert.Equal(t, "", s3.B.B.C) + + s3 = Struct{} + awsutil.SetValueAtPath(&s3, "b.b.c", &str) + assert.Equal(t, "foo", s3.B.B.C) + + var s4 struct{ Name *string } + awsutil.SetValueAtPath(&s4, "Name", str) + assert.Equal(t, str, *s4.Name) + + s4 = struct{ Name *string }{} + awsutil.SetValueAtPath(&s4, "Name", nil) + assert.Equal(t, (*string)(nil), s4.Name) + + s4 = struct{ Name *string }{Name: &str} + awsutil.SetValueAtPath(&s4, "Name", nil) + assert.Equal(t, (*string)(nil), s4.Name) + + s4 = struct{ Name *string }{} + awsutil.SetValueAtPath(&s4, "Name", &str) + assert.Equal(t, str, *s4.Name) } diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/awsutil/string_value.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/awsutil/string_value.go new file mode 100644 index 00000000000..b6432f1a118 --- /dev/null +++ b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/awsutil/string_value.go @@ -0,0 +1,89 @@ +package awsutil + +import ( + "bytes" + "fmt" + "reflect" + "strings" +) + +// StringValue returns the string representation of a value. +func StringValue(i interface{}) string { + var buf bytes.Buffer + stringValue(reflect.ValueOf(i), 0, &buf) + return buf.String() +} + +func stringValue(v reflect.Value, indent int, buf *bytes.Buffer) { + for v.Kind() == reflect.Ptr { + v = v.Elem() + } + + switch v.Kind() { + case reflect.Struct: + buf.WriteString("{\n") + + names := []string{} + for i := 0; i < v.Type().NumField(); i++ { + name := v.Type().Field(i).Name + f := v.Field(i) + if name[0:1] == strings.ToLower(name[0:1]) { + continue // ignore unexported fields + } + if (f.Kind() == reflect.Ptr || f.Kind() == reflect.Slice) && f.IsNil() { + continue // ignore unset fields + } + names = append(names, name) + } + + for i, n := range names { + val := v.FieldByName(n) + buf.WriteString(strings.Repeat(" ", indent+2)) + buf.WriteString(n + ": ") + stringValue(val, indent+2, buf) + + if i < len(names)-1 { + buf.WriteString(",\n") + } + } + + buf.WriteString("\n" + strings.Repeat(" ", indent) + "}") + case reflect.Slice: + nl, id, id2 := "", "", "" + if v.Len() > 3 { + nl, id, id2 = "\n", strings.Repeat(" ", indent), strings.Repeat(" ", indent+2) + } + buf.WriteString("[" + nl) + for i := 0; i < v.Len(); i++ { + buf.WriteString(id2) + stringValue(v.Index(i), indent+2, buf) + + if i < v.Len()-1 { + buf.WriteString("," + nl) + } + } + + buf.WriteString(nl + id + "]") + case reflect.Map: + buf.WriteString("{\n") + + for i, k := range v.MapKeys() { + buf.WriteString(strings.Repeat(" ", indent+2)) + buf.WriteString(k.String() + ": ") + stringValue(v.MapIndex(k), indent+2, buf) + + if i < v.Len()-1 { + buf.WriteString(",\n") + } + } + + buf.WriteString("\n" + strings.Repeat(" ", indent) + "}") + default: + format := "%v" + switch v.Interface().(type) { + case string: + format = "%q" + } + fmt.Fprintf(buf, format, v.Interface()) + } +} diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/client/client.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/client/client.go new file mode 100644 index 00000000000..e639ce040d7 --- /dev/null +++ b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/client/client.go @@ -0,0 +1,120 @@ +package client + +import ( + "fmt" + "io/ioutil" + "net/http/httputil" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/client/metadata" + "github.com/aws/aws-sdk-go/aws/request" +) + +// A Config provides configuration to a service client instance. +type Config struct { + Config *aws.Config + Handlers request.Handlers + Endpoint, SigningRegion string +} + +// ConfigProvider provides a generic way for a service client to receive +// the ClientConfig without circular dependencies. +type ConfigProvider interface { + ClientConfig(serviceName string, cfgs ...*aws.Config) Config +} + +// A Client implements the base client request and response handling +// used by all service clients. +type Client struct { + request.Retryer + metadata.ClientInfo + + Config aws.Config + Handlers request.Handlers +} + +// New will return a pointer to a new initialized service client. +func New(cfg aws.Config, info metadata.ClientInfo, handlers request.Handlers, options ...func(*Client)) *Client { + svc := &Client{ + Config: cfg, + ClientInfo: info, + Handlers: handlers, + } + + switch retryer, ok := cfg.Retryer.(request.Retryer); { + case ok: + svc.Retryer = retryer + case cfg.Retryer != nil && cfg.Logger != nil: + s := fmt.Sprintf("WARNING: %T does not implement request.Retryer; using DefaultRetryer instead", cfg.Retryer) + cfg.Logger.Log(s) + fallthrough + default: + maxRetries := aws.IntValue(cfg.MaxRetries) + if cfg.MaxRetries == nil || maxRetries == aws.UseServiceDefaultRetries { + maxRetries = 3 + } + svc.Retryer = DefaultRetryer{NumMaxRetries: maxRetries} + } + + svc.AddDebugHandlers() + + for _, option := range options { + option(svc) + } + + return svc +} + +// NewRequest returns a new Request pointer for the service API +// operation and parameters. +func (c *Client) NewRequest(operation *request.Operation, params interface{}, data interface{}) *request.Request { + return request.New(c.Config, c.ClientInfo, c.Handlers, c.Retryer, operation, params, data) +} + +// AddDebugHandlers injects debug logging handlers into the service to log request +// debug information. +func (c *Client) AddDebugHandlers() { + if !c.Config.LogLevel.AtLeast(aws.LogDebug) { + return + } + + c.Handlers.Send.PushFront(logRequest) + c.Handlers.Send.PushBack(logResponse) +} + +const logReqMsg = `DEBUG: Request %s/%s Details: +---[ REQUEST POST-SIGN ]----------------------------- +%s +-----------------------------------------------------` + +func logRequest(r *request.Request) { + logBody := r.Config.LogLevel.Matches(aws.LogDebugWithHTTPBody) + dumpedBody, _ := httputil.DumpRequestOut(r.HTTPRequest, logBody) + + if logBody { + // Reset the request body because dumpRequest will re-wrap the r.HTTPRequest's + // Body as a NoOpCloser and will not be reset after read by the HTTP + // client reader. + r.Body.Seek(r.BodyStart, 0) + r.HTTPRequest.Body = ioutil.NopCloser(r.Body) + } + + r.Config.Logger.Log(fmt.Sprintf(logReqMsg, r.ClientInfo.ServiceName, r.Operation.Name, string(dumpedBody))) +} + +const logRespMsg = `DEBUG: Response %s/%s Details: +---[ RESPONSE ]-------------------------------------- +%s +-----------------------------------------------------` + +func logResponse(r *request.Request) { + var msg = "no reponse data" + if r.HTTPResponse != nil { + logBody := r.Config.LogLevel.Matches(aws.LogDebugWithHTTPBody) + dumpedBody, _ := httputil.DumpResponse(r.HTTPResponse, logBody) + msg = string(dumpedBody) + } else if r.Error != nil { + msg = r.Error.Error() + } + r.Config.Logger.Log(fmt.Sprintf(logRespMsg, r.ClientInfo.ServiceName, r.Operation.Name, msg)) +} diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/service/default_retryer.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/client/default_retryer.go similarity index 83% rename from Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/service/default_retryer.go rename to Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/client/default_retryer.go index c3dd0fa35a1..24d39ce5641 100644 --- a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/service/default_retryer.go +++ b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/client/default_retryer.go @@ -1,11 +1,10 @@ -package service +package client import ( "math" "math/rand" "time" - "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/request" ) @@ -22,16 +21,13 @@ import ( // // This implementation always has 100 max retries // func (d retryer) MaxRetries() uint { return 100 } type DefaultRetryer struct { - *Service + NumMaxRetries int } // MaxRetries returns the number of maximum returns the service will use to make // an individual API request. -func (d DefaultRetryer) MaxRetries() uint { - if aws.IntValue(d.Service.Config.MaxRetries) < 0 { - return d.DefaultMaxRetries - } - return uint(aws.IntValue(d.Service.Config.MaxRetries)) +func (d DefaultRetryer) MaxRetries() int { + return d.NumMaxRetries } // RetryRules returns the delay duration before retrying this request again diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/client/metadata/client_info.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/client/metadata/client_info.go new file mode 100644 index 00000000000..4778056ddfd --- /dev/null +++ b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/client/metadata/client_info.go @@ -0,0 +1,12 @@ +package metadata + +// ClientInfo wraps immutable data from the client.Client structure. +type ClientInfo struct { + ServiceName string + APIVersion string + Endpoint string + SigningName string + SigningRegion string + JSONVersion string + TargetPrefix string +} diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/config.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/config.go index cd2aade289f..75fcc8284b9 100644 --- a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/config.go +++ b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/config.go @@ -7,15 +7,20 @@ import ( "github.com/aws/aws-sdk-go/aws/credentials" ) -// DefaultRetries is the default number of retries for a service. The value of -// -1 indicates that the service specific retry default will be used. -const DefaultRetries = -1 +// UseServiceDefaultRetries instructs the config to use the service's own default +// number of retries. This will be the default action if Config.MaxRetries +// is nil also. +const UseServiceDefaultRetries = -1 + +// RequestRetryer is an alias for a type that implements the request.Retryer interface. +type RequestRetryer interface{} // A Config provides service configuration for service clients. By default, // all clients will use the {defaults.DefaultConfig} structure. type Config struct { // The credentials object to use when signing requests. Defaults to - // {defaults.DefaultChainCredentials}. + // a chain of credential providers to search for credentials in environment + // variables, shared credential file, and EC2 Instance Roles. Credentials *credentials.Credentials // An optional endpoint URL (hostname only or fully qualified URI) @@ -57,6 +62,21 @@ type Config struct { // configuration. MaxRetries *int + // Retryer guides how HTTP requests should be retried in case of recoverable failures. + // + // When nil or the value does not implement the request.Retryer interface, + // the request.DefaultRetryer will be used. + // + // When both Retryer and MaxRetries are non-nil, the former is used and + // the latter ignored. + // + // To set the Retryer field in a type-safe manner and with chaining, use + // the request.WithRetryer helper function: + // + // cfg := request.WithRetryer(aws.NewConfig(), myRetryer) + // + Retryer RequestRetryer + // Disables semantic parameter validation, which validates input for missing // required fields and/or other semantic request input errors. DisableParamValidation *bool @@ -171,15 +191,17 @@ func (c *Config) WithSleepDelay(fn func(time.Duration)) *Config { return c } -// Merge returns a new Config with the other Config's attribute values merged into -// this Config. If the other Config's attribute is nil it will not be merged into -// the new Config to be returned. -func (c Config) Merge(other *Config) *Config { - if other == nil { - return &c +// MergeIn merges the passed in configs into the existing config object. +func (c *Config) MergeIn(cfgs ...*Config) { + for _, other := range cfgs { + mergeInConfig(c, other) } +} - dst := c +func mergeInConfig(dst *Config, other *Config) { + if other == nil { + return + } if other.Credentials != nil { dst.Credentials = other.Credentials @@ -213,6 +235,10 @@ func (c Config) Merge(other *Config) *Config { dst.MaxRetries = other.MaxRetries } + if other.Retryer != nil { + dst.Retryer = other.Retryer + } + if other.DisableParamValidation != nil { dst.DisableParamValidation = other.DisableParamValidation } @@ -228,12 +254,17 @@ func (c Config) Merge(other *Config) *Config { if other.SleepDelay != nil { dst.SleepDelay = other.SleepDelay } - - return &dst } -// Copy will return a shallow copy of the Config object. -func (c Config) Copy() *Config { - dst := c - return &dst +// Copy will return a shallow copy of the Config object. If any additional +// configurations are provided they will be merged into the new config returned. +func (c *Config) Copy(cfgs ...*Config) *Config { + dst := &Config{} + dst.MergeIn(c) + + for _, cfg := range cfgs { + dst.MergeIn(cfg) + } + + return dst } diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/config_test.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/config_test.go index c4320ca1ede..fe97a31fc76 100644 --- a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/config_test.go +++ b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/config_test.go @@ -18,7 +18,7 @@ var copyTestConfig = Config{ HTTPClient: http.DefaultClient, LogLevel: LogLevel(LogDebug), Logger: NewDefaultLogger(), - MaxRetries: Int(DefaultRetries), + MaxRetries: Int(3), DisableParamValidation: Bool(true), DisableComputeChecksums: Bool(true), S3ForcePathStyle: Bool(true), @@ -31,6 +31,11 @@ func TestCopy(t *testing.T) { t.Errorf("Copy() = %+v", got) t.Errorf(" want %+v", want) } + + got.Region = String("other") + if got.Region == want.Region { + t.Errorf("Expect setting copy values not not reflect in source") + } } func TestCopyReturnsNewInstance(t *testing.T) { @@ -69,7 +74,8 @@ var mergeTests = []struct { func TestMerge(t *testing.T) { for i, tt := range mergeTests { - got := tt.cfg.Merge(tt.in) + got := tt.cfg.Copy() + got.MergeIn(tt.in) if !reflect.DeepEqual(got, tt.want) { t.Errorf("Config %d %+v", i, tt.cfg) t.Errorf(" Merge(%+v)", tt.in) diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/corehandlers/handlers.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/corehandlers/handlers.go index 597feb4fa44..1d3e656fd68 100644 --- a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/corehandlers/handlers.go +++ b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/corehandlers/handlers.go @@ -8,6 +8,7 @@ import ( "net/http" "net/url" "regexp" + "runtime" "strconv" "github.com/aws/aws-sdk-go/aws" @@ -23,7 +24,7 @@ type lener interface { // BuildContentLengthHandler builds the content length of a request based on the body, // or will use the HTTPRequest.Header's "Content-Length" if defined. If unable // to determine request body length and no "Content-Length" was specified it will panic. -var BuildContentLengthHandler = request.NamedHandler{"core.BuildContentLengthHandler", func(r *request.Request) { +var BuildContentLengthHandler = request.NamedHandler{Name: "core.BuildContentLengthHandler", Fn: func(r *request.Request) { if slength := r.HTTPRequest.Header.Get("Content-Length"); slength != "" { length, _ := strconv.ParseInt(slength, 10, 64) r.HTTPRequest.ContentLength = length @@ -49,17 +50,19 @@ var BuildContentLengthHandler = request.NamedHandler{"core.BuildContentLengthHan r.HTTPRequest.Header.Set("Content-Length", fmt.Sprintf("%d", length)) }} -// UserAgentHandler is a request handler for injecting User agent into requests. -var UserAgentHandler = request.NamedHandler{"core.UserAgentHandler", func(r *request.Request) { - r.HTTPRequest.Header.Set("User-Agent", aws.SDKName+"/"+aws.SDKVersion) -}} +// SDKVersionUserAgentHandler is a request handler for adding the SDK Version to the user agent. +var SDKVersionUserAgentHandler = request.NamedHandler{ + Name: "core.SDKVersionUserAgentHandler", + Fn: request.MakeAddToUserAgentHandler(aws.SDKName, aws.SDKVersion, + runtime.Version(), runtime.GOOS, runtime.GOARCH), +} var reStatusCode = regexp.MustCompile(`^(\d{3})`) // SendHandler is a request handler to send service request using HTTP client. -var SendHandler = request.NamedHandler{"core.SendHandler", func(r *request.Request) { +var SendHandler = request.NamedHandler{Name: "core.SendHandler", Fn: func(r *request.Request) { var err error - r.HTTPResponse, err = r.Service.Config.HTTPClient.Do(r.HTTPRequest) + r.HTTPResponse, err = r.Config.HTTPClient.Do(r.HTTPRequest) if err != nil { // Capture the case where url.Error is returned for error processing // response. e.g. 301 without location header comes back as string @@ -92,7 +95,7 @@ var SendHandler = request.NamedHandler{"core.SendHandler", func(r *request.Reque }} // ValidateResponseHandler is a request handler to validate service response. -var ValidateResponseHandler = request.NamedHandler{"core.ValidateResponseHandler", func(r *request.Request) { +var ValidateResponseHandler = request.NamedHandler{Name: "core.ValidateResponseHandler", Fn: func(r *request.Request) { if r.HTTPResponse.StatusCode == 0 || r.HTTPResponse.StatusCode >= 300 { // this may be replaced by an UnmarshalError handler r.Error = awserr.New("UnknownError", "unknown error", nil) @@ -101,7 +104,7 @@ var ValidateResponseHandler = request.NamedHandler{"core.ValidateResponseHandler // AfterRetryHandler performs final checks to determine if the request should // be retried and how long to delay. -var AfterRetryHandler = request.NamedHandler{"core.AfterRetryHandler", func(r *request.Request) { +var AfterRetryHandler = request.NamedHandler{Name: "core.AfterRetryHandler", Fn: func(r *request.Request) { // If one of the other handlers already set the retry state // we don't want to override it based on the service's state if r.Retryable == nil { @@ -110,13 +113,13 @@ var AfterRetryHandler = request.NamedHandler{"core.AfterRetryHandler", func(r *r if r.WillRetry() { r.RetryDelay = r.RetryRules(r) - r.Service.Config.SleepDelay(r.RetryDelay) + r.Config.SleepDelay(r.RetryDelay) // when the expired token exception occurs the credentials // need to be expired locally so that the next request to // get credentials will trigger a credentials refresh. if r.IsErrorExpired() { - r.Service.Config.Credentials.Expire() + r.Config.Credentials.Expire() } r.RetryCount++ @@ -127,10 +130,10 @@ var AfterRetryHandler = request.NamedHandler{"core.AfterRetryHandler", func(r *r // ValidateEndpointHandler is a request handler to validate a request had the // appropriate Region and Endpoint set. Will set r.Error if the endpoint or // region is not valid. -var ValidateEndpointHandler = request.NamedHandler{"core.ValidateEndpointHandler", func(r *request.Request) { - if r.Service.SigningRegion == "" && aws.StringValue(r.Service.Config.Region) == "" { +var ValidateEndpointHandler = request.NamedHandler{Name: "core.ValidateEndpointHandler", Fn: func(r *request.Request) { + if r.ClientInfo.SigningRegion == "" && aws.StringValue(r.Config.Region) == "" { r.Error = aws.ErrMissingRegion - } else if r.Service.Endpoint == "" { + } else if r.ClientInfo.Endpoint == "" { r.Error = aws.ErrMissingEndpoint } }} diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/corehandlers/handlers_test.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/corehandlers/handlers_test.go index 214adcab088..632ea8d4ea1 100644 --- a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/corehandlers/handlers_test.go +++ b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/corehandlers/handlers_test.go @@ -13,12 +13,13 @@ import ( "github.com/aws/aws-sdk-go/aws/corehandlers" "github.com/aws/aws-sdk-go/aws/credentials" "github.com/aws/aws-sdk-go/aws/request" - "github.com/aws/aws-sdk-go/aws/service" + "github.com/aws/aws-sdk-go/awstesting" ) func TestValidateEndpointHandler(t *testing.T) { os.Clearenv() - svc := service.New(aws.NewConfig().WithRegion("us-west-2")) + + svc := awstesting.NewClient(aws.NewConfig().WithRegion("us-west-2")) svc.Handlers.Clear() svc.Handlers.Validate.PushBackNamed(corehandlers.ValidateEndpointHandler) @@ -30,7 +31,8 @@ func TestValidateEndpointHandler(t *testing.T) { func TestValidateEndpointHandlerErrorRegion(t *testing.T) { os.Clearenv() - svc := service.New(nil) + + svc := awstesting.NewClient() svc.Handlers.Clear() svc.Handlers.Validate.PushBackNamed(corehandlers.ValidateEndpointHandler) @@ -58,7 +60,11 @@ func (m *mockCredsProvider) IsExpired() bool { func TestAfterRetryRefreshCreds(t *testing.T) { os.Clearenv() credProvider := &mockCredsProvider{} - svc := service.New(&aws.Config{Credentials: credentials.NewCredentials(credProvider), MaxRetries: aws.Int(1)}) + + svc := awstesting.NewClient(&aws.Config{ + Credentials: credentials.NewCredentials(credProvider), + MaxRetries: aws.Int(1), + }) svc.Handlers.Clear() svc.Handlers.ValidateResponse.PushBack(func(r *request.Request) { @@ -91,7 +97,7 @@ func (t *testSendHandlerTransport) RoundTrip(r *http.Request) (*http.Response, e } func TestSendHandlerError(t *testing.T) { - svc := service.New(&aws.Config{ + svc := awstesting.NewClient(&aws.Config{ HTTPClient: &http.Client{ Transport: &testSendHandlerTransport{}, }, diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/corehandlers/param_validator.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/corehandlers/param_validator.go index c70d422dfb0..3b53f5e026a 100644 --- a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/corehandlers/param_validator.go +++ b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/corehandlers/param_validator.go @@ -12,7 +12,7 @@ import ( // ValidateParametersHandler is a request handler to validate the input parameters. // Validating parameters only has meaning if done prior to the request being sent. -var ValidateParametersHandler = request.NamedHandler{"core.ValidateParametersHandler", func(r *request.Request) { +var ValidateParametersHandler = request.NamedHandler{Name: "core.ValidateParametersHandler", Fn: func(r *request.Request) { if r.ParamsFilled() { v := validator{errors: []string{}} v.validateAny(reflect.ValueOf(r.Params), "") diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/corehandlers/param_validator_test.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/corehandlers/param_validator_test.go index db483ba408b..96bfc0e6720 100644 --- a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/corehandlers/param_validator_test.go +++ b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/corehandlers/param_validator_test.go @@ -7,17 +7,17 @@ import ( "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/awserr" + "github.com/aws/aws-sdk-go/aws/client" + "github.com/aws/aws-sdk-go/aws/client/metadata" "github.com/aws/aws-sdk-go/aws/corehandlers" "github.com/aws/aws-sdk-go/aws/request" - "github.com/aws/aws-sdk-go/aws/service" - "github.com/aws/aws-sdk-go/aws/service/serviceinfo" "github.com/stretchr/testify/require" ) -var testSvc = func() *service.Service { - s := &service.Service{ - ServiceInfo: serviceinfo.ServiceInfo{ - Config: &aws.Config{}, +var testSvc = func() *client.Client { + s := &client.Client{ + Config: aws.Config{}, + ClientInfo: metadata.ClientInfo{ ServiceName: "mock-service", APIVersion: "2015-01-01", }, diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/credentials/ec2rolecreds/ec2_role_provider.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/credentials/ec2rolecreds/ec2_role_provider.go index 946a117206e..80702c26f9c 100644 --- a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/credentials/ec2rolecreds/ec2_role_provider.go +++ b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/credentials/ec2rolecreds/ec2_role_provider.go @@ -9,6 +9,7 @@ import ( "time" "github.com/aws/aws-sdk-go/aws/awserr" + "github.com/aws/aws-sdk-go/aws/client" "github.com/aws/aws-sdk-go/aws/credentials" "github.com/aws/aws-sdk-go/aws/ec2metadata" ) @@ -25,9 +26,6 @@ import ( // Client: &http.Client{ // Timeout: 10 * time.Second, // }, -// // Use default EC2 Role metadata endpoint, Alternate endpoints can be -// // specified setting Endpoint to something else. -// Endpoint: "", // // Do not use early expiry of credentials. If a non zero value is // // specified the credentials will be expired early // ExpiryWindow: 0, @@ -35,8 +33,8 @@ import ( type EC2RoleProvider struct { credentials.Expiry - // EC2Metadata client to use when connecting to EC2 metadata service - Client *ec2metadata.Client + // Required EC2Metadata client to use when connecting to EC2 metadata service. + Client *ec2metadata.EC2Metadata // ExpiryWindow will allow the credentials to trigger refreshing prior to // the credentials actually expiring. This is beneficial so race conditions @@ -50,33 +48,40 @@ type EC2RoleProvider struct { ExpiryWindow time.Duration } -// NewCredentials returns a pointer to a new Credentials object -// wrapping the EC2RoleProvider. -// -// Takes a custom http.Client which can be configured for custom handling of -// things such as timeout. -// -// Endpoint is the URL that the EC2RoleProvider will connect to when retrieving -// role and credentials. -// -// Window is the expiry window that will be subtracted from the expiry returned -// by the role credential request. This is done so that the credentials will -// expire sooner than their actual lifespan. -func NewCredentials(client *ec2metadata.Client, window time.Duration) *credentials.Credentials { - return credentials.NewCredentials(&EC2RoleProvider{ - Client: client, - ExpiryWindow: window, - }) +// NewCredentials returns a pointer to a new Credentials object wrapping +// the EC2RoleProvider. Takes a ConfigProvider to create a EC2Metadata client. +// The ConfigProvider is satisfied by the session.Session type. +func NewCredentials(c client.ConfigProvider, options ...func(*EC2RoleProvider)) *credentials.Credentials { + p := &EC2RoleProvider{ + Client: ec2metadata.New(c), + } + + for _, option := range options { + option(p) + } + + return credentials.NewCredentials(p) +} + +// NewCredentialsWithClient returns a pointer to a new Credentials object wrapping +// the EC2RoleProvider. Takes a EC2Metadata client to use when connecting to EC2 +// metadata service. +func NewCredentialsWithClient(client *ec2metadata.EC2Metadata, options ...func(*EC2RoleProvider)) *credentials.Credentials { + p := &EC2RoleProvider{ + Client: client, + } + + for _, option := range options { + option(p) + } + + return credentials.NewCredentials(p) } // Retrieve retrieves credentials from the EC2 service. // Error will be returned if the request fails, or unable to extract // the desired credentials. func (m *EC2RoleProvider) Retrieve() (credentials.Value, error) { - if m.Client == nil { - m.Client = ec2metadata.New(nil) - } - credsList, err := requestCredList(m.Client) if err != nil { return credentials.Value{}, err @@ -101,7 +106,7 @@ func (m *EC2RoleProvider) Retrieve() (credentials.Value, error) { }, nil } -// A ec2RoleCredRespBody provides the shape for deserializing credential +// A ec2RoleCredRespBody provides the shape for unmarshalling credential // request responses. type ec2RoleCredRespBody struct { // Success State @@ -119,7 +124,7 @@ const iamSecurityCredsPath = "/iam/security-credentials" // requestCredList requests a list of credentials from the EC2 service. // If there are no credentials, or there is an error making or receiving the request -func requestCredList(client *ec2metadata.Client) ([]string, error) { +func requestCredList(client *ec2metadata.EC2Metadata) ([]string, error) { resp, err := client.GetMetadata(iamSecurityCredsPath) if err != nil { return nil, awserr.New("EC2RoleRequestError", "failed to list EC2 Roles", err) @@ -142,7 +147,7 @@ func requestCredList(client *ec2metadata.Client) ([]string, error) { // // If the credentials cannot be found, or there is an error reading the response // and error will be returned. -func requestCred(client *ec2metadata.Client, credsName string) (ec2RoleCredRespBody, error) { +func requestCred(client *ec2metadata.EC2Metadata, credsName string) (ec2RoleCredRespBody, error) { resp, err := client.GetMetadata(path.Join(iamSecurityCredsPath, credsName)) if err != nil { return ec2RoleCredRespBody{}, diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/credentials/ec2rolecreds/ec2_role_provider_test.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/credentials/ec2rolecreds/ec2_role_provider_test.go index cd0cbc97e06..da3d8ed3ec1 100644 --- a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/credentials/ec2rolecreds/ec2_role_provider_test.go +++ b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/credentials/ec2rolecreds/ec2_role_provider_test.go @@ -13,6 +13,7 @@ import ( "github.com/aws/aws-sdk-go/aws/awserr" "github.com/aws/aws-sdk-go/aws/credentials/ec2rolecreds" "github.com/aws/aws-sdk-go/aws/ec2metadata" + "github.com/aws/aws-sdk-go/aws/session" ) const credsRespTmpl = `{ @@ -54,11 +55,11 @@ func TestEC2RoleProvider(t *testing.T) { defer server.Close() p := &ec2rolecreds.EC2RoleProvider{ - Client: ec2metadata.New(&ec2metadata.Config{Endpoint: aws.String(server.URL + "/latest")}), + Client: ec2metadata.New(session.New(), &aws.Config{Endpoint: aws.String(server.URL + "/latest")}), } creds, err := p.Retrieve() - assert.Nil(t, err, "Expect no error") + assert.Nil(t, err, "Expect no error, %v", err) assert.Equal(t, "accessKey", creds.AccessKeyID, "Expect access key ID to match") assert.Equal(t, "secret", creds.SecretAccessKey, "Expect secret access key to match") @@ -70,7 +71,7 @@ func TestEC2RoleProviderFailAssume(t *testing.T) { defer server.Close() p := &ec2rolecreds.EC2RoleProvider{ - Client: ec2metadata.New(&ec2metadata.Config{Endpoint: aws.String(server.URL + "/latest")}), + Client: ec2metadata.New(session.New(), &aws.Config{Endpoint: aws.String(server.URL + "/latest")}), } creds, err := p.Retrieve() @@ -91,7 +92,7 @@ func TestEC2RoleProviderIsExpired(t *testing.T) { defer server.Close() p := &ec2rolecreds.EC2RoleProvider{ - Client: ec2metadata.New(&ec2metadata.Config{Endpoint: aws.String(server.URL + "/latest")}), + Client: ec2metadata.New(session.New(), &aws.Config{Endpoint: aws.String(server.URL + "/latest")}), } p.CurrentTime = func() time.Time { return time.Date(2014, 12, 15, 21, 26, 0, 0, time.UTC) @@ -100,7 +101,7 @@ func TestEC2RoleProviderIsExpired(t *testing.T) { assert.True(t, p.IsExpired(), "Expect creds to be expired before retrieve.") _, err := p.Retrieve() - assert.Nil(t, err, "Expect no error") + assert.Nil(t, err, "Expect no error, %v", err) assert.False(t, p.IsExpired(), "Expect creds to not be expired after retrieve.") @@ -116,7 +117,7 @@ func TestEC2RoleProviderExpiryWindowIsExpired(t *testing.T) { defer server.Close() p := &ec2rolecreds.EC2RoleProvider{ - Client: ec2metadata.New(&ec2metadata.Config{Endpoint: aws.String(server.URL + "/latest")}), + Client: ec2metadata.New(session.New(), &aws.Config{Endpoint: aws.String(server.URL + "/latest")}), ExpiryWindow: time.Hour * 1, } p.CurrentTime = func() time.Time { @@ -126,7 +127,7 @@ func TestEC2RoleProviderExpiryWindowIsExpired(t *testing.T) { assert.True(t, p.IsExpired(), "Expect creds to be expired before retrieve.") _, err := p.Retrieve() - assert.Nil(t, err, "Expect no error") + assert.Nil(t, err, "Expect no error, %v", err) assert.False(t, p.IsExpired(), "Expect creds to not be expired after retrieve.") @@ -137,12 +138,12 @@ func TestEC2RoleProviderExpiryWindowIsExpired(t *testing.T) { assert.True(t, p.IsExpired(), "Expect creds to be expired.") } -func BenchmarkEC2RoleProvider(b *testing.B) { +func BenchmarkEC3RoleProvider(b *testing.B) { server := initTestServer("2014-12-16T01:51:37Z", false) defer server.Close() p := &ec2rolecreds.EC2RoleProvider{ - Client: ec2metadata.New(&ec2metadata.Config{Endpoint: aws.String(server.URL + "/latest")}), + Client: ec2metadata.New(session.New(), &aws.Config{Endpoint: aws.String(server.URL + "/latest")}), } _, err := p.Retrieve() if err != nil { @@ -150,12 +151,9 @@ func BenchmarkEC2RoleProvider(b *testing.B) { } b.ResetTimer() - b.RunParallel(func(pb *testing.PB) { - for pb.Next() { - _, err := p.Retrieve() - if err != nil { - b.Fatal(err) - } + for i := 0; i < b.N; i++ { + if _, err := p.Retrieve(); err != nil { + b.Fatal(err) } - }) + } } diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/credentials/example.ini b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/credentials/example.ini index aa2dc506ad0..7fc91d9d204 100644 --- a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/credentials/example.ini +++ b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/credentials/example.ini @@ -6,3 +6,7 @@ aws_session_token = token [no_token] aws_access_key_id = accessKey aws_secret_access_key = secret + +[with_colon] +aws_access_key_id: accessKey +aws_secret_access_key: secret diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/credentials/shared_credentials_provider.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/credentials/shared_credentials_provider.go index fac6d78c41e..09bd00a9506 100644 --- a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/credentials/shared_credentials_provider.go +++ b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/credentials/shared_credentials_provider.go @@ -5,7 +5,7 @@ import ( "os" "path/filepath" - "github.com/vaughan0/go-ini" + "github.com/go-ini/ini" "github.com/aws/aws-sdk-go/aws/awserr" ) @@ -76,32 +76,36 @@ func (p *SharedCredentialsProvider) IsExpired() bool { // The credentials retrieved from the profile will be returned or error. Error will be // returned if it fails to read from the file, or the data is invalid. func loadProfile(filename, profile string) (Value, error) { - config, err := ini.LoadFile(filename) + config, err := ini.Load(filename) if err != nil { return Value{}, awserr.New("SharedCredsLoad", "failed to load shared credentials file", err) } - iniProfile := config.Section(profile) - - id, ok := iniProfile["aws_access_key_id"] - if !ok { - return Value{}, awserr.New("SharedCredsAccessKey", - fmt.Sprintf("shared credentials %s in %s did not contain aws_access_key_id", profile, filename), - nil) + iniProfile, err := config.GetSection(profile) + if err != nil { + return Value{}, awserr.New("SharedCredsLoad", "failed to get profile", err) } - secret, ok := iniProfile["aws_secret_access_key"] - if !ok { + id, err := iniProfile.GetKey("aws_access_key_id") + if err != nil { + return Value{}, awserr.New("SharedCredsAccessKey", + fmt.Sprintf("shared credentials %s in %s did not contain aws_access_key_id", profile, filename), + err) + } + + secret, err := iniProfile.GetKey("aws_secret_access_key") + if err != nil { return Value{}, awserr.New("SharedCredsSecret", fmt.Sprintf("shared credentials %s in %s did not contain aws_secret_access_key", profile, filename), nil) } - token := iniProfile["aws_session_token"] + // Default to empty string if not found + token := iniProfile.Key("aws_session_token") return Value{ - AccessKeyID: id, - SecretAccessKey: secret, - SessionToken: token, + AccessKeyID: id.String(), + SecretAccessKey: secret.String(), + SessionToken: token.String(), }, nil } diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/credentials/shared_credentials_provider_test.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/credentials/shared_credentials_provider_test.go index 1d9983f2ce1..2e26da2634b 100644 --- a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/credentials/shared_credentials_provider_test.go +++ b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/credentials/shared_credentials_provider_test.go @@ -69,6 +69,18 @@ func TestSharedCredentialsProviderWithoutTokenFromProfile(t *testing.T) { assert.Empty(t, creds.SessionToken, "Expect no token") } +func TestSharedCredentialsProviderColonInCredFile(t *testing.T) { + os.Clearenv() + + p := SharedCredentialsProvider{Filename: "example.ini", Profile: "with_colon"} + creds, err := p.Retrieve() + assert.Nil(t, err, "Expect no error") + + assert.Equal(t, "accessKey", creds.AccessKeyID, "Expect access key ID to match") + assert.Equal(t, "secret", creds.SecretAccessKey, "Expect secret access key to match") + assert.Empty(t, creds.SessionToken, "Expect no token") +} + func BenchmarkSharedCredentialsProvider(b *testing.B) { os.Clearenv() diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/credentials/stscreds/assume_role_provider.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/credentials/stscreds/assume_role_provider.go index 7a4459f8046..0214860d4cc 100644 --- a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/credentials/stscreds/assume_role_provider.go +++ b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/credentials/stscreds/assume_role_provider.go @@ -9,6 +9,7 @@ import ( "time" "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/client" "github.com/aws/aws-sdk-go/aws/credentials" "github.com/aws/aws-sdk-go/service/sts" ) @@ -18,31 +19,17 @@ type AssumeRoler interface { AssumeRole(input *sts.AssumeRoleInput) (*sts.AssumeRoleOutput, error) } +// DefaultDuration is the default amount of time in minutes that the credentials +// will be valid for. +var DefaultDuration = time.Duration(15) * time.Minute + // AssumeRoleProvider retrieves temporary credentials from the STS service, and // keeps track of their expiration time. This provider must be used explicitly, // as it is not included in the credentials chain. -// -// Example how to configure a service to use this provider: -// -// config := &aws.Config{ -// Credentials: stscreds.NewCredentials(nil, "arn-of-the-role-to-assume", 10*time.Second), -// }) -// // Use config for creating your AWS service. -// -// Example how to obtain customised credentials: -// -// provider := &stscreds.Provider{ -// // Extend the duration to 1 hour. -// Duration: time.Hour, -// // Custom role name. -// RoleSessionName: "custom-session-name", -// } -// creds := credentials.NewCredentials(provider) -// type AssumeRoleProvider struct { credentials.Expiry - // Custom STS client. If not set the default STS client will be used. + // STS client to make assume role request with. Client AssumeRoler // Role to be assumed. @@ -70,37 +57,55 @@ type AssumeRoleProvider struct { } // NewCredentials returns a pointer to a new Credentials object wrapping the -// AssumeRoleProvider. The credentials will expire every 15 minutes and the +// AssumeRoleProvider. The credentials will expire every 15 minutes and the // role will be named after a nanosecond timestamp of this operation. // -// The sts and roleARN parameters are used for building the "AssumeRole" call. -// Pass nil as sts to use the default client. +// Takes a Config provider to create the STS client. The ConfigProvider is +// satisfied by the session.Session type. +func NewCredentials(c client.ConfigProvider, roleARN string, options ...func(*AssumeRoleProvider)) *credentials.Credentials { + p := &AssumeRoleProvider{ + Client: sts.New(c), + RoleARN: roleARN, + Duration: DefaultDuration, + } + + for _, option := range options { + option(p) + } + + return credentials.NewCredentials(p) +} + +// NewCredentialsWithClient returns a pointer to a new Credentials object wrapping the +// AssumeRoleProvider. The credentials will expire every 15 minutes and the +// role will be named after a nanosecond timestamp of this operation. // -// Window is the expiry window that will be subtracted from the expiry returned -// by the role credential request. This is done so that the credentials will -// expire sooner than their actual lifespan. -func NewCredentials(client AssumeRoler, roleARN string, window time.Duration) *credentials.Credentials { - return credentials.NewCredentials(&AssumeRoleProvider{ - Client: client, - RoleARN: roleARN, - ExpiryWindow: window, - }) +// Takes an AssumeRoler which can be satisfiede by the STS client. +func NewCredentialsWithClient(svc AssumeRoler, roleARN string, options ...func(*AssumeRoleProvider)) *credentials.Credentials { + p := &AssumeRoleProvider{ + Client: svc, + RoleARN: roleARN, + Duration: DefaultDuration, + } + + for _, option := range options { + option(p) + } + + return credentials.NewCredentials(p) } // Retrieve generates a new set of temporary credentials using STS. func (p *AssumeRoleProvider) Retrieve() (credentials.Value, error) { // Apply defaults where parameters are not set. - if p.Client == nil { - p.Client = sts.New(nil) - } if p.RoleSessionName == "" { // Try to work out a role name that will hopefully end up unique. p.RoleSessionName = fmt.Sprintf("%d", time.Now().UTC().UnixNano()) } if p.Duration == 0 { // Expire as often as AWS permits. - p.Duration = 15 * time.Minute + p.Duration = DefaultDuration } roleOutput, err := p.Client.AssumeRole(&sts.AssumeRoleInput{ diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/credentials/stscreds/assume_role_provider_test.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/credentials/stscreds/assume_role_provider_test.go index f5b97c0053b..6bd6e91973e 100644 --- a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/credentials/stscreds/assume_role_provider_test.go +++ b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/credentials/stscreds/assume_role_provider_test.go @@ -48,12 +48,9 @@ func BenchmarkAssumeRoleProvider(b *testing.B) { } b.ResetTimer() - b.RunParallel(func(pb *testing.PB) { - for pb.Next() { - _, err := p.Retrieve() - if err != nil { - b.Fatal(err) - } + for i := 0; i < b.N; i++ { + if _, err := p.Retrieve(); err != nil { + b.Fatal(err) } - }) + } } diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/defaults/defaults.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/defaults/defaults.go index 2f161b57f1d..b746783beca 100644 --- a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/defaults/defaults.go +++ b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/defaults/defaults.go @@ -1,3 +1,5 @@ +// Package defaults is a collection of helpers to retrieve the SDK's default +// configuration and handlers. package defaults import ( @@ -6,34 +8,69 @@ import ( "time" "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/corehandlers" "github.com/aws/aws-sdk-go/aws/credentials" "github.com/aws/aws-sdk-go/aws/credentials/ec2rolecreds" + "github.com/aws/aws-sdk-go/aws/ec2metadata" + "github.com/aws/aws-sdk-go/aws/request" + "github.com/aws/aws-sdk-go/private/endpoints" ) -// DefaultChainCredentials is a Credentials which will find the first available -// credentials Value from the list of Providers. -// -// This should be used in the default case. Once the type of credentials are -// known switching to the specific Credentials will be more efficient. -var DefaultChainCredentials = credentials.NewChainCredentials( - []credentials.Provider{ - &credentials.EnvProvider{}, - &credentials.SharedCredentialsProvider{Filename: "", Profile: ""}, - &ec2rolecreds.EC2RoleProvider{ExpiryWindow: 5 * time.Minute}, - }) +// A Defaults provides a collection of default values for SDK clients. +type Defaults struct { + Config *aws.Config + Handlers request.Handlers +} -// DefaultConfig is the default all service configuration will be based off of. -// By default, all clients use this structure for initialization options unless -// a custom configuration object is passed in. -// -// You may modify this global structure to change all default configuration -// in the SDK. Note that configuration options are copied by value, so any -// modifications must happen before constructing a client. -var DefaultConfig = aws.NewConfig(). - WithCredentials(DefaultChainCredentials). - WithRegion(os.Getenv("AWS_REGION")). - WithHTTPClient(http.DefaultClient). - WithMaxRetries(aws.DefaultRetries). - WithLogger(aws.NewDefaultLogger()). - WithLogLevel(aws.LogOff). - WithSleepDelay(time.Sleep) +// Get returns the SDK's default values with Config and handlers pre-configured. +func Get() Defaults { + cfg := Config() + handlers := Handlers() + cfg.Credentials = CredChain(cfg, handlers) + + return Defaults{ + Config: cfg, + Handlers: handlers, + } +} + +// Config returns the default configuration. +func Config() *aws.Config { + return aws.NewConfig(). + WithCredentials(credentials.AnonymousCredentials). + WithRegion(os.Getenv("AWS_REGION")). + WithHTTPClient(http.DefaultClient). + WithMaxRetries(aws.UseServiceDefaultRetries). + WithLogger(aws.NewDefaultLogger()). + WithLogLevel(aws.LogOff). + WithSleepDelay(time.Sleep) +} + +// Handlers returns the default request handlers. +func Handlers() request.Handlers { + var handlers request.Handlers + + handlers.Validate.PushBackNamed(corehandlers.ValidateEndpointHandler) + handlers.Build.PushBackNamed(corehandlers.SDKVersionUserAgentHandler) + handlers.Sign.PushBackNamed(corehandlers.BuildContentLengthHandler) + handlers.Send.PushBackNamed(corehandlers.SendHandler) + handlers.AfterRetry.PushBackNamed(corehandlers.AfterRetryHandler) + handlers.ValidateResponse.PushBackNamed(corehandlers.ValidateResponseHandler) + + return handlers +} + +// CredChain returns the default credential chain. +func CredChain(cfg *aws.Config, handlers request.Handlers) *credentials.Credentials { + endpoint, signingRegion := endpoints.EndpointForRegion(ec2metadata.ServiceName, *cfg.Region, true) + + return credentials.NewChainCredentials( + []credentials.Provider{ + &credentials.EnvProvider{}, + &credentials.SharedCredentialsProvider{Filename: "", Profile: ""}, + &ec2rolecreds.EC2RoleProvider{ + Client: ec2metadata.NewClient(*cfg, handlers, endpoint, signingRegion), + ExpiryWindow: 5 * time.Minute, + }, + }) +} diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/ec2metadata/api.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/ec2metadata/api.go index 9d784b6e6ab..e5137ca17da 100644 --- a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/ec2metadata/api.go +++ b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/ec2metadata/api.go @@ -7,7 +7,7 @@ import ( ) // GetMetadata uses the path provided to request -func (c *Client) GetMetadata(p string) (string, error) { +func (c *EC2Metadata) GetMetadata(p string) (string, error) { op := &request.Operation{ Name: "GetMetadata", HTTPMethod: "GET", @@ -15,13 +15,13 @@ func (c *Client) GetMetadata(p string) (string, error) { } output := &metadataOutput{} - req := request.New(c.Service.ServiceInfo, c.Service.Handlers, c.Service.Retryer, op, nil, output) + req := c.NewRequest(op, nil, output) return output.Content, req.Send() } // Region returns the region the instance is running in. -func (c *Client) Region() (string, error) { +func (c *EC2Metadata) Region() (string, error) { resp, err := c.GetMetadata("placement/availability-zone") if err != nil { return "", err @@ -34,7 +34,7 @@ func (c *Client) Region() (string, error) { // Available returns if the application has access to the EC2 Metadata service. // Can be used to determine if application is running within an EC2 Instance and // the metadata service is available. -func (c *Client) Available() bool { +func (c *EC2Metadata) Available() bool { if _, err := c.GetMetadata("instance-id"); err != nil { return false } diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/ec2metadata/api_test.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/ec2metadata/api_test.go index 61ab62a5305..c3c92972b7c 100644 --- a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/ec2metadata/api_test.go +++ b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/ec2metadata/api_test.go @@ -14,6 +14,7 @@ import ( "github.com/aws/aws-sdk-go/aws/awserr" "github.com/aws/aws-sdk-go/aws/ec2metadata" "github.com/aws/aws-sdk-go/aws/request" + "github.com/aws/aws-sdk-go/aws/session" ) func initTestServer(path string, resp string) *httptest.Server { @@ -28,15 +29,15 @@ func initTestServer(path string, resp string) *httptest.Server { } func TestEndpoint(t *testing.T) { - c := ec2metadata.New(&ec2metadata.Config{}) + c := ec2metadata.New(session.New()) op := &request.Operation{ Name: "GetMetadata", HTTPMethod: "GET", HTTPPath: path.Join("/", "meta-data", "testpath"), } - req := c.Service.NewRequest(op, nil, nil) - assert.Equal(t, "http://169.254.169.254/latest", req.Service.Endpoint) + req := c.NewRequest(op, nil, nil) + assert.Equal(t, "http://169.254.169.254/latest", req.ClientInfo.Endpoint) assert.Equal(t, "http://169.254.169.254/latest/meta-data/testpath", req.HTTPRequest.URL.String()) } @@ -46,7 +47,7 @@ func TestGetMetadata(t *testing.T) { "success", // real response includes suffix ) defer server.Close() - c := ec2metadata.New(&ec2metadata.Config{Endpoint: aws.String(server.URL + "/latest")}) + c := ec2metadata.New(session.New(), &aws.Config{Endpoint: aws.String(server.URL + "/latest")}) resp, err := c.GetMetadata("some/path") @@ -60,7 +61,7 @@ func TestGetRegion(t *testing.T) { "us-west-2a", // real response includes suffix ) defer server.Close() - c := ec2metadata.New(&ec2metadata.Config{Endpoint: aws.String(server.URL + "/latest")}) + c := ec2metadata.New(session.New(), &aws.Config{Endpoint: aws.String(server.URL + "/latest")}) region, err := c.Region() @@ -74,7 +75,7 @@ func TestMetadataAvailable(t *testing.T) { "instance-id", ) defer server.Close() - c := ec2metadata.New(&ec2metadata.Config{Endpoint: aws.String(server.URL + "/latest")}) + c := ec2metadata.New(session.New(), &aws.Config{Endpoint: aws.String(server.URL + "/latest")}) available := c.Available() @@ -82,7 +83,7 @@ func TestMetadataAvailable(t *testing.T) { } func TestMetadataNotAvailable(t *testing.T) { - c := ec2metadata.New(nil) + c := ec2metadata.New(session.New()) c.Handlers.Send.Clear() c.Handlers.Send.PushBack(func(r *request.Request) { r.HTTPResponse = &http.Response{ diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/ec2metadata/service.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/ec2metadata/service.go index 73a12c9129a..f0dc331e012 100644 --- a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/ec2metadata/service.go +++ b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/ec2metadata/service.go @@ -1,3 +1,5 @@ +// Package ec2metadata provides the client for making API calls to the +// EC2 Metadata service. package ec2metadata import ( @@ -8,89 +10,41 @@ import ( "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/awserr" - "github.com/aws/aws-sdk-go/aws/credentials" + "github.com/aws/aws-sdk-go/aws/client" + "github.com/aws/aws-sdk-go/aws/client/metadata" "github.com/aws/aws-sdk-go/aws/request" - "github.com/aws/aws-sdk-go/aws/service" - "github.com/aws/aws-sdk-go/aws/service/serviceinfo" ) -// DefaultRetries states the default number of times the service client will -// attempt to retry a failed request before failing. -const DefaultRetries = 3 +// ServiceName is the name of the service. +const ServiceName = "ec2metadata" -// A Config provides the configuration for the EC2 Metadata service. -type Config struct { - // An optional endpoint URL (hostname only or fully qualified URI) - // that overrides the default service endpoint for a client. Set this - // to nil, or `""` to use the default service endpoint. - Endpoint *string - - // The HTTP client to use when sending requests. Defaults to - // `http.DefaultClient`. - HTTPClient *http.Client - - // An integer value representing the logging level. The default log level - // is zero (LogOff), which represents no logging. To enable logging set - // to a LogLevel Value. - Logger aws.Logger - - // The logger writer interface to write logging messages to. Defaults to - // standard out. - LogLevel *aws.LogLevelType - - // The maximum number of times that a request will be retried for failures. - // Defaults to DefaultRetries for the number of retries to be performed - // per request. - MaxRetries *int +// A EC2Metadata is an EC2 Metadata service Client. +type EC2Metadata struct { + *client.Client } -// A Client is an EC2 Metadata service Client. -type Client struct { - *service.Service -} - -// New creates a new instance of the EC2 Metadata service client. +// New creates a new instance of the EC2Metadata client with a session. +// This client is safe to use across multiple goroutines. // -// In the general use case the configuration for this service client should not -// be needed and `nil` can be provided. Configuration is only needed if the -// `ec2metadata.Config` defaults need to be overridden. Eg. Setting LogLevel. +// Example: +// // Create a EC2Metadata client from just a session. +// svc := ec2metadata.New(mySession) // -// @note This configuration will NOT be merged with the default AWS service -// client configuration `defaults.DefaultConfig`. Due to circular dependencies -// with the defaults package and credentials EC2 Role Provider. -func New(config *Config) *Client { - service := &service.Service{ - ServiceInfo: serviceinfo.ServiceInfo{ - Config: copyConfig(config), - ServiceName: "Client", - Endpoint: "http://169.254.169.254/latest", - APIVersion: "latest", - }, - } - service.Initialize() - service.Handlers.Unmarshal.PushBack(unmarshalHandler) - service.Handlers.UnmarshalError.PushBack(unmarshalError) - service.Handlers.Validate.Clear() - service.Handlers.Validate.PushBack(validateEndpointHandler) - - return &Client{service} +// // Create a EC2Metadata client with additional configuration +// svc := ec2metadata.New(mySession, aws.NewConfig().WithLogLevel(aws.LogDebugHTTPBody)) +func New(p client.ConfigProvider, cfgs ...*aws.Config) *EC2Metadata { + c := p.ClientConfig(ServiceName, cfgs...) + return NewClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) } -func copyConfig(config *Config) *aws.Config { - if config == nil { - config = &Config{} - } - c := &aws.Config{ - Credentials: credentials.AnonymousCredentials, - Endpoint: config.Endpoint, - HTTPClient: config.HTTPClient, - Logger: config.Logger, - LogLevel: config.LogLevel, - MaxRetries: config.MaxRetries, - } - - if c.HTTPClient == nil { - c.HTTPClient = &http.Client{ +// NewClient returns a new EC2Metadata client. Should be used to create +// a client when not using a session. Generally using just New with a session +// is preferred. +func NewClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string, opts ...func(*client.Client)) *EC2Metadata { + // If the default http client is provided, replace it with a custom + // client using default timeouts. + if cfg.HTTPClient == http.DefaultClient { + cfg.HTTPClient = &http.Client{ Transport: &http.Transport{ Proxy: http.ProxyFromEnvironment, Dial: (&net.Dialer{ @@ -104,17 +58,30 @@ func copyConfig(config *Config) *aws.Config { }, } } - if c.Logger == nil { - c.Logger = aws.NewDefaultLogger() - } - if c.LogLevel == nil { - c.LogLevel = aws.LogLevel(aws.LogOff) - } - if c.MaxRetries == nil { - c.MaxRetries = aws.Int(DefaultRetries) + + svc := &EC2Metadata{ + Client: client.New( + cfg, + metadata.ClientInfo{ + ServiceName: ServiceName, + Endpoint: endpoint, + APIVersion: "latest", + }, + handlers, + ), } - return c + svc.Handlers.Unmarshal.PushBack(unmarshalHandler) + svc.Handlers.UnmarshalError.PushBack(unmarshalError) + svc.Handlers.Validate.Clear() + svc.Handlers.Validate.PushBack(validateEndpointHandler) + + // Add additional options to the service config + for _, option := range opts { + option(svc.Client) + } + + return svc } type metadataOutput struct { @@ -143,7 +110,7 @@ func unmarshalError(r *request.Request) { } func validateEndpointHandler(r *request.Request) { - if r.Service.Endpoint == "" { + if r.ClientInfo.Endpoint == "" { r.Error = aws.ErrMissingEndpoint } } diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/errors.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/errors.go index db2f481b01b..57663616868 100644 --- a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/errors.go +++ b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/errors.go @@ -7,11 +7,11 @@ var ( // not found. // // @readonly - ErrMissingRegion error = awserr.New("MissingRegion", "could not find region configuration", nil) + ErrMissingRegion = awserr.New("MissingRegion", "could not find region configuration", nil) // ErrMissingEndpoint is an error that is returned if an endpoint cannot be // resolved for a service. // // @readonly - ErrMissingEndpoint error = awserr.New("MissingEndpoint", "'Endpoint' configuration is required for this service", nil) + ErrMissingEndpoint = awserr.New("MissingEndpoint", "'Endpoint' configuration is required for this service", nil) ) diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/request/handlers.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/request/handlers.go index 85bc122e7b3..3e90a7976ae 100644 --- a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/request/handlers.go +++ b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/request/handlers.go @@ -1,5 +1,10 @@ package request +import ( + "fmt" + "strings" +) + // A Handlers provides a collection of request handlers for various // stages of handling requests. type Handlers struct { @@ -110,3 +115,26 @@ func (l *HandlerList) Run(r *Request) { f.Fn(r) } } + +// MakeAddToUserAgentHandler will add the name/version pair to the User-Agent request +// header. If the extra parameters are provided they will be added as metadata to the +// name/version pair resulting in the following format. +// "name/version (extra0; extra1; ...)" +// The user agent part will be concatenated with this current request's user agent string. +func MakeAddToUserAgentHandler(name, version string, extra ...string) func(*Request) { + ua := fmt.Sprintf("%s/%s", name, version) + if len(extra) > 0 { + ua += fmt.Sprintf(" (%s)", strings.Join(extra, "; ")) + } + return func(r *Request) { + AddToUserAgent(r, ua) + } +} + +// MakeAddToUserAgentFreeFormHandler adds the input to the User-Agent request header. +// The input string will be concatenated with the current request's user agent string. +func MakeAddToUserAgentFreeFormHandler(s string) func(*Request) { + return func(r *Request) { + AddToUserAgent(r, s) + } +} diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/request/handlers_test.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/request/handlers_test.go index 2ff05a8154e..16a1418283b 100644 --- a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/request/handlers_test.go +++ b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/request/handlers_test.go @@ -35,8 +35,8 @@ func TestMultipleHandlers(t *testing.T) { func TestNamedHandlers(t *testing.T) { l := request.HandlerList{} - named := request.NamedHandler{"Name", func(r *request.Request) {}} - named2 := request.NamedHandler{"NotName", func(r *request.Request) {}} + named := request.NamedHandler{Name: "Name", Fn: func(r *request.Request) {}} + named2 := request.NamedHandler{Name: "NotName", Fn: func(r *request.Request) {}} l.PushBackNamed(named) l.PushBackNamed(named) l.PushBackNamed(named2) diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/request/request.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/request/request.go index 70c28b88316..3735d7fa533 100644 --- a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/request/request.go +++ b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/request/request.go @@ -12,15 +12,16 @@ import ( "time" "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/awsutil" - "github.com/aws/aws-sdk-go/aws/service/serviceinfo" + "github.com/aws/aws-sdk-go/aws/client/metadata" ) // A Request is the service request to be made. type Request struct { + Config aws.Config + ClientInfo metadata.ClientInfo + Handlers Handlers + Retryer - Service serviceinfo.ServiceInfo - Handlers Handlers Time time.Time ExpireTime time.Duration Operation *Operation @@ -32,7 +33,7 @@ type Request struct { Error error Data interface{} RequestID string - RetryCount uint + RetryCount int Retryable *bool RetryDelay time.Duration @@ -61,7 +62,9 @@ type Paginator struct { // Params is any value of input parameters to be the request payload. // Data is pointer value to an object which the request's response // payload will be deserialized to. -func New(service serviceinfo.ServiceInfo, handlers Handlers, retryer Retryer, operation *Operation, params interface{}, data interface{}) *Request { +func New(cfg aws.Config, clientInfo metadata.ClientInfo, handlers Handlers, + retryer Retryer, operation *Operation, params interface{}, data interface{}) *Request { + method := operation.HTTPMethod if method == "" { method = "POST" @@ -72,12 +75,14 @@ func New(service serviceinfo.ServiceInfo, handlers Handlers, retryer Retryer, op } httpReq, _ := http.NewRequest(method, "", nil) - httpReq.URL, _ = url.Parse(service.Endpoint + p) + httpReq.URL, _ = url.Parse(clientInfo.Endpoint + p) r := &Request{ + Config: cfg, + ClientInfo: clientInfo, + Handlers: handlers.Copy(), + Retryer: retryer, - Service: service, - Handlers: handlers.Copy(), Time: time.Now(), ExpireTime: 0, Operation: operation, @@ -140,7 +145,7 @@ func (r *Request) Presign(expireTime time.Duration) (string, error) { } func debugLogReqError(r *Request, stage string, retrying bool, err error) { - if !r.Service.Config.LogLevel.Matches(aws.LogDebugWithRequestErrors) { + if !r.Config.LogLevel.Matches(aws.LogDebugWithRequestErrors) { return } @@ -149,8 +154,8 @@ func debugLogReqError(r *Request, stage string, retrying bool, err error) { retryStr = "will retry" } - r.Service.Config.Logger.Log(fmt.Sprintf("DEBUG: %s %s/%s failed, %s, error %v", - stage, r.Service.ServiceName, r.Operation.Name, retryStr, err)) + r.Config.Logger.Log(fmt.Sprintf("DEBUG: %s %s/%s failed, %s, error %v", + stage, r.ClientInfo.ServiceName, r.Operation.Name, retryStr, err)) } // Build will build the request's object so it can be signed and sent @@ -205,9 +210,9 @@ func (r *Request) Send() error { } if aws.BoolValue(r.Retryable) { - if r.Service.Config.LogLevel.Matches(aws.LogDebugWithRequestRetries) { - r.Service.Config.Logger.Log(fmt.Sprintf("DEBUG: Retrying Request %s/%s, attempt %d", - r.Service.ServiceName, r.Operation.Name, r.RetryCount)) + if r.Config.LogLevel.Matches(aws.LogDebugWithRequestRetries) { + r.Config.Logger.Log(fmt.Sprintf("DEBUG: Retrying Request %s/%s, attempt %d", + r.ClientInfo.ServiceName, r.Operation.Name, r.RetryCount)) } // Re-seek the body back to the original point in for a retry so that @@ -264,85 +269,11 @@ func (r *Request) Send() error { return nil } -// HasNextPage returns true if this request has more pages of data available. -func (r *Request) HasNextPage() bool { - return r.nextPageTokens() != nil -} - -// nextPageTokens returns the tokens to use when asking for the next page of -// data. -func (r *Request) nextPageTokens() []interface{} { - if r.Operation.Paginator == nil { - return nil - } - - if r.Operation.TruncationToken != "" { - tr := awsutil.ValuesAtAnyPath(r.Data, r.Operation.TruncationToken) - if tr == nil || len(tr) == 0 { - return nil - } - switch v := tr[0].(type) { - case bool: - if v == false { - return nil - } - } - } - - found := false - tokens := make([]interface{}, len(r.Operation.OutputTokens)) - - for i, outtok := range r.Operation.OutputTokens { - v := awsutil.ValuesAtAnyPath(r.Data, outtok) - if v != nil && len(v) > 0 { - found = true - tokens[i] = v[0] - } - } - - if found { - return tokens - } - return nil -} - -// NextPage returns a new Request that can be executed to return the next -// page of result data. Call .Send() on this request to execute it. -func (r *Request) NextPage() *Request { - tokens := r.nextPageTokens() - if tokens == nil { - return nil - } - - data := reflect.New(reflect.TypeOf(r.Data).Elem()).Interface() - nr := New(r.Service, r.Handlers, r.Retryer, r.Operation, awsutil.CopyOf(r.Params), data) - for i, intok := range nr.Operation.InputTokens { - awsutil.SetValueAtAnyPath(nr.Params, intok, tokens[i]) - } - return nr -} - -// EachPage iterates over each page of a paginated request object. The fn -// parameter should be a function with the following sample signature: -// -// func(page *T, lastPage bool) bool { -// return true // return false to stop iterating -// } -// -// Where "T" is the structure type matching the output structure of the given -// operation. For example, a request object generated by -// DynamoDB.ListTablesRequest() would expect to see dynamodb.ListTablesOutput -// as the structure "T". The lastPage value represents whether the page is -// the last page of data or not. The return value of this function should -// return true to keep iterating or false to stop. -func (r *Request) EachPage(fn func(data interface{}, isLastPage bool) (shouldContinue bool)) error { - for page := r; page != nil; page = page.NextPage() { - page.Send() - shouldContinue := fn(page.Data, !page.HasNextPage()) - if page.Error != nil || !shouldContinue { - return page.Error - } - } - - return nil +// AddToUserAgent adds the string to the end of the request's current user agent. +func AddToUserAgent(r *Request, s string) { + curUA := r.HTTPRequest.Header.Get("User-Agent") + if len(curUA) > 0 { + s = curUA + " " + s + } + r.HTTPRequest.Header.Set("User-Agent", s) } diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/request/request_pagination.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/request/request_pagination.go new file mode 100644 index 00000000000..2939ec473f2 --- /dev/null +++ b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/request/request_pagination.go @@ -0,0 +1,104 @@ +package request + +import ( + "reflect" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/awsutil" +) + +//type Paginater interface { +// HasNextPage() bool +// NextPage() *Request +// EachPage(fn func(data interface{}, isLastPage bool) (shouldContinue bool)) error +//} + +// HasNextPage returns true if this request has more pages of data available. +func (r *Request) HasNextPage() bool { + return len(r.nextPageTokens()) > 0 +} + +// nextPageTokens returns the tokens to use when asking for the next page of +// data. +func (r *Request) nextPageTokens() []interface{} { + if r.Operation.Paginator == nil { + return nil + } + + if r.Operation.TruncationToken != "" { + tr, _ := awsutil.ValuesAtPath(r.Data, r.Operation.TruncationToken) + if len(tr) == 0 { + return nil + } + + switch v := tr[0].(type) { + case *bool: + if !aws.BoolValue(v) { + return nil + } + case bool: + if v == false { + return nil + } + } + } + + tokens := []interface{}{} + tokenAdded := false + for _, outToken := range r.Operation.OutputTokens { + v, _ := awsutil.ValuesAtPath(r.Data, outToken) + if len(v) > 0 { + tokens = append(tokens, v[0]) + tokenAdded = true + } else { + tokens = append(tokens, nil) + } + } + if !tokenAdded { + return nil + } + + return tokens +} + +// NextPage returns a new Request that can be executed to return the next +// page of result data. Call .Send() on this request to execute it. +func (r *Request) NextPage() *Request { + tokens := r.nextPageTokens() + if len(tokens) == 0 { + return nil + } + + data := reflect.New(reflect.TypeOf(r.Data).Elem()).Interface() + nr := New(r.Config, r.ClientInfo, r.Handlers, r.Retryer, r.Operation, awsutil.CopyOf(r.Params), data) + for i, intok := range nr.Operation.InputTokens { + awsutil.SetValueAtPath(nr.Params, intok, tokens[i]) + } + return nr +} + +// EachPage iterates over each page of a paginated request object. The fn +// parameter should be a function with the following sample signature: +// +// func(page *T, lastPage bool) bool { +// return true // return false to stop iterating +// } +// +// Where "T" is the structure type matching the output structure of the given +// operation. For example, a request object generated by +// DynamoDB.ListTablesRequest() would expect to see dynamodb.ListTablesOutput +// as the structure "T". The lastPage value represents whether the page is +// the last page of data or not. The return value of this function should +// return true to keep iterating or false to stop. +func (r *Request) EachPage(fn func(data interface{}, isLastPage bool) (shouldContinue bool)) error { + for page := r; page != nil; page = page.NextPage() { + if err := page.Send(); err != nil { + return err + } + if getNextPage := fn(page.Data, !page.HasNextPage()); !getNextPage { + return page.Error + } + } + + return nil +} diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/request/request_pagination_test.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/request/request_pagination_test.go index 7869da89e3d..95a8d99fbe6 100644 --- a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/request/request_pagination_test.go +++ b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/request/request_pagination_test.go @@ -9,14 +9,101 @@ import ( "github.com/aws/aws-sdk-go/aws/request" "github.com/aws/aws-sdk-go/awstesting/unit" "github.com/aws/aws-sdk-go/service/dynamodb" + "github.com/aws/aws-sdk-go/service/route53" "github.com/aws/aws-sdk-go/service/s3" ) -var _ = unit.Imported +// Use DynamoDB methods for simplicity +func TestPaginationQueryPage(t *testing.T) { + db := dynamodb.New(unit.Session) + tokens, pages, numPages, gotToEnd := []map[string]*dynamodb.AttributeValue{}, []map[string]*dynamodb.AttributeValue{}, 0, false + + reqNum := 0 + resps := []*dynamodb.QueryOutput{ + { + LastEvaluatedKey: map[string]*dynamodb.AttributeValue{"key": {S: aws.String("key1")}}, + Count: aws.Int64(1), + Items: []map[string]*dynamodb.AttributeValue{ + map[string]*dynamodb.AttributeValue{ + "key": {S: aws.String("key1")}, + }, + }, + }, + { + LastEvaluatedKey: map[string]*dynamodb.AttributeValue{"key": {S: aws.String("key2")}}, + Count: aws.Int64(1), + Items: []map[string]*dynamodb.AttributeValue{ + map[string]*dynamodb.AttributeValue{ + "key": {S: aws.String("key2")}, + }, + }, + }, + { + LastEvaluatedKey: map[string]*dynamodb.AttributeValue{}, + Count: aws.Int64(1), + Items: []map[string]*dynamodb.AttributeValue{ + map[string]*dynamodb.AttributeValue{ + "key": {S: aws.String("key3")}, + }, + }, + }, + } + + db.Handlers.Send.Clear() // mock sending + db.Handlers.Unmarshal.Clear() + db.Handlers.UnmarshalMeta.Clear() + db.Handlers.ValidateResponse.Clear() + db.Handlers.Build.PushBack(func(r *request.Request) { + in := r.Params.(*dynamodb.QueryInput) + if in == nil { + tokens = append(tokens, nil) + } else if len(in.ExclusiveStartKey) != 0 { + tokens = append(tokens, in.ExclusiveStartKey) + } + }) + db.Handlers.Unmarshal.PushBack(func(r *request.Request) { + r.Data = resps[reqNum] + reqNum++ + }) + + params := &dynamodb.QueryInput{ + Limit: aws.Int64(2), + TableName: aws.String("tablename"), + } + err := db.QueryPages(params, func(p *dynamodb.QueryOutput, last bool) bool { + numPages++ + for _, item := range p.Items { + pages = append(pages, item) + } + if last { + if gotToEnd { + assert.Fail(t, "last=true happened twice") + } + gotToEnd = true + } + return true + }) + assert.Nil(t, err) + + assert.Equal(t, + []map[string]*dynamodb.AttributeValue{ + map[string]*dynamodb.AttributeValue{"key": {S: aws.String("key1")}}, + map[string]*dynamodb.AttributeValue{"key": {S: aws.String("key2")}}, + }, tokens) + assert.Equal(t, + []map[string]*dynamodb.AttributeValue{ + map[string]*dynamodb.AttributeValue{"key": {S: aws.String("key1")}}, + map[string]*dynamodb.AttributeValue{"key": {S: aws.String("key2")}}, + map[string]*dynamodb.AttributeValue{"key": {S: aws.String("key3")}}, + }, pages) + assert.Equal(t, 3, numPages) + assert.True(t, gotToEnd) + assert.Nil(t, params.ExclusiveStartKey) +} // Use DynamoDB methods for simplicity func TestPagination(t *testing.T) { - db := dynamodb.New(nil) + db := dynamodb.New(unit.Session) tokens, pages, numPages, gotToEnd := []string{}, []string{}, 0, false reqNum := 0 @@ -68,7 +155,7 @@ func TestPagination(t *testing.T) { // Use DynamoDB methods for simplicity func TestPaginationEachPage(t *testing.T) { - db := dynamodb.New(nil) + db := dynamodb.New(unit.Session) tokens, pages, numPages, gotToEnd := []string{}, []string{}, 0, false reqNum := 0 @@ -121,7 +208,7 @@ func TestPaginationEachPage(t *testing.T) { // Use DynamoDB methods for simplicity func TestPaginationEarlyExit(t *testing.T) { - db := dynamodb.New(nil) + db := dynamodb.New(unit.Session) numPages, gotToEnd := 0, false reqNum := 0 @@ -161,7 +248,7 @@ func TestPaginationEarlyExit(t *testing.T) { } func TestSkipPagination(t *testing.T) { - client := s3.New(nil) + client := s3.New(unit.Session) client.Handlers.Send.Clear() // mock sending client.Handlers.Unmarshal.Clear() client.Handlers.UnmarshalMeta.Clear() @@ -186,10 +273,9 @@ func TestSkipPagination(t *testing.T) { // Use S3 for simplicity func TestPaginationTruncation(t *testing.T) { - count := 0 - client := s3.New(nil) + client := s3.New(unit.Session) - reqNum := &count + reqNum := 0 resps := []*s3.ListObjectsOutput{ {IsTruncated: aws.Bool(true), Contents: []*s3.Object{{Key: aws.String("Key1")}}}, {IsTruncated: aws.Bool(true), Contents: []*s3.Object{{Key: aws.String("Key2")}}}, @@ -202,8 +288,8 @@ func TestPaginationTruncation(t *testing.T) { client.Handlers.UnmarshalMeta.Clear() client.Handlers.ValidateResponse.Clear() client.Handlers.Unmarshal.PushBack(func(r *request.Request) { - r.Data = resps[*reqNum] - *reqNum++ + r.Data = resps[reqNum] + reqNum++ }) params := &s3.ListObjectsInput{Bucket: aws.String("bucket")} @@ -218,7 +304,7 @@ func TestPaginationTruncation(t *testing.T) { assert.Nil(t, err) // Try again without truncation token at all - count = 0 + reqNum = 0 resps[1].IsTruncated = nil resps[2].IsTruncated = aws.Bool(true) results = []string{} @@ -229,7 +315,69 @@ func TestPaginationTruncation(t *testing.T) { assert.Equal(t, []string{"Key1", "Key2"}, results) assert.Nil(t, err) +} +func TestPaginationNilToken(t *testing.T) { + client := route53.New(unit.Session) + + reqNum := 0 + resps := []*route53.ListResourceRecordSetsOutput{ + { + ResourceRecordSets: []*route53.ResourceRecordSet{ + {Name: aws.String("first.example.com.")}, + }, + IsTruncated: aws.Bool(true), + NextRecordName: aws.String("second.example.com."), + NextRecordType: aws.String("MX"), + NextRecordIdentifier: aws.String("second"), + MaxItems: aws.String("1"), + }, + { + ResourceRecordSets: []*route53.ResourceRecordSet{ + {Name: aws.String("second.example.com.")}, + }, + IsTruncated: aws.Bool(true), + NextRecordName: aws.String("third.example.com."), + NextRecordType: aws.String("MX"), + MaxItems: aws.String("1"), + }, + { + ResourceRecordSets: []*route53.ResourceRecordSet{ + {Name: aws.String("third.example.com.")}, + }, + IsTruncated: aws.Bool(false), + MaxItems: aws.String("1"), + }, + } + client.Handlers.Send.Clear() // mock sending + client.Handlers.Unmarshal.Clear() + client.Handlers.UnmarshalMeta.Clear() + client.Handlers.ValidateResponse.Clear() + + idents := []string{} + client.Handlers.Build.PushBack(func(r *request.Request) { + p := r.Params.(*route53.ListResourceRecordSetsInput) + idents = append(idents, aws.StringValue(p.StartRecordIdentifier)) + + }) + client.Handlers.Unmarshal.PushBack(func(r *request.Request) { + r.Data = resps[reqNum] + reqNum++ + }) + + params := &route53.ListResourceRecordSetsInput{ + HostedZoneId: aws.String("id-zone"), + } + + results := []string{} + err := client.ListResourceRecordSetsPages(params, func(p *route53.ListResourceRecordSetsOutput, last bool) bool { + results = append(results, *p.ResourceRecordSets[0].Name) + return true + }) + + assert.NoError(t, err) + assert.Equal(t, []string{"", "second", ""}, idents) + assert.Equal(t, []string{"first.example.com.", "second.example.com.", "third.example.com."}, results) } // Benchmarks @@ -251,7 +399,7 @@ var benchResps = []*dynamodb.ListTablesOutput{ } var benchDb = func() *dynamodb.DynamoDB { - db := dynamodb.New(nil) + db := dynamodb.New(unit.Session) db.Handlers.Send.Clear() // mock sending db.Handlers.Unmarshal.Clear() db.Handlers.UnmarshalMeta.Clear() diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/request/request_test.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/request/request_test.go index 6cea0bd2fff..4828dff7fda 100644 --- a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/request/request_test.go +++ b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/request/request_test.go @@ -7,15 +7,17 @@ import ( "io" "io/ioutil" "net/http" + "runtime" "testing" "time" + "github.com/stretchr/testify/assert" + "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/awserr" "github.com/aws/aws-sdk-go/aws/credentials" "github.com/aws/aws-sdk-go/aws/request" - "github.com/aws/aws-sdk-go/aws/service" - "github.com/stretchr/testify/assert" + "github.com/aws/aws-sdk-go/awstesting" ) type testData struct { @@ -74,7 +76,7 @@ func TestRequestRecoverRetry5xx(t *testing.T) { {StatusCode: 200, Body: body(`{"data":"valid"}`)}, } - s := service.New(aws.NewConfig().WithMaxRetries(10)) + s := awstesting.NewClient(aws.NewConfig().WithMaxRetries(10)) s.Handlers.Validate.Clear() s.Handlers.Unmarshal.PushBack(unmarshal) s.Handlers.UnmarshalError.PushBack(unmarshalError) @@ -100,7 +102,7 @@ func TestRequestRecoverRetry4xxRetryable(t *testing.T) { {StatusCode: 200, Body: body(`{"data":"valid"}`)}, } - s := service.New(aws.NewConfig().WithMaxRetries(10)) + s := awstesting.NewClient(aws.NewConfig().WithMaxRetries(10)) s.Handlers.Validate.Clear() s.Handlers.Unmarshal.PushBack(unmarshal) s.Handlers.UnmarshalError.PushBack(unmarshalError) @@ -119,7 +121,7 @@ func TestRequestRecoverRetry4xxRetryable(t *testing.T) { // test that retries don't occur for 4xx status codes with a response type that can't be retried func TestRequest4xxUnretryable(t *testing.T) { - s := service.New(aws.NewConfig().WithMaxRetries(10)) + s := awstesting.NewClient(aws.NewConfig().WithMaxRetries(10)) s.Handlers.Validate.Clear() s.Handlers.Unmarshal.PushBack(unmarshal) s.Handlers.UnmarshalError.PushBack(unmarshalError) @@ -155,7 +157,7 @@ func TestRequestExhaustRetries(t *testing.T) { {StatusCode: 500, Body: body(`{"__type":"UnknownError","message":"An error occurred."}`)}, } - s := service.New(aws.NewConfig().WithMaxRetries(aws.DefaultRetries).WithSleepDelay(sleepDelay)) + s := awstesting.NewClient(aws.NewConfig().WithSleepDelay(sleepDelay)) s.Handlers.Validate.Clear() s.Handlers.Unmarshal.PushBack(unmarshal) s.Handlers.UnmarshalError.PushBack(unmarshalError) @@ -193,7 +195,7 @@ func TestRequestRecoverExpiredCreds(t *testing.T) { {StatusCode: 200, Body: body(`{"data":"valid"}`)}, } - s := service.New(&aws.Config{MaxRetries: aws.Int(10), Credentials: credentials.NewStaticCredentials("AKID", "SECRET", "")}) + s := awstesting.NewClient(&aws.Config{MaxRetries: aws.Int(10), Credentials: credentials.NewStaticCredentials("AKID", "SECRET", "")}) s.Handlers.Validate.Clear() s.Handlers.Unmarshal.PushBack(unmarshal) s.Handlers.UnmarshalError.PushBack(unmarshalError) @@ -202,12 +204,12 @@ func TestRequestRecoverExpiredCreds(t *testing.T) { credExpiredAfterRetry := false s.Handlers.AfterRetry.PushBack(func(r *request.Request) { - credExpiredAfterRetry = r.Service.Config.Credentials.IsExpired() + credExpiredAfterRetry = r.Config.Credentials.IsExpired() }) s.Handlers.Sign.Clear() s.Handlers.Sign.PushBack(func(r *request.Request) { - r.Service.Config.Credentials.Get() + r.Config.Credentials.Get() }) s.Handlers.Send.Clear() // mock sending s.Handlers.Send.PushBack(func(r *request.Request) { @@ -226,3 +228,34 @@ func TestRequestRecoverExpiredCreds(t *testing.T) { assert.Equal(t, 1, int(r.RetryCount)) assert.Equal(t, "valid", out.Data) } + +func TestMakeAddtoUserAgentHandler(t *testing.T) { + fn := request.MakeAddToUserAgentHandler("name", "version", "extra1", "extra2") + r := &request.Request{HTTPRequest: &http.Request{Header: http.Header{}}} + r.HTTPRequest.Header.Set("User-Agent", "foo/bar") + fn(r) + + assert.Equal(t, "foo/bar name/version (extra1; extra2)", r.HTTPRequest.Header.Get("User-Agent")) +} + +func TestMakeAddtoUserAgentFreeFormHandler(t *testing.T) { + fn := request.MakeAddToUserAgentFreeFormHandler("name/version (extra1; extra2)") + r := &request.Request{HTTPRequest: &http.Request{Header: http.Header{}}} + r.HTTPRequest.Header.Set("User-Agent", "foo/bar") + fn(r) + + assert.Equal(t, "foo/bar name/version (extra1; extra2)", r.HTTPRequest.Header.Get("User-Agent")) +} + +func TestRequestUserAgent(t *testing.T) { + s := awstesting.NewClient(&aws.Config{Region: aws.String("us-east-1")}) + // s.Handlers.Validate.Clear() + + req := s.NewRequest(&request.Operation{Name: "Operation"}, nil, &testData{}) + req.HTTPRequest.Header.Set("User-Agent", "foo/bar") + assert.NoError(t, req.Build()) + + expectUA := fmt.Sprintf("foo/bar %s/%s (%s; %s; %s)", + aws.SDKName, aws.SDKVersion, runtime.Version(), runtime.GOOS, runtime.GOARCH) + assert.Equal(t, expectUA, req.HTTPRequest.Header.Get("User-Agent")) +} diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/request/retryer.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/request/retryer.go index 52667510257..ab6fff5ac84 100644 --- a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/request/retryer.go +++ b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/request/retryer.go @@ -3,6 +3,7 @@ package request import ( "time" + "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/awserr" ) @@ -12,13 +13,21 @@ import ( type Retryer interface { RetryRules(*Request) time.Duration ShouldRetry(*Request) bool - MaxRetries() uint + MaxRetries() int +} + +// WithRetryer sets a config Retryer value to the given Config returning it +// for chaining. +func WithRetryer(cfg *aws.Config, retryer Retryer) *aws.Config { + cfg.Retryer = retryer + return cfg } // retryableCodes is a collection of service response codes which are retry-able // without any further action. var retryableCodes = map[string]struct{}{ "RequestError": {}, + "RequestTimeout": {}, "ProvisionedThroughputExceededException": {}, "Throttling": {}, "ThrottlingException": {}, diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/service/service.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/service/service.go deleted file mode 100644 index 38aa5d51484..00000000000 --- a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/service/service.go +++ /dev/null @@ -1,133 +0,0 @@ -package service - -import ( - "fmt" - "io/ioutil" - "net/http" - "net/http/httputil" - "regexp" - "time" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/corehandlers" - "github.com/aws/aws-sdk-go/aws/request" - "github.com/aws/aws-sdk-go/aws/service/serviceinfo" - "github.com/aws/aws-sdk-go/private/endpoints" -) - -// A Service implements the base service request and response handling -// used by all services. -type Service struct { - serviceinfo.ServiceInfo - request.Retryer - DefaultMaxRetries uint - Handlers request.Handlers -} - -var schemeRE = regexp.MustCompile("^([^:]+)://") - -// New will return a pointer to a new Server object initialized. -func New(config *aws.Config) *Service { - svc := &Service{ServiceInfo: serviceinfo.ServiceInfo{Config: config}} - svc.Initialize() - return svc -} - -// Initialize initializes the service. -func (s *Service) Initialize() { - if s.Config == nil { - s.Config = &aws.Config{} - } - if s.Config.HTTPClient == nil { - s.Config.HTTPClient = http.DefaultClient - } - if s.Config.SleepDelay == nil { - s.Config.SleepDelay = time.Sleep - } - - s.Retryer = DefaultRetryer{s} - s.DefaultMaxRetries = 3 - s.Handlers.Validate.PushBackNamed(corehandlers.ValidateEndpointHandler) - s.Handlers.Build.PushBackNamed(corehandlers.UserAgentHandler) - s.Handlers.Sign.PushBackNamed(corehandlers.BuildContentLengthHandler) - s.Handlers.Send.PushBackNamed(corehandlers.SendHandler) - s.Handlers.AfterRetry.PushBackNamed(corehandlers.AfterRetryHandler) - s.Handlers.ValidateResponse.PushBackNamed(corehandlers.ValidateResponseHandler) - if !aws.BoolValue(s.Config.DisableParamValidation) { - s.Handlers.Validate.PushBackNamed(corehandlers.ValidateParametersHandler) - } - s.AddDebugHandlers() - s.buildEndpoint() -} - -// NewRequest returns a new Request pointer for the service API -// operation and parameters. -func (s *Service) NewRequest(operation *request.Operation, params interface{}, data interface{}) *request.Request { - return request.New(s.ServiceInfo, s.Handlers, s.Retryer, operation, params, data) -} - -// buildEndpoint builds the endpoint values the service will use to make requests with. -func (s *Service) buildEndpoint() { - if aws.StringValue(s.Config.Endpoint) != "" { - s.Endpoint = *s.Config.Endpoint - } else if s.Endpoint == "" { - s.Endpoint, s.SigningRegion = - endpoints.EndpointForRegion(s.ServiceName, aws.StringValue(s.Config.Region)) - } - - if s.Endpoint != "" && !schemeRE.MatchString(s.Endpoint) { - scheme := "https" - if aws.BoolValue(s.Config.DisableSSL) { - scheme = "http" - } - s.Endpoint = scheme + "://" + s.Endpoint - } -} - -// AddDebugHandlers injects debug logging handlers into the service to log request -// debug information. -func (s *Service) AddDebugHandlers() { - if !s.Config.LogLevel.AtLeast(aws.LogDebug) { - return - } - - s.Handlers.Send.PushFront(logRequest) - s.Handlers.Send.PushBack(logResponse) -} - -const logReqMsg = `DEBUG: Request %s/%s Details: ----[ REQUEST POST-SIGN ]----------------------------- -%s ------------------------------------------------------` - -func logRequest(r *request.Request) { - logBody := r.Service.Config.LogLevel.Matches(aws.LogDebugWithHTTPBody) - dumpedBody, _ := httputil.DumpRequestOut(r.HTTPRequest, logBody) - - if logBody { - // Reset the request body because dumpRequest will re-wrap the r.HTTPRequest's - // Body as a NoOpCloser and will not be reset after read by the HTTP - // client reader. - r.Body.Seek(r.BodyStart, 0) - r.HTTPRequest.Body = ioutil.NopCloser(r.Body) - } - - r.Service.Config.Logger.Log(fmt.Sprintf(logReqMsg, r.Service.ServiceName, r.Operation.Name, string(dumpedBody))) -} - -const logRespMsg = `DEBUG: Response %s/%s Details: ----[ RESPONSE ]-------------------------------------- -%s ------------------------------------------------------` - -func logResponse(r *request.Request) { - var msg = "no reponse data" - if r.HTTPResponse != nil { - logBody := r.Service.Config.LogLevel.Matches(aws.LogDebugWithHTTPBody) - dumpedBody, _ := httputil.DumpResponse(r.HTTPResponse, logBody) - msg = string(dumpedBody) - } else if r.Error != nil { - msg = r.Error.Error() - } - r.Service.Config.Logger.Log(fmt.Sprintf(logRespMsg, r.Service.ServiceName, r.Operation.Name, msg)) -} diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/service/serviceinfo/service_info.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/service/serviceinfo/service_info.go deleted file mode 100644 index a920e96a967..00000000000 --- a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/service/serviceinfo/service_info.go +++ /dev/null @@ -1,15 +0,0 @@ -package serviceinfo - -import "github.com/aws/aws-sdk-go/aws" - -// ServiceInfo wraps immutable data from the service.Service structure. -type ServiceInfo struct { - Config *aws.Config - ServiceName string - APIVersion string - Endpoint string - SigningName string - SigningRegion string - JSONVersion string - TargetPrefix string -} diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/session/session.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/session/session.go new file mode 100644 index 00000000000..eb7fc2052f1 --- /dev/null +++ b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/session/session.go @@ -0,0 +1,105 @@ +// Package session provides a way to create service clients with shared configuration +// and handlers. +package session + +import ( + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/client" + "github.com/aws/aws-sdk-go/aws/corehandlers" + "github.com/aws/aws-sdk-go/aws/defaults" + "github.com/aws/aws-sdk-go/aws/request" + "github.com/aws/aws-sdk-go/private/endpoints" +) + +// A Session provides a central location to create service clients from and +// store configurations and request handlers for those services. +// +// Sessions are safe to create service clients concurrently, but it is not safe +// to mutate the session concurrently. +type Session struct { + Config *aws.Config + Handlers request.Handlers +} + +// New creates a new instance of the handlers merging in the provided Configs +// on top of the SDK's default configurations. Once the session is created it +// can be mutated to modify Configs or Handlers. The session is safe to be read +// concurrently, but it should not be written to concurrently. +// +// Example: +// // Create a session with the default config and request handlers. +// sess := session.New() +// +// // Create a session with a custom region +// sess := session.New(&aws.Config{Region: aws.String("us-east-1")}) +// +// // Create a session, and add additional handlers for all service +// // clients created with the session to inherit. Adds logging handler. +// sess := session.New() +// sess.Handlers.Send.PushFront(func(r *request.Request) { +// // Log every request made and its payload +// logger.Println("Request: %s/%s, Payload: %s", r.ClientInfo.ServiceName, r.Operation, r.Params) +// }) +// +// // Create a S3 client instance from a session +// sess := session.New() +// svc := s3.New(sess) +func New(cfgs ...*aws.Config) *Session { + def := defaults.Get() + s := &Session{ + Config: def.Config, + Handlers: def.Handlers, + } + s.Config.MergeIn(cfgs...) + + initHandlers(s) + + return s +} + +func initHandlers(s *Session) { + // Add the Validate parameter handler if it is not disabled. + s.Handlers.Validate.Remove(corehandlers.ValidateParametersHandler) + if !aws.BoolValue(s.Config.DisableParamValidation) { + s.Handlers.Validate.PushBackNamed(corehandlers.ValidateParametersHandler) + } +} + +// Copy creates and returns a copy of the current session, coping the config +// and handlers. If any additional configs are provided they will be merged +// on top of the session's copied config. +// +// Example: +// // Create a copy of the current session, configured for the us-west-2 region. +// sess.Copy(&aws.Config{Region: aws.String("us-west-2"}) +func (s *Session) Copy(cfgs ...*aws.Config) *Session { + newSession := &Session{ + Config: s.Config.Copy(cfgs...), + Handlers: s.Handlers.Copy(), + } + + initHandlers(newSession) + + return newSession +} + +// ClientConfig satisfies the client.ConfigProvider interface and is used to +// configure the service client instances. Passing the Session to the service +// client's constructor (New) will use this method to configure the client. +// +// Example: +// sess := session.New() +// s3.New(sess) +func (s *Session) ClientConfig(serviceName string, cfgs ...*aws.Config) client.Config { + s = s.Copy(cfgs...) + endpoint, signingRegion := endpoints.NormalizeEndpoint( + aws.StringValue(s.Config.Endpoint), serviceName, + aws.StringValue(s.Config.Region), aws.BoolValue(s.Config.DisableSSL)) + + return client.Config{ + Config: s.Config, + Handlers: s.Handlers, + Endpoint: endpoint, + SigningRegion: signingRegion, + } +} diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/session/session_test.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/session/session_test.go new file mode 100644 index 00000000000..e56c02fc661 --- /dev/null +++ b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/session/session_test.go @@ -0,0 +1,20 @@ +package session_test + +import ( + "net/http" + "testing" + + "github.com/stretchr/testify/assert" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/session" +) + +func TestNewDefaultSession(t *testing.T) { + s := session.New(&aws.Config{Region: aws.String("region")}) + + assert.Equal(t, "region", *s.Config.Region) + assert.Equal(t, http.DefaultClient, s.Config.HTTPClient) + assert.NotNil(t, s.Config.Logger) + assert.Equal(t, aws.LogOff, *s.Config.LogLevel) +} diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/types.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/types.go index 846b732dda1..0f067c57f4e 100644 --- a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/types.go +++ b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/types.go @@ -5,7 +5,7 @@ import ( "sync" ) -// ReadSeekCloser wraps a io.Reader returning a ReaderSeakerCloser +// ReadSeekCloser wraps a io.Reader returning a ReaderSeekerCloser func ReadSeekCloser(r io.Reader) ReaderSeekerCloser { return ReaderSeekerCloser{r} } diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/version.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/version.go index b7de9e35190..eec3baa1f05 100644 --- a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/version.go +++ b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/version.go @@ -5,4 +5,4 @@ package aws const SDKName = "aws-sdk-go" // SDKVersion is the version of this SDK -const SDKVersion = "0.9.16" +const SDKVersion = "1.0.0" diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/endpoints/endpoints.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/endpoints/endpoints.go index d040cccd57d..2b279e65999 100644 --- a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/endpoints/endpoints.go +++ b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/endpoints/endpoints.go @@ -4,11 +4,27 @@ package endpoints //go:generate go run ../model/cli/gen-endpoints/main.go endpoints.json endpoints_map.go //go:generate gofmt -s -w endpoints_map.go -import "strings" +import ( + "fmt" + "regexp" + "strings" +) + +// NormalizeEndpoint takes and endpoint and service API information to return a +// normalized endpoint and signing region. If the endpoint is not an empty string +// the service name and region will be used to look up the service's API endpoint. +// If the endpoint is provided the scheme will be added if it is not present. +func NormalizeEndpoint(endpoint, serviceName, region string, disableSSL bool) (normEndpoint, signingRegion string) { + if endpoint == "" { + return EndpointForRegion(serviceName, region, disableSSL) + } + + return AddScheme(endpoint, disableSSL), "" +} // EndpointForRegion returns an endpoint and its signing region for a service and region. // if the service and region pair are not found endpoint and signingRegion will be empty. -func EndpointForRegion(svcName, region string) (endpoint, signingRegion string) { +func EndpointForRegion(svcName, region string, disableSSL bool) (endpoint, signingRegion string) { derivedKeys := []string{ region + "/" + svcName, region + "/*", @@ -24,8 +40,26 @@ func EndpointForRegion(svcName, region string) (endpoint, signingRegion string) endpoint = ep signingRegion = val.SigningRegion - return + break } } - return + + return AddScheme(endpoint, disableSSL), signingRegion +} + +// Regular expression to determine if the endpoint string is prefixed with a scheme. +var schemeRE = regexp.MustCompile("^([^:]+)://") + +// AddScheme adds the HTTP or HTTPS schemes to a endpoint URL if there is no +// scheme. If disableSSL is true HTTP will be added instead of the default HTTPS. +func AddScheme(endpoint string, disableSSL bool) string { + if endpoint != "" && !schemeRE.MatchString(endpoint) { + scheme := "https" + if disableSSL { + scheme = "http" + } + endpoint = fmt.Sprintf("%s://%s", scheme, endpoint) + } + + return endpoint } diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/endpoints/endpoints.json b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/endpoints/endpoints.json index 62b8231d48b..ea819b1ec35 100644 --- a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/endpoints/endpoints.json +++ b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/endpoints/endpoints.json @@ -29,6 +29,10 @@ "endpoint": "", "signingRegion": "us-east-1" }, + "*/ec2metadata": { + "endpoint": "http://169.254.169.254/latest", + "signingRegion": "us-east-1" + }, "*/iam": { "endpoint": "iam.amazonaws.com", "signingRegion": "us-east-1" @@ -45,6 +49,10 @@ "endpoint": "sts.amazonaws.com", "signingRegion": "us-east-1" }, + "*/waf": { + "endpoint": "waf.amazonaws.com", + "signingRegion": "us-east-1" + }, "us-east-1/sdb": { "endpoint": "sdb.amazonaws.com", "signingRegion": "us-east-1" diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/endpoints/endpoints_map.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/endpoints/endpoints_map.go index 62fdc16bdd7..3fab91c7f19 100644 --- a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/endpoints/endpoints_map.go +++ b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/endpoints/endpoints_map.go @@ -30,6 +30,10 @@ var endpointsMap = endpointStruct{ Endpoint: "", SigningRegion: "us-east-1", }, + "*/ec2metadata": { + Endpoint: "http://169.254.169.254/latest", + SigningRegion: "us-east-1", + }, "*/iam": { Endpoint: "iam.amazonaws.com", SigningRegion: "us-east-1", @@ -46,6 +50,10 @@ var endpointsMap = endpointStruct{ Endpoint: "sts.amazonaws.com", SigningRegion: "us-east-1", }, + "*/waf": { + Endpoint: "waf.amazonaws.com", + SigningRegion: "us-east-1", + }, "ap-northeast-1/s3": { Endpoint: "s3-{region}.amazonaws.com", }, diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/endpoints/endpoints_test.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/endpoints/endpoints_test.go index 8af65879d40..2add48890b3 100644 --- a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/endpoints/endpoints_test.go +++ b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/endpoints/endpoints_test.go @@ -1,28 +1,41 @@ -package endpoints +package endpoints_test import ( + "fmt" "testing" "github.com/stretchr/testify/assert" + + "github.com/aws/aws-sdk-go/private/endpoints" ) +func TestGenericEndpoint(t *testing.T) { + name := "service" + region := "mock-region-1" + + ep, sr := endpoints.EndpointForRegion(name, region, false) + assert.Equal(t, fmt.Sprintf("https://%s.%s.amazonaws.com", name, region), ep) + assert.Empty(t, sr) +} + func TestGlobalEndpoints(t *testing.T) { region := "mock-region-1" - svcs := []string{"cloudfront", "iam", "importexport", "route53", "sts"} + svcs := []string{"cloudfront", "iam", "importexport", "route53", "sts", "waf"} for _, name := range svcs { - ep, sr := EndpointForRegion(name, region) - assert.Equal(t, name+".amazonaws.com", ep) + ep, sr := endpoints.EndpointForRegion(name, region, false) + assert.Equal(t, fmt.Sprintf("https://%s.amazonaws.com", name), ep) assert.Equal(t, "us-east-1", sr) } } func TestServicesInCN(t *testing.T) { region := "cn-north-1" - svcs := []string{"cloudfront", "iam", "importexport", "route53", "sts", "s3"} + svcs := []string{"cloudfront", "iam", "importexport", "route53", "sts", "s3", "waf"} for _, name := range svcs { - ep, _ := EndpointForRegion(name, region) - assert.Equal(t, name+"."+region+".amazonaws.com.cn", ep) + ep, sr := endpoints.EndpointForRegion(name, region, false) + assert.Equal(t, fmt.Sprintf("https://%s.%s.amazonaws.com.cn", name, region), ep) + assert.Empty(t, sr) } } diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/protocol/ec2query/build.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/protocol/ec2query/build.go index 8e646140b30..0ead0126ee8 100644 --- a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/protocol/ec2query/build.go +++ b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/protocol/ec2query/build.go @@ -15,7 +15,7 @@ import ( func Build(r *request.Request) { body := url.Values{ "Action": {r.Operation.Name}, - "Version": {r.Service.APIVersion}, + "Version": {r.ClientInfo.APIVersion}, } if err := queryutil.Parse(body, r.Params, true); err != nil { r.Error = awserr.New("SerializationError", "failed encoding EC2 Query request", err) diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/protocol/ec2query/build_bench_test.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/protocol/ec2query/build_bench_test.go index 6e563722edc..e135b93601d 100644 --- a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/protocol/ec2query/build_bench_test.go +++ b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/protocol/ec2query/build_bench_test.go @@ -7,7 +7,7 @@ import ( "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/request" - "github.com/aws/aws-sdk-go/aws/service" + "github.com/aws/aws-sdk-go/awstesting" "github.com/aws/aws-sdk-go/private/protocol/ec2query" "github.com/aws/aws-sdk-go/service/ec2" ) @@ -67,7 +67,7 @@ func BenchmarkEC2QueryBuild_Simple_ec2AttachNetworkInterface(b *testing.B) { } func benchEC2QueryBuild(b *testing.B, opName string, params interface{}) { - svc := service.New(nil) + svc := awstesting.NewClient() svc.ServiceName = "ec2" svc.APIVersion = "2015-04-15" diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/protocol/ec2query/build_test.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/protocol/ec2query/build_test.go index a3846344d6b..887feeb1ea8 100644 --- a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/protocol/ec2query/build_test.go +++ b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/protocol/ec2query/build_test.go @@ -12,10 +12,10 @@ import ( "time" "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/defaults" + "github.com/aws/aws-sdk-go/aws/client" + "github.com/aws/aws-sdk-go/aws/client/metadata" "github.com/aws/aws-sdk-go/aws/request" - "github.com/aws/aws-sdk-go/aws/service" - "github.com/aws/aws-sdk-go/aws/service/serviceinfo" + "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/awstesting" "github.com/aws/aws-sdk-go/private/protocol/ec2query" "github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil" @@ -35,30 +35,52 @@ var _ = ioutil.Discard var _ = util.Trim("") var _ = url.Values{} var _ = io.EOF +var _ = aws.String +//The service client's operations are safe to be used concurrently. +// It is not safe to mutate any of the client's properties though. type InputService1ProtocolTest struct { - *service.Service + *client.Client } -// New returns a new InputService1ProtocolTest client. -func NewInputService1ProtocolTest(config *aws.Config) *InputService1ProtocolTest { - service := &service.Service{ - ServiceInfo: serviceinfo.ServiceInfo{ - Config: defaults.DefaultConfig.Merge(config), - ServiceName: "inputservice1protocoltest", - APIVersion: "2014-01-01", - }, +// New creates a new instance of the InputService1ProtocolTest client with a session. +// If additional configuration is needed for the client instance use the optional +// aws.Config parameter to add your extra config. +// +// Example: +// // Create a InputService1ProtocolTest client from just a session. +// svc := inputservice1protocoltest.New(mySession) +// +// // Create a InputService1ProtocolTest client with additional configuration +// svc := inputservice1protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) +func NewInputService1ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService1ProtocolTest { + c := p.ClientConfig("inputservice1protocoltest", cfgs...) + return newInputService1ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) +} + +// newClient creates, initializes and returns a new service client instance. +func newInputService1ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *InputService1ProtocolTest { + svc := &InputService1ProtocolTest{ + Client: client.New( + cfg, + metadata.ClientInfo{ + ServiceName: "inputservice1protocoltest", + SigningRegion: signingRegion, + Endpoint: endpoint, + APIVersion: "2014-01-01", + }, + handlers, + ), } - service.Initialize() // Handlers - service.Handlers.Sign.PushBack(v4.Sign) - service.Handlers.Build.PushBack(ec2query.Build) - service.Handlers.Unmarshal.PushBack(ec2query.Unmarshal) - service.Handlers.UnmarshalMeta.PushBack(ec2query.UnmarshalMeta) - service.Handlers.UnmarshalError.PushBack(ec2query.UnmarshalError) + svc.Handlers.Sign.PushBack(v4.Sign) + svc.Handlers.Build.PushBack(ec2query.Build) + svc.Handlers.Unmarshal.PushBack(ec2query.Unmarshal) + svc.Handlers.UnmarshalMeta.PushBack(ec2query.UnmarshalMeta) + svc.Handlers.UnmarshalError.PushBack(ec2query.UnmarshalError) - return &InputService1ProtocolTest{service} + return svc } // newRequest creates a new request for a InputService1ProtocolTest operation and runs any @@ -113,29 +135,50 @@ type metadataInputService1TestShapeInputService1TestCaseOperation1Output struct SDKShapeTraits bool `type:"structure"` } +//The service client's operations are safe to be used concurrently. +// It is not safe to mutate any of the client's properties though. type InputService2ProtocolTest struct { - *service.Service + *client.Client } -// New returns a new InputService2ProtocolTest client. -func NewInputService2ProtocolTest(config *aws.Config) *InputService2ProtocolTest { - service := &service.Service{ - ServiceInfo: serviceinfo.ServiceInfo{ - Config: defaults.DefaultConfig.Merge(config), - ServiceName: "inputservice2protocoltest", - APIVersion: "2014-01-01", - }, +// New creates a new instance of the InputService2ProtocolTest client with a session. +// If additional configuration is needed for the client instance use the optional +// aws.Config parameter to add your extra config. +// +// Example: +// // Create a InputService2ProtocolTest client from just a session. +// svc := inputservice2protocoltest.New(mySession) +// +// // Create a InputService2ProtocolTest client with additional configuration +// svc := inputservice2protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) +func NewInputService2ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService2ProtocolTest { + c := p.ClientConfig("inputservice2protocoltest", cfgs...) + return newInputService2ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) +} + +// newClient creates, initializes and returns a new service client instance. +func newInputService2ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *InputService2ProtocolTest { + svc := &InputService2ProtocolTest{ + Client: client.New( + cfg, + metadata.ClientInfo{ + ServiceName: "inputservice2protocoltest", + SigningRegion: signingRegion, + Endpoint: endpoint, + APIVersion: "2014-01-01", + }, + handlers, + ), } - service.Initialize() // Handlers - service.Handlers.Sign.PushBack(v4.Sign) - service.Handlers.Build.PushBack(ec2query.Build) - service.Handlers.Unmarshal.PushBack(ec2query.Unmarshal) - service.Handlers.UnmarshalMeta.PushBack(ec2query.UnmarshalMeta) - service.Handlers.UnmarshalError.PushBack(ec2query.UnmarshalError) + svc.Handlers.Sign.PushBack(v4.Sign) + svc.Handlers.Build.PushBack(ec2query.Build) + svc.Handlers.Unmarshal.PushBack(ec2query.Unmarshal) + svc.Handlers.UnmarshalMeta.PushBack(ec2query.UnmarshalMeta) + svc.Handlers.UnmarshalError.PushBack(ec2query.UnmarshalError) - return &InputService2ProtocolTest{service} + return svc } // newRequest creates a new request for a InputService2ProtocolTest operation and runs any @@ -192,29 +235,50 @@ type metadataInputService2TestShapeInputService2TestCaseOperation1Output struct SDKShapeTraits bool `type:"structure"` } +//The service client's operations are safe to be used concurrently. +// It is not safe to mutate any of the client's properties though. type InputService3ProtocolTest struct { - *service.Service + *client.Client } -// New returns a new InputService3ProtocolTest client. -func NewInputService3ProtocolTest(config *aws.Config) *InputService3ProtocolTest { - service := &service.Service{ - ServiceInfo: serviceinfo.ServiceInfo{ - Config: defaults.DefaultConfig.Merge(config), - ServiceName: "inputservice3protocoltest", - APIVersion: "2014-01-01", - }, +// New creates a new instance of the InputService3ProtocolTest client with a session. +// If additional configuration is needed for the client instance use the optional +// aws.Config parameter to add your extra config. +// +// Example: +// // Create a InputService3ProtocolTest client from just a session. +// svc := inputservice3protocoltest.New(mySession) +// +// // Create a InputService3ProtocolTest client with additional configuration +// svc := inputservice3protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) +func NewInputService3ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService3ProtocolTest { + c := p.ClientConfig("inputservice3protocoltest", cfgs...) + return newInputService3ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) +} + +// newClient creates, initializes and returns a new service client instance. +func newInputService3ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *InputService3ProtocolTest { + svc := &InputService3ProtocolTest{ + Client: client.New( + cfg, + metadata.ClientInfo{ + ServiceName: "inputservice3protocoltest", + SigningRegion: signingRegion, + Endpoint: endpoint, + APIVersion: "2014-01-01", + }, + handlers, + ), } - service.Initialize() // Handlers - service.Handlers.Sign.PushBack(v4.Sign) - service.Handlers.Build.PushBack(ec2query.Build) - service.Handlers.Unmarshal.PushBack(ec2query.Unmarshal) - service.Handlers.UnmarshalMeta.PushBack(ec2query.UnmarshalMeta) - service.Handlers.UnmarshalError.PushBack(ec2query.UnmarshalError) + svc.Handlers.Sign.PushBack(v4.Sign) + svc.Handlers.Build.PushBack(ec2query.Build) + svc.Handlers.Unmarshal.PushBack(ec2query.Unmarshal) + svc.Handlers.UnmarshalMeta.PushBack(ec2query.UnmarshalMeta) + svc.Handlers.UnmarshalError.PushBack(ec2query.UnmarshalError) - return &InputService3ProtocolTest{service} + return svc } // newRequest creates a new request for a InputService3ProtocolTest operation and runs any @@ -277,29 +341,50 @@ type metadataInputService3TestShapeStructType struct { SDKShapeTraits bool `type:"structure"` } +//The service client's operations are safe to be used concurrently. +// It is not safe to mutate any of the client's properties though. type InputService4ProtocolTest struct { - *service.Service + *client.Client } -// New returns a new InputService4ProtocolTest client. -func NewInputService4ProtocolTest(config *aws.Config) *InputService4ProtocolTest { - service := &service.Service{ - ServiceInfo: serviceinfo.ServiceInfo{ - Config: defaults.DefaultConfig.Merge(config), - ServiceName: "inputservice4protocoltest", - APIVersion: "2014-01-01", - }, +// New creates a new instance of the InputService4ProtocolTest client with a session. +// If additional configuration is needed for the client instance use the optional +// aws.Config parameter to add your extra config. +// +// Example: +// // Create a InputService4ProtocolTest client from just a session. +// svc := inputservice4protocoltest.New(mySession) +// +// // Create a InputService4ProtocolTest client with additional configuration +// svc := inputservice4protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) +func NewInputService4ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService4ProtocolTest { + c := p.ClientConfig("inputservice4protocoltest", cfgs...) + return newInputService4ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) +} + +// newClient creates, initializes and returns a new service client instance. +func newInputService4ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *InputService4ProtocolTest { + svc := &InputService4ProtocolTest{ + Client: client.New( + cfg, + metadata.ClientInfo{ + ServiceName: "inputservice4protocoltest", + SigningRegion: signingRegion, + Endpoint: endpoint, + APIVersion: "2014-01-01", + }, + handlers, + ), } - service.Initialize() // Handlers - service.Handlers.Sign.PushBack(v4.Sign) - service.Handlers.Build.PushBack(ec2query.Build) - service.Handlers.Unmarshal.PushBack(ec2query.Unmarshal) - service.Handlers.UnmarshalMeta.PushBack(ec2query.UnmarshalMeta) - service.Handlers.UnmarshalError.PushBack(ec2query.UnmarshalError) + svc.Handlers.Sign.PushBack(v4.Sign) + svc.Handlers.Build.PushBack(ec2query.Build) + svc.Handlers.Unmarshal.PushBack(ec2query.Unmarshal) + svc.Handlers.UnmarshalMeta.PushBack(ec2query.UnmarshalMeta) + svc.Handlers.UnmarshalError.PushBack(ec2query.UnmarshalError) - return &InputService4ProtocolTest{service} + return svc } // newRequest creates a new request for a InputService4ProtocolTest operation and runs any @@ -352,29 +437,50 @@ type metadataInputService4TestShapeInputService4TestCaseOperation1Output struct SDKShapeTraits bool `type:"structure"` } +//The service client's operations are safe to be used concurrently. +// It is not safe to mutate any of the client's properties though. type InputService5ProtocolTest struct { - *service.Service + *client.Client } -// New returns a new InputService5ProtocolTest client. -func NewInputService5ProtocolTest(config *aws.Config) *InputService5ProtocolTest { - service := &service.Service{ - ServiceInfo: serviceinfo.ServiceInfo{ - Config: defaults.DefaultConfig.Merge(config), - ServiceName: "inputservice5protocoltest", - APIVersion: "2014-01-01", - }, +// New creates a new instance of the InputService5ProtocolTest client with a session. +// If additional configuration is needed for the client instance use the optional +// aws.Config parameter to add your extra config. +// +// Example: +// // Create a InputService5ProtocolTest client from just a session. +// svc := inputservice5protocoltest.New(mySession) +// +// // Create a InputService5ProtocolTest client with additional configuration +// svc := inputservice5protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) +func NewInputService5ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService5ProtocolTest { + c := p.ClientConfig("inputservice5protocoltest", cfgs...) + return newInputService5ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) +} + +// newClient creates, initializes and returns a new service client instance. +func newInputService5ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *InputService5ProtocolTest { + svc := &InputService5ProtocolTest{ + Client: client.New( + cfg, + metadata.ClientInfo{ + ServiceName: "inputservice5protocoltest", + SigningRegion: signingRegion, + Endpoint: endpoint, + APIVersion: "2014-01-01", + }, + handlers, + ), } - service.Initialize() // Handlers - service.Handlers.Sign.PushBack(v4.Sign) - service.Handlers.Build.PushBack(ec2query.Build) - service.Handlers.Unmarshal.PushBack(ec2query.Unmarshal) - service.Handlers.UnmarshalMeta.PushBack(ec2query.UnmarshalMeta) - service.Handlers.UnmarshalError.PushBack(ec2query.UnmarshalError) + svc.Handlers.Sign.PushBack(v4.Sign) + svc.Handlers.Build.PushBack(ec2query.Build) + svc.Handlers.Unmarshal.PushBack(ec2query.Unmarshal) + svc.Handlers.UnmarshalMeta.PushBack(ec2query.UnmarshalMeta) + svc.Handlers.UnmarshalError.PushBack(ec2query.UnmarshalError) - return &InputService5ProtocolTest{service} + return svc } // newRequest creates a new request for a InputService5ProtocolTest operation and runs any @@ -427,29 +533,50 @@ type metadataInputService5TestShapeInputService5TestCaseOperation1Output struct SDKShapeTraits bool `type:"structure"` } +//The service client's operations are safe to be used concurrently. +// It is not safe to mutate any of the client's properties though. type InputService6ProtocolTest struct { - *service.Service + *client.Client } -// New returns a new InputService6ProtocolTest client. -func NewInputService6ProtocolTest(config *aws.Config) *InputService6ProtocolTest { - service := &service.Service{ - ServiceInfo: serviceinfo.ServiceInfo{ - Config: defaults.DefaultConfig.Merge(config), - ServiceName: "inputservice6protocoltest", - APIVersion: "2014-01-01", - }, +// New creates a new instance of the InputService6ProtocolTest client with a session. +// If additional configuration is needed for the client instance use the optional +// aws.Config parameter to add your extra config. +// +// Example: +// // Create a InputService6ProtocolTest client from just a session. +// svc := inputservice6protocoltest.New(mySession) +// +// // Create a InputService6ProtocolTest client with additional configuration +// svc := inputservice6protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) +func NewInputService6ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService6ProtocolTest { + c := p.ClientConfig("inputservice6protocoltest", cfgs...) + return newInputService6ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) +} + +// newClient creates, initializes and returns a new service client instance. +func newInputService6ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *InputService6ProtocolTest { + svc := &InputService6ProtocolTest{ + Client: client.New( + cfg, + metadata.ClientInfo{ + ServiceName: "inputservice6protocoltest", + SigningRegion: signingRegion, + Endpoint: endpoint, + APIVersion: "2014-01-01", + }, + handlers, + ), } - service.Initialize() // Handlers - service.Handlers.Sign.PushBack(v4.Sign) - service.Handlers.Build.PushBack(ec2query.Build) - service.Handlers.Unmarshal.PushBack(ec2query.Unmarshal) - service.Handlers.UnmarshalMeta.PushBack(ec2query.UnmarshalMeta) - service.Handlers.UnmarshalError.PushBack(ec2query.UnmarshalError) + svc.Handlers.Sign.PushBack(v4.Sign) + svc.Handlers.Build.PushBack(ec2query.Build) + svc.Handlers.Unmarshal.PushBack(ec2query.Unmarshal) + svc.Handlers.UnmarshalMeta.PushBack(ec2query.UnmarshalMeta) + svc.Handlers.UnmarshalError.PushBack(ec2query.UnmarshalError) - return &InputService6ProtocolTest{service} + return svc } // newRequest creates a new request for a InputService6ProtocolTest operation and runs any @@ -502,29 +629,50 @@ type metadataInputService6TestShapeInputService6TestCaseOperation1Output struct SDKShapeTraits bool `type:"structure"` } +//The service client's operations are safe to be used concurrently. +// It is not safe to mutate any of the client's properties though. type InputService7ProtocolTest struct { - *service.Service + *client.Client } -// New returns a new InputService7ProtocolTest client. -func NewInputService7ProtocolTest(config *aws.Config) *InputService7ProtocolTest { - service := &service.Service{ - ServiceInfo: serviceinfo.ServiceInfo{ - Config: defaults.DefaultConfig.Merge(config), - ServiceName: "inputservice7protocoltest", - APIVersion: "2014-01-01", - }, +// New creates a new instance of the InputService7ProtocolTest client with a session. +// If additional configuration is needed for the client instance use the optional +// aws.Config parameter to add your extra config. +// +// Example: +// // Create a InputService7ProtocolTest client from just a session. +// svc := inputservice7protocoltest.New(mySession) +// +// // Create a InputService7ProtocolTest client with additional configuration +// svc := inputservice7protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) +func NewInputService7ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService7ProtocolTest { + c := p.ClientConfig("inputservice7protocoltest", cfgs...) + return newInputService7ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) +} + +// newClient creates, initializes and returns a new service client instance. +func newInputService7ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *InputService7ProtocolTest { + svc := &InputService7ProtocolTest{ + Client: client.New( + cfg, + metadata.ClientInfo{ + ServiceName: "inputservice7protocoltest", + SigningRegion: signingRegion, + Endpoint: endpoint, + APIVersion: "2014-01-01", + }, + handlers, + ), } - service.Initialize() // Handlers - service.Handlers.Sign.PushBack(v4.Sign) - service.Handlers.Build.PushBack(ec2query.Build) - service.Handlers.Unmarshal.PushBack(ec2query.Unmarshal) - service.Handlers.UnmarshalMeta.PushBack(ec2query.UnmarshalMeta) - service.Handlers.UnmarshalError.PushBack(ec2query.UnmarshalError) + svc.Handlers.Sign.PushBack(v4.Sign) + svc.Handlers.Build.PushBack(ec2query.Build) + svc.Handlers.Unmarshal.PushBack(ec2query.Unmarshal) + svc.Handlers.UnmarshalMeta.PushBack(ec2query.UnmarshalMeta) + svc.Handlers.UnmarshalError.PushBack(ec2query.UnmarshalError) - return &InputService7ProtocolTest{service} + return svc } // newRequest creates a new request for a InputService7ProtocolTest operation and runs any @@ -577,29 +725,50 @@ type metadataInputService7TestShapeInputService7TestCaseOperation1Output struct SDKShapeTraits bool `type:"structure"` } +//The service client's operations are safe to be used concurrently. +// It is not safe to mutate any of the client's properties though. type InputService8ProtocolTest struct { - *service.Service + *client.Client } -// New returns a new InputService8ProtocolTest client. -func NewInputService8ProtocolTest(config *aws.Config) *InputService8ProtocolTest { - service := &service.Service{ - ServiceInfo: serviceinfo.ServiceInfo{ - Config: defaults.DefaultConfig.Merge(config), - ServiceName: "inputservice8protocoltest", - APIVersion: "2014-01-01", - }, +// New creates a new instance of the InputService8ProtocolTest client with a session. +// If additional configuration is needed for the client instance use the optional +// aws.Config parameter to add your extra config. +// +// Example: +// // Create a InputService8ProtocolTest client from just a session. +// svc := inputservice8protocoltest.New(mySession) +// +// // Create a InputService8ProtocolTest client with additional configuration +// svc := inputservice8protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) +func NewInputService8ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService8ProtocolTest { + c := p.ClientConfig("inputservice8protocoltest", cfgs...) + return newInputService8ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) +} + +// newClient creates, initializes and returns a new service client instance. +func newInputService8ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *InputService8ProtocolTest { + svc := &InputService8ProtocolTest{ + Client: client.New( + cfg, + metadata.ClientInfo{ + ServiceName: "inputservice8protocoltest", + SigningRegion: signingRegion, + Endpoint: endpoint, + APIVersion: "2014-01-01", + }, + handlers, + ), } - service.Initialize() // Handlers - service.Handlers.Sign.PushBack(v4.Sign) - service.Handlers.Build.PushBack(ec2query.Build) - service.Handlers.Unmarshal.PushBack(ec2query.Unmarshal) - service.Handlers.UnmarshalMeta.PushBack(ec2query.UnmarshalMeta) - service.Handlers.UnmarshalError.PushBack(ec2query.UnmarshalError) + svc.Handlers.Sign.PushBack(v4.Sign) + svc.Handlers.Build.PushBack(ec2query.Build) + svc.Handlers.Unmarshal.PushBack(ec2query.Unmarshal) + svc.Handlers.UnmarshalMeta.PushBack(ec2query.UnmarshalMeta) + svc.Handlers.UnmarshalError.PushBack(ec2query.UnmarshalError) - return &InputService8ProtocolTest{service} + return svc } // newRequest creates a new request for a InputService8ProtocolTest operation and runs any @@ -657,8 +826,8 @@ type metadataInputService8TestShapeInputService8TestCaseOperation1Output struct // func TestInputService1ProtocolTestScalarMembersCase1(t *testing.T) { - svc := NewInputService1ProtocolTest(nil) - svc.Endpoint = "https://test" + sess := session.New() + svc := NewInputService1ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) input := &InputService1TestShapeInputService1TestCaseOperation1Input{ Bar: aws.String("val2"), @@ -684,8 +853,8 @@ func TestInputService1ProtocolTestScalarMembersCase1(t *testing.T) { } func TestInputService2ProtocolTestStructureWithLocationNameAndQueryNameAppliedToMembersCase1(t *testing.T) { - svc := NewInputService2ProtocolTest(nil) - svc.Endpoint = "https://test" + sess := session.New() + svc := NewInputService2ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) input := &InputService2TestShapeInputService2TestCaseOperation1Input{ Bar: aws.String("val2"), @@ -712,8 +881,8 @@ func TestInputService2ProtocolTestStructureWithLocationNameAndQueryNameAppliedTo } func TestInputService3ProtocolTestNestedStructureMembersCase1(t *testing.T) { - svc := NewInputService3ProtocolTest(nil) - svc.Endpoint = "https://test" + sess := session.New() + svc := NewInputService3ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) input := &InputService3TestShapeInputService3TestCaseOperation1Input{ StructArg: &InputService3TestShapeStructType{ @@ -740,8 +909,8 @@ func TestInputService3ProtocolTestNestedStructureMembersCase1(t *testing.T) { } func TestInputService4ProtocolTestListTypesCase1(t *testing.T) { - svc := NewInputService4ProtocolTest(nil) - svc.Endpoint = "https://test" + sess := session.New() + svc := NewInputService4ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) input := &InputService4TestShapeInputService4TestCaseOperation1Input{ ListArg: []*string{ @@ -770,8 +939,8 @@ func TestInputService4ProtocolTestListTypesCase1(t *testing.T) { } func TestInputService5ProtocolTestListWithLocationNameAppliedToMemberCase1(t *testing.T) { - svc := NewInputService5ProtocolTest(nil) - svc.Endpoint = "https://test" + sess := session.New() + svc := NewInputService5ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) input := &InputService5TestShapeInputService5TestCaseOperation1Input{ ListArg: []*string{ @@ -800,8 +969,8 @@ func TestInputService5ProtocolTestListWithLocationNameAppliedToMemberCase1(t *te } func TestInputService6ProtocolTestListWithLocationNameAndQueryNameCase1(t *testing.T) { - svc := NewInputService6ProtocolTest(nil) - svc.Endpoint = "https://test" + sess := session.New() + svc := NewInputService6ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) input := &InputService6TestShapeInputService6TestCaseOperation1Input{ ListArg: []*string{ @@ -830,8 +999,8 @@ func TestInputService6ProtocolTestListWithLocationNameAndQueryNameCase1(t *testi } func TestInputService7ProtocolTestBase64EncodedBlobsCase1(t *testing.T) { - svc := NewInputService7ProtocolTest(nil) - svc.Endpoint = "https://test" + sess := session.New() + svc := NewInputService7ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) input := &InputService7TestShapeInputService7TestCaseOperation1Input{ BlobArg: []byte("foo"), @@ -856,8 +1025,8 @@ func TestInputService7ProtocolTestBase64EncodedBlobsCase1(t *testing.T) { } func TestInputService8ProtocolTestTimestampValuesCase1(t *testing.T) { - svc := NewInputService8ProtocolTest(nil) - svc.Endpoint = "https://test" + sess := session.New() + svc := NewInputService8ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) input := &InputService8TestShapeInputService8TestCaseOperation1Input{ TimeArg: aws.Time(time.Unix(1422172800, 0)), diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/protocol/ec2query/unmarshal_test.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/protocol/ec2query/unmarshal_test.go index b9ee3dc7667..c347c371c10 100644 --- a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/protocol/ec2query/unmarshal_test.go +++ b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/protocol/ec2query/unmarshal_test.go @@ -12,10 +12,10 @@ import ( "time" "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/defaults" + "github.com/aws/aws-sdk-go/aws/client" + "github.com/aws/aws-sdk-go/aws/client/metadata" "github.com/aws/aws-sdk-go/aws/request" - "github.com/aws/aws-sdk-go/aws/service" - "github.com/aws/aws-sdk-go/aws/service/serviceinfo" + "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/awstesting" "github.com/aws/aws-sdk-go/private/protocol/ec2query" "github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil" @@ -35,30 +35,52 @@ var _ = ioutil.Discard var _ = util.Trim("") var _ = url.Values{} var _ = io.EOF +var _ = aws.String +//The service client's operations are safe to be used concurrently. +// It is not safe to mutate any of the client's properties though. type OutputService1ProtocolTest struct { - *service.Service + *client.Client } -// New returns a new OutputService1ProtocolTest client. -func NewOutputService1ProtocolTest(config *aws.Config) *OutputService1ProtocolTest { - service := &service.Service{ - ServiceInfo: serviceinfo.ServiceInfo{ - Config: defaults.DefaultConfig.Merge(config), - ServiceName: "outputservice1protocoltest", - APIVersion: "", - }, +// New creates a new instance of the OutputService1ProtocolTest client with a session. +// If additional configuration is needed for the client instance use the optional +// aws.Config parameter to add your extra config. +// +// Example: +// // Create a OutputService1ProtocolTest client from just a session. +// svc := outputservice1protocoltest.New(mySession) +// +// // Create a OutputService1ProtocolTest client with additional configuration +// svc := outputservice1protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) +func NewOutputService1ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService1ProtocolTest { + c := p.ClientConfig("outputservice1protocoltest", cfgs...) + return newOutputService1ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) +} + +// newClient creates, initializes and returns a new service client instance. +func newOutputService1ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *OutputService1ProtocolTest { + svc := &OutputService1ProtocolTest{ + Client: client.New( + cfg, + metadata.ClientInfo{ + ServiceName: "outputservice1protocoltest", + SigningRegion: signingRegion, + Endpoint: endpoint, + APIVersion: "", + }, + handlers, + ), } - service.Initialize() // Handlers - service.Handlers.Sign.PushBack(v4.Sign) - service.Handlers.Build.PushBack(ec2query.Build) - service.Handlers.Unmarshal.PushBack(ec2query.Unmarshal) - service.Handlers.UnmarshalMeta.PushBack(ec2query.UnmarshalMeta) - service.Handlers.UnmarshalError.PushBack(ec2query.UnmarshalError) + svc.Handlers.Sign.PushBack(v4.Sign) + svc.Handlers.Build.PushBack(ec2query.Build) + svc.Handlers.Unmarshal.PushBack(ec2query.Unmarshal) + svc.Handlers.UnmarshalMeta.PushBack(ec2query.UnmarshalMeta) + svc.Handlers.UnmarshalError.PushBack(ec2query.UnmarshalError) - return &OutputService1ProtocolTest{service} + return svc } // newRequest creates a new request for a OutputService1ProtocolTest operation and runs any @@ -125,29 +147,50 @@ type metadataOutputService1TestShapeOutputService1TestCaseOperation1Output struc SDKShapeTraits bool `type:"structure"` } +//The service client's operations are safe to be used concurrently. +// It is not safe to mutate any of the client's properties though. type OutputService2ProtocolTest struct { - *service.Service + *client.Client } -// New returns a new OutputService2ProtocolTest client. -func NewOutputService2ProtocolTest(config *aws.Config) *OutputService2ProtocolTest { - service := &service.Service{ - ServiceInfo: serviceinfo.ServiceInfo{ - Config: defaults.DefaultConfig.Merge(config), - ServiceName: "outputservice2protocoltest", - APIVersion: "", - }, +// New creates a new instance of the OutputService2ProtocolTest client with a session. +// If additional configuration is needed for the client instance use the optional +// aws.Config parameter to add your extra config. +// +// Example: +// // Create a OutputService2ProtocolTest client from just a session. +// svc := outputservice2protocoltest.New(mySession) +// +// // Create a OutputService2ProtocolTest client with additional configuration +// svc := outputservice2protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) +func NewOutputService2ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService2ProtocolTest { + c := p.ClientConfig("outputservice2protocoltest", cfgs...) + return newOutputService2ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) +} + +// newClient creates, initializes and returns a new service client instance. +func newOutputService2ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *OutputService2ProtocolTest { + svc := &OutputService2ProtocolTest{ + Client: client.New( + cfg, + metadata.ClientInfo{ + ServiceName: "outputservice2protocoltest", + SigningRegion: signingRegion, + Endpoint: endpoint, + APIVersion: "", + }, + handlers, + ), } - service.Initialize() // Handlers - service.Handlers.Sign.PushBack(v4.Sign) - service.Handlers.Build.PushBack(ec2query.Build) - service.Handlers.Unmarshal.PushBack(ec2query.Unmarshal) - service.Handlers.UnmarshalMeta.PushBack(ec2query.UnmarshalMeta) - service.Handlers.UnmarshalError.PushBack(ec2query.UnmarshalError) + svc.Handlers.Sign.PushBack(v4.Sign) + svc.Handlers.Build.PushBack(ec2query.Build) + svc.Handlers.Unmarshal.PushBack(ec2query.Unmarshal) + svc.Handlers.UnmarshalMeta.PushBack(ec2query.UnmarshalMeta) + svc.Handlers.UnmarshalError.PushBack(ec2query.UnmarshalError) - return &OutputService2ProtocolTest{service} + return svc } // newRequest creates a new request for a OutputService2ProtocolTest operation and runs any @@ -200,29 +243,50 @@ type metadataOutputService2TestShapeOutputService2TestCaseOperation1Output struc SDKShapeTraits bool `type:"structure"` } +//The service client's operations are safe to be used concurrently. +// It is not safe to mutate any of the client's properties though. type OutputService3ProtocolTest struct { - *service.Service + *client.Client } -// New returns a new OutputService3ProtocolTest client. -func NewOutputService3ProtocolTest(config *aws.Config) *OutputService3ProtocolTest { - service := &service.Service{ - ServiceInfo: serviceinfo.ServiceInfo{ - Config: defaults.DefaultConfig.Merge(config), - ServiceName: "outputservice3protocoltest", - APIVersion: "", - }, +// New creates a new instance of the OutputService3ProtocolTest client with a session. +// If additional configuration is needed for the client instance use the optional +// aws.Config parameter to add your extra config. +// +// Example: +// // Create a OutputService3ProtocolTest client from just a session. +// svc := outputservice3protocoltest.New(mySession) +// +// // Create a OutputService3ProtocolTest client with additional configuration +// svc := outputservice3protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) +func NewOutputService3ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService3ProtocolTest { + c := p.ClientConfig("outputservice3protocoltest", cfgs...) + return newOutputService3ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) +} + +// newClient creates, initializes and returns a new service client instance. +func newOutputService3ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *OutputService3ProtocolTest { + svc := &OutputService3ProtocolTest{ + Client: client.New( + cfg, + metadata.ClientInfo{ + ServiceName: "outputservice3protocoltest", + SigningRegion: signingRegion, + Endpoint: endpoint, + APIVersion: "", + }, + handlers, + ), } - service.Initialize() // Handlers - service.Handlers.Sign.PushBack(v4.Sign) - service.Handlers.Build.PushBack(ec2query.Build) - service.Handlers.Unmarshal.PushBack(ec2query.Unmarshal) - service.Handlers.UnmarshalMeta.PushBack(ec2query.UnmarshalMeta) - service.Handlers.UnmarshalError.PushBack(ec2query.UnmarshalError) + svc.Handlers.Sign.PushBack(v4.Sign) + svc.Handlers.Build.PushBack(ec2query.Build) + svc.Handlers.Unmarshal.PushBack(ec2query.Unmarshal) + svc.Handlers.UnmarshalMeta.PushBack(ec2query.UnmarshalMeta) + svc.Handlers.UnmarshalError.PushBack(ec2query.UnmarshalError) - return &OutputService3ProtocolTest{service} + return svc } // newRequest creates a new request for a OutputService3ProtocolTest operation and runs any @@ -275,29 +339,50 @@ type metadataOutputService3TestShapeOutputService3TestCaseOperation1Output struc SDKShapeTraits bool `type:"structure"` } +//The service client's operations are safe to be used concurrently. +// It is not safe to mutate any of the client's properties though. type OutputService4ProtocolTest struct { - *service.Service + *client.Client } -// New returns a new OutputService4ProtocolTest client. -func NewOutputService4ProtocolTest(config *aws.Config) *OutputService4ProtocolTest { - service := &service.Service{ - ServiceInfo: serviceinfo.ServiceInfo{ - Config: defaults.DefaultConfig.Merge(config), - ServiceName: "outputservice4protocoltest", - APIVersion: "", - }, +// New creates a new instance of the OutputService4ProtocolTest client with a session. +// If additional configuration is needed for the client instance use the optional +// aws.Config parameter to add your extra config. +// +// Example: +// // Create a OutputService4ProtocolTest client from just a session. +// svc := outputservice4protocoltest.New(mySession) +// +// // Create a OutputService4ProtocolTest client with additional configuration +// svc := outputservice4protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) +func NewOutputService4ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService4ProtocolTest { + c := p.ClientConfig("outputservice4protocoltest", cfgs...) + return newOutputService4ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) +} + +// newClient creates, initializes and returns a new service client instance. +func newOutputService4ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *OutputService4ProtocolTest { + svc := &OutputService4ProtocolTest{ + Client: client.New( + cfg, + metadata.ClientInfo{ + ServiceName: "outputservice4protocoltest", + SigningRegion: signingRegion, + Endpoint: endpoint, + APIVersion: "", + }, + handlers, + ), } - service.Initialize() // Handlers - service.Handlers.Sign.PushBack(v4.Sign) - service.Handlers.Build.PushBack(ec2query.Build) - service.Handlers.Unmarshal.PushBack(ec2query.Unmarshal) - service.Handlers.UnmarshalMeta.PushBack(ec2query.UnmarshalMeta) - service.Handlers.UnmarshalError.PushBack(ec2query.UnmarshalError) + svc.Handlers.Sign.PushBack(v4.Sign) + svc.Handlers.Build.PushBack(ec2query.Build) + svc.Handlers.Unmarshal.PushBack(ec2query.Unmarshal) + svc.Handlers.UnmarshalMeta.PushBack(ec2query.UnmarshalMeta) + svc.Handlers.UnmarshalError.PushBack(ec2query.UnmarshalError) - return &OutputService4ProtocolTest{service} + return svc } // newRequest creates a new request for a OutputService4ProtocolTest operation and runs any @@ -350,29 +435,50 @@ type metadataOutputService4TestShapeOutputService4TestCaseOperation1Output struc SDKShapeTraits bool `type:"structure"` } +//The service client's operations are safe to be used concurrently. +// It is not safe to mutate any of the client's properties though. type OutputService5ProtocolTest struct { - *service.Service + *client.Client } -// New returns a new OutputService5ProtocolTest client. -func NewOutputService5ProtocolTest(config *aws.Config) *OutputService5ProtocolTest { - service := &service.Service{ - ServiceInfo: serviceinfo.ServiceInfo{ - Config: defaults.DefaultConfig.Merge(config), - ServiceName: "outputservice5protocoltest", - APIVersion: "", - }, +// New creates a new instance of the OutputService5ProtocolTest client with a session. +// If additional configuration is needed for the client instance use the optional +// aws.Config parameter to add your extra config. +// +// Example: +// // Create a OutputService5ProtocolTest client from just a session. +// svc := outputservice5protocoltest.New(mySession) +// +// // Create a OutputService5ProtocolTest client with additional configuration +// svc := outputservice5protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) +func NewOutputService5ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService5ProtocolTest { + c := p.ClientConfig("outputservice5protocoltest", cfgs...) + return newOutputService5ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) +} + +// newClient creates, initializes and returns a new service client instance. +func newOutputService5ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *OutputService5ProtocolTest { + svc := &OutputService5ProtocolTest{ + Client: client.New( + cfg, + metadata.ClientInfo{ + ServiceName: "outputservice5protocoltest", + SigningRegion: signingRegion, + Endpoint: endpoint, + APIVersion: "", + }, + handlers, + ), } - service.Initialize() // Handlers - service.Handlers.Sign.PushBack(v4.Sign) - service.Handlers.Build.PushBack(ec2query.Build) - service.Handlers.Unmarshal.PushBack(ec2query.Unmarshal) - service.Handlers.UnmarshalMeta.PushBack(ec2query.UnmarshalMeta) - service.Handlers.UnmarshalError.PushBack(ec2query.UnmarshalError) + svc.Handlers.Sign.PushBack(v4.Sign) + svc.Handlers.Build.PushBack(ec2query.Build) + svc.Handlers.Unmarshal.PushBack(ec2query.Unmarshal) + svc.Handlers.UnmarshalMeta.PushBack(ec2query.UnmarshalMeta) + svc.Handlers.UnmarshalError.PushBack(ec2query.UnmarshalError) - return &OutputService5ProtocolTest{service} + return svc } // newRequest creates a new request for a OutputService5ProtocolTest operation and runs any @@ -425,29 +531,50 @@ type metadataOutputService5TestShapeOutputService5TestCaseOperation1Output struc SDKShapeTraits bool `type:"structure"` } +//The service client's operations are safe to be used concurrently. +// It is not safe to mutate any of the client's properties though. type OutputService6ProtocolTest struct { - *service.Service + *client.Client } -// New returns a new OutputService6ProtocolTest client. -func NewOutputService6ProtocolTest(config *aws.Config) *OutputService6ProtocolTest { - service := &service.Service{ - ServiceInfo: serviceinfo.ServiceInfo{ - Config: defaults.DefaultConfig.Merge(config), - ServiceName: "outputservice6protocoltest", - APIVersion: "", - }, +// New creates a new instance of the OutputService6ProtocolTest client with a session. +// If additional configuration is needed for the client instance use the optional +// aws.Config parameter to add your extra config. +// +// Example: +// // Create a OutputService6ProtocolTest client from just a session. +// svc := outputservice6protocoltest.New(mySession) +// +// // Create a OutputService6ProtocolTest client with additional configuration +// svc := outputservice6protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) +func NewOutputService6ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService6ProtocolTest { + c := p.ClientConfig("outputservice6protocoltest", cfgs...) + return newOutputService6ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) +} + +// newClient creates, initializes and returns a new service client instance. +func newOutputService6ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *OutputService6ProtocolTest { + svc := &OutputService6ProtocolTest{ + Client: client.New( + cfg, + metadata.ClientInfo{ + ServiceName: "outputservice6protocoltest", + SigningRegion: signingRegion, + Endpoint: endpoint, + APIVersion: "", + }, + handlers, + ), } - service.Initialize() // Handlers - service.Handlers.Sign.PushBack(v4.Sign) - service.Handlers.Build.PushBack(ec2query.Build) - service.Handlers.Unmarshal.PushBack(ec2query.Unmarshal) - service.Handlers.UnmarshalMeta.PushBack(ec2query.UnmarshalMeta) - service.Handlers.UnmarshalError.PushBack(ec2query.UnmarshalError) + svc.Handlers.Sign.PushBack(v4.Sign) + svc.Handlers.Build.PushBack(ec2query.Build) + svc.Handlers.Unmarshal.PushBack(ec2query.Unmarshal) + svc.Handlers.UnmarshalMeta.PushBack(ec2query.UnmarshalMeta) + svc.Handlers.UnmarshalError.PushBack(ec2query.UnmarshalError) - return &OutputService6ProtocolTest{service} + return svc } // newRequest creates a new request for a OutputService6ProtocolTest operation and runs any @@ -510,29 +637,50 @@ type metadataOutputService6TestShapeStructureType struct { SDKShapeTraits bool `type:"structure"` } +//The service client's operations are safe to be used concurrently. +// It is not safe to mutate any of the client's properties though. type OutputService7ProtocolTest struct { - *service.Service + *client.Client } -// New returns a new OutputService7ProtocolTest client. -func NewOutputService7ProtocolTest(config *aws.Config) *OutputService7ProtocolTest { - service := &service.Service{ - ServiceInfo: serviceinfo.ServiceInfo{ - Config: defaults.DefaultConfig.Merge(config), - ServiceName: "outputservice7protocoltest", - APIVersion: "", - }, +// New creates a new instance of the OutputService7ProtocolTest client with a session. +// If additional configuration is needed for the client instance use the optional +// aws.Config parameter to add your extra config. +// +// Example: +// // Create a OutputService7ProtocolTest client from just a session. +// svc := outputservice7protocoltest.New(mySession) +// +// // Create a OutputService7ProtocolTest client with additional configuration +// svc := outputservice7protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) +func NewOutputService7ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService7ProtocolTest { + c := p.ClientConfig("outputservice7protocoltest", cfgs...) + return newOutputService7ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) +} + +// newClient creates, initializes and returns a new service client instance. +func newOutputService7ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *OutputService7ProtocolTest { + svc := &OutputService7ProtocolTest{ + Client: client.New( + cfg, + metadata.ClientInfo{ + ServiceName: "outputservice7protocoltest", + SigningRegion: signingRegion, + Endpoint: endpoint, + APIVersion: "", + }, + handlers, + ), } - service.Initialize() // Handlers - service.Handlers.Sign.PushBack(v4.Sign) - service.Handlers.Build.PushBack(ec2query.Build) - service.Handlers.Unmarshal.PushBack(ec2query.Unmarshal) - service.Handlers.UnmarshalMeta.PushBack(ec2query.UnmarshalMeta) - service.Handlers.UnmarshalError.PushBack(ec2query.UnmarshalError) + svc.Handlers.Sign.PushBack(v4.Sign) + svc.Handlers.Build.PushBack(ec2query.Build) + svc.Handlers.Unmarshal.PushBack(ec2query.Unmarshal) + svc.Handlers.UnmarshalMeta.PushBack(ec2query.UnmarshalMeta) + svc.Handlers.UnmarshalError.PushBack(ec2query.UnmarshalError) - return &OutputService7ProtocolTest{service} + return svc } // newRequest creates a new request for a OutputService7ProtocolTest operation and runs any @@ -585,29 +733,50 @@ type metadataOutputService7TestShapeOutputService7TestCaseOperation1Output struc SDKShapeTraits bool `type:"structure"` } +//The service client's operations are safe to be used concurrently. +// It is not safe to mutate any of the client's properties though. type OutputService8ProtocolTest struct { - *service.Service + *client.Client } -// New returns a new OutputService8ProtocolTest client. -func NewOutputService8ProtocolTest(config *aws.Config) *OutputService8ProtocolTest { - service := &service.Service{ - ServiceInfo: serviceinfo.ServiceInfo{ - Config: defaults.DefaultConfig.Merge(config), - ServiceName: "outputservice8protocoltest", - APIVersion: "", - }, +// New creates a new instance of the OutputService8ProtocolTest client with a session. +// If additional configuration is needed for the client instance use the optional +// aws.Config parameter to add your extra config. +// +// Example: +// // Create a OutputService8ProtocolTest client from just a session. +// svc := outputservice8protocoltest.New(mySession) +// +// // Create a OutputService8ProtocolTest client with additional configuration +// svc := outputservice8protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) +func NewOutputService8ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService8ProtocolTest { + c := p.ClientConfig("outputservice8protocoltest", cfgs...) + return newOutputService8ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) +} + +// newClient creates, initializes and returns a new service client instance. +func newOutputService8ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *OutputService8ProtocolTest { + svc := &OutputService8ProtocolTest{ + Client: client.New( + cfg, + metadata.ClientInfo{ + ServiceName: "outputservice8protocoltest", + SigningRegion: signingRegion, + Endpoint: endpoint, + APIVersion: "", + }, + handlers, + ), } - service.Initialize() // Handlers - service.Handlers.Sign.PushBack(v4.Sign) - service.Handlers.Build.PushBack(ec2query.Build) - service.Handlers.Unmarshal.PushBack(ec2query.Unmarshal) - service.Handlers.UnmarshalMeta.PushBack(ec2query.UnmarshalMeta) - service.Handlers.UnmarshalError.PushBack(ec2query.UnmarshalError) + svc.Handlers.Sign.PushBack(v4.Sign) + svc.Handlers.Build.PushBack(ec2query.Build) + svc.Handlers.Unmarshal.PushBack(ec2query.Unmarshal) + svc.Handlers.UnmarshalMeta.PushBack(ec2query.UnmarshalMeta) + svc.Handlers.UnmarshalError.PushBack(ec2query.UnmarshalError) - return &OutputService8ProtocolTest{service} + return svc } // newRequest creates a new request for a OutputService8ProtocolTest operation and runs any @@ -660,12 +829,109 @@ type metadataOutputService8TestShapeOutputService8TestCaseOperation1Output struc SDKShapeTraits bool `type:"structure"` } +//The service client's operations are safe to be used concurrently. +// It is not safe to mutate any of the client's properties though. +type OutputService9ProtocolTest struct { + *client.Client +} + +// New creates a new instance of the OutputService9ProtocolTest client with a session. +// If additional configuration is needed for the client instance use the optional +// aws.Config parameter to add your extra config. +// +// Example: +// // Create a OutputService9ProtocolTest client from just a session. +// svc := outputservice9protocoltest.New(mySession) +// +// // Create a OutputService9ProtocolTest client with additional configuration +// svc := outputservice9protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) +func NewOutputService9ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService9ProtocolTest { + c := p.ClientConfig("outputservice9protocoltest", cfgs...) + return newOutputService9ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) +} + +// newClient creates, initializes and returns a new service client instance. +func newOutputService9ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *OutputService9ProtocolTest { + svc := &OutputService9ProtocolTest{ + Client: client.New( + cfg, + metadata.ClientInfo{ + ServiceName: "outputservice9protocoltest", + SigningRegion: signingRegion, + Endpoint: endpoint, + APIVersion: "", + }, + handlers, + ), + } + + // Handlers + svc.Handlers.Sign.PushBack(v4.Sign) + svc.Handlers.Build.PushBack(ec2query.Build) + svc.Handlers.Unmarshal.PushBack(ec2query.Unmarshal) + svc.Handlers.UnmarshalMeta.PushBack(ec2query.UnmarshalMeta) + svc.Handlers.UnmarshalError.PushBack(ec2query.UnmarshalError) + + return svc +} + +// newRequest creates a new request for a OutputService9ProtocolTest operation and runs any +// custom request initialization. +func (c *OutputService9ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { + req := c.NewRequest(op, params, data) + + return req +} + +const opOutputService9TestCaseOperation1 = "OperationName" + +// OutputService9TestCaseOperation1Request generates a request for the OutputService9TestCaseOperation1 operation. +func (c *OutputService9ProtocolTest) OutputService9TestCaseOperation1Request(input *OutputService9TestShapeOutputService9TestCaseOperation1Input) (req *request.Request, output *OutputService9TestShapeOutputService9TestCaseOperation1Output) { + op := &request.Operation{ + Name: opOutputService9TestCaseOperation1, + } + + if input == nil { + input = &OutputService9TestShapeOutputService9TestCaseOperation1Input{} + } + + req = c.newRequest(op, input, output) + output = &OutputService9TestShapeOutputService9TestCaseOperation1Output{} + req.Data = output + return +} + +func (c *OutputService9ProtocolTest) OutputService9TestCaseOperation1(input *OutputService9TestShapeOutputService9TestCaseOperation1Input) (*OutputService9TestShapeOutputService9TestCaseOperation1Output, error) { + req, out := c.OutputService9TestCaseOperation1Request(input) + err := req.Send() + return out, err +} + +type OutputService9TestShapeOutputService9TestCaseOperation1Input struct { + metadataOutputService9TestShapeOutputService9TestCaseOperation1Input `json:"-" xml:"-"` +} + +type metadataOutputService9TestShapeOutputService9TestCaseOperation1Input struct { + SDKShapeTraits bool `type:"structure"` +} + +type OutputService9TestShapeOutputService9TestCaseOperation1Output struct { + Foo *string `type:"string"` + + metadataOutputService9TestShapeOutputService9TestCaseOperation1Output `json:"-" xml:"-"` +} + +type metadataOutputService9TestShapeOutputService9TestCaseOperation1Output struct { + SDKShapeTraits bool `type:"structure"` +} + // // Tests begin here // func TestOutputService1ProtocolTestScalarMembersCase1(t *testing.T) { - svc := NewOutputService1ProtocolTest(nil) + sess := session.New() + svc := NewOutputService1ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) buf := bytes.NewReader([]byte("myname123falsetrue1.21.3200arequest-id")) req, out := svc.OutputService1TestCaseOperation1Request(nil) @@ -692,7 +958,8 @@ func TestOutputService1ProtocolTestScalarMembersCase1(t *testing.T) { } func TestOutputService2ProtocolTestBlobCase1(t *testing.T) { - svc := NewOutputService2ProtocolTest(nil) + sess := session.New() + svc := NewOutputService2ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) buf := bytes.NewReader([]byte("dmFsdWU=requestid")) req, out := svc.OutputService2TestCaseOperation1Request(nil) @@ -712,7 +979,8 @@ func TestOutputService2ProtocolTestBlobCase1(t *testing.T) { } func TestOutputService3ProtocolTestListsCase1(t *testing.T) { - svc := NewOutputService3ProtocolTest(nil) + sess := session.New() + svc := NewOutputService3ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) buf := bytes.NewReader([]byte("abc123requestid")) req, out := svc.OutputService3TestCaseOperation1Request(nil) @@ -733,7 +1001,8 @@ func TestOutputService3ProtocolTestListsCase1(t *testing.T) { } func TestOutputService4ProtocolTestListWithCustomMemberNameCase1(t *testing.T) { - svc := NewOutputService4ProtocolTest(nil) + sess := session.New() + svc := NewOutputService4ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) buf := bytes.NewReader([]byte("abc123requestid")) req, out := svc.OutputService4TestCaseOperation1Request(nil) @@ -754,7 +1023,8 @@ func TestOutputService4ProtocolTestListWithCustomMemberNameCase1(t *testing.T) { } func TestOutputService5ProtocolTestFlattenedListCase1(t *testing.T) { - svc := NewOutputService5ProtocolTest(nil) + sess := session.New() + svc := NewOutputService5ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) buf := bytes.NewReader([]byte("abc123requestid")) req, out := svc.OutputService5TestCaseOperation1Request(nil) @@ -775,7 +1045,8 @@ func TestOutputService5ProtocolTestFlattenedListCase1(t *testing.T) { } func TestOutputService6ProtocolTestNormalMapCase1(t *testing.T) { - svc := NewOutputService6ProtocolTest(nil) + sess := session.New() + svc := NewOutputService6ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) buf := bytes.NewReader([]byte("quxbarbazbamrequestid")) req, out := svc.OutputService6TestCaseOperation1Request(nil) @@ -796,7 +1067,8 @@ func TestOutputService6ProtocolTestNormalMapCase1(t *testing.T) { } func TestOutputService7ProtocolTestFlattenedMapCase1(t *testing.T) { - svc := NewOutputService7ProtocolTest(nil) + sess := session.New() + svc := NewOutputService7ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) buf := bytes.NewReader([]byte("quxbarbazbamrequestid")) req, out := svc.OutputService7TestCaseOperation1Request(nil) @@ -817,7 +1089,8 @@ func TestOutputService7ProtocolTestFlattenedMapCase1(t *testing.T) { } func TestOutputService8ProtocolTestNamedMapCase1(t *testing.T) { - svc := NewOutputService8ProtocolTest(nil) + sess := session.New() + svc := NewOutputService8ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) buf := bytes.NewReader([]byte("quxbarbazbamrequestid")) req, out := svc.OutputService8TestCaseOperation1Request(nil) @@ -836,3 +1109,24 @@ func TestOutputService8ProtocolTestNamedMapCase1(t *testing.T) { assert.Equal(t, "bar", *out.Map["qux"]) } + +func TestOutputService9ProtocolTestEmptyStringCase1(t *testing.T) { + sess := session.New() + svc := NewOutputService9ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + + buf := bytes.NewReader([]byte("requestid")) + req, out := svc.OutputService9TestCaseOperation1Request(nil) + req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} + + // set headers + + // unmarshal response + ec2query.UnmarshalMeta(req) + ec2query.Unmarshal(req) + assert.NoError(t, req.Error) + + // assert response + assert.NotNil(t, out) // ensure out variable is used + assert.Equal(t, "", *out.Foo) + +} diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/protocol/query/build.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/protocol/query/build.go index b6b0b54d25d..2d78c35c241 100644 --- a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/protocol/query/build.go +++ b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/protocol/query/build.go @@ -15,7 +15,7 @@ import ( func Build(r *request.Request) { body := url.Values{ "Action": {r.Operation.Name}, - "Version": {r.Service.APIVersion}, + "Version": {r.ClientInfo.APIVersion}, } if err := queryutil.Parse(body, r.Params, false); err != nil { r.Error = awserr.New("SerializationError", "failed encoding Query request", err) diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/protocol/query/build_test.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/protocol/query/build_test.go index 824fb6c1703..535821b2fd4 100644 --- a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/protocol/query/build_test.go +++ b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/protocol/query/build_test.go @@ -12,10 +12,10 @@ import ( "time" "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/defaults" + "github.com/aws/aws-sdk-go/aws/client" + "github.com/aws/aws-sdk-go/aws/client/metadata" "github.com/aws/aws-sdk-go/aws/request" - "github.com/aws/aws-sdk-go/aws/service" - "github.com/aws/aws-sdk-go/aws/service/serviceinfo" + "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/awstesting" "github.com/aws/aws-sdk-go/private/protocol/query" "github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil" @@ -35,30 +35,52 @@ var _ = ioutil.Discard var _ = util.Trim("") var _ = url.Values{} var _ = io.EOF +var _ = aws.String +//The service client's operations are safe to be used concurrently. +// It is not safe to mutate any of the client's properties though. type InputService1ProtocolTest struct { - *service.Service + *client.Client } -// New returns a new InputService1ProtocolTest client. -func NewInputService1ProtocolTest(config *aws.Config) *InputService1ProtocolTest { - service := &service.Service{ - ServiceInfo: serviceinfo.ServiceInfo{ - Config: defaults.DefaultConfig.Merge(config), - ServiceName: "inputservice1protocoltest", - APIVersion: "2014-01-01", - }, +// New creates a new instance of the InputService1ProtocolTest client with a session. +// If additional configuration is needed for the client instance use the optional +// aws.Config parameter to add your extra config. +// +// Example: +// // Create a InputService1ProtocolTest client from just a session. +// svc := inputservice1protocoltest.New(mySession) +// +// // Create a InputService1ProtocolTest client with additional configuration +// svc := inputservice1protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) +func NewInputService1ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService1ProtocolTest { + c := p.ClientConfig("inputservice1protocoltest", cfgs...) + return newInputService1ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) +} + +// newClient creates, initializes and returns a new service client instance. +func newInputService1ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *InputService1ProtocolTest { + svc := &InputService1ProtocolTest{ + Client: client.New( + cfg, + metadata.ClientInfo{ + ServiceName: "inputservice1protocoltest", + SigningRegion: signingRegion, + Endpoint: endpoint, + APIVersion: "2014-01-01", + }, + handlers, + ), } - service.Initialize() // Handlers - service.Handlers.Sign.PushBack(v4.Sign) - service.Handlers.Build.PushBack(query.Build) - service.Handlers.Unmarshal.PushBack(query.Unmarshal) - service.Handlers.UnmarshalMeta.PushBack(query.UnmarshalMeta) - service.Handlers.UnmarshalError.PushBack(query.UnmarshalError) + svc.Handlers.Sign.PushBack(v4.Sign) + svc.Handlers.Build.PushBack(query.Build) + svc.Handlers.Unmarshal.PushBack(query.Unmarshal) + svc.Handlers.UnmarshalMeta.PushBack(query.UnmarshalMeta) + svc.Handlers.UnmarshalError.PushBack(query.UnmarshalError) - return &InputService1ProtocolTest{service} + return svc } // newRequest creates a new request for a InputService1ProtocolTest operation and runs any @@ -72,13 +94,13 @@ func (c *InputService1ProtocolTest) newRequest(op *request.Operation, params, da const opInputService1TestCaseOperation1 = "OperationName" // InputService1TestCaseOperation1Request generates a request for the InputService1TestCaseOperation1 operation. -func (c *InputService1ProtocolTest) InputService1TestCaseOperation1Request(input *InputService1TestShapeInputService1TestCaseOperation1Input) (req *request.Request, output *InputService1TestShapeInputService1TestCaseOperation1Output) { +func (c *InputService1ProtocolTest) InputService1TestCaseOperation1Request(input *InputService1TestShapeInputShape) (req *request.Request, output *InputService1TestShapeInputService1TestCaseOperation1Output) { op := &request.Operation{ Name: opInputService1TestCaseOperation1, } if input == nil { - input = &InputService1TestShapeInputService1TestCaseOperation1Input{} + input = &InputService1TestShapeInputShape{} } req = c.newRequest(op, input, output) @@ -87,22 +109,58 @@ func (c *InputService1ProtocolTest) InputService1TestCaseOperation1Request(input return } -func (c *InputService1ProtocolTest) InputService1TestCaseOperation1(input *InputService1TestShapeInputService1TestCaseOperation1Input) (*InputService1TestShapeInputService1TestCaseOperation1Output, error) { +func (c *InputService1ProtocolTest) InputService1TestCaseOperation1(input *InputService1TestShapeInputShape) (*InputService1TestShapeInputService1TestCaseOperation1Output, error) { req, out := c.InputService1TestCaseOperation1Request(input) err := req.Send() return out, err } -type InputService1TestShapeInputService1TestCaseOperation1Input struct { - Bar *string `type:"string"` +const opInputService1TestCaseOperation2 = "OperationName" - Foo *string `type:"string"` +// InputService1TestCaseOperation2Request generates a request for the InputService1TestCaseOperation2 operation. +func (c *InputService1ProtocolTest) InputService1TestCaseOperation2Request(input *InputService1TestShapeInputShape) (req *request.Request, output *InputService1TestShapeInputService1TestCaseOperation2Output) { + op := &request.Operation{ + Name: opInputService1TestCaseOperation2, + } - metadataInputService1TestShapeInputService1TestCaseOperation1Input `json:"-" xml:"-"` + if input == nil { + input = &InputService1TestShapeInputShape{} + } + + req = c.newRequest(op, input, output) + output = &InputService1TestShapeInputService1TestCaseOperation2Output{} + req.Data = output + return } -type metadataInputService1TestShapeInputService1TestCaseOperation1Input struct { - SDKShapeTraits bool `type:"structure"` +func (c *InputService1ProtocolTest) InputService1TestCaseOperation2(input *InputService1TestShapeInputShape) (*InputService1TestShapeInputService1TestCaseOperation2Output, error) { + req, out := c.InputService1TestCaseOperation2Request(input) + err := req.Send() + return out, err +} + +const opInputService1TestCaseOperation3 = "OperationName" + +// InputService1TestCaseOperation3Request generates a request for the InputService1TestCaseOperation3 operation. +func (c *InputService1ProtocolTest) InputService1TestCaseOperation3Request(input *InputService1TestShapeInputShape) (req *request.Request, output *InputService1TestShapeInputService1TestCaseOperation3Output) { + op := &request.Operation{ + Name: opInputService1TestCaseOperation3, + } + + if input == nil { + input = &InputService1TestShapeInputShape{} + } + + req = c.newRequest(op, input, output) + output = &InputService1TestShapeInputService1TestCaseOperation3Output{} + req.Data = output + return +} + +func (c *InputService1ProtocolTest) InputService1TestCaseOperation3(input *InputService1TestShapeInputShape) (*InputService1TestShapeInputService1TestCaseOperation3Output, error) { + req, out := c.InputService1TestCaseOperation3Request(input) + err := req.Send() + return out, err } type InputService1TestShapeInputService1TestCaseOperation1Output struct { @@ -113,29 +171,80 @@ type metadataInputService1TestShapeInputService1TestCaseOperation1Output struct SDKShapeTraits bool `type:"structure"` } -type InputService2ProtocolTest struct { - *service.Service +type InputService1TestShapeInputService1TestCaseOperation2Output struct { + metadataInputService1TestShapeInputService1TestCaseOperation2Output `json:"-" xml:"-"` } -// New returns a new InputService2ProtocolTest client. -func NewInputService2ProtocolTest(config *aws.Config) *InputService2ProtocolTest { - service := &service.Service{ - ServiceInfo: serviceinfo.ServiceInfo{ - Config: defaults.DefaultConfig.Merge(config), - ServiceName: "inputservice2protocoltest", - APIVersion: "2014-01-01", - }, +type metadataInputService1TestShapeInputService1TestCaseOperation2Output struct { + SDKShapeTraits bool `type:"structure"` +} + +type InputService1TestShapeInputService1TestCaseOperation3Output struct { + metadataInputService1TestShapeInputService1TestCaseOperation3Output `json:"-" xml:"-"` +} + +type metadataInputService1TestShapeInputService1TestCaseOperation3Output struct { + SDKShapeTraits bool `type:"structure"` +} + +type InputService1TestShapeInputShape struct { + Bar *string `type:"string"` + + Baz *bool `type:"boolean"` + + Foo *string `type:"string"` + + metadataInputService1TestShapeInputShape `json:"-" xml:"-"` +} + +type metadataInputService1TestShapeInputShape struct { + SDKShapeTraits bool `type:"structure"` +} + +//The service client's operations are safe to be used concurrently. +// It is not safe to mutate any of the client's properties though. +type InputService2ProtocolTest struct { + *client.Client +} + +// New creates a new instance of the InputService2ProtocolTest client with a session. +// If additional configuration is needed for the client instance use the optional +// aws.Config parameter to add your extra config. +// +// Example: +// // Create a InputService2ProtocolTest client from just a session. +// svc := inputservice2protocoltest.New(mySession) +// +// // Create a InputService2ProtocolTest client with additional configuration +// svc := inputservice2protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) +func NewInputService2ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService2ProtocolTest { + c := p.ClientConfig("inputservice2protocoltest", cfgs...) + return newInputService2ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) +} + +// newClient creates, initializes and returns a new service client instance. +func newInputService2ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *InputService2ProtocolTest { + svc := &InputService2ProtocolTest{ + Client: client.New( + cfg, + metadata.ClientInfo{ + ServiceName: "inputservice2protocoltest", + SigningRegion: signingRegion, + Endpoint: endpoint, + APIVersion: "2014-01-01", + }, + handlers, + ), } - service.Initialize() // Handlers - service.Handlers.Sign.PushBack(v4.Sign) - service.Handlers.Build.PushBack(query.Build) - service.Handlers.Unmarshal.PushBack(query.Unmarshal) - service.Handlers.UnmarshalMeta.PushBack(query.UnmarshalMeta) - service.Handlers.UnmarshalError.PushBack(query.UnmarshalError) + svc.Handlers.Sign.PushBack(v4.Sign) + svc.Handlers.Build.PushBack(query.Build) + svc.Handlers.Unmarshal.PushBack(query.Unmarshal) + svc.Handlers.UnmarshalMeta.PushBack(query.UnmarshalMeta) + svc.Handlers.UnmarshalError.PushBack(query.UnmarshalError) - return &InputService2ProtocolTest{service} + return svc } // newRequest creates a new request for a InputService2ProtocolTest operation and runs any @@ -198,29 +307,50 @@ type metadataInputService2TestShapeStructType struct { SDKShapeTraits bool `type:"structure"` } +//The service client's operations are safe to be used concurrently. +// It is not safe to mutate any of the client's properties though. type InputService3ProtocolTest struct { - *service.Service + *client.Client } -// New returns a new InputService3ProtocolTest client. -func NewInputService3ProtocolTest(config *aws.Config) *InputService3ProtocolTest { - service := &service.Service{ - ServiceInfo: serviceinfo.ServiceInfo{ - Config: defaults.DefaultConfig.Merge(config), - ServiceName: "inputservice3protocoltest", - APIVersion: "2014-01-01", - }, +// New creates a new instance of the InputService3ProtocolTest client with a session. +// If additional configuration is needed for the client instance use the optional +// aws.Config parameter to add your extra config. +// +// Example: +// // Create a InputService3ProtocolTest client from just a session. +// svc := inputservice3protocoltest.New(mySession) +// +// // Create a InputService3ProtocolTest client with additional configuration +// svc := inputservice3protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) +func NewInputService3ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService3ProtocolTest { + c := p.ClientConfig("inputservice3protocoltest", cfgs...) + return newInputService3ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) +} + +// newClient creates, initializes and returns a new service client instance. +func newInputService3ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *InputService3ProtocolTest { + svc := &InputService3ProtocolTest{ + Client: client.New( + cfg, + metadata.ClientInfo{ + ServiceName: "inputservice3protocoltest", + SigningRegion: signingRegion, + Endpoint: endpoint, + APIVersion: "2014-01-01", + }, + handlers, + ), } - service.Initialize() // Handlers - service.Handlers.Sign.PushBack(v4.Sign) - service.Handlers.Build.PushBack(query.Build) - service.Handlers.Unmarshal.PushBack(query.Unmarshal) - service.Handlers.UnmarshalMeta.PushBack(query.UnmarshalMeta) - service.Handlers.UnmarshalError.PushBack(query.UnmarshalError) + svc.Handlers.Sign.PushBack(v4.Sign) + svc.Handlers.Build.PushBack(query.Build) + svc.Handlers.Unmarshal.PushBack(query.Unmarshal) + svc.Handlers.UnmarshalMeta.PushBack(query.UnmarshalMeta) + svc.Handlers.UnmarshalError.PushBack(query.UnmarshalError) - return &InputService3ProtocolTest{service} + return svc } // newRequest creates a new request for a InputService3ProtocolTest operation and runs any @@ -234,13 +364,13 @@ func (c *InputService3ProtocolTest) newRequest(op *request.Operation, params, da const opInputService3TestCaseOperation1 = "OperationName" // InputService3TestCaseOperation1Request generates a request for the InputService3TestCaseOperation1 operation. -func (c *InputService3ProtocolTest) InputService3TestCaseOperation1Request(input *InputService3TestShapeInputService3TestCaseOperation1Input) (req *request.Request, output *InputService3TestShapeInputService3TestCaseOperation1Output) { +func (c *InputService3ProtocolTest) InputService3TestCaseOperation1Request(input *InputService3TestShapeInputShape) (req *request.Request, output *InputService3TestShapeInputService3TestCaseOperation1Output) { op := &request.Operation{ Name: opInputService3TestCaseOperation1, } if input == nil { - input = &InputService3TestShapeInputService3TestCaseOperation1Input{} + input = &InputService3TestShapeInputShape{} } req = c.newRequest(op, input, output) @@ -249,20 +379,34 @@ func (c *InputService3ProtocolTest) InputService3TestCaseOperation1Request(input return } -func (c *InputService3ProtocolTest) InputService3TestCaseOperation1(input *InputService3TestShapeInputService3TestCaseOperation1Input) (*InputService3TestShapeInputService3TestCaseOperation1Output, error) { +func (c *InputService3ProtocolTest) InputService3TestCaseOperation1(input *InputService3TestShapeInputShape) (*InputService3TestShapeInputService3TestCaseOperation1Output, error) { req, out := c.InputService3TestCaseOperation1Request(input) err := req.Send() return out, err } -type InputService3TestShapeInputService3TestCaseOperation1Input struct { - ListArg []*string `type:"list"` +const opInputService3TestCaseOperation2 = "OperationName" - metadataInputService3TestShapeInputService3TestCaseOperation1Input `json:"-" xml:"-"` +// InputService3TestCaseOperation2Request generates a request for the InputService3TestCaseOperation2 operation. +func (c *InputService3ProtocolTest) InputService3TestCaseOperation2Request(input *InputService3TestShapeInputShape) (req *request.Request, output *InputService3TestShapeInputService3TestCaseOperation2Output) { + op := &request.Operation{ + Name: opInputService3TestCaseOperation2, + } + + if input == nil { + input = &InputService3TestShapeInputShape{} + } + + req = c.newRequest(op, input, output) + output = &InputService3TestShapeInputService3TestCaseOperation2Output{} + req.Data = output + return } -type metadataInputService3TestShapeInputService3TestCaseOperation1Input struct { - SDKShapeTraits bool `type:"structure"` +func (c *InputService3ProtocolTest) InputService3TestCaseOperation2(input *InputService3TestShapeInputShape) (*InputService3TestShapeInputService3TestCaseOperation2Output, error) { + req, out := c.InputService3TestCaseOperation2Request(input) + err := req.Send() + return out, err } type InputService3TestShapeInputService3TestCaseOperation1Output struct { @@ -273,29 +417,68 @@ type metadataInputService3TestShapeInputService3TestCaseOperation1Output struct SDKShapeTraits bool `type:"structure"` } -type InputService4ProtocolTest struct { - *service.Service +type InputService3TestShapeInputService3TestCaseOperation2Output struct { + metadataInputService3TestShapeInputService3TestCaseOperation2Output `json:"-" xml:"-"` } -// New returns a new InputService4ProtocolTest client. -func NewInputService4ProtocolTest(config *aws.Config) *InputService4ProtocolTest { - service := &service.Service{ - ServiceInfo: serviceinfo.ServiceInfo{ - Config: defaults.DefaultConfig.Merge(config), - ServiceName: "inputservice4protocoltest", - APIVersion: "2014-01-01", - }, +type metadataInputService3TestShapeInputService3TestCaseOperation2Output struct { + SDKShapeTraits bool `type:"structure"` +} + +type InputService3TestShapeInputShape struct { + ListArg []*string `type:"list"` + + metadataInputService3TestShapeInputShape `json:"-" xml:"-"` +} + +type metadataInputService3TestShapeInputShape struct { + SDKShapeTraits bool `type:"structure"` +} + +//The service client's operations are safe to be used concurrently. +// It is not safe to mutate any of the client's properties though. +type InputService4ProtocolTest struct { + *client.Client +} + +// New creates a new instance of the InputService4ProtocolTest client with a session. +// If additional configuration is needed for the client instance use the optional +// aws.Config parameter to add your extra config. +// +// Example: +// // Create a InputService4ProtocolTest client from just a session. +// svc := inputservice4protocoltest.New(mySession) +// +// // Create a InputService4ProtocolTest client with additional configuration +// svc := inputservice4protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) +func NewInputService4ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService4ProtocolTest { + c := p.ClientConfig("inputservice4protocoltest", cfgs...) + return newInputService4ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) +} + +// newClient creates, initializes and returns a new service client instance. +func newInputService4ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *InputService4ProtocolTest { + svc := &InputService4ProtocolTest{ + Client: client.New( + cfg, + metadata.ClientInfo{ + ServiceName: "inputservice4protocoltest", + SigningRegion: signingRegion, + Endpoint: endpoint, + APIVersion: "2014-01-01", + }, + handlers, + ), } - service.Initialize() // Handlers - service.Handlers.Sign.PushBack(v4.Sign) - service.Handlers.Build.PushBack(query.Build) - service.Handlers.Unmarshal.PushBack(query.Unmarshal) - service.Handlers.UnmarshalMeta.PushBack(query.UnmarshalMeta) - service.Handlers.UnmarshalError.PushBack(query.UnmarshalError) + svc.Handlers.Sign.PushBack(v4.Sign) + svc.Handlers.Build.PushBack(query.Build) + svc.Handlers.Unmarshal.PushBack(query.Unmarshal) + svc.Handlers.UnmarshalMeta.PushBack(query.UnmarshalMeta) + svc.Handlers.UnmarshalError.PushBack(query.UnmarshalError) - return &InputService4ProtocolTest{service} + return svc } // newRequest creates a new request for a InputService4ProtocolTest operation and runs any @@ -309,13 +492,13 @@ func (c *InputService4ProtocolTest) newRequest(op *request.Operation, params, da const opInputService4TestCaseOperation1 = "OperationName" // InputService4TestCaseOperation1Request generates a request for the InputService4TestCaseOperation1 operation. -func (c *InputService4ProtocolTest) InputService4TestCaseOperation1Request(input *InputService4TestShapeInputService4TestCaseOperation1Input) (req *request.Request, output *InputService4TestShapeInputService4TestCaseOperation1Output) { +func (c *InputService4ProtocolTest) InputService4TestCaseOperation1Request(input *InputService4TestShapeInputShape) (req *request.Request, output *InputService4TestShapeInputService4TestCaseOperation1Output) { op := &request.Operation{ Name: opInputService4TestCaseOperation1, } if input == nil { - input = &InputService4TestShapeInputService4TestCaseOperation1Input{} + input = &InputService4TestShapeInputShape{} } req = c.newRequest(op, input, output) @@ -324,22 +507,34 @@ func (c *InputService4ProtocolTest) InputService4TestCaseOperation1Request(input return } -func (c *InputService4ProtocolTest) InputService4TestCaseOperation1(input *InputService4TestShapeInputService4TestCaseOperation1Input) (*InputService4TestShapeInputService4TestCaseOperation1Output, error) { +func (c *InputService4ProtocolTest) InputService4TestCaseOperation1(input *InputService4TestShapeInputShape) (*InputService4TestShapeInputService4TestCaseOperation1Output, error) { req, out := c.InputService4TestCaseOperation1Request(input) err := req.Send() return out, err } -type InputService4TestShapeInputService4TestCaseOperation1Input struct { - ListArg []*string `type:"list" flattened:"true"` +const opInputService4TestCaseOperation2 = "OperationName" - ScalarArg *string `type:"string"` +// InputService4TestCaseOperation2Request generates a request for the InputService4TestCaseOperation2 operation. +func (c *InputService4ProtocolTest) InputService4TestCaseOperation2Request(input *InputService4TestShapeInputShape) (req *request.Request, output *InputService4TestShapeInputService4TestCaseOperation2Output) { + op := &request.Operation{ + Name: opInputService4TestCaseOperation2, + } - metadataInputService4TestShapeInputService4TestCaseOperation1Input `json:"-" xml:"-"` + if input == nil { + input = &InputService4TestShapeInputShape{} + } + + req = c.newRequest(op, input, output) + output = &InputService4TestShapeInputService4TestCaseOperation2Output{} + req.Data = output + return } -type metadataInputService4TestShapeInputService4TestCaseOperation1Input struct { - SDKShapeTraits bool `type:"structure"` +func (c *InputService4ProtocolTest) InputService4TestCaseOperation2(input *InputService4TestShapeInputShape) (*InputService4TestShapeInputService4TestCaseOperation2Output, error) { + req, out := c.InputService4TestCaseOperation2Request(input) + err := req.Send() + return out, err } type InputService4TestShapeInputService4TestCaseOperation1Output struct { @@ -350,29 +545,72 @@ type metadataInputService4TestShapeInputService4TestCaseOperation1Output struct SDKShapeTraits bool `type:"structure"` } -type InputService5ProtocolTest struct { - *service.Service +type InputService4TestShapeInputService4TestCaseOperation2Output struct { + metadataInputService4TestShapeInputService4TestCaseOperation2Output `json:"-" xml:"-"` } -// New returns a new InputService5ProtocolTest client. -func NewInputService5ProtocolTest(config *aws.Config) *InputService5ProtocolTest { - service := &service.Service{ - ServiceInfo: serviceinfo.ServiceInfo{ - Config: defaults.DefaultConfig.Merge(config), - ServiceName: "inputservice5protocoltest", - APIVersion: "2014-01-01", - }, +type metadataInputService4TestShapeInputService4TestCaseOperation2Output struct { + SDKShapeTraits bool `type:"structure"` +} + +type InputService4TestShapeInputShape struct { + ListArg []*string `type:"list" flattened:"true"` + + NamedListArg []*string `locationNameList:"Foo" type:"list" flattened:"true"` + + ScalarArg *string `type:"string"` + + metadataInputService4TestShapeInputShape `json:"-" xml:"-"` +} + +type metadataInputService4TestShapeInputShape struct { + SDKShapeTraits bool `type:"structure"` +} + +//The service client's operations are safe to be used concurrently. +// It is not safe to mutate any of the client's properties though. +type InputService5ProtocolTest struct { + *client.Client +} + +// New creates a new instance of the InputService5ProtocolTest client with a session. +// If additional configuration is needed for the client instance use the optional +// aws.Config parameter to add your extra config. +// +// Example: +// // Create a InputService5ProtocolTest client from just a session. +// svc := inputservice5protocoltest.New(mySession) +// +// // Create a InputService5ProtocolTest client with additional configuration +// svc := inputservice5protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) +func NewInputService5ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService5ProtocolTest { + c := p.ClientConfig("inputservice5protocoltest", cfgs...) + return newInputService5ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) +} + +// newClient creates, initializes and returns a new service client instance. +func newInputService5ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *InputService5ProtocolTest { + svc := &InputService5ProtocolTest{ + Client: client.New( + cfg, + metadata.ClientInfo{ + ServiceName: "inputservice5protocoltest", + SigningRegion: signingRegion, + Endpoint: endpoint, + APIVersion: "2014-01-01", + }, + handlers, + ), } - service.Initialize() // Handlers - service.Handlers.Sign.PushBack(v4.Sign) - service.Handlers.Build.PushBack(query.Build) - service.Handlers.Unmarshal.PushBack(query.Unmarshal) - service.Handlers.UnmarshalMeta.PushBack(query.UnmarshalMeta) - service.Handlers.UnmarshalError.PushBack(query.UnmarshalError) + svc.Handlers.Sign.PushBack(v4.Sign) + svc.Handlers.Build.PushBack(query.Build) + svc.Handlers.Unmarshal.PushBack(query.Unmarshal) + svc.Handlers.UnmarshalMeta.PushBack(query.UnmarshalMeta) + svc.Handlers.UnmarshalError.PushBack(query.UnmarshalError) - return &InputService5ProtocolTest{service} + return svc } // newRequest creates a new request for a InputService5ProtocolTest operation and runs any @@ -408,9 +646,7 @@ func (c *InputService5ProtocolTest) InputService5TestCaseOperation1(input *Input } type InputService5TestShapeInputService5TestCaseOperation1Input struct { - ListArg []*string `locationNameList:"ListArgLocation" type:"list" flattened:"true"` - - ScalarArg *string `type:"string"` + MapArg map[string]*string `type:"map" flattened:"true"` metadataInputService5TestShapeInputService5TestCaseOperation1Input `json:"-" xml:"-"` } @@ -427,29 +663,50 @@ type metadataInputService5TestShapeInputService5TestCaseOperation1Output struct SDKShapeTraits bool `type:"structure"` } +//The service client's operations are safe to be used concurrently. +// It is not safe to mutate any of the client's properties though. type InputService6ProtocolTest struct { - *service.Service + *client.Client } -// New returns a new InputService6ProtocolTest client. -func NewInputService6ProtocolTest(config *aws.Config) *InputService6ProtocolTest { - service := &service.Service{ - ServiceInfo: serviceinfo.ServiceInfo{ - Config: defaults.DefaultConfig.Merge(config), - ServiceName: "inputservice6protocoltest", - APIVersion: "2014-01-01", - }, +// New creates a new instance of the InputService6ProtocolTest client with a session. +// If additional configuration is needed for the client instance use the optional +// aws.Config parameter to add your extra config. +// +// Example: +// // Create a InputService6ProtocolTest client from just a session. +// svc := inputservice6protocoltest.New(mySession) +// +// // Create a InputService6ProtocolTest client with additional configuration +// svc := inputservice6protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) +func NewInputService6ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService6ProtocolTest { + c := p.ClientConfig("inputservice6protocoltest", cfgs...) + return newInputService6ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) +} + +// newClient creates, initializes and returns a new service client instance. +func newInputService6ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *InputService6ProtocolTest { + svc := &InputService6ProtocolTest{ + Client: client.New( + cfg, + metadata.ClientInfo{ + ServiceName: "inputservice6protocoltest", + SigningRegion: signingRegion, + Endpoint: endpoint, + APIVersion: "2014-01-01", + }, + handlers, + ), } - service.Initialize() // Handlers - service.Handlers.Sign.PushBack(v4.Sign) - service.Handlers.Build.PushBack(query.Build) - service.Handlers.Unmarshal.PushBack(query.Unmarshal) - service.Handlers.UnmarshalMeta.PushBack(query.UnmarshalMeta) - service.Handlers.UnmarshalError.PushBack(query.UnmarshalError) + svc.Handlers.Sign.PushBack(v4.Sign) + svc.Handlers.Build.PushBack(query.Build) + svc.Handlers.Unmarshal.PushBack(query.Unmarshal) + svc.Handlers.UnmarshalMeta.PushBack(query.UnmarshalMeta) + svc.Handlers.UnmarshalError.PushBack(query.UnmarshalError) - return &InputService6ProtocolTest{service} + return svc } // newRequest creates a new request for a InputService6ProtocolTest operation and runs any @@ -485,7 +742,7 @@ func (c *InputService6ProtocolTest) InputService6TestCaseOperation1(input *Input } type InputService6TestShapeInputService6TestCaseOperation1Input struct { - MapArg map[string]*string `type:"map"` + ListArg []*string `locationNameList:"item" type:"list"` metadataInputService6TestShapeInputService6TestCaseOperation1Input `json:"-" xml:"-"` } @@ -502,29 +759,50 @@ type metadataInputService6TestShapeInputService6TestCaseOperation1Output struct SDKShapeTraits bool `type:"structure"` } +//The service client's operations are safe to be used concurrently. +// It is not safe to mutate any of the client's properties though. type InputService7ProtocolTest struct { - *service.Service + *client.Client } -// New returns a new InputService7ProtocolTest client. -func NewInputService7ProtocolTest(config *aws.Config) *InputService7ProtocolTest { - service := &service.Service{ - ServiceInfo: serviceinfo.ServiceInfo{ - Config: defaults.DefaultConfig.Merge(config), - ServiceName: "inputservice7protocoltest", - APIVersion: "2014-01-01", - }, +// New creates a new instance of the InputService7ProtocolTest client with a session. +// If additional configuration is needed for the client instance use the optional +// aws.Config parameter to add your extra config. +// +// Example: +// // Create a InputService7ProtocolTest client from just a session. +// svc := inputservice7protocoltest.New(mySession) +// +// // Create a InputService7ProtocolTest client with additional configuration +// svc := inputservice7protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) +func NewInputService7ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService7ProtocolTest { + c := p.ClientConfig("inputservice7protocoltest", cfgs...) + return newInputService7ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) +} + +// newClient creates, initializes and returns a new service client instance. +func newInputService7ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *InputService7ProtocolTest { + svc := &InputService7ProtocolTest{ + Client: client.New( + cfg, + metadata.ClientInfo{ + ServiceName: "inputservice7protocoltest", + SigningRegion: signingRegion, + Endpoint: endpoint, + APIVersion: "2014-01-01", + }, + handlers, + ), } - service.Initialize() // Handlers - service.Handlers.Sign.PushBack(v4.Sign) - service.Handlers.Build.PushBack(query.Build) - service.Handlers.Unmarshal.PushBack(query.Unmarshal) - service.Handlers.UnmarshalMeta.PushBack(query.UnmarshalMeta) - service.Handlers.UnmarshalError.PushBack(query.UnmarshalError) + svc.Handlers.Sign.PushBack(v4.Sign) + svc.Handlers.Build.PushBack(query.Build) + svc.Handlers.Unmarshal.PushBack(query.Unmarshal) + svc.Handlers.UnmarshalMeta.PushBack(query.UnmarshalMeta) + svc.Handlers.UnmarshalError.PushBack(query.UnmarshalError) - return &InputService7ProtocolTest{service} + return svc } // newRequest creates a new request for a InputService7ProtocolTest operation and runs any @@ -560,7 +838,9 @@ func (c *InputService7ProtocolTest) InputService7TestCaseOperation1(input *Input } type InputService7TestShapeInputService7TestCaseOperation1Input struct { - MapArg map[string]*string `locationNameKey:"TheKey" locationNameValue:"TheValue" type:"map"` + ListArg []*string `locationNameList:"ListArgLocation" type:"list" flattened:"true"` + + ScalarArg *string `type:"string"` metadataInputService7TestShapeInputService7TestCaseOperation1Input `json:"-" xml:"-"` } @@ -577,29 +857,50 @@ type metadataInputService7TestShapeInputService7TestCaseOperation1Output struct SDKShapeTraits bool `type:"structure"` } +//The service client's operations are safe to be used concurrently. +// It is not safe to mutate any of the client's properties though. type InputService8ProtocolTest struct { - *service.Service + *client.Client } -// New returns a new InputService8ProtocolTest client. -func NewInputService8ProtocolTest(config *aws.Config) *InputService8ProtocolTest { - service := &service.Service{ - ServiceInfo: serviceinfo.ServiceInfo{ - Config: defaults.DefaultConfig.Merge(config), - ServiceName: "inputservice8protocoltest", - APIVersion: "2014-01-01", - }, +// New creates a new instance of the InputService8ProtocolTest client with a session. +// If additional configuration is needed for the client instance use the optional +// aws.Config parameter to add your extra config. +// +// Example: +// // Create a InputService8ProtocolTest client from just a session. +// svc := inputservice8protocoltest.New(mySession) +// +// // Create a InputService8ProtocolTest client with additional configuration +// svc := inputservice8protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) +func NewInputService8ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService8ProtocolTest { + c := p.ClientConfig("inputservice8protocoltest", cfgs...) + return newInputService8ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) +} + +// newClient creates, initializes and returns a new service client instance. +func newInputService8ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *InputService8ProtocolTest { + svc := &InputService8ProtocolTest{ + Client: client.New( + cfg, + metadata.ClientInfo{ + ServiceName: "inputservice8protocoltest", + SigningRegion: signingRegion, + Endpoint: endpoint, + APIVersion: "2014-01-01", + }, + handlers, + ), } - service.Initialize() // Handlers - service.Handlers.Sign.PushBack(v4.Sign) - service.Handlers.Build.PushBack(query.Build) - service.Handlers.Unmarshal.PushBack(query.Unmarshal) - service.Handlers.UnmarshalMeta.PushBack(query.UnmarshalMeta) - service.Handlers.UnmarshalError.PushBack(query.UnmarshalError) + svc.Handlers.Sign.PushBack(v4.Sign) + svc.Handlers.Build.PushBack(query.Build) + svc.Handlers.Unmarshal.PushBack(query.Unmarshal) + svc.Handlers.UnmarshalMeta.PushBack(query.UnmarshalMeta) + svc.Handlers.UnmarshalError.PushBack(query.UnmarshalError) - return &InputService8ProtocolTest{service} + return svc } // newRequest creates a new request for a InputService8ProtocolTest operation and runs any @@ -635,7 +936,7 @@ func (c *InputService8ProtocolTest) InputService8TestCaseOperation1(input *Input } type InputService8TestShapeInputService8TestCaseOperation1Input struct { - BlobArg []byte `type:"blob"` + MapArg map[string]*string `type:"map"` metadataInputService8TestShapeInputService8TestCaseOperation1Input `json:"-" xml:"-"` } @@ -652,29 +953,50 @@ type metadataInputService8TestShapeInputService8TestCaseOperation1Output struct SDKShapeTraits bool `type:"structure"` } +//The service client's operations are safe to be used concurrently. +// It is not safe to mutate any of the client's properties though. type InputService9ProtocolTest struct { - *service.Service + *client.Client } -// New returns a new InputService9ProtocolTest client. -func NewInputService9ProtocolTest(config *aws.Config) *InputService9ProtocolTest { - service := &service.Service{ - ServiceInfo: serviceinfo.ServiceInfo{ - Config: defaults.DefaultConfig.Merge(config), - ServiceName: "inputservice9protocoltest", - APIVersion: "2014-01-01", - }, +// New creates a new instance of the InputService9ProtocolTest client with a session. +// If additional configuration is needed for the client instance use the optional +// aws.Config parameter to add your extra config. +// +// Example: +// // Create a InputService9ProtocolTest client from just a session. +// svc := inputservice9protocoltest.New(mySession) +// +// // Create a InputService9ProtocolTest client with additional configuration +// svc := inputservice9protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) +func NewInputService9ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService9ProtocolTest { + c := p.ClientConfig("inputservice9protocoltest", cfgs...) + return newInputService9ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) +} + +// newClient creates, initializes and returns a new service client instance. +func newInputService9ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *InputService9ProtocolTest { + svc := &InputService9ProtocolTest{ + Client: client.New( + cfg, + metadata.ClientInfo{ + ServiceName: "inputservice9protocoltest", + SigningRegion: signingRegion, + Endpoint: endpoint, + APIVersion: "2014-01-01", + }, + handlers, + ), } - service.Initialize() // Handlers - service.Handlers.Sign.PushBack(v4.Sign) - service.Handlers.Build.PushBack(query.Build) - service.Handlers.Unmarshal.PushBack(query.Unmarshal) - service.Handlers.UnmarshalMeta.PushBack(query.UnmarshalMeta) - service.Handlers.UnmarshalError.PushBack(query.UnmarshalError) + svc.Handlers.Sign.PushBack(v4.Sign) + svc.Handlers.Build.PushBack(query.Build) + svc.Handlers.Unmarshal.PushBack(query.Unmarshal) + svc.Handlers.UnmarshalMeta.PushBack(query.UnmarshalMeta) + svc.Handlers.UnmarshalError.PushBack(query.UnmarshalError) - return &InputService9ProtocolTest{service} + return svc } // newRequest creates a new request for a InputService9ProtocolTest operation and runs any @@ -710,7 +1032,7 @@ func (c *InputService9ProtocolTest) InputService9TestCaseOperation1(input *Input } type InputService9TestShapeInputService9TestCaseOperation1Input struct { - TimeArg *time.Time `type:"timestamp" timestampFormat:"iso8601"` + MapArg map[string]*string `locationNameKey:"TheKey" locationNameValue:"TheValue" type:"map"` metadataInputService9TestShapeInputService9TestCaseOperation1Input `json:"-" xml:"-"` } @@ -727,29 +1049,50 @@ type metadataInputService9TestShapeInputService9TestCaseOperation1Output struct SDKShapeTraits bool `type:"structure"` } +//The service client's operations are safe to be used concurrently. +// It is not safe to mutate any of the client's properties though. type InputService10ProtocolTest struct { - *service.Service + *client.Client } -// New returns a new InputService10ProtocolTest client. -func NewInputService10ProtocolTest(config *aws.Config) *InputService10ProtocolTest { - service := &service.Service{ - ServiceInfo: serviceinfo.ServiceInfo{ - Config: defaults.DefaultConfig.Merge(config), - ServiceName: "inputservice10protocoltest", - APIVersion: "2014-01-01", - }, +// New creates a new instance of the InputService10ProtocolTest client with a session. +// If additional configuration is needed for the client instance use the optional +// aws.Config parameter to add your extra config. +// +// Example: +// // Create a InputService10ProtocolTest client from just a session. +// svc := inputservice10protocoltest.New(mySession) +// +// // Create a InputService10ProtocolTest client with additional configuration +// svc := inputservice10protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) +func NewInputService10ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService10ProtocolTest { + c := p.ClientConfig("inputservice10protocoltest", cfgs...) + return newInputService10ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) +} + +// newClient creates, initializes and returns a new service client instance. +func newInputService10ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *InputService10ProtocolTest { + svc := &InputService10ProtocolTest{ + Client: client.New( + cfg, + metadata.ClientInfo{ + ServiceName: "inputservice10protocoltest", + SigningRegion: signingRegion, + Endpoint: endpoint, + APIVersion: "2014-01-01", + }, + handlers, + ), } - service.Initialize() // Handlers - service.Handlers.Sign.PushBack(v4.Sign) - service.Handlers.Build.PushBack(query.Build) - service.Handlers.Unmarshal.PushBack(query.Unmarshal) - service.Handlers.UnmarshalMeta.PushBack(query.UnmarshalMeta) - service.Handlers.UnmarshalError.PushBack(query.UnmarshalError) + svc.Handlers.Sign.PushBack(v4.Sign) + svc.Handlers.Build.PushBack(query.Build) + svc.Handlers.Unmarshal.PushBack(query.Unmarshal) + svc.Handlers.UnmarshalMeta.PushBack(query.UnmarshalMeta) + svc.Handlers.UnmarshalError.PushBack(query.UnmarshalError) - return &InputService10ProtocolTest{service} + return svc } // newRequest creates a new request for a InputService10ProtocolTest operation and runs any @@ -763,13 +1106,13 @@ func (c *InputService10ProtocolTest) newRequest(op *request.Operation, params, d const opInputService10TestCaseOperation1 = "OperationName" // InputService10TestCaseOperation1Request generates a request for the InputService10TestCaseOperation1 operation. -func (c *InputService10ProtocolTest) InputService10TestCaseOperation1Request(input *InputService10TestShapeInputShape) (req *request.Request, output *InputService10TestShapeInputService10TestCaseOperation1Output) { +func (c *InputService10ProtocolTest) InputService10TestCaseOperation1Request(input *InputService10TestShapeInputService10TestCaseOperation1Input) (req *request.Request, output *InputService10TestShapeInputService10TestCaseOperation1Output) { op := &request.Operation{ Name: opInputService10TestCaseOperation1, } if input == nil { - input = &InputService10TestShapeInputShape{} + input = &InputService10TestShapeInputService10TestCaseOperation1Input{} } req = c.newRequest(op, input, output) @@ -778,130 +1121,20 @@ func (c *InputService10ProtocolTest) InputService10TestCaseOperation1Request(inp return } -func (c *InputService10ProtocolTest) InputService10TestCaseOperation1(input *InputService10TestShapeInputShape) (*InputService10TestShapeInputService10TestCaseOperation1Output, error) { +func (c *InputService10ProtocolTest) InputService10TestCaseOperation1(input *InputService10TestShapeInputService10TestCaseOperation1Input) (*InputService10TestShapeInputService10TestCaseOperation1Output, error) { req, out := c.InputService10TestCaseOperation1Request(input) err := req.Send() return out, err } -const opInputService10TestCaseOperation2 = "OperationName" +type InputService10TestShapeInputService10TestCaseOperation1Input struct { + BlobArg []byte `type:"blob"` -// InputService10TestCaseOperation2Request generates a request for the InputService10TestCaseOperation2 operation. -func (c *InputService10ProtocolTest) InputService10TestCaseOperation2Request(input *InputService10TestShapeInputShape) (req *request.Request, output *InputService10TestShapeInputService10TestCaseOperation2Output) { - op := &request.Operation{ - Name: opInputService10TestCaseOperation2, - } - - if input == nil { - input = &InputService10TestShapeInputShape{} - } - - req = c.newRequest(op, input, output) - output = &InputService10TestShapeInputService10TestCaseOperation2Output{} - req.Data = output - return + metadataInputService10TestShapeInputService10TestCaseOperation1Input `json:"-" xml:"-"` } -func (c *InputService10ProtocolTest) InputService10TestCaseOperation2(input *InputService10TestShapeInputShape) (*InputService10TestShapeInputService10TestCaseOperation2Output, error) { - req, out := c.InputService10TestCaseOperation2Request(input) - err := req.Send() - return out, err -} - -const opInputService10TestCaseOperation3 = "OperationName" - -// InputService10TestCaseOperation3Request generates a request for the InputService10TestCaseOperation3 operation. -func (c *InputService10ProtocolTest) InputService10TestCaseOperation3Request(input *InputService10TestShapeInputShape) (req *request.Request, output *InputService10TestShapeInputService10TestCaseOperation3Output) { - op := &request.Operation{ - Name: opInputService10TestCaseOperation3, - } - - if input == nil { - input = &InputService10TestShapeInputShape{} - } - - req = c.newRequest(op, input, output) - output = &InputService10TestShapeInputService10TestCaseOperation3Output{} - req.Data = output - return -} - -func (c *InputService10ProtocolTest) InputService10TestCaseOperation3(input *InputService10TestShapeInputShape) (*InputService10TestShapeInputService10TestCaseOperation3Output, error) { - req, out := c.InputService10TestCaseOperation3Request(input) - err := req.Send() - return out, err -} - -const opInputService10TestCaseOperation4 = "OperationName" - -// InputService10TestCaseOperation4Request generates a request for the InputService10TestCaseOperation4 operation. -func (c *InputService10ProtocolTest) InputService10TestCaseOperation4Request(input *InputService10TestShapeInputShape) (req *request.Request, output *InputService10TestShapeInputService10TestCaseOperation4Output) { - op := &request.Operation{ - Name: opInputService10TestCaseOperation4, - } - - if input == nil { - input = &InputService10TestShapeInputShape{} - } - - req = c.newRequest(op, input, output) - output = &InputService10TestShapeInputService10TestCaseOperation4Output{} - req.Data = output - return -} - -func (c *InputService10ProtocolTest) InputService10TestCaseOperation4(input *InputService10TestShapeInputShape) (*InputService10TestShapeInputService10TestCaseOperation4Output, error) { - req, out := c.InputService10TestCaseOperation4Request(input) - err := req.Send() - return out, err -} - -const opInputService10TestCaseOperation5 = "OperationName" - -// InputService10TestCaseOperation5Request generates a request for the InputService10TestCaseOperation5 operation. -func (c *InputService10ProtocolTest) InputService10TestCaseOperation5Request(input *InputService10TestShapeInputShape) (req *request.Request, output *InputService10TestShapeInputService10TestCaseOperation5Output) { - op := &request.Operation{ - Name: opInputService10TestCaseOperation5, - } - - if input == nil { - input = &InputService10TestShapeInputShape{} - } - - req = c.newRequest(op, input, output) - output = &InputService10TestShapeInputService10TestCaseOperation5Output{} - req.Data = output - return -} - -func (c *InputService10ProtocolTest) InputService10TestCaseOperation5(input *InputService10TestShapeInputShape) (*InputService10TestShapeInputService10TestCaseOperation5Output, error) { - req, out := c.InputService10TestCaseOperation5Request(input) - err := req.Send() - return out, err -} - -const opInputService10TestCaseOperation6 = "OperationName" - -// InputService10TestCaseOperation6Request generates a request for the InputService10TestCaseOperation6 operation. -func (c *InputService10ProtocolTest) InputService10TestCaseOperation6Request(input *InputService10TestShapeInputShape) (req *request.Request, output *InputService10TestShapeInputService10TestCaseOperation6Output) { - op := &request.Operation{ - Name: opInputService10TestCaseOperation6, - } - - if input == nil { - input = &InputService10TestShapeInputShape{} - } - - req = c.newRequest(op, input, output) - output = &InputService10TestShapeInputService10TestCaseOperation6Output{} - req.Data = output - return -} - -func (c *InputService10ProtocolTest) InputService10TestCaseOperation6(input *InputService10TestShapeInputShape) (*InputService10TestShapeInputService10TestCaseOperation6Output, error) { - req, out := c.InputService10TestCaseOperation6Request(input) - err := req.Send() - return out, err +type metadataInputService10TestShapeInputService10TestCaseOperation1Input struct { + SDKShapeTraits bool `type:"structure"` } type InputService10TestShapeInputService10TestCaseOperation1Output struct { @@ -912,69 +1145,371 @@ type metadataInputService10TestShapeInputService10TestCaseOperation1Output struc SDKShapeTraits bool `type:"structure"` } -type InputService10TestShapeInputService10TestCaseOperation2Output struct { - metadataInputService10TestShapeInputService10TestCaseOperation2Output `json:"-" xml:"-"` +//The service client's operations are safe to be used concurrently. +// It is not safe to mutate any of the client's properties though. +type InputService11ProtocolTest struct { + *client.Client } -type metadataInputService10TestShapeInputService10TestCaseOperation2Output struct { +// New creates a new instance of the InputService11ProtocolTest client with a session. +// If additional configuration is needed for the client instance use the optional +// aws.Config parameter to add your extra config. +// +// Example: +// // Create a InputService11ProtocolTest client from just a session. +// svc := inputservice11protocoltest.New(mySession) +// +// // Create a InputService11ProtocolTest client with additional configuration +// svc := inputservice11protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) +func NewInputService11ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService11ProtocolTest { + c := p.ClientConfig("inputservice11protocoltest", cfgs...) + return newInputService11ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) +} + +// newClient creates, initializes and returns a new service client instance. +func newInputService11ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *InputService11ProtocolTest { + svc := &InputService11ProtocolTest{ + Client: client.New( + cfg, + metadata.ClientInfo{ + ServiceName: "inputservice11protocoltest", + SigningRegion: signingRegion, + Endpoint: endpoint, + APIVersion: "2014-01-01", + }, + handlers, + ), + } + + // Handlers + svc.Handlers.Sign.PushBack(v4.Sign) + svc.Handlers.Build.PushBack(query.Build) + svc.Handlers.Unmarshal.PushBack(query.Unmarshal) + svc.Handlers.UnmarshalMeta.PushBack(query.UnmarshalMeta) + svc.Handlers.UnmarshalError.PushBack(query.UnmarshalError) + + return svc +} + +// newRequest creates a new request for a InputService11ProtocolTest operation and runs any +// custom request initialization. +func (c *InputService11ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { + req := c.NewRequest(op, params, data) + + return req +} + +const opInputService11TestCaseOperation1 = "OperationName" + +// InputService11TestCaseOperation1Request generates a request for the InputService11TestCaseOperation1 operation. +func (c *InputService11ProtocolTest) InputService11TestCaseOperation1Request(input *InputService11TestShapeInputService11TestCaseOperation1Input) (req *request.Request, output *InputService11TestShapeInputService11TestCaseOperation1Output) { + op := &request.Operation{ + Name: opInputService11TestCaseOperation1, + } + + if input == nil { + input = &InputService11TestShapeInputService11TestCaseOperation1Input{} + } + + req = c.newRequest(op, input, output) + output = &InputService11TestShapeInputService11TestCaseOperation1Output{} + req.Data = output + return +} + +func (c *InputService11ProtocolTest) InputService11TestCaseOperation1(input *InputService11TestShapeInputService11TestCaseOperation1Input) (*InputService11TestShapeInputService11TestCaseOperation1Output, error) { + req, out := c.InputService11TestCaseOperation1Request(input) + err := req.Send() + return out, err +} + +type InputService11TestShapeInputService11TestCaseOperation1Input struct { + TimeArg *time.Time `type:"timestamp" timestampFormat:"iso8601"` + + metadataInputService11TestShapeInputService11TestCaseOperation1Input `json:"-" xml:"-"` +} + +type metadataInputService11TestShapeInputService11TestCaseOperation1Input struct { SDKShapeTraits bool `type:"structure"` } -type InputService10TestShapeInputService10TestCaseOperation3Output struct { - metadataInputService10TestShapeInputService10TestCaseOperation3Output `json:"-" xml:"-"` +type InputService11TestShapeInputService11TestCaseOperation1Output struct { + metadataInputService11TestShapeInputService11TestCaseOperation1Output `json:"-" xml:"-"` } -type metadataInputService10TestShapeInputService10TestCaseOperation3Output struct { +type metadataInputService11TestShapeInputService11TestCaseOperation1Output struct { SDKShapeTraits bool `type:"structure"` } -type InputService10TestShapeInputService10TestCaseOperation4Output struct { - metadataInputService10TestShapeInputService10TestCaseOperation4Output `json:"-" xml:"-"` +//The service client's operations are safe to be used concurrently. +// It is not safe to mutate any of the client's properties though. +type InputService12ProtocolTest struct { + *client.Client } -type metadataInputService10TestShapeInputService10TestCaseOperation4Output struct { +// New creates a new instance of the InputService12ProtocolTest client with a session. +// If additional configuration is needed for the client instance use the optional +// aws.Config parameter to add your extra config. +// +// Example: +// // Create a InputService12ProtocolTest client from just a session. +// svc := inputservice12protocoltest.New(mySession) +// +// // Create a InputService12ProtocolTest client with additional configuration +// svc := inputservice12protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) +func NewInputService12ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService12ProtocolTest { + c := p.ClientConfig("inputservice12protocoltest", cfgs...) + return newInputService12ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) +} + +// newClient creates, initializes and returns a new service client instance. +func newInputService12ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *InputService12ProtocolTest { + svc := &InputService12ProtocolTest{ + Client: client.New( + cfg, + metadata.ClientInfo{ + ServiceName: "inputservice12protocoltest", + SigningRegion: signingRegion, + Endpoint: endpoint, + APIVersion: "2014-01-01", + }, + handlers, + ), + } + + // Handlers + svc.Handlers.Sign.PushBack(v4.Sign) + svc.Handlers.Build.PushBack(query.Build) + svc.Handlers.Unmarshal.PushBack(query.Unmarshal) + svc.Handlers.UnmarshalMeta.PushBack(query.UnmarshalMeta) + svc.Handlers.UnmarshalError.PushBack(query.UnmarshalError) + + return svc +} + +// newRequest creates a new request for a InputService12ProtocolTest operation and runs any +// custom request initialization. +func (c *InputService12ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { + req := c.NewRequest(op, params, data) + + return req +} + +const opInputService12TestCaseOperation1 = "OperationName" + +// InputService12TestCaseOperation1Request generates a request for the InputService12TestCaseOperation1 operation. +func (c *InputService12ProtocolTest) InputService12TestCaseOperation1Request(input *InputService12TestShapeInputShape) (req *request.Request, output *InputService12TestShapeInputService12TestCaseOperation1Output) { + op := &request.Operation{ + Name: opInputService12TestCaseOperation1, + } + + if input == nil { + input = &InputService12TestShapeInputShape{} + } + + req = c.newRequest(op, input, output) + output = &InputService12TestShapeInputService12TestCaseOperation1Output{} + req.Data = output + return +} + +func (c *InputService12ProtocolTest) InputService12TestCaseOperation1(input *InputService12TestShapeInputShape) (*InputService12TestShapeInputService12TestCaseOperation1Output, error) { + req, out := c.InputService12TestCaseOperation1Request(input) + err := req.Send() + return out, err +} + +const opInputService12TestCaseOperation2 = "OperationName" + +// InputService12TestCaseOperation2Request generates a request for the InputService12TestCaseOperation2 operation. +func (c *InputService12ProtocolTest) InputService12TestCaseOperation2Request(input *InputService12TestShapeInputShape) (req *request.Request, output *InputService12TestShapeInputService12TestCaseOperation2Output) { + op := &request.Operation{ + Name: opInputService12TestCaseOperation2, + } + + if input == nil { + input = &InputService12TestShapeInputShape{} + } + + req = c.newRequest(op, input, output) + output = &InputService12TestShapeInputService12TestCaseOperation2Output{} + req.Data = output + return +} + +func (c *InputService12ProtocolTest) InputService12TestCaseOperation2(input *InputService12TestShapeInputShape) (*InputService12TestShapeInputService12TestCaseOperation2Output, error) { + req, out := c.InputService12TestCaseOperation2Request(input) + err := req.Send() + return out, err +} + +const opInputService12TestCaseOperation3 = "OperationName" + +// InputService12TestCaseOperation3Request generates a request for the InputService12TestCaseOperation3 operation. +func (c *InputService12ProtocolTest) InputService12TestCaseOperation3Request(input *InputService12TestShapeInputShape) (req *request.Request, output *InputService12TestShapeInputService12TestCaseOperation3Output) { + op := &request.Operation{ + Name: opInputService12TestCaseOperation3, + } + + if input == nil { + input = &InputService12TestShapeInputShape{} + } + + req = c.newRequest(op, input, output) + output = &InputService12TestShapeInputService12TestCaseOperation3Output{} + req.Data = output + return +} + +func (c *InputService12ProtocolTest) InputService12TestCaseOperation3(input *InputService12TestShapeInputShape) (*InputService12TestShapeInputService12TestCaseOperation3Output, error) { + req, out := c.InputService12TestCaseOperation3Request(input) + err := req.Send() + return out, err +} + +const opInputService12TestCaseOperation4 = "OperationName" + +// InputService12TestCaseOperation4Request generates a request for the InputService12TestCaseOperation4 operation. +func (c *InputService12ProtocolTest) InputService12TestCaseOperation4Request(input *InputService12TestShapeInputShape) (req *request.Request, output *InputService12TestShapeInputService12TestCaseOperation4Output) { + op := &request.Operation{ + Name: opInputService12TestCaseOperation4, + } + + if input == nil { + input = &InputService12TestShapeInputShape{} + } + + req = c.newRequest(op, input, output) + output = &InputService12TestShapeInputService12TestCaseOperation4Output{} + req.Data = output + return +} + +func (c *InputService12ProtocolTest) InputService12TestCaseOperation4(input *InputService12TestShapeInputShape) (*InputService12TestShapeInputService12TestCaseOperation4Output, error) { + req, out := c.InputService12TestCaseOperation4Request(input) + err := req.Send() + return out, err +} + +const opInputService12TestCaseOperation5 = "OperationName" + +// InputService12TestCaseOperation5Request generates a request for the InputService12TestCaseOperation5 operation. +func (c *InputService12ProtocolTest) InputService12TestCaseOperation5Request(input *InputService12TestShapeInputShape) (req *request.Request, output *InputService12TestShapeInputService12TestCaseOperation5Output) { + op := &request.Operation{ + Name: opInputService12TestCaseOperation5, + } + + if input == nil { + input = &InputService12TestShapeInputShape{} + } + + req = c.newRequest(op, input, output) + output = &InputService12TestShapeInputService12TestCaseOperation5Output{} + req.Data = output + return +} + +func (c *InputService12ProtocolTest) InputService12TestCaseOperation5(input *InputService12TestShapeInputShape) (*InputService12TestShapeInputService12TestCaseOperation5Output, error) { + req, out := c.InputService12TestCaseOperation5Request(input) + err := req.Send() + return out, err +} + +const opInputService12TestCaseOperation6 = "OperationName" + +// InputService12TestCaseOperation6Request generates a request for the InputService12TestCaseOperation6 operation. +func (c *InputService12ProtocolTest) InputService12TestCaseOperation6Request(input *InputService12TestShapeInputShape) (req *request.Request, output *InputService12TestShapeInputService12TestCaseOperation6Output) { + op := &request.Operation{ + Name: opInputService12TestCaseOperation6, + } + + if input == nil { + input = &InputService12TestShapeInputShape{} + } + + req = c.newRequest(op, input, output) + output = &InputService12TestShapeInputService12TestCaseOperation6Output{} + req.Data = output + return +} + +func (c *InputService12ProtocolTest) InputService12TestCaseOperation6(input *InputService12TestShapeInputShape) (*InputService12TestShapeInputService12TestCaseOperation6Output, error) { + req, out := c.InputService12TestCaseOperation6Request(input) + err := req.Send() + return out, err +} + +type InputService12TestShapeInputService12TestCaseOperation1Output struct { + metadataInputService12TestShapeInputService12TestCaseOperation1Output `json:"-" xml:"-"` +} + +type metadataInputService12TestShapeInputService12TestCaseOperation1Output struct { SDKShapeTraits bool `type:"structure"` } -type InputService10TestShapeInputService10TestCaseOperation5Output struct { - metadataInputService10TestShapeInputService10TestCaseOperation5Output `json:"-" xml:"-"` +type InputService12TestShapeInputService12TestCaseOperation2Output struct { + metadataInputService12TestShapeInputService12TestCaseOperation2Output `json:"-" xml:"-"` } -type metadataInputService10TestShapeInputService10TestCaseOperation5Output struct { +type metadataInputService12TestShapeInputService12TestCaseOperation2Output struct { SDKShapeTraits bool `type:"structure"` } -type InputService10TestShapeInputService10TestCaseOperation6Output struct { - metadataInputService10TestShapeInputService10TestCaseOperation6Output `json:"-" xml:"-"` +type InputService12TestShapeInputService12TestCaseOperation3Output struct { + metadataInputService12TestShapeInputService12TestCaseOperation3Output `json:"-" xml:"-"` } -type metadataInputService10TestShapeInputService10TestCaseOperation6Output struct { +type metadataInputService12TestShapeInputService12TestCaseOperation3Output struct { SDKShapeTraits bool `type:"structure"` } -type InputService10TestShapeInputShape struct { - RecursiveStruct *InputService10TestShapeRecursiveStructType `type:"structure"` - - metadataInputService10TestShapeInputShape `json:"-" xml:"-"` +type InputService12TestShapeInputService12TestCaseOperation4Output struct { + metadataInputService12TestShapeInputService12TestCaseOperation4Output `json:"-" xml:"-"` } -type metadataInputService10TestShapeInputShape struct { +type metadataInputService12TestShapeInputService12TestCaseOperation4Output struct { SDKShapeTraits bool `type:"structure"` } -type InputService10TestShapeRecursiveStructType struct { +type InputService12TestShapeInputService12TestCaseOperation5Output struct { + metadataInputService12TestShapeInputService12TestCaseOperation5Output `json:"-" xml:"-"` +} + +type metadataInputService12TestShapeInputService12TestCaseOperation5Output struct { + SDKShapeTraits bool `type:"structure"` +} + +type InputService12TestShapeInputService12TestCaseOperation6Output struct { + metadataInputService12TestShapeInputService12TestCaseOperation6Output `json:"-" xml:"-"` +} + +type metadataInputService12TestShapeInputService12TestCaseOperation6Output struct { + SDKShapeTraits bool `type:"structure"` +} + +type InputService12TestShapeInputShape struct { + RecursiveStruct *InputService12TestShapeRecursiveStructType `type:"structure"` + + metadataInputService12TestShapeInputShape `json:"-" xml:"-"` +} + +type metadataInputService12TestShapeInputShape struct { + SDKShapeTraits bool `type:"structure"` +} + +type InputService12TestShapeRecursiveStructType struct { NoRecurse *string `type:"string"` - RecursiveList []*InputService10TestShapeRecursiveStructType `type:"list"` + RecursiveList []*InputService12TestShapeRecursiveStructType `type:"list"` - RecursiveMap map[string]*InputService10TestShapeRecursiveStructType `type:"map"` + RecursiveMap map[string]*InputService12TestShapeRecursiveStructType `type:"map"` - RecursiveStruct *InputService10TestShapeRecursiveStructType `type:"structure"` + RecursiveStruct *InputService12TestShapeRecursiveStructType `type:"structure"` - metadataInputService10TestShapeRecursiveStructType `json:"-" xml:"-"` + metadataInputService12TestShapeRecursiveStructType `json:"-" xml:"-"` } -type metadataInputService10TestShapeRecursiveStructType struct { +type metadataInputService12TestShapeRecursiveStructType struct { SDKShapeTraits bool `type:"structure"` } @@ -983,10 +1518,10 @@ type metadataInputService10TestShapeRecursiveStructType struct { // func TestInputService1ProtocolTestScalarMembersCase1(t *testing.T) { - svc := NewInputService1ProtocolTest(nil) - svc.Endpoint = "https://test" + sess := session.New() + svc := NewInputService1ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - input := &InputService1TestShapeInputService1TestCaseOperation1Input{ + input := &InputService1TestShapeInputShape{ Bar: aws.String("val2"), Foo: aws.String("val1"), } @@ -1009,9 +1544,61 @@ func TestInputService1ProtocolTestScalarMembersCase1(t *testing.T) { } +func TestInputService1ProtocolTestScalarMembersCase2(t *testing.T) { + sess := session.New() + svc := NewInputService1ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + + input := &InputService1TestShapeInputShape{ + Baz: aws.Bool(true), + } + req, _ := svc.InputService1TestCaseOperation2Request(input) + r := req.HTTPRequest + + // build request + query.Build(req) + assert.NoError(t, req.Error) + + // assert body + assert.NotNil(t, r.Body) + body, _ := ioutil.ReadAll(r.Body) + awstesting.AssertQuery(t, `Action=OperationName&Baz=true&Version=2014-01-01`, util.Trim(string(body))) + + // assert URL + awstesting.AssertURL(t, "https://test/", r.URL.String()) + + // assert headers + +} + +func TestInputService1ProtocolTestScalarMembersCase3(t *testing.T) { + sess := session.New() + svc := NewInputService1ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + + input := &InputService1TestShapeInputShape{ + Baz: aws.Bool(false), + } + req, _ := svc.InputService1TestCaseOperation3Request(input) + r := req.HTTPRequest + + // build request + query.Build(req) + assert.NoError(t, req.Error) + + // assert body + assert.NotNil(t, r.Body) + body, _ := ioutil.ReadAll(r.Body) + awstesting.AssertQuery(t, `Action=OperationName&Baz=false&Version=2014-01-01`, util.Trim(string(body))) + + // assert URL + awstesting.AssertURL(t, "https://test/", r.URL.String()) + + // assert headers + +} + func TestInputService2ProtocolTestNestedStructureMembersCase1(t *testing.T) { - svc := NewInputService2ProtocolTest(nil) - svc.Endpoint = "https://test" + sess := session.New() + svc := NewInputService2ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) input := &InputService2TestShapeInputService2TestCaseOperation1Input{ StructArg: &InputService2TestShapeStructType{ @@ -1038,10 +1625,10 @@ func TestInputService2ProtocolTestNestedStructureMembersCase1(t *testing.T) { } func TestInputService3ProtocolTestListTypesCase1(t *testing.T) { - svc := NewInputService3ProtocolTest(nil) - svc.Endpoint = "https://test" + sess := session.New() + svc := NewInputService3ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - input := &InputService3TestShapeInputService3TestCaseOperation1Input{ + input := &InputService3TestShapeInputShape{ ListArg: []*string{ aws.String("foo"), aws.String("bar"), @@ -1067,11 +1654,37 @@ func TestInputService3ProtocolTestListTypesCase1(t *testing.T) { } -func TestInputService4ProtocolTestFlattenedListCase1(t *testing.T) { - svc := NewInputService4ProtocolTest(nil) - svc.Endpoint = "https://test" +func TestInputService3ProtocolTestListTypesCase2(t *testing.T) { + sess := session.New() + svc := NewInputService3ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - input := &InputService4TestShapeInputService4TestCaseOperation1Input{ + input := &InputService3TestShapeInputShape{ + ListArg: []*string{}, + } + req, _ := svc.InputService3TestCaseOperation2Request(input) + r := req.HTTPRequest + + // build request + query.Build(req) + assert.NoError(t, req.Error) + + // assert body + assert.NotNil(t, r.Body) + body, _ := ioutil.ReadAll(r.Body) + awstesting.AssertQuery(t, `Action=OperationName&ListArg=&Version=2014-01-01`, util.Trim(string(body))) + + // assert URL + awstesting.AssertURL(t, "https://test/", r.URL.String()) + + // assert headers + +} + +func TestInputService4ProtocolTestFlattenedListCase1(t *testing.T) { + sess := session.New() + svc := NewInputService4ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + + input := &InputService4TestShapeInputShape{ ListArg: []*string{ aws.String("a"), aws.String("b"), @@ -1098,11 +1711,98 @@ func TestInputService4ProtocolTestFlattenedListCase1(t *testing.T) { } -func TestInputService5ProtocolTestFlattenedListWithLocationNameCase1(t *testing.T) { - svc := NewInputService5ProtocolTest(nil) - svc.Endpoint = "https://test" +func TestInputService4ProtocolTestFlattenedListCase2(t *testing.T) { + sess := session.New() + svc := NewInputService4ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + + input := &InputService4TestShapeInputShape{ + NamedListArg: []*string{ + aws.String("a"), + }, + } + req, _ := svc.InputService4TestCaseOperation2Request(input) + r := req.HTTPRequest + + // build request + query.Build(req) + assert.NoError(t, req.Error) + + // assert body + assert.NotNil(t, r.Body) + body, _ := ioutil.ReadAll(r.Body) + awstesting.AssertQuery(t, `Action=OperationName&Foo.1=a&Version=2014-01-01`, util.Trim(string(body))) + + // assert URL + awstesting.AssertURL(t, "https://test/", r.URL.String()) + + // assert headers + +} + +func TestInputService5ProtocolTestSerializeFlattenedMapTypeCase1(t *testing.T) { + sess := session.New() + svc := NewInputService5ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) input := &InputService5TestShapeInputService5TestCaseOperation1Input{ + MapArg: map[string]*string{ + "key1": aws.String("val1"), + "key2": aws.String("val2"), + }, + } + req, _ := svc.InputService5TestCaseOperation1Request(input) + r := req.HTTPRequest + + // build request + query.Build(req) + assert.NoError(t, req.Error) + + // assert body + assert.NotNil(t, r.Body) + body, _ := ioutil.ReadAll(r.Body) + awstesting.AssertQuery(t, `Action=OperationName&MapArg.1.key=key1&MapArg.1.value=val1&MapArg.2.key=key2&MapArg.2.value=val2&Version=2014-01-01`, util.Trim(string(body))) + + // assert URL + awstesting.AssertURL(t, "https://test/", r.URL.String()) + + // assert headers + +} + +func TestInputService6ProtocolTestNonFlattenedListWithLocationNameCase1(t *testing.T) { + sess := session.New() + svc := NewInputService6ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + + input := &InputService6TestShapeInputService6TestCaseOperation1Input{ + ListArg: []*string{ + aws.String("a"), + aws.String("b"), + aws.String("c"), + }, + } + req, _ := svc.InputService6TestCaseOperation1Request(input) + r := req.HTTPRequest + + // build request + query.Build(req) + assert.NoError(t, req.Error) + + // assert body + assert.NotNil(t, r.Body) + body, _ := ioutil.ReadAll(r.Body) + awstesting.AssertQuery(t, `Action=OperationName&ListArg.item.1=a&ListArg.item.2=b&ListArg.item.3=c&Version=2014-01-01`, util.Trim(string(body))) + + // assert URL + awstesting.AssertURL(t, "https://test/", r.URL.String()) + + // assert headers + +} + +func TestInputService7ProtocolTestFlattenedListWithLocationNameCase1(t *testing.T) { + sess := session.New() + svc := NewInputService7ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + + input := &InputService7TestShapeInputService7TestCaseOperation1Input{ ListArg: []*string{ aws.String("a"), aws.String("b"), @@ -1110,7 +1810,7 @@ func TestInputService5ProtocolTestFlattenedListWithLocationNameCase1(t *testing. }, ScalarArg: aws.String("foo"), } - req, _ := svc.InputService5TestCaseOperation1Request(input) + req, _ := svc.InputService7TestCaseOperation1Request(input) r := req.HTTPRequest // build request @@ -1129,17 +1829,17 @@ func TestInputService5ProtocolTestFlattenedListWithLocationNameCase1(t *testing. } -func TestInputService6ProtocolTestSerializeMapTypeCase1(t *testing.T) { - svc := NewInputService6ProtocolTest(nil) - svc.Endpoint = "https://test" +func TestInputService8ProtocolTestSerializeMapTypeCase1(t *testing.T) { + sess := session.New() + svc := NewInputService8ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - input := &InputService6TestShapeInputService6TestCaseOperation1Input{ + input := &InputService8TestShapeInputService8TestCaseOperation1Input{ MapArg: map[string]*string{ "key1": aws.String("val1"), "key2": aws.String("val2"), }, } - req, _ := svc.InputService6TestCaseOperation1Request(input) + req, _ := svc.InputService8TestCaseOperation1Request(input) r := req.HTTPRequest // build request @@ -1158,17 +1858,17 @@ func TestInputService6ProtocolTestSerializeMapTypeCase1(t *testing.T) { } -func TestInputService7ProtocolTestSerializeMapTypeWithLocationNameCase1(t *testing.T) { - svc := NewInputService7ProtocolTest(nil) - svc.Endpoint = "https://test" +func TestInputService9ProtocolTestSerializeMapTypeWithLocationNameCase1(t *testing.T) { + sess := session.New() + svc := NewInputService9ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - input := &InputService7TestShapeInputService7TestCaseOperation1Input{ + input := &InputService9TestShapeInputService9TestCaseOperation1Input{ MapArg: map[string]*string{ "key1": aws.String("val1"), "key2": aws.String("val2"), }, } - req, _ := svc.InputService7TestCaseOperation1Request(input) + req, _ := svc.InputService9TestCaseOperation1Request(input) r := req.HTTPRequest // build request @@ -1187,14 +1887,14 @@ func TestInputService7ProtocolTestSerializeMapTypeWithLocationNameCase1(t *testi } -func TestInputService8ProtocolTestBase64EncodedBlobsCase1(t *testing.T) { - svc := NewInputService8ProtocolTest(nil) - svc.Endpoint = "https://test" +func TestInputService10ProtocolTestBase64EncodedBlobsCase1(t *testing.T) { + sess := session.New() + svc := NewInputService10ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - input := &InputService8TestShapeInputService8TestCaseOperation1Input{ + input := &InputService10TestShapeInputService10TestCaseOperation1Input{ BlobArg: []byte("foo"), } - req, _ := svc.InputService8TestCaseOperation1Request(input) + req, _ := svc.InputService10TestCaseOperation1Request(input) r := req.HTTPRequest // build request @@ -1213,14 +1913,14 @@ func TestInputService8ProtocolTestBase64EncodedBlobsCase1(t *testing.T) { } -func TestInputService9ProtocolTestTimestampValuesCase1(t *testing.T) { - svc := NewInputService9ProtocolTest(nil) - svc.Endpoint = "https://test" +func TestInputService11ProtocolTestTimestampValuesCase1(t *testing.T) { + sess := session.New() + svc := NewInputService11ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - input := &InputService9TestShapeInputService9TestCaseOperation1Input{ + input := &InputService11TestShapeInputService11TestCaseOperation1Input{ TimeArg: aws.Time(time.Unix(1422172800, 0)), } - req, _ := svc.InputService9TestCaseOperation1Request(input) + req, _ := svc.InputService11TestCaseOperation1Request(input) r := req.HTTPRequest // build request @@ -1239,16 +1939,16 @@ func TestInputService9ProtocolTestTimestampValuesCase1(t *testing.T) { } -func TestInputService10ProtocolTestRecursiveShapesCase1(t *testing.T) { - svc := NewInputService10ProtocolTest(nil) - svc.Endpoint = "https://test" +func TestInputService12ProtocolTestRecursiveShapesCase1(t *testing.T) { + sess := session.New() + svc := NewInputService12ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - input := &InputService10TestShapeInputShape{ - RecursiveStruct: &InputService10TestShapeRecursiveStructType{ + input := &InputService12TestShapeInputShape{ + RecursiveStruct: &InputService12TestShapeRecursiveStructType{ NoRecurse: aws.String("foo"), }, } - req, _ := svc.InputService10TestCaseOperation1Request(input) + req, _ := svc.InputService12TestCaseOperation1Request(input) r := req.HTTPRequest // build request @@ -1267,18 +1967,18 @@ func TestInputService10ProtocolTestRecursiveShapesCase1(t *testing.T) { } -func TestInputService10ProtocolTestRecursiveShapesCase2(t *testing.T) { - svc := NewInputService10ProtocolTest(nil) - svc.Endpoint = "https://test" +func TestInputService12ProtocolTestRecursiveShapesCase2(t *testing.T) { + sess := session.New() + svc := NewInputService12ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - input := &InputService10TestShapeInputShape{ - RecursiveStruct: &InputService10TestShapeRecursiveStructType{ - RecursiveStruct: &InputService10TestShapeRecursiveStructType{ + input := &InputService12TestShapeInputShape{ + RecursiveStruct: &InputService12TestShapeRecursiveStructType{ + RecursiveStruct: &InputService12TestShapeRecursiveStructType{ NoRecurse: aws.String("foo"), }, }, } - req, _ := svc.InputService10TestCaseOperation2Request(input) + req, _ := svc.InputService12TestCaseOperation2Request(input) r := req.HTTPRequest // build request @@ -1297,22 +1997,22 @@ func TestInputService10ProtocolTestRecursiveShapesCase2(t *testing.T) { } -func TestInputService10ProtocolTestRecursiveShapesCase3(t *testing.T) { - svc := NewInputService10ProtocolTest(nil) - svc.Endpoint = "https://test" +func TestInputService12ProtocolTestRecursiveShapesCase3(t *testing.T) { + sess := session.New() + svc := NewInputService12ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - input := &InputService10TestShapeInputShape{ - RecursiveStruct: &InputService10TestShapeRecursiveStructType{ - RecursiveStruct: &InputService10TestShapeRecursiveStructType{ - RecursiveStruct: &InputService10TestShapeRecursiveStructType{ - RecursiveStruct: &InputService10TestShapeRecursiveStructType{ + input := &InputService12TestShapeInputShape{ + RecursiveStruct: &InputService12TestShapeRecursiveStructType{ + RecursiveStruct: &InputService12TestShapeRecursiveStructType{ + RecursiveStruct: &InputService12TestShapeRecursiveStructType{ + RecursiveStruct: &InputService12TestShapeRecursiveStructType{ NoRecurse: aws.String("foo"), }, }, }, }, } - req, _ := svc.InputService10TestCaseOperation3Request(input) + req, _ := svc.InputService12TestCaseOperation3Request(input) r := req.HTTPRequest // build request @@ -1331,13 +2031,13 @@ func TestInputService10ProtocolTestRecursiveShapesCase3(t *testing.T) { } -func TestInputService10ProtocolTestRecursiveShapesCase4(t *testing.T) { - svc := NewInputService10ProtocolTest(nil) - svc.Endpoint = "https://test" +func TestInputService12ProtocolTestRecursiveShapesCase4(t *testing.T) { + sess := session.New() + svc := NewInputService12ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - input := &InputService10TestShapeInputShape{ - RecursiveStruct: &InputService10TestShapeRecursiveStructType{ - RecursiveList: []*InputService10TestShapeRecursiveStructType{ + input := &InputService12TestShapeInputShape{ + RecursiveStruct: &InputService12TestShapeRecursiveStructType{ + RecursiveList: []*InputService12TestShapeRecursiveStructType{ { NoRecurse: aws.String("foo"), }, @@ -1347,7 +2047,7 @@ func TestInputService10ProtocolTestRecursiveShapesCase4(t *testing.T) { }, }, } - req, _ := svc.InputService10TestCaseOperation4Request(input) + req, _ := svc.InputService12TestCaseOperation4Request(input) r := req.HTTPRequest // build request @@ -1366,25 +2066,25 @@ func TestInputService10ProtocolTestRecursiveShapesCase4(t *testing.T) { } -func TestInputService10ProtocolTestRecursiveShapesCase5(t *testing.T) { - svc := NewInputService10ProtocolTest(nil) - svc.Endpoint = "https://test" +func TestInputService12ProtocolTestRecursiveShapesCase5(t *testing.T) { + sess := session.New() + svc := NewInputService12ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - input := &InputService10TestShapeInputShape{ - RecursiveStruct: &InputService10TestShapeRecursiveStructType{ - RecursiveList: []*InputService10TestShapeRecursiveStructType{ + input := &InputService12TestShapeInputShape{ + RecursiveStruct: &InputService12TestShapeRecursiveStructType{ + RecursiveList: []*InputService12TestShapeRecursiveStructType{ { NoRecurse: aws.String("foo"), }, { - RecursiveStruct: &InputService10TestShapeRecursiveStructType{ + RecursiveStruct: &InputService12TestShapeRecursiveStructType{ NoRecurse: aws.String("bar"), }, }, }, }, } - req, _ := svc.InputService10TestCaseOperation5Request(input) + req, _ := svc.InputService12TestCaseOperation5Request(input) r := req.HTTPRequest // build request @@ -1403,13 +2103,13 @@ func TestInputService10ProtocolTestRecursiveShapesCase5(t *testing.T) { } -func TestInputService10ProtocolTestRecursiveShapesCase6(t *testing.T) { - svc := NewInputService10ProtocolTest(nil) - svc.Endpoint = "https://test" +func TestInputService12ProtocolTestRecursiveShapesCase6(t *testing.T) { + sess := session.New() + svc := NewInputService12ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) - input := &InputService10TestShapeInputShape{ - RecursiveStruct: &InputService10TestShapeRecursiveStructType{ - RecursiveMap: map[string]*InputService10TestShapeRecursiveStructType{ + input := &InputService12TestShapeInputShape{ + RecursiveStruct: &InputService12TestShapeRecursiveStructType{ + RecursiveMap: map[string]*InputService12TestShapeRecursiveStructType{ "bar": { NoRecurse: aws.String("bar"), }, @@ -1419,7 +2119,7 @@ func TestInputService10ProtocolTestRecursiveShapesCase6(t *testing.T) { }, }, } - req, _ := svc.InputService10TestCaseOperation6Request(input) + req, _ := svc.InputService12TestCaseOperation6Request(input) r := req.HTTPRequest // build request diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/protocol/query/queryutil/queryutil.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/protocol/query/queryutil/queryutil.go index 3b417a89f71..4afa4cf0eed 100644 --- a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/protocol/query/queryutil/queryutil.go +++ b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/protocol/query/queryutil/queryutil.go @@ -72,7 +72,7 @@ func (q *queryParser) parseStruct(v url.Values, value reflect.Value, prefix stri continue // ignore unexported fields } - value := elemOf(value.Field(i)) + elemValue := elemOf(value.Field(i)) field := t.Field(i) var name string @@ -97,7 +97,7 @@ func (q *queryParser) parseStruct(v url.Values, value reflect.Value, prefix stri name = prefix + "." + name } - if err := q.parseValue(v, value, name, field.Tag); err != nil { + if err := q.parseValue(v, elemValue, name, field.Tag); err != nil { return err } } diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/protocol/query/unmarshal_test.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/protocol/query/unmarshal_test.go index a3d08a1a2f0..fe2a58e3650 100644 --- a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/protocol/query/unmarshal_test.go +++ b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/protocol/query/unmarshal_test.go @@ -12,10 +12,10 @@ import ( "time" "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/defaults" + "github.com/aws/aws-sdk-go/aws/client" + "github.com/aws/aws-sdk-go/aws/client/metadata" "github.com/aws/aws-sdk-go/aws/request" - "github.com/aws/aws-sdk-go/aws/service" - "github.com/aws/aws-sdk-go/aws/service/serviceinfo" + "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/awstesting" "github.com/aws/aws-sdk-go/private/protocol/query" "github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil" @@ -35,30 +35,52 @@ var _ = ioutil.Discard var _ = util.Trim("") var _ = url.Values{} var _ = io.EOF +var _ = aws.String +//The service client's operations are safe to be used concurrently. +// It is not safe to mutate any of the client's properties though. type OutputService1ProtocolTest struct { - *service.Service + *client.Client } -// New returns a new OutputService1ProtocolTest client. -func NewOutputService1ProtocolTest(config *aws.Config) *OutputService1ProtocolTest { - service := &service.Service{ - ServiceInfo: serviceinfo.ServiceInfo{ - Config: defaults.DefaultConfig.Merge(config), - ServiceName: "outputservice1protocoltest", - APIVersion: "", - }, +// New creates a new instance of the OutputService1ProtocolTest client with a session. +// If additional configuration is needed for the client instance use the optional +// aws.Config parameter to add your extra config. +// +// Example: +// // Create a OutputService1ProtocolTest client from just a session. +// svc := outputservice1protocoltest.New(mySession) +// +// // Create a OutputService1ProtocolTest client with additional configuration +// svc := outputservice1protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) +func NewOutputService1ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService1ProtocolTest { + c := p.ClientConfig("outputservice1protocoltest", cfgs...) + return newOutputService1ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) +} + +// newClient creates, initializes and returns a new service client instance. +func newOutputService1ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *OutputService1ProtocolTest { + svc := &OutputService1ProtocolTest{ + Client: client.New( + cfg, + metadata.ClientInfo{ + ServiceName: "outputservice1protocoltest", + SigningRegion: signingRegion, + Endpoint: endpoint, + APIVersion: "", + }, + handlers, + ), } - service.Initialize() // Handlers - service.Handlers.Sign.PushBack(v4.Sign) - service.Handlers.Build.PushBack(query.Build) - service.Handlers.Unmarshal.PushBack(query.Unmarshal) - service.Handlers.UnmarshalMeta.PushBack(query.UnmarshalMeta) - service.Handlers.UnmarshalError.PushBack(query.UnmarshalError) + svc.Handlers.Sign.PushBack(v4.Sign) + svc.Handlers.Build.PushBack(query.Build) + svc.Handlers.Unmarshal.PushBack(query.Unmarshal) + svc.Handlers.UnmarshalMeta.PushBack(query.UnmarshalMeta) + svc.Handlers.UnmarshalError.PushBack(query.UnmarshalError) - return &OutputService1ProtocolTest{service} + return svc } // newRequest creates a new request for a OutputService1ProtocolTest operation and runs any @@ -127,29 +149,50 @@ type metadataOutputService1TestShapeOutputService1TestCaseOperation1Output struc SDKShapeTraits bool `type:"structure"` } +//The service client's operations are safe to be used concurrently. +// It is not safe to mutate any of the client's properties though. type OutputService2ProtocolTest struct { - *service.Service + *client.Client } -// New returns a new OutputService2ProtocolTest client. -func NewOutputService2ProtocolTest(config *aws.Config) *OutputService2ProtocolTest { - service := &service.Service{ - ServiceInfo: serviceinfo.ServiceInfo{ - Config: defaults.DefaultConfig.Merge(config), - ServiceName: "outputservice2protocoltest", - APIVersion: "", - }, +// New creates a new instance of the OutputService2ProtocolTest client with a session. +// If additional configuration is needed for the client instance use the optional +// aws.Config parameter to add your extra config. +// +// Example: +// // Create a OutputService2ProtocolTest client from just a session. +// svc := outputservice2protocoltest.New(mySession) +// +// // Create a OutputService2ProtocolTest client with additional configuration +// svc := outputservice2protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) +func NewOutputService2ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService2ProtocolTest { + c := p.ClientConfig("outputservice2protocoltest", cfgs...) + return newOutputService2ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) +} + +// newClient creates, initializes and returns a new service client instance. +func newOutputService2ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *OutputService2ProtocolTest { + svc := &OutputService2ProtocolTest{ + Client: client.New( + cfg, + metadata.ClientInfo{ + ServiceName: "outputservice2protocoltest", + SigningRegion: signingRegion, + Endpoint: endpoint, + APIVersion: "", + }, + handlers, + ), } - service.Initialize() // Handlers - service.Handlers.Sign.PushBack(v4.Sign) - service.Handlers.Build.PushBack(query.Build) - service.Handlers.Unmarshal.PushBack(query.Unmarshal) - service.Handlers.UnmarshalMeta.PushBack(query.UnmarshalMeta) - service.Handlers.UnmarshalError.PushBack(query.UnmarshalError) + svc.Handlers.Sign.PushBack(v4.Sign) + svc.Handlers.Build.PushBack(query.Build) + svc.Handlers.Unmarshal.PushBack(query.Unmarshal) + svc.Handlers.UnmarshalMeta.PushBack(query.UnmarshalMeta) + svc.Handlers.UnmarshalError.PushBack(query.UnmarshalError) - return &OutputService2ProtocolTest{service} + return svc } // newRequest creates a new request for a OutputService2ProtocolTest operation and runs any @@ -204,29 +247,50 @@ type metadataOutputService2TestShapeOutputService2TestCaseOperation1Output struc SDKShapeTraits bool `type:"structure"` } +//The service client's operations are safe to be used concurrently. +// It is not safe to mutate any of the client's properties though. type OutputService3ProtocolTest struct { - *service.Service + *client.Client } -// New returns a new OutputService3ProtocolTest client. -func NewOutputService3ProtocolTest(config *aws.Config) *OutputService3ProtocolTest { - service := &service.Service{ - ServiceInfo: serviceinfo.ServiceInfo{ - Config: defaults.DefaultConfig.Merge(config), - ServiceName: "outputservice3protocoltest", - APIVersion: "", - }, +// New creates a new instance of the OutputService3ProtocolTest client with a session. +// If additional configuration is needed for the client instance use the optional +// aws.Config parameter to add your extra config. +// +// Example: +// // Create a OutputService3ProtocolTest client from just a session. +// svc := outputservice3protocoltest.New(mySession) +// +// // Create a OutputService3ProtocolTest client with additional configuration +// svc := outputservice3protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) +func NewOutputService3ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService3ProtocolTest { + c := p.ClientConfig("outputservice3protocoltest", cfgs...) + return newOutputService3ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) +} + +// newClient creates, initializes and returns a new service client instance. +func newOutputService3ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *OutputService3ProtocolTest { + svc := &OutputService3ProtocolTest{ + Client: client.New( + cfg, + metadata.ClientInfo{ + ServiceName: "outputservice3protocoltest", + SigningRegion: signingRegion, + Endpoint: endpoint, + APIVersion: "", + }, + handlers, + ), } - service.Initialize() // Handlers - service.Handlers.Sign.PushBack(v4.Sign) - service.Handlers.Build.PushBack(query.Build) - service.Handlers.Unmarshal.PushBack(query.Unmarshal) - service.Handlers.UnmarshalMeta.PushBack(query.UnmarshalMeta) - service.Handlers.UnmarshalError.PushBack(query.UnmarshalError) + svc.Handlers.Sign.PushBack(v4.Sign) + svc.Handlers.Build.PushBack(query.Build) + svc.Handlers.Unmarshal.PushBack(query.Unmarshal) + svc.Handlers.UnmarshalMeta.PushBack(query.UnmarshalMeta) + svc.Handlers.UnmarshalError.PushBack(query.UnmarshalError) - return &OutputService3ProtocolTest{service} + return svc } // newRequest creates a new request for a OutputService3ProtocolTest operation and runs any @@ -279,29 +343,50 @@ type metadataOutputService3TestShapeOutputService3TestCaseOperation1Output struc SDKShapeTraits bool `type:"structure"` } +//The service client's operations are safe to be used concurrently. +// It is not safe to mutate any of the client's properties though. type OutputService4ProtocolTest struct { - *service.Service + *client.Client } -// New returns a new OutputService4ProtocolTest client. -func NewOutputService4ProtocolTest(config *aws.Config) *OutputService4ProtocolTest { - service := &service.Service{ - ServiceInfo: serviceinfo.ServiceInfo{ - Config: defaults.DefaultConfig.Merge(config), - ServiceName: "outputservice4protocoltest", - APIVersion: "", - }, +// New creates a new instance of the OutputService4ProtocolTest client with a session. +// If additional configuration is needed for the client instance use the optional +// aws.Config parameter to add your extra config. +// +// Example: +// // Create a OutputService4ProtocolTest client from just a session. +// svc := outputservice4protocoltest.New(mySession) +// +// // Create a OutputService4ProtocolTest client with additional configuration +// svc := outputservice4protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) +func NewOutputService4ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService4ProtocolTest { + c := p.ClientConfig("outputservice4protocoltest", cfgs...) + return newOutputService4ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) +} + +// newClient creates, initializes and returns a new service client instance. +func newOutputService4ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *OutputService4ProtocolTest { + svc := &OutputService4ProtocolTest{ + Client: client.New( + cfg, + metadata.ClientInfo{ + ServiceName: "outputservice4protocoltest", + SigningRegion: signingRegion, + Endpoint: endpoint, + APIVersion: "", + }, + handlers, + ), } - service.Initialize() // Handlers - service.Handlers.Sign.PushBack(v4.Sign) - service.Handlers.Build.PushBack(query.Build) - service.Handlers.Unmarshal.PushBack(query.Unmarshal) - service.Handlers.UnmarshalMeta.PushBack(query.UnmarshalMeta) - service.Handlers.UnmarshalError.PushBack(query.UnmarshalError) + svc.Handlers.Sign.PushBack(v4.Sign) + svc.Handlers.Build.PushBack(query.Build) + svc.Handlers.Unmarshal.PushBack(query.Unmarshal) + svc.Handlers.UnmarshalMeta.PushBack(query.UnmarshalMeta) + svc.Handlers.UnmarshalError.PushBack(query.UnmarshalError) - return &OutputService4ProtocolTest{service} + return svc } // newRequest creates a new request for a OutputService4ProtocolTest operation and runs any @@ -354,29 +439,50 @@ type metadataOutputService4TestShapeOutputService4TestCaseOperation1Output struc SDKShapeTraits bool `type:"structure"` } +//The service client's operations are safe to be used concurrently. +// It is not safe to mutate any of the client's properties though. type OutputService5ProtocolTest struct { - *service.Service + *client.Client } -// New returns a new OutputService5ProtocolTest client. -func NewOutputService5ProtocolTest(config *aws.Config) *OutputService5ProtocolTest { - service := &service.Service{ - ServiceInfo: serviceinfo.ServiceInfo{ - Config: defaults.DefaultConfig.Merge(config), - ServiceName: "outputservice5protocoltest", - APIVersion: "", - }, +// New creates a new instance of the OutputService5ProtocolTest client with a session. +// If additional configuration is needed for the client instance use the optional +// aws.Config parameter to add your extra config. +// +// Example: +// // Create a OutputService5ProtocolTest client from just a session. +// svc := outputservice5protocoltest.New(mySession) +// +// // Create a OutputService5ProtocolTest client with additional configuration +// svc := outputservice5protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) +func NewOutputService5ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService5ProtocolTest { + c := p.ClientConfig("outputservice5protocoltest", cfgs...) + return newOutputService5ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) +} + +// newClient creates, initializes and returns a new service client instance. +func newOutputService5ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *OutputService5ProtocolTest { + svc := &OutputService5ProtocolTest{ + Client: client.New( + cfg, + metadata.ClientInfo{ + ServiceName: "outputservice5protocoltest", + SigningRegion: signingRegion, + Endpoint: endpoint, + APIVersion: "", + }, + handlers, + ), } - service.Initialize() // Handlers - service.Handlers.Sign.PushBack(v4.Sign) - service.Handlers.Build.PushBack(query.Build) - service.Handlers.Unmarshal.PushBack(query.Unmarshal) - service.Handlers.UnmarshalMeta.PushBack(query.UnmarshalMeta) - service.Handlers.UnmarshalError.PushBack(query.UnmarshalError) + svc.Handlers.Sign.PushBack(v4.Sign) + svc.Handlers.Build.PushBack(query.Build) + svc.Handlers.Unmarshal.PushBack(query.Unmarshal) + svc.Handlers.UnmarshalMeta.PushBack(query.UnmarshalMeta) + svc.Handlers.UnmarshalError.PushBack(query.UnmarshalError) - return &OutputService5ProtocolTest{service} + return svc } // newRequest creates a new request for a OutputService5ProtocolTest operation and runs any @@ -429,29 +535,50 @@ type metadataOutputService5TestShapeOutputService5TestCaseOperation1Output struc SDKShapeTraits bool `type:"structure"` } +//The service client's operations are safe to be used concurrently. +// It is not safe to mutate any of the client's properties though. type OutputService6ProtocolTest struct { - *service.Service + *client.Client } -// New returns a new OutputService6ProtocolTest client. -func NewOutputService6ProtocolTest(config *aws.Config) *OutputService6ProtocolTest { - service := &service.Service{ - ServiceInfo: serviceinfo.ServiceInfo{ - Config: defaults.DefaultConfig.Merge(config), - ServiceName: "outputservice6protocoltest", - APIVersion: "", - }, +// New creates a new instance of the OutputService6ProtocolTest client with a session. +// If additional configuration is needed for the client instance use the optional +// aws.Config parameter to add your extra config. +// +// Example: +// // Create a OutputService6ProtocolTest client from just a session. +// svc := outputservice6protocoltest.New(mySession) +// +// // Create a OutputService6ProtocolTest client with additional configuration +// svc := outputservice6protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) +func NewOutputService6ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService6ProtocolTest { + c := p.ClientConfig("outputservice6protocoltest", cfgs...) + return newOutputService6ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) +} + +// newClient creates, initializes and returns a new service client instance. +func newOutputService6ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *OutputService6ProtocolTest { + svc := &OutputService6ProtocolTest{ + Client: client.New( + cfg, + metadata.ClientInfo{ + ServiceName: "outputservice6protocoltest", + SigningRegion: signingRegion, + Endpoint: endpoint, + APIVersion: "", + }, + handlers, + ), } - service.Initialize() // Handlers - service.Handlers.Sign.PushBack(v4.Sign) - service.Handlers.Build.PushBack(query.Build) - service.Handlers.Unmarshal.PushBack(query.Unmarshal) - service.Handlers.UnmarshalMeta.PushBack(query.UnmarshalMeta) - service.Handlers.UnmarshalError.PushBack(query.UnmarshalError) + svc.Handlers.Sign.PushBack(v4.Sign) + svc.Handlers.Build.PushBack(query.Build) + svc.Handlers.Unmarshal.PushBack(query.Unmarshal) + svc.Handlers.UnmarshalMeta.PushBack(query.UnmarshalMeta) + svc.Handlers.UnmarshalError.PushBack(query.UnmarshalError) - return &OutputService6ProtocolTest{service} + return svc } // newRequest creates a new request for a OutputService6ProtocolTest operation and runs any @@ -504,29 +631,50 @@ type metadataOutputService6TestShapeOutputService6TestCaseOperation1Output struc SDKShapeTraits bool `type:"structure"` } +//The service client's operations are safe to be used concurrently. +// It is not safe to mutate any of the client's properties though. type OutputService7ProtocolTest struct { - *service.Service + *client.Client } -// New returns a new OutputService7ProtocolTest client. -func NewOutputService7ProtocolTest(config *aws.Config) *OutputService7ProtocolTest { - service := &service.Service{ - ServiceInfo: serviceinfo.ServiceInfo{ - Config: defaults.DefaultConfig.Merge(config), - ServiceName: "outputservice7protocoltest", - APIVersion: "", - }, +// New creates a new instance of the OutputService7ProtocolTest client with a session. +// If additional configuration is needed for the client instance use the optional +// aws.Config parameter to add your extra config. +// +// Example: +// // Create a OutputService7ProtocolTest client from just a session. +// svc := outputservice7protocoltest.New(mySession) +// +// // Create a OutputService7ProtocolTest client with additional configuration +// svc := outputservice7protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) +func NewOutputService7ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService7ProtocolTest { + c := p.ClientConfig("outputservice7protocoltest", cfgs...) + return newOutputService7ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) +} + +// newClient creates, initializes and returns a new service client instance. +func newOutputService7ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *OutputService7ProtocolTest { + svc := &OutputService7ProtocolTest{ + Client: client.New( + cfg, + metadata.ClientInfo{ + ServiceName: "outputservice7protocoltest", + SigningRegion: signingRegion, + Endpoint: endpoint, + APIVersion: "", + }, + handlers, + ), } - service.Initialize() // Handlers - service.Handlers.Sign.PushBack(v4.Sign) - service.Handlers.Build.PushBack(query.Build) - service.Handlers.Unmarshal.PushBack(query.Unmarshal) - service.Handlers.UnmarshalMeta.PushBack(query.UnmarshalMeta) - service.Handlers.UnmarshalError.PushBack(query.UnmarshalError) + svc.Handlers.Sign.PushBack(v4.Sign) + svc.Handlers.Build.PushBack(query.Build) + svc.Handlers.Unmarshal.PushBack(query.Unmarshal) + svc.Handlers.UnmarshalMeta.PushBack(query.UnmarshalMeta) + svc.Handlers.UnmarshalError.PushBack(query.UnmarshalError) - return &OutputService7ProtocolTest{service} + return svc } // newRequest creates a new request for a OutputService7ProtocolTest operation and runs any @@ -579,29 +727,50 @@ type metadataOutputService7TestShapeOutputService7TestCaseOperation1Output struc SDKShapeTraits bool `type:"structure"` } +//The service client's operations are safe to be used concurrently. +// It is not safe to mutate any of the client's properties though. type OutputService8ProtocolTest struct { - *service.Service + *client.Client } -// New returns a new OutputService8ProtocolTest client. -func NewOutputService8ProtocolTest(config *aws.Config) *OutputService8ProtocolTest { - service := &service.Service{ - ServiceInfo: serviceinfo.ServiceInfo{ - Config: defaults.DefaultConfig.Merge(config), - ServiceName: "outputservice8protocoltest", - APIVersion: "", - }, +// New creates a new instance of the OutputService8ProtocolTest client with a session. +// If additional configuration is needed for the client instance use the optional +// aws.Config parameter to add your extra config. +// +// Example: +// // Create a OutputService8ProtocolTest client from just a session. +// svc := outputservice8protocoltest.New(mySession) +// +// // Create a OutputService8ProtocolTest client with additional configuration +// svc := outputservice8protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) +func NewOutputService8ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService8ProtocolTest { + c := p.ClientConfig("outputservice8protocoltest", cfgs...) + return newOutputService8ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) +} + +// newClient creates, initializes and returns a new service client instance. +func newOutputService8ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *OutputService8ProtocolTest { + svc := &OutputService8ProtocolTest{ + Client: client.New( + cfg, + metadata.ClientInfo{ + ServiceName: "outputservice8protocoltest", + SigningRegion: signingRegion, + Endpoint: endpoint, + APIVersion: "", + }, + handlers, + ), } - service.Initialize() // Handlers - service.Handlers.Sign.PushBack(v4.Sign) - service.Handlers.Build.PushBack(query.Build) - service.Handlers.Unmarshal.PushBack(query.Unmarshal) - service.Handlers.UnmarshalMeta.PushBack(query.UnmarshalMeta) - service.Handlers.UnmarshalError.PushBack(query.UnmarshalError) + svc.Handlers.Sign.PushBack(v4.Sign) + svc.Handlers.Build.PushBack(query.Build) + svc.Handlers.Unmarshal.PushBack(query.Unmarshal) + svc.Handlers.UnmarshalMeta.PushBack(query.UnmarshalMeta) + svc.Handlers.UnmarshalError.PushBack(query.UnmarshalError) - return &OutputService8ProtocolTest{service} + return svc } // newRequest creates a new request for a OutputService8ProtocolTest operation and runs any @@ -668,29 +837,50 @@ type metadataOutputService8TestShapeStructureShape struct { SDKShapeTraits bool `type:"structure"` } +//The service client's operations are safe to be used concurrently. +// It is not safe to mutate any of the client's properties though. type OutputService9ProtocolTest struct { - *service.Service + *client.Client } -// New returns a new OutputService9ProtocolTest client. -func NewOutputService9ProtocolTest(config *aws.Config) *OutputService9ProtocolTest { - service := &service.Service{ - ServiceInfo: serviceinfo.ServiceInfo{ - Config: defaults.DefaultConfig.Merge(config), - ServiceName: "outputservice9protocoltest", - APIVersion: "", - }, +// New creates a new instance of the OutputService9ProtocolTest client with a session. +// If additional configuration is needed for the client instance use the optional +// aws.Config parameter to add your extra config. +// +// Example: +// // Create a OutputService9ProtocolTest client from just a session. +// svc := outputservice9protocoltest.New(mySession) +// +// // Create a OutputService9ProtocolTest client with additional configuration +// svc := outputservice9protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) +func NewOutputService9ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService9ProtocolTest { + c := p.ClientConfig("outputservice9protocoltest", cfgs...) + return newOutputService9ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) +} + +// newClient creates, initializes and returns a new service client instance. +func newOutputService9ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *OutputService9ProtocolTest { + svc := &OutputService9ProtocolTest{ + Client: client.New( + cfg, + metadata.ClientInfo{ + ServiceName: "outputservice9protocoltest", + SigningRegion: signingRegion, + Endpoint: endpoint, + APIVersion: "", + }, + handlers, + ), } - service.Initialize() // Handlers - service.Handlers.Sign.PushBack(v4.Sign) - service.Handlers.Build.PushBack(query.Build) - service.Handlers.Unmarshal.PushBack(query.Unmarshal) - service.Handlers.UnmarshalMeta.PushBack(query.UnmarshalMeta) - service.Handlers.UnmarshalError.PushBack(query.UnmarshalError) + svc.Handlers.Sign.PushBack(v4.Sign) + svc.Handlers.Build.PushBack(query.Build) + svc.Handlers.Unmarshal.PushBack(query.Unmarshal) + svc.Handlers.UnmarshalMeta.PushBack(query.UnmarshalMeta) + svc.Handlers.UnmarshalError.PushBack(query.UnmarshalError) - return &OutputService9ProtocolTest{service} + return svc } // newRequest creates a new request for a OutputService9ProtocolTest operation and runs any @@ -757,29 +947,50 @@ type metadataOutputService9TestShapeStructureShape struct { SDKShapeTraits bool `type:"structure"` } +//The service client's operations are safe to be used concurrently. +// It is not safe to mutate any of the client's properties though. type OutputService10ProtocolTest struct { - *service.Service + *client.Client } -// New returns a new OutputService10ProtocolTest client. -func NewOutputService10ProtocolTest(config *aws.Config) *OutputService10ProtocolTest { - service := &service.Service{ - ServiceInfo: serviceinfo.ServiceInfo{ - Config: defaults.DefaultConfig.Merge(config), - ServiceName: "outputservice10protocoltest", - APIVersion: "", - }, +// New creates a new instance of the OutputService10ProtocolTest client with a session. +// If additional configuration is needed for the client instance use the optional +// aws.Config parameter to add your extra config. +// +// Example: +// // Create a OutputService10ProtocolTest client from just a session. +// svc := outputservice10protocoltest.New(mySession) +// +// // Create a OutputService10ProtocolTest client with additional configuration +// svc := outputservice10protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) +func NewOutputService10ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService10ProtocolTest { + c := p.ClientConfig("outputservice10protocoltest", cfgs...) + return newOutputService10ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) +} + +// newClient creates, initializes and returns a new service client instance. +func newOutputService10ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *OutputService10ProtocolTest { + svc := &OutputService10ProtocolTest{ + Client: client.New( + cfg, + metadata.ClientInfo{ + ServiceName: "outputservice10protocoltest", + SigningRegion: signingRegion, + Endpoint: endpoint, + APIVersion: "", + }, + handlers, + ), } - service.Initialize() // Handlers - service.Handlers.Sign.PushBack(v4.Sign) - service.Handlers.Build.PushBack(query.Build) - service.Handlers.Unmarshal.PushBack(query.Unmarshal) - service.Handlers.UnmarshalMeta.PushBack(query.UnmarshalMeta) - service.Handlers.UnmarshalError.PushBack(query.UnmarshalError) + svc.Handlers.Sign.PushBack(v4.Sign) + svc.Handlers.Build.PushBack(query.Build) + svc.Handlers.Unmarshal.PushBack(query.Unmarshal) + svc.Handlers.UnmarshalMeta.PushBack(query.UnmarshalMeta) + svc.Handlers.UnmarshalError.PushBack(query.UnmarshalError) - return &OutputService10ProtocolTest{service} + return svc } // newRequest creates a new request for a OutputService10ProtocolTest operation and runs any @@ -832,29 +1043,50 @@ type metadataOutputService10TestShapeOutputService10TestCaseOperation1Output str SDKShapeTraits bool `type:"structure"` } +//The service client's operations are safe to be used concurrently. +// It is not safe to mutate any of the client's properties though. type OutputService11ProtocolTest struct { - *service.Service + *client.Client } -// New returns a new OutputService11ProtocolTest client. -func NewOutputService11ProtocolTest(config *aws.Config) *OutputService11ProtocolTest { - service := &service.Service{ - ServiceInfo: serviceinfo.ServiceInfo{ - Config: defaults.DefaultConfig.Merge(config), - ServiceName: "outputservice11protocoltest", - APIVersion: "", - }, +// New creates a new instance of the OutputService11ProtocolTest client with a session. +// If additional configuration is needed for the client instance use the optional +// aws.Config parameter to add your extra config. +// +// Example: +// // Create a OutputService11ProtocolTest client from just a session. +// svc := outputservice11protocoltest.New(mySession) +// +// // Create a OutputService11ProtocolTest client with additional configuration +// svc := outputservice11protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) +func NewOutputService11ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService11ProtocolTest { + c := p.ClientConfig("outputservice11protocoltest", cfgs...) + return newOutputService11ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) +} + +// newClient creates, initializes and returns a new service client instance. +func newOutputService11ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *OutputService11ProtocolTest { + svc := &OutputService11ProtocolTest{ + Client: client.New( + cfg, + metadata.ClientInfo{ + ServiceName: "outputservice11protocoltest", + SigningRegion: signingRegion, + Endpoint: endpoint, + APIVersion: "", + }, + handlers, + ), } - service.Initialize() // Handlers - service.Handlers.Sign.PushBack(v4.Sign) - service.Handlers.Build.PushBack(query.Build) - service.Handlers.Unmarshal.PushBack(query.Unmarshal) - service.Handlers.UnmarshalMeta.PushBack(query.UnmarshalMeta) - service.Handlers.UnmarshalError.PushBack(query.UnmarshalError) + svc.Handlers.Sign.PushBack(v4.Sign) + svc.Handlers.Build.PushBack(query.Build) + svc.Handlers.Unmarshal.PushBack(query.Unmarshal) + svc.Handlers.UnmarshalMeta.PushBack(query.UnmarshalMeta) + svc.Handlers.UnmarshalError.PushBack(query.UnmarshalError) - return &OutputService11ProtocolTest{service} + return svc } // newRequest creates a new request for a OutputService11ProtocolTest operation and runs any @@ -917,29 +1149,50 @@ type metadataOutputService11TestShapeStructType struct { SDKShapeTraits bool `type:"structure"` } +//The service client's operations are safe to be used concurrently. +// It is not safe to mutate any of the client's properties though. type OutputService12ProtocolTest struct { - *service.Service + *client.Client } -// New returns a new OutputService12ProtocolTest client. -func NewOutputService12ProtocolTest(config *aws.Config) *OutputService12ProtocolTest { - service := &service.Service{ - ServiceInfo: serviceinfo.ServiceInfo{ - Config: defaults.DefaultConfig.Merge(config), - ServiceName: "outputservice12protocoltest", - APIVersion: "", - }, +// New creates a new instance of the OutputService12ProtocolTest client with a session. +// If additional configuration is needed for the client instance use the optional +// aws.Config parameter to add your extra config. +// +// Example: +// // Create a OutputService12ProtocolTest client from just a session. +// svc := outputservice12protocoltest.New(mySession) +// +// // Create a OutputService12ProtocolTest client with additional configuration +// svc := outputservice12protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) +func NewOutputService12ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService12ProtocolTest { + c := p.ClientConfig("outputservice12protocoltest", cfgs...) + return newOutputService12ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) +} + +// newClient creates, initializes and returns a new service client instance. +func newOutputService12ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *OutputService12ProtocolTest { + svc := &OutputService12ProtocolTest{ + Client: client.New( + cfg, + metadata.ClientInfo{ + ServiceName: "outputservice12protocoltest", + SigningRegion: signingRegion, + Endpoint: endpoint, + APIVersion: "", + }, + handlers, + ), } - service.Initialize() // Handlers - service.Handlers.Sign.PushBack(v4.Sign) - service.Handlers.Build.PushBack(query.Build) - service.Handlers.Unmarshal.PushBack(query.Unmarshal) - service.Handlers.UnmarshalMeta.PushBack(query.UnmarshalMeta) - service.Handlers.UnmarshalError.PushBack(query.UnmarshalError) + svc.Handlers.Sign.PushBack(v4.Sign) + svc.Handlers.Build.PushBack(query.Build) + svc.Handlers.Unmarshal.PushBack(query.Unmarshal) + svc.Handlers.UnmarshalMeta.PushBack(query.UnmarshalMeta) + svc.Handlers.UnmarshalError.PushBack(query.UnmarshalError) - return &OutputService12ProtocolTest{service} + return svc } // newRequest creates a new request for a OutputService12ProtocolTest operation and runs any @@ -992,29 +1245,50 @@ type metadataOutputService12TestShapeOutputService12TestCaseOperation1Output str SDKShapeTraits bool `type:"structure"` } +//The service client's operations are safe to be used concurrently. +// It is not safe to mutate any of the client's properties though. type OutputService13ProtocolTest struct { - *service.Service + *client.Client } -// New returns a new OutputService13ProtocolTest client. -func NewOutputService13ProtocolTest(config *aws.Config) *OutputService13ProtocolTest { - service := &service.Service{ - ServiceInfo: serviceinfo.ServiceInfo{ - Config: defaults.DefaultConfig.Merge(config), - ServiceName: "outputservice13protocoltest", - APIVersion: "", - }, +// New creates a new instance of the OutputService13ProtocolTest client with a session. +// If additional configuration is needed for the client instance use the optional +// aws.Config parameter to add your extra config. +// +// Example: +// // Create a OutputService13ProtocolTest client from just a session. +// svc := outputservice13protocoltest.New(mySession) +// +// // Create a OutputService13ProtocolTest client with additional configuration +// svc := outputservice13protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) +func NewOutputService13ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService13ProtocolTest { + c := p.ClientConfig("outputservice13protocoltest", cfgs...) + return newOutputService13ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) +} + +// newClient creates, initializes and returns a new service client instance. +func newOutputService13ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *OutputService13ProtocolTest { + svc := &OutputService13ProtocolTest{ + Client: client.New( + cfg, + metadata.ClientInfo{ + ServiceName: "outputservice13protocoltest", + SigningRegion: signingRegion, + Endpoint: endpoint, + APIVersion: "", + }, + handlers, + ), } - service.Initialize() // Handlers - service.Handlers.Sign.PushBack(v4.Sign) - service.Handlers.Build.PushBack(query.Build) - service.Handlers.Unmarshal.PushBack(query.Unmarshal) - service.Handlers.UnmarshalMeta.PushBack(query.UnmarshalMeta) - service.Handlers.UnmarshalError.PushBack(query.UnmarshalError) + svc.Handlers.Sign.PushBack(v4.Sign) + svc.Handlers.Build.PushBack(query.Build) + svc.Handlers.Unmarshal.PushBack(query.Unmarshal) + svc.Handlers.UnmarshalMeta.PushBack(query.UnmarshalMeta) + svc.Handlers.UnmarshalError.PushBack(query.UnmarshalError) - return &OutputService13ProtocolTest{service} + return svc } // newRequest creates a new request for a OutputService13ProtocolTest operation and runs any @@ -1067,29 +1341,50 @@ type metadataOutputService13TestShapeOutputService13TestCaseOperation1Output str SDKShapeTraits bool `type:"structure"` } +//The service client's operations are safe to be used concurrently. +// It is not safe to mutate any of the client's properties though. type OutputService14ProtocolTest struct { - *service.Service + *client.Client } -// New returns a new OutputService14ProtocolTest client. -func NewOutputService14ProtocolTest(config *aws.Config) *OutputService14ProtocolTest { - service := &service.Service{ - ServiceInfo: serviceinfo.ServiceInfo{ - Config: defaults.DefaultConfig.Merge(config), - ServiceName: "outputservice14protocoltest", - APIVersion: "", - }, +// New creates a new instance of the OutputService14ProtocolTest client with a session. +// If additional configuration is needed for the client instance use the optional +// aws.Config parameter to add your extra config. +// +// Example: +// // Create a OutputService14ProtocolTest client from just a session. +// svc := outputservice14protocoltest.New(mySession) +// +// // Create a OutputService14ProtocolTest client with additional configuration +// svc := outputservice14protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) +func NewOutputService14ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService14ProtocolTest { + c := p.ClientConfig("outputservice14protocoltest", cfgs...) + return newOutputService14ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) +} + +// newClient creates, initializes and returns a new service client instance. +func newOutputService14ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *OutputService14ProtocolTest { + svc := &OutputService14ProtocolTest{ + Client: client.New( + cfg, + metadata.ClientInfo{ + ServiceName: "outputservice14protocoltest", + SigningRegion: signingRegion, + Endpoint: endpoint, + APIVersion: "", + }, + handlers, + ), } - service.Initialize() // Handlers - service.Handlers.Sign.PushBack(v4.Sign) - service.Handlers.Build.PushBack(query.Build) - service.Handlers.Unmarshal.PushBack(query.Unmarshal) - service.Handlers.UnmarshalMeta.PushBack(query.UnmarshalMeta) - service.Handlers.UnmarshalError.PushBack(query.UnmarshalError) + svc.Handlers.Sign.PushBack(v4.Sign) + svc.Handlers.Build.PushBack(query.Build) + svc.Handlers.Unmarshal.PushBack(query.Unmarshal) + svc.Handlers.UnmarshalMeta.PushBack(query.UnmarshalMeta) + svc.Handlers.UnmarshalError.PushBack(query.UnmarshalError) - return &OutputService14ProtocolTest{service} + return svc } // newRequest creates a new request for a OutputService14ProtocolTest operation and runs any @@ -1142,12 +1437,109 @@ type metadataOutputService14TestShapeOutputService14TestCaseOperation1Output str SDKShapeTraits bool `type:"structure"` } +//The service client's operations are safe to be used concurrently. +// It is not safe to mutate any of the client's properties though. +type OutputService15ProtocolTest struct { + *client.Client +} + +// New creates a new instance of the OutputService15ProtocolTest client with a session. +// If additional configuration is needed for the client instance use the optional +// aws.Config parameter to add your extra config. +// +// Example: +// // Create a OutputService15ProtocolTest client from just a session. +// svc := outputservice15protocoltest.New(mySession) +// +// // Create a OutputService15ProtocolTest client with additional configuration +// svc := outputservice15protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) +func NewOutputService15ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService15ProtocolTest { + c := p.ClientConfig("outputservice15protocoltest", cfgs...) + return newOutputService15ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) +} + +// newClient creates, initializes and returns a new service client instance. +func newOutputService15ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *OutputService15ProtocolTest { + svc := &OutputService15ProtocolTest{ + Client: client.New( + cfg, + metadata.ClientInfo{ + ServiceName: "outputservice15protocoltest", + SigningRegion: signingRegion, + Endpoint: endpoint, + APIVersion: "", + }, + handlers, + ), + } + + // Handlers + svc.Handlers.Sign.PushBack(v4.Sign) + svc.Handlers.Build.PushBack(query.Build) + svc.Handlers.Unmarshal.PushBack(query.Unmarshal) + svc.Handlers.UnmarshalMeta.PushBack(query.UnmarshalMeta) + svc.Handlers.UnmarshalError.PushBack(query.UnmarshalError) + + return svc +} + +// newRequest creates a new request for a OutputService15ProtocolTest operation and runs any +// custom request initialization. +func (c *OutputService15ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { + req := c.NewRequest(op, params, data) + + return req +} + +const opOutputService15TestCaseOperation1 = "OperationName" + +// OutputService15TestCaseOperation1Request generates a request for the OutputService15TestCaseOperation1 operation. +func (c *OutputService15ProtocolTest) OutputService15TestCaseOperation1Request(input *OutputService15TestShapeOutputService15TestCaseOperation1Input) (req *request.Request, output *OutputService15TestShapeOutputService15TestCaseOperation1Output) { + op := &request.Operation{ + Name: opOutputService15TestCaseOperation1, + } + + if input == nil { + input = &OutputService15TestShapeOutputService15TestCaseOperation1Input{} + } + + req = c.newRequest(op, input, output) + output = &OutputService15TestShapeOutputService15TestCaseOperation1Output{} + req.Data = output + return +} + +func (c *OutputService15ProtocolTest) OutputService15TestCaseOperation1(input *OutputService15TestShapeOutputService15TestCaseOperation1Input) (*OutputService15TestShapeOutputService15TestCaseOperation1Output, error) { + req, out := c.OutputService15TestCaseOperation1Request(input) + err := req.Send() + return out, err +} + +type OutputService15TestShapeOutputService15TestCaseOperation1Input struct { + metadataOutputService15TestShapeOutputService15TestCaseOperation1Input `json:"-" xml:"-"` +} + +type metadataOutputService15TestShapeOutputService15TestCaseOperation1Input struct { + SDKShapeTraits bool `type:"structure"` +} + +type OutputService15TestShapeOutputService15TestCaseOperation1Output struct { + Foo *string `type:"string"` + + metadataOutputService15TestShapeOutputService15TestCaseOperation1Output `json:"-" xml:"-"` +} + +type metadataOutputService15TestShapeOutputService15TestCaseOperation1Output struct { + SDKShapeTraits bool `type:"structure"` +} + // // Tests begin here // func TestOutputService1ProtocolTestScalarMembersCase1(t *testing.T) { - svc := NewOutputService1ProtocolTest(nil) + sess := session.New() + svc := NewOutputService1ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) buf := bytes.NewReader([]byte("myname123falsetrue1.21.3200a2015-01-25T08:00:00Zrequest-id")) req, out := svc.OutputService1TestCaseOperation1Request(nil) @@ -1175,7 +1567,8 @@ func TestOutputService1ProtocolTestScalarMembersCase1(t *testing.T) { } func TestOutputService2ProtocolTestNotAllMembersInResponseCase1(t *testing.T) { - svc := NewOutputService2ProtocolTest(nil) + sess := session.New() + svc := NewOutputService2ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) buf := bytes.NewReader([]byte("mynamerequest-id")) req, out := svc.OutputService2TestCaseOperation1Request(nil) @@ -1195,7 +1588,8 @@ func TestOutputService2ProtocolTestNotAllMembersInResponseCase1(t *testing.T) { } func TestOutputService3ProtocolTestBlobCase1(t *testing.T) { - svc := NewOutputService3ProtocolTest(nil) + sess := session.New() + svc := NewOutputService3ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) buf := bytes.NewReader([]byte("dmFsdWU=requestid")) req, out := svc.OutputService3TestCaseOperation1Request(nil) @@ -1215,7 +1609,8 @@ func TestOutputService3ProtocolTestBlobCase1(t *testing.T) { } func TestOutputService4ProtocolTestListsCase1(t *testing.T) { - svc := NewOutputService4ProtocolTest(nil) + sess := session.New() + svc := NewOutputService4ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) buf := bytes.NewReader([]byte("abc123requestid")) req, out := svc.OutputService4TestCaseOperation1Request(nil) @@ -1236,7 +1631,8 @@ func TestOutputService4ProtocolTestListsCase1(t *testing.T) { } func TestOutputService5ProtocolTestListWithCustomMemberNameCase1(t *testing.T) { - svc := NewOutputService5ProtocolTest(nil) + sess := session.New() + svc := NewOutputService5ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) buf := bytes.NewReader([]byte("abc123requestid")) req, out := svc.OutputService5TestCaseOperation1Request(nil) @@ -1257,7 +1653,8 @@ func TestOutputService5ProtocolTestListWithCustomMemberNameCase1(t *testing.T) { } func TestOutputService6ProtocolTestFlattenedListCase1(t *testing.T) { - svc := NewOutputService6ProtocolTest(nil) + sess := session.New() + svc := NewOutputService6ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) buf := bytes.NewReader([]byte("abc123requestid")) req, out := svc.OutputService6TestCaseOperation1Request(nil) @@ -1278,7 +1675,8 @@ func TestOutputService6ProtocolTestFlattenedListCase1(t *testing.T) { } func TestOutputService7ProtocolTestFlattenedSingleElementListCase1(t *testing.T) { - svc := NewOutputService7ProtocolTest(nil) + sess := session.New() + svc := NewOutputService7ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) buf := bytes.NewReader([]byte("abcrequestid")) req, out := svc.OutputService7TestCaseOperation1Request(nil) @@ -1298,7 +1696,8 @@ func TestOutputService7ProtocolTestFlattenedSingleElementListCase1(t *testing.T) } func TestOutputService8ProtocolTestListOfStructuresCase1(t *testing.T) { - svc := NewOutputService8ProtocolTest(nil) + sess := session.New() + svc := NewOutputService8ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) buf := bytes.NewReader([]byte("firstfoofirstbarfirstbazsecondfoosecondbarsecondbazrequestid")) req, out := svc.OutputService8TestCaseOperation1Request(nil) @@ -1323,7 +1722,8 @@ func TestOutputService8ProtocolTestListOfStructuresCase1(t *testing.T) { } func TestOutputService9ProtocolTestFlattenedListOfStructuresCase1(t *testing.T) { - svc := NewOutputService9ProtocolTest(nil) + sess := session.New() + svc := NewOutputService9ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) buf := bytes.NewReader([]byte("firstfoofirstbarfirstbazsecondfoosecondbarsecondbazrequestid")) req, out := svc.OutputService9TestCaseOperation1Request(nil) @@ -1348,7 +1748,8 @@ func TestOutputService9ProtocolTestFlattenedListOfStructuresCase1(t *testing.T) } func TestOutputService10ProtocolTestFlattenedListWithLocationNameCase1(t *testing.T) { - svc := NewOutputService10ProtocolTest(nil) + sess := session.New() + svc := NewOutputService10ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) buf := bytes.NewReader([]byte("abrequestid")) req, out := svc.OutputService10TestCaseOperation1Request(nil) @@ -1369,7 +1770,8 @@ func TestOutputService10ProtocolTestFlattenedListWithLocationNameCase1(t *testin } func TestOutputService11ProtocolTestNormalMapCase1(t *testing.T) { - svc := NewOutputService11ProtocolTest(nil) + sess := session.New() + svc := NewOutputService11ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) buf := bytes.NewReader([]byte("quxbarbazbamrequestid")) req, out := svc.OutputService11TestCaseOperation1Request(nil) @@ -1390,7 +1792,8 @@ func TestOutputService11ProtocolTestNormalMapCase1(t *testing.T) { } func TestOutputService12ProtocolTestFlattenedMapCase1(t *testing.T) { - svc := NewOutputService12ProtocolTest(nil) + sess := session.New() + svc := NewOutputService12ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) buf := bytes.NewReader([]byte("quxbarbazbamrequestid")) req, out := svc.OutputService12TestCaseOperation1Request(nil) @@ -1411,7 +1814,8 @@ func TestOutputService12ProtocolTestFlattenedMapCase1(t *testing.T) { } func TestOutputService13ProtocolTestFlattenedMapInShapeDefinitionCase1(t *testing.T) { - svc := NewOutputService13ProtocolTest(nil) + sess := session.New() + svc := NewOutputService13ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) buf := bytes.NewReader([]byte("quxbarrequestid")) req, out := svc.OutputService13TestCaseOperation1Request(nil) @@ -1431,7 +1835,8 @@ func TestOutputService13ProtocolTestFlattenedMapInShapeDefinitionCase1(t *testin } func TestOutputService14ProtocolTestNamedMapCase1(t *testing.T) { - svc := NewOutputService14ProtocolTest(nil) + sess := session.New() + svc := NewOutputService14ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) buf := bytes.NewReader([]byte("quxbarbazbamrequestid")) req, out := svc.OutputService14TestCaseOperation1Request(nil) @@ -1450,3 +1855,24 @@ func TestOutputService14ProtocolTestNamedMapCase1(t *testing.T) { assert.Equal(t, "bar", *out.Map["qux"]) } + +func TestOutputService15ProtocolTestEmptyStringCase1(t *testing.T) { + sess := session.New() + svc := NewOutputService15ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + + buf := bytes.NewReader([]byte("requestid")) + req, out := svc.OutputService15TestCaseOperation1Request(nil) + req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} + + // set headers + + // unmarshal response + query.UnmarshalMeta(req) + query.Unmarshal(req) + assert.NoError(t, req.Error) + + // assert response + assert.NotNil(t, out) // ensure out variable is used + assert.Equal(t, "", *out.Foo) + +} diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/signer/v4/functional_test.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/signer/v4/functional_test.go index e7e7bd521d2..51a26d6ade6 100644 --- a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/signer/v4/functional_test.go +++ b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/signer/v4/functional_test.go @@ -5,16 +5,15 @@ import ( "testing" "time" + "github.com/stretchr/testify/assert" + "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/awstesting/unit" "github.com/aws/aws-sdk-go/service/s3" - "github.com/stretchr/testify/assert" ) -var _ = unit.Imported - func TestPresignHandler(t *testing.T) { - svc := s3.New(nil) + svc := s3.New(unit.Session) req, _ := svc.PutObjectRequest(&s3.PutObjectInput{ Bucket: aws.String("bucket"), Key: aws.String("key"), diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/signer/v4/v4.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/signer/v4/v4.go index ac7adfc959d..dc176f312ba 100644 --- a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/signer/v4/v4.go +++ b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/signer/v4/v4.go @@ -67,18 +67,18 @@ type signer struct { func Sign(req *request.Request) { // If the request does not need to be signed ignore the signing of the // request if the AnonymousCredentials object is used. - if req.Service.Config.Credentials == credentials.AnonymousCredentials { + if req.Config.Credentials == credentials.AnonymousCredentials { return } - region := req.Service.SigningRegion + region := req.ClientInfo.SigningRegion if region == "" { - region = aws.StringValue(req.Service.Config.Region) + region = aws.StringValue(req.Config.Region) } - name := req.Service.SigningName + name := req.ClientInfo.SigningName if name == "" { - name = req.Service.ServiceName + name = req.ClientInfo.ServiceName } s := signer{ @@ -89,9 +89,9 @@ func Sign(req *request.Request) { Body: req.Body, ServiceName: name, Region: region, - Credentials: req.Service.Config.Credentials, - Debug: req.Service.Config.LogLevel.Value(), - Logger: req.Service.Config.Logger, + Credentials: req.Config.Credentials, + Debug: req.Config.LogLevel.Value(), + Logger: req.Config.Logger, } req.Error = s.sign() diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/signer/v4/v4_test.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/signer/v4/v4_test.go index 0ba9ff25f73..f39414fcf91 100644 --- a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/signer/v4/v4_test.go +++ b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/signer/v4/v4_test.go @@ -6,11 +6,12 @@ import ( "testing" "time" + "github.com/stretchr/testify/assert" + "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/credentials" "github.com/aws/aws-sdk-go/aws/request" - "github.com/aws/aws-sdk-go/aws/service" - "github.com/stretchr/testify/assert" + "github.com/aws/aws-sdk-go/awstesting" ) func buildSigner(serviceName string, region string, signTime time.Time, expireTime time.Duration, body string) signer { @@ -118,7 +119,7 @@ func TestSignPrecomputedBodyChecksum(t *testing.T) { } func TestAnonymousCredentials(t *testing.T) { - svc := service.New(&aws.Config{Credentials: credentials.AnonymousCredentials}) + svc := awstesting.NewClient(&aws.Config{Credentials: credentials.AnonymousCredentials}) r := svc.NewRequest( &request.Operation{ Name: "BatchGetItem", @@ -142,7 +143,7 @@ func TestAnonymousCredentials(t *testing.T) { } func TestIgnoreResignRequestWithValidCreds(t *testing.T) { - svc := service.New(&aws.Config{ + svc := awstesting.NewClient(&aws.Config{ Credentials: credentials.NewStaticCredentials("AKID", "SECRET", "SESSION"), Region: aws.String("us-west-2"), }) @@ -164,7 +165,7 @@ func TestIgnoreResignRequestWithValidCreds(t *testing.T) { } func TestIgnorePreResignRequestWithValidCreds(t *testing.T) { - svc := service.New(&aws.Config{ + svc := awstesting.NewClient(&aws.Config{ Credentials: credentials.NewStaticCredentials("AKID", "SECRET", "SESSION"), Region: aws.String("us-west-2"), }) @@ -188,7 +189,7 @@ func TestIgnorePreResignRequestWithValidCreds(t *testing.T) { func TestResignRequestExpiredCreds(t *testing.T) { creds := credentials.NewStaticCredentials("AKID", "SECRET", "SESSION") - svc := service.New(&aws.Config{Credentials: creds}) + svc := awstesting.NewClient(&aws.Config{Credentials: creds}) r := svc.NewRequest( &request.Operation{ Name: "BatchGetItem", @@ -208,9 +209,13 @@ func TestResignRequestExpiredCreds(t *testing.T) { } func TestPreResignRequestExpiredCreds(t *testing.T) { - provider := &credentials.StaticProvider{credentials.Value{"AKID", "SECRET", "SESSION"}} + provider := &credentials.StaticProvider{Value: credentials.Value{ + AccessKeyID: "AKID", + SecretAccessKey: "SECRET", + SessionToken: "SESSION", + }} creds := credentials.NewCredentials(provider) - svc := service.New(&aws.Config{Credentials: creds}) + svc := awstesting.NewClient(&aws.Config{Credentials: creds}) r := svc.NewRequest( &request.Operation{ Name: "BatchGetItem", diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/waiter/waiter.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/waiter/waiter.go new file mode 100644 index 00000000000..e5fb13666ab --- /dev/null +++ b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/waiter/waiter.go @@ -0,0 +1,136 @@ +package waiter + +import ( + "fmt" + "reflect" + "time" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/awserr" + "github.com/aws/aws-sdk-go/aws/awsutil" + "github.com/aws/aws-sdk-go/aws/request" +) + +// A Config provides a collection of configuration values to setup a generated +// waiter code with. +type Config struct { + Name string + Delay int + MaxAttempts int + Operation string + Acceptors []WaitAcceptor +} + +// A WaitAcceptor provides the information needed to wait for an API operation +// to complete. +type WaitAcceptor struct { + Expected interface{} + Matcher string + State string + Argument string +} + +// A Waiter provides waiting for an operation to complete. +type Waiter struct { + Config + Client interface{} + Input interface{} +} + +// Wait waits for an operation to complete, expire max attempts, or fail. Error +// is returned if the operation fails. +func (w *Waiter) Wait() error { + client := reflect.ValueOf(w.Client) + in := reflect.ValueOf(w.Input) + method := client.MethodByName(w.Config.Operation + "Request") + + for i := 0; i < w.MaxAttempts; i++ { + res := method.Call([]reflect.Value{in}) + req := res[0].Interface().(*request.Request) + req.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Waiter")) + + err := req.Send() + for _, a := range w.Acceptors { + if err != nil && a.Matcher != "error" { + // Only matcher error is valid if there is a request error + continue + } + + result := false + var vals []interface{} + switch a.Matcher { + case "pathAll", "path": + // Require all matches to be equal for result to match + vals, _ = awsutil.ValuesAtPath(req.Data, a.Argument) + result = true + for _, val := range vals { + if !awsutil.DeepEqual(val, a.Expected) { + result = false + break + } + } + case "pathAny": + // Only a single match needs to equal for the result to match + vals, _ = awsutil.ValuesAtPath(req.Data, a.Argument) + for _, val := range vals { + if awsutil.DeepEqual(val, a.Expected) { + result = true + break + } + } + case "status": + s := a.Expected.(int) + result = s == req.HTTPResponse.StatusCode + case "error": + if aerr, ok := err.(awserr.Error); ok { + result = aerr.Code() == a.Expected.(string) + } + case "pathList": + // ignored matcher + default: + logf(client, "WARNING: Waiter for %s encountered unexpected matcher: %s", + w.Config.Operation, a.Matcher) + } + + if !result { + // If there was no matching result found there is nothing more to do + // for this response, retry the request. + continue + } + + switch a.State { + case "success": + // waiter completed + return nil + case "failure": + // Waiter failure state triggered + return awserr.New("ResourceNotReady", + fmt.Sprintf("failed waiting for successful resource state"), err) + case "retry": + // clear the error and retry the operation + err = nil + default: + logf(client, "WARNING: Waiter for %s encountered unexpected state: %s", + w.Config.Operation, a.State) + } + } + if err != nil { + return err + } + + time.Sleep(time.Second * time.Duration(w.Delay)) + } + + return awserr.New("ResourceNotReady", + fmt.Sprintf("exceeded %d wait attempts", w.MaxAttempts), nil) +} + +func logf(client reflect.Value, msg string, args ...interface{}) { + cfgVal := client.FieldByName("Config") + if !cfgVal.IsValid() { + return + } + if cfg, ok := cfgVal.Interface().(*aws.Config); ok && cfg.Logger != nil { + cfg.Logger.Log(fmt.Sprintf(msg, args...)) + } +} diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/waiter/waiter_test.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/waiter/waiter_test.go new file mode 100644 index 00000000000..d545f35370f --- /dev/null +++ b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/waiter/waiter_test.go @@ -0,0 +1,391 @@ +package waiter_test + +import ( + "bytes" + "io/ioutil" + "net/http" + "testing" + + "github.com/stretchr/testify/assert" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/awserr" + "github.com/aws/aws-sdk-go/aws/client" + "github.com/aws/aws-sdk-go/aws/request" + "github.com/aws/aws-sdk-go/awstesting" + "github.com/aws/aws-sdk-go/private/waiter" +) + +type mockClient struct { + *client.Client +} +type MockInput struct{} +type MockOutput struct { + States []*MockState +} +type MockState struct { + State *string +} + +func (c *mockClient) MockRequest(input *MockInput) (*request.Request, *MockOutput) { + op := &request.Operation{ + Name: "Mock", + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &MockInput{} + } + + output := &MockOutput{} + req := c.NewRequest(op, input, output) + req.Data = output + return req, output +} + +func TestWaiterPathAll(t *testing.T) { + svc := &mockClient{Client: awstesting.NewClient(&aws.Config{ + Region: aws.String("mock-region"), + })} + svc.Handlers.Send.Clear() // mock sending + svc.Handlers.Unmarshal.Clear() + svc.Handlers.UnmarshalMeta.Clear() + svc.Handlers.ValidateResponse.Clear() + + reqNum := 0 + resps := []*MockOutput{ + { // Request 1 + States: []*MockState{ + {State: aws.String("pending")}, + {State: aws.String("pending")}, + }, + }, + { // Request 2 + States: []*MockState{ + {State: aws.String("running")}, + {State: aws.String("pending")}, + }, + }, + { // Request 3 + States: []*MockState{ + {State: aws.String("running")}, + {State: aws.String("running")}, + }, + }, + } + + numBuiltReq := 0 + svc.Handlers.Build.PushBack(func(r *request.Request) { + numBuiltReq++ + }) + svc.Handlers.Unmarshal.PushBack(func(r *request.Request) { + if reqNum >= len(resps) { + assert.Fail(t, "too many polling requests made") + return + } + r.Data = resps[reqNum] + reqNum++ + }) + + waiterCfg := waiter.Config{ + Operation: "Mock", + Delay: 0, + MaxAttempts: 10, + Acceptors: []waiter.WaitAcceptor{ + { + State: "success", + Matcher: "pathAll", + Argument: "States[].State", + Expected: "running", + }, + }, + } + w := waiter.Waiter{ + Client: svc, + Input: &MockInput{}, + Config: waiterCfg, + } + + err := w.Wait() + assert.NoError(t, err) + assert.Equal(t, 3, numBuiltReq) + assert.Equal(t, 3, reqNum) +} + +func TestWaiterPath(t *testing.T) { + svc := &mockClient{Client: awstesting.NewClient(&aws.Config{ + Region: aws.String("mock-region"), + })} + svc.Handlers.Send.Clear() // mock sending + svc.Handlers.Unmarshal.Clear() + svc.Handlers.UnmarshalMeta.Clear() + svc.Handlers.ValidateResponse.Clear() + + reqNum := 0 + resps := []*MockOutput{ + { // Request 1 + States: []*MockState{ + {State: aws.String("pending")}, + {State: aws.String("pending")}, + }, + }, + { // Request 2 + States: []*MockState{ + {State: aws.String("running")}, + {State: aws.String("pending")}, + }, + }, + { // Request 3 + States: []*MockState{ + {State: aws.String("running")}, + {State: aws.String("running")}, + }, + }, + } + + numBuiltReq := 0 + svc.Handlers.Build.PushBack(func(r *request.Request) { + numBuiltReq++ + }) + svc.Handlers.Unmarshal.PushBack(func(r *request.Request) { + if reqNum >= len(resps) { + assert.Fail(t, "too many polling requests made") + return + } + r.Data = resps[reqNum] + reqNum++ + }) + + waiterCfg := waiter.Config{ + Operation: "Mock", + Delay: 0, + MaxAttempts: 10, + Acceptors: []waiter.WaitAcceptor{ + { + State: "success", + Matcher: "path", + Argument: "States[].State", + Expected: "running", + }, + }, + } + w := waiter.Waiter{ + Client: svc, + Input: &MockInput{}, + Config: waiterCfg, + } + + err := w.Wait() + assert.NoError(t, err) + assert.Equal(t, 3, numBuiltReq) + assert.Equal(t, 3, reqNum) +} + +func TestWaiterFailure(t *testing.T) { + svc := &mockClient{Client: awstesting.NewClient(&aws.Config{ + Region: aws.String("mock-region"), + })} + svc.Handlers.Send.Clear() // mock sending + svc.Handlers.Unmarshal.Clear() + svc.Handlers.UnmarshalMeta.Clear() + svc.Handlers.ValidateResponse.Clear() + + reqNum := 0 + resps := []*MockOutput{ + { // Request 1 + States: []*MockState{ + {State: aws.String("pending")}, + {State: aws.String("pending")}, + }, + }, + { // Request 2 + States: []*MockState{ + {State: aws.String("running")}, + {State: aws.String("pending")}, + }, + }, + { // Request 3 + States: []*MockState{ + {State: aws.String("running")}, + {State: aws.String("stopping")}, + }, + }, + } + + numBuiltReq := 0 + svc.Handlers.Build.PushBack(func(r *request.Request) { + numBuiltReq++ + }) + svc.Handlers.Unmarshal.PushBack(func(r *request.Request) { + if reqNum >= len(resps) { + assert.Fail(t, "too many polling requests made") + return + } + r.Data = resps[reqNum] + reqNum++ + }) + + waiterCfg := waiter.Config{ + Operation: "Mock", + Delay: 0, + MaxAttempts: 10, + Acceptors: []waiter.WaitAcceptor{ + { + State: "success", + Matcher: "pathAll", + Argument: "States[].State", + Expected: "running", + }, + { + State: "failure", + Matcher: "pathAny", + Argument: "States[].State", + Expected: "stopping", + }, + }, + } + w := waiter.Waiter{ + Client: svc, + Input: &MockInput{}, + Config: waiterCfg, + } + + err := w.Wait().(awserr.Error) + assert.Error(t, err) + assert.Equal(t, "ResourceNotReady", err.Code()) + assert.Equal(t, "failed waiting for successful resource state", err.Message()) + assert.Equal(t, 3, numBuiltReq) + assert.Equal(t, 3, reqNum) +} + +func TestWaiterError(t *testing.T) { + svc := &mockClient{Client: awstesting.NewClient(&aws.Config{ + Region: aws.String("mock-region"), + })} + svc.Handlers.Send.Clear() // mock sending + svc.Handlers.Unmarshal.Clear() + svc.Handlers.UnmarshalMeta.Clear() + svc.Handlers.ValidateResponse.Clear() + + reqNum := 0 + resps := []*MockOutput{ + { // Request 1 + States: []*MockState{ + {State: aws.String("pending")}, + {State: aws.String("pending")}, + }, + }, + { // Request 2, error case + }, + { // Request 3 + States: []*MockState{ + {State: aws.String("running")}, + {State: aws.String("running")}, + }, + }, + } + + numBuiltReq := 0 + svc.Handlers.Build.PushBack(func(r *request.Request) { + numBuiltReq++ + }) + svc.Handlers.Send.PushBack(func(r *request.Request) { + if reqNum == 1 { + r.Error = awserr.New("MockException", "mock exception message", nil) + r.HTTPResponse = &http.Response{ + StatusCode: 400, + Status: http.StatusText(400), + Body: ioutil.NopCloser(bytes.NewReader([]byte{})), + } + reqNum++ + } + }) + svc.Handlers.Unmarshal.PushBack(func(r *request.Request) { + if reqNum >= len(resps) { + assert.Fail(t, "too many polling requests made") + return + } + r.Data = resps[reqNum] + reqNum++ + }) + + waiterCfg := waiter.Config{ + Operation: "Mock", + Delay: 0, + MaxAttempts: 10, + Acceptors: []waiter.WaitAcceptor{ + { + State: "success", + Matcher: "pathAll", + Argument: "States[].State", + Expected: "running", + }, + { + State: "retry", + Matcher: "error", + Argument: "", + Expected: "MockException", + }, + }, + } + w := waiter.Waiter{ + Client: svc, + Input: &MockInput{}, + Config: waiterCfg, + } + + err := w.Wait() + assert.NoError(t, err) + assert.Equal(t, 3, numBuiltReq) + assert.Equal(t, 3, reqNum) +} + +func TestWaiterStatus(t *testing.T) { + svc := &mockClient{Client: awstesting.NewClient(&aws.Config{ + Region: aws.String("mock-region"), + })} + svc.Handlers.Send.Clear() // mock sending + svc.Handlers.Unmarshal.Clear() + svc.Handlers.UnmarshalMeta.Clear() + svc.Handlers.ValidateResponse.Clear() + + reqNum := 0 + svc.Handlers.Build.PushBack(func(r *request.Request) { + reqNum++ + }) + svc.Handlers.Send.PushBack(func(r *request.Request) { + code := 200 + if reqNum == 3 { + code = 404 + } + r.HTTPResponse = &http.Response{ + StatusCode: code, + Status: http.StatusText(code), + Body: ioutil.NopCloser(bytes.NewReader([]byte{})), + } + }) + + waiterCfg := waiter.Config{ + Operation: "Mock", + Delay: 0, + MaxAttempts: 10, + Acceptors: []waiter.WaitAcceptor{ + { + State: "success", + Matcher: "status", + Argument: "", + Expected: 404, + }, + }, + } + w := waiter.Waiter{ + Client: svc, + Input: &MockInput{}, + Config: waiterCfg, + } + + err := w.Wait() + assert.NoError(t, err) + assert.Equal(t, 3, reqNum) +} diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/service/cloudwatch/api.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/service/cloudwatch/api.go index 94df50a7c96..2099e40491d 100644 --- a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/service/cloudwatch/api.go +++ b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/service/cloudwatch/api.go @@ -74,6 +74,7 @@ func (c *CloudWatch) DescribeAlarmHistory(input *DescribeAlarmHistoryInput) (*De func (c *CloudWatch) DescribeAlarmHistoryPages(input *DescribeAlarmHistoryInput, fn func(p *DescribeAlarmHistoryOutput, lastPage bool) (shouldContinue bool)) error { page, _ := c.DescribeAlarmHistoryRequest(input) + page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) return page.EachPage(func(p interface{}, lastPage bool) bool { return fn(p.(*DescribeAlarmHistoryOutput), lastPage) }) @@ -116,6 +117,7 @@ func (c *CloudWatch) DescribeAlarms(input *DescribeAlarmsInput) (*DescribeAlarms func (c *CloudWatch) DescribeAlarmsPages(input *DescribeAlarmsInput, fn func(p *DescribeAlarmsOutput, lastPage bool) (shouldContinue bool)) error { page, _ := c.DescribeAlarmsRequest(input) + page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) return page.EachPage(func(p interface{}, lastPage bool) bool { return fn(p.(*DescribeAlarmsOutput), lastPage) }) @@ -293,6 +295,7 @@ func (c *CloudWatch) ListMetrics(input *ListMetricsInput) (*ListMetricsOutput, e func (c *CloudWatch) ListMetricsPages(input *ListMetricsInput, fn func(p *ListMetricsOutput, lastPage bool) (shouldContinue bool)) error { page, _ := c.ListMetricsRequest(input) + page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) return page.EachPage(func(p interface{}, lastPage bool) bool { return fn(p.(*ListMetricsOutput), lastPage) }) diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/service/cloudwatch/cloudwatchiface/interface.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/service/cloudwatch/cloudwatchiface/interface.go index d73332aa0c0..140dc9e9832 100644 --- a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/service/cloudwatch/cloudwatchiface/interface.go +++ b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/service/cloudwatch/cloudwatchiface/interface.go @@ -60,3 +60,5 @@ type CloudWatchAPI interface { SetAlarmState(*cloudwatch.SetAlarmStateInput) (*cloudwatch.SetAlarmStateOutput, error) } + +var _ CloudWatchAPI = (*cloudwatch.CloudWatch)(nil) diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/service/cloudwatch/cloudwatchiface/interface_test.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/service/cloudwatch/cloudwatchiface/interface_test.go deleted file mode 100644 index cdc377249db..00000000000 --- a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/service/cloudwatch/cloudwatchiface/interface_test.go +++ /dev/null @@ -1,15 +0,0 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. - -package cloudwatchiface_test - -import ( - "testing" - - "github.com/aws/aws-sdk-go/service/cloudwatch" - "github.com/aws/aws-sdk-go/service/cloudwatch/cloudwatchiface" - "github.com/stretchr/testify/assert" -) - -func TestInterface(t *testing.T) { - assert.Implements(t, (*cloudwatchiface.CloudWatchAPI)(nil), cloudwatch.New(nil)) -} diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/service/cloudwatch/examples_test.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/service/cloudwatch/examples_test.go index fbfc3f516df..07b010852b9 100644 --- a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/service/cloudwatch/examples_test.go +++ b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/service/cloudwatch/examples_test.go @@ -8,6 +8,7 @@ import ( "time" "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/cloudwatch" ) @@ -15,7 +16,7 @@ var _ time.Duration var _ bytes.Buffer func ExampleCloudWatch_DeleteAlarms() { - svc := cloudwatch.New(nil) + svc := cloudwatch.New(session.New()) params := &cloudwatch.DeleteAlarmsInput{ AlarmNames: []*string{ // Required @@ -37,7 +38,7 @@ func ExampleCloudWatch_DeleteAlarms() { } func ExampleCloudWatch_DescribeAlarmHistory() { - svc := cloudwatch.New(nil) + svc := cloudwatch.New(session.New()) params := &cloudwatch.DescribeAlarmHistoryInput{ AlarmName: aws.String("AlarmName"), @@ -61,7 +62,7 @@ func ExampleCloudWatch_DescribeAlarmHistory() { } func ExampleCloudWatch_DescribeAlarms() { - svc := cloudwatch.New(nil) + svc := cloudwatch.New(session.New()) params := &cloudwatch.DescribeAlarmsInput{ ActionPrefix: aws.String("ActionPrefix"), @@ -88,7 +89,7 @@ func ExampleCloudWatch_DescribeAlarms() { } func ExampleCloudWatch_DescribeAlarmsForMetric() { - svc := cloudwatch.New(nil) + svc := cloudwatch.New(session.New()) params := &cloudwatch.DescribeAlarmsForMetricInput{ MetricName: aws.String("MetricName"), // Required @@ -118,7 +119,7 @@ func ExampleCloudWatch_DescribeAlarmsForMetric() { } func ExampleCloudWatch_DisableAlarmActions() { - svc := cloudwatch.New(nil) + svc := cloudwatch.New(session.New()) params := &cloudwatch.DisableAlarmActionsInput{ AlarmNames: []*string{ // Required @@ -140,7 +141,7 @@ func ExampleCloudWatch_DisableAlarmActions() { } func ExampleCloudWatch_EnableAlarmActions() { - svc := cloudwatch.New(nil) + svc := cloudwatch.New(session.New()) params := &cloudwatch.EnableAlarmActionsInput{ AlarmNames: []*string{ // Required @@ -162,7 +163,7 @@ func ExampleCloudWatch_EnableAlarmActions() { } func ExampleCloudWatch_GetMetricStatistics() { - svc := cloudwatch.New(nil) + svc := cloudwatch.New(session.New()) params := &cloudwatch.GetMetricStatisticsInput{ EndTime: aws.Time(time.Now()), // Required @@ -197,7 +198,7 @@ func ExampleCloudWatch_GetMetricStatistics() { } func ExampleCloudWatch_ListMetrics() { - svc := cloudwatch.New(nil) + svc := cloudwatch.New(session.New()) params := &cloudwatch.ListMetricsInput{ Dimensions: []*cloudwatch.DimensionFilter{ @@ -225,7 +226,7 @@ func ExampleCloudWatch_ListMetrics() { } func ExampleCloudWatch_PutMetricAlarm() { - svc := cloudwatch.New(nil) + svc := cloudwatch.New(session.New()) params := &cloudwatch.PutMetricAlarmInput{ AlarmName: aws.String("AlarmName"), // Required @@ -273,7 +274,7 @@ func ExampleCloudWatch_PutMetricAlarm() { } func ExampleCloudWatch_PutMetricData() { - svc := cloudwatch.New(nil) + svc := cloudwatch.New(session.New()) params := &cloudwatch.PutMetricDataInput{ MetricData: []*cloudwatch.MetricDatum{ // Required @@ -314,7 +315,7 @@ func ExampleCloudWatch_PutMetricData() { } func ExampleCloudWatch_SetAlarmState() { - svc := cloudwatch.New(nil) + svc := cloudwatch.New(session.New()) params := &cloudwatch.SetAlarmStateInput{ AlarmName: aws.String("AlarmName"), // Required diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/service/cloudwatch/service.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/service/cloudwatch/service.go index 17a6f3f7524..e6f85068460 100644 --- a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/service/cloudwatch/service.go +++ b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/service/cloudwatch/service.go @@ -4,10 +4,9 @@ package cloudwatch import ( "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/defaults" + "github.com/aws/aws-sdk-go/aws/client" + "github.com/aws/aws-sdk-go/aws/client/metadata" "github.com/aws/aws-sdk-go/aws/request" - "github.com/aws/aws-sdk-go/aws/service" - "github.com/aws/aws-sdk-go/aws/service/serviceinfo" "github.com/aws/aws-sdk-go/private/protocol/query" "github.com/aws/aws-sdk-go/private/signer/v4" ) @@ -52,40 +51,64 @@ import ( // Center (http://aws.amazon.com/php/) AWS Python Developer Center (http://aws.amazon.com/python/) // AWS Ruby Developer Center (http://aws.amazon.com/ruby/) AWS Windows and .NET // Developer Center (http://aws.amazon.com/net/) +//The service client's operations are safe to be used concurrently. +// It is not safe to mutate any of the client's properties though. type CloudWatch struct { - *service.Service + *client.Client } -// Used for custom service initialization logic -var initService func(*service.Service) +// Used for custom client initialization logic +var initClient func(*client.Client) // Used for custom request initialization logic var initRequest func(*request.Request) -// New returns a new CloudWatch client. -func New(config *aws.Config) *CloudWatch { - service := &service.Service{ - ServiceInfo: serviceinfo.ServiceInfo{ - Config: defaults.DefaultConfig.Merge(config), - ServiceName: "monitoring", - APIVersion: "2010-08-01", - }, +// A ServiceName is the name of the service the client will make API calls to. +const ServiceName = "monitoring" + +// New creates a new instance of the CloudWatch client with a session. +// If additional configuration is needed for the client instance use the optional +// aws.Config parameter to add your extra config. +// +// Example: +// // Create a CloudWatch client from just a session. +// svc := cloudwatch.New(mySession) +// +// // Create a CloudWatch client with additional configuration +// svc := cloudwatch.New(mySession, aws.NewConfig().WithRegion("us-west-2")) +func New(p client.ConfigProvider, cfgs ...*aws.Config) *CloudWatch { + c := p.ClientConfig(ServiceName, cfgs...) + return newClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) +} + +// newClient creates, initializes and returns a new service client instance. +func newClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *CloudWatch { + svc := &CloudWatch{ + Client: client.New( + cfg, + metadata.ClientInfo{ + ServiceName: ServiceName, + SigningRegion: signingRegion, + Endpoint: endpoint, + APIVersion: "2010-08-01", + }, + handlers, + ), } - service.Initialize() // Handlers - service.Handlers.Sign.PushBack(v4.Sign) - service.Handlers.Build.PushBack(query.Build) - service.Handlers.Unmarshal.PushBack(query.Unmarshal) - service.Handlers.UnmarshalMeta.PushBack(query.UnmarshalMeta) - service.Handlers.UnmarshalError.PushBack(query.UnmarshalError) + svc.Handlers.Sign.PushBack(v4.Sign) + svc.Handlers.Build.PushBack(query.Build) + svc.Handlers.Unmarshal.PushBack(query.Unmarshal) + svc.Handlers.UnmarshalMeta.PushBack(query.UnmarshalMeta) + svc.Handlers.UnmarshalError.PushBack(query.UnmarshalError) - // Run custom service initialization if present - if initService != nil { - initService(service) + // Run custom client initialization if present + if initClient != nil { + initClient(svc.Client) } - return &CloudWatch{service} + return svc } // newRequest creates a new request for a CloudWatch operation and runs any diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/service/ec2/api.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/service/ec2/api.go index b4c238a5fb0..337392a86f2 100644 --- a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/service/ec2/api.go +++ b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/service/ec2/api.go @@ -871,7 +871,7 @@ func (c *EC2) CreateCustomerGatewayRequest(input *CreateCustomerGatewayInput) (r // gateway is the appliance at your end of the VPN connection. (The device on // the AWS side of the VPN connection is the virtual private gateway.) You must // provide the Internet-routable IP address of the customer gateway's external -// interface. The IP address must be static and can't be behind a device performing +// interface. The IP address must be static and may be behind a device performing // network address translation (NAT). // // For devices that use Border Gateway Protocol (BGP), you can also provide @@ -1598,6 +1598,9 @@ func (c *EC2) CreateTagsRequest(input *CreateTagsInput) (req *request.Request, o // of a key and optional value. Tag keys must be unique per resource. // // For more information about tags, see Tagging Your Resources (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Using_Tags.html) +// in the Amazon Elastic Compute Cloud User Guide. For more information about +// creating IAM policies that control users' access to resources based on tags, +// see Supported Resource-Level Permissions for Amazon EC2 API Actions (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-supported-iam-actions-resources.html) // in the Amazon Elastic Compute Cloud User Guide. func (c *EC2) CreateTags(input *CreateTagsInput) (*CreateTagsOutput, error) { req, out := c.CreateTagsRequest(input) @@ -3100,6 +3103,7 @@ func (c *EC2) DescribeInstanceStatus(input *DescribeInstanceStatusInput) (*Descr func (c *EC2) DescribeInstanceStatusPages(input *DescribeInstanceStatusInput, fn func(p *DescribeInstanceStatusOutput, lastPage bool) (shouldContinue bool)) error { page, _ := c.DescribeInstanceStatusRequest(input) + page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) return page.EachPage(func(p interface{}, lastPage bool) bool { return fn(p.(*DescribeInstanceStatusOutput), lastPage) }) @@ -3149,6 +3153,7 @@ func (c *EC2) DescribeInstances(input *DescribeInstancesInput) (*DescribeInstanc func (c *EC2) DescribeInstancesPages(input *DescribeInstancesInput, fn func(p *DescribeInstancesOutput, lastPage bool) (shouldContinue bool)) error { page, _ := c.DescribeInstancesRequest(input) + page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) return page.EachPage(func(p interface{}, lastPage bool) bool { return fn(p.(*DescribeInstancesOutput), lastPage) }) @@ -3534,6 +3539,7 @@ func (c *EC2) DescribeReservedInstancesModifications(input *DescribeReservedInst func (c *EC2) DescribeReservedInstancesModificationsPages(input *DescribeReservedInstancesModificationsInput, fn func(p *DescribeReservedInstancesModificationsOutput, lastPage bool) (shouldContinue bool)) error { page, _ := c.DescribeReservedInstancesModificationsRequest(input) + page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) return page.EachPage(func(p interface{}, lastPage bool) bool { return fn(p.(*DescribeReservedInstancesModificationsOutput), lastPage) }) @@ -3581,6 +3587,7 @@ func (c *EC2) DescribeReservedInstancesOfferings(input *DescribeReservedInstance func (c *EC2) DescribeReservedInstancesOfferingsPages(input *DescribeReservedInstancesOfferingsInput, fn func(p *DescribeReservedInstancesOfferingsOutput, lastPage bool) (shouldContinue bool)) error { page, _ := c.DescribeReservedInstancesOfferingsRequest(input) + page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) return page.EachPage(func(p interface{}, lastPage bool) bool { return fn(p.(*DescribeReservedInstancesOfferingsOutput), lastPage) }) @@ -3697,7 +3704,7 @@ func (c *EC2) DescribeSnapshotsRequest(input *DescribeSnapshotsInput) (req *requ Paginator: &request.Paginator{ InputTokens: []string{"NextToken"}, OutputTokens: []string{"NextToken"}, - LimitToken: "", + LimitToken: "MaxResults", TruncationToken: "", }, } @@ -3760,6 +3767,7 @@ func (c *EC2) DescribeSnapshots(input *DescribeSnapshotsInput) (*DescribeSnapsho func (c *EC2) DescribeSnapshotsPages(input *DescribeSnapshotsInput, fn func(p *DescribeSnapshotsOutput, lastPage bool) (shouldContinue bool)) error { page, _ := c.DescribeSnapshotsRequest(input) + page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) return page.EachPage(func(p interface{}, lastPage bool) bool { return fn(p.(*DescribeSnapshotsOutput), lastPage) }) @@ -3961,6 +3969,7 @@ func (c *EC2) DescribeSpotPriceHistory(input *DescribeSpotPriceHistoryInput) (*D func (c *EC2) DescribeSpotPriceHistoryPages(input *DescribeSpotPriceHistoryInput, fn func(p *DescribeSpotPriceHistoryOutput, lastPage bool) (shouldContinue bool)) error { page, _ := c.DescribeSpotPriceHistoryRequest(input) + page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) return page.EachPage(func(p interface{}, lastPage bool) bool { return fn(p.(*DescribeSpotPriceHistoryOutput), lastPage) }) @@ -4004,6 +4013,12 @@ func (c *EC2) DescribeTagsRequest(input *DescribeTagsInput) (req *request.Reques Name: opDescribeTags, HTTPMethod: "POST", HTTPPath: "/", + Paginator: &request.Paginator{ + InputTokens: []string{"NextToken"}, + OutputTokens: []string{"NextToken"}, + LimitToken: "MaxResults", + TruncationToken: "", + }, } if input == nil { @@ -4026,6 +4041,14 @@ func (c *EC2) DescribeTags(input *DescribeTagsInput) (*DescribeTagsOutput, error return out, err } +func (c *EC2) DescribeTagsPages(input *DescribeTagsInput, fn func(p *DescribeTagsOutput, lastPage bool) (shouldContinue bool)) error { + page, _ := c.DescribeTagsRequest(input) + page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) + return page.EachPage(func(p interface{}, lastPage bool) bool { + return fn(p.(*DescribeTagsOutput), lastPage) + }) +} + const opDescribeVolumeAttribute = "DescribeVolumeAttribute" // DescribeVolumeAttributeRequest generates a request for the DescribeVolumeAttribute operation. @@ -4126,6 +4149,7 @@ func (c *EC2) DescribeVolumeStatus(input *DescribeVolumeStatusInput) (*DescribeV func (c *EC2) DescribeVolumeStatusPages(input *DescribeVolumeStatusInput, fn func(p *DescribeVolumeStatusOutput, lastPage bool) (shouldContinue bool)) error { page, _ := c.DescribeVolumeStatusRequest(input) + page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) return page.EachPage(func(p interface{}, lastPage bool) bool { return fn(p.(*DescribeVolumeStatusOutput), lastPage) }) @@ -4176,6 +4200,7 @@ func (c *EC2) DescribeVolumes(input *DescribeVolumesInput) (*DescribeVolumesOutp func (c *EC2) DescribeVolumesPages(input *DescribeVolumesInput, fn func(p *DescribeVolumesOutput, lastPage bool) (shouldContinue bool)) error { page, _ := c.DescribeVolumesRequest(input) + page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) return page.EachPage(func(p interface{}, lastPage bool) bool { return fn(p.(*DescribeVolumesOutput), lastPage) }) @@ -9206,7 +9231,8 @@ func (s CreateSpotDatafeedSubscriptionOutput) GoString() string { type CreateSubnetInput struct { // The Availability Zone for the subnet. // - // Default: Amazon EC2 selects one for you (recommended). + // Default: AWS selects one for you. If you create more than one subnet in + // your VPC, we may not necessarily select a different zone for each subnet. AvailabilityZone *string `type:"string"` // The network range for the subnet, in CIDR notation. For example, 10.0.0.0/24. @@ -12262,7 +12288,7 @@ type DescribeInstancesInput struct { // // network-interface.vpc-id - The ID of the VPC for the network interface. // - // network-interface.network-interface.id - The ID of the network interface. + // network-interface.network-interface-id - The ID of the network interface. // // network-interface.owner-id - The ID of the owner of the network interface. // @@ -14153,7 +14179,7 @@ type DescribeSpotInstanceRequestsInput struct { // // launch.image-id - The ID of the AMI. // - // launch.instance-type - The type of instance (for example, m1.small). + // launch.instance-type - The type of instance (for example, m3.medium). // // launch.kernel-id - The kernel ID. // @@ -14291,7 +14317,7 @@ type DescribeSpotPriceHistoryInput struct { // // availability-zone - The Availability Zone for which prices should be returned. // - // instance-type - The type of instance (for example, m1.small). + // instance-type - The type of instance (for example, m3.medium). // // product-description - The product description for the Spot price (Linux/UNIX // | SUSE Linux | Windows | Linux/UNIX (Amazon VPC) | SUSE Linux (Amazon VPC) @@ -17491,7 +17517,7 @@ type Instance struct { // Any block device mapping entries for the instance. BlockDeviceMappings []*InstanceBlockDeviceMapping `locationName:"blockDeviceMapping" locationNameList:"item" type:"list"` - // The idempotency token you provided when you launched the instance. + // The idempotency token you provided when you launched the instance, if applicable. ClientToken *string `locationName:"clientToken" type:"string"` // Indicates whether the instance is optimized for EBS I/O. This optimization @@ -17504,7 +17530,7 @@ type Instance struct { // The hypervisor type of the instance. Hypervisor *string `locationName:"hypervisor" type:"string" enum:"HypervisorType"` - // The IAM instance profile associated with the instance. + // The IAM instance profile associated with the instance, if applicable. IamInstanceProfile *IamInstanceProfile `locationName:"iamInstanceProfile" type:"structure"` // The ID of the AMI used to launch the instance. @@ -17519,7 +17545,7 @@ type Instance struct { // The instance type. InstanceType *string `locationName:"instanceType" type:"string" enum:"InstanceType"` - // The kernel associated with this instance. + // The kernel associated with this instance, if applicable. KernelId *string `locationName:"kernelId" type:"string"` // The name of the key pair, if this instance was launched with an associated @@ -17535,7 +17561,7 @@ type Instance struct { // [EC2-VPC] One or more network interfaces for the instance. NetworkInterfaces []*InstanceNetworkInterface `locationName:"networkInterfaceSet" locationNameList:"item" type:"list"` - // The location where the instance launched. + // The location where the instance launched, if applicable. Placement *Placement `locationName:"placement" type:"structure"` // The value is Windows for Windows instances; otherwise blank. @@ -17543,23 +17569,25 @@ type Instance struct { // The private DNS name assigned to the instance. This DNS name can only be // used inside the Amazon EC2 network. This name is not available until the - // instance enters the running state. + // instance enters the running state. For EC2-VPC, this name is only available + // if you've enabled DNS hostnames for your VPC. PrivateDnsName *string `locationName:"privateDnsName" type:"string"` // The private IP address assigned to the instance. PrivateIpAddress *string `locationName:"privateIpAddress" type:"string"` - // The product codes attached to this instance. + // The product codes attached to this instance, if applicable. ProductCodes []*ProductCode `locationName:"productCodes" locationNameList:"item" type:"list"` // The public DNS name assigned to the instance. This name is not available - // until the instance enters the running state. + // until the instance enters the running state. For EC2-VPC, this name is only + // available if you've enabled DNS hostnames for your VPC. PublicDnsName *string `locationName:"dnsName" type:"string"` - // The public IP address assigned to the instance. + // The public IP address assigned to the instance, if applicable. PublicIpAddress *string `locationName:"ipAddress" type:"string"` - // The RAM disk associated with this instance. + // The RAM disk associated with this instance, if applicable. RamdiskId *string `locationName:"ramdiskId" type:"string"` // The root device name (for example, /dev/sda1 or /dev/xvda). @@ -17580,7 +17608,7 @@ type Instance struct { // in the Amazon Virtual Private Cloud User Guide. SourceDestCheck *bool `locationName:"sourceDestCheck" type:"boolean"` - // The ID of the Spot Instance request. + // If the request is a Spot instance request, the ID of the request. SpotInstanceRequestId *string `locationName:"spotInstanceRequestId" type:"string"` // Specifies whether enhanced networking is enabled. @@ -17595,7 +17623,7 @@ type Instance struct { // The reason for the most recent state transition. This might be an empty string. StateTransitionReason *string `locationName:"reason" type:"string"` - // The ID of the subnet in which the instance is running. + // [EC2-VPC] The ID of the subnet in which the instance is running. SubnetId *string `locationName:"subnetId" type:"string"` // Any tags assigned to the instance. @@ -17604,7 +17632,7 @@ type Instance struct { // The virtualization type of the instance. VirtualizationType *string `locationName:"virtualizationType" type:"string" enum:"VirtualizationType"` - // The ID of the VPC in which the instance is running. + // [EC2-VPC] The ID of the VPC in which the instance is running. VpcId *string `locationName:"vpcId" type:"string"` metadataInstance `json:"-" xml:"-"` @@ -18960,7 +18988,9 @@ type ModifyVpcAttributeInput struct { // Indicates whether the instances launched in the VPC get DNS hostnames. If // enabled, instances in the VPC get DNS hostnames; otherwise, they do not. // - // You can only enable DNS hostnames if you also enable DNS support. + // You cannot modify the DNS resolution and DNS hostnames attributes in the + // same request. Use separate requests for each attribute. You can only enable + // DNS hostnames if you've enabled DNS support. EnableDnsHostnames *AttributeBooleanValue `type:"structure"` // Indicates whether the DNS resolution is supported for the VPC. If enabled, @@ -18968,6 +18998,9 @@ type ModifyVpcAttributeInput struct { // or the reserved IP address at the base of the VPC network range "plus two" // will succeed. If disabled, the Amazon provided DNS service in the VPC that // resolves public DNS hostnames to IP addresses is not enabled. + // + // You cannot modify the DNS resolution and DNS hostnames attributes in the + // same request. Use separate requests for each attribute. EnableDnsSupport *AttributeBooleanValue `type:"structure"` // The ID of the VPC. @@ -20589,7 +20622,7 @@ type RequestSpotInstancesInput struct { // the instance a two-minute warning before it terminates. // // Note that you can't specify an Availability Zone group or a launch group - // if you specify a required duration. + // if you specify a duration. BlockDurationMinutes *int64 `locationName:"blockDurationMinutes" type:"integer"` // Unique, case-sensitive identifier that you provide to ensure the idempotency @@ -22348,8 +22381,8 @@ func (s SpotFleetRequestConfigData) GoString() string { // Describes a Spot instance request. type SpotInstanceRequest struct { - // If you specified a required duration and your request was fulfilled, this - // is the fixed hourly price in effect for the Spot instance while it runs. + // If you specified a duration and your Spot instance request was fulfilled, + // this is the fixed hourly price in effect for the Spot instance while it runs. ActualBlockHourlyPrice *string `locationName:"actualBlockHourlyPrice" type:"string"` // The Availability Zone group. If you specify the same Availability Zone group @@ -22357,7 +22390,7 @@ type SpotInstanceRequest struct { // Availability Zone. AvailabilityZoneGroup *string `locationName:"availabilityZoneGroup" type:"string"` - // The required duration for the Spot instance, in minutes. + // The duration for the Spot instance, in minutes. BlockDurationMinutes *int64 `locationName:"blockDurationMinutes" type:"integer"` // The date and time when the Spot instance request was created, in UTC format @@ -22460,7 +22493,8 @@ func (s SpotInstanceStateFault) GoString() string { // Describes the status of a Spot instance request. type SpotInstanceStatus struct { - // The status code. + // The status code. For a list of status codes, see Spot Bid Status Codes (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/spot-bid-status.html#spot-instance-bid-status-understand) + // in the Amazon Elastic Compute Cloud User Guide. Code *string `locationName:"code" type:"string"` // The description for the status code. diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/service/ec2/customizations.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/service/ec2/customizations.go index 99f0820477e..9e94fe671ce 100644 --- a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/service/ec2/customizations.go +++ b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/service/ec2/customizations.go @@ -3,8 +3,10 @@ package ec2 import ( "time" + "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/awsutil" "github.com/aws/aws-sdk-go/aws/request" + "github.com/aws/aws-sdk-go/private/endpoints" ) func init() { @@ -20,38 +22,34 @@ func fillPresignedURL(r *request.Request) { return } - params := r.Params.(*CopySnapshotInput) + origParams := r.Params.(*CopySnapshotInput) // Stop if PresignedURL/DestinationRegion is set - if params.PresignedUrl != nil || params.DestinationRegion != nil { + if origParams.PresignedUrl != nil || origParams.DestinationRegion != nil { return } - // First generate a copy of parameters - r.Params = awsutil.CopyOf(r.Params) - params = r.Params.(*CopySnapshotInput) + origParams.DestinationRegion = r.Config.Region + newParams := awsutil.CopyOf(r.Params).(*CopySnapshotInput) - // Set destination region. Avoids infinite handler loop. - // Also needed to sign sub-request. - params.DestinationRegion = r.Service.Config.Region - - // Create a new client pointing at source region. - // We will use this to presign the CopySnapshot request against - // the source region - config := r.Service.Config.Copy(). + // Create a new request based on the existing request. We will use this to + // presign the CopySnapshot request against the source region. + cfg := r.Config.Copy(aws.NewConfig(). WithEndpoint(""). - WithRegion(*params.SourceRegion) + WithRegion(aws.StringValue(origParams.SourceRegion))) - client := New(config) + clientInfo := r.ClientInfo + clientInfo.Endpoint, clientInfo.SigningRegion = endpoints.EndpointForRegion( + clientInfo.ServiceName, aws.StringValue(cfg.Region), aws.BoolValue(cfg.DisableSSL)) // Presign a CopySnapshot request with modified params - req, _ := client.CopySnapshotRequest(params) - url, err := req.Presign(300 * time.Second) // 5 minutes should be enough. - - if err != nil { // bubble error back up to original request + req := request.New(*cfg, clientInfo, r.Handlers, r.Retryer, r.Operation, newParams, r.Data) + url, err := req.Presign(5 * time.Minute) // 5 minutes should be enough. + if err != nil { // bubble error back up to original request r.Error = err + return } // We have our URL, set it on params - params.PresignedUrl = &url + origParams.PresignedUrl = &url } diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/service/ec2/customizations_test.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/service/ec2/customizations_test.go index 0fbd49b9a2c..195d9b55b8d 100644 --- a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/service/ec2/customizations_test.go +++ b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/service/ec2/customizations_test.go @@ -11,10 +11,8 @@ import ( "github.com/stretchr/testify/assert" ) -var _ = unit.Imported - func TestCopySnapshotPresignedURL(t *testing.T) { - svc := ec2.New(&aws.Config{Region: aws.String("us-west-2")}) + svc := ec2.New(unit.Session, &aws.Config{Region: aws.String("us-west-2")}) assert.NotPanics(t, func() { // Doesn't panic on nil input @@ -30,7 +28,8 @@ func TestCopySnapshotPresignedURL(t *testing.T) { b, _ := ioutil.ReadAll(req.HTTPRequest.Body) q, _ := url.ParseQuery(string(b)) - url, _ := url.QueryUnescape(q.Get("PresignedUrl")) + u, _ := url.QueryUnescape(q.Get("PresignedUrl")) assert.Equal(t, "us-west-2", q.Get("DestinationRegion")) - assert.Regexp(t, `^https://ec2\.us-west-1\.amazon.+&DestinationRegion=us-west-2`, url) + assert.Equal(t, "us-west-1", q.Get("SourceRegion")) + assert.Regexp(t, `^https://ec2\.us-west-1\.amazonaws\.com/.+&DestinationRegion=us-west-2`, u) } diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/service/ec2/ec2iface/interface.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/service/ec2/ec2iface/interface.go index 88a209d1608..5bcf93248ae 100644 --- a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/service/ec2/ec2iface/interface.go +++ b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/service/ec2/ec2iface/interface.go @@ -486,6 +486,8 @@ type EC2API interface { DescribeTags(*ec2.DescribeTagsInput) (*ec2.DescribeTagsOutput, error) + DescribeTagsPages(*ec2.DescribeTagsInput, func(*ec2.DescribeTagsOutput, bool) bool) error + DescribeVolumeAttributeRequest(*ec2.DescribeVolumeAttributeInput) (*request.Request, *ec2.DescribeVolumeAttributeOutput) DescribeVolumeAttribute(*ec2.DescribeVolumeAttributeInput) (*ec2.DescribeVolumeAttributeOutput, error) @@ -758,3 +760,5 @@ type EC2API interface { UnmonitorInstances(*ec2.UnmonitorInstancesInput) (*ec2.UnmonitorInstancesOutput, error) } + +var _ EC2API = (*ec2.EC2)(nil) diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/service/ec2/ec2iface/interface_test.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/service/ec2/ec2iface/interface_test.go deleted file mode 100644 index 3941d260db0..00000000000 --- a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/service/ec2/ec2iface/interface_test.go +++ /dev/null @@ -1,15 +0,0 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. - -package ec2iface_test - -import ( - "testing" - - "github.com/aws/aws-sdk-go/service/ec2" - "github.com/aws/aws-sdk-go/service/ec2/ec2iface" - "github.com/stretchr/testify/assert" -) - -func TestInterface(t *testing.T) { - assert.Implements(t, (*ec2iface.EC2API)(nil), ec2.New(nil)) -} diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/service/ec2/examples_test.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/service/ec2/examples_test.go index 3a827ef3f23..86557fc15d0 100644 --- a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/service/ec2/examples_test.go +++ b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/service/ec2/examples_test.go @@ -8,6 +8,7 @@ import ( "time" "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/ec2" ) @@ -15,7 +16,7 @@ var _ time.Duration var _ bytes.Buffer func ExampleEC2_AcceptVpcPeeringConnection() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.AcceptVpcPeeringConnectionInput{ DryRun: aws.Bool(true), @@ -35,7 +36,7 @@ func ExampleEC2_AcceptVpcPeeringConnection() { } func ExampleEC2_AllocateAddress() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.AllocateAddressInput{ Domain: aws.String("DomainType"), @@ -55,7 +56,7 @@ func ExampleEC2_AllocateAddress() { } func ExampleEC2_AssignPrivateIpAddresses() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.AssignPrivateIpAddressesInput{ NetworkInterfaceId: aws.String("String"), // Required @@ -80,7 +81,7 @@ func ExampleEC2_AssignPrivateIpAddresses() { } func ExampleEC2_AssociateAddress() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.AssociateAddressInput{ AllocationId: aws.String("String"), @@ -105,7 +106,7 @@ func ExampleEC2_AssociateAddress() { } func ExampleEC2_AssociateDhcpOptions() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.AssociateDhcpOptionsInput{ DhcpOptionsId: aws.String("String"), // Required @@ -126,7 +127,7 @@ func ExampleEC2_AssociateDhcpOptions() { } func ExampleEC2_AssociateRouteTable() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.AssociateRouteTableInput{ RouteTableId: aws.String("String"), // Required @@ -147,7 +148,7 @@ func ExampleEC2_AssociateRouteTable() { } func ExampleEC2_AttachClassicLinkVpc() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.AttachClassicLinkVpcInput{ Groups: []*string{ // Required @@ -172,7 +173,7 @@ func ExampleEC2_AttachClassicLinkVpc() { } func ExampleEC2_AttachInternetGateway() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.AttachInternetGatewayInput{ InternetGatewayId: aws.String("String"), // Required @@ -193,7 +194,7 @@ func ExampleEC2_AttachInternetGateway() { } func ExampleEC2_AttachNetworkInterface() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.AttachNetworkInterfaceInput{ DeviceIndex: aws.Int64(1), // Required @@ -215,7 +216,7 @@ func ExampleEC2_AttachNetworkInterface() { } func ExampleEC2_AttachVolume() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.AttachVolumeInput{ Device: aws.String("String"), // Required @@ -237,7 +238,7 @@ func ExampleEC2_AttachVolume() { } func ExampleEC2_AttachVpnGateway() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.AttachVpnGatewayInput{ VpcId: aws.String("String"), // Required @@ -258,7 +259,7 @@ func ExampleEC2_AttachVpnGateway() { } func ExampleEC2_AuthorizeSecurityGroupEgress() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.AuthorizeSecurityGroupEgressInput{ GroupId: aws.String("String"), // Required @@ -312,7 +313,7 @@ func ExampleEC2_AuthorizeSecurityGroupEgress() { } func ExampleEC2_AuthorizeSecurityGroupIngress() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.AuthorizeSecurityGroupIngressInput{ CidrIp: aws.String("String"), @@ -367,7 +368,7 @@ func ExampleEC2_AuthorizeSecurityGroupIngress() { } func ExampleEC2_BundleInstance() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.BundleInstanceInput{ InstanceId: aws.String("String"), // Required @@ -396,7 +397,7 @@ func ExampleEC2_BundleInstance() { } func ExampleEC2_CancelBundleTask() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.CancelBundleTaskInput{ BundleId: aws.String("String"), // Required @@ -416,7 +417,7 @@ func ExampleEC2_CancelBundleTask() { } func ExampleEC2_CancelConversionTask() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.CancelConversionTaskInput{ ConversionTaskId: aws.String("String"), // Required @@ -437,7 +438,7 @@ func ExampleEC2_CancelConversionTask() { } func ExampleEC2_CancelExportTask() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.CancelExportTaskInput{ ExportTaskId: aws.String("String"), // Required @@ -456,7 +457,7 @@ func ExampleEC2_CancelExportTask() { } func ExampleEC2_CancelImportTask() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.CancelImportTaskInput{ CancelReason: aws.String("String"), @@ -477,7 +478,7 @@ func ExampleEC2_CancelImportTask() { } func ExampleEC2_CancelReservedInstancesListing() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.CancelReservedInstancesListingInput{ ReservedInstancesListingId: aws.String("String"), // Required @@ -496,7 +497,7 @@ func ExampleEC2_CancelReservedInstancesListing() { } func ExampleEC2_CancelSpotFleetRequests() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.CancelSpotFleetRequestsInput{ SpotFleetRequestIds: []*string{ // Required @@ -520,7 +521,7 @@ func ExampleEC2_CancelSpotFleetRequests() { } func ExampleEC2_CancelSpotInstanceRequests() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.CancelSpotInstanceRequestsInput{ SpotInstanceRequestIds: []*string{ // Required @@ -543,7 +544,7 @@ func ExampleEC2_CancelSpotInstanceRequests() { } func ExampleEC2_ConfirmProductInstance() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.ConfirmProductInstanceInput{ InstanceId: aws.String("String"), // Required @@ -564,7 +565,7 @@ func ExampleEC2_ConfirmProductInstance() { } func ExampleEC2_CopyImage() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.CopyImageInput{ Name: aws.String("String"), // Required @@ -588,7 +589,7 @@ func ExampleEC2_CopyImage() { } func ExampleEC2_CopySnapshot() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.CopySnapshotInput{ SourceRegion: aws.String("String"), // Required @@ -614,7 +615,7 @@ func ExampleEC2_CopySnapshot() { } func ExampleEC2_CreateCustomerGateway() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.CreateCustomerGatewayInput{ BgpAsn: aws.Int64(1), // Required @@ -636,7 +637,7 @@ func ExampleEC2_CreateCustomerGateway() { } func ExampleEC2_CreateDhcpOptions() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.CreateDhcpOptionsInput{ DhcpConfigurations: []*ec2.NewDhcpConfiguration{ // Required @@ -665,7 +666,7 @@ func ExampleEC2_CreateDhcpOptions() { } func ExampleEC2_CreateFlowLogs() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.CreateFlowLogsInput{ DeliverLogsPermissionArn: aws.String("String"), // Required @@ -692,7 +693,7 @@ func ExampleEC2_CreateFlowLogs() { } func ExampleEC2_CreateImage() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.CreateImageInput{ InstanceId: aws.String("String"), // Required @@ -731,7 +732,7 @@ func ExampleEC2_CreateImage() { } func ExampleEC2_CreateInstanceExportTask() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.CreateInstanceExportTaskInput{ InstanceId: aws.String("String"), // Required @@ -758,7 +759,7 @@ func ExampleEC2_CreateInstanceExportTask() { } func ExampleEC2_CreateInternetGateway() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.CreateInternetGatewayInput{ DryRun: aws.Bool(true), @@ -777,7 +778,7 @@ func ExampleEC2_CreateInternetGateway() { } func ExampleEC2_CreateKeyPair() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.CreateKeyPairInput{ KeyName: aws.String("String"), // Required @@ -797,7 +798,7 @@ func ExampleEC2_CreateKeyPair() { } func ExampleEC2_CreateNetworkAcl() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.CreateNetworkAclInput{ VpcId: aws.String("String"), // Required @@ -817,7 +818,7 @@ func ExampleEC2_CreateNetworkAcl() { } func ExampleEC2_CreateNetworkAclEntry() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.CreateNetworkAclEntryInput{ CidrBlock: aws.String("String"), // Required @@ -850,7 +851,7 @@ func ExampleEC2_CreateNetworkAclEntry() { } func ExampleEC2_CreateNetworkInterface() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.CreateNetworkInterfaceInput{ SubnetId: aws.String("String"), // Required @@ -884,7 +885,7 @@ func ExampleEC2_CreateNetworkInterface() { } func ExampleEC2_CreatePlacementGroup() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.CreatePlacementGroupInput{ GroupName: aws.String("String"), // Required @@ -905,7 +906,7 @@ func ExampleEC2_CreatePlacementGroup() { } func ExampleEC2_CreateReservedInstancesListing() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.CreateReservedInstancesListingInput{ ClientToken: aws.String("String"), // Required @@ -934,7 +935,7 @@ func ExampleEC2_CreateReservedInstancesListing() { } func ExampleEC2_CreateRoute() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.CreateRouteInput{ DestinationCidrBlock: aws.String("String"), // Required @@ -959,7 +960,7 @@ func ExampleEC2_CreateRoute() { } func ExampleEC2_CreateRouteTable() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.CreateRouteTableInput{ VpcId: aws.String("String"), // Required @@ -979,7 +980,7 @@ func ExampleEC2_CreateRouteTable() { } func ExampleEC2_CreateSecurityGroup() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.CreateSecurityGroupInput{ Description: aws.String("String"), // Required @@ -1001,7 +1002,7 @@ func ExampleEC2_CreateSecurityGroup() { } func ExampleEC2_CreateSnapshot() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.CreateSnapshotInput{ VolumeId: aws.String("String"), // Required @@ -1022,7 +1023,7 @@ func ExampleEC2_CreateSnapshot() { } func ExampleEC2_CreateSpotDatafeedSubscription() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.CreateSpotDatafeedSubscriptionInput{ Bucket: aws.String("String"), // Required @@ -1043,7 +1044,7 @@ func ExampleEC2_CreateSpotDatafeedSubscription() { } func ExampleEC2_CreateSubnet() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.CreateSubnetInput{ CidrBlock: aws.String("String"), // Required @@ -1065,7 +1066,7 @@ func ExampleEC2_CreateSubnet() { } func ExampleEC2_CreateTags() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.CreateTagsInput{ Resources: []*string{ // Required @@ -1095,7 +1096,7 @@ func ExampleEC2_CreateTags() { } func ExampleEC2_CreateVolume() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.CreateVolumeInput{ AvailabilityZone: aws.String("String"), // Required @@ -1121,7 +1122,7 @@ func ExampleEC2_CreateVolume() { } func ExampleEC2_CreateVpc() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.CreateVpcInput{ CidrBlock: aws.String("String"), // Required @@ -1142,7 +1143,7 @@ func ExampleEC2_CreateVpc() { } func ExampleEC2_CreateVpcEndpoint() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.CreateVpcEndpointInput{ ServiceName: aws.String("String"), // Required @@ -1169,7 +1170,7 @@ func ExampleEC2_CreateVpcEndpoint() { } func ExampleEC2_CreateVpcPeeringConnection() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.CreateVpcPeeringConnectionInput{ DryRun: aws.Bool(true), @@ -1191,7 +1192,7 @@ func ExampleEC2_CreateVpcPeeringConnection() { } func ExampleEC2_CreateVpnConnection() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.CreateVpnConnectionInput{ CustomerGatewayId: aws.String("String"), // Required @@ -1216,7 +1217,7 @@ func ExampleEC2_CreateVpnConnection() { } func ExampleEC2_CreateVpnConnectionRoute() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.CreateVpnConnectionRouteInput{ DestinationCidrBlock: aws.String("String"), // Required @@ -1236,7 +1237,7 @@ func ExampleEC2_CreateVpnConnectionRoute() { } func ExampleEC2_CreateVpnGateway() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.CreateVpnGatewayInput{ Type: aws.String("GatewayType"), // Required @@ -1257,7 +1258,7 @@ func ExampleEC2_CreateVpnGateway() { } func ExampleEC2_DeleteCustomerGateway() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.DeleteCustomerGatewayInput{ CustomerGatewayId: aws.String("String"), // Required @@ -1277,7 +1278,7 @@ func ExampleEC2_DeleteCustomerGateway() { } func ExampleEC2_DeleteDhcpOptions() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.DeleteDhcpOptionsInput{ DhcpOptionsId: aws.String("String"), // Required @@ -1297,7 +1298,7 @@ func ExampleEC2_DeleteDhcpOptions() { } func ExampleEC2_DeleteFlowLogs() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.DeleteFlowLogsInput{ FlowLogIds: []*string{ // Required @@ -1319,7 +1320,7 @@ func ExampleEC2_DeleteFlowLogs() { } func ExampleEC2_DeleteInternetGateway() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.DeleteInternetGatewayInput{ InternetGatewayId: aws.String("String"), // Required @@ -1339,7 +1340,7 @@ func ExampleEC2_DeleteInternetGateway() { } func ExampleEC2_DeleteKeyPair() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.DeleteKeyPairInput{ KeyName: aws.String("String"), // Required @@ -1359,7 +1360,7 @@ func ExampleEC2_DeleteKeyPair() { } func ExampleEC2_DeleteNetworkAcl() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.DeleteNetworkAclInput{ NetworkAclId: aws.String("String"), // Required @@ -1379,7 +1380,7 @@ func ExampleEC2_DeleteNetworkAcl() { } func ExampleEC2_DeleteNetworkAclEntry() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.DeleteNetworkAclEntryInput{ Egress: aws.Bool(true), // Required @@ -1401,7 +1402,7 @@ func ExampleEC2_DeleteNetworkAclEntry() { } func ExampleEC2_DeleteNetworkInterface() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.DeleteNetworkInterfaceInput{ NetworkInterfaceId: aws.String("String"), // Required @@ -1421,7 +1422,7 @@ func ExampleEC2_DeleteNetworkInterface() { } func ExampleEC2_DeletePlacementGroup() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.DeletePlacementGroupInput{ GroupName: aws.String("String"), // Required @@ -1441,7 +1442,7 @@ func ExampleEC2_DeletePlacementGroup() { } func ExampleEC2_DeleteRoute() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.DeleteRouteInput{ DestinationCidrBlock: aws.String("String"), // Required @@ -1462,7 +1463,7 @@ func ExampleEC2_DeleteRoute() { } func ExampleEC2_DeleteRouteTable() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.DeleteRouteTableInput{ RouteTableId: aws.String("String"), // Required @@ -1482,7 +1483,7 @@ func ExampleEC2_DeleteRouteTable() { } func ExampleEC2_DeleteSecurityGroup() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.DeleteSecurityGroupInput{ DryRun: aws.Bool(true), @@ -1503,7 +1504,7 @@ func ExampleEC2_DeleteSecurityGroup() { } func ExampleEC2_DeleteSnapshot() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.DeleteSnapshotInput{ SnapshotId: aws.String("String"), // Required @@ -1523,7 +1524,7 @@ func ExampleEC2_DeleteSnapshot() { } func ExampleEC2_DeleteSpotDatafeedSubscription() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.DeleteSpotDatafeedSubscriptionInput{ DryRun: aws.Bool(true), @@ -1542,7 +1543,7 @@ func ExampleEC2_DeleteSpotDatafeedSubscription() { } func ExampleEC2_DeleteSubnet() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.DeleteSubnetInput{ SubnetId: aws.String("String"), // Required @@ -1562,7 +1563,7 @@ func ExampleEC2_DeleteSubnet() { } func ExampleEC2_DeleteTags() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.DeleteTagsInput{ Resources: []*string{ // Required @@ -1592,7 +1593,7 @@ func ExampleEC2_DeleteTags() { } func ExampleEC2_DeleteVolume() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.DeleteVolumeInput{ VolumeId: aws.String("String"), // Required @@ -1612,7 +1613,7 @@ func ExampleEC2_DeleteVolume() { } func ExampleEC2_DeleteVpc() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.DeleteVpcInput{ VpcId: aws.String("String"), // Required @@ -1632,7 +1633,7 @@ func ExampleEC2_DeleteVpc() { } func ExampleEC2_DeleteVpcEndpoints() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.DeleteVpcEndpointsInput{ VpcEndpointIds: []*string{ // Required @@ -1655,7 +1656,7 @@ func ExampleEC2_DeleteVpcEndpoints() { } func ExampleEC2_DeleteVpcPeeringConnection() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.DeleteVpcPeeringConnectionInput{ VpcPeeringConnectionId: aws.String("String"), // Required @@ -1675,7 +1676,7 @@ func ExampleEC2_DeleteVpcPeeringConnection() { } func ExampleEC2_DeleteVpnConnection() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.DeleteVpnConnectionInput{ VpnConnectionId: aws.String("String"), // Required @@ -1695,7 +1696,7 @@ func ExampleEC2_DeleteVpnConnection() { } func ExampleEC2_DeleteVpnConnectionRoute() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.DeleteVpnConnectionRouteInput{ DestinationCidrBlock: aws.String("String"), // Required @@ -1715,7 +1716,7 @@ func ExampleEC2_DeleteVpnConnectionRoute() { } func ExampleEC2_DeleteVpnGateway() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.DeleteVpnGatewayInput{ VpnGatewayId: aws.String("String"), // Required @@ -1735,7 +1736,7 @@ func ExampleEC2_DeleteVpnGateway() { } func ExampleEC2_DeregisterImage() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.DeregisterImageInput{ ImageId: aws.String("String"), // Required @@ -1755,7 +1756,7 @@ func ExampleEC2_DeregisterImage() { } func ExampleEC2_DescribeAccountAttributes() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.DescribeAccountAttributesInput{ AttributeNames: []*string{ @@ -1778,7 +1779,7 @@ func ExampleEC2_DescribeAccountAttributes() { } func ExampleEC2_DescribeAddresses() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.DescribeAddressesInput{ AllocationIds: []*string{ @@ -1815,7 +1816,7 @@ func ExampleEC2_DescribeAddresses() { } func ExampleEC2_DescribeAvailabilityZones() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.DescribeAvailabilityZonesInput{ DryRun: aws.Bool(true), @@ -1848,7 +1849,7 @@ func ExampleEC2_DescribeAvailabilityZones() { } func ExampleEC2_DescribeBundleTasks() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.DescribeBundleTasksInput{ BundleIds: []*string{ @@ -1881,7 +1882,7 @@ func ExampleEC2_DescribeBundleTasks() { } func ExampleEC2_DescribeClassicLinkInstances() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.DescribeClassicLinkInstancesInput{ DryRun: aws.Bool(true), @@ -1916,7 +1917,7 @@ func ExampleEC2_DescribeClassicLinkInstances() { } func ExampleEC2_DescribeConversionTasks() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.DescribeConversionTasksInput{ ConversionTaskIds: []*string{ @@ -1949,7 +1950,7 @@ func ExampleEC2_DescribeConversionTasks() { } func ExampleEC2_DescribeCustomerGateways() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.DescribeCustomerGatewaysInput{ CustomerGatewayIds: []*string{ @@ -1982,7 +1983,7 @@ func ExampleEC2_DescribeCustomerGateways() { } func ExampleEC2_DescribeDhcpOptions() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.DescribeDhcpOptionsInput{ DhcpOptionsIds: []*string{ @@ -2015,7 +2016,7 @@ func ExampleEC2_DescribeDhcpOptions() { } func ExampleEC2_DescribeExportTasks() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.DescribeExportTasksInput{ ExportTaskIds: []*string{ @@ -2037,7 +2038,7 @@ func ExampleEC2_DescribeExportTasks() { } func ExampleEC2_DescribeFlowLogs() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.DescribeFlowLogsInput{ Filter: []*ec2.Filter{ @@ -2071,7 +2072,7 @@ func ExampleEC2_DescribeFlowLogs() { } func ExampleEC2_DescribeImageAttribute() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.DescribeImageAttributeInput{ Attribute: aws.String("ImageAttributeName"), // Required @@ -2092,7 +2093,7 @@ func ExampleEC2_DescribeImageAttribute() { } func ExampleEC2_DescribeImages() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.DescribeImagesInput{ DryRun: aws.Bool(true), @@ -2133,7 +2134,7 @@ func ExampleEC2_DescribeImages() { } func ExampleEC2_DescribeImportImageTasks() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.DescribeImportImageTasksInput{ DryRun: aws.Bool(true), @@ -2168,7 +2169,7 @@ func ExampleEC2_DescribeImportImageTasks() { } func ExampleEC2_DescribeImportSnapshotTasks() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.DescribeImportSnapshotTasksInput{ DryRun: aws.Bool(true), @@ -2203,7 +2204,7 @@ func ExampleEC2_DescribeImportSnapshotTasks() { } func ExampleEC2_DescribeInstanceAttribute() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.DescribeInstanceAttributeInput{ Attribute: aws.String("InstanceAttributeName"), // Required @@ -2224,7 +2225,7 @@ func ExampleEC2_DescribeInstanceAttribute() { } func ExampleEC2_DescribeInstanceStatus() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.DescribeInstanceStatusInput{ DryRun: aws.Bool(true), @@ -2260,7 +2261,7 @@ func ExampleEC2_DescribeInstanceStatus() { } func ExampleEC2_DescribeInstances() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.DescribeInstancesInput{ DryRun: aws.Bool(true), @@ -2295,7 +2296,7 @@ func ExampleEC2_DescribeInstances() { } func ExampleEC2_DescribeInternetGateways() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.DescribeInternetGatewaysInput{ DryRun: aws.Bool(true), @@ -2328,7 +2329,7 @@ func ExampleEC2_DescribeInternetGateways() { } func ExampleEC2_DescribeKeyPairs() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.DescribeKeyPairsInput{ DryRun: aws.Bool(true), @@ -2361,7 +2362,7 @@ func ExampleEC2_DescribeKeyPairs() { } func ExampleEC2_DescribeMovingAddresses() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.DescribeMovingAddressesInput{ DryRun: aws.Bool(true), @@ -2396,7 +2397,7 @@ func ExampleEC2_DescribeMovingAddresses() { } func ExampleEC2_DescribeNetworkAcls() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.DescribeNetworkAclsInput{ DryRun: aws.Bool(true), @@ -2429,7 +2430,7 @@ func ExampleEC2_DescribeNetworkAcls() { } func ExampleEC2_DescribeNetworkInterfaceAttribute() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.DescribeNetworkInterfaceAttributeInput{ NetworkInterfaceId: aws.String("String"), // Required @@ -2450,7 +2451,7 @@ func ExampleEC2_DescribeNetworkInterfaceAttribute() { } func ExampleEC2_DescribeNetworkInterfaces() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.DescribeNetworkInterfacesInput{ DryRun: aws.Bool(true), @@ -2483,7 +2484,7 @@ func ExampleEC2_DescribeNetworkInterfaces() { } func ExampleEC2_DescribePlacementGroups() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.DescribePlacementGroupsInput{ DryRun: aws.Bool(true), @@ -2516,7 +2517,7 @@ func ExampleEC2_DescribePlacementGroups() { } func ExampleEC2_DescribePrefixLists() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.DescribePrefixListsInput{ DryRun: aws.Bool(true), @@ -2551,7 +2552,7 @@ func ExampleEC2_DescribePrefixLists() { } func ExampleEC2_DescribeRegions() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.DescribeRegionsInput{ DryRun: aws.Bool(true), @@ -2584,7 +2585,7 @@ func ExampleEC2_DescribeRegions() { } func ExampleEC2_DescribeReservedInstances() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.DescribeReservedInstancesInput{ DryRun: aws.Bool(true), @@ -2618,7 +2619,7 @@ func ExampleEC2_DescribeReservedInstances() { } func ExampleEC2_DescribeReservedInstancesListings() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.DescribeReservedInstancesListingsInput{ Filters: []*ec2.Filter{ @@ -2648,7 +2649,7 @@ func ExampleEC2_DescribeReservedInstancesListings() { } func ExampleEC2_DescribeReservedInstancesModifications() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.DescribeReservedInstancesModificationsInput{ Filters: []*ec2.Filter{ @@ -2681,7 +2682,7 @@ func ExampleEC2_DescribeReservedInstancesModifications() { } func ExampleEC2_DescribeReservedInstancesOfferings() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.DescribeReservedInstancesOfferingsInput{ AvailabilityZone: aws.String("String"), @@ -2725,7 +2726,7 @@ func ExampleEC2_DescribeReservedInstancesOfferings() { } func ExampleEC2_DescribeRouteTables() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.DescribeRouteTablesInput{ DryRun: aws.Bool(true), @@ -2758,7 +2759,7 @@ func ExampleEC2_DescribeRouteTables() { } func ExampleEC2_DescribeSecurityGroups() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.DescribeSecurityGroupsInput{ DryRun: aws.Bool(true), @@ -2795,7 +2796,7 @@ func ExampleEC2_DescribeSecurityGroups() { } func ExampleEC2_DescribeSnapshotAttribute() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.DescribeSnapshotAttributeInput{ Attribute: aws.String("SnapshotAttributeName"), // Required @@ -2816,7 +2817,7 @@ func ExampleEC2_DescribeSnapshotAttribute() { } func ExampleEC2_DescribeSnapshots() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.DescribeSnapshotsInput{ DryRun: aws.Bool(true), @@ -2859,7 +2860,7 @@ func ExampleEC2_DescribeSnapshots() { } func ExampleEC2_DescribeSpotDatafeedSubscription() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.DescribeSpotDatafeedSubscriptionInput{ DryRun: aws.Bool(true), @@ -2878,7 +2879,7 @@ func ExampleEC2_DescribeSpotDatafeedSubscription() { } func ExampleEC2_DescribeSpotFleetInstances() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.DescribeSpotFleetInstancesInput{ SpotFleetRequestId: aws.String("String"), // Required @@ -2900,7 +2901,7 @@ func ExampleEC2_DescribeSpotFleetInstances() { } func ExampleEC2_DescribeSpotFleetRequestHistory() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.DescribeSpotFleetRequestHistoryInput{ SpotFleetRequestId: aws.String("String"), // Required @@ -2924,7 +2925,7 @@ func ExampleEC2_DescribeSpotFleetRequestHistory() { } func ExampleEC2_DescribeSpotFleetRequests() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.DescribeSpotFleetRequestsInput{ DryRun: aws.Bool(true), @@ -2949,7 +2950,7 @@ func ExampleEC2_DescribeSpotFleetRequests() { } func ExampleEC2_DescribeSpotInstanceRequests() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.DescribeSpotInstanceRequestsInput{ DryRun: aws.Bool(true), @@ -2982,7 +2983,7 @@ func ExampleEC2_DescribeSpotInstanceRequests() { } func ExampleEC2_DescribeSpotPriceHistory() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.DescribeSpotPriceHistoryInput{ AvailabilityZone: aws.String("String"), @@ -3024,7 +3025,7 @@ func ExampleEC2_DescribeSpotPriceHistory() { } func ExampleEC2_DescribeSubnets() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.DescribeSubnetsInput{ DryRun: aws.Bool(true), @@ -3057,7 +3058,7 @@ func ExampleEC2_DescribeSubnets() { } func ExampleEC2_DescribeTags() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.DescribeTagsInput{ DryRun: aws.Bool(true), @@ -3088,7 +3089,7 @@ func ExampleEC2_DescribeTags() { } func ExampleEC2_DescribeVolumeAttribute() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.DescribeVolumeAttributeInput{ VolumeId: aws.String("String"), // Required @@ -3109,7 +3110,7 @@ func ExampleEC2_DescribeVolumeAttribute() { } func ExampleEC2_DescribeVolumeStatus() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.DescribeVolumeStatusInput{ DryRun: aws.Bool(true), @@ -3144,7 +3145,7 @@ func ExampleEC2_DescribeVolumeStatus() { } func ExampleEC2_DescribeVolumes() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.DescribeVolumesInput{ DryRun: aws.Bool(true), @@ -3179,7 +3180,7 @@ func ExampleEC2_DescribeVolumes() { } func ExampleEC2_DescribeVpcAttribute() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.DescribeVpcAttributeInput{ VpcId: aws.String("String"), // Required @@ -3200,7 +3201,7 @@ func ExampleEC2_DescribeVpcAttribute() { } func ExampleEC2_DescribeVpcClassicLink() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.DescribeVpcClassicLinkInput{ DryRun: aws.Bool(true), @@ -3233,7 +3234,7 @@ func ExampleEC2_DescribeVpcClassicLink() { } func ExampleEC2_DescribeVpcEndpointServices() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.DescribeVpcEndpointServicesInput{ DryRun: aws.Bool(true), @@ -3254,7 +3255,7 @@ func ExampleEC2_DescribeVpcEndpointServices() { } func ExampleEC2_DescribeVpcEndpoints() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.DescribeVpcEndpointsInput{ DryRun: aws.Bool(true), @@ -3289,7 +3290,7 @@ func ExampleEC2_DescribeVpcEndpoints() { } func ExampleEC2_DescribeVpcPeeringConnections() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.DescribeVpcPeeringConnectionsInput{ DryRun: aws.Bool(true), @@ -3322,7 +3323,7 @@ func ExampleEC2_DescribeVpcPeeringConnections() { } func ExampleEC2_DescribeVpcs() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.DescribeVpcsInput{ DryRun: aws.Bool(true), @@ -3355,7 +3356,7 @@ func ExampleEC2_DescribeVpcs() { } func ExampleEC2_DescribeVpnConnections() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.DescribeVpnConnectionsInput{ DryRun: aws.Bool(true), @@ -3388,7 +3389,7 @@ func ExampleEC2_DescribeVpnConnections() { } func ExampleEC2_DescribeVpnGateways() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.DescribeVpnGatewaysInput{ DryRun: aws.Bool(true), @@ -3421,7 +3422,7 @@ func ExampleEC2_DescribeVpnGateways() { } func ExampleEC2_DetachClassicLinkVpc() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.DetachClassicLinkVpcInput{ InstanceId: aws.String("String"), // Required @@ -3442,7 +3443,7 @@ func ExampleEC2_DetachClassicLinkVpc() { } func ExampleEC2_DetachInternetGateway() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.DetachInternetGatewayInput{ InternetGatewayId: aws.String("String"), // Required @@ -3463,7 +3464,7 @@ func ExampleEC2_DetachInternetGateway() { } func ExampleEC2_DetachNetworkInterface() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.DetachNetworkInterfaceInput{ AttachmentId: aws.String("String"), // Required @@ -3484,7 +3485,7 @@ func ExampleEC2_DetachNetworkInterface() { } func ExampleEC2_DetachVolume() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.DetachVolumeInput{ VolumeId: aws.String("String"), // Required @@ -3507,7 +3508,7 @@ func ExampleEC2_DetachVolume() { } func ExampleEC2_DetachVpnGateway() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.DetachVpnGatewayInput{ VpcId: aws.String("String"), // Required @@ -3528,7 +3529,7 @@ func ExampleEC2_DetachVpnGateway() { } func ExampleEC2_DisableVgwRoutePropagation() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.DisableVgwRoutePropagationInput{ GatewayId: aws.String("String"), // Required @@ -3548,7 +3549,7 @@ func ExampleEC2_DisableVgwRoutePropagation() { } func ExampleEC2_DisableVpcClassicLink() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.DisableVpcClassicLinkInput{ VpcId: aws.String("String"), // Required @@ -3568,7 +3569,7 @@ func ExampleEC2_DisableVpcClassicLink() { } func ExampleEC2_DisassociateAddress() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.DisassociateAddressInput{ AssociationId: aws.String("String"), @@ -3589,7 +3590,7 @@ func ExampleEC2_DisassociateAddress() { } func ExampleEC2_DisassociateRouteTable() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.DisassociateRouteTableInput{ AssociationId: aws.String("String"), // Required @@ -3609,7 +3610,7 @@ func ExampleEC2_DisassociateRouteTable() { } func ExampleEC2_EnableVgwRoutePropagation() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.EnableVgwRoutePropagationInput{ GatewayId: aws.String("String"), // Required @@ -3629,7 +3630,7 @@ func ExampleEC2_EnableVgwRoutePropagation() { } func ExampleEC2_EnableVolumeIO() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.EnableVolumeIOInput{ VolumeId: aws.String("String"), // Required @@ -3649,7 +3650,7 @@ func ExampleEC2_EnableVolumeIO() { } func ExampleEC2_EnableVpcClassicLink() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.EnableVpcClassicLinkInput{ VpcId: aws.String("String"), // Required @@ -3669,7 +3670,7 @@ func ExampleEC2_EnableVpcClassicLink() { } func ExampleEC2_GetConsoleOutput() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.GetConsoleOutputInput{ InstanceId: aws.String("String"), // Required @@ -3689,7 +3690,7 @@ func ExampleEC2_GetConsoleOutput() { } func ExampleEC2_GetPasswordData() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.GetPasswordDataInput{ InstanceId: aws.String("String"), // Required @@ -3709,7 +3710,7 @@ func ExampleEC2_GetPasswordData() { } func ExampleEC2_ImportImage() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.ImportImageInput{ Architecture: aws.String("String"), @@ -3755,7 +3756,7 @@ func ExampleEC2_ImportImage() { } func ExampleEC2_ImportInstance() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.ImportInstanceInput{ Platform: aws.String("PlatformValues"), // Required @@ -3815,7 +3816,7 @@ func ExampleEC2_ImportInstance() { } func ExampleEC2_ImportKeyPair() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.ImportKeyPairInput{ KeyName: aws.String("String"), // Required @@ -3836,7 +3837,7 @@ func ExampleEC2_ImportKeyPair() { } func ExampleEC2_ImportSnapshot() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.ImportSnapshotInput{ ClientData: &ec2.ClientData{ @@ -3873,7 +3874,7 @@ func ExampleEC2_ImportSnapshot() { } func ExampleEC2_ImportVolume() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.ImportVolumeInput{ AvailabilityZone: aws.String("String"), // Required @@ -3902,7 +3903,7 @@ func ExampleEC2_ImportVolume() { } func ExampleEC2_ModifyImageAttribute() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.ModifyImageAttributeInput{ ImageId: aws.String("String"), // Required @@ -3956,7 +3957,7 @@ func ExampleEC2_ModifyImageAttribute() { } func ExampleEC2_ModifyInstanceAttribute() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.ModifyInstanceAttributeInput{ InstanceId: aws.String("String"), // Required @@ -4021,7 +4022,7 @@ func ExampleEC2_ModifyInstanceAttribute() { } func ExampleEC2_ModifyNetworkInterfaceAttribute() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.ModifyNetworkInterfaceAttributeInput{ NetworkInterfaceId: aws.String("String"), // Required @@ -4055,7 +4056,7 @@ func ExampleEC2_ModifyNetworkInterfaceAttribute() { } func ExampleEC2_ModifyReservedInstances() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.ModifyReservedInstancesInput{ ReservedInstancesIds: []*string{ // Required @@ -4087,7 +4088,7 @@ func ExampleEC2_ModifyReservedInstances() { } func ExampleEC2_ModifySnapshotAttribute() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.ModifySnapshotAttributeInput{ SnapshotId: aws.String("String"), // Required @@ -4133,7 +4134,7 @@ func ExampleEC2_ModifySnapshotAttribute() { } func ExampleEC2_ModifySpotFleetRequest() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.ModifySpotFleetRequestInput{ SpotFleetRequestId: aws.String("String"), // Required @@ -4154,7 +4155,7 @@ func ExampleEC2_ModifySpotFleetRequest() { } func ExampleEC2_ModifySubnetAttribute() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.ModifySubnetAttributeInput{ SubnetId: aws.String("String"), // Required @@ -4176,7 +4177,7 @@ func ExampleEC2_ModifySubnetAttribute() { } func ExampleEC2_ModifyVolumeAttribute() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.ModifyVolumeAttributeInput{ VolumeId: aws.String("String"), // Required @@ -4199,7 +4200,7 @@ func ExampleEC2_ModifyVolumeAttribute() { } func ExampleEC2_ModifyVpcAttribute() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.ModifyVpcAttributeInput{ VpcId: aws.String("String"), // Required @@ -4224,7 +4225,7 @@ func ExampleEC2_ModifyVpcAttribute() { } func ExampleEC2_ModifyVpcEndpoint() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.ModifyVpcEndpointInput{ VpcEndpointId: aws.String("String"), // Required @@ -4254,7 +4255,7 @@ func ExampleEC2_ModifyVpcEndpoint() { } func ExampleEC2_MonitorInstances() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.MonitorInstancesInput{ InstanceIds: []*string{ // Required @@ -4277,7 +4278,7 @@ func ExampleEC2_MonitorInstances() { } func ExampleEC2_MoveAddressToVpc() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.MoveAddressToVpcInput{ PublicIp: aws.String("String"), // Required @@ -4297,7 +4298,7 @@ func ExampleEC2_MoveAddressToVpc() { } func ExampleEC2_PurchaseReservedInstancesOffering() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.PurchaseReservedInstancesOfferingInput{ InstanceCount: aws.Int64(1), // Required @@ -4322,7 +4323,7 @@ func ExampleEC2_PurchaseReservedInstancesOffering() { } func ExampleEC2_RebootInstances() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.RebootInstancesInput{ InstanceIds: []*string{ // Required @@ -4345,7 +4346,7 @@ func ExampleEC2_RebootInstances() { } func ExampleEC2_RegisterImage() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.RegisterImageInput{ Name: aws.String("String"), // Required @@ -4389,7 +4390,7 @@ func ExampleEC2_RegisterImage() { } func ExampleEC2_RejectVpcPeeringConnection() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.RejectVpcPeeringConnectionInput{ VpcPeeringConnectionId: aws.String("String"), // Required @@ -4409,7 +4410,7 @@ func ExampleEC2_RejectVpcPeeringConnection() { } func ExampleEC2_ReleaseAddress() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.ReleaseAddressInput{ AllocationId: aws.String("String"), @@ -4430,7 +4431,7 @@ func ExampleEC2_ReleaseAddress() { } func ExampleEC2_ReplaceNetworkAclAssociation() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.ReplaceNetworkAclAssociationInput{ AssociationId: aws.String("String"), // Required @@ -4451,7 +4452,7 @@ func ExampleEC2_ReplaceNetworkAclAssociation() { } func ExampleEC2_ReplaceNetworkAclEntry() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.ReplaceNetworkAclEntryInput{ CidrBlock: aws.String("String"), // Required @@ -4484,7 +4485,7 @@ func ExampleEC2_ReplaceNetworkAclEntry() { } func ExampleEC2_ReplaceRoute() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.ReplaceRouteInput{ DestinationCidrBlock: aws.String("String"), // Required @@ -4509,7 +4510,7 @@ func ExampleEC2_ReplaceRoute() { } func ExampleEC2_ReplaceRouteTableAssociation() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.ReplaceRouteTableAssociationInput{ AssociationId: aws.String("String"), // Required @@ -4530,7 +4531,7 @@ func ExampleEC2_ReplaceRouteTableAssociation() { } func ExampleEC2_ReportInstanceStatus() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.ReportInstanceStatusInput{ Instances: []*string{ // Required @@ -4561,7 +4562,7 @@ func ExampleEC2_ReportInstanceStatus() { } func ExampleEC2_RequestSpotFleet() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.RequestSpotFleetInput{ SpotFleetRequestConfig: &ec2.SpotFleetRequestConfigData{ // Required @@ -4665,7 +4666,7 @@ func ExampleEC2_RequestSpotFleet() { } func ExampleEC2_RequestSpotInstances() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.RequestSpotInstancesInput{ SpotPrice: aws.String("String"), // Required @@ -4763,7 +4764,7 @@ func ExampleEC2_RequestSpotInstances() { } func ExampleEC2_ResetImageAttribute() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.ResetImageAttributeInput{ Attribute: aws.String("ResetImageAttributeName"), // Required @@ -4784,7 +4785,7 @@ func ExampleEC2_ResetImageAttribute() { } func ExampleEC2_ResetInstanceAttribute() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.ResetInstanceAttributeInput{ Attribute: aws.String("InstanceAttributeName"), // Required @@ -4805,7 +4806,7 @@ func ExampleEC2_ResetInstanceAttribute() { } func ExampleEC2_ResetNetworkInterfaceAttribute() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.ResetNetworkInterfaceAttributeInput{ NetworkInterfaceId: aws.String("String"), // Required @@ -4826,7 +4827,7 @@ func ExampleEC2_ResetNetworkInterfaceAttribute() { } func ExampleEC2_ResetSnapshotAttribute() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.ResetSnapshotAttributeInput{ Attribute: aws.String("SnapshotAttributeName"), // Required @@ -4847,7 +4848,7 @@ func ExampleEC2_ResetSnapshotAttribute() { } func ExampleEC2_RestoreAddressToClassic() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.RestoreAddressToClassicInput{ PublicIp: aws.String("String"), // Required @@ -4867,7 +4868,7 @@ func ExampleEC2_RestoreAddressToClassic() { } func ExampleEC2_RevokeSecurityGroupEgress() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.RevokeSecurityGroupEgressInput{ GroupId: aws.String("String"), // Required @@ -4921,7 +4922,7 @@ func ExampleEC2_RevokeSecurityGroupEgress() { } func ExampleEC2_RevokeSecurityGroupIngress() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.RevokeSecurityGroupIngressInput{ CidrIp: aws.String("String"), @@ -4976,7 +4977,7 @@ func ExampleEC2_RevokeSecurityGroupIngress() { } func ExampleEC2_RunInstances() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.RunInstancesInput{ ImageId: aws.String("String"), // Required @@ -5070,7 +5071,7 @@ func ExampleEC2_RunInstances() { } func ExampleEC2_StartInstances() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.StartInstancesInput{ InstanceIds: []*string{ // Required @@ -5094,7 +5095,7 @@ func ExampleEC2_StartInstances() { } func ExampleEC2_StopInstances() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.StopInstancesInput{ InstanceIds: []*string{ // Required @@ -5118,7 +5119,7 @@ func ExampleEC2_StopInstances() { } func ExampleEC2_TerminateInstances() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.TerminateInstancesInput{ InstanceIds: []*string{ // Required @@ -5141,7 +5142,7 @@ func ExampleEC2_TerminateInstances() { } func ExampleEC2_UnassignPrivateIpAddresses() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.UnassignPrivateIpAddressesInput{ NetworkInterfaceId: aws.String("String"), // Required @@ -5164,7 +5165,7 @@ func ExampleEC2_UnassignPrivateIpAddresses() { } func ExampleEC2_UnmonitorInstances() { - svc := ec2.New(nil) + svc := ec2.New(session.New()) params := &ec2.UnmonitorInstancesInput{ InstanceIds: []*string{ // Required diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/service/ec2/service.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/service/ec2/service.go index fb20e805b9f..2ff4220f7da 100644 --- a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/service/ec2/service.go +++ b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/service/ec2/service.go @@ -4,10 +4,9 @@ package ec2 import ( "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/defaults" + "github.com/aws/aws-sdk-go/aws/client" + "github.com/aws/aws-sdk-go/aws/client/metadata" "github.com/aws/aws-sdk-go/aws/request" - "github.com/aws/aws-sdk-go/aws/service" - "github.com/aws/aws-sdk-go/aws/service/serviceinfo" "github.com/aws/aws-sdk-go/private/protocol/ec2query" "github.com/aws/aws-sdk-go/private/signer/v4" ) @@ -16,40 +15,64 @@ import ( // in the Amazon Web Services (AWS) cloud. Using Amazon EC2 eliminates your // need to invest in hardware up front, so you can develop and deploy applications // faster. +//The service client's operations are safe to be used concurrently. +// It is not safe to mutate any of the client's properties though. type EC2 struct { - *service.Service + *client.Client } -// Used for custom service initialization logic -var initService func(*service.Service) +// Used for custom client initialization logic +var initClient func(*client.Client) // Used for custom request initialization logic var initRequest func(*request.Request) -// New returns a new EC2 client. -func New(config *aws.Config) *EC2 { - service := &service.Service{ - ServiceInfo: serviceinfo.ServiceInfo{ - Config: defaults.DefaultConfig.Merge(config), - ServiceName: "ec2", - APIVersion: "2015-10-01", - }, +// A ServiceName is the name of the service the client will make API calls to. +const ServiceName = "ec2" + +// New creates a new instance of the EC2 client with a session. +// If additional configuration is needed for the client instance use the optional +// aws.Config parameter to add your extra config. +// +// Example: +// // Create a EC2 client from just a session. +// svc := ec2.New(mySession) +// +// // Create a EC2 client with additional configuration +// svc := ec2.New(mySession, aws.NewConfig().WithRegion("us-west-2")) +func New(p client.ConfigProvider, cfgs ...*aws.Config) *EC2 { + c := p.ClientConfig(ServiceName, cfgs...) + return newClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) +} + +// newClient creates, initializes and returns a new service client instance. +func newClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *EC2 { + svc := &EC2{ + Client: client.New( + cfg, + metadata.ClientInfo{ + ServiceName: ServiceName, + SigningRegion: signingRegion, + Endpoint: endpoint, + APIVersion: "2015-10-01", + }, + handlers, + ), } - service.Initialize() // Handlers - service.Handlers.Sign.PushBack(v4.Sign) - service.Handlers.Build.PushBack(ec2query.Build) - service.Handlers.Unmarshal.PushBack(ec2query.Unmarshal) - service.Handlers.UnmarshalMeta.PushBack(ec2query.UnmarshalMeta) - service.Handlers.UnmarshalError.PushBack(ec2query.UnmarshalError) + svc.Handlers.Sign.PushBack(v4.Sign) + svc.Handlers.Build.PushBack(ec2query.Build) + svc.Handlers.Unmarshal.PushBack(ec2query.Unmarshal) + svc.Handlers.UnmarshalMeta.PushBack(ec2query.UnmarshalMeta) + svc.Handlers.UnmarshalError.PushBack(ec2query.UnmarshalError) - // Run custom service initialization if present - if initService != nil { - initService(service) + // Run custom client initialization if present + if initClient != nil { + initClient(svc.Client) } - return &EC2{service} + return svc } // newRequest creates a new request for a EC2 operation and runs any diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/service/ec2/waiters.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/service/ec2/waiters.go new file mode 100644 index 00000000000..1b28317a18b --- /dev/null +++ b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/service/ec2/waiters.go @@ -0,0 +1,761 @@ +// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. + +package ec2 + +import ( + "github.com/aws/aws-sdk-go/private/waiter" +) + +func (c *EC2) WaitUntilBundleTaskComplete(input *DescribeBundleTasksInput) error { + waiterCfg := waiter.Config{ + Operation: "DescribeBundleTasks", + Delay: 15, + MaxAttempts: 40, + Acceptors: []waiter.WaitAcceptor{ + { + State: "success", + Matcher: "pathAll", + Argument: "BundleTasks[].State", + Expected: "complete", + }, + { + State: "failure", + Matcher: "pathAny", + Argument: "BundleTasks[].State", + Expected: "failed", + }, + }, + } + + w := waiter.Waiter{ + Client: c, + Input: input, + Config: waiterCfg, + } + return w.Wait() +} + +func (c *EC2) WaitUntilConversionTaskCancelled(input *DescribeConversionTasksInput) error { + waiterCfg := waiter.Config{ + Operation: "DescribeConversionTasks", + Delay: 15, + MaxAttempts: 40, + Acceptors: []waiter.WaitAcceptor{ + { + State: "success", + Matcher: "pathAll", + Argument: "ConversionTasks[].State", + Expected: "cancelled", + }, + }, + } + + w := waiter.Waiter{ + Client: c, + Input: input, + Config: waiterCfg, + } + return w.Wait() +} + +func (c *EC2) WaitUntilConversionTaskCompleted(input *DescribeConversionTasksInput) error { + waiterCfg := waiter.Config{ + Operation: "DescribeConversionTasks", + Delay: 15, + MaxAttempts: 40, + Acceptors: []waiter.WaitAcceptor{ + { + State: "success", + Matcher: "pathAll", + Argument: "ConversionTasks[].State", + Expected: "completed", + }, + { + State: "failure", + Matcher: "pathAny", + Argument: "ConversionTasks[].State", + Expected: "cancelled", + }, + { + State: "failure", + Matcher: "pathAny", + Argument: "ConversionTasks[].State", + Expected: "cancelling", + }, + }, + } + + w := waiter.Waiter{ + Client: c, + Input: input, + Config: waiterCfg, + } + return w.Wait() +} + +func (c *EC2) WaitUntilConversionTaskDeleted(input *DescribeConversionTasksInput) error { + waiterCfg := waiter.Config{ + Operation: "DescribeConversionTasks", + Delay: 15, + MaxAttempts: 40, + Acceptors: []waiter.WaitAcceptor{ + { + State: "success", + Matcher: "pathAll", + Argument: "ConversionTasks[].State", + Expected: "deleted", + }, + }, + } + + w := waiter.Waiter{ + Client: c, + Input: input, + Config: waiterCfg, + } + return w.Wait() +} + +func (c *EC2) WaitUntilCustomerGatewayAvailable(input *DescribeCustomerGatewaysInput) error { + waiterCfg := waiter.Config{ + Operation: "DescribeCustomerGateways", + Delay: 15, + MaxAttempts: 40, + Acceptors: []waiter.WaitAcceptor{ + { + State: "success", + Matcher: "pathAll", + Argument: "CustomerGateways[].State", + Expected: "available", + }, + { + State: "failure", + Matcher: "pathAny", + Argument: "CustomerGateways[].State", + Expected: "deleted", + }, + { + State: "failure", + Matcher: "pathAny", + Argument: "CustomerGateways[].State", + Expected: "deleting", + }, + }, + } + + w := waiter.Waiter{ + Client: c, + Input: input, + Config: waiterCfg, + } + return w.Wait() +} + +func (c *EC2) WaitUntilExportTaskCancelled(input *DescribeExportTasksInput) error { + waiterCfg := waiter.Config{ + Operation: "DescribeExportTasks", + Delay: 15, + MaxAttempts: 40, + Acceptors: []waiter.WaitAcceptor{ + { + State: "success", + Matcher: "pathAll", + Argument: "ExportTasks[].State", + Expected: "cancelled", + }, + }, + } + + w := waiter.Waiter{ + Client: c, + Input: input, + Config: waiterCfg, + } + return w.Wait() +} + +func (c *EC2) WaitUntilExportTaskCompleted(input *DescribeExportTasksInput) error { + waiterCfg := waiter.Config{ + Operation: "DescribeExportTasks", + Delay: 15, + MaxAttempts: 40, + Acceptors: []waiter.WaitAcceptor{ + { + State: "success", + Matcher: "pathAll", + Argument: "ExportTasks[].State", + Expected: "completed", + }, + }, + } + + w := waiter.Waiter{ + Client: c, + Input: input, + Config: waiterCfg, + } + return w.Wait() +} + +func (c *EC2) WaitUntilImageAvailable(input *DescribeImagesInput) error { + waiterCfg := waiter.Config{ + Operation: "DescribeImages", + Delay: 15, + MaxAttempts: 40, + Acceptors: []waiter.WaitAcceptor{ + { + State: "success", + Matcher: "pathAll", + Argument: "Images[].State", + Expected: "available", + }, + { + State: "failure", + Matcher: "pathAny", + Argument: "Images[].State", + Expected: "failed", + }, + }, + } + + w := waiter.Waiter{ + Client: c, + Input: input, + Config: waiterCfg, + } + return w.Wait() +} + +func (c *EC2) WaitUntilInstanceExists(input *DescribeInstancesInput) error { + waiterCfg := waiter.Config{ + Operation: "DescribeInstances", + Delay: 5, + MaxAttempts: 40, + Acceptors: []waiter.WaitAcceptor{ + { + State: "success", + Matcher: "status", + Argument: "", + Expected: 200, + }, + { + State: "retry", + Matcher: "error", + Argument: "", + Expected: "InvalidInstanceIDNotFound", + }, + }, + } + + w := waiter.Waiter{ + Client: c, + Input: input, + Config: waiterCfg, + } + return w.Wait() +} + +func (c *EC2) WaitUntilInstanceRunning(input *DescribeInstancesInput) error { + waiterCfg := waiter.Config{ + Operation: "DescribeInstances", + Delay: 15, + MaxAttempts: 40, + Acceptors: []waiter.WaitAcceptor{ + { + State: "success", + Matcher: "pathAll", + Argument: "Reservations[].Instances[].State.Name", + Expected: "running", + }, + { + State: "failure", + Matcher: "pathAny", + Argument: "Reservations[].Instances[].State.Name", + Expected: "shutting-down", + }, + { + State: "failure", + Matcher: "pathAny", + Argument: "Reservations[].Instances[].State.Name", + Expected: "terminated", + }, + { + State: "failure", + Matcher: "pathAny", + Argument: "Reservations[].Instances[].State.Name", + Expected: "stopping", + }, + }, + } + + w := waiter.Waiter{ + Client: c, + Input: input, + Config: waiterCfg, + } + return w.Wait() +} + +func (c *EC2) WaitUntilInstanceStatusOk(input *DescribeInstanceStatusInput) error { + waiterCfg := waiter.Config{ + Operation: "DescribeInstanceStatus", + Delay: 15, + MaxAttempts: 40, + Acceptors: []waiter.WaitAcceptor{ + { + State: "success", + Matcher: "pathAll", + Argument: "InstanceStatuses[].InstanceStatus.Status", + Expected: "ok", + }, + }, + } + + w := waiter.Waiter{ + Client: c, + Input: input, + Config: waiterCfg, + } + return w.Wait() +} + +func (c *EC2) WaitUntilInstanceStopped(input *DescribeInstancesInput) error { + waiterCfg := waiter.Config{ + Operation: "DescribeInstances", + Delay: 15, + MaxAttempts: 40, + Acceptors: []waiter.WaitAcceptor{ + { + State: "success", + Matcher: "pathAll", + Argument: "Reservations[].Instances[].State.Name", + Expected: "stopped", + }, + { + State: "failure", + Matcher: "pathAny", + Argument: "Reservations[].Instances[].State.Name", + Expected: "pending", + }, + { + State: "failure", + Matcher: "pathAny", + Argument: "Reservations[].Instances[].State.Name", + Expected: "terminated", + }, + }, + } + + w := waiter.Waiter{ + Client: c, + Input: input, + Config: waiterCfg, + } + return w.Wait() +} + +func (c *EC2) WaitUntilInstanceTerminated(input *DescribeInstancesInput) error { + waiterCfg := waiter.Config{ + Operation: "DescribeInstances", + Delay: 15, + MaxAttempts: 40, + Acceptors: []waiter.WaitAcceptor{ + { + State: "success", + Matcher: "pathAll", + Argument: "Reservations[].Instances[].State.Name", + Expected: "terminated", + }, + { + State: "failure", + Matcher: "pathAny", + Argument: "Reservations[].Instances[].State.Name", + Expected: "pending", + }, + { + State: "failure", + Matcher: "pathAny", + Argument: "Reservations[].Instances[].State.Name", + Expected: "stopping", + }, + }, + } + + w := waiter.Waiter{ + Client: c, + Input: input, + Config: waiterCfg, + } + return w.Wait() +} + +func (c *EC2) WaitUntilKeyPairExists(input *DescribeKeyPairsInput) error { + waiterCfg := waiter.Config{ + Operation: "DescribeKeyPairs", + Delay: 5, + MaxAttempts: 6, + Acceptors: []waiter.WaitAcceptor{ + { + State: "success", + Matcher: "pathAll", + Argument: "length(KeyPairs[].KeyName) > `0`", + Expected: true, + }, + { + State: "retry", + Matcher: "error", + Argument: "", + Expected: "InvalidKeyPairNotFound", + }, + }, + } + + w := waiter.Waiter{ + Client: c, + Input: input, + Config: waiterCfg, + } + return w.Wait() +} + +func (c *EC2) WaitUntilNetworkInterfaceAvailable(input *DescribeNetworkInterfacesInput) error { + waiterCfg := waiter.Config{ + Operation: "DescribeNetworkInterfaces", + Delay: 20, + MaxAttempts: 10, + Acceptors: []waiter.WaitAcceptor{ + { + State: "success", + Matcher: "pathAll", + Argument: "NetworkInterfaces[].Status", + Expected: "available", + }, + { + State: "failure", + Matcher: "error", + Argument: "", + Expected: "InvalidNetworkInterfaceIDNotFound", + }, + }, + } + + w := waiter.Waiter{ + Client: c, + Input: input, + Config: waiterCfg, + } + return w.Wait() +} + +func (c *EC2) WaitUntilPasswordDataAvailable(input *GetPasswordDataInput) error { + waiterCfg := waiter.Config{ + Operation: "GetPasswordData", + Delay: 15, + MaxAttempts: 40, + Acceptors: []waiter.WaitAcceptor{ + { + State: "success", + Matcher: "path", + Argument: "length(PasswordData) > `0`", + Expected: true, + }, + }, + } + + w := waiter.Waiter{ + Client: c, + Input: input, + Config: waiterCfg, + } + return w.Wait() +} + +func (c *EC2) WaitUntilSnapshotCompleted(input *DescribeSnapshotsInput) error { + waiterCfg := waiter.Config{ + Operation: "DescribeSnapshots", + Delay: 15, + MaxAttempts: 40, + Acceptors: []waiter.WaitAcceptor{ + { + State: "success", + Matcher: "pathAll", + Argument: "Snapshots[].State", + Expected: "completed", + }, + }, + } + + w := waiter.Waiter{ + Client: c, + Input: input, + Config: waiterCfg, + } + return w.Wait() +} + +func (c *EC2) WaitUntilSpotInstanceRequestFulfilled(input *DescribeSpotInstanceRequestsInput) error { + waiterCfg := waiter.Config{ + Operation: "DescribeSpotInstanceRequests", + Delay: 15, + MaxAttempts: 40, + Acceptors: []waiter.WaitAcceptor{ + { + State: "success", + Matcher: "pathAll", + Argument: "SpotInstanceRequests[].Status.Code", + Expected: "fulfilled", + }, + { + State: "failure", + Matcher: "pathAny", + Argument: "SpotInstanceRequests[].Status.Code", + Expected: "schedule-expired", + }, + { + State: "failure", + Matcher: "pathAny", + Argument: "SpotInstanceRequests[].Status.Code", + Expected: "canceled-before-fulfillment", + }, + { + State: "failure", + Matcher: "pathAny", + Argument: "SpotInstanceRequests[].Status.Code", + Expected: "bad-parameters", + }, + { + State: "failure", + Matcher: "pathAny", + Argument: "SpotInstanceRequests[].Status.Code", + Expected: "system-error", + }, + }, + } + + w := waiter.Waiter{ + Client: c, + Input: input, + Config: waiterCfg, + } + return w.Wait() +} + +func (c *EC2) WaitUntilSubnetAvailable(input *DescribeSubnetsInput) error { + waiterCfg := waiter.Config{ + Operation: "DescribeSubnets", + Delay: 15, + MaxAttempts: 40, + Acceptors: []waiter.WaitAcceptor{ + { + State: "success", + Matcher: "pathAll", + Argument: "Subnets[].State", + Expected: "available", + }, + }, + } + + w := waiter.Waiter{ + Client: c, + Input: input, + Config: waiterCfg, + } + return w.Wait() +} + +func (c *EC2) WaitUntilSystemStatusOk(input *DescribeInstanceStatusInput) error { + waiterCfg := waiter.Config{ + Operation: "DescribeInstanceStatus", + Delay: 15, + MaxAttempts: 40, + Acceptors: []waiter.WaitAcceptor{ + { + State: "success", + Matcher: "pathAll", + Argument: "InstanceStatuses[].SystemStatus.Status", + Expected: "ok", + }, + }, + } + + w := waiter.Waiter{ + Client: c, + Input: input, + Config: waiterCfg, + } + return w.Wait() +} + +func (c *EC2) WaitUntilVolumeAvailable(input *DescribeVolumesInput) error { + waiterCfg := waiter.Config{ + Operation: "DescribeVolumes", + Delay: 15, + MaxAttempts: 40, + Acceptors: []waiter.WaitAcceptor{ + { + State: "success", + Matcher: "pathAll", + Argument: "Volumes[].State", + Expected: "available", + }, + { + State: "failure", + Matcher: "pathAny", + Argument: "Volumes[].State", + Expected: "deleted", + }, + }, + } + + w := waiter.Waiter{ + Client: c, + Input: input, + Config: waiterCfg, + } + return w.Wait() +} + +func (c *EC2) WaitUntilVolumeDeleted(input *DescribeVolumesInput) error { + waiterCfg := waiter.Config{ + Operation: "DescribeVolumes", + Delay: 15, + MaxAttempts: 40, + Acceptors: []waiter.WaitAcceptor{ + { + State: "success", + Matcher: "pathAll", + Argument: "Volumes[].State", + Expected: "deleted", + }, + { + State: "success", + Matcher: "error", + Argument: "", + Expected: "InvalidVolumeNotFound", + }, + }, + } + + w := waiter.Waiter{ + Client: c, + Input: input, + Config: waiterCfg, + } + return w.Wait() +} + +func (c *EC2) WaitUntilVolumeInUse(input *DescribeVolumesInput) error { + waiterCfg := waiter.Config{ + Operation: "DescribeVolumes", + Delay: 15, + MaxAttempts: 40, + Acceptors: []waiter.WaitAcceptor{ + { + State: "success", + Matcher: "pathAll", + Argument: "Volumes[].State", + Expected: "in-use", + }, + { + State: "failure", + Matcher: "pathAny", + Argument: "Volumes[].State", + Expected: "deleted", + }, + }, + } + + w := waiter.Waiter{ + Client: c, + Input: input, + Config: waiterCfg, + } + return w.Wait() +} + +func (c *EC2) WaitUntilVpcAvailable(input *DescribeVpcsInput) error { + waiterCfg := waiter.Config{ + Operation: "DescribeVpcs", + Delay: 15, + MaxAttempts: 40, + Acceptors: []waiter.WaitAcceptor{ + { + State: "success", + Matcher: "pathAll", + Argument: "Vpcs[].State", + Expected: "available", + }, + }, + } + + w := waiter.Waiter{ + Client: c, + Input: input, + Config: waiterCfg, + } + return w.Wait() +} + +func (c *EC2) WaitUntilVpnConnectionAvailable(input *DescribeVpnConnectionsInput) error { + waiterCfg := waiter.Config{ + Operation: "DescribeVpnConnections", + Delay: 15, + MaxAttempts: 40, + Acceptors: []waiter.WaitAcceptor{ + { + State: "success", + Matcher: "pathAll", + Argument: "VpnConnections[].State", + Expected: "available", + }, + { + State: "failure", + Matcher: "pathAny", + Argument: "VpnConnections[].State", + Expected: "deleting", + }, + { + State: "failure", + Matcher: "pathAny", + Argument: "VpnConnections[].State", + Expected: "deleted", + }, + }, + } + + w := waiter.Waiter{ + Client: c, + Input: input, + Config: waiterCfg, + } + return w.Wait() +} + +func (c *EC2) WaitUntilVpnConnectionDeleted(input *DescribeVpnConnectionsInput) error { + waiterCfg := waiter.Config{ + Operation: "DescribeVpnConnections", + Delay: 15, + MaxAttempts: 40, + Acceptors: []waiter.WaitAcceptor{ + { + State: "success", + Matcher: "pathAll", + Argument: "VpnConnections[].State", + Expected: "deleted", + }, + { + State: "failure", + Matcher: "pathAny", + Argument: "VpnConnections[].State", + Expected: "pending", + }, + }, + } + + w := waiter.Waiter{ + Client: c, + Input: input, + Config: waiterCfg, + } + return w.Wait() +} diff --git a/Godeps/_workspace/src/github.com/go-ini/ini/.gitignore b/Godeps/_workspace/src/github.com/go-ini/ini/.gitignore new file mode 100644 index 00000000000..7adca9439c5 --- /dev/null +++ b/Godeps/_workspace/src/github.com/go-ini/ini/.gitignore @@ -0,0 +1,4 @@ +testdata/conf_out.ini +ini.sublime-project +ini.sublime-workspace +testdata/conf_reflect.ini diff --git a/Godeps/_workspace/src/github.com/go-ini/ini/LICENSE b/Godeps/_workspace/src/github.com/go-ini/ini/LICENSE new file mode 100644 index 00000000000..37ec93a14fd --- /dev/null +++ b/Godeps/_workspace/src/github.com/go-ini/ini/LICENSE @@ -0,0 +1,191 @@ +Apache License +Version 2.0, January 2004 +http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + +"License" shall mean the terms and conditions for use, reproduction, and +distribution as defined by Sections 1 through 9 of this document. + +"Licensor" shall mean the copyright owner or entity authorized by the copyright +owner that is granting the License. + +"Legal Entity" shall mean the union of the acting entity and all other entities +that control, are controlled by, or are under common control with that entity. +For the purposes of this definition, "control" means (i) the power, direct or +indirect, to cause the direction or management of such entity, whether by +contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the +outstanding shares, or (iii) beneficial ownership of such entity. + +"You" (or "Your") shall mean an individual or Legal Entity exercising +permissions granted by this License. + +"Source" form shall mean the preferred form for making modifications, including +but not limited to software source code, documentation source, and configuration +files. + +"Object" form shall mean any form resulting from mechanical transformation or +translation of a Source form, including but not limited to compiled object code, +generated documentation, and conversions to other media types. + +"Work" shall mean the work of authorship, whether in Source or Object form, made +available under the License, as indicated by a copyright notice that is included +in or attached to the work (an example is provided in the Appendix below). + +"Derivative Works" shall mean any work, whether in Source or Object form, that +is based on (or derived from) the Work and for which the editorial revisions, +annotations, elaborations, or other modifications represent, as a whole, an +original work of authorship. For the purposes of this License, Derivative Works +shall not include works that remain separable from, or merely link (or bind by +name) to the interfaces of, the Work and Derivative Works thereof. + +"Contribution" shall mean any work of authorship, including the original version +of the Work and any modifications or additions to that Work or Derivative Works +thereof, that is intentionally submitted to Licensor for inclusion in the Work +by the copyright owner or by an individual or Legal Entity authorized to submit +on behalf of the copyright owner. For the purposes of this definition, +"submitted" means any form of electronic, verbal, or written communication sent +to the Licensor or its representatives, including but not limited to +communication on electronic mailing lists, source code control systems, and +issue tracking systems that are managed by, or on behalf of, the Licensor for +the purpose of discussing and improving the Work, but excluding communication +that is conspicuously marked or otherwise designated in writing by the copyright +owner as "Not a Contribution." + +"Contributor" shall mean Licensor and any individual or Legal Entity on behalf +of whom a Contribution has been received by Licensor and subsequently +incorporated within the Work. + +2. Grant of Copyright License. + +Subject to the terms and conditions of this License, each Contributor hereby +grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, +irrevocable copyright license to reproduce, prepare Derivative Works of, +publicly display, publicly perform, sublicense, and distribute the Work and such +Derivative Works in Source or Object form. + +3. Grant of Patent License. + +Subject to the terms and conditions of this License, each Contributor hereby +grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, +irrevocable (except as stated in this section) patent license to make, have +made, use, offer to sell, sell, import, and otherwise transfer the Work, where +such license applies only to those patent claims licensable by such Contributor +that are necessarily infringed by their Contribution(s) alone or by combination +of their Contribution(s) with the Work to which such Contribution(s) was +submitted. If You institute patent litigation against any entity (including a +cross-claim or counterclaim in a lawsuit) alleging that the Work or a +Contribution incorporated within the Work constitutes direct or contributory +patent infringement, then any patent licenses granted to You under this License +for that Work shall terminate as of the date such litigation is filed. + +4. Redistribution. + +You may reproduce and distribute copies of the Work or Derivative Works thereof +in any medium, with or without modifications, and in Source or Object form, +provided that You meet the following conditions: + +You must give any other recipients of the Work or Derivative Works a copy of +this License; and +You must cause any modified files to carry prominent notices stating that You +changed the files; and +You must retain, in the Source form of any Derivative Works that You distribute, +all copyright, patent, trademark, and attribution notices from the Source form +of the Work, excluding those notices that do not pertain to any part of the +Derivative Works; and +If the Work includes a "NOTICE" text file as part of its distribution, then any +Derivative Works that You distribute must include a readable copy of the +attribution notices contained within such NOTICE file, excluding those notices +that do not pertain to any part of the Derivative Works, in at least one of the +following places: within a NOTICE text file distributed as part of the +Derivative Works; within the Source form or documentation, if provided along +with the Derivative Works; or, within a display generated by the Derivative +Works, if and wherever such third-party notices normally appear. The contents of +the NOTICE file are for informational purposes only and do not modify the +License. You may add Your own attribution notices within Derivative Works that +You distribute, alongside or as an addendum to the NOTICE text from the Work, +provided that such additional attribution notices cannot be construed as +modifying the License. +You may add Your own copyright statement to Your modifications and may provide +additional or different license terms and conditions for use, reproduction, or +distribution of Your modifications, or for any such Derivative Works as a whole, +provided Your use, reproduction, and distribution of the Work otherwise complies +with the conditions stated in this License. + +5. Submission of Contributions. + +Unless You explicitly state otherwise, any Contribution intentionally submitted +for inclusion in the Work by You to the Licensor shall be under the terms and +conditions of this License, without any additional terms or conditions. +Notwithstanding the above, nothing herein shall supersede or modify the terms of +any separate license agreement you may have executed with Licensor regarding +such Contributions. + +6. Trademarks. + +This License does not grant permission to use the trade names, trademarks, +service marks, or product names of the Licensor, except as required for +reasonable and customary use in describing the origin of the Work and +reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. + +Unless required by applicable law or agreed to in writing, Licensor provides the +Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, +including, without limitation, any warranties or conditions of TITLE, +NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are +solely responsible for determining the appropriateness of using or +redistributing the Work and assume any risks associated with Your exercise of +permissions under this License. + +8. Limitation of Liability. + +In no event and under no legal theory, whether in tort (including negligence), +contract, or otherwise, unless required by applicable law (such as deliberate +and grossly negligent acts) or agreed to in writing, shall any Contributor be +liable to You for damages, including any direct, indirect, special, incidental, +or consequential damages of any character arising as a result of this License or +out of the use or inability to use the Work (including but not limited to +damages for loss of goodwill, work stoppage, computer failure or malfunction, or +any and all other commercial damages or losses), even if such Contributor has +been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. + +While redistributing the Work or Derivative Works thereof, You may choose to +offer, and charge a fee for, acceptance of support, warranty, indemnity, or +other liability obligations and/or rights consistent with this License. However, +in accepting such obligations, You may act only on Your own behalf and on Your +sole responsibility, not on behalf of any other Contributor, and only if You +agree to indemnify, defend, and hold each Contributor harmless for any liability +incurred by, or claims asserted against, such Contributor by reason of your +accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS + +APPENDIX: How to apply the Apache License to your work + +To apply the Apache License to your work, attach the following boilerplate +notice, with the fields enclosed by brackets "[]" replaced with your own +identifying information. (Don't include the brackets!) The text should be +enclosed in the appropriate comment syntax for the file format. We also +recommend that a file or class name and description of purpose be included on +the same "printed page" as the copyright notice for easier identification within +third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/Godeps/_workspace/src/github.com/go-ini/ini/README.md b/Godeps/_workspace/src/github.com/go-ini/ini/README.md new file mode 100644 index 00000000000..1272038a9e3 --- /dev/null +++ b/Godeps/_workspace/src/github.com/go-ini/ini/README.md @@ -0,0 +1,560 @@ +ini [![Build Status](https://drone.io/github.com/go-ini/ini/status.png)](https://drone.io/github.com/go-ini/ini/latest) [![](http://gocover.io/_badge/github.com/go-ini/ini)](http://gocover.io/github.com/go-ini/ini) +=== + +![](https://avatars0.githubusercontent.com/u/10216035?v=3&s=200) + +Package ini provides INI file read and write functionality in Go. + +[简体中文](README_ZH.md) + +## Feature + +- Load multiple data sources(`[]byte` or file) with overwrites. +- Read with recursion values. +- Read with parent-child sections. +- Read with auto-increment key names. +- Read with multiple-line values. +- Read with tons of helper methods. +- Read and convert values to Go types. +- Read and **WRITE** comments of sections and keys. +- Manipulate sections, keys and comments with ease. +- Keep sections and keys in order as you parse and save. + +## Installation + + go get gopkg.in/ini.v1 + +## Getting Started + +### Loading from data sources + +A **Data Source** is either raw data in type `[]byte` or a file name with type `string` and you can load **as many as** data sources you want. Passing other types will simply return an error. + +```go +cfg, err := ini.Load([]byte("raw data"), "filename") +``` + +Or start with an empty object: + +```go +cfg := ini.Empty() +``` + +When you cannot decide how many data sources to load at the beginning, you still able to **Append()** them later. + +```go +err := cfg.Append("other file", []byte("other raw data")) +``` + +### Working with sections + +To get a section, you would need to: + +```go +section, err := cfg.GetSection("section name") +``` + +For a shortcut for default section, just give an empty string as name: + +```go +section, err := cfg.GetSection("") +``` + +When you're pretty sure the section exists, following code could make your life easier: + +```go +section := cfg.Section("") +``` + +What happens when the section somehow does not exist? Don't panic, it automatically creates and returns a new section to you. + +To create a new section: + +```go +err := cfg.NewSection("new section") +``` + +To get a list of sections or section names: + +```go +sections := cfg.Sections() +names := cfg.SectionStrings() +``` + +### Working with keys + +To get a key under a section: + +```go +key, err := cfg.Section("").GetKey("key name") +``` + +Same rule applies to key operations: + +```go +key := cfg.Section("").Key("key name") +``` + +To create a new key: + +```go +err := cfg.Section("").NewKey("name", "value") +``` + +To get a list of keys or key names: + +```go +keys := cfg.Section("").Keys() +names := cfg.Section("").KeyStrings() +``` + +To get a clone hash of keys and corresponding values: + +```go +hash := cfg.GetSection("").KeysHash() +``` + +### Working with values + +To get a string value: + +```go +val := cfg.Section("").Key("key name").String() +``` + +To validate key value on the fly: + +```go +val := cfg.Section("").Key("key name").Validate(func(in string) string { + if len(in) == 0 { + return "default" + } + return in +}) +``` + +To get value with types: + +```go +// For boolean values: +// true when value is: 1, t, T, TRUE, true, True, YES, yes, Yes, ON, on, On +// false when value is: 0, f, F, FALSE, false, False, NO, no, No, OFF, off, Off +v, err = cfg.Section("").Key("BOOL").Bool() +v, err = cfg.Section("").Key("FLOAT64").Float64() +v, err = cfg.Section("").Key("INT").Int() +v, err = cfg.Section("").Key("INT64").Int64() +v, err = cfg.Section("").Key("UINT").Uint() +v, err = cfg.Section("").Key("UINT64").Uint64() +v, err = cfg.Section("").Key("TIME").TimeFormat(time.RFC3339) +v, err = cfg.Section("").Key("TIME").Time() // RFC3339 + +v = cfg.Section("").Key("BOOL").MustBool() +v = cfg.Section("").Key("FLOAT64").MustFloat64() +v = cfg.Section("").Key("INT").MustInt() +v = cfg.Section("").Key("INT64").MustInt64() +v = cfg.Section("").Key("UINT").MustUint() +v = cfg.Section("").Key("UINT64").MustUint64() +v = cfg.Section("").Key("TIME").MustTimeFormat(time.RFC3339) +v = cfg.Section("").Key("TIME").MustTime() // RFC3339 + +// Methods start with Must also accept one argument for default value +// when key not found or fail to parse value to given type. +// Except method MustString, which you have to pass a default value. + +v = cfg.Section("").Key("String").MustString("default") +v = cfg.Section("").Key("BOOL").MustBool(true) +v = cfg.Section("").Key("FLOAT64").MustFloat64(1.25) +v = cfg.Section("").Key("INT").MustInt(10) +v = cfg.Section("").Key("INT64").MustInt64(99) +v = cfg.Section("").Key("UINT").MustUint(3) +v = cfg.Section("").Key("UINT64").MustUint64(6) +v = cfg.Section("").Key("TIME").MustTimeFormat(time.RFC3339, time.Now()) +v = cfg.Section("").Key("TIME").MustTime(time.Now()) // RFC3339 +``` + +What if my value is three-line long? + +```ini +[advance] +ADDRESS = """404 road, +NotFound, State, 5000 +Earth""" +``` + +Not a problem! + +```go +cfg.Section("advance").Key("ADDRESS").String() + +/* --- start --- +404 road, +NotFound, State, 5000 +Earth +------ end --- */ +``` + +That's cool, how about continuation lines? + +```ini +[advance] +two_lines = how about \ + continuation lines? +lots_of_lines = 1 \ + 2 \ + 3 \ + 4 +``` + +Piece of cake! + +```go +cfg.Section("advance").Key("two_lines").String() // how about continuation lines? +cfg.Section("advance").Key("lots_of_lines").String() // 1 2 3 4 +``` + +Note that single quotes around values will be stripped: + +```ini +foo = "some value" // foo: some value +bar = 'some value' // bar: some value +``` + +That's all? Hmm, no. + +#### Helper methods of working with values + +To get value with given candidates: + +```go +v = cfg.Section("").Key("STRING").In("default", []string{"str", "arr", "types"}) +v = cfg.Section("").Key("FLOAT64").InFloat64(1.1, []float64{1.25, 2.5, 3.75}) +v = cfg.Section("").Key("INT").InInt(5, []int{10, 20, 30}) +v = cfg.Section("").Key("INT64").InInt64(10, []int64{10, 20, 30}) +v = cfg.Section("").Key("UINT").InUint(4, []int{3, 6, 9}) +v = cfg.Section("").Key("UINT64").InUint64(8, []int64{3, 6, 9}) +v = cfg.Section("").Key("TIME").InTimeFormat(time.RFC3339, time.Now(), []time.Time{time1, time2, time3}) +v = cfg.Section("").Key("TIME").InTime(time.Now(), []time.Time{time1, time2, time3}) // RFC3339 +``` + +Default value will be presented if value of key is not in candidates you given, and default value does not need be one of candidates. + +To validate value in a given range: + +```go +vals = cfg.Section("").Key("FLOAT64").RangeFloat64(0.0, 1.1, 2.2) +vals = cfg.Section("").Key("INT").RangeInt(0, 10, 20) +vals = cfg.Section("").Key("INT64").RangeInt64(0, 10, 20) +vals = cfg.Section("").Key("UINT").RangeUint(0, 3, 9) +vals = cfg.Section("").Key("UINT64").RangeUint64(0, 3, 9) +vals = cfg.Section("").Key("TIME").RangeTimeFormat(time.RFC3339, time.Now(), minTime, maxTime) +vals = cfg.Section("").Key("TIME").RangeTime(time.Now(), minTime, maxTime) // RFC3339 +``` + +To auto-split value into slice: + +```go +vals = cfg.Section("").Key("STRINGS").Strings(",") +vals = cfg.Section("").Key("FLOAT64S").Float64s(",") +vals = cfg.Section("").Key("INTS").Ints(",") +vals = cfg.Section("").Key("INT64S").Int64s(",") +vals = cfg.Section("").Key("UINTS").Uints(",") +vals = cfg.Section("").Key("UINT64S").Uint64s(",") +vals = cfg.Section("").Key("TIMES").Times(",") +``` + +### Save your configuration + +Finally, it's time to save your configuration to somewhere. + +A typical way to save configuration is writing it to a file: + +```go +// ... +err = cfg.SaveTo("my.ini") +err = cfg.SaveToIndent("my.ini", "\t") +``` + +Another way to save is writing to a `io.Writer` interface: + +```go +// ... +cfg.WriteTo(writer) +cfg.WriteToIndent(writer, "\t") +``` + +## Advanced Usage + +### Recursive Values + +For all value of keys, there is a special syntax `%()s`, where `` is the key name in same section or default section, and `%()s` will be replaced by corresponding value(empty string if key not found). You can use this syntax at most 99 level of recursions. + +```ini +NAME = ini + +[author] +NAME = Unknwon +GITHUB = https://github.com/%(NAME)s + +[package] +FULL_NAME = github.com/go-ini/%(NAME)s +``` + +```go +cfg.Section("author").Key("GITHUB").String() // https://github.com/Unknwon +cfg.Section("package").Key("FULL_NAME").String() // github.com/go-ini/ini +``` + +### Parent-child Sections + +You can use `.` in section name to indicate parent-child relationship between two or more sections. If the key not found in the child section, library will try again on its parent section until there is no parent section. + +```ini +NAME = ini +VERSION = v1 +IMPORT_PATH = gopkg.in/%(NAME)s.%(VERSION)s + +[package] +CLONE_URL = https://%(IMPORT_PATH)s + +[package.sub] +``` + +```go +cfg.Section("package.sub").Key("CLONE_URL").String() // https://gopkg.in/ini.v1 +``` + +### Auto-increment Key Names + +If key name is `-` in data source, then it would be seen as special syntax for auto-increment key name start from 1, and every section is independent on counter. + +```ini +[features] +-: Support read/write comments of keys and sections +-: Support auto-increment of key names +-: Support load multiple files to overwrite key values +``` + +```go +cfg.Section("features").KeyStrings() // []{"#1", "#2", "#3"} +``` + +### Map To Struct + +Want more objective way to play with INI? Cool. + +```ini +Name = Unknwon +age = 21 +Male = true +Born = 1993-01-01T20:17:05Z + +[Note] +Content = Hi is a good man! +Cities = HangZhou, Boston +``` + +```go +type Note struct { + Content string + Cities []string +} + +type Person struct { + Name string + Age int `ini:"age"` + Male bool + Born time.Time + Note + Created time.Time `ini:"-"` +} + +func main() { + cfg, err := ini.Load("path/to/ini") + // ... + p := new(Person) + err = cfg.MapTo(p) + // ... + + // Things can be simpler. + err = ini.MapTo(p, "path/to/ini") + // ... + + // Just map a section? Fine. + n := new(Note) + err = cfg.Section("Note").MapTo(n) + // ... +} +``` + +Can I have default value for field? Absolutely. + +Assign it before you map to struct. It will keep the value as it is if the key is not presented or got wrong type. + +```go +// ... +p := &Person{ + Name: "Joe", +} +// ... +``` + +It's really cool, but what's the point if you can't give me my file back from struct? + +### Reflect From Struct + +Why not? + +```go +type Embeded struct { + Dates []time.Time `delim:"|"` + Places []string + None []int +} + +type Author struct { + Name string `ini:"NAME"` + Male bool + Age int + GPA float64 + NeverMind string `ini:"-"` + *Embeded +} + +func main() { + a := &Author{"Unknwon", true, 21, 2.8, "", + &Embeded{ + []time.Time{time.Now(), time.Now()}, + []string{"HangZhou", "Boston"}, + []int{}, + }} + cfg := ini.Empty() + err = ini.ReflectFrom(cfg, a) + // ... +} +``` + +So, what do I get? + +```ini +NAME = Unknwon +Male = true +Age = 21 +GPA = 2.8 + +[Embeded] +Dates = 2015-08-07T22:14:22+08:00|2015-08-07T22:14:22+08:00 +Places = HangZhou,Boston +None = +``` + +#### Name Mapper + +To save your time and make your code cleaner, this library supports [`NameMapper`](https://gowalker.org/gopkg.in/ini.v1#NameMapper) between struct field and actual section and key name. + +There are 2 built-in name mappers: + +- `AllCapsUnderscore`: it converts to format `ALL_CAPS_UNDERSCORE` then match section or key. +- `TitleUnderscore`: it converts to format `title_underscore` then match section or key. + +To use them: + +```go +type Info struct { + PackageName string +} + +func main() { + err = ini.MapToWithMapper(&Info{}, ini.TitleUnderscore, []byte("packag_name=ini")) + // ... + + cfg, err := ini.Load([]byte("PACKAGE_NAME=ini")) + // ... + info := new(Info) + cfg.NameMapper = ini.AllCapsUnderscore + err = cfg.MapTo(info) + // ... +} +``` + +Same rules of name mapper apply to `ini.ReflectFromWithMapper` function. + +#### Other Notes On Map/Reflect + +Any embedded struct is treated as a section by default, and there is no automatic parent-child relations in map/reflect feature: + +```go +type Child struct { + Age string +} + +type Parent struct { + Name string + Child +} + +type Config struct { + City string + Parent +} +``` + +Example configuration: + +```ini +City = Boston + +[Parent] +Name = Unknwon + +[Child] +Age = 21 +``` + +What if, yes, I'm paranoid, I want embedded struct to be in the same section. Well, all roads lead to Rome. + +```go +type Child struct { + Age string +} + +type Parent struct { + Name string + Child `ini:"Parent"` +} + +type Config struct { + City string + Parent +} +``` + +Example configuration: + +```ini +City = Boston + +[Parent] +Name = Unknwon +Age = 21 +``` + +## Getting Help + +- [API Documentation](https://gowalker.org/gopkg.in/ini.v1) +- [File An Issue](https://github.com/go-ini/ini/issues/new) + +## FAQs + +### What does `BlockMode` field do? + +By default, library lets you read and write values so we need a locker to make sure your data is safe. But in cases that you are very sure about only reading data through the library, you can set `cfg.BlockMode = false` to speed up read operations about **50-70%** faster. + +### Why another INI library? + +Many people are using my another INI library [goconfig](https://github.com/Unknwon/goconfig), so the reason for this one is I would like to make more Go style code. Also when you set `cfg.BlockMode = false`, this one is about **10-30%** faster. + +To make those changes I have to confirm API broken, so it's safer to keep it in another place and start using `gopkg.in` to version my package at this time.(PS: shorter import path) + +## License + +This project is under Apache v2 License. See the [LICENSE](LICENSE) file for the full license text. diff --git a/Godeps/_workspace/src/github.com/go-ini/ini/README_ZH.md b/Godeps/_workspace/src/github.com/go-ini/ini/README_ZH.md new file mode 100644 index 00000000000..45e19edddff --- /dev/null +++ b/Godeps/_workspace/src/github.com/go-ini/ini/README_ZH.md @@ -0,0 +1,547 @@ +本包提供了 Go 语言中读写 INI 文件的功能。 + +## 功能特性 + +- 支持覆盖加载多个数据源(`[]byte` 或文件) +- 支持递归读取键值 +- 支持读取父子分区 +- 支持读取自增键名 +- 支持读取多行的键值 +- 支持大量辅助方法 +- 支持在读取时直接转换为 Go 语言类型 +- 支持读取和 **写入** 分区和键的注释 +- 轻松操作分区、键值和注释 +- 在保存文件时分区和键值会保持原有的顺序 + +## 下载安装 + + go get gopkg.in/ini.v1 + +## 开始使用 + +### 从数据源加载 + +一个 **数据源** 可以是 `[]byte` 类型的原始数据,或 `string` 类型的文件路径。您可以加载 **任意多个** 数据源。如果您传递其它类型的数据源,则会直接返回错误。 + +```go +cfg, err := ini.Load([]byte("raw data"), "filename") +``` + +或者从一个空白的文件开始: + +```go +cfg := ini.Empty() +``` + +当您在一开始无法决定需要加载哪些数据源时,仍可以使用 **Append()** 在需要的时候加载它们。 + +```go +err := cfg.Append("other file", []byte("other raw data")) +``` + +### 操作分区(Section) + +获取指定分区: + +```go +section, err := cfg.GetSection("section name") +``` + +如果您想要获取默认分区,则可以用空字符串代替分区名: + +```go +section, err := cfg.GetSection("") +``` + +当您非常确定某个分区是存在的,可以使用以下简便方法: + +```go +section := cfg.Section("") +``` + +如果不小心判断错了,要获取的分区其实是不存在的,那会发生什么呢?没事的,它会自动创建并返回一个对应的分区对象给您。 + +创建一个分区: + +```go +err := cfg.NewSection("new section") +``` + +获取所有分区对象或名称: + +```go +sections := cfg.Sections() +names := cfg.SectionStrings() +``` + +### 操作键(Key) + +获取某个分区下的键: + +```go +key, err := cfg.Section("").GetKey("key name") +``` + +和分区一样,您也可以直接获取键而忽略错误处理: + +```go +key := cfg.Section("").Key("key name") +``` + +创建一个新的键: + +```go +err := cfg.Section("").NewKey("name", "value") +``` + +获取分区下的所有键或键名: + +```go +keys := cfg.Section("").Keys() +names := cfg.Section("").KeyStrings() +``` + +获取分区下的所有键值对的克隆: + +```go +hash := cfg.GetSection("").KeysHash() +``` + +### 操作键值(Value) + +获取一个类型为字符串(string)的值: + +```go +val := cfg.Section("").Key("key name").String() +``` + +获取值的同时通过自定义函数进行处理验证: + +```go +val := cfg.Section("").Key("key name").Validate(func(in string) string { + if len(in) == 0 { + return "default" + } + return in +}) +``` + +获取其它类型的值: + +```go +// 布尔值的规则: +// true 当值为:1, t, T, TRUE, true, True, YES, yes, Yes, ON, on, On +// false 当值为:0, f, F, FALSE, false, False, NO, no, No, OFF, off, Off +v, err = cfg.Section("").Key("BOOL").Bool() +v, err = cfg.Section("").Key("FLOAT64").Float64() +v, err = cfg.Section("").Key("INT").Int() +v, err = cfg.Section("").Key("INT64").Int64() +v, err = cfg.Section("").Key("UINT").Uint() +v, err = cfg.Section("").Key("UINT64").Uint64() +v, err = cfg.Section("").Key("TIME").TimeFormat(time.RFC3339) +v, err = cfg.Section("").Key("TIME").Time() // RFC3339 + +v = cfg.Section("").Key("BOOL").MustBool() +v = cfg.Section("").Key("FLOAT64").MustFloat64() +v = cfg.Section("").Key("INT").MustInt() +v = cfg.Section("").Key("INT64").MustInt64() +v = cfg.Section("").Key("UINT").MustUint() +v = cfg.Section("").Key("UINT64").MustUint64() +v = cfg.Section("").Key("TIME").MustTimeFormat(time.RFC3339) +v = cfg.Section("").Key("TIME").MustTime() // RFC3339 + +// 由 Must 开头的方法名允许接收一个相同类型的参数来作为默认值, +// 当键不存在或者转换失败时,则会直接返回该默认值。 +// 但是,MustString 方法必须传递一个默认值。 + +v = cfg.Seciont("").Key("String").MustString("default") +v = cfg.Section("").Key("BOOL").MustBool(true) +v = cfg.Section("").Key("FLOAT64").MustFloat64(1.25) +v = cfg.Section("").Key("INT").MustInt(10) +v = cfg.Section("").Key("INT64").MustInt64(99) +v = cfg.Section("").Key("UINT").MustUint(3) +v = cfg.Section("").Key("UINT64").MustUint64(6) +v = cfg.Section("").Key("TIME").MustTimeFormat(time.RFC3339, time.Now()) +v = cfg.Section("").Key("TIME").MustTime(time.Now()) // RFC3339 +``` + +如果我的值有好多行怎么办? + +```ini +[advance] +ADDRESS = """404 road, +NotFound, State, 5000 +Earth""" +``` + +嗯哼?小 case! + +```go +cfg.Section("advance").Key("ADDRESS").String() + +/* --- start --- +404 road, +NotFound, State, 5000 +Earth +------ end --- */ +``` + +赞爆了!那要是我属于一行的内容写不下想要写到第二行怎么办? + +```ini +[advance] +two_lines = how about \ + continuation lines? +lots_of_lines = 1 \ + 2 \ + 3 \ + 4 +``` + +简直是小菜一碟! + +```go +cfg.Section("advance").Key("two_lines").String() // how about continuation lines? +cfg.Section("advance").Key("lots_of_lines").String() // 1 2 3 4 +``` + +需要注意的是,值两侧的单引号会被自动剔除: + +```ini +foo = "some value" // foo: some value +bar = 'some value' // bar: some value +``` + +这就是全部了?哈哈,当然不是。 + +#### 操作键值的辅助方法 + +获取键值时设定候选值: + +```go +v = cfg.Section("").Key("STRING").In("default", []string{"str", "arr", "types"}) +v = cfg.Section("").Key("FLOAT64").InFloat64(1.1, []float64{1.25, 2.5, 3.75}) +v = cfg.Section("").Key("INT").InInt(5, []int{10, 20, 30}) +v = cfg.Section("").Key("INT64").InInt64(10, []int64{10, 20, 30}) +v = cfg.Section("").Key("UINT").InUint(4, []int{3, 6, 9}) +v = cfg.Section("").Key("UINT64").InUint64(8, []int64{3, 6, 9}) +v = cfg.Section("").Key("TIME").InTimeFormat(time.RFC3339, time.Now(), []time.Time{time1, time2, time3}) +v = cfg.Section("").Key("TIME").InTime(time.Now(), []time.Time{time1, time2, time3}) // RFC3339 +``` + +如果获取到的值不是候选值的任意一个,则会返回默认值,而默认值不需要是候选值中的一员。 + +验证获取的值是否在指定范围内: + +```go +vals = cfg.Section("").Key("FLOAT64").RangeFloat64(0.0, 1.1, 2.2) +vals = cfg.Section("").Key("INT").RangeInt(0, 10, 20) +vals = cfg.Section("").Key("INT64").RangeInt64(0, 10, 20) +vals = cfg.Section("").Key("UINT").RangeUint(0, 3, 9) +vals = cfg.Section("").Key("UINT64").RangeUint64(0, 3, 9) +vals = cfg.Section("").Key("TIME").RangeTimeFormat(time.RFC3339, time.Now(), minTime, maxTime) +vals = cfg.Section("").Key("TIME").RangeTime(time.Now(), minTime, maxTime) // RFC3339 +``` + +自动分割键值为切片(slice): + +```go +vals = cfg.Section("").Key("STRINGS").Strings(",") +vals = cfg.Section("").Key("FLOAT64S").Float64s(",") +vals = cfg.Section("").Key("INTS").Ints(",") +vals = cfg.Section("").Key("INT64S").Int64s(",") +vals = cfg.Section("").Key("UINTS").Uints(",") +vals = cfg.Section("").Key("UINT64S").Uint64s(",") +vals = cfg.Section("").Key("TIMES").Times(",") +``` + +### 保存配置 + +终于到了这个时刻,是时候保存一下配置了。 + +比较原始的做法是输出配置到某个文件: + +```go +// ... +err = cfg.SaveTo("my.ini") +err = cfg.SaveToIndent("my.ini", "\t") +``` + +另一个比较高级的做法是写入到任何实现 `io.Writer` 接口的对象中: + +```go +// ... +cfg.WriteTo(writer) +cfg.WriteToIndent(writer, "\t") +``` + +### 高级用法 + +#### 递归读取键值 + +在获取所有键值的过程中,特殊语法 `%()s` 会被应用,其中 `` 可以是相同分区或者默认分区下的键名。字符串 `%()s` 会被相应的键值所替代,如果指定的键不存在,则会用空字符串替代。您可以最多使用 99 层的递归嵌套。 + +```ini +NAME = ini + +[author] +NAME = Unknwon +GITHUB = https://github.com/%(NAME)s + +[package] +FULL_NAME = github.com/go-ini/%(NAME)s +``` + +```go +cfg.Section("author").Key("GITHUB").String() // https://github.com/Unknwon +cfg.Section("package").Key("FULL_NAME").String() // github.com/go-ini/ini +``` + +#### 读取父子分区 + +您可以在分区名称中使用 `.` 来表示两个或多个分区之间的父子关系。如果某个键在子分区中不存在,则会去它的父分区中再次寻找,直到没有父分区为止。 + +```ini +NAME = ini +VERSION = v1 +IMPORT_PATH = gopkg.in/%(NAME)s.%(VERSION)s + +[package] +CLONE_URL = https://%(IMPORT_PATH)s + +[package.sub] +``` + +```go +cfg.Section("package.sub").Key("CLONE_URL").String() // https://gopkg.in/ini.v1 +``` + +#### 读取自增键名 + +如果数据源中的键名为 `-`,则认为该键使用了自增键名的特殊语法。计数器从 1 开始,并且分区之间是相互独立的。 + +```ini +[features] +-: Support read/write comments of keys and sections +-: Support auto-increment of key names +-: Support load multiple files to overwrite key values +``` + +```go +cfg.Section("features").KeyStrings() // []{"#1", "#2", "#3"} +``` + +### 映射到结构 + +想要使用更加面向对象的方式玩转 INI 吗?好主意。 + +```ini +Name = Unknwon +age = 21 +Male = true +Born = 1993-01-01T20:17:05Z + +[Note] +Content = Hi is a good man! +Cities = HangZhou, Boston +``` + +```go +type Note struct { + Content string + Cities []string +} + +type Person struct { + Name string + Age int `ini:"age"` + Male bool + Born time.Time + Note + Created time.Time `ini:"-"` +} + +func main() { + cfg, err := ini.Load("path/to/ini") + // ... + p := new(Person) + err = cfg.MapTo(p) + // ... + + // 一切竟可以如此的简单。 + err = ini.MapTo(p, "path/to/ini") + // ... + + // 嗯哼?只需要映射一个分区吗? + n := new(Note) + err = cfg.Section("Note").MapTo(n) + // ... +} +``` + +结构的字段怎么设置默认值呢?很简单,只要在映射之前对指定字段进行赋值就可以了。如果键未找到或者类型错误,该值不会发生改变。 + +```go +// ... +p := &Person{ + Name: "Joe", +} +// ... +``` + +这样玩 INI 真的好酷啊!然而,如果不能还给我原来的配置文件,有什么卵用? + +### 从结构反射 + +可是,我有说不能吗? + +```go +type Embeded struct { + Dates []time.Time `delim:"|"` + Places []string + None []int +} + +type Author struct { + Name string `ini:"NAME"` + Male bool + Age int + GPA float64 + NeverMind string `ini:"-"` + *Embeded +} + +func main() { + a := &Author{"Unknwon", true, 21, 2.8, "", + &Embeded{ + []time.Time{time.Now(), time.Now()}, + []string{"HangZhou", "Boston"}, + []int{}, + }} + cfg := ini.Empty() + err = ini.ReflectFrom(cfg, a) + // ... +} +``` + +瞧瞧,奇迹发生了。 + +```ini +NAME = Unknwon +Male = true +Age = 21 +GPA = 2.8 + +[Embeded] +Dates = 2015-08-07T22:14:22+08:00|2015-08-07T22:14:22+08:00 +Places = HangZhou,Boston +None = +``` + +#### 名称映射器(Name Mapper) + +为了节省您的时间并简化代码,本库支持类型为 [`NameMapper`](https://gowalker.org/gopkg.in/ini.v1#NameMapper) 的名称映射器,该映射器负责结构字段名与分区名和键名之间的映射。 + +目前有 2 款内置的映射器: + +- `AllCapsUnderscore`:该映射器将字段名转换至格式 `ALL_CAPS_UNDERSCORE` 后再去匹配分区名和键名。 +- `TitleUnderscore`:该映射器将字段名转换至格式 `title_underscore` 后再去匹配分区名和键名。 + +使用方法: + +```go +type Info struct{ + PackageName string +} + +func main() { + err = ini.MapToWithMapper(&Info{}, ini.TitleUnderscore, []byte("packag_name=ini")) + // ... + + cfg, err := ini.Load([]byte("PACKAGE_NAME=ini")) + // ... + info := new(Info) + cfg.NameMapper = ini.AllCapsUnderscore + err = cfg.MapTo(info) + // ... +} +``` + +使用函数 `ini.ReflectFromWithMapper` 时也可应用相同的规则。 + +#### 映射/反射的其它说明 + +任何嵌入的结构都会被默认认作一个不同的分区,并且不会自动产生所谓的父子分区关联: + +```go +type Child struct { + Age string +} + +type Parent struct { + Name string + Child +} + +type Config struct { + City string + Parent +} +``` + +示例配置文件: + +```ini +City = Boston + +[Parent] +Name = Unknwon + +[Child] +Age = 21 +``` + +很好,但是,我就是要嵌入结构也在同一个分区。好吧,你爹是李刚! + +```go +type Child struct { + Age string +} + +type Parent struct { + Name string + Child `ini:"Parent"` +} + +type Config struct { + City string + Parent +} +``` + +示例配置文件: + +```ini +City = Boston + +[Parent] +Name = Unknwon +Age = 21 +``` + +## 获取帮助 + +- [API 文档](https://gowalker.org/gopkg.in/ini.v1) +- [创建工单](https://github.com/go-ini/ini/issues/new) + +## 常见问题 + +### 字段 `BlockMode` 是什么? + +默认情况下,本库会在您进行读写操作时采用锁机制来确保数据时间。但在某些情况下,您非常确定只进行读操作。此时,您可以通过设置 `cfg.BlockMode = false` 来将读操作提升大约 **50-70%** 的性能。 + +### 为什么要写另一个 INI 解析库? + +许多人都在使用我的 [goconfig](https://github.com/Unknwon/goconfig) 来完成对 INI 文件的操作,但我希望使用更加 Go 风格的代码。并且当您设置 `cfg.BlockMode = false` 时,会有大约 **10-30%** 的性能提升。 + +为了做出这些改变,我必须对 API 进行破坏,所以新开一个仓库是最安全的做法。除此之外,本库直接使用 `gopkg.in` 来进行版本化发布。(其实真相是导入路径更短了) diff --git a/Godeps/_workspace/src/github.com/go-ini/ini/ini.go b/Godeps/_workspace/src/github.com/go-ini/ini/ini.go new file mode 100644 index 00000000000..1fee789a1d6 --- /dev/null +++ b/Godeps/_workspace/src/github.com/go-ini/ini/ini.go @@ -0,0 +1,1226 @@ +// Copyright 2014 Unknwon +// +// Licensed under the Apache License, Version 2.0 (the "License"): you may +// not use this file except in compliance with the License. You may obtain +// a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +// License for the specific language governing permissions and limitations +// under the License. + +// Package ini provides INI file read and write functionality in Go. +package ini + +import ( + "bufio" + "bytes" + "errors" + "fmt" + "io" + "os" + "regexp" + "runtime" + "strconv" + "strings" + "sync" + "time" +) + +const ( + DEFAULT_SECTION = "DEFAULT" + // Maximum allowed depth when recursively substituing variable names. + _DEPTH_VALUES = 99 + + _VERSION = "1.6.0" +) + +func Version() string { + return _VERSION +} + +var ( + LineBreak = "\n" + + // Variable regexp pattern: %(variable)s + varPattern = regexp.MustCompile(`%\(([^\)]+)\)s`) + + // Write spaces around "=" to look better. + PrettyFormat = true +) + +func init() { + if runtime.GOOS == "windows" { + LineBreak = "\r\n" + } +} + +func inSlice(str string, s []string) bool { + for _, v := range s { + if str == v { + return true + } + } + return false +} + +// dataSource is a interface that returns file content. +type dataSource interface { + ReadCloser() (io.ReadCloser, error) +} + +type sourceFile struct { + name string +} + +func (s sourceFile) ReadCloser() (_ io.ReadCloser, err error) { + return os.Open(s.name) +} + +type bytesReadCloser struct { + reader io.Reader +} + +func (rc *bytesReadCloser) Read(p []byte) (n int, err error) { + return rc.reader.Read(p) +} + +func (rc *bytesReadCloser) Close() error { + return nil +} + +type sourceData struct { + data []byte +} + +func (s *sourceData) ReadCloser() (io.ReadCloser, error) { + return &bytesReadCloser{bytes.NewReader(s.data)}, nil +} + +// ____ __. +// | |/ _|____ ___.__. +// | <_/ __ < | | +// | | \ ___/\___ | +// |____|__ \___ > ____| +// \/ \/\/ + +// Key represents a key under a section. +type Key struct { + s *Section + Comment string + name string + value string + isAutoIncr bool +} + +// Name returns name of key. +func (k *Key) Name() string { + return k.name +} + +// Value returns raw value of key for performance purpose. +func (k *Key) Value() string { + return k.value +} + +// String returns string representation of value. +func (k *Key) String() string { + val := k.value + if strings.Index(val, "%") == -1 { + return val + } + + for i := 0; i < _DEPTH_VALUES; i++ { + vr := varPattern.FindString(val) + if len(vr) == 0 { + break + } + + // Take off leading '%(' and trailing ')s'. + noption := strings.TrimLeft(vr, "%(") + noption = strings.TrimRight(noption, ")s") + + // Search in the same section. + nk, err := k.s.GetKey(noption) + if err != nil { + // Search again in default section. + nk, _ = k.s.f.Section("").GetKey(noption) + } + + // Substitute by new value and take off leading '%(' and trailing ')s'. + val = strings.Replace(val, vr, nk.value, -1) + } + return val +} + +// Validate accepts a validate function which can +// return modifed result as key value. +func (k *Key) Validate(fn func(string) string) string { + return fn(k.String()) +} + +// parseBool returns the boolean value represented by the string. +// +// It accepts 1, t, T, TRUE, true, True, YES, yes, Yes, ON, on, On, +// 0, f, F, FALSE, false, False, NO, no, No, OFF, off, Off. +// Any other value returns an error. +func parseBool(str string) (value bool, err error) { + switch str { + case "1", "t", "T", "true", "TRUE", "True", "YES", "yes", "Yes", "ON", "on", "On": + return true, nil + case "0", "f", "F", "false", "FALSE", "False", "NO", "no", "No", "OFF", "off", "Off": + return false, nil + } + return false, fmt.Errorf("parsing \"%s\": invalid syntax", str) +} + +// Bool returns bool type value. +func (k *Key) Bool() (bool, error) { + return parseBool(k.String()) +} + +// Float64 returns float64 type value. +func (k *Key) Float64() (float64, error) { + return strconv.ParseFloat(k.String(), 64) +} + +// Int returns int type value. +func (k *Key) Int() (int, error) { + return strconv.Atoi(k.String()) +} + +// Int64 returns int64 type value. +func (k *Key) Int64() (int64, error) { + return strconv.ParseInt(k.String(), 10, 64) +} + +// Uint returns uint type valued. +func (k *Key) Uint() (uint, error) { + u, e := strconv.ParseUint(k.String(), 10, 64) + return uint(u), e +} + +// Uint64 returns uint64 type value. +func (k *Key) Uint64() (uint64, error) { + return strconv.ParseUint(k.String(), 10, 64) +} + +// Duration returns time.Duration type value. +func (k *Key) Duration() (time.Duration, error) { + return time.ParseDuration(k.String()) +} + +// TimeFormat parses with given format and returns time.Time type value. +func (k *Key) TimeFormat(format string) (time.Time, error) { + return time.Parse(format, k.String()) +} + +// Time parses with RFC3339 format and returns time.Time type value. +func (k *Key) Time() (time.Time, error) { + return k.TimeFormat(time.RFC3339) +} + +// MustString returns default value if key value is empty. +func (k *Key) MustString(defaultVal string) string { + val := k.String() + if len(val) == 0 { + return defaultVal + } + return val +} + +// MustBool always returns value without error, +// it returns false if error occurs. +func (k *Key) MustBool(defaultVal ...bool) bool { + val, err := k.Bool() + if len(defaultVal) > 0 && err != nil { + return defaultVal[0] + } + return val +} + +// MustFloat64 always returns value without error, +// it returns 0.0 if error occurs. +func (k *Key) MustFloat64(defaultVal ...float64) float64 { + val, err := k.Float64() + if len(defaultVal) > 0 && err != nil { + return defaultVal[0] + } + return val +} + +// MustInt always returns value without error, +// it returns 0 if error occurs. +func (k *Key) MustInt(defaultVal ...int) int { + val, err := k.Int() + if len(defaultVal) > 0 && err != nil { + return defaultVal[0] + } + return val +} + +// MustInt64 always returns value without error, +// it returns 0 if error occurs. +func (k *Key) MustInt64(defaultVal ...int64) int64 { + val, err := k.Int64() + if len(defaultVal) > 0 && err != nil { + return defaultVal[0] + } + return val +} + +// MustUint always returns value without error, +// it returns 0 if error occurs. +func (k *Key) MustUint(defaultVal ...uint) uint { + val, err := k.Uint() + if len(defaultVal) > 0 && err != nil { + return defaultVal[0] + } + return val +} + +// MustUint64 always returns value without error, +// it returns 0 if error occurs. +func (k *Key) MustUint64(defaultVal ...uint64) uint64 { + val, err := k.Uint64() + if len(defaultVal) > 0 && err != nil { + return defaultVal[0] + } + return val +} + +// MustDuration always returns value without error, +// it returns zero value if error occurs. +func (k *Key) MustDuration(defaultVal ...time.Duration) time.Duration { + val, err := k.Duration() + if len(defaultVal) > 0 && err != nil { + return defaultVal[0] + } + return val +} + +// MustTimeFormat always parses with given format and returns value without error, +// it returns zero value if error occurs. +func (k *Key) MustTimeFormat(format string, defaultVal ...time.Time) time.Time { + val, err := k.TimeFormat(format) + if len(defaultVal) > 0 && err != nil { + return defaultVal[0] + } + return val +} + +// MustTime always parses with RFC3339 format and returns value without error, +// it returns zero value if error occurs. +func (k *Key) MustTime(defaultVal ...time.Time) time.Time { + return k.MustTimeFormat(time.RFC3339, defaultVal...) +} + +// In always returns value without error, +// it returns default value if error occurs or doesn't fit into candidates. +func (k *Key) In(defaultVal string, candidates []string) string { + val := k.String() + for _, cand := range candidates { + if val == cand { + return val + } + } + return defaultVal +} + +// InFloat64 always returns value without error, +// it returns default value if error occurs or doesn't fit into candidates. +func (k *Key) InFloat64(defaultVal float64, candidates []float64) float64 { + val := k.MustFloat64() + for _, cand := range candidates { + if val == cand { + return val + } + } + return defaultVal +} + +// InInt always returns value without error, +// it returns default value if error occurs or doesn't fit into candidates. +func (k *Key) InInt(defaultVal int, candidates []int) int { + val := k.MustInt() + for _, cand := range candidates { + if val == cand { + return val + } + } + return defaultVal +} + +// InInt64 always returns value without error, +// it returns default value if error occurs or doesn't fit into candidates. +func (k *Key) InInt64(defaultVal int64, candidates []int64) int64 { + val := k.MustInt64() + for _, cand := range candidates { + if val == cand { + return val + } + } + return defaultVal +} + +// InUint always returns value without error, +// it returns default value if error occurs or doesn't fit into candidates. +func (k *Key) InUint(defaultVal uint, candidates []uint) uint { + val := k.MustUint() + for _, cand := range candidates { + if val == cand { + return val + } + } + return defaultVal +} + +// InUint64 always returns value without error, +// it returns default value if error occurs or doesn't fit into candidates. +func (k *Key) InUint64(defaultVal uint64, candidates []uint64) uint64 { + val := k.MustUint64() + for _, cand := range candidates { + if val == cand { + return val + } + } + return defaultVal +} + +// InTimeFormat always parses with given format and returns value without error, +// it returns default value if error occurs or doesn't fit into candidates. +func (k *Key) InTimeFormat(format string, defaultVal time.Time, candidates []time.Time) time.Time { + val := k.MustTimeFormat(format) + for _, cand := range candidates { + if val == cand { + return val + } + } + return defaultVal +} + +// InTime always parses with RFC3339 format and returns value without error, +// it returns default value if error occurs or doesn't fit into candidates. +func (k *Key) InTime(defaultVal time.Time, candidates []time.Time) time.Time { + return k.InTimeFormat(time.RFC3339, defaultVal, candidates) +} + +// RangeFloat64 checks if value is in given range inclusively, +// and returns default value if it's not. +func (k *Key) RangeFloat64(defaultVal, min, max float64) float64 { + val := k.MustFloat64() + if val < min || val > max { + return defaultVal + } + return val +} + +// RangeInt checks if value is in given range inclusively, +// and returns default value if it's not. +func (k *Key) RangeInt(defaultVal, min, max int) int { + val := k.MustInt() + if val < min || val > max { + return defaultVal + } + return val +} + +// RangeInt64 checks if value is in given range inclusively, +// and returns default value if it's not. +func (k *Key) RangeInt64(defaultVal, min, max int64) int64 { + val := k.MustInt64() + if val < min || val > max { + return defaultVal + } + return val +} + +// RangeTimeFormat checks if value with given format is in given range inclusively, +// and returns default value if it's not. +func (k *Key) RangeTimeFormat(format string, defaultVal, min, max time.Time) time.Time { + val := k.MustTimeFormat(format) + if val.Unix() < min.Unix() || val.Unix() > max.Unix() { + return defaultVal + } + return val +} + +// RangeTime checks if value with RFC3339 format is in given range inclusively, +// and returns default value if it's not. +func (k *Key) RangeTime(defaultVal, min, max time.Time) time.Time { + return k.RangeTimeFormat(time.RFC3339, defaultVal, min, max) +} + +// Strings returns list of string devide by given delimiter. +func (k *Key) Strings(delim string) []string { + str := k.String() + if len(str) == 0 { + return []string{} + } + + vals := strings.Split(str, delim) + for i := range vals { + vals[i] = strings.TrimSpace(vals[i]) + } + return vals +} + +// Float64s returns list of float64 devide by given delimiter. +func (k *Key) Float64s(delim string) []float64 { + strs := k.Strings(delim) + vals := make([]float64, len(strs)) + for i := range strs { + vals[i], _ = strconv.ParseFloat(strs[i], 64) + } + return vals +} + +// Ints returns list of int devide by given delimiter. +func (k *Key) Ints(delim string) []int { + strs := k.Strings(delim) + vals := make([]int, len(strs)) + for i := range strs { + vals[i], _ = strconv.Atoi(strs[i]) + } + return vals +} + +// Int64s returns list of int64 devide by given delimiter. +func (k *Key) Int64s(delim string) []int64 { + strs := k.Strings(delim) + vals := make([]int64, len(strs)) + for i := range strs { + vals[i], _ = strconv.ParseInt(strs[i], 10, 64) + } + return vals +} + +// Uints returns list of uint devide by given delimiter. +func (k *Key) Uints(delim string) []uint { + strs := k.Strings(delim) + vals := make([]uint, len(strs)) + for i := range strs { + u, _ := strconv.ParseUint(strs[i], 10, 64) + vals[i] = uint(u) + } + return vals +} + +// Uint64s returns list of uint64 devide by given delimiter. +func (k *Key) Uint64s(delim string) []uint64 { + strs := k.Strings(delim) + vals := make([]uint64, len(strs)) + for i := range strs { + vals[i], _ = strconv.ParseUint(strs[i], 10, 64) + } + return vals +} + +// TimesFormat parses with given format and returns list of time.Time devide by given delimiter. +func (k *Key) TimesFormat(format, delim string) []time.Time { + strs := k.Strings(delim) + vals := make([]time.Time, len(strs)) + for i := range strs { + vals[i], _ = time.Parse(format, strs[i]) + } + return vals +} + +// Times parses with RFC3339 format and returns list of time.Time devide by given delimiter. +func (k *Key) Times(delim string) []time.Time { + return k.TimesFormat(time.RFC3339, delim) +} + +// SetValue changes key value. +func (k *Key) SetValue(v string) { + k.value = v +} + +// _________ __ .__ +// / _____/ ____ _____/ |_|__| ____ ____ +// \_____ \_/ __ \_/ ___\ __\ |/ _ \ / \ +// / \ ___/\ \___| | | ( <_> ) | \ +// /_______ /\___ >\___ >__| |__|\____/|___| / +// \/ \/ \/ \/ + +// Section represents a config section. +type Section struct { + f *File + Comment string + name string + keys map[string]*Key + keyList []string + keysHash map[string]string +} + +func newSection(f *File, name string) *Section { + return &Section{f, "", name, make(map[string]*Key), make([]string, 0, 10), make(map[string]string)} +} + +// Name returns name of Section. +func (s *Section) Name() string { + return s.name +} + +// NewKey creates a new key to given section. +func (s *Section) NewKey(name, val string) (*Key, error) { + if len(name) == 0 { + return nil, errors.New("error creating new key: empty key name") + } + + if s.f.BlockMode { + s.f.lock.Lock() + defer s.f.lock.Unlock() + } + + if inSlice(name, s.keyList) { + s.keys[name].value = val + return s.keys[name], nil + } + + s.keyList = append(s.keyList, name) + s.keys[name] = &Key{s, "", name, val, false} + s.keysHash[name] = val + return s.keys[name], nil +} + +// GetKey returns key in section by given name. +func (s *Section) GetKey(name string) (*Key, error) { + // FIXME: change to section level lock? + if s.f.BlockMode { + s.f.lock.RLock() + } + key := s.keys[name] + if s.f.BlockMode { + s.f.lock.RUnlock() + } + + if key == nil { + // Check if it is a child-section. + sname := s.name + for { + if i := strings.LastIndex(sname, "."); i > -1 { + sname = sname[:i] + sec, err := s.f.GetSection(sname) + if err != nil { + continue + } + return sec.GetKey(name) + } else { + break + } + } + return nil, fmt.Errorf("error when getting key of section '%s': key '%s' not exists", s.name, name) + } + return key, nil +} + +// Key assumes named Key exists in section and returns a zero-value when not. +func (s *Section) Key(name string) *Key { + key, err := s.GetKey(name) + if err != nil { + // It's OK here because the only possible error is empty key name, + // but if it's empty, this piece of code won't be executed. + key, _ = s.NewKey(name, "") + return key + } + return key +} + +// Keys returns list of keys of section. +func (s *Section) Keys() []*Key { + keys := make([]*Key, len(s.keyList)) + for i := range s.keyList { + keys[i] = s.Key(s.keyList[i]) + } + return keys +} + +// KeyStrings returns list of key names of section. +func (s *Section) KeyStrings() []string { + list := make([]string, len(s.keyList)) + copy(list, s.keyList) + return list +} + +// KeysHash returns keys hash consisting of names and values. +func (s *Section) KeysHash() map[string]string { + if s.f.BlockMode { + s.f.lock.RLock() + defer s.f.lock.RUnlock() + } + + hash := map[string]string{} + for key, value := range s.keysHash { + hash[key] = value + } + return hash +} + +// DeleteKey deletes a key from section. +func (s *Section) DeleteKey(name string) { + if s.f.BlockMode { + s.f.lock.Lock() + defer s.f.lock.Unlock() + } + + for i, k := range s.keyList { + if k == name { + s.keyList = append(s.keyList[:i], s.keyList[i+1:]...) + delete(s.keys, name) + return + } + } +} + +// ___________.__.__ +// \_ _____/|__| | ____ +// | __) | | | _/ __ \ +// | \ | | |_\ ___/ +// \___ / |__|____/\___ > +// \/ \/ + +// File represents a combination of a or more INI file(s) in memory. +type File struct { + // Should make things safe, but sometimes doesn't matter. + BlockMode bool + // Make sure data is safe in multiple goroutines. + lock sync.RWMutex + + // Allow combination of multiple data sources. + dataSources []dataSource + // Actual data is stored here. + sections map[string]*Section + + // To keep data in order. + sectionList []string + + NameMapper +} + +// newFile initializes File object with given data sources. +func newFile(dataSources []dataSource) *File { + return &File{ + BlockMode: true, + dataSources: dataSources, + sections: make(map[string]*Section), + sectionList: make([]string, 0, 10), + } +} + +func parseDataSource(source interface{}) (dataSource, error) { + switch s := source.(type) { + case string: + return sourceFile{s}, nil + case []byte: + return &sourceData{s}, nil + default: + return nil, fmt.Errorf("error parsing data source: unknown type '%s'", s) + } +} + +// Load loads and parses from INI data sources. +// Arguments can be mixed of file name with string type, or raw data in []byte. +func Load(source interface{}, others ...interface{}) (_ *File, err error) { + sources := make([]dataSource, len(others)+1) + sources[0], err = parseDataSource(source) + if err != nil { + return nil, err + } + for i := range others { + sources[i+1], err = parseDataSource(others[i]) + if err != nil { + return nil, err + } + } + f := newFile(sources) + return f, f.Reload() +} + +// Empty returns an empty file object. +func Empty() *File { + // Ignore error here, we sure our data is good. + f, _ := Load([]byte("")) + return f +} + +// NewSection creates a new section. +func (f *File) NewSection(name string) (*Section, error) { + if len(name) == 0 { + return nil, errors.New("error creating new section: empty section name") + } + + if f.BlockMode { + f.lock.Lock() + defer f.lock.Unlock() + } + + if inSlice(name, f.sectionList) { + return f.sections[name], nil + } + + f.sectionList = append(f.sectionList, name) + f.sections[name] = newSection(f, name) + return f.sections[name], nil +} + +// NewSections creates a list of sections. +func (f *File) NewSections(names ...string) (err error) { + for _, name := range names { + if _, err = f.NewSection(name); err != nil { + return err + } + } + return nil +} + +// GetSection returns section by given name. +func (f *File) GetSection(name string) (*Section, error) { + if len(name) == 0 { + name = DEFAULT_SECTION + } + + if f.BlockMode { + f.lock.RLock() + defer f.lock.RUnlock() + } + + sec := f.sections[name] + if sec == nil { + return nil, fmt.Errorf("error when getting section: section '%s' not exists", name) + } + return sec, nil +} + +// Section assumes named section exists and returns a zero-value when not. +func (f *File) Section(name string) *Section { + sec, err := f.GetSection(name) + if err != nil { + // Note: It's OK here because the only possible error is empty section name, + // but if it's empty, this piece of code won't be executed. + sec, _ = f.NewSection(name) + return sec + } + return sec +} + +// Section returns list of Section. +func (f *File) Sections() []*Section { + sections := make([]*Section, len(f.sectionList)) + for i := range f.sectionList { + sections[i] = f.Section(f.sectionList[i]) + } + return sections +} + +// SectionStrings returns list of section names. +func (f *File) SectionStrings() []string { + list := make([]string, len(f.sectionList)) + copy(list, f.sectionList) + return list +} + +// DeleteSection deletes a section. +func (f *File) DeleteSection(name string) { + if f.BlockMode { + f.lock.Lock() + defer f.lock.Unlock() + } + + if len(name) == 0 { + name = DEFAULT_SECTION + } + + for i, s := range f.sectionList { + if s == name { + f.sectionList = append(f.sectionList[:i], f.sectionList[i+1:]...) + delete(f.sections, name) + return + } + } +} + +func cutComment(str string) string { + i := strings.Index(str, "#") + if i == -1 { + return str + } + return str[:i] +} + +func checkMultipleLines(buf *bufio.Reader, line, val, valQuote string) (string, error) { + isEnd := false + for { + next, err := buf.ReadString('\n') + if err != nil { + if err != io.EOF { + return "", err + } + isEnd = true + } + pos := strings.LastIndex(next, valQuote) + if pos > -1 { + val += next[:pos] + break + } + val += next + if isEnd { + return "", fmt.Errorf("error parsing line: missing closing key quote from '%s' to '%s'", line, next) + } + } + return val, nil +} + +func checkContinuationLines(buf *bufio.Reader, val string) (string, bool, error) { + isEnd := false + for { + valLen := len(val) + if valLen == 0 || val[valLen-1] != '\\' { + break + } + val = val[:valLen-1] + + next, err := buf.ReadString('\n') + if err != nil { + if err != io.EOF { + return "", isEnd, err + } + isEnd = true + } + + next = strings.TrimSpace(next) + if len(next) == 0 { + break + } + val += next + } + return val, isEnd, nil +} + +// parse parses data through an io.Reader. +func (f *File) parse(reader io.Reader) error { + buf := bufio.NewReader(reader) + + // Handle BOM-UTF8. + // http://en.wikipedia.org/wiki/Byte_order_mark#Representations_of_byte_order_marks_by_encoding + mask, err := buf.Peek(3) + if err == nil && len(mask) >= 3 && mask[0] == 239 && mask[1] == 187 && mask[2] == 191 { + buf.Read(mask) + } + + count := 1 + comments := "" + isEnd := false + + section, err := f.NewSection(DEFAULT_SECTION) + if err != nil { + return err + } + + for { + line, err := buf.ReadString('\n') + line = strings.TrimSpace(line) + length := len(line) + + // Check error and ignore io.EOF just for a moment. + if err != nil { + if err != io.EOF { + return fmt.Errorf("error reading next line: %v", err) + } + // The last line of file could be an empty line. + if length == 0 { + break + } + isEnd = true + } + + // Skip empty lines. + if length == 0 { + continue + } + + switch { + case line[0] == '#' || line[0] == ';': // Comments. + if len(comments) == 0 { + comments = line + } else { + comments += LineBreak + line + } + continue + case line[0] == '[' && line[length-1] == ']': // New sction. + section, err = f.NewSection(strings.TrimSpace(line[1 : length-1])) + if err != nil { + return err + } + + if len(comments) > 0 { + section.Comment = comments + comments = "" + } + // Reset counter. + count = 1 + continue + } + + // Other possibilities. + var ( + i int + keyQuote string + kname string + valQuote string + val string + ) + + // Key name surrounded by quotes. + if line[0] == '"' { + if length > 6 && line[0:3] == `"""` { + keyQuote = `"""` + } else { + keyQuote = `"` + } + } else if line[0] == '`' { + keyQuote = "`" + } + if len(keyQuote) > 0 { + qLen := len(keyQuote) + pos := strings.Index(line[qLen:], keyQuote) + if pos == -1 { + return fmt.Errorf("error parsing line: missing closing key quote: %s", line) + } + pos = pos + qLen + i = strings.IndexAny(line[pos:], "=:") + if i < 0 { + return fmt.Errorf("error parsing line: key-value delimiter not found: %s", line) + } else if i == pos { + return fmt.Errorf("error parsing line: key is empty: %s", line) + } + i = i + pos + kname = line[qLen:pos] // Just keep spaces inside quotes. + } else { + i = strings.IndexAny(line, "=:") + if i < 0 { + return fmt.Errorf("error parsing line: key-value delimiter not found: %s", line) + } else if i == 0 { + return fmt.Errorf("error parsing line: key is empty: %s", line) + } + kname = strings.TrimSpace(line[0:i]) + } + + isAutoIncr := false + // Auto increment. + if kname == "-" { + isAutoIncr = true + kname = "#" + fmt.Sprint(count) + count++ + } + + lineRight := strings.TrimSpace(line[i+1:]) + lineRightLength := len(lineRight) + firstChar := "" + if lineRightLength >= 2 { + firstChar = lineRight[0:1] + } + if firstChar == "`" { + valQuote = "`" + } else if firstChar == `"` { + if lineRightLength >= 3 && lineRight[0:3] == `"""` { + valQuote = `"""` + } else { + valQuote = `"` + } + } else if firstChar == `'` { + valQuote = `'` + } + + if len(valQuote) > 0 { + qLen := len(valQuote) + pos := strings.LastIndex(lineRight[qLen:], valQuote) + // For multiple-line value check. + if pos == -1 { + if valQuote == `"` || valQuote == `'` { + return fmt.Errorf("error parsing line: single quote does not allow multiple-line value: %s", line) + } + + val = lineRight[qLen:] + "\n" + val, err = checkMultipleLines(buf, line, val, valQuote) + if err != nil { + return err + } + } else { + val = lineRight[qLen : pos+qLen] + } + } else { + val = strings.TrimSpace(cutComment(lineRight)) + val, isEnd, err = checkContinuationLines(buf, val) + if err != nil { + return err + } + } + + k, err := section.NewKey(kname, val) + if err != nil { + return err + } + k.isAutoIncr = isAutoIncr + if len(comments) > 0 { + k.Comment = comments + comments = "" + } + + if isEnd { + break + } + } + return nil +} + +func (f *File) reload(s dataSource) error { + r, err := s.ReadCloser() + if err != nil { + return err + } + defer r.Close() + + return f.parse(r) +} + +// Reload reloads and parses all data sources. +func (f *File) Reload() (err error) { + for _, s := range f.dataSources { + if err = f.reload(s); err != nil { + return err + } + } + return nil +} + +// Append appends one or more data sources and reloads automatically. +func (f *File) Append(source interface{}, others ...interface{}) error { + ds, err := parseDataSource(source) + if err != nil { + return err + } + f.dataSources = append(f.dataSources, ds) + for _, s := range others { + ds, err = parseDataSource(s) + if err != nil { + return err + } + f.dataSources = append(f.dataSources, ds) + } + return f.Reload() +} + +// WriteToIndent writes file content into io.Writer with given value indention. +func (f *File) WriteToIndent(w io.Writer, indent string) (n int64, err error) { + equalSign := "=" + if PrettyFormat { + equalSign = " = " + } + + // Use buffer to make sure target is safe until finish encoding. + buf := bytes.NewBuffer(nil) + for i, sname := range f.sectionList { + sec := f.Section(sname) + if len(sec.Comment) > 0 { + if sec.Comment[0] != '#' && sec.Comment[0] != ';' { + sec.Comment = "; " + sec.Comment + } + if _, err = buf.WriteString(sec.Comment + LineBreak); err != nil { + return 0, err + } + } + + if i > 0 { + if _, err = buf.WriteString("[" + sname + "]" + LineBreak); err != nil { + return 0, err + } + } else { + // Write nothing if default section is empty. + if len(sec.keyList) == 0 { + continue + } + } + + for _, kname := range sec.keyList { + key := sec.Key(kname) + if len(key.Comment) > 0 { + if len(indent) > 0 && sname != DEFAULT_SECTION { + buf.WriteString(indent) + } + if key.Comment[0] != '#' && key.Comment[0] != ';' { + key.Comment = "; " + key.Comment + } + if _, err = buf.WriteString(key.Comment + LineBreak); err != nil { + return 0, err + } + } + + if len(indent) > 0 && sname != DEFAULT_SECTION { + buf.WriteString(indent) + } + + switch { + case key.isAutoIncr: + kname = "-" + case strings.Contains(kname, "`") || strings.Contains(kname, `"`): + kname = `"""` + kname + `"""` + case strings.Contains(kname, `=`) || strings.Contains(kname, `:`): + kname = "`" + kname + "`" + } + + val := key.value + // In case key value contains "\n", "`" or "\"". + if strings.Contains(val, "\n") || strings.Contains(val, "`") || strings.Contains(val, `"`) || + strings.Contains(val, "#") { + val = `"""` + val + `"""` + } + if _, err = buf.WriteString(kname + equalSign + val + LineBreak); err != nil { + return 0, err + } + } + + // Put a line between sections. + if _, err = buf.WriteString(LineBreak); err != nil { + return 0, err + } + } + + return buf.WriteTo(w) +} + +// WriteTo writes file content into io.Writer. +func (f *File) WriteTo(w io.Writer) (int64, error) { + return f.WriteToIndent(w, "") +} + +// SaveToIndent writes content to file system with given value indention. +func (f *File) SaveToIndent(filename, indent string) error { + // Note: Because we are truncating with os.Create, + // so it's safer to save to a temporary file location and rename afte done. + tmpPath := filename + "." + strconv.Itoa(time.Now().Nanosecond()) + ".tmp" + defer os.Remove(tmpPath) + + fw, err := os.Create(tmpPath) + if err != nil { + return err + } + + if _, err = f.WriteToIndent(fw, indent); err != nil { + fw.Close() + return err + } + fw.Close() + + // Remove old file and rename the new one. + os.Remove(filename) + return os.Rename(tmpPath, filename) +} + +// SaveTo writes content to file system. +func (f *File) SaveTo(filename string) error { + return f.SaveToIndent(filename, "") +} diff --git a/Godeps/_workspace/src/github.com/go-ini/ini/ini_test.go b/Godeps/_workspace/src/github.com/go-ini/ini/ini_test.go new file mode 100644 index 00000000000..82ff36dd236 --- /dev/null +++ b/Godeps/_workspace/src/github.com/go-ini/ini/ini_test.go @@ -0,0 +1,512 @@ +// Copyright 2014 Unknwon +// +// Licensed under the Apache License, Version 2.0 (the "License"): you may +// not use this file except in compliance with the License. You may obtain +// a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +// License for the specific language governing permissions and limitations +// under the License. + +package ini + +import ( + "fmt" + "strings" + "testing" + "time" + + . "github.com/smartystreets/goconvey/convey" +) + +func Test_Version(t *testing.T) { + Convey("Get version", t, func() { + So(Version(), ShouldEqual, _VERSION) + }) +} + +const _CONF_DATA = ` +; Package name +NAME = ini +; Package version +VERSION = v1 +; Package import path +IMPORT_PATH = gopkg.in/%(NAME)s.%(VERSION)s + +# Information about package author +# Bio can be written in multiple lines. +[author] +NAME = Unknwon # Succeeding comment +E-MAIL = fake@localhost +GITHUB = https://github.com/%(NAME)s +BIO = """Gopher. +Coding addict. +Good man. +""" # Succeeding comment + +[package] +CLONE_URL = https://%(IMPORT_PATH)s + +[package.sub] +UNUSED_KEY = should be deleted + +[features] +-: Support read/write comments of keys and sections +-: Support auto-increment of key names +-: Support load multiple files to overwrite key values + +[types] +STRING = str +BOOL = true +BOOL_FALSE = false +FLOAT64 = 1.25 +INT = 10 +TIME = 2015-01-01T20:17:05Z +DURATION = 2h45m +UINT = 3 + +[array] +STRINGS = en, zh, de +FLOAT64S = 1.1, 2.2, 3.3 +INTS = 1, 2, 3 +UINTS = 1, 2, 3 +TIMES = 2015-01-01T20:17:05Z,2015-01-01T20:17:05Z,2015-01-01T20:17:05Z + +[note] +empty_lines = next line is empty\ + +[advance] +value with quotes = "some value" +value quote2 again = 'some value' +true = """"2+3=5"""" +"1+1=2" = true +"""6+1=7""" = true +"""` + "`" + `5+5` + "`" + `""" = 10 +""""6+6"""" = 12 +` + "`" + `7-2=4` + "`" + ` = false +ADDRESS = ` + "`" + `404 road, +NotFound, State, 50000` + "`" + ` + +two_lines = how about \ + continuation lines? +lots_of_lines = 1 \ + 2 \ + 3 \ + 4 \ +` + +func Test_Load(t *testing.T) { + Convey("Load from data sources", t, func() { + + Convey("Load with empty data", func() { + So(Empty(), ShouldNotBeNil) + }) + + Convey("Load with multiple data sources", func() { + cfg, err := Load([]byte(_CONF_DATA), "testdata/conf.ini") + So(err, ShouldBeNil) + So(cfg, ShouldNotBeNil) + }) + }) + + Convey("Bad load process", t, func() { + + Convey("Load from invalid data sources", func() { + _, err := Load(_CONF_DATA) + So(err, ShouldNotBeNil) + + _, err = Load("testdata/404.ini") + So(err, ShouldNotBeNil) + + _, err = Load(1) + So(err, ShouldNotBeNil) + + _, err = Load([]byte(""), 1) + So(err, ShouldNotBeNil) + }) + + Convey("Load with empty section name", func() { + _, err := Load([]byte("[]")) + So(err, ShouldNotBeNil) + }) + + Convey("Load with bad keys", func() { + _, err := Load([]byte(`"""name`)) + So(err, ShouldNotBeNil) + + _, err = Load([]byte(`"""name"""`)) + So(err, ShouldNotBeNil) + + _, err = Load([]byte(`""=1`)) + So(err, ShouldNotBeNil) + + _, err = Load([]byte(`=`)) + So(err, ShouldNotBeNil) + + _, err = Load([]byte(`name`)) + So(err, ShouldNotBeNil) + }) + + Convey("Load with bad values", func() { + _, err := Load([]byte(`name="""Unknwon`)) + So(err, ShouldNotBeNil) + + _, err = Load([]byte(`key = "value`)) + So(err, ShouldNotBeNil) + }) + }) +} + +func Test_Values(t *testing.T) { + Convey("Test getting and setting values", t, func() { + cfg, err := Load([]byte(_CONF_DATA), "testdata/conf.ini") + So(err, ShouldBeNil) + So(cfg, ShouldNotBeNil) + + Convey("Get values in default section", func() { + sec := cfg.Section("") + So(sec, ShouldNotBeNil) + So(sec.Key("NAME").Value(), ShouldEqual, "ini") + So(sec.Key("NAME").String(), ShouldEqual, "ini") + So(sec.Key("NAME").Validate(func(in string) string { + return in + }), ShouldEqual, "ini") + So(sec.Key("NAME").Comment, ShouldEqual, "; Package name") + So(sec.Key("IMPORT_PATH").String(), ShouldEqual, "gopkg.in/ini.v1") + }) + + Convey("Get values in non-default section", func() { + sec := cfg.Section("author") + So(sec, ShouldNotBeNil) + So(sec.Key("NAME").String(), ShouldEqual, "Unknwon") + So(sec.Key("GITHUB").String(), ShouldEqual, "https://github.com/Unknwon") + + sec = cfg.Section("package") + So(sec, ShouldNotBeNil) + So(sec.Key("CLONE_URL").String(), ShouldEqual, "https://gopkg.in/ini.v1") + }) + + Convey("Get auto-increment key names", func() { + keys := cfg.Section("features").Keys() + for i, k := range keys { + So(k.Name(), ShouldEqual, fmt.Sprintf("#%d", i+1)) + } + }) + + Convey("Get overwrite value", func() { + So(cfg.Section("author").Key("E-MAIL").String(), ShouldEqual, "u@gogs.io") + }) + + Convey("Get sections", func() { + sections := cfg.Sections() + for i, name := range []string{DEFAULT_SECTION, "author", "package", "package.sub", "features", "types", "array", "note", "advance"} { + So(sections[i].Name(), ShouldEqual, name) + } + }) + + Convey("Get parent section value", func() { + So(cfg.Section("package.sub").Key("CLONE_URL").String(), ShouldEqual, "https://gopkg.in/ini.v1") + }) + + Convey("Get multiple line value", func() { + So(cfg.Section("author").Key("BIO").String(), ShouldEqual, "Gopher.\nCoding addict.\nGood man.\n") + }) + + Convey("Get values with type", func() { + sec := cfg.Section("types") + v1, err := sec.Key("BOOL").Bool() + So(err, ShouldBeNil) + So(v1, ShouldBeTrue) + + v1, err = sec.Key("BOOL_FALSE").Bool() + So(err, ShouldBeNil) + So(v1, ShouldBeFalse) + + v2, err := sec.Key("FLOAT64").Float64() + So(err, ShouldBeNil) + So(v2, ShouldEqual, 1.25) + + v3, err := sec.Key("INT").Int() + So(err, ShouldBeNil) + So(v3, ShouldEqual, 10) + + v4, err := sec.Key("INT").Int64() + So(err, ShouldBeNil) + So(v4, ShouldEqual, 10) + + v5, err := sec.Key("UINT").Uint() + So(err, ShouldBeNil) + So(v5, ShouldEqual, 3) + + v6, err := sec.Key("UINT").Uint64() + So(err, ShouldBeNil) + So(v6, ShouldEqual, 3) + + t, err := time.Parse(time.RFC3339, "2015-01-01T20:17:05Z") + So(err, ShouldBeNil) + v7, err := sec.Key("TIME").Time() + So(err, ShouldBeNil) + So(v7.String(), ShouldEqual, t.String()) + + Convey("Must get values with type", func() { + So(sec.Key("STRING").MustString("404"), ShouldEqual, "str") + So(sec.Key("BOOL").MustBool(), ShouldBeTrue) + So(sec.Key("FLOAT64").MustFloat64(), ShouldEqual, 1.25) + So(sec.Key("INT").MustInt(), ShouldEqual, 10) + So(sec.Key("INT").MustInt64(), ShouldEqual, 10) + So(sec.Key("UINT").MustUint(), ShouldEqual, 3) + So(sec.Key("UINT").MustUint64(), ShouldEqual, 3) + So(sec.Key("TIME").MustTime().String(), ShouldEqual, t.String()) + + dur, err := time.ParseDuration("2h45m") + So(err, ShouldBeNil) + So(sec.Key("DURATION").MustDuration().Seconds(), ShouldEqual, dur.Seconds()) + + Convey("Must get values with default value", func() { + So(sec.Key("STRING_404").MustString("404"), ShouldEqual, "404") + So(sec.Key("BOOL_404").MustBool(true), ShouldBeTrue) + So(sec.Key("FLOAT64_404").MustFloat64(2.5), ShouldEqual, 2.5) + So(sec.Key("INT_404").MustInt(15), ShouldEqual, 15) + So(sec.Key("INT_404").MustInt64(15), ShouldEqual, 15) + So(sec.Key("UINT_404").MustUint(6), ShouldEqual, 6) + So(sec.Key("UINT_404").MustUint64(6), ShouldEqual, 6) + + t, err := time.Parse(time.RFC3339, "2014-01-01T20:17:05Z") + So(err, ShouldBeNil) + So(sec.Key("TIME_404").MustTime(t).String(), ShouldEqual, t.String()) + + So(sec.Key("DURATION_404").MustDuration(dur).Seconds(), ShouldEqual, dur.Seconds()) + }) + }) + }) + + Convey("Get value with candidates", func() { + sec := cfg.Section("types") + So(sec.Key("STRING").In("", []string{"str", "arr", "types"}), ShouldEqual, "str") + So(sec.Key("FLOAT64").InFloat64(0, []float64{1.25, 2.5, 3.75}), ShouldEqual, 1.25) + So(sec.Key("INT").InInt(0, []int{10, 20, 30}), ShouldEqual, 10) + So(sec.Key("INT").InInt64(0, []int64{10, 20, 30}), ShouldEqual, 10) + So(sec.Key("UINT").InUint(0, []uint{3, 6, 9}), ShouldEqual, 3) + So(sec.Key("UINT").InUint64(0, []uint64{3, 6, 9}), ShouldEqual, 3) + + zt, err := time.Parse(time.RFC3339, "0001-01-01T01:00:00Z") + So(err, ShouldBeNil) + t, err := time.Parse(time.RFC3339, "2015-01-01T20:17:05Z") + So(err, ShouldBeNil) + So(sec.Key("TIME").InTime(zt, []time.Time{t, time.Now(), time.Now().Add(1 * time.Second)}).String(), ShouldEqual, t.String()) + + Convey("Get value with candidates and default value", func() { + So(sec.Key("STRING_404").In("str", []string{"str", "arr", "types"}), ShouldEqual, "str") + So(sec.Key("FLOAT64_404").InFloat64(1.25, []float64{1.25, 2.5, 3.75}), ShouldEqual, 1.25) + So(sec.Key("INT_404").InInt(10, []int{10, 20, 30}), ShouldEqual, 10) + So(sec.Key("INT64_404").InInt64(10, []int64{10, 20, 30}), ShouldEqual, 10) + So(sec.Key("UINT_404").InUint(3, []uint{3, 6, 9}), ShouldEqual, 3) + So(sec.Key("UINT_404").InUint64(3, []uint64{3, 6, 9}), ShouldEqual, 3) + So(sec.Key("TIME_404").InTime(t, []time.Time{time.Now(), time.Now(), time.Now().Add(1 * time.Second)}).String(), ShouldEqual, t.String()) + }) + }) + + Convey("Get values in range", func() { + sec := cfg.Section("types") + So(sec.Key("FLOAT64").RangeFloat64(0, 1, 2), ShouldEqual, 1.25) + So(sec.Key("INT").RangeInt(0, 10, 20), ShouldEqual, 10) + So(sec.Key("INT").RangeInt64(0, 10, 20), ShouldEqual, 10) + + minT, err := time.Parse(time.RFC3339, "0001-01-01T01:00:00Z") + So(err, ShouldBeNil) + midT, err := time.Parse(time.RFC3339, "2013-01-01T01:00:00Z") + So(err, ShouldBeNil) + maxT, err := time.Parse(time.RFC3339, "9999-01-01T01:00:00Z") + So(err, ShouldBeNil) + t, err := time.Parse(time.RFC3339, "2015-01-01T20:17:05Z") + So(err, ShouldBeNil) + So(sec.Key("TIME").RangeTime(t, minT, maxT).String(), ShouldEqual, t.String()) + + Convey("Get value in range with default value", func() { + So(sec.Key("FLOAT64").RangeFloat64(5, 0, 1), ShouldEqual, 5) + So(sec.Key("INT").RangeInt(7, 0, 5), ShouldEqual, 7) + So(sec.Key("INT").RangeInt64(7, 0, 5), ShouldEqual, 7) + So(sec.Key("TIME").RangeTime(t, minT, midT).String(), ShouldEqual, t.String()) + }) + }) + + Convey("Get values into slice", func() { + sec := cfg.Section("array") + So(strings.Join(sec.Key("STRINGS").Strings(","), ","), ShouldEqual, "en,zh,de") + So(len(sec.Key("STRINGS_404").Strings(",")), ShouldEqual, 0) + + vals1 := sec.Key("FLOAT64S").Float64s(",") + for i, v := range []float64{1.1, 2.2, 3.3} { + So(vals1[i], ShouldEqual, v) + } + + vals2 := sec.Key("INTS").Ints(",") + for i, v := range []int{1, 2, 3} { + So(vals2[i], ShouldEqual, v) + } + + vals3 := sec.Key("INTS").Int64s(",") + for i, v := range []int64{1, 2, 3} { + So(vals3[i], ShouldEqual, v) + } + + vals4 := sec.Key("UINTS").Uints(",") + for i, v := range []uint{1, 2, 3} { + So(vals4[i], ShouldEqual, v) + } + + vals5 := sec.Key("UINTS").Uint64s(",") + for i, v := range []uint64{1, 2, 3} { + So(vals5[i], ShouldEqual, v) + } + + t, err := time.Parse(time.RFC3339, "2015-01-01T20:17:05Z") + So(err, ShouldBeNil) + vals6 := sec.Key("TIMES").Times(",") + for i, v := range []time.Time{t, t, t} { + So(vals6[i].String(), ShouldEqual, v.String()) + } + }) + + Convey("Get key hash", func() { + cfg.Section("").KeysHash() + }) + + Convey("Set key value", func() { + k := cfg.Section("author").Key("NAME") + k.SetValue("无闻") + So(k.String(), ShouldEqual, "无闻") + }) + + Convey("Get key strings", func() { + So(strings.Join(cfg.Section("types").KeyStrings(), ","), ShouldEqual, "STRING,BOOL,BOOL_FALSE,FLOAT64,INT,TIME,DURATION,UINT") + }) + + Convey("Delete a key", func() { + cfg.Section("package.sub").DeleteKey("UNUSED_KEY") + _, err := cfg.Section("package.sub").GetKey("UNUSED_KEY") + So(err, ShouldNotBeNil) + }) + + Convey("Get section strings", func() { + So(strings.Join(cfg.SectionStrings(), ","), ShouldEqual, "DEFAULT,author,package,package.sub,features,types,array,note,advance") + }) + + Convey("Delete a section", func() { + cfg.DeleteSection("") + So(cfg.SectionStrings()[0], ShouldNotEqual, DEFAULT_SECTION) + }) + + Convey("Create new sections", func() { + cfg.NewSections("test", "test2") + _, err := cfg.GetSection("test") + So(err, ShouldBeNil) + _, err = cfg.GetSection("test2") + So(err, ShouldBeNil) + }) + }) + + Convey("Test getting and setting bad values", t, func() { + cfg, err := Load([]byte(_CONF_DATA), "testdata/conf.ini") + So(err, ShouldBeNil) + So(cfg, ShouldNotBeNil) + + Convey("Create new key with empty name", func() { + k, err := cfg.Section("").NewKey("", "") + So(err, ShouldNotBeNil) + So(k, ShouldBeNil) + }) + + Convey("Create new section with empty name", func() { + s, err := cfg.NewSection("") + So(err, ShouldNotBeNil) + So(s, ShouldBeNil) + }) + + Convey("Create new sections with empty name", func() { + So(cfg.NewSections(""), ShouldNotBeNil) + }) + + Convey("Get section that not exists", func() { + s, err := cfg.GetSection("404") + So(err, ShouldNotBeNil) + So(s, ShouldBeNil) + + s = cfg.Section("404") + So(s, ShouldNotBeNil) + }) + }) +} + +func Test_File_Append(t *testing.T) { + Convey("Append data sources", t, func() { + cfg, err := Load([]byte("")) + So(err, ShouldBeNil) + So(cfg, ShouldNotBeNil) + + So(cfg.Append([]byte(""), []byte("")), ShouldBeNil) + + Convey("Append bad data sources", func() { + So(cfg.Append(1), ShouldNotBeNil) + So(cfg.Append([]byte(""), 1), ShouldNotBeNil) + }) + }) +} + +func Test_File_SaveTo(t *testing.T) { + Convey("Save file", t, func() { + cfg, err := Load([]byte(_CONF_DATA), "testdata/conf.ini") + So(err, ShouldBeNil) + So(cfg, ShouldNotBeNil) + + cfg.Section("").Key("NAME").Comment = "Package name" + cfg.Section("author").Comment = `Information about package author +# Bio can be written in multiple lines.` + cfg.Section("advanced").Key("val w/ pound").SetValue("my#password") + So(cfg.SaveTo("testdata/conf_out.ini"), ShouldBeNil) + + cfg.Section("author").Key("NAME").Comment = "This is author name" + So(cfg.SaveToIndent("testdata/conf_out.ini", "\t"), ShouldBeNil) + }) +} + +func Benchmark_Key_Value(b *testing.B) { + c, _ := Load([]byte(_CONF_DATA)) + for i := 0; i < b.N; i++ { + c.Section("").Key("NAME").Value() + } +} + +func Benchmark_Key_String(b *testing.B) { + c, _ := Load([]byte(_CONF_DATA)) + for i := 0; i < b.N; i++ { + c.Section("").Key("NAME").String() + } +} + +func Benchmark_Key_Value_NonBlock(b *testing.B) { + c, _ := Load([]byte(_CONF_DATA)) + c.BlockMode = false + for i := 0; i < b.N; i++ { + c.Section("").Key("NAME").Value() + } +} + +func Benchmark_Key_String_NonBlock(b *testing.B) { + c, _ := Load([]byte(_CONF_DATA)) + c.BlockMode = false + for i := 0; i < b.N; i++ { + c.Section("").Key("NAME").String() + } +} + +func Benchmark_Key_SetValue(b *testing.B) { + c, _ := Load([]byte(_CONF_DATA)) + for i := 0; i < b.N; i++ { + c.Section("").Key("NAME").SetValue("10") + } +} diff --git a/Godeps/_workspace/src/github.com/go-ini/ini/struct.go b/Godeps/_workspace/src/github.com/go-ini/ini/struct.go new file mode 100644 index 00000000000..c1184371010 --- /dev/null +++ b/Godeps/_workspace/src/github.com/go-ini/ini/struct.go @@ -0,0 +1,350 @@ +// Copyright 2014 Unknwon +// +// Licensed under the Apache License, Version 2.0 (the "License"): you may +// not use this file except in compliance with the License. You may obtain +// a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +// License for the specific language governing permissions and limitations +// under the License. + +package ini + +import ( + "bytes" + "errors" + "fmt" + "reflect" + "time" + "unicode" +) + +// NameMapper represents a ini tag name mapper. +type NameMapper func(string) string + +// Built-in name getters. +var ( + // AllCapsUnderscore converts to format ALL_CAPS_UNDERSCORE. + AllCapsUnderscore NameMapper = func(raw string) string { + newstr := make([]rune, 0, len(raw)) + for i, chr := range raw { + if isUpper := 'A' <= chr && chr <= 'Z'; isUpper { + if i > 0 { + newstr = append(newstr, '_') + } + } + newstr = append(newstr, unicode.ToUpper(chr)) + } + return string(newstr) + } + // TitleUnderscore converts to format title_underscore. + TitleUnderscore NameMapper = func(raw string) string { + newstr := make([]rune, 0, len(raw)) + for i, chr := range raw { + if isUpper := 'A' <= chr && chr <= 'Z'; isUpper { + if i > 0 { + newstr = append(newstr, '_') + } + chr -= ('A' - 'a') + } + newstr = append(newstr, chr) + } + return string(newstr) + } +) + +func (s *Section) parseFieldName(raw, actual string) string { + if len(actual) > 0 { + return actual + } + if s.f.NameMapper != nil { + return s.f.NameMapper(raw) + } + return raw +} + +func parseDelim(actual string) string { + if len(actual) > 0 { + return actual + } + return "," +} + +var reflectTime = reflect.TypeOf(time.Now()).Kind() + +// setWithProperType sets proper value to field based on its type, +// but it does not return error for failing parsing, +// because we want to use default value that is already assigned to strcut. +func setWithProperType(t reflect.Type, key *Key, field reflect.Value, delim string) error { + switch t.Kind() { + case reflect.String: + if len(key.String()) == 0 { + return nil + } + field.SetString(key.String()) + case reflect.Bool: + boolVal, err := key.Bool() + if err != nil { + return nil + } + field.SetBool(boolVal) + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + durationVal, err := key.Duration() + if err == nil { + field.Set(reflect.ValueOf(durationVal)) + return nil + } + + intVal, err := key.Int64() + if err != nil { + return nil + } + field.SetInt(intVal) + // byte is an alias for uint8, so supporting uint8 breaks support for byte + case reflect.Uint, reflect.Uint16, reflect.Uint32, reflect.Uint64: + durationVal, err := key.Duration() + if err == nil { + field.Set(reflect.ValueOf(durationVal)) + return nil + } + + uintVal, err := key.Uint64() + if err != nil { + return nil + } + field.SetUint(uintVal) + + case reflect.Float64: + floatVal, err := key.Float64() + if err != nil { + return nil + } + field.SetFloat(floatVal) + case reflectTime: + timeVal, err := key.Time() + if err != nil { + return nil + } + field.Set(reflect.ValueOf(timeVal)) + case reflect.Slice: + vals := key.Strings(delim) + numVals := len(vals) + if numVals == 0 { + return nil + } + + sliceOf := field.Type().Elem().Kind() + + var times []time.Time + if sliceOf == reflectTime { + times = key.Times(delim) + } + + slice := reflect.MakeSlice(field.Type(), numVals, numVals) + for i := 0; i < numVals; i++ { + switch sliceOf { + case reflectTime: + slice.Index(i).Set(reflect.ValueOf(times[i])) + default: + slice.Index(i).Set(reflect.ValueOf(vals[i])) + } + } + field.Set(slice) + default: + return fmt.Errorf("unsupported type '%s'", t) + } + return nil +} + +func (s *Section) mapTo(val reflect.Value) error { + if val.Kind() == reflect.Ptr { + val = val.Elem() + } + typ := val.Type() + + for i := 0; i < typ.NumField(); i++ { + field := val.Field(i) + tpField := typ.Field(i) + + tag := tpField.Tag.Get("ini") + if tag == "-" { + continue + } + + fieldName := s.parseFieldName(tpField.Name, tag) + if len(fieldName) == 0 || !field.CanSet() { + continue + } + + isAnonymous := tpField.Type.Kind() == reflect.Ptr && tpField.Anonymous + isStruct := tpField.Type.Kind() == reflect.Struct + if isAnonymous { + field.Set(reflect.New(tpField.Type.Elem())) + } + + if isAnonymous || isStruct { + if sec, err := s.f.GetSection(fieldName); err == nil { + if err = sec.mapTo(field); err != nil { + return fmt.Errorf("error mapping field(%s): %v", fieldName, err) + } + continue + } + } + + if key, err := s.GetKey(fieldName); err == nil { + if err = setWithProperType(tpField.Type, key, field, parseDelim(tpField.Tag.Get("delim"))); err != nil { + return fmt.Errorf("error mapping field(%s): %v", fieldName, err) + } + } + } + return nil +} + +// MapTo maps section to given struct. +func (s *Section) MapTo(v interface{}) error { + typ := reflect.TypeOf(v) + val := reflect.ValueOf(v) + if typ.Kind() == reflect.Ptr { + typ = typ.Elem() + val = val.Elem() + } else { + return errors.New("cannot map to non-pointer struct") + } + + return s.mapTo(val) +} + +// MapTo maps file to given struct. +func (f *File) MapTo(v interface{}) error { + return f.Section("").MapTo(v) +} + +// MapTo maps data sources to given struct with name mapper. +func MapToWithMapper(v interface{}, mapper NameMapper, source interface{}, others ...interface{}) error { + cfg, err := Load(source, others...) + if err != nil { + return err + } + cfg.NameMapper = mapper + return cfg.MapTo(v) +} + +// MapTo maps data sources to given struct. +func MapTo(v, source interface{}, others ...interface{}) error { + return MapToWithMapper(v, nil, source, others...) +} + +// reflectWithProperType does the opposite thing with setWithProperType. +func reflectWithProperType(t reflect.Type, key *Key, field reflect.Value, delim string) error { + switch t.Kind() { + case reflect.String: + key.SetValue(field.String()) + case reflect.Bool, + reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, + reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, + reflect.Float64, + reflectTime: + key.SetValue(fmt.Sprint(field)) + case reflect.Slice: + vals := field.Slice(0, field.Len()) + if field.Len() == 0 { + return nil + } + + var buf bytes.Buffer + isTime := fmt.Sprint(field.Type()) == "[]time.Time" + for i := 0; i < field.Len(); i++ { + if isTime { + buf.WriteString(vals.Index(i).Interface().(time.Time).Format(time.RFC3339)) + } else { + buf.WriteString(fmt.Sprint(vals.Index(i))) + } + buf.WriteString(delim) + } + key.SetValue(buf.String()[:buf.Len()-1]) + default: + return fmt.Errorf("unsupported type '%s'", t) + } + return nil +} + +func (s *Section) reflectFrom(val reflect.Value) error { + if val.Kind() == reflect.Ptr { + val = val.Elem() + } + typ := val.Type() + + for i := 0; i < typ.NumField(); i++ { + field := val.Field(i) + tpField := typ.Field(i) + + tag := tpField.Tag.Get("ini") + if tag == "-" { + continue + } + + fieldName := s.parseFieldName(tpField.Name, tag) + if len(fieldName) == 0 || !field.CanSet() { + continue + } + + if (tpField.Type.Kind() == reflect.Ptr && tpField.Anonymous) || + (tpField.Type.Kind() == reflect.Struct) { + // Note: The only error here is section doesn't exist. + sec, err := s.f.GetSection(fieldName) + if err != nil { + // Note: fieldName can never be empty here, ignore error. + sec, _ = s.f.NewSection(fieldName) + } + if err = sec.reflectFrom(field); err != nil { + return fmt.Errorf("error reflecting field(%s): %v", fieldName, err) + } + continue + } + + // Note: Same reason as secion. + key, err := s.GetKey(fieldName) + if err != nil { + key, _ = s.NewKey(fieldName, "") + } + if err = reflectWithProperType(tpField.Type, key, field, parseDelim(tpField.Tag.Get("delim"))); err != nil { + return fmt.Errorf("error reflecting field(%s): %v", fieldName, err) + } + + } + return nil +} + +// ReflectFrom reflects secion from given struct. +func (s *Section) ReflectFrom(v interface{}) error { + typ := reflect.TypeOf(v) + val := reflect.ValueOf(v) + if typ.Kind() == reflect.Ptr { + typ = typ.Elem() + val = val.Elem() + } else { + return errors.New("cannot reflect from non-pointer struct") + } + + return s.reflectFrom(val) +} + +// ReflectFrom reflects file from given struct. +func (f *File) ReflectFrom(v interface{}) error { + return f.Section("").ReflectFrom(v) +} + +// ReflectFrom reflects data sources from given struct with name mapper. +func ReflectFromWithMapper(cfg *File, v interface{}, mapper NameMapper) error { + cfg.NameMapper = mapper + return cfg.ReflectFrom(v) +} + +// ReflectFrom reflects data sources from given struct. +func ReflectFrom(cfg *File, v interface{}) error { + return ReflectFromWithMapper(cfg, v, nil) +} diff --git a/Godeps/_workspace/src/github.com/go-ini/ini/struct_test.go b/Godeps/_workspace/src/github.com/go-ini/ini/struct_test.go new file mode 100644 index 00000000000..d865ad78eb7 --- /dev/null +++ b/Godeps/_workspace/src/github.com/go-ini/ini/struct_test.go @@ -0,0 +1,239 @@ +// Copyright 2014 Unknwon +// +// Licensed under the Apache License, Version 2.0 (the "License"): you may +// not use this file except in compliance with the License. You may obtain +// a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +// License for the specific language governing permissions and limitations +// under the License. + +package ini + +import ( + "strings" + "testing" + "time" + + . "github.com/smartystreets/goconvey/convey" +) + +type testNested struct { + Cities []string `delim:"|"` + Visits []time.Time + Note string + Unused int `ini:"-"` +} + +type testEmbeded struct { + GPA float64 +} + +type testStruct struct { + Name string `ini:"NAME"` + Age int + Male bool + Money float64 + Born time.Time + Time time.Duration `ini:"Duration"` + Others testNested + *testEmbeded `ini:"grade"` + Unused int `ini:"-"` + Unsigned uint +} + +const _CONF_DATA_STRUCT = ` +NAME = Unknwon +Age = 21 +Male = true +Money = 1.25 +Born = 1993-10-07T20:17:05Z +Duration = 2h45m +Unsigned = 3 + +[Others] +Cities = HangZhou|Boston +Visits = 1993-10-07T20:17:05Z, 1993-10-07T20:17:05Z +Note = Hello world! + +[grade] +GPA = 2.8 + +[foo.bar] +Here = there +When = then +` + +type unsupport struct { + Byte byte +} + +type unsupport2 struct { + Others struct { + Cities byte + } +} + +type unsupport3 struct { + Cities byte +} + +type unsupport4 struct { + *unsupport3 `ini:"Others"` +} + +type defaultValue struct { + Name string + Age int + Male bool + Money float64 + Born time.Time + Cities []string +} + +type fooBar struct { + Here, When string +} + +const _INVALID_DATA_CONF_STRUCT = ` +Name = +Age = age +Male = 123 +Money = money +Born = nil +Cities = +` + +func Test_Struct(t *testing.T) { + Convey("Map to struct", t, func() { + Convey("Map file to struct", func() { + ts := new(testStruct) + So(MapTo(ts, []byte(_CONF_DATA_STRUCT)), ShouldBeNil) + + So(ts.Name, ShouldEqual, "Unknwon") + So(ts.Age, ShouldEqual, 21) + So(ts.Male, ShouldBeTrue) + So(ts.Money, ShouldEqual, 1.25) + So(ts.Unsigned, ShouldEqual, 3) + + t, err := time.Parse(time.RFC3339, "1993-10-07T20:17:05Z") + So(err, ShouldBeNil) + So(ts.Born.String(), ShouldEqual, t.String()) + + dur, err := time.ParseDuration("2h45m") + So(err, ShouldBeNil) + So(ts.Time.Seconds(), ShouldEqual, dur.Seconds()) + + So(strings.Join(ts.Others.Cities, ","), ShouldEqual, "HangZhou,Boston") + So(ts.Others.Visits[0].String(), ShouldEqual, t.String()) + So(ts.Others.Note, ShouldEqual, "Hello world!") + So(ts.testEmbeded.GPA, ShouldEqual, 2.8) + }) + + Convey("Map section to struct", func() { + foobar := new(fooBar) + f, err := Load([]byte(_CONF_DATA_STRUCT)) + So(err, ShouldBeNil) + + So(f.Section("foo.bar").MapTo(foobar), ShouldBeNil) + So(foobar.Here, ShouldEqual, "there") + So(foobar.When, ShouldEqual, "then") + }) + + Convey("Map to non-pointer struct", func() { + cfg, err := Load([]byte(_CONF_DATA_STRUCT)) + So(err, ShouldBeNil) + So(cfg, ShouldNotBeNil) + + So(cfg.MapTo(testStruct{}), ShouldNotBeNil) + }) + + Convey("Map to unsupported type", func() { + cfg, err := Load([]byte(_CONF_DATA_STRUCT)) + So(err, ShouldBeNil) + So(cfg, ShouldNotBeNil) + + cfg.NameMapper = func(raw string) string { + if raw == "Byte" { + return "NAME" + } + return raw + } + So(cfg.MapTo(&unsupport{}), ShouldNotBeNil) + So(cfg.MapTo(&unsupport2{}), ShouldNotBeNil) + So(cfg.MapTo(&unsupport4{}), ShouldNotBeNil) + }) + + Convey("Map from invalid data source", func() { + So(MapTo(&testStruct{}, "hi"), ShouldNotBeNil) + }) + + Convey("Map to wrong types and gain default values", func() { + cfg, err := Load([]byte(_INVALID_DATA_CONF_STRUCT)) + So(err, ShouldBeNil) + + t, err := time.Parse(time.RFC3339, "1993-10-07T20:17:05Z") + So(err, ShouldBeNil) + dv := &defaultValue{"Joe", 10, true, 1.25, t, []string{"HangZhou", "Boston"}} + So(cfg.MapTo(dv), ShouldBeNil) + So(dv.Name, ShouldEqual, "Joe") + So(dv.Age, ShouldEqual, 10) + So(dv.Male, ShouldBeTrue) + So(dv.Money, ShouldEqual, 1.25) + So(dv.Born.String(), ShouldEqual, t.String()) + So(strings.Join(dv.Cities, ","), ShouldEqual, "HangZhou,Boston") + }) + }) + + Convey("Reflect from struct", t, func() { + type Embeded struct { + Dates []time.Time `delim:"|"` + Places []string + None []int + } + type Author struct { + Name string `ini:"NAME"` + Male bool + Age int + GPA float64 + NeverMind string `ini:"-"` + *Embeded `ini:"infos"` + } + a := &Author{"Unknwon", true, 21, 2.8, "", + &Embeded{ + []time.Time{time.Now(), time.Now()}, + []string{"HangZhou", "Boston"}, + []int{}, + }} + cfg := Empty() + So(ReflectFrom(cfg, a), ShouldBeNil) + cfg.SaveTo("testdata/conf_reflect.ini") + + Convey("Reflect from non-point struct", func() { + So(ReflectFrom(cfg, Author{}), ShouldNotBeNil) + }) + }) +} + +type testMapper struct { + PackageName string +} + +func Test_NameGetter(t *testing.T) { + Convey("Test name mappers", t, func() { + So(MapToWithMapper(&testMapper{}, TitleUnderscore, []byte("packag_name=ini")), ShouldBeNil) + + cfg, err := Load([]byte("PACKAGE_NAME=ini")) + So(err, ShouldBeNil) + So(cfg, ShouldNotBeNil) + + cfg.NameMapper = AllCapsUnderscore + tg := new(testMapper) + So(cfg.MapTo(tg), ShouldBeNil) + So(tg.PackageName, ShouldEqual, "ini") + }) +} diff --git a/Godeps/_workspace/src/github.com/go-ini/ini/testdata/conf.ini b/Godeps/_workspace/src/github.com/go-ini/ini/testdata/conf.ini new file mode 100644 index 00000000000..2ed0ac1d3ac --- /dev/null +++ b/Godeps/_workspace/src/github.com/go-ini/ini/testdata/conf.ini @@ -0,0 +1,2 @@ +[author] +E-MAIL = u@gogs.io \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/.gitignore b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/.gitignore new file mode 100644 index 00000000000..531fcc11c70 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/.gitignore @@ -0,0 +1,4 @@ +jpgo +jmespath-fuzz.zip +cpu.out +go-jmespath.test diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/.travis.yml b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/.travis.yml new file mode 100644 index 00000000000..1f98077570d --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/.travis.yml @@ -0,0 +1,9 @@ +language: go + +sudo: false + +go: + - 1.4 + +install: go get -v -t ./... +script: make test diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/LICENSE b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/LICENSE new file mode 100644 index 00000000000..b03310a91fd --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/LICENSE @@ -0,0 +1,13 @@ +Copyright 2015 James Saryerwinnie + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/Makefile b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/Makefile new file mode 100644 index 00000000000..ad17bf0012e --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/Makefile @@ -0,0 +1,44 @@ + +CMD = jpgo + +help: + @echo "Please use \`make ' where is one of" + @echo " test to run all the tests" + @echo " build to build the library and jp executable" + @echo " generate to run codegen" + + +generate: + go generate ./... + +build: + rm -f $(CMD) + go build ./... + rm -f cmd/$(CMD)/$(CMD) && cd cmd/$(CMD)/ && go build ./... + mv cmd/$(CMD)/$(CMD) . + +test: + go test -v ./... + +check: + go vet ./... + @echo "golint ./..." + @lint=`golint ./...`; \ + lint=`echo "$$lint" | grep -v "astnodetype_string.go" | grep -v "toktype_string.go"`; \ + echo "$$lint"; \ + if [ "$$lint" != "" ]; then exit 1; fi + +htmlc: + go test -coverprofile="/tmp/jpcov" && go tool cover -html="/tmp/jpcov" && unlink /tmp/jpcov + +buildfuzz: + go-fuzz-build github.com/jmespath/go-jmespath/fuzz + +fuzz: buildfuzz + go-fuzz -bin=./jmespath-fuzz.zip -workdir=fuzz/corpus + +bench: + go test -bench . -cpuprofile cpu.out + +pprof-cpu: + go tool pprof ./go-jmespath.test ./cpu.out diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/README.md b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/README.md new file mode 100644 index 00000000000..187ef676dc9 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/README.md @@ -0,0 +1,7 @@ +# go-jmespath - A JMESPath implementation in Go + +[![Build Status](https://img.shields.io/travis/jmespath/go-jmespath.svg)](https://travis-ci.org/jmespath/go-jmespath) + + + +See http://jmespath.org for more info. diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/api.go b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/api.go new file mode 100644 index 00000000000..67df3fc1c87 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/api.go @@ -0,0 +1,12 @@ +package jmespath + +// 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) +} diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/astnodetype_string.go b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/astnodetype_string.go new file mode 100644 index 00000000000..1cd2d239c96 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/astnodetype_string.go @@ -0,0 +1,16 @@ +// generated by stringer -type astNodeType; DO NOT EDIT + +package jmespath + +import "fmt" + +const _astNodeType_name = "ASTEmptyASTComparatorASTCurrentNodeASTExpRefASTFunctionExpressionASTFieldASTFilterProjectionASTFlattenASTIdentityASTIndexASTIndexExpressionASTKeyValPairASTLiteralASTMultiSelectHashASTMultiSelectListASTOrExpressionASTAndExpressionASTNotExpressionASTPipeASTProjectionASTSubexpressionASTSliceASTValueProjection" + +var _astNodeType_index = [...]uint16{0, 8, 21, 35, 44, 65, 73, 92, 102, 113, 121, 139, 152, 162, 180, 198, 213, 229, 245, 252, 265, 281, 289, 307} + +func (i astNodeType) String() string { + if i < 0 || i >= astNodeType(len(_astNodeType_index)-1) { + return fmt.Sprintf("astNodeType(%d)", i) + } + return _astNodeType_name[_astNodeType_index[i]:_astNodeType_index[i+1]] +} diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/compliance/basic.json b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/compliance/basic.json new file mode 100644 index 00000000000..d550e969547 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/compliance/basic.json @@ -0,0 +1,96 @@ +[{ + "given": + {"foo": {"bar": {"baz": "correct"}}}, + "cases": [ + { + "expression": "foo", + "result": {"bar": {"baz": "correct"}} + }, + { + "expression": "foo.bar", + "result": {"baz": "correct"} + }, + { + "expression": "foo.bar.baz", + "result": "correct" + }, + { + "expression": "foo\n.\nbar\n.baz", + "result": "correct" + }, + { + "expression": "foo.bar.baz.bad", + "result": null + }, + { + "expression": "foo.bar.bad", + "result": null + }, + { + "expression": "foo.bad", + "result": null + }, + { + "expression": "bad", + "result": null + }, + { + "expression": "bad.morebad.morebad", + "result": null + } + ] +}, +{ + "given": + {"foo": {"bar": ["one", "two", "three"]}}, + "cases": [ + { + "expression": "foo", + "result": {"bar": ["one", "two", "three"]} + }, + { + "expression": "foo.bar", + "result": ["one", "two", "three"] + } + ] +}, +{ + "given": ["one", "two", "three"], + "cases": [ + { + "expression": "one", + "result": null + }, + { + "expression": "two", + "result": null + }, + { + "expression": "three", + "result": null + }, + { + "expression": "one.two", + "result": null + } + ] +}, +{ + "given": + {"foo": {"1": ["one", "two", "three"], "-1": "bar"}}, + "cases": [ + { + "expression": "foo.\"1\"", + "result": ["one", "two", "three"] + }, + { + "expression": "foo.\"1\"[0]", + "result": "one" + }, + { + "expression": "foo.\"-1\"", + "result": "bar" + } + ] +} +] diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/compliance/boolean.json b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/compliance/boolean.json new file mode 100644 index 00000000000..e3fa196b14f --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/compliance/boolean.json @@ -0,0 +1,257 @@ +[ + { + "given": { + "outer": { + "foo": "foo", + "bar": "bar", + "baz": "baz" + } + }, + "cases": [ + { + "expression": "outer.foo || outer.bar", + "result": "foo" + }, + { + "expression": "outer.foo||outer.bar", + "result": "foo" + }, + { + "expression": "outer.bar || outer.baz", + "result": "bar" + }, + { + "expression": "outer.bar||outer.baz", + "result": "bar" + }, + { + "expression": "outer.bad || outer.foo", + "result": "foo" + }, + { + "expression": "outer.bad||outer.foo", + "result": "foo" + }, + { + "expression": "outer.foo || outer.bad", + "result": "foo" + }, + { + "expression": "outer.foo||outer.bad", + "result": "foo" + }, + { + "expression": "outer.bad || outer.alsobad", + "result": null + }, + { + "expression": "outer.bad||outer.alsobad", + "result": null + } + ] + }, + { + "given": { + "outer": { + "foo": "foo", + "bool": false, + "empty_list": [], + "empty_string": "" + } + }, + "cases": [ + { + "expression": "outer.empty_string || outer.foo", + "result": "foo" + }, + { + "expression": "outer.nokey || outer.bool || outer.empty_list || outer.empty_string || outer.foo", + "result": "foo" + } + ] + }, + { + "given": { + "True": true, + "False": false, + "Number": 5, + "EmptyList": [], + "Zero": 0 + }, + "cases": [ + { + "expression": "True && False", + "result": false + }, + { + "expression": "False && True", + "result": false + }, + { + "expression": "True && True", + "result": true + }, + { + "expression": "False && False", + "result": false + }, + { + "expression": "True && Number", + "result": 5 + }, + { + "expression": "Number && True", + "result": true + }, + { + "expression": "Number && False", + "result": false + }, + { + "expression": "Number && EmptyList", + "result": [] + }, + { + "expression": "Number && True", + "result": true + }, + { + "expression": "EmptyList && True", + "result": [] + }, + { + "expression": "EmptyList && False", + "result": [] + }, + { + "expression": "True || False", + "result": true + }, + { + "expression": "True || True", + "result": true + }, + { + "expression": "False || True", + "result": true + }, + { + "expression": "False || False", + "result": false + }, + { + "expression": "Number || EmptyList", + "result": 5 + }, + { + "expression": "Number || True", + "result": 5 + }, + { + "expression": "Number || True && False", + "result": 5 + }, + { + "expression": "(Number || True) && False", + "result": false + }, + { + "expression": "Number || (True && False)", + "result": 5 + }, + { + "expression": "!True", + "result": false + }, + { + "expression": "!False", + "result": true + }, + { + "expression": "!Number", + "result": false + }, + { + "expression": "!EmptyList", + "result": true + }, + { + "expression": "True && !False", + "result": true + }, + { + "expression": "True && !EmptyList", + "result": true + }, + { + "expression": "!False && !EmptyList", + "result": true + }, + { + "expression": "!(True && False)", + "result": true + }, + { + "expression": "!Zero", + "result": false + }, + { + "expression": "!!Zero", + "result": true + } + ] + }, + { + "given": { + "one": 1, + "two": 2, + "three": 3 + }, + "cases": [ + { + "expression": "one < two", + "result": true + }, + { + "expression": "one <= two", + "result": true + }, + { + "expression": "one == one", + "result": true + }, + { + "expression": "one == two", + "result": false + }, + { + "expression": "one > two", + "result": false + }, + { + "expression": "one >= two", + "result": false + }, + { + "expression": "one != two", + "result": true + }, + { + "expression": "one < two && three > one", + "result": true + }, + { + "expression": "one < two || three > one", + "result": true + }, + { + "expression": "one < two || three < one", + "result": true + }, + { + "expression": "two < one || three < one", + "result": false + } + ] + } +] diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/compliance/current.json b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/compliance/current.json new file mode 100644 index 00000000000..0c26248d079 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/compliance/current.json @@ -0,0 +1,25 @@ +[ + { + "given": { + "foo": [{"name": "a"}, {"name": "b"}], + "bar": {"baz": "qux"} + }, + "cases": [ + { + "expression": "@", + "result": { + "foo": [{"name": "a"}, {"name": "b"}], + "bar": {"baz": "qux"} + } + }, + { + "expression": "@.bar", + "result": {"baz": "qux"} + }, + { + "expression": "@.foo[0]", + "result": {"name": "a"} + } + ] + } +] diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/compliance/escape.json b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/compliance/escape.json new file mode 100644 index 00000000000..4a62d951a65 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/compliance/escape.json @@ -0,0 +1,46 @@ +[{ + "given": { + "foo.bar": "dot", + "foo bar": "space", + "foo\nbar": "newline", + "foo\"bar": "doublequote", + "c:\\\\windows\\path": "windows", + "/unix/path": "unix", + "\"\"\"": "threequotes", + "bar": {"baz": "qux"} + }, + "cases": [ + { + "expression": "\"foo.bar\"", + "result": "dot" + }, + { + "expression": "\"foo bar\"", + "result": "space" + }, + { + "expression": "\"foo\\nbar\"", + "result": "newline" + }, + { + "expression": "\"foo\\\"bar\"", + "result": "doublequote" + }, + { + "expression": "\"c:\\\\\\\\windows\\\\path\"", + "result": "windows" + }, + { + "expression": "\"/unix/path\"", + "result": "unix" + }, + { + "expression": "\"\\\"\\\"\\\"\"", + "result": "threequotes" + }, + { + "expression": "\"bar\".\"baz\"", + "result": "qux" + } + ] +}] diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/compliance/filters.json b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/compliance/filters.json new file mode 100644 index 00000000000..5b9f52b1159 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/compliance/filters.json @@ -0,0 +1,468 @@ +[ + { + "given": {"foo": [{"name": "a"}, {"name": "b"}]}, + "cases": [ + { + "comment": "Matching a literal", + "expression": "foo[?name == 'a']", + "result": [{"name": "a"}] + } + ] + }, + { + "given": {"foo": [0, 1], "bar": [2, 3]}, + "cases": [ + { + "comment": "Matching a literal", + "expression": "*[?[0] == `0`]", + "result": [[], []] + } + ] + }, + { + "given": {"foo": [{"first": "foo", "last": "bar"}, + {"first": "foo", "last": "foo"}, + {"first": "foo", "last": "baz"}]}, + "cases": [ + { + "comment": "Matching an expression", + "expression": "foo[?first == last]", + "result": [{"first": "foo", "last": "foo"}] + }, + { + "comment": "Verify projection created from filter", + "expression": "foo[?first == last].first", + "result": ["foo"] + } + ] + }, + { + "given": {"foo": [{"age": 20}, + {"age": 25}, + {"age": 30}]}, + "cases": [ + { + "comment": "Greater than with a number", + "expression": "foo[?age > `25`]", + "result": [{"age": 30}] + }, + { + "expression": "foo[?age >= `25`]", + "result": [{"age": 25}, {"age": 30}] + }, + { + "comment": "Greater than with a number", + "expression": "foo[?age > `30`]", + "result": [] + }, + { + "comment": "Greater than with a number", + "expression": "foo[?age < `25`]", + "result": [{"age": 20}] + }, + { + "comment": "Greater than with a number", + "expression": "foo[?age <= `25`]", + "result": [{"age": 20}, {"age": 25}] + }, + { + "comment": "Greater than with a number", + "expression": "foo[?age < `20`]", + "result": [] + }, + { + "expression": "foo[?age == `20`]", + "result": [{"age": 20}] + }, + { + "expression": "foo[?age != `20`]", + "result": [{"age": 25}, {"age": 30}] + } + ] + }, + { + "given": {"foo": [{"top": {"name": "a"}}, + {"top": {"name": "b"}}]}, + "cases": [ + { + "comment": "Filter with subexpression", + "expression": "foo[?top.name == 'a']", + "result": [{"top": {"name": "a"}}] + } + ] + }, + { + "given": {"foo": [{"top": {"first": "foo", "last": "bar"}}, + {"top": {"first": "foo", "last": "foo"}}, + {"top": {"first": "foo", "last": "baz"}}]}, + "cases": [ + { + "comment": "Matching an expression", + "expression": "foo[?top.first == top.last]", + "result": [{"top": {"first": "foo", "last": "foo"}}] + }, + { + "comment": "Matching a JSON array", + "expression": "foo[?top == `{\"first\": \"foo\", \"last\": \"bar\"}`]", + "result": [{"top": {"first": "foo", "last": "bar"}}] + } + ] + }, + { + "given": {"foo": [ + {"key": true}, + {"key": false}, + {"key": 0}, + {"key": 1}, + {"key": [0]}, + {"key": {"bar": [0]}}, + {"key": null}, + {"key": [1]}, + {"key": {"a":2}} + ]}, + "cases": [ + { + "expression": "foo[?key == `true`]", + "result": [{"key": true}] + }, + { + "expression": "foo[?key == `false`]", + "result": [{"key": false}] + }, + { + "expression": "foo[?key == `0`]", + "result": [{"key": 0}] + }, + { + "expression": "foo[?key == `1`]", + "result": [{"key": 1}] + }, + { + "expression": "foo[?key == `[0]`]", + "result": [{"key": [0]}] + }, + { + "expression": "foo[?key == `{\"bar\": [0]}`]", + "result": [{"key": {"bar": [0]}}] + }, + { + "expression": "foo[?key == `null`]", + "result": [{"key": null}] + }, + { + "expression": "foo[?key == `[1]`]", + "result": [{"key": [1]}] + }, + { + "expression": "foo[?key == `{\"a\":2}`]", + "result": [{"key": {"a":2}}] + }, + { + "expression": "foo[?`true` == key]", + "result": [{"key": true}] + }, + { + "expression": "foo[?`false` == key]", + "result": [{"key": false}] + }, + { + "expression": "foo[?`0` == key]", + "result": [{"key": 0}] + }, + { + "expression": "foo[?`1` == key]", + "result": [{"key": 1}] + }, + { + "expression": "foo[?`[0]` == key]", + "result": [{"key": [0]}] + }, + { + "expression": "foo[?`{\"bar\": [0]}` == key]", + "result": [{"key": {"bar": [0]}}] + }, + { + "expression": "foo[?`null` == key]", + "result": [{"key": null}] + }, + { + "expression": "foo[?`[1]` == key]", + "result": [{"key": [1]}] + }, + { + "expression": "foo[?`{\"a\":2}` == key]", + "result": [{"key": {"a":2}}] + }, + { + "expression": "foo[?key != `true`]", + "result": [{"key": false}, {"key": 0}, {"key": 1}, {"key": [0]}, + {"key": {"bar": [0]}}, {"key": null}, {"key": [1]}, {"key": {"a":2}}] + }, + { + "expression": "foo[?key != `false`]", + "result": [{"key": true}, {"key": 0}, {"key": 1}, {"key": [0]}, + {"key": {"bar": [0]}}, {"key": null}, {"key": [1]}, {"key": {"a":2}}] + }, + { + "expression": "foo[?key != `0`]", + "result": [{"key": true}, {"key": false}, {"key": 1}, {"key": [0]}, + {"key": {"bar": [0]}}, {"key": null}, {"key": [1]}, {"key": {"a":2}}] + }, + { + "expression": "foo[?key != `1`]", + "result": [{"key": true}, {"key": false}, {"key": 0}, {"key": [0]}, + {"key": {"bar": [0]}}, {"key": null}, {"key": [1]}, {"key": {"a":2}}] + }, + { + "expression": "foo[?key != `null`]", + "result": [{"key": true}, {"key": false}, {"key": 0}, {"key": 1}, {"key": [0]}, + {"key": {"bar": [0]}}, {"key": [1]}, {"key": {"a":2}}] + }, + { + "expression": "foo[?key != `[1]`]", + "result": [{"key": true}, {"key": false}, {"key": 0}, {"key": 1}, {"key": [0]}, + {"key": {"bar": [0]}}, {"key": null}, {"key": {"a":2}}] + }, + { + "expression": "foo[?key != `{\"a\":2}`]", + "result": [{"key": true}, {"key": false}, {"key": 0}, {"key": 1}, {"key": [0]}, + {"key": {"bar": [0]}}, {"key": null}, {"key": [1]}] + }, + { + "expression": "foo[?`true` != key]", + "result": [{"key": false}, {"key": 0}, {"key": 1}, {"key": [0]}, + {"key": {"bar": [0]}}, {"key": null}, {"key": [1]}, {"key": {"a":2}}] + }, + { + "expression": "foo[?`false` != key]", + "result": [{"key": true}, {"key": 0}, {"key": 1}, {"key": [0]}, + {"key": {"bar": [0]}}, {"key": null}, {"key": [1]}, {"key": {"a":2}}] + }, + { + "expression": "foo[?`0` != key]", + "result": [{"key": true}, {"key": false}, {"key": 1}, {"key": [0]}, + {"key": {"bar": [0]}}, {"key": null}, {"key": [1]}, {"key": {"a":2}}] + }, + { + "expression": "foo[?`1` != key]", + "result": [{"key": true}, {"key": false}, {"key": 0}, {"key": [0]}, + {"key": {"bar": [0]}}, {"key": null}, {"key": [1]}, {"key": {"a":2}}] + }, + { + "expression": "foo[?`null` != key]", + "result": [{"key": true}, {"key": false}, {"key": 0}, {"key": 1}, {"key": [0]}, + {"key": {"bar": [0]}}, {"key": [1]}, {"key": {"a":2}}] + }, + { + "expression": "foo[?`[1]` != key]", + "result": [{"key": true}, {"key": false}, {"key": 0}, {"key": 1}, {"key": [0]}, + {"key": {"bar": [0]}}, {"key": null}, {"key": {"a":2}}] + }, + { + "expression": "foo[?`{\"a\":2}` != key]", + "result": [{"key": true}, {"key": false}, {"key": 0}, {"key": 1}, {"key": [0]}, + {"key": {"bar": [0]}}, {"key": null}, {"key": [1]}] + } + ] + }, + { + "given": {"reservations": [ + {"instances": [ + {"foo": 1, "bar": 2}, {"foo": 1, "bar": 3}, + {"foo": 1, "bar": 2}, {"foo": 2, "bar": 1}]}]}, + "cases": [ + { + "expression": "reservations[].instances[?bar==`1`]", + "result": [[{"foo": 2, "bar": 1}]] + }, + { + "expression": "reservations[*].instances[?bar==`1`]", + "result": [[{"foo": 2, "bar": 1}]] + }, + { + "expression": "reservations[].instances[?bar==`1`][]", + "result": [{"foo": 2, "bar": 1}] + } + ] + }, + { + "given": { + "baz": "other", + "foo": [ + {"bar": 1}, {"bar": 2}, {"bar": 3}, {"bar": 4}, {"bar": 1, "baz": 2} + ] + }, + "cases": [ + { + "expression": "foo[?bar==`1`].bar[0]", + "result": [] + } + ] + }, + { + "given": { + "foo": [ + {"a": 1, "b": {"c": "x"}}, + {"a": 1, "b": {"c": "y"}}, + {"a": 1, "b": {"c": "z"}}, + {"a": 2, "b": {"c": "z"}}, + {"a": 1, "baz": 2} + ] + }, + "cases": [ + { + "expression": "foo[?a==`1`].b.c", + "result": ["x", "y", "z"] + } + ] + }, + { + "given": {"foo": [{"name": "a"}, {"name": "b"}, {"name": "c"}]}, + "cases": [ + { + "comment": "Filter with or expression", + "expression": "foo[?name == 'a' || name == 'b']", + "result": [{"name": "a"}, {"name": "b"}] + }, + { + "expression": "foo[?name == 'a' || name == 'e']", + "result": [{"name": "a"}] + }, + { + "expression": "foo[?name == 'a' || name == 'b' || name == 'c']", + "result": [{"name": "a"}, {"name": "b"}, {"name": "c"}] + } + ] + }, + { + "given": {"foo": [{"a": 1, "b": 2}, {"a": 1, "b": 3}]}, + "cases": [ + { + "comment": "Filter with and expression", + "expression": "foo[?a == `1` && b == `2`]", + "result": [{"a": 1, "b": 2}] + }, + { + "expression": "foo[?a == `1` && b == `4`]", + "result": [] + } + ] + }, + { + "given": {"foo": [{"a": 1, "b": 2, "c": 3}, {"a": 3, "b": 4}]}, + "cases": [ + { + "comment": "Filter with Or and And expressions", + "expression": "foo[?c == `3` || a == `1` && b == `4`]", + "result": [{"a": 1, "b": 2, "c": 3}] + }, + { + "expression": "foo[?b == `2` || a == `3` && b == `4`]", + "result": [{"a": 1, "b": 2, "c": 3}, {"a": 3, "b": 4}] + }, + { + "expression": "foo[?a == `3` && b == `4` || b == `2`]", + "result": [{"a": 1, "b": 2, "c": 3}, {"a": 3, "b": 4}] + }, + { + "expression": "foo[?(a == `3` && b == `4`) || b == `2`]", + "result": [{"a": 1, "b": 2, "c": 3}, {"a": 3, "b": 4}] + }, + { + "expression": "foo[?((a == `3` && b == `4`)) || b == `2`]", + "result": [{"a": 1, "b": 2, "c": 3}, {"a": 3, "b": 4}] + }, + { + "expression": "foo[?a == `3` && (b == `4` || b == `2`)]", + "result": [{"a": 3, "b": 4}] + }, + { + "expression": "foo[?a == `3` && ((b == `4` || b == `2`))]", + "result": [{"a": 3, "b": 4}] + } + ] + }, + { + "given": {"foo": [{"a": 1, "b": 2, "c": 3}, {"a": 3, "b": 4}]}, + "cases": [ + { + "comment": "Verify precedence of or/and expressions", + "expression": "foo[?a == `1` || b ==`2` && c == `5`]", + "result": [{"a": 1, "b": 2, "c": 3}] + }, + { + "comment": "Parentheses can alter precedence", + "expression": "foo[?(a == `1` || b ==`2`) && c == `5`]", + "result": [] + }, + { + "comment": "Not expressions combined with and/or", + "expression": "foo[?!(a == `1` || b ==`2`)]", + "result": [{"a": 3, "b": 4}] + } + ] + }, + { + "given": { + "foo": [ + {"key": true}, + {"key": false}, + {"key": []}, + {"key": {}}, + {"key": [0]}, + {"key": {"a": "b"}}, + {"key": 0}, + {"key": 1}, + {"key": null}, + {"notkey": true} + ] + }, + "cases": [ + { + "comment": "Unary filter expression", + "expression": "foo[?key]", + "result": [ + {"key": true}, {"key": [0]}, {"key": {"a": "b"}}, + {"key": 0}, {"key": 1} + ] + }, + { + "comment": "Unary not filter expression", + "expression": "foo[?!key]", + "result": [ + {"key": false}, {"key": []}, {"key": {}}, + {"key": null}, {"notkey": true} + ] + }, + { + "comment": "Equality with null RHS", + "expression": "foo[?key == `null`]", + "result": [ + {"key": null}, {"notkey": true} + ] + } + ] + }, + { + "given": { + "foo": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] + }, + "cases": [ + { + "comment": "Using @ in a filter expression", + "expression": "foo[?@ < `5`]", + "result": [0, 1, 2, 3, 4] + }, + { + "comment": "Using @ in a filter expression", + "expression": "foo[?`5` > @]", + "result": [0, 1, 2, 3, 4] + }, + { + "comment": "Using @ in a filter expression", + "expression": "foo[?@ == @]", + "result": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] + } + ] + } +] diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/compliance/functions.json b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/compliance/functions.json new file mode 100644 index 00000000000..8b8db363a2b --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/compliance/functions.json @@ -0,0 +1,825 @@ +[{ + "given": + { + "foo": -1, + "zero": 0, + "numbers": [-1, 3, 4, 5], + "array": [-1, 3, 4, 5, "a", "100"], + "strings": ["a", "b", "c"], + "decimals": [1.01, 1.2, -1.5], + "str": "Str", + "false": false, + "empty_list": [], + "empty_hash": {}, + "objects": {"foo": "bar", "bar": "baz"}, + "null_key": null + }, + "cases": [ + { + "expression": "abs(foo)", + "result": 1 + }, + { + "expression": "abs(foo)", + "result": 1 + }, + { + "expression": "abs(str)", + "error": "invalid-type" + }, + { + "expression": "abs(array[1])", + "result": 3 + }, + { + "expression": "abs(array[1])", + "result": 3 + }, + { + "expression": "abs(`false`)", + "error": "invalid-type" + }, + { + "expression": "abs(`-24`)", + "result": 24 + }, + { + "expression": "abs(`-24`)", + "result": 24 + }, + { + "expression": "abs(`1`, `2`)", + "error": "invalid-arity" + }, + { + "expression": "abs()", + "error": "invalid-arity" + }, + { + "expression": "unknown_function(`1`, `2`)", + "error": "unknown-function" + }, + { + "expression": "avg(numbers)", + "result": 2.75 + }, + { + "expression": "avg(array)", + "error": "invalid-type" + }, + { + "expression": "avg('abc')", + "error": "invalid-type" + }, + { + "expression": "avg(foo)", + "error": "invalid-type" + }, + { + "expression": "avg(@)", + "error": "invalid-type" + }, + { + "expression": "avg(strings)", + "error": "invalid-type" + }, + { + "expression": "ceil(`1.2`)", + "result": 2 + }, + { + "expression": "ceil(decimals[0])", + "result": 2 + }, + { + "expression": "ceil(decimals[1])", + "result": 2 + }, + { + "expression": "ceil(decimals[2])", + "result": -1 + }, + { + "expression": "ceil('string')", + "error": "invalid-type" + }, + { + "expression": "contains('abc', 'a')", + "result": true + }, + { + "expression": "contains('abc', 'd')", + "result": false + }, + { + "expression": "contains(`false`, 'd')", + "error": "invalid-type" + }, + { + "expression": "contains(strings, 'a')", + "result": true + }, + { + "expression": "contains(decimals, `1.2`)", + "result": true + }, + { + "expression": "contains(decimals, `false`)", + "result": false + }, + { + "expression": "ends_with(str, 'r')", + "result": true + }, + { + "expression": "ends_with(str, 'tr')", + "result": true + }, + { + "expression": "ends_with(str, 'Str')", + "result": true + }, + { + "expression": "ends_with(str, 'SStr')", + "result": false + }, + { + "expression": "ends_with(str, 'foo')", + "result": false + }, + { + "expression": "ends_with(str, `0`)", + "error": "invalid-type" + }, + { + "expression": "floor(`1.2`)", + "result": 1 + }, + { + "expression": "floor('string')", + "error": "invalid-type" + }, + { + "expression": "floor(decimals[0])", + "result": 1 + }, + { + "expression": "floor(foo)", + "result": -1 + }, + { + "expression": "floor(str)", + "error": "invalid-type" + }, + { + "expression": "length('abc')", + "result": 3 + }, + { + "expression": "length('✓foo')", + "result": 4 + }, + { + "expression": "length('')", + "result": 0 + }, + { + "expression": "length(@)", + "result": 12 + }, + { + "expression": "length(strings[0])", + "result": 1 + }, + { + "expression": "length(str)", + "result": 3 + }, + { + "expression": "length(array)", + "result": 6 + }, + { + "expression": "length(objects)", + "result": 2 + }, + { + "expression": "length(`false`)", + "error": "invalid-type" + }, + { + "expression": "length(foo)", + "error": "invalid-type" + }, + { + "expression": "length(strings[0])", + "result": 1 + }, + { + "expression": "max(numbers)", + "result": 5 + }, + { + "expression": "max(decimals)", + "result": 1.2 + }, + { + "expression": "max(strings)", + "result": "c" + }, + { + "expression": "max(abc)", + "error": "invalid-type" + }, + { + "expression": "max(array)", + "error": "invalid-type" + }, + { + "expression": "max(decimals)", + "result": 1.2 + }, + { + "expression": "max(empty_list)", + "result": null + }, + { + "expression": "merge(`{}`)", + "result": {} + }, + { + "expression": "merge(`{}`, `{}`)", + "result": {} + }, + { + "expression": "merge(`{\"a\": 1}`, `{\"b\": 2}`)", + "result": {"a": 1, "b": 2} + }, + { + "expression": "merge(`{\"a\": 1}`, `{\"a\": 2}`)", + "result": {"a": 2} + }, + { + "expression": "merge(`{\"a\": 1, \"b\": 2}`, `{\"a\": 2, \"c\": 3}`, `{\"d\": 4}`)", + "result": {"a": 2, "b": 2, "c": 3, "d": 4} + }, + { + "expression": "min(numbers)", + "result": -1 + }, + { + "expression": "min(decimals)", + "result": -1.5 + }, + { + "expression": "min(abc)", + "error": "invalid-type" + }, + { + "expression": "min(array)", + "error": "invalid-type" + }, + { + "expression": "min(empty_list)", + "result": null + }, + { + "expression": "min(decimals)", + "result": -1.5 + }, + { + "expression": "min(strings)", + "result": "a" + }, + { + "expression": "type('abc')", + "result": "string" + }, + { + "expression": "type(`1.0`)", + "result": "number" + }, + { + "expression": "type(`2`)", + "result": "number" + }, + { + "expression": "type(`true`)", + "result": "boolean" + }, + { + "expression": "type(`false`)", + "result": "boolean" + }, + { + "expression": "type(`null`)", + "result": "null" + }, + { + "expression": "type(`[0]`)", + "result": "array" + }, + { + "expression": "type(`{\"a\": \"b\"}`)", + "result": "object" + }, + { + "expression": "type(@)", + "result": "object" + }, + { + "expression": "sort(keys(objects))", + "result": ["bar", "foo"] + }, + { + "expression": "keys(foo)", + "error": "invalid-type" + }, + { + "expression": "keys(strings)", + "error": "invalid-type" + }, + { + "expression": "keys(`false`)", + "error": "invalid-type" + }, + { + "expression": "sort(values(objects))", + "result": ["bar", "baz"] + }, + { + "expression": "keys(empty_hash)", + "result": [] + }, + { + "expression": "values(foo)", + "error": "invalid-type" + }, + { + "expression": "join(', ', strings)", + "result": "a, b, c" + }, + { + "expression": "join(', ', strings)", + "result": "a, b, c" + }, + { + "expression": "join(',', `[\"a\", \"b\"]`)", + "result": "a,b" + }, + { + "expression": "join(',', `[\"a\", 0]`)", + "error": "invalid-type" + }, + { + "expression": "join(', ', str)", + "error": "invalid-type" + }, + { + "expression": "join('|', strings)", + "result": "a|b|c" + }, + { + "expression": "join(`2`, strings)", + "error": "invalid-type" + }, + { + "expression": "join('|', decimals)", + "error": "invalid-type" + }, + { + "expression": "join('|', decimals[].to_string(@))", + "result": "1.01|1.2|-1.5" + }, + { + "expression": "join('|', empty_list)", + "result": "" + }, + { + "expression": "reverse(numbers)", + "result": [5, 4, 3, -1] + }, + { + "expression": "reverse(array)", + "result": ["100", "a", 5, 4, 3, -1] + }, + { + "expression": "reverse(`[]`)", + "result": [] + }, + { + "expression": "reverse('')", + "result": "" + }, + { + "expression": "reverse('hello world')", + "result": "dlrow olleh" + }, + { + "expression": "starts_with(str, 'S')", + "result": true + }, + { + "expression": "starts_with(str, 'St')", + "result": true + }, + { + "expression": "starts_with(str, 'Str')", + "result": true + }, + { + "expression": "starts_with(str, 'String')", + "result": false + }, + { + "expression": "starts_with(str, `0`)", + "error": "invalid-type" + }, + { + "expression": "sum(numbers)", + "result": 11 + }, + { + "expression": "sum(decimals)", + "result": 0.71 + }, + { + "expression": "sum(array)", + "error": "invalid-type" + }, + { + "expression": "sum(array[].to_number(@))", + "result": 111 + }, + { + "expression": "sum(`[]`)", + "result": 0 + }, + { + "expression": "to_array('foo')", + "result": ["foo"] + }, + { + "expression": "to_array(`0`)", + "result": [0] + }, + { + "expression": "to_array(objects)", + "result": [{"foo": "bar", "bar": "baz"}] + }, + { + "expression": "to_array(`[1, 2, 3]`)", + "result": [1, 2, 3] + }, + { + "expression": "to_array(false)", + "result": [false] + }, + { + "expression": "to_string('foo')", + "result": "foo" + }, + { + "expression": "to_string(`1.2`)", + "result": "1.2" + }, + { + "expression": "to_string(`[0, 1]`)", + "result": "[0,1]" + }, + { + "expression": "to_number('1.0')", + "result": 1.0 + }, + { + "expression": "to_number('1.1')", + "result": 1.1 + }, + { + "expression": "to_number('4')", + "result": 4 + }, + { + "expression": "to_number('notanumber')", + "result": null + }, + { + "expression": "to_number(`false`)", + "result": null + }, + { + "expression": "to_number(`null`)", + "result": null + }, + { + "expression": "to_number(`[0]`)", + "result": null + }, + { + "expression": "to_number(`{\"foo\": 0}`)", + "result": null + }, + { + "expression": "\"to_string\"(`1.0`)", + "error": "syntax" + }, + { + "expression": "sort(numbers)", + "result": [-1, 3, 4, 5] + }, + { + "expression": "sort(strings)", + "result": ["a", "b", "c"] + }, + { + "expression": "sort(decimals)", + "result": [-1.5, 1.01, 1.2] + }, + { + "expression": "sort(array)", + "error": "invalid-type" + }, + { + "expression": "sort(abc)", + "error": "invalid-type" + }, + { + "expression": "sort(empty_list)", + "result": [] + }, + { + "expression": "sort(@)", + "error": "invalid-type" + }, + { + "expression": "not_null(unknown_key, str)", + "result": "Str" + }, + { + "expression": "not_null(unknown_key, foo.bar, empty_list, str)", + "result": [] + }, + { + "expression": "not_null(unknown_key, null_key, empty_list, str)", + "result": [] + }, + { + "expression": "not_null(all, expressions, are_null)", + "result": null + }, + { + "expression": "not_null()", + "error": "invalid-arity" + }, + { + "description": "function projection on single arg function", + "expression": "numbers[].to_string(@)", + "result": ["-1", "3", "4", "5"] + }, + { + "description": "function projection on single arg function", + "expression": "array[].to_number(@)", + "result": [-1, 3, 4, 5, 100] + } + ] +}, { + "given": + { + "foo": [ + {"b": "b", "a": "a"}, + {"c": "c", "b": "b"}, + {"d": "d", "c": "c"}, + {"e": "e", "d": "d"}, + {"f": "f", "e": "e"} + ] + }, + "cases": [ + { + "description": "function projection on variadic function", + "expression": "foo[].not_null(f, e, d, c, b, a)", + "result": ["b", "c", "d", "e", "f"] + } + ] +}, { + "given": + { + "people": [ + {"age": 20, "age_str": "20", "bool": true, "name": "a", "extra": "foo"}, + {"age": 40, "age_str": "40", "bool": false, "name": "b", "extra": "bar"}, + {"age": 30, "age_str": "30", "bool": true, "name": "c"}, + {"age": 50, "age_str": "50", "bool": false, "name": "d"}, + {"age": 10, "age_str": "10", "bool": true, "name": 3} + ] + }, + "cases": [ + { + "description": "sort by field expression", + "expression": "sort_by(people, &age)", + "result": [ + {"age": 10, "age_str": "10", "bool": true, "name": 3}, + {"age": 20, "age_str": "20", "bool": true, "name": "a", "extra": "foo"}, + {"age": 30, "age_str": "30", "bool": true, "name": "c"}, + {"age": 40, "age_str": "40", "bool": false, "name": "b", "extra": "bar"}, + {"age": 50, "age_str": "50", "bool": false, "name": "d"} + ] + }, + { + "expression": "sort_by(people, &age_str)", + "result": [ + {"age": 10, "age_str": "10", "bool": true, "name": 3}, + {"age": 20, "age_str": "20", "bool": true, "name": "a", "extra": "foo"}, + {"age": 30, "age_str": "30", "bool": true, "name": "c"}, + {"age": 40, "age_str": "40", "bool": false, "name": "b", "extra": "bar"}, + {"age": 50, "age_str": "50", "bool": false, "name": "d"} + ] + }, + { + "description": "sort by function expression", + "expression": "sort_by(people, &to_number(age_str))", + "result": [ + {"age": 10, "age_str": "10", "bool": true, "name": 3}, + {"age": 20, "age_str": "20", "bool": true, "name": "a", "extra": "foo"}, + {"age": 30, "age_str": "30", "bool": true, "name": "c"}, + {"age": 40, "age_str": "40", "bool": false, "name": "b", "extra": "bar"}, + {"age": 50, "age_str": "50", "bool": false, "name": "d"} + ] + }, + { + "description": "function projection on sort_by function", + "expression": "sort_by(people, &age)[].name", + "result": [3, "a", "c", "b", "d"] + }, + { + "expression": "sort_by(people, &extra)", + "error": "invalid-type" + }, + { + "expression": "sort_by(people, &bool)", + "error": "invalid-type" + }, + { + "expression": "sort_by(people, &name)", + "error": "invalid-type" + }, + { + "expression": "sort_by(people, name)", + "error": "invalid-type" + }, + { + "expression": "sort_by(people, &age)[].extra", + "result": ["foo", "bar"] + }, + { + "expression": "sort_by(`[]`, &age)", + "result": [] + }, + { + "expression": "max_by(people, &age)", + "result": {"age": 50, "age_str": "50", "bool": false, "name": "d"} + }, + { + "expression": "max_by(people, &age_str)", + "result": {"age": 50, "age_str": "50", "bool": false, "name": "d"} + }, + { + "expression": "max_by(people, &bool)", + "error": "invalid-type" + }, + { + "expression": "max_by(people, &extra)", + "error": "invalid-type" + }, + { + "expression": "max_by(people, &to_number(age_str))", + "result": {"age": 50, "age_str": "50", "bool": false, "name": "d"} + }, + { + "expression": "min_by(people, &age)", + "result": {"age": 10, "age_str": "10", "bool": true, "name": 3} + }, + { + "expression": "min_by(people, &age_str)", + "result": {"age": 10, "age_str": "10", "bool": true, "name": 3} + }, + { + "expression": "min_by(people, &bool)", + "error": "invalid-type" + }, + { + "expression": "min_by(people, &extra)", + "error": "invalid-type" + }, + { + "expression": "min_by(people, &to_number(age_str))", + "result": {"age": 10, "age_str": "10", "bool": true, "name": 3} + } + ] +}, { + "given": + { + "people": [ + {"age": 10, "order": "1"}, + {"age": 10, "order": "2"}, + {"age": 10, "order": "3"}, + {"age": 10, "order": "4"}, + {"age": 10, "order": "5"}, + {"age": 10, "order": "6"}, + {"age": 10, "order": "7"}, + {"age": 10, "order": "8"}, + {"age": 10, "order": "9"}, + {"age": 10, "order": "10"}, + {"age": 10, "order": "11"} + ] + }, + "cases": [ + { + "description": "stable sort order", + "expression": "sort_by(people, &age)", + "result": [ + {"age": 10, "order": "1"}, + {"age": 10, "order": "2"}, + {"age": 10, "order": "3"}, + {"age": 10, "order": "4"}, + {"age": 10, "order": "5"}, + {"age": 10, "order": "6"}, + {"age": 10, "order": "7"}, + {"age": 10, "order": "8"}, + {"age": 10, "order": "9"}, + {"age": 10, "order": "10"}, + {"age": 10, "order": "11"} + ] + } + ] +}, { + "given": + { + "people": [ + {"a": 10, "b": 1, "c": "z"}, + {"a": 10, "b": 2, "c": null}, + {"a": 10, "b": 3}, + {"a": 10, "b": 4, "c": "z"}, + {"a": 10, "b": 5, "c": null}, + {"a": 10, "b": 6}, + {"a": 10, "b": 7, "c": "z"}, + {"a": 10, "b": 8, "c": null}, + {"a": 10, "b": 9} + ], + "empty": [] + }, + "cases": [ + { + "expression": "map(&a, people)", + "result": [10, 10, 10, 10, 10, 10, 10, 10, 10] + }, + { + "expression": "map(&c, people)", + "result": ["z", null, null, "z", null, null, "z", null, null] + }, + { + "expression": "map(&a, badkey)", + "error": "invalid-type" + }, + { + "expression": "map(&foo, empty)", + "result": [] + } + ] +}, { + "given": { + "array": [ + { + "foo": {"bar": "yes1"} + }, + { + "foo": {"bar": "yes2"} + }, + { + "foo1": {"bar": "no"} + } + ]}, + "cases": [ + { + "expression": "map(&foo.bar, array)", + "result": ["yes1", "yes2", null] + }, + { + "expression": "map(&foo1.bar, array)", + "result": [null, null, "no"] + }, + { + "expression": "map(&foo.bar.baz, array)", + "result": [null, null, null] + } + ] +}, { + "given": { + "array": [[1, 2, 3, [4]], [5, 6, 7, [8, 9]]] + }, + "cases": [ + { + "expression": "map(&[], array)", + "result": [[1, 2, 3, 4], [5, 6, 7, 8, 9]] + } + ] +} +] diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/compliance/identifiers.json b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/compliance/identifiers.json new file mode 100644 index 00000000000..7998a41ac9d --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/compliance/identifiers.json @@ -0,0 +1,1377 @@ +[ + { + "given": { + "__L": true + }, + "cases": [ + { + "expression": "__L", + "result": true + } + ] + }, + { + "given": { + "!\r": true + }, + "cases": [ + { + "expression": "\"!\\r\"", + "result": true + } + ] + }, + { + "given": { + "Y_1623": true + }, + "cases": [ + { + "expression": "Y_1623", + "result": true + } + ] + }, + { + "given": { + "x": true + }, + "cases": [ + { + "expression": "x", + "result": true + } + ] + }, + { + "given": { + "\tF\uCebb": true + }, + "cases": [ + { + "expression": "\"\\tF\\uCebb\"", + "result": true + } + ] + }, + { + "given": { + " \t": true + }, + "cases": [ + { + "expression": "\" \\t\"", + "result": true + } + ] + }, + { + "given": { + " ": true + }, + "cases": [ + { + "expression": "\" \"", + "result": true + } + ] + }, + { + "given": { + "v2": true + }, + "cases": [ + { + "expression": "v2", + "result": true + } + ] + }, + { + "given": { + "\t": true + }, + "cases": [ + { + "expression": "\"\\t\"", + "result": true + } + ] + }, + { + "given": { + "_X": true + }, + "cases": [ + { + "expression": "_X", + "result": true + } + ] + }, + { + "given": { + "\t4\ud9da\udd15": true + }, + "cases": [ + { + "expression": "\"\\t4\\ud9da\\udd15\"", + "result": true + } + ] + }, + { + "given": { + "v24_W": true + }, + "cases": [ + { + "expression": "v24_W", + "result": true + } + ] + }, + { + "given": { + "H": true + }, + "cases": [ + { + "expression": "\"H\"", + "result": true + } + ] + }, + { + "given": { + "\f": true + }, + "cases": [ + { + "expression": "\"\\f\"", + "result": true + } + ] + }, + { + "given": { + "E4": true + }, + "cases": [ + { + "expression": "\"E4\"", + "result": true + } + ] + }, + { + "given": { + "!": true + }, + "cases": [ + { + "expression": "\"!\"", + "result": true + } + ] + }, + { + "given": { + "tM": true + }, + "cases": [ + { + "expression": "tM", + "result": true + } + ] + }, + { + "given": { + " [": true + }, + "cases": [ + { + "expression": "\" [\"", + "result": true + } + ] + }, + { + "given": { + "R!": true + }, + "cases": [ + { + "expression": "\"R!\"", + "result": true + } + ] + }, + { + "given": { + "_6W": true + }, + "cases": [ + { + "expression": "_6W", + "result": true + } + ] + }, + { + "given": { + "\uaBA1\r": true + }, + "cases": [ + { + "expression": "\"\\uaBA1\\r\"", + "result": true + } + ] + }, + { + "given": { + "tL7": true + }, + "cases": [ + { + "expression": "tL7", + "result": true + } + ] + }, + { + "given": { + "<": true + }, + "cases": [ + { + "expression": "\">\"", + "result": true + } + ] + }, + { + "given": { + "hvu": true + }, + "cases": [ + { + "expression": "hvu", + "result": true + } + ] + }, + { + "given": { + "; !": true + }, + "cases": [ + { + "expression": "\"; !\"", + "result": true + } + ] + }, + { + "given": { + "hU": true + }, + "cases": [ + { + "expression": "hU", + "result": true + } + ] + }, + { + "given": { + "!I\n\/": true + }, + "cases": [ + { + "expression": "\"!I\\n\\/\"", + "result": true + } + ] + }, + { + "given": { + "\uEEbF": true + }, + "cases": [ + { + "expression": "\"\\uEEbF\"", + "result": true + } + ] + }, + { + "given": { + "U)\t": true + }, + "cases": [ + { + "expression": "\"U)\\t\"", + "result": true + } + ] + }, + { + "given": { + "fa0_9": true + }, + "cases": [ + { + "expression": "fa0_9", + "result": true + } + ] + }, + { + "given": { + "/": true + }, + "cases": [ + { + "expression": "\"/\"", + "result": true + } + ] + }, + { + "given": { + "Gy": true + }, + "cases": [ + { + "expression": "Gy", + "result": true + } + ] + }, + { + "given": { + "\b": true + }, + "cases": [ + { + "expression": "\"\\b\"", + "result": true + } + ] + }, + { + "given": { + "<": true + }, + "cases": [ + { + "expression": "\"<\"", + "result": true + } + ] + }, + { + "given": { + "\t": true + }, + "cases": [ + { + "expression": "\"\\t\"", + "result": true + } + ] + }, + { + "given": { + "\t&\\\r": true + }, + "cases": [ + { + "expression": "\"\\t&\\\\\\r\"", + "result": true + } + ] + }, + { + "given": { + "#": true + }, + "cases": [ + { + "expression": "\"#\"", + "result": true + } + ] + }, + { + "given": { + "B__": true + }, + "cases": [ + { + "expression": "B__", + "result": true + } + ] + }, + { + "given": { + "\nS \n": true + }, + "cases": [ + { + "expression": "\"\\nS \\n\"", + "result": true + } + ] + }, + { + "given": { + "Bp": true + }, + "cases": [ + { + "expression": "Bp", + "result": true + } + ] + }, + { + "given": { + ",\t;": true + }, + "cases": [ + { + "expression": "\",\\t;\"", + "result": true + } + ] + }, + { + "given": { + "B_q": true + }, + "cases": [ + { + "expression": "B_q", + "result": true + } + ] + }, + { + "given": { + "\/+\t\n\b!Z": true + }, + "cases": [ + { + "expression": "\"\\/+\\t\\n\\b!Z\"", + "result": true + } + ] + }, + { + "given": { + "\udadd\udfc7\\ueFAc": true + }, + "cases": [ + { + "expression": "\"\udadd\udfc7\\\\ueFAc\"", + "result": true + } + ] + }, + { + "given": { + ":\f": true + }, + "cases": [ + { + "expression": "\":\\f\"", + "result": true + } + ] + }, + { + "given": { + "\/": true + }, + "cases": [ + { + "expression": "\"\\/\"", + "result": true + } + ] + }, + { + "given": { + "_BW_6Hg_Gl": true + }, + "cases": [ + { + "expression": "_BW_6Hg_Gl", + "result": true + } + ] + }, + { + "given": { + "\udbcf\udc02": true + }, + "cases": [ + { + "expression": "\"\udbcf\udc02\"", + "result": true + } + ] + }, + { + "given": { + "zs1DC": true + }, + "cases": [ + { + "expression": "zs1DC", + "result": true + } + ] + }, + { + "given": { + "__434": true + }, + "cases": [ + { + "expression": "__434", + "result": true + } + ] + }, + { + "given": { + "\udb94\udd41": true + }, + "cases": [ + { + "expression": "\"\udb94\udd41\"", + "result": true + } + ] + }, + { + "given": { + "Z_5": true + }, + "cases": [ + { + "expression": "Z_5", + "result": true + } + ] + }, + { + "given": { + "z_M_": true + }, + "cases": [ + { + "expression": "z_M_", + "result": true + } + ] + }, + { + "given": { + "YU_2": true + }, + "cases": [ + { + "expression": "YU_2", + "result": true + } + ] + }, + { + "given": { + "_0": true + }, + "cases": [ + { + "expression": "_0", + "result": true + } + ] + }, + { + "given": { + "\b+": true + }, + "cases": [ + { + "expression": "\"\\b+\"", + "result": true + } + ] + }, + { + "given": { + "\"": true + }, + "cases": [ + { + "expression": "\"\\\"\"", + "result": true + } + ] + }, + { + "given": { + "D7": true + }, + "cases": [ + { + "expression": "D7", + "result": true + } + ] + }, + { + "given": { + "_62L": true + }, + "cases": [ + { + "expression": "_62L", + "result": true + } + ] + }, + { + "given": { + "\tK\t": true + }, + "cases": [ + { + "expression": "\"\\tK\\t\"", + "result": true + } + ] + }, + { + "given": { + "\n\\\f": true + }, + "cases": [ + { + "expression": "\"\\n\\\\\\f\"", + "result": true + } + ] + }, + { + "given": { + "I_": true + }, + "cases": [ + { + "expression": "I_", + "result": true + } + ] + }, + { + "given": { + "W_a0_": true + }, + "cases": [ + { + "expression": "W_a0_", + "result": true + } + ] + }, + { + "given": { + "BQ": true + }, + "cases": [ + { + "expression": "BQ", + "result": true + } + ] + }, + { + "given": { + "\tX$\uABBb": true + }, + "cases": [ + { + "expression": "\"\\tX$\\uABBb\"", + "result": true + } + ] + }, + { + "given": { + "Z9": true + }, + "cases": [ + { + "expression": "Z9", + "result": true + } + ] + }, + { + "given": { + "\b%\"\uda38\udd0f": true + }, + "cases": [ + { + "expression": "\"\\b%\\\"\uda38\udd0f\"", + "result": true + } + ] + }, + { + "given": { + "_F": true + }, + "cases": [ + { + "expression": "_F", + "result": true + } + ] + }, + { + "given": { + "!,": true + }, + "cases": [ + { + "expression": "\"!,\"", + "result": true + } + ] + }, + { + "given": { + "\"!": true + }, + "cases": [ + { + "expression": "\"\\\"!\"", + "result": true + } + ] + }, + { + "given": { + "Hh": true + }, + "cases": [ + { + "expression": "Hh", + "result": true + } + ] + }, + { + "given": { + "&": true + }, + "cases": [ + { + "expression": "\"&\"", + "result": true + } + ] + }, + { + "given": { + "9\r\\R": true + }, + "cases": [ + { + "expression": "\"9\\r\\\\R\"", + "result": true + } + ] + }, + { + "given": { + "M_k": true + }, + "cases": [ + { + "expression": "M_k", + "result": true + } + ] + }, + { + "given": { + "!\b\n\udb06\ude52\"\"": true + }, + "cases": [ + { + "expression": "\"!\\b\\n\udb06\ude52\\\"\\\"\"", + "result": true + } + ] + }, + { + "given": { + "6": true + }, + "cases": [ + { + "expression": "\"6\"", + "result": true + } + ] + }, + { + "given": { + "_7": true + }, + "cases": [ + { + "expression": "_7", + "result": true + } + ] + }, + { + "given": { + "0": true + }, + "cases": [ + { + "expression": "\"0\"", + "result": true + } + ] + }, + { + "given": { + "\\8\\": true + }, + "cases": [ + { + "expression": "\"\\\\8\\\\\"", + "result": true + } + ] + }, + { + "given": { + "b7eo": true + }, + "cases": [ + { + "expression": "b7eo", + "result": true + } + ] + }, + { + "given": { + "xIUo9": true + }, + "cases": [ + { + "expression": "xIUo9", + "result": true + } + ] + }, + { + "given": { + "5": true + }, + "cases": [ + { + "expression": "\"5\"", + "result": true + } + ] + }, + { + "given": { + "?": true + }, + "cases": [ + { + "expression": "\"?\"", + "result": true + } + ] + }, + { + "given": { + "sU": true + }, + "cases": [ + { + "expression": "sU", + "result": true + } + ] + }, + { + "given": { + "VH2&H\\\/": true + }, + "cases": [ + { + "expression": "\"VH2&H\\\\\\/\"", + "result": true + } + ] + }, + { + "given": { + "_C": true + }, + "cases": [ + { + "expression": "_C", + "result": true + } + ] + }, + { + "given": { + "_": true + }, + "cases": [ + { + "expression": "_", + "result": true + } + ] + }, + { + "given": { + "<\t": true + }, + "cases": [ + { + "expression": "\"<\\t\"", + "result": true + } + ] + }, + { + "given": { + "\uD834\uDD1E": true + }, + "cases": [ + { + "expression": "\"\\uD834\\uDD1E\"", + "result": true + } + ] + } +] diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/compliance/indices.json b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/compliance/indices.json new file mode 100644 index 00000000000..aa03b35dd7f --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/compliance/indices.json @@ -0,0 +1,346 @@ +[{ + "given": + {"foo": {"bar": ["zero", "one", "two"]}}, + "cases": [ + { + "expression": "foo.bar[0]", + "result": "zero" + }, + { + "expression": "foo.bar[1]", + "result": "one" + }, + { + "expression": "foo.bar[2]", + "result": "two" + }, + { + "expression": "foo.bar[3]", + "result": null + }, + { + "expression": "foo.bar[-1]", + "result": "two" + }, + { + "expression": "foo.bar[-2]", + "result": "one" + }, + { + "expression": "foo.bar[-3]", + "result": "zero" + }, + { + "expression": "foo.bar[-4]", + "result": null + } + ] +}, +{ + "given": + {"foo": [{"bar": "one"}, {"bar": "two"}, {"bar": "three"}, {"notbar": "four"}]}, + "cases": [ + { + "expression": "foo.bar", + "result": null + }, + { + "expression": "foo[0].bar", + "result": "one" + }, + { + "expression": "foo[1].bar", + "result": "two" + }, + { + "expression": "foo[2].bar", + "result": "three" + }, + { + "expression": "foo[3].notbar", + "result": "four" + }, + { + "expression": "foo[3].bar", + "result": null + }, + { + "expression": "foo[0]", + "result": {"bar": "one"} + }, + { + "expression": "foo[1]", + "result": {"bar": "two"} + }, + { + "expression": "foo[2]", + "result": {"bar": "three"} + }, + { + "expression": "foo[3]", + "result": {"notbar": "four"} + }, + { + "expression": "foo[4]", + "result": null + } + ] +}, +{ + "given": [ + "one", "two", "three" + ], + "cases": [ + { + "expression": "[0]", + "result": "one" + }, + { + "expression": "[1]", + "result": "two" + }, + { + "expression": "[2]", + "result": "three" + }, + { + "expression": "[-1]", + "result": "three" + }, + { + "expression": "[-2]", + "result": "two" + }, + { + "expression": "[-3]", + "result": "one" + } + ] +}, +{ + "given": {"reservations": [ + {"instances": [{"foo": 1}, {"foo": 2}]} + ]}, + "cases": [ + { + "expression": "reservations[].instances[].foo", + "result": [1, 2] + }, + { + "expression": "reservations[].instances[].bar", + "result": [] + }, + { + "expression": "reservations[].notinstances[].foo", + "result": [] + }, + { + "expression": "reservations[].notinstances[].foo", + "result": [] + } + ] +}, +{ + "given": {"reservations": [{ + "instances": [ + {"foo": [{"bar": 1}, {"bar": 2}, {"notbar": 3}, {"bar": 4}]}, + {"foo": [{"bar": 5}, {"bar": 6}, {"notbar": [7]}, {"bar": 8}]}, + {"foo": "bar"}, + {"notfoo": [{"bar": 20}, {"bar": 21}, {"notbar": [7]}, {"bar": 22}]}, + {"bar": [{"baz": [1]}, {"baz": [2]}, {"baz": [3]}, {"baz": [4]}]}, + {"baz": [{"baz": [1, 2]}, {"baz": []}, {"baz": []}, {"baz": [3, 4]}]}, + {"qux": [{"baz": []}, {"baz": [1, 2, 3]}, {"baz": [4]}, {"baz": []}]} + ], + "otherkey": {"foo": [{"bar": 1}, {"bar": 2}, {"notbar": 3}, {"bar": 4}]} + }, { + "instances": [ + {"a": [{"bar": 1}, {"bar": 2}, {"notbar": 3}, {"bar": 4}]}, + {"b": [{"bar": 5}, {"bar": 6}, {"notbar": [7]}, {"bar": 8}]}, + {"c": "bar"}, + {"notfoo": [{"bar": 23}, {"bar": 24}, {"notbar": [7]}, {"bar": 25}]}, + {"qux": [{"baz": []}, {"baz": [1, 2, 3]}, {"baz": [4]}, {"baz": []}]} + ], + "otherkey": {"foo": [{"bar": 1}, {"bar": 2}, {"notbar": 3}, {"bar": 4}]} + } + ]}, + "cases": [ + { + "expression": "reservations[].instances[].foo[].bar", + "result": [1, 2, 4, 5, 6, 8] + }, + { + "expression": "reservations[].instances[].foo[].baz", + "result": [] + }, + { + "expression": "reservations[].instances[].notfoo[].bar", + "result": [20, 21, 22, 23, 24, 25] + }, + { + "expression": "reservations[].instances[].notfoo[].notbar", + "result": [[7], [7]] + }, + { + "expression": "reservations[].notinstances[].foo", + "result": [] + }, + { + "expression": "reservations[].instances[].foo[].notbar", + "result": [3, [7]] + }, + { + "expression": "reservations[].instances[].bar[].baz", + "result": [[1], [2], [3], [4]] + }, + { + "expression": "reservations[].instances[].baz[].baz", + "result": [[1, 2], [], [], [3, 4]] + }, + { + "expression": "reservations[].instances[].qux[].baz", + "result": [[], [1, 2, 3], [4], [], [], [1, 2, 3], [4], []] + }, + { + "expression": "reservations[].instances[].qux[].baz[]", + "result": [1, 2, 3, 4, 1, 2, 3, 4] + } + ] +}, +{ + "given": { + "foo": [ + [["one", "two"], ["three", "four"]], + [["five", "six"], ["seven", "eight"]], + [["nine"], ["ten"]] + ] + }, + "cases": [ + { + "expression": "foo[]", + "result": [["one", "two"], ["three", "four"], ["five", "six"], + ["seven", "eight"], ["nine"], ["ten"]] + }, + { + "expression": "foo[][0]", + "result": ["one", "three", "five", "seven", "nine", "ten"] + }, + { + "expression": "foo[][1]", + "result": ["two", "four", "six", "eight"] + }, + { + "expression": "foo[][0][0]", + "result": [] + }, + { + "expression": "foo[][2][2]", + "result": [] + }, + { + "expression": "foo[][0][0][100]", + "result": [] + } + ] +}, +{ + "given": { + "foo": [{ + "bar": [ + { + "qux": 2, + "baz": 1 + }, + { + "qux": 4, + "baz": 3 + } + ] + }, + { + "bar": [ + { + "qux": 6, + "baz": 5 + }, + { + "qux": 8, + "baz": 7 + } + ] + } + ] + }, + "cases": [ + { + "expression": "foo", + "result": [{"bar": [{"qux": 2, "baz": 1}, {"qux": 4, "baz": 3}]}, + {"bar": [{"qux": 6, "baz": 5}, {"qux": 8, "baz": 7}]}] + }, + { + "expression": "foo[]", + "result": [{"bar": [{"qux": 2, "baz": 1}, {"qux": 4, "baz": 3}]}, + {"bar": [{"qux": 6, "baz": 5}, {"qux": 8, "baz": 7}]}] + }, + { + "expression": "foo[].bar", + "result": [[{"qux": 2, "baz": 1}, {"qux": 4, "baz": 3}], + [{"qux": 6, "baz": 5}, {"qux": 8, "baz": 7}]] + }, + { + "expression": "foo[].bar[]", + "result": [{"qux": 2, "baz": 1}, {"qux": 4, "baz": 3}, + {"qux": 6, "baz": 5}, {"qux": 8, "baz": 7}] + }, + { + "expression": "foo[].bar[].baz", + "result": [1, 3, 5, 7] + } + ] +}, +{ + "given": { + "string": "string", + "hash": {"foo": "bar", "bar": "baz"}, + "number": 23, + "nullvalue": null + }, + "cases": [ + { + "expression": "string[]", + "result": null + }, + { + "expression": "hash[]", + "result": null + }, + { + "expression": "number[]", + "result": null + }, + { + "expression": "nullvalue[]", + "result": null + }, + { + "expression": "string[].foo", + "result": null + }, + { + "expression": "hash[].foo", + "result": null + }, + { + "expression": "number[].foo", + "result": null + }, + { + "expression": "nullvalue[].foo", + "result": null + }, + { + "expression": "nullvalue[].foo[].bar", + "result": null + } + ] +} +] diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/compliance/literal.json b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/compliance/literal.json new file mode 100644 index 00000000000..c6706b97196 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/compliance/literal.json @@ -0,0 +1,185 @@ +[ + { + "given": { + "foo": [{"name": "a"}, {"name": "b"}], + "bar": {"baz": "qux"} + }, + "cases": [ + { + "expression": "`\"foo\"`", + "result": "foo" + }, + { + "comment": "Interpret escaped unicode.", + "expression": "`\"\\u03a6\"`", + "result": "Φ" + }, + { + "expression": "`\"✓\"`", + "result": "✓" + }, + { + "expression": "`[1, 2, 3]`", + "result": [1, 2, 3] + }, + { + "expression": "`{\"a\": \"b\"}`", + "result": {"a": "b"} + }, + { + "expression": "`true`", + "result": true + }, + { + "expression": "`false`", + "result": false + }, + { + "expression": "`null`", + "result": null + }, + { + "expression": "`0`", + "result": 0 + }, + { + "expression": "`1`", + "result": 1 + }, + { + "expression": "`2`", + "result": 2 + }, + { + "expression": "`3`", + "result": 3 + }, + { + "expression": "`4`", + "result": 4 + }, + { + "expression": "`5`", + "result": 5 + }, + { + "expression": "`6`", + "result": 6 + }, + { + "expression": "`7`", + "result": 7 + }, + { + "expression": "`8`", + "result": 8 + }, + { + "expression": "`9`", + "result": 9 + }, + { + "comment": "Escaping a backtick in quotes", + "expression": "`\"foo\\`bar\"`", + "result": "foo`bar" + }, + { + "comment": "Double quote in literal", + "expression": "`\"foo\\\"bar\"`", + "result": "foo\"bar" + }, + { + "expression": "`\"1\\`\"`", + "result": "1`" + }, + { + "comment": "Multiple literal expressions with escapes", + "expression": "`\"\\\\\"`.{a:`\"b\"`}", + "result": {"a": "b"} + }, + { + "comment": "literal . identifier", + "expression": "`{\"a\": \"b\"}`.a", + "result": "b" + }, + { + "comment": "literal . identifier . identifier", + "expression": "`{\"a\": {\"b\": \"c\"}}`.a.b", + "result": "c" + }, + { + "comment": "literal . identifier bracket-expr", + "expression": "`[0, 1, 2]`[1]", + "result": 1 + } + ] + }, + { + "comment": "Literals", + "given": {"type": "object"}, + "cases": [ + { + "comment": "Literal with leading whitespace", + "expression": "` {\"foo\": true}`", + "result": {"foo": true} + }, + { + "comment": "Literal with trailing whitespace", + "expression": "`{\"foo\": true} `", + "result": {"foo": true} + }, + { + "comment": "Literal on RHS of subexpr not allowed", + "expression": "foo.`\"bar\"`", + "error": "syntax" + } + ] + }, + { + "comment": "Raw String Literals", + "given": {}, + "cases": [ + { + "expression": "'foo'", + "result": "foo" + }, + { + "expression": "' foo '", + "result": " foo " + }, + { + "expression": "'0'", + "result": "0" + }, + { + "expression": "'newline\n'", + "result": "newline\n" + }, + { + "expression": "'\n'", + "result": "\n" + }, + { + "expression": "'✓'", + "result": "✓" + }, + { + "expression": "'𝄞'", + "result": "𝄞" + }, + { + "expression": "' [foo] '", + "result": " [foo] " + }, + { + "expression": "'[foo]'", + "result": "[foo]" + }, + { + "comment": "Do not interpret escaped unicode.", + "expression": "'\\u03a6'", + "result": "\\u03a6" + } + ] + } +] diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/compliance/multiselect.json b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/compliance/multiselect.json new file mode 100644 index 00000000000..8f2a481ed7c --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/compliance/multiselect.json @@ -0,0 +1,393 @@ +[{ + "given": { + "foo": { + "bar": "bar", + "baz": "baz", + "qux": "qux", + "nested": { + "one": { + "a": "first", + "b": "second", + "c": "third" + }, + "two": { + "a": "first", + "b": "second", + "c": "third" + }, + "three": { + "a": "first", + "b": "second", + "c": {"inner": "third"} + } + } + }, + "bar": 1, + "baz": 2, + "qux\"": 3 + }, + "cases": [ + { + "expression": "foo.{bar: bar}", + "result": {"bar": "bar"} + }, + { + "expression": "foo.{\"bar\": bar}", + "result": {"bar": "bar"} + }, + { + "expression": "foo.{\"foo.bar\": bar}", + "result": {"foo.bar": "bar"} + }, + { + "expression": "foo.{bar: bar, baz: baz}", + "result": {"bar": "bar", "baz": "baz"} + }, + { + "expression": "foo.{\"bar\": bar, \"baz\": baz}", + "result": {"bar": "bar", "baz": "baz"} + }, + { + "expression": "{\"baz\": baz, \"qux\\\"\": \"qux\\\"\"}", + "result": {"baz": 2, "qux\"": 3} + }, + { + "expression": "foo.{bar:bar,baz:baz}", + "result": {"bar": "bar", "baz": "baz"} + }, + { + "expression": "foo.{bar: bar,qux: qux}", + "result": {"bar": "bar", "qux": "qux"} + }, + { + "expression": "foo.{bar: bar, noexist: noexist}", + "result": {"bar": "bar", "noexist": null} + }, + { + "expression": "foo.{noexist: noexist, alsonoexist: alsonoexist}", + "result": {"noexist": null, "alsonoexist": null} + }, + { + "expression": "foo.badkey.{nokey: nokey, alsonokey: alsonokey}", + "result": null + }, + { + "expression": "foo.nested.*.{a: a,b: b}", + "result": [{"a": "first", "b": "second"}, + {"a": "first", "b": "second"}, + {"a": "first", "b": "second"}] + }, + { + "expression": "foo.nested.three.{a: a, cinner: c.inner}", + "result": {"a": "first", "cinner": "third"} + }, + { + "expression": "foo.nested.three.{a: a, c: c.inner.bad.key}", + "result": {"a": "first", "c": null} + }, + { + "expression": "foo.{a: nested.one.a, b: nested.two.b}", + "result": {"a": "first", "b": "second"} + }, + { + "expression": "{bar: bar, baz: baz}", + "result": {"bar": 1, "baz": 2} + }, + { + "expression": "{bar: bar}", + "result": {"bar": 1} + }, + { + "expression": "{otherkey: bar}", + "result": {"otherkey": 1} + }, + { + "expression": "{no: no, exist: exist}", + "result": {"no": null, "exist": null} + }, + { + "expression": "foo.[bar]", + "result": ["bar"] + }, + { + "expression": "foo.[bar,baz]", + "result": ["bar", "baz"] + }, + { + "expression": "foo.[bar,qux]", + "result": ["bar", "qux"] + }, + { + "expression": "foo.[bar,noexist]", + "result": ["bar", null] + }, + { + "expression": "foo.[noexist,alsonoexist]", + "result": [null, null] + } + ] +}, { + "given": { + "foo": {"bar": 1, "baz": [2, 3, 4]} + }, + "cases": [ + { + "expression": "foo.{bar:bar,baz:baz}", + "result": {"bar": 1, "baz": [2, 3, 4]} + }, + { + "expression": "foo.[bar,baz[0]]", + "result": [1, 2] + }, + { + "expression": "foo.[bar,baz[1]]", + "result": [1, 3] + }, + { + "expression": "foo.[bar,baz[2]]", + "result": [1, 4] + }, + { + "expression": "foo.[bar,baz[3]]", + "result": [1, null] + }, + { + "expression": "foo.[bar[0],baz[3]]", + "result": [null, null] + } + ] +}, { + "given": { + "foo": {"bar": 1, "baz": 2} + }, + "cases": [ + { + "expression": "foo.{bar: bar, baz: baz}", + "result": {"bar": 1, "baz": 2} + }, + { + "expression": "foo.[bar,baz]", + "result": [1, 2] + } + ] +}, { + "given": { + "foo": { + "bar": {"baz": [{"common": "first", "one": 1}, + {"common": "second", "two": 2}]}, + "ignoreme": 1, + "includeme": true + } + }, + "cases": [ + { + "expression": "foo.{bar: bar.baz[1],includeme: includeme}", + "result": {"bar": {"common": "second", "two": 2}, "includeme": true} + }, + { + "expression": "foo.{\"bar.baz.two\": bar.baz[1].two, includeme: includeme}", + "result": {"bar.baz.two": 2, "includeme": true} + }, + { + "expression": "foo.[includeme, bar.baz[*].common]", + "result": [true, ["first", "second"]] + }, + { + "expression": "foo.[includeme, bar.baz[*].none]", + "result": [true, []] + }, + { + "expression": "foo.[includeme, bar.baz[].common]", + "result": [true, ["first", "second"]] + } + ] +}, { + "given": { + "reservations": [{ + "instances": [ + {"id": "id1", + "name": "first"}, + {"id": "id2", + "name": "second"} + ]}, { + "instances": [ + {"id": "id3", + "name": "third"}, + {"id": "id4", + "name": "fourth"} + ]} + ]}, + "cases": [ + { + "expression": "reservations[*].instances[*].{id: id, name: name}", + "result": [[{"id": "id1", "name": "first"}, {"id": "id2", "name": "second"}], + [{"id": "id3", "name": "third"}, {"id": "id4", "name": "fourth"}]] + }, + { + "expression": "reservations[].instances[].{id: id, name: name}", + "result": [{"id": "id1", "name": "first"}, + {"id": "id2", "name": "second"}, + {"id": "id3", "name": "third"}, + {"id": "id4", "name": "fourth"}] + }, + { + "expression": "reservations[].instances[].[id, name]", + "result": [["id1", "first"], + ["id2", "second"], + ["id3", "third"], + ["id4", "fourth"]] + } + ] +}, +{ + "given": { + "foo": [{ + "bar": [ + { + "qux": 2, + "baz": 1 + }, + { + "qux": 4, + "baz": 3 + } + ] + }, + { + "bar": [ + { + "qux": 6, + "baz": 5 + }, + { + "qux": 8, + "baz": 7 + } + ] + } + ] + }, + "cases": [ + { + "expression": "foo", + "result": [{"bar": [{"qux": 2, "baz": 1}, {"qux": 4, "baz": 3}]}, + {"bar": [{"qux": 6, "baz": 5}, {"qux": 8, "baz": 7}]}] + }, + { + "expression": "foo[]", + "result": [{"bar": [{"qux": 2, "baz": 1}, {"qux": 4, "baz": 3}]}, + {"bar": [{"qux": 6, "baz": 5}, {"qux": 8, "baz": 7}]}] + }, + { + "expression": "foo[].bar", + "result": [[{"qux": 2, "baz": 1}, {"qux": 4, "baz": 3}], + [{"qux": 6, "baz": 5}, {"qux": 8, "baz": 7}]] + }, + { + "expression": "foo[].bar[]", + "result": [{"qux": 2, "baz": 1}, {"qux": 4, "baz": 3}, + {"qux": 6, "baz": 5}, {"qux": 8, "baz": 7}] + }, + { + "expression": "foo[].bar[].[baz, qux]", + "result": [[1, 2], [3, 4], [5, 6], [7, 8]] + }, + { + "expression": "foo[].bar[].[baz]", + "result": [[1], [3], [5], [7]] + }, + { + "expression": "foo[].bar[].[baz, qux][]", + "result": [1, 2, 3, 4, 5, 6, 7, 8] + } + ] +}, +{ + "given": { + "foo": { + "baz": [ + { + "bar": "abc" + }, { + "bar": "def" + } + ], + "qux": ["zero"] + } + }, + "cases": [ + { + "expression": "foo.[baz[*].bar, qux[0]]", + "result": [["abc", "def"], "zero"] + } + ] +}, +{ + "given": { + "foo": { + "baz": [ + { + "bar": "a", + "bam": "b", + "boo": "c" + }, { + "bar": "d", + "bam": "e", + "boo": "f" + } + ], + "qux": ["zero"] + } + }, + "cases": [ + { + "expression": "foo.[baz[*].[bar, boo], qux[0]]", + "result": [[["a", "c" ], ["d", "f" ]], "zero"] + } + ] +}, +{ + "given": { + "foo": { + "baz": [ + { + "bar": "a", + "bam": "b", + "boo": "c" + }, { + "bar": "d", + "bam": "e", + "boo": "f" + } + ], + "qux": ["zero"] + } + }, + "cases": [ + { + "expression": "foo.[baz[*].not_there || baz[*].bar, qux[0]]", + "result": [["a", "d"], "zero"] + } + ] +}, +{ + "given": {"type": "object"}, + "cases": [ + { + "comment": "Nested multiselect", + "expression": "[[*],*]", + "result": [null, ["object"]] + } + ] +}, +{ + "given": [], + "cases": [ + { + "comment": "Nested multiselect", + "expression": "[[*]]", + "result": [[]] + } + ] +} +] diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/compliance/ormatch.json b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/compliance/ormatch.json new file mode 100644 index 00000000000..2127cf441ba --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/compliance/ormatch.json @@ -0,0 +1,59 @@ +[{ + "given": + {"outer": {"foo": "foo", "bar": "bar", "baz": "baz"}}, + "cases": [ + { + "expression": "outer.foo || outer.bar", + "result": "foo" + }, + { + "expression": "outer.foo||outer.bar", + "result": "foo" + }, + { + "expression": "outer.bar || outer.baz", + "result": "bar" + }, + { + "expression": "outer.bar||outer.baz", + "result": "bar" + }, + { + "expression": "outer.bad || outer.foo", + "result": "foo" + }, + { + "expression": "outer.bad||outer.foo", + "result": "foo" + }, + { + "expression": "outer.foo || outer.bad", + "result": "foo" + }, + { + "expression": "outer.foo||outer.bad", + "result": "foo" + }, + { + "expression": "outer.bad || outer.alsobad", + "result": null + }, + { + "expression": "outer.bad||outer.alsobad", + "result": null + } + ] +}, { + "given": + {"outer": {"foo": "foo", "bool": false, "empty_list": [], "empty_string": ""}}, + "cases": [ + { + "expression": "outer.empty_string || outer.foo", + "result": "foo" + }, + { + "expression": "outer.nokey || outer.bool || outer.empty_list || outer.empty_string || outer.foo", + "result": "foo" + } + ] +}] diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/compliance/pipe.json b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/compliance/pipe.json new file mode 100644 index 00000000000..b10c0a496d6 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/compliance/pipe.json @@ -0,0 +1,131 @@ +[{ + "given": { + "foo": { + "bar": { + "baz": "subkey" + }, + "other": { + "baz": "subkey" + }, + "other2": { + "baz": "subkey" + }, + "other3": { + "notbaz": ["a", "b", "c"] + }, + "other4": { + "notbaz": ["a", "b", "c"] + } + } + }, + "cases": [ + { + "expression": "foo.*.baz | [0]", + "result": "subkey" + }, + { + "expression": "foo.*.baz | [1]", + "result": "subkey" + }, + { + "expression": "foo.*.baz | [2]", + "result": "subkey" + }, + { + "expression": "foo.bar.* | [0]", + "result": "subkey" + }, + { + "expression": "foo.*.notbaz | [*]", + "result": [["a", "b", "c"], ["a", "b", "c"]] + }, + { + "expression": "{\"a\": foo.bar, \"b\": foo.other} | *.baz", + "result": ["subkey", "subkey"] + } + ] +}, { + "given": { + "foo": { + "bar": { + "baz": "one" + }, + "other": { + "baz": "two" + }, + "other2": { + "baz": "three" + }, + "other3": { + "notbaz": ["a", "b", "c"] + }, + "other4": { + "notbaz": ["d", "e", "f"] + } + } + }, + "cases": [ + { + "expression": "foo | bar", + "result": {"baz": "one"} + }, + { + "expression": "foo | bar | baz", + "result": "one" + }, + { + "expression": "foo|bar| baz", + "result": "one" + }, + { + "expression": "not_there | [0]", + "result": null + }, + { + "expression": "not_there | [0]", + "result": null + }, + { + "expression": "[foo.bar, foo.other] | [0]", + "result": {"baz": "one"} + }, + { + "expression": "{\"a\": foo.bar, \"b\": foo.other} | a", + "result": {"baz": "one"} + }, + { + "expression": "{\"a\": foo.bar, \"b\": foo.other} | b", + "result": {"baz": "two"} + }, + { + "expression": "foo.bam || foo.bar | baz", + "result": "one" + }, + { + "expression": "foo | not_there || bar", + "result": {"baz": "one"} + } + ] +}, { + "given": { + "foo": [{ + "bar": [{ + "baz": "one" + }, { + "baz": "two" + }] + }, { + "bar": [{ + "baz": "three" + }, { + "baz": "four" + }] + }] + }, + "cases": [ + { + "expression": "foo[*].bar[*] | [0][0]", + "result": {"baz": "one"} + } + ] +}] diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/compliance/slice.json b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/compliance/slice.json new file mode 100644 index 00000000000..359477278c8 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/compliance/slice.json @@ -0,0 +1,187 @@ +[{ + "given": { + "foo": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], + "bar": { + "baz": 1 + } + }, + "cases": [ + { + "expression": "bar[0:10]", + "result": null + }, + { + "expression": "foo[0:10:1]", + "result": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] + }, + { + "expression": "foo[0:10]", + "result": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] + }, + { + "expression": "foo[0:10:]", + "result": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] + }, + { + "expression": "foo[0::1]", + "result": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] + }, + { + "expression": "foo[0::]", + "result": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] + }, + { + "expression": "foo[0:]", + "result": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] + }, + { + "expression": "foo[:10:1]", + "result": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] + }, + { + "expression": "foo[::1]", + "result": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] + }, + { + "expression": "foo[:10:]", + "result": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] + }, + { + "expression": "foo[::]", + "result": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] + }, + { + "expression": "foo[:]", + "result": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] + }, + { + "expression": "foo[1:9]", + "result": [1, 2, 3, 4, 5, 6, 7, 8] + }, + { + "expression": "foo[0:10:2]", + "result": [0, 2, 4, 6, 8] + }, + { + "expression": "foo[5:]", + "result": [5, 6, 7, 8, 9] + }, + { + "expression": "foo[5::2]", + "result": [5, 7, 9] + }, + { + "expression": "foo[::2]", + "result": [0, 2, 4, 6, 8] + }, + { + "expression": "foo[::-1]", + "result": [9, 8, 7, 6, 5, 4, 3, 2, 1, 0] + }, + { + "expression": "foo[1::2]", + "result": [1, 3, 5, 7, 9] + }, + { + "expression": "foo[10:0:-1]", + "result": [9, 8, 7, 6, 5, 4, 3, 2, 1] + }, + { + "expression": "foo[10:5:-1]", + "result": [9, 8, 7, 6] + }, + { + "expression": "foo[8:2:-2]", + "result": [8, 6, 4] + }, + { + "expression": "foo[0:20]", + "result": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] + }, + { + "expression": "foo[10:-20:-1]", + "result": [9, 8, 7, 6, 5, 4, 3, 2, 1, 0] + }, + { + "expression": "foo[10:-20]", + "result": [] + }, + { + "expression": "foo[-4:-1]", + "result": [6, 7, 8] + }, + { + "expression": "foo[:-5:-1]", + "result": [9, 8, 7, 6] + }, + { + "expression": "foo[8:2:0]", + "error": "invalid-value" + }, + { + "expression": "foo[8:2:0:1]", + "error": "syntax" + }, + { + "expression": "foo[8:2&]", + "error": "syntax" + }, + { + "expression": "foo[2:a:3]", + "error": "syntax" + } + ] +}, { + "given": { + "foo": [{"a": 1}, {"a": 2}, {"a": 3}], + "bar": [{"a": {"b": 1}}, {"a": {"b": 2}}, + {"a": {"b": 3}}], + "baz": 50 + }, + "cases": [ + { + "expression": "foo[:2].a", + "result": [1, 2] + }, + { + "expression": "foo[:2].b", + "result": [] + }, + { + "expression": "foo[:2].a.b", + "result": [] + }, + { + "expression": "bar[::-1].a.b", + "result": [3, 2, 1] + }, + { + "expression": "bar[:2].a.b", + "result": [1, 2] + }, + { + "expression": "baz[:2].a", + "result": null + } + ] +}, { + "given": [{"a": 1}, {"a": 2}, {"a": 3}], + "cases": [ + { + "expression": "[:]", + "result": [{"a": 1}, {"a": 2}, {"a": 3}] + }, + { + "expression": "[:2].a", + "result": [1, 2] + }, + { + "expression": "[::-1].a", + "result": [3, 2, 1] + }, + { + "expression": "[:2].b", + "result": [] + } + ] +}] diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/compliance/syntax.json b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/compliance/syntax.json new file mode 100644 index 00000000000..003c2945887 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/compliance/syntax.json @@ -0,0 +1,616 @@ +[{ + "comment": "Dot syntax", + "given": {"type": "object"}, + "cases": [ + { + "expression": "foo.bar", + "result": null + }, + { + "expression": "foo.1", + "error": "syntax" + }, + { + "expression": "foo.-11", + "error": "syntax" + }, + { + "expression": "foo", + "result": null + }, + { + "expression": "foo.", + "error": "syntax" + }, + { + "expression": "foo.", + "error": "syntax" + }, + { + "expression": ".foo", + "error": "syntax" + }, + { + "expression": "foo..bar", + "error": "syntax" + }, + { + "expression": "foo.bar.", + "error": "syntax" + }, + { + "expression": "foo[.]", + "error": "syntax" + } + ] +}, + { + "comment": "Simple token errors", + "given": {"type": "object"}, + "cases": [ + { + "expression": ".", + "error": "syntax" + }, + { + "expression": ":", + "error": "syntax" + }, + { + "expression": ",", + "error": "syntax" + }, + { + "expression": "]", + "error": "syntax" + }, + { + "expression": "[", + "error": "syntax" + }, + { + "expression": "}", + "error": "syntax" + }, + { + "expression": "{", + "error": "syntax" + }, + { + "expression": ")", + "error": "syntax" + }, + { + "expression": "(", + "error": "syntax" + }, + { + "expression": "((&", + "error": "syntax" + }, + { + "expression": "a[", + "error": "syntax" + }, + { + "expression": "a]", + "error": "syntax" + }, + { + "expression": "a][", + "error": "syntax" + }, + { + "expression": "!", + "error": "syntax" + } + ] + }, + { + "comment": "Boolean syntax errors", + "given": {"type": "object"}, + "cases": [ + { + "expression": "![!(!", + "error": "syntax" + } + ] + }, + { + "comment": "Wildcard syntax", + "given": {"type": "object"}, + "cases": [ + { + "expression": "*", + "result": ["object"] + }, + { + "expression": "*.*", + "result": [] + }, + { + "expression": "*.foo", + "result": [] + }, + { + "expression": "*[0]", + "result": [] + }, + { + "expression": ".*", + "error": "syntax" + }, + { + "expression": "*foo", + "error": "syntax" + }, + { + "expression": "*0", + "error": "syntax" + }, + { + "expression": "foo[*]bar", + "error": "syntax" + }, + { + "expression": "foo[*]*", + "error": "syntax" + } + ] + }, + { + "comment": "Flatten syntax", + "given": {"type": "object"}, + "cases": [ + { + "expression": "[]", + "result": null + } + ] + }, + { + "comment": "Simple bracket syntax", + "given": {"type": "object"}, + "cases": [ + { + "expression": "[0]", + "result": null + }, + { + "expression": "[*]", + "result": null + }, + { + "expression": "*.[0]", + "error": "syntax" + }, + { + "expression": "*.[\"0\"]", + "result": [[null]] + }, + { + "expression": "[*].bar", + "result": null + }, + { + "expression": "[*][0]", + "result": null + }, + { + "expression": "foo[#]", + "error": "syntax" + } + ] + }, + { + "comment": "Multi-select list syntax", + "given": {"type": "object"}, + "cases": [ + { + "expression": "foo[0]", + "result": null + }, + { + "comment": "Valid multi-select of a list", + "expression": "foo[0, 1]", + "error": "syntax" + }, + { + "expression": "foo.[0]", + "error": "syntax" + }, + { + "expression": "foo.[*]", + "result": null + }, + { + "comment": "Multi-select of a list with trailing comma", + "expression": "foo[0, ]", + "error": "syntax" + }, + { + "comment": "Multi-select of a list with trailing comma and no close", + "expression": "foo[0,", + "error": "syntax" + }, + { + "comment": "Multi-select of a list with trailing comma and no close", + "expression": "foo.[a", + "error": "syntax" + }, + { + "comment": "Multi-select of a list with extra comma", + "expression": "foo[0,, 1]", + "error": "syntax" + }, + { + "comment": "Multi-select of a list using an identifier index", + "expression": "foo[abc]", + "error": "syntax" + }, + { + "comment": "Multi-select of a list using identifier indices", + "expression": "foo[abc, def]", + "error": "syntax" + }, + { + "comment": "Multi-select of a list using an identifier index", + "expression": "foo[abc, 1]", + "error": "syntax" + }, + { + "comment": "Multi-select of a list using an identifier index with trailing comma", + "expression": "foo[abc, ]", + "error": "syntax" + }, + { + "comment": "Valid multi-select of a hash using an identifier index", + "expression": "foo.[abc]", + "result": null + }, + { + "comment": "Valid multi-select of a hash", + "expression": "foo.[abc, def]", + "result": null + }, + { + "comment": "Multi-select of a hash using a numeric index", + "expression": "foo.[abc, 1]", + "error": "syntax" + }, + { + "comment": "Multi-select of a hash with a trailing comma", + "expression": "foo.[abc, ]", + "error": "syntax" + }, + { + "comment": "Multi-select of a hash with extra commas", + "expression": "foo.[abc,, def]", + "error": "syntax" + }, + { + "comment": "Multi-select of a hash using number indices", + "expression": "foo.[0, 1]", + "error": "syntax" + } + ] + }, + { + "comment": "Multi-select hash syntax", + "given": {"type": "object"}, + "cases": [ + { + "comment": "No key or value", + "expression": "a{}", + "error": "syntax" + }, + { + "comment": "No closing token", + "expression": "a{", + "error": "syntax" + }, + { + "comment": "Not a key value pair", + "expression": "a{foo}", + "error": "syntax" + }, + { + "comment": "Missing value and closing character", + "expression": "a{foo:", + "error": "syntax" + }, + { + "comment": "Missing closing character", + "expression": "a{foo: 0", + "error": "syntax" + }, + { + "comment": "Missing value", + "expression": "a{foo:}", + "error": "syntax" + }, + { + "comment": "Trailing comma and no closing character", + "expression": "a{foo: 0, ", + "error": "syntax" + }, + { + "comment": "Missing value with trailing comma", + "expression": "a{foo: ,}", + "error": "syntax" + }, + { + "comment": "Accessing Array using an identifier", + "expression": "a{foo: bar}", + "error": "syntax" + }, + { + "expression": "a{foo: 0}", + "error": "syntax" + }, + { + "comment": "Missing key-value pair", + "expression": "a.{}", + "error": "syntax" + }, + { + "comment": "Not a key-value pair", + "expression": "a.{foo}", + "error": "syntax" + }, + { + "comment": "Missing value", + "expression": "a.{foo:}", + "error": "syntax" + }, + { + "comment": "Missing value with trailing comma", + "expression": "a.{foo: ,}", + "error": "syntax" + }, + { + "comment": "Valid multi-select hash extraction", + "expression": "a.{foo: bar}", + "result": null + }, + { + "comment": "Valid multi-select hash extraction", + "expression": "a.{foo: bar, baz: bam}", + "result": null + }, + { + "comment": "Trailing comma", + "expression": "a.{foo: bar, }", + "error": "syntax" + }, + { + "comment": "Missing key in second key-value pair", + "expression": "a.{foo: bar, baz}", + "error": "syntax" + }, + { + "comment": "Missing value in second key-value pair", + "expression": "a.{foo: bar, baz:}", + "error": "syntax" + }, + { + "comment": "Trailing comma", + "expression": "a.{foo: bar, baz: bam, }", + "error": "syntax" + }, + { + "comment": "Nested multi select", + "expression": "{\"\\\\\":{\" \":*}}", + "result": {"\\": {" ": ["object"]}} + } + ] + }, + { + "comment": "Or expressions", + "given": {"type": "object"}, + "cases": [ + { + "expression": "foo || bar", + "result": null + }, + { + "expression": "foo ||", + "error": "syntax" + }, + { + "expression": "foo.|| bar", + "error": "syntax" + }, + { + "expression": " || foo", + "error": "syntax" + }, + { + "expression": "foo || || foo", + "error": "syntax" + }, + { + "expression": "foo.[a || b]", + "result": null + }, + { + "expression": "foo.[a ||]", + "error": "syntax" + }, + { + "expression": "\"foo", + "error": "syntax" + } + ] + }, + { + "comment": "Filter expressions", + "given": {"type": "object"}, + "cases": [ + { + "expression": "foo[?bar==`\"baz\"`]", + "result": null + }, + { + "expression": "foo[? bar == `\"baz\"` ]", + "result": null + }, + { + "expression": "foo[ ?bar==`\"baz\"`]", + "error": "syntax" + }, + { + "expression": "foo[?bar==]", + "error": "syntax" + }, + { + "expression": "foo[?==]", + "error": "syntax" + }, + { + "expression": "foo[?==bar]", + "error": "syntax" + }, + { + "expression": "foo[?bar==baz?]", + "error": "syntax" + }, + { + "expression": "foo[?a.b.c==d.e.f]", + "result": null + }, + { + "expression": "foo[?bar==`[0, 1, 2]`]", + "result": null + }, + { + "expression": "foo[?bar==`[\"a\", \"b\", \"c\"]`]", + "result": null + }, + { + "comment": "Literal char not escaped", + "expression": "foo[?bar==`[\"foo`bar\"]`]", + "error": "syntax" + }, + { + "comment": "Literal char escaped", + "expression": "foo[?bar==`[\"foo\\`bar\"]`]", + "result": null + }, + { + "comment": "Unknown comparator", + "expression": "foo[?bar<>baz]", + "error": "syntax" + }, + { + "comment": "Unknown comparator", + "expression": "foo[?bar^baz]", + "error": "syntax" + }, + { + "expression": "foo[bar==baz]", + "error": "syntax" + }, + { + "comment": "Quoted identifier in filter expression no spaces", + "expression": "[?\"\\\\\">`\"foo\"`]", + "result": null + }, + { + "comment": "Quoted identifier in filter expression with spaces", + "expression": "[?\"\\\\\" > `\"foo\"`]", + "result": null + } + ] + }, + { + "comment": "Filter expression errors", + "given": {"type": "object"}, + "cases": [ + { + "expression": "bar.`\"anything\"`", + "error": "syntax" + }, + { + "expression": "bar.baz.noexists.`\"literal\"`", + "error": "syntax" + }, + { + "comment": "Literal wildcard projection", + "expression": "foo[*].`\"literal\"`", + "error": "syntax" + }, + { + "expression": "foo[*].name.`\"literal\"`", + "error": "syntax" + }, + { + "expression": "foo[].name.`\"literal\"`", + "error": "syntax" + }, + { + "expression": "foo[].name.`\"literal\"`.`\"subliteral\"`", + "error": "syntax" + }, + { + "comment": "Projecting a literal onto an empty list", + "expression": "foo[*].name.noexist.`\"literal\"`", + "error": "syntax" + }, + { + "expression": "foo[].name.noexist.`\"literal\"`", + "error": "syntax" + }, + { + "expression": "twolen[*].`\"foo\"`", + "error": "syntax" + }, + { + "comment": "Two level projection of a literal", + "expression": "twolen[*].threelen[*].`\"bar\"`", + "error": "syntax" + }, + { + "comment": "Two level flattened projection of a literal", + "expression": "twolen[].threelen[].`\"bar\"`", + "error": "syntax" + } + ] + }, + { + "comment": "Identifiers", + "given": {"type": "object"}, + "cases": [ + { + "expression": "foo", + "result": null + }, + { + "expression": "\"foo\"", + "result": null + }, + { + "expression": "\"\\\\\"", + "result": null + } + ] + }, + { + "comment": "Combined syntax", + "given": [], + "cases": [ + { + "expression": "*||*|*|*", + "result": null + }, + { + "expression": "*[]||[*]", + "result": [] + }, + { + "expression": "[*.*]", + "result": [null] + } + ] + } +] diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/compliance/unicode.json b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/compliance/unicode.json new file mode 100644 index 00000000000..6b07b0b6dae --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/compliance/unicode.json @@ -0,0 +1,38 @@ +[ + { + "given": {"foo": [{"✓": "✓"}, {"✓": "✗"}]}, + "cases": [ + { + "expression": "foo[].\"✓\"", + "result": ["✓", "✗"] + } + ] + }, + { + "given": {"☯": true}, + "cases": [ + { + "expression": "\"☯\"", + "result": true + } + ] + }, + { + "given": {"♪♫•*¨*•.¸¸❤¸¸.•*¨*•♫♪": true}, + "cases": [ + { + "expression": "\"♪♫•*¨*•.¸¸❤¸¸.•*¨*•♫♪\"", + "result": true + } + ] + }, + { + "given": {"☃": true}, + "cases": [ + { + "expression": "\"☃\"", + "result": true + } + ] + } +] diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/compliance/wildcard.json b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/compliance/wildcard.json new file mode 100644 index 00000000000..3bcec302815 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/compliance/wildcard.json @@ -0,0 +1,460 @@ +[{ + "given": { + "foo": { + "bar": { + "baz": "val" + }, + "other": { + "baz": "val" + }, + "other2": { + "baz": "val" + }, + "other3": { + "notbaz": ["a", "b", "c"] + }, + "other4": { + "notbaz": ["a", "b", "c"] + }, + "other5": { + "other": { + "a": 1, + "b": 1, + "c": 1 + } + } + } + }, + "cases": [ + { + "expression": "foo.*.baz", + "result": ["val", "val", "val"] + }, + { + "expression": "foo.bar.*", + "result": ["val"] + }, + { + "expression": "foo.*.notbaz", + "result": [["a", "b", "c"], ["a", "b", "c"]] + }, + { + "expression": "foo.*.notbaz[0]", + "result": ["a", "a"] + }, + { + "expression": "foo.*.notbaz[-1]", + "result": ["c", "c"] + } + ] +}, { + "given": { + "foo": { + "first-1": { + "second-1": "val" + }, + "first-2": { + "second-1": "val" + }, + "first-3": { + "second-1": "val" + } + } + }, + "cases": [ + { + "expression": "foo.*", + "result": [{"second-1": "val"}, {"second-1": "val"}, + {"second-1": "val"}] + }, + { + "expression": "foo.*.*", + "result": [["val"], ["val"], ["val"]] + }, + { + "expression": "foo.*.*.*", + "result": [[], [], []] + }, + { + "expression": "foo.*.*.*.*", + "result": [[], [], []] + } + ] +}, { + "given": { + "foo": { + "bar": "one" + }, + "other": { + "bar": "one" + }, + "nomatch": { + "notbar": "three" + } + }, + "cases": [ + { + "expression": "*.bar", + "result": ["one", "one"] + } + ] +}, { + "given": { + "top1": { + "sub1": {"foo": "one"} + }, + "top2": { + "sub1": {"foo": "one"} + } + }, + "cases": [ + { + "expression": "*", + "result": [{"sub1": {"foo": "one"}}, + {"sub1": {"foo": "one"}}] + }, + { + "expression": "*.sub1", + "result": [{"foo": "one"}, + {"foo": "one"}] + }, + { + "expression": "*.*", + "result": [[{"foo": "one"}], + [{"foo": "one"}]] + }, + { + "expression": "*.*.foo[]", + "result": ["one", "one"] + }, + { + "expression": "*.sub1.foo", + "result": ["one", "one"] + } + ] +}, +{ + "given": + {"foo": [{"bar": "one"}, {"bar": "two"}, {"bar": "three"}, {"notbar": "four"}]}, + "cases": [ + { + "expression": "foo[*].bar", + "result": ["one", "two", "three"] + }, + { + "expression": "foo[*].notbar", + "result": ["four"] + } + ] +}, +{ + "given": + [{"bar": "one"}, {"bar": "two"}, {"bar": "three"}, {"notbar": "four"}], + "cases": [ + { + "expression": "[*]", + "result": [{"bar": "one"}, {"bar": "two"}, {"bar": "three"}, {"notbar": "four"}] + }, + { + "expression": "[*].bar", + "result": ["one", "two", "three"] + }, + { + "expression": "[*].notbar", + "result": ["four"] + } + ] +}, +{ + "given": { + "foo": { + "bar": [ + {"baz": ["one", "two", "three"]}, + {"baz": ["four", "five", "six"]}, + {"baz": ["seven", "eight", "nine"]} + ] + } + }, + "cases": [ + { + "expression": "foo.bar[*].baz", + "result": [["one", "two", "three"], ["four", "five", "six"], ["seven", "eight", "nine"]] + }, + { + "expression": "foo.bar[*].baz[0]", + "result": ["one", "four", "seven"] + }, + { + "expression": "foo.bar[*].baz[1]", + "result": ["two", "five", "eight"] + }, + { + "expression": "foo.bar[*].baz[2]", + "result": ["three", "six", "nine"] + }, + { + "expression": "foo.bar[*].baz[3]", + "result": [] + } + ] +}, +{ + "given": { + "foo": { + "bar": [["one", "two"], ["three", "four"]] + } + }, + "cases": [ + { + "expression": "foo.bar[*]", + "result": [["one", "two"], ["three", "four"]] + }, + { + "expression": "foo.bar[0]", + "result": ["one", "two"] + }, + { + "expression": "foo.bar[0][0]", + "result": "one" + }, + { + "expression": "foo.bar[0][0][0]", + "result": null + }, + { + "expression": "foo.bar[0][0][0][0]", + "result": null + }, + { + "expression": "foo[0][0]", + "result": null + } + ] +}, +{ + "given": { + "foo": [ + {"bar": [{"kind": "basic"}, {"kind": "intermediate"}]}, + {"bar": [{"kind": "advanced"}, {"kind": "expert"}]}, + {"bar": "string"} + ] + + }, + "cases": [ + { + "expression": "foo[*].bar[*].kind", + "result": [["basic", "intermediate"], ["advanced", "expert"]] + }, + { + "expression": "foo[*].bar[0].kind", + "result": ["basic", "advanced"] + } + ] +}, +{ + "given": { + "foo": [ + {"bar": {"kind": "basic"}}, + {"bar": {"kind": "intermediate"}}, + {"bar": {"kind": "advanced"}}, + {"bar": {"kind": "expert"}}, + {"bar": "string"} + ] + }, + "cases": [ + { + "expression": "foo[*].bar.kind", + "result": ["basic", "intermediate", "advanced", "expert"] + } + ] +}, +{ + "given": { + "foo": [{"bar": ["one", "two"]}, {"bar": ["three", "four"]}, {"bar": ["five"]}] + }, + "cases": [ + { + "expression": "foo[*].bar[0]", + "result": ["one", "three", "five"] + }, + { + "expression": "foo[*].bar[1]", + "result": ["two", "four"] + }, + { + "expression": "foo[*].bar[2]", + "result": [] + } + ] +}, +{ + "given": { + "foo": [{"bar": []}, {"bar": []}, {"bar": []}] + }, + "cases": [ + { + "expression": "foo[*].bar[0]", + "result": [] + } + ] +}, +{ + "given": { + "foo": [["one", "two"], ["three", "four"], ["five"]] + }, + "cases": [ + { + "expression": "foo[*][0]", + "result": ["one", "three", "five"] + }, + { + "expression": "foo[*][1]", + "result": ["two", "four"] + } + ] +}, +{ + "given": { + "foo": [ + [ + ["one", "two"], ["three", "four"] + ], [ + ["five", "six"], ["seven", "eight"] + ], [ + ["nine"], ["ten"] + ] + ] + }, + "cases": [ + { + "expression": "foo[*][0]", + "result": [["one", "two"], ["five", "six"], ["nine"]] + }, + { + "expression": "foo[*][1]", + "result": [["three", "four"], ["seven", "eight"], ["ten"]] + }, + { + "expression": "foo[*][0][0]", + "result": ["one", "five", "nine"] + }, + { + "expression": "foo[*][1][0]", + "result": ["three", "seven", "ten"] + }, + { + "expression": "foo[*][0][1]", + "result": ["two", "six"] + }, + { + "expression": "foo[*][1][1]", + "result": ["four", "eight"] + }, + { + "expression": "foo[*][2]", + "result": [] + }, + { + "expression": "foo[*][2][2]", + "result": [] + }, + { + "expression": "bar[*]", + "result": null + }, + { + "expression": "bar[*].baz[*]", + "result": null + } + ] +}, +{ + "given": { + "string": "string", + "hash": {"foo": "bar", "bar": "baz"}, + "number": 23, + "nullvalue": null + }, + "cases": [ + { + "expression": "string[*]", + "result": null + }, + { + "expression": "hash[*]", + "result": null + }, + { + "expression": "number[*]", + "result": null + }, + { + "expression": "nullvalue[*]", + "result": null + }, + { + "expression": "string[*].foo", + "result": null + }, + { + "expression": "hash[*].foo", + "result": null + }, + { + "expression": "number[*].foo", + "result": null + }, + { + "expression": "nullvalue[*].foo", + "result": null + }, + { + "expression": "nullvalue[*].foo[*].bar", + "result": null + } + ] +}, +{ + "given": { + "string": "string", + "hash": {"foo": "val", "bar": "val"}, + "number": 23, + "array": [1, 2, 3], + "nullvalue": null + }, + "cases": [ + { + "expression": "string.*", + "result": null + }, + { + "expression": "hash.*", + "result": ["val", "val"] + }, + { + "expression": "number.*", + "result": null + }, + { + "expression": "array.*", + "result": null + }, + { + "expression": "nullvalue.*", + "result": null + } + ] +}, +{ + "given": { + "a": [0, 1, 2], + "b": [0, 1, 2] + }, + "cases": [ + { + "expression": "*[0]", + "result": [0, 0] + } + ] +} +] diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/compliance_test.go b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/compliance_test.go new file mode 100644 index 00000000000..4ee9c959dc6 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/compliance_test.go @@ -0,0 +1,123 @@ +package jmespath + +import ( + "encoding/json" + "fmt" + "io/ioutil" + "os" + "path/filepath" + "testing" + + "github.com/stretchr/testify/assert" +) + +type TestSuite struct { + Given interface{} + TestCases []TestCase `json:"cases"` + Comment string +} +type TestCase struct { + Comment string + Expression string + Result interface{} + Error string +} + +var whiteListed = []string{ + "compliance/basic.json", + "compliance/current.json", + "compliance/escape.json", + "compliance/filters.json", + "compliance/functions.json", + "compliance/identifiers.json", + "compliance/indices.json", + "compliance/literal.json", + "compliance/multiselect.json", + "compliance/ormatch.json", + "compliance/pipe.json", + "compliance/slice.json", + "compliance/syntax.json", + "compliance/unicode.json", + "compliance/wildcard.json", + "compliance/boolean.json", +} + +func allowed(path string) bool { + for _, el := range whiteListed { + if el == path { + return true + } + } + return false +} + +func TestCompliance(t *testing.T) { + assert := assert.New(t) + + var complianceFiles []string + err := filepath.Walk("compliance", func(path string, _ os.FileInfo, _ error) error { + //if strings.HasSuffix(path, ".json") { + if allowed(path) { + complianceFiles = append(complianceFiles, path) + } + return nil + }) + if assert.Nil(err) { + for _, filename := range complianceFiles { + runComplianceTest(assert, filename) + } + } +} + +func runComplianceTest(assert *assert.Assertions, filename string) { + var testSuites []TestSuite + data, err := ioutil.ReadFile(filename) + if assert.Nil(err) { + err := json.Unmarshal(data, &testSuites) + if assert.Nil(err) { + for _, testsuite := range testSuites { + runTestSuite(assert, testsuite, filename) + } + } + } +} + +func runTestSuite(assert *assert.Assertions, testsuite TestSuite, filename string) { + for _, testcase := range testsuite.TestCases { + if testcase.Error != "" { + // This is a test case that verifies we error out properly. + runSyntaxTestCase(assert, testsuite.Given, testcase, filename) + } else { + runTestCase(assert, testsuite.Given, testcase, filename) + } + } +} + +func runSyntaxTestCase(assert *assert.Assertions, given interface{}, testcase TestCase, filename string) { + // Anything with an .Error means that we expect that JMESPath should return + // an error when we try to evaluate the expression. + _, err := Search(testcase.Expression, given) + assert.NotNil(err, fmt.Sprintf("Expression: %s", testcase.Expression)) +} + +func runTestCase(assert *assert.Assertions, given interface{}, testcase TestCase, filename string) { + lexer := NewLexer() + var err error + _, err = lexer.tokenize(testcase.Expression) + if err != nil { + errMsg := fmt.Sprintf("(%s) Could not lex expression: %s -- %s", filename, testcase.Expression, err.Error()) + assert.Fail(errMsg) + return + } + parser := NewParser() + _, err = parser.Parse(testcase.Expression) + if err != nil { + errMsg := fmt.Sprintf("(%s) Could not parse expression: %s -- %s", filename, testcase.Expression, err.Error()) + assert.Fail(errMsg) + return + } + actual, err := Search(testcase.Expression, given) + if assert.Nil(err, fmt.Sprintf("Expression: %s", testcase.Expression)) { + assert.Equal(testcase.Result, actual, fmt.Sprintf("Expression: %s", testcase.Expression)) + } +} diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/functions.go b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/functions.go new file mode 100644 index 00000000000..8a3f2ef0dce --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/functions.go @@ -0,0 +1,840 @@ +package jmespath + +import ( + "encoding/json" + "errors" + "fmt" + "math" + "sort" + "strconv" + "strings" + "unicode/utf8" +) + +type jpFunction func(arguments []interface{}) (interface{}, error) + +type jpType string + +const ( + jpUnknown jpType = "unknown" + jpNumber jpType = "number" + jpString jpType = "string" + jpArray jpType = "array" + jpObject jpType = "object" + jpArrayNumber jpType = "array[number]" + jpArrayString jpType = "array[string]" + jpExpref jpType = "expref" + jpAny jpType = "any" +) + +type functionEntry struct { + name string + arguments []argSpec + handler jpFunction + hasExpRef bool +} + +type argSpec struct { + types []jpType + variadic bool +} + +type byExprString struct { + intr *treeInterpreter + node ASTNode + items []interface{} + hasError bool +} + +func (a *byExprString) Len() int { + return len(a.items) +} +func (a *byExprString) Swap(i, j int) { + a.items[i], a.items[j] = a.items[j], a.items[i] +} +func (a *byExprString) Less(i, j int) bool { + first, err := a.intr.Execute(a.node, a.items[i]) + if err != nil { + a.hasError = true + // Return a dummy value. + return true + } + ith, ok := first.(string) + if !ok { + a.hasError = true + return true + } + second, err := a.intr.Execute(a.node, a.items[j]) + if err != nil { + a.hasError = true + // Return a dummy value. + return true + } + jth, ok := second.(string) + if !ok { + a.hasError = true + return true + } + return ith < jth +} + +type byExprFloat struct { + intr *treeInterpreter + node ASTNode + items []interface{} + hasError bool +} + +func (a *byExprFloat) Len() int { + return len(a.items) +} +func (a *byExprFloat) Swap(i, j int) { + a.items[i], a.items[j] = a.items[j], a.items[i] +} +func (a *byExprFloat) Less(i, j int) bool { + first, err := a.intr.Execute(a.node, a.items[i]) + if err != nil { + a.hasError = true + // Return a dummy value. + return true + } + ith, ok := first.(float64) + if !ok { + a.hasError = true + return true + } + second, err := a.intr.Execute(a.node, a.items[j]) + if err != nil { + a.hasError = true + // Return a dummy value. + return true + } + jth, ok := second.(float64) + if !ok { + a.hasError = true + return true + } + return ith < jth +} + +type functionCaller struct { + functionTable map[string]functionEntry +} + +func newFunctionCaller() *functionCaller { + caller := &functionCaller{} + caller.functionTable = map[string]functionEntry{ + "length": functionEntry{ + name: "length", + arguments: []argSpec{ + argSpec{types: []jpType{jpString, jpArray, jpObject}}, + }, + handler: jpfLength, + }, + "starts_with": functionEntry{ + name: "starts_with", + arguments: []argSpec{ + argSpec{types: []jpType{jpString}}, + argSpec{types: []jpType{jpString}}, + }, + handler: jpfStartsWith, + }, + "abs": functionEntry{ + name: "abs", + arguments: []argSpec{ + argSpec{types: []jpType{jpNumber}}, + }, + handler: jpfAbs, + }, + "avg": functionEntry{ + name: "avg", + arguments: []argSpec{ + argSpec{types: []jpType{jpArrayNumber}}, + }, + handler: jpfAvg, + }, + "ceil": functionEntry{ + name: "ceil", + arguments: []argSpec{ + argSpec{types: []jpType{jpNumber}}, + }, + handler: jpfCeil, + }, + "contains": functionEntry{ + name: "contains", + arguments: []argSpec{ + argSpec{types: []jpType{jpArray, jpString}}, + argSpec{types: []jpType{jpAny}}, + }, + handler: jpfContains, + }, + "ends_with": functionEntry{ + name: "ends_with", + arguments: []argSpec{ + argSpec{types: []jpType{jpString}}, + argSpec{types: []jpType{jpString}}, + }, + handler: jpfEndsWith, + }, + "floor": functionEntry{ + name: "floor", + arguments: []argSpec{ + argSpec{types: []jpType{jpNumber}}, + }, + handler: jpfFloor, + }, + "map": functionEntry{ + name: "amp", + arguments: []argSpec{ + argSpec{types: []jpType{jpExpref}}, + argSpec{types: []jpType{jpArray}}, + }, + handler: jpfMap, + hasExpRef: true, + }, + "max": functionEntry{ + name: "max", + arguments: []argSpec{ + argSpec{types: []jpType{jpArrayNumber, jpArrayString}}, + }, + handler: jpfMax, + }, + "merge": functionEntry{ + name: "merge", + arguments: []argSpec{ + argSpec{types: []jpType{jpObject}, variadic: true}, + }, + handler: jpfMerge, + }, + "max_by": functionEntry{ + name: "max_by", + arguments: []argSpec{ + argSpec{types: []jpType{jpArray}}, + argSpec{types: []jpType{jpExpref}}, + }, + handler: jpfMaxBy, + hasExpRef: true, + }, + "sum": functionEntry{ + name: "sum", + arguments: []argSpec{ + argSpec{types: []jpType{jpArrayNumber}}, + }, + handler: jpfSum, + }, + "min": functionEntry{ + name: "min", + arguments: []argSpec{ + argSpec{types: []jpType{jpArrayNumber, jpArrayString}}, + }, + handler: jpfMin, + }, + "min_by": functionEntry{ + name: "min_by", + arguments: []argSpec{ + argSpec{types: []jpType{jpArray}}, + argSpec{types: []jpType{jpExpref}}, + }, + handler: jpfMinBy, + hasExpRef: true, + }, + "type": functionEntry{ + name: "type", + arguments: []argSpec{ + argSpec{types: []jpType{jpAny}}, + }, + handler: jpfType, + }, + "keys": functionEntry{ + name: "keys", + arguments: []argSpec{ + argSpec{types: []jpType{jpObject}}, + }, + handler: jpfKeys, + }, + "values": functionEntry{ + name: "values", + arguments: []argSpec{ + argSpec{types: []jpType{jpObject}}, + }, + handler: jpfValues, + }, + "sort": functionEntry{ + name: "sort", + arguments: []argSpec{ + argSpec{types: []jpType{jpArrayString, jpArrayNumber}}, + }, + handler: jpfSort, + }, + "sort_by": functionEntry{ + name: "sort_by", + arguments: []argSpec{ + argSpec{types: []jpType{jpArray}}, + argSpec{types: []jpType{jpExpref}}, + }, + handler: jpfSortBy, + hasExpRef: true, + }, + "join": functionEntry{ + name: "join", + arguments: []argSpec{ + argSpec{types: []jpType{jpString}}, + argSpec{types: []jpType{jpArrayString}}, + }, + handler: jpfJoin, + }, + "reverse": functionEntry{ + name: "reverse", + arguments: []argSpec{ + argSpec{types: []jpType{jpArray, jpString}}, + }, + handler: jpfReverse, + }, + "to_array": functionEntry{ + name: "to_array", + arguments: []argSpec{ + argSpec{types: []jpType{jpAny}}, + }, + handler: jpfToArray, + }, + "to_string": functionEntry{ + name: "to_string", + arguments: []argSpec{ + argSpec{types: []jpType{jpAny}}, + }, + handler: jpfToString, + }, + "to_number": functionEntry{ + name: "to_number", + arguments: []argSpec{ + argSpec{types: []jpType{jpAny}}, + }, + handler: jpfToNumber, + }, + "not_null": functionEntry{ + name: "not_null", + arguments: []argSpec{ + argSpec{types: []jpType{jpAny}, variadic: true}, + }, + handler: jpfNotNull, + }, + } + return caller +} + +func (e *functionEntry) resolveArgs(arguments []interface{}) ([]interface{}, error) { + if len(e.arguments) == 0 { + return arguments, nil + } + if !e.arguments[len(e.arguments)-1].variadic { + if len(e.arguments) != len(arguments) { + return nil, errors.New("incorrect number of args") + } + for i, spec := range e.arguments { + userArg := arguments[i] + err := spec.typeCheck(userArg) + if err != nil { + return nil, err + } + } + return arguments, nil + } + if len(arguments) < len(e.arguments) { + return nil, errors.New("Invalid arity.") + } + return arguments, nil +} + +func (a *argSpec) typeCheck(arg interface{}) error { + for _, t := range a.types { + switch t { + case jpNumber: + if _, ok := arg.(float64); ok { + return nil + } + case jpString: + if _, ok := arg.(string); ok { + return nil + } + case jpArray: + if _, ok := arg.([]interface{}); ok { + return nil + } + case jpObject: + if _, ok := arg.(map[string]interface{}); ok { + return nil + } + case jpArrayNumber: + if _, ok := toArrayNum(arg); ok { + return nil + } + case jpArrayString: + if _, ok := toArrayStr(arg); ok { + return nil + } + case jpAny: + return nil + case jpExpref: + if _, ok := arg.(expRef); ok { + return nil + } + } + } + return fmt.Errorf("Invalid type for: %v, expected: %#v", arg, a.types) +} + +func (f *functionCaller) CallFunction(name string, arguments []interface{}, intr *treeInterpreter) (interface{}, error) { + entry, ok := f.functionTable[name] + if !ok { + return nil, errors.New("unknown function: " + name) + } + resolvedArgs, err := entry.resolveArgs(arguments) + if err != nil { + return nil, err + } + if entry.hasExpRef { + var extra []interface{} + extra = append(extra, intr) + resolvedArgs = append(extra, resolvedArgs...) + } + return entry.handler(resolvedArgs) +} + +func jpfAbs(arguments []interface{}) (interface{}, error) { + num := arguments[0].(float64) + return math.Abs(num), nil +} + +func jpfLength(arguments []interface{}) (interface{}, error) { + arg := arguments[0] + if c, ok := arg.(string); ok { + return float64(utf8.RuneCountInString(c)), nil + } else if c, ok := arg.([]interface{}); ok { + return float64(len(c)), nil + } else if c, ok := arg.(map[string]interface{}); ok { + return float64(len(c)), nil + } + return nil, errors.New("could not compute length()") +} + +func jpfStartsWith(arguments []interface{}) (interface{}, error) { + search := arguments[0].(string) + prefix := arguments[1].(string) + return strings.HasPrefix(search, prefix), nil +} + +func jpfAvg(arguments []interface{}) (interface{}, error) { + // We've already type checked the value so we can safely use + // type assertions. + args := arguments[0].([]interface{}) + length := float64(len(args)) + numerator := 0.0 + for _, n := range args { + numerator += n.(float64) + } + return numerator / length, nil +} +func jpfCeil(arguments []interface{}) (interface{}, error) { + val := arguments[0].(float64) + return math.Ceil(val), nil +} +func jpfContains(arguments []interface{}) (interface{}, error) { + search := arguments[0] + el := arguments[1] + if searchStr, ok := search.(string); ok { + if elStr, ok := el.(string); ok { + return strings.Index(searchStr, elStr) != -1, nil + } + return false, nil + } + // Otherwise this is a generic contains for []interface{} + general := search.([]interface{}) + for _, item := range general { + if item == el { + return true, nil + } + } + return false, nil +} +func jpfEndsWith(arguments []interface{}) (interface{}, error) { + search := arguments[0].(string) + suffix := arguments[1].(string) + return strings.HasSuffix(search, suffix), nil +} +func jpfFloor(arguments []interface{}) (interface{}, error) { + val := arguments[0].(float64) + return math.Floor(val), nil +} +func jpfMap(arguments []interface{}) (interface{}, error) { + intr := arguments[0].(*treeInterpreter) + exp := arguments[1].(expRef) + node := exp.ref + arr := arguments[2].([]interface{}) + mapped := make([]interface{}, 0, len(arr)) + for _, value := range arr { + current, err := intr.Execute(node, value) + if err != nil { + return nil, err + } + mapped = append(mapped, current) + } + return mapped, nil +} +func jpfMax(arguments []interface{}) (interface{}, error) { + if items, ok := toArrayNum(arguments[0]); ok { + if len(items) == 0 { + return nil, nil + } + if len(items) == 1 { + return items[0], nil + } + best := items[0] + for _, item := range items[1:] { + if item > best { + best = item + } + } + return best, nil + } + // Otherwise we're dealing with a max() of strings. + items, _ := toArrayStr(arguments[0]) + if len(items) == 0 { + return nil, nil + } + if len(items) == 1 { + return items[0], nil + } + best := items[0] + for _, item := range items[1:] { + if item > best { + best = item + } + } + return best, nil +} +func jpfMerge(arguments []interface{}) (interface{}, error) { + final := make(map[string]interface{}) + for _, m := range arguments { + mapped := m.(map[string]interface{}) + for key, value := range mapped { + final[key] = value + } + } + return final, nil +} +func jpfMaxBy(arguments []interface{}) (interface{}, error) { + intr := arguments[0].(*treeInterpreter) + arr := arguments[1].([]interface{}) + exp := arguments[2].(expRef) + node := exp.ref + if len(arr) == 0 { + return nil, nil + } else if len(arr) == 1 { + return arr[0], nil + } + start, err := intr.Execute(node, arr[0]) + if err != nil { + return nil, err + } + switch t := start.(type) { + case float64: + bestVal := t + bestItem := arr[0] + for _, item := range arr[1:] { + result, err := intr.Execute(node, item) + if err != nil { + return nil, err + } + current, ok := result.(float64) + if !ok { + return nil, errors.New("invalid type, must be number") + } + if current > bestVal { + bestVal = current + bestItem = item + } + } + return bestItem, nil + case string: + bestVal := t + bestItem := arr[0] + for _, item := range arr[1:] { + result, err := intr.Execute(node, item) + if err != nil { + return nil, err + } + current, ok := result.(string) + if !ok { + return nil, errors.New("invalid type, must be string") + } + if current > bestVal { + bestVal = current + bestItem = item + } + } + return bestItem, nil + default: + return nil, errors.New("invalid type, must be number of string") + } +} +func jpfSum(arguments []interface{}) (interface{}, error) { + items, _ := toArrayNum(arguments[0]) + sum := 0.0 + for _, item := range items { + sum += item + } + return sum, nil +} + +func jpfMin(arguments []interface{}) (interface{}, error) { + if items, ok := toArrayNum(arguments[0]); ok { + if len(items) == 0 { + return nil, nil + } + if len(items) == 1 { + return items[0], nil + } + best := items[0] + for _, item := range items[1:] { + if item < best { + best = item + } + } + return best, nil + } + items, _ := toArrayStr(arguments[0]) + if len(items) == 0 { + return nil, nil + } + if len(items) == 1 { + return items[0], nil + } + best := items[0] + for _, item := range items[1:] { + if item < best { + best = item + } + } + return best, nil +} + +func jpfMinBy(arguments []interface{}) (interface{}, error) { + intr := arguments[0].(*treeInterpreter) + arr := arguments[1].([]interface{}) + exp := arguments[2].(expRef) + node := exp.ref + if len(arr) == 0 { + return nil, nil + } else if len(arr) == 1 { + return arr[0], nil + } + start, err := intr.Execute(node, arr[0]) + if err != nil { + return nil, err + } + if t, ok := start.(float64); ok { + bestVal := t + bestItem := arr[0] + for _, item := range arr[1:] { + result, err := intr.Execute(node, item) + if err != nil { + return nil, err + } + current, ok := result.(float64) + if !ok { + return nil, errors.New("invalid type, must be number") + } + if current < bestVal { + bestVal = current + bestItem = item + } + } + return bestItem, nil + } else if t, ok := start.(string); ok { + bestVal := t + bestItem := arr[0] + for _, item := range arr[1:] { + result, err := intr.Execute(node, item) + if err != nil { + return nil, err + } + current, ok := result.(string) + if !ok { + return nil, errors.New("invalid type, must be string") + } + if current < bestVal { + bestVal = current + bestItem = item + } + } + return bestItem, nil + } else { + return nil, errors.New("invalid type, must be number of string") + } +} +func jpfType(arguments []interface{}) (interface{}, error) { + arg := arguments[0] + if _, ok := arg.(float64); ok { + return "number", nil + } + if _, ok := arg.(string); ok { + return "string", nil + } + if _, ok := arg.([]interface{}); ok { + return "array", nil + } + if _, ok := arg.(map[string]interface{}); ok { + return "object", nil + } + if arg == nil { + return "null", nil + } + if arg == true || arg == false { + return "boolean", nil + } + return nil, errors.New("unknown type") +} +func jpfKeys(arguments []interface{}) (interface{}, error) { + arg := arguments[0].(map[string]interface{}) + collected := make([]interface{}, 0, len(arg)) + for key := range arg { + collected = append(collected, key) + } + return collected, nil +} +func jpfValues(arguments []interface{}) (interface{}, error) { + arg := arguments[0].(map[string]interface{}) + collected := make([]interface{}, 0, len(arg)) + for _, value := range arg { + collected = append(collected, value) + } + return collected, nil +} +func jpfSort(arguments []interface{}) (interface{}, error) { + if items, ok := toArrayNum(arguments[0]); ok { + d := sort.Float64Slice(items) + sort.Stable(d) + final := make([]interface{}, len(d)) + for i, val := range d { + final[i] = val + } + return final, nil + } + // Otherwise we're dealing with sort()'ing strings. + items, _ := toArrayStr(arguments[0]) + d := sort.StringSlice(items) + sort.Stable(d) + final := make([]interface{}, len(d)) + for i, val := range d { + final[i] = val + } + return final, nil +} +func jpfSortBy(arguments []interface{}) (interface{}, error) { + intr := arguments[0].(*treeInterpreter) + arr := arguments[1].([]interface{}) + exp := arguments[2].(expRef) + node := exp.ref + if len(arr) == 0 { + return arr, nil + } else if len(arr) == 1 { + return arr, nil + } + start, err := intr.Execute(node, arr[0]) + if err != nil { + return nil, err + } + if _, ok := start.(float64); ok { + sortable := &byExprFloat{intr, node, arr, false} + sort.Stable(sortable) + if sortable.hasError { + return nil, errors.New("error in sort_by comparison") + } + return arr, nil + } else if _, ok := start.(string); ok { + sortable := &byExprString{intr, node, arr, false} + sort.Stable(sortable) + if sortable.hasError { + return nil, errors.New("error in sort_by comparison") + } + return arr, nil + } else { + return nil, errors.New("invalid type, must be number of string") + } +} +func jpfJoin(arguments []interface{}) (interface{}, error) { + sep := arguments[0].(string) + // We can't just do arguments[1].([]string), we have to + // manually convert each item to a string. + arrayStr := []string{} + for _, item := range arguments[1].([]interface{}) { + arrayStr = append(arrayStr, item.(string)) + } + return strings.Join(arrayStr, sep), nil +} +func jpfReverse(arguments []interface{}) (interface{}, error) { + if s, ok := arguments[0].(string); ok { + r := []rune(s) + for i, j := 0, len(r)-1; i < len(r)/2; i, j = i+1, j-1 { + r[i], r[j] = r[j], r[i] + } + return string(r), nil + } + items := arguments[0].([]interface{}) + length := len(items) + reversed := make([]interface{}, length) + for i, item := range items { + reversed[length-(i+1)] = item + } + return reversed, nil +} +func jpfToArray(arguments []interface{}) (interface{}, error) { + if _, ok := arguments[0].([]interface{}); ok { + return arguments[0], nil + } + return arguments[:1:1], nil +} +func jpfToString(arguments []interface{}) (interface{}, error) { + if v, ok := arguments[0].(string); ok { + return v, nil + } + result, err := json.Marshal(arguments[0]) + if err != nil { + return nil, err + } + return string(result), nil +} +func jpfToNumber(arguments []interface{}) (interface{}, error) { + arg := arguments[0] + if v, ok := arg.(float64); ok { + return v, nil + } + if v, ok := arg.(string); ok { + conv, err := strconv.ParseFloat(v, 64) + if err != nil { + return nil, nil + } + return conv, nil + } + if _, ok := arg.([]interface{}); ok { + return nil, nil + } + if _, ok := arg.(map[string]interface{}); ok { + return nil, nil + } + if arg == nil { + return nil, nil + } + if arg == true || arg == false { + return nil, nil + } + return nil, errors.New("unknown type") +} +func jpfNotNull(arguments []interface{}) (interface{}, error) { + for _, arg := range arguments { + if arg != nil { + return arg, nil + } + } + return nil, nil +} diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-1 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-1 new file mode 100644 index 00000000000..19102815663 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-1 @@ -0,0 +1 @@ +foo \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-10 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-10 new file mode 100644 index 00000000000..4d5f9756e55 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-10 @@ -0,0 +1 @@ +foo.bar \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-100 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-100 new file mode 100644 index 00000000000..bc4f6a3f49c --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-100 @@ -0,0 +1 @@ +ends_with(str, 'SStr') \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-101 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-101 new file mode 100644 index 00000000000..81bf07a7a1b --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-101 @@ -0,0 +1 @@ +ends_with(str, 'foo') \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-102 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-102 new file mode 100644 index 00000000000..3225de91399 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-102 @@ -0,0 +1 @@ +floor(`1.2`) \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-103 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-103 new file mode 100644 index 00000000000..8cac9595822 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-103 @@ -0,0 +1 @@ +floor(decimals[0]) \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-104 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-104 new file mode 100644 index 00000000000..bd76f47e216 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-104 @@ -0,0 +1 @@ +floor(foo) \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-105 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-105 new file mode 100644 index 00000000000..c719add3deb --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-105 @@ -0,0 +1 @@ +length('abc') \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-106 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-106 new file mode 100644 index 00000000000..ff12f04f148 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-106 @@ -0,0 +1 @@ +length('') \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-107 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-107 new file mode 100644 index 00000000000..0eccba1d3a0 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-107 @@ -0,0 +1 @@ +length(@) \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-108 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-108 new file mode 100644 index 00000000000..ab14b0fa8e6 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-108 @@ -0,0 +1 @@ +length(strings[0]) \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-109 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-109 new file mode 100644 index 00000000000..f1514bb7438 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-109 @@ -0,0 +1 @@ +length(str) \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-110 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-110 new file mode 100644 index 00000000000..09276059a23 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-110 @@ -0,0 +1 @@ +length(array) \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-112 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-112 new file mode 100644 index 00000000000..ab14b0fa8e6 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-112 @@ -0,0 +1 @@ +length(strings[0]) \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-115 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-115 new file mode 100644 index 00000000000..bfb41ae9875 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-115 @@ -0,0 +1 @@ +max(strings) \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-118 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-118 new file mode 100644 index 00000000000..915ec172ae7 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-118 @@ -0,0 +1 @@ +merge(`{}`) \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-119 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-119 new file mode 100644 index 00000000000..5b74e9b593f --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-119 @@ -0,0 +1 @@ +merge(`{}`, `{}`) \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-12 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-12 new file mode 100644 index 00000000000..64c5e5885a4 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-12 @@ -0,0 +1 @@ +two \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-120 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-120 new file mode 100644 index 00000000000..f34dcd8fade --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-120 @@ -0,0 +1 @@ +merge(`{"a": 1}`, `{"b": 2}`) \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-121 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-121 new file mode 100644 index 00000000000..e335dc96fea --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-121 @@ -0,0 +1 @@ +merge(`{"a": 1}`, `{"a": 2}`) \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-122 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-122 new file mode 100644 index 00000000000..aac28fffeb3 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-122 @@ -0,0 +1 @@ +merge(`{"a": 1, "b": 2}`, `{"a": 2, "c": 3}`, `{"d": 4}`) \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-123 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-123 new file mode 100644 index 00000000000..1c6fd67198e --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-123 @@ -0,0 +1 @@ +min(numbers) \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-126 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-126 new file mode 100644 index 00000000000..93e68db7759 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-126 @@ -0,0 +1 @@ +min(decimals) \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-128 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-128 new file mode 100644 index 00000000000..554601ea427 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-128 @@ -0,0 +1 @@ +type('abc') \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-129 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-129 new file mode 100644 index 00000000000..1ab2d9834f8 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-129 @@ -0,0 +1 @@ +type(`1.0`) \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-13 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-13 new file mode 100644 index 00000000000..1d19714ffbc --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-13 @@ -0,0 +1 @@ +three \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-130 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-130 new file mode 100644 index 00000000000..3cee2f56f15 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-130 @@ -0,0 +1 @@ +type(`2`) \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-131 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-131 new file mode 100644 index 00000000000..4821f9aefcf --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-131 @@ -0,0 +1 @@ +type(`true`) \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-132 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-132 new file mode 100644 index 00000000000..40b6913a6c0 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-132 @@ -0,0 +1 @@ +type(`false`) \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-133 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-133 new file mode 100644 index 00000000000..c711252be28 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-133 @@ -0,0 +1 @@ +type(`null`) \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-134 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-134 new file mode 100644 index 00000000000..ec5d07e95cc --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-134 @@ -0,0 +1 @@ +type(`[0]`) \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-135 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-135 new file mode 100644 index 00000000000..2080401e1ea --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-135 @@ -0,0 +1 @@ +type(`{"a": "b"}`) \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-136 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-136 new file mode 100644 index 00000000000..c5ee2ba5cb8 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-136 @@ -0,0 +1 @@ +type(@) \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-137 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-137 new file mode 100644 index 00000000000..1814ca17b87 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-137 @@ -0,0 +1 @@ +keys(objects) \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-138 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-138 new file mode 100644 index 00000000000..e03cdb0d640 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-138 @@ -0,0 +1 @@ +values(objects) \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-139 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-139 new file mode 100644 index 00000000000..7fea8d2ce5c --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-139 @@ -0,0 +1 @@ +keys(empty_hash) \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-14 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-14 new file mode 100644 index 00000000000..a17c92f5974 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-14 @@ -0,0 +1 @@ +one.two \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-140 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-140 new file mode 100644 index 00000000000..4f1d882a406 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-140 @@ -0,0 +1 @@ +join(', ', strings) \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-141 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-141 new file mode 100644 index 00000000000..4f1d882a406 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-141 @@ -0,0 +1 @@ +join(', ', strings) \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-142 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-142 new file mode 100644 index 00000000000..19ec1fe0900 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-142 @@ -0,0 +1 @@ +join(',', `["a", "b"]`) \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-143 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-143 new file mode 100644 index 00000000000..761c68a6b59 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-143 @@ -0,0 +1 @@ +join('|', strings) \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-144 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-144 new file mode 100644 index 00000000000..a0dd68eaa90 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-144 @@ -0,0 +1 @@ +join('|', decimals[].to_string(@)) \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-145 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-145 new file mode 100644 index 00000000000..a4190b2ba25 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-145 @@ -0,0 +1 @@ +join('|', empty_list) \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-146 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-146 new file mode 100644 index 00000000000..f5033c30223 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-146 @@ -0,0 +1 @@ +reverse(numbers) \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-147 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-147 new file mode 100644 index 00000000000..822f054d50c --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-147 @@ -0,0 +1 @@ +reverse(array) \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-148 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-148 new file mode 100644 index 00000000000..a584adcc0c5 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-148 @@ -0,0 +1 @@ +reverse(`[]`) \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-149 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-149 new file mode 100644 index 00000000000..fb4cc5dc482 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-149 @@ -0,0 +1 @@ +reverse('') \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-15 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-15 new file mode 100644 index 00000000000..693f9549627 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-15 @@ -0,0 +1 @@ +foo."1" \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-150 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-150 new file mode 100644 index 00000000000..aa260fabc17 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-150 @@ -0,0 +1 @@ +reverse('hello world') \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-151 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-151 new file mode 100644 index 00000000000..d8c58826afd --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-151 @@ -0,0 +1 @@ +starts_with(str, 'S') \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-152 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-152 new file mode 100644 index 00000000000..32e16b7bb00 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-152 @@ -0,0 +1 @@ +starts_with(str, 'St') \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-153 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-153 new file mode 100644 index 00000000000..5f575ae7fc4 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-153 @@ -0,0 +1 @@ +starts_with(str, 'Str') \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-155 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-155 new file mode 100644 index 00000000000..f31551c62fd --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-155 @@ -0,0 +1 @@ +sum(numbers) \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-156 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-156 new file mode 100644 index 00000000000..18b90446cc9 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-156 @@ -0,0 +1 @@ +sum(decimals) \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-157 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-157 new file mode 100644 index 00000000000..def4d0bc19c --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-157 @@ -0,0 +1 @@ +sum(array[].to_number(@)) \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-158 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-158 new file mode 100644 index 00000000000..48e4a7707c7 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-158 @@ -0,0 +1 @@ +sum(`[]`) \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-159 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-159 new file mode 100644 index 00000000000..9fb939a0b1b --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-159 @@ -0,0 +1 @@ +to_array('foo') \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-16 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-16 new file mode 100644 index 00000000000..86155ed7546 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-16 @@ -0,0 +1 @@ +foo."1"[0] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-160 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-160 new file mode 100644 index 00000000000..74ba7cc67db --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-160 @@ -0,0 +1 @@ +to_array(`0`) \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-161 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-161 new file mode 100644 index 00000000000..57f8b983f08 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-161 @@ -0,0 +1 @@ +to_array(objects) \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-162 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-162 new file mode 100644 index 00000000000..d17c7345faf --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-162 @@ -0,0 +1 @@ +to_array(`[1, 2, 3]`) \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-163 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-163 new file mode 100644 index 00000000000..15f70f78399 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-163 @@ -0,0 +1 @@ +to_array(false) \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-164 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-164 new file mode 100644 index 00000000000..9b227529b40 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-164 @@ -0,0 +1 @@ +to_string('foo') \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-165 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-165 new file mode 100644 index 00000000000..489a42935a6 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-165 @@ -0,0 +1 @@ +to_string(`1.2`) \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-166 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-166 new file mode 100644 index 00000000000..d17106a00f5 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-166 @@ -0,0 +1 @@ +to_string(`[0, 1]`) \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-167 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-167 new file mode 100644 index 00000000000..4f4ae9e6890 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-167 @@ -0,0 +1 @@ +to_number('1.0') \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-168 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-168 new file mode 100644 index 00000000000..ce932e2e6ac --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-168 @@ -0,0 +1 @@ +to_number('1.1') \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-169 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-169 new file mode 100644 index 00000000000..e246fa4dbcb --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-169 @@ -0,0 +1 @@ +to_number('4') \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-17 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-17 new file mode 100644 index 00000000000..de0b4c39d99 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-17 @@ -0,0 +1 @@ +foo."-1" \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-170 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-170 new file mode 100644 index 00000000000..f8c264747e9 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-170 @@ -0,0 +1 @@ +to_number('notanumber') \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-171 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-171 new file mode 100644 index 00000000000..7d423b1cd19 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-171 @@ -0,0 +1 @@ +to_number(`false`) \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-172 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-172 new file mode 100644 index 00000000000..503716b687c --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-172 @@ -0,0 +1 @@ +to_number(`null`) \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-173 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-173 new file mode 100644 index 00000000000..7f61dfa157b --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-173 @@ -0,0 +1 @@ +to_number(`[0]`) \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-174 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-174 new file mode 100644 index 00000000000..ee72a8c01ac --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-174 @@ -0,0 +1 @@ +to_number(`{"foo": 0}`) \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-175 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-175 new file mode 100644 index 00000000000..8d8f1f75906 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-175 @@ -0,0 +1 @@ +sort(numbers) \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-178 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-178 new file mode 100644 index 00000000000..8cb54ba47b3 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-178 @@ -0,0 +1 @@ +sort(empty_list) \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-179 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-179 new file mode 100644 index 00000000000..cf2c9b1db2e --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-179 @@ -0,0 +1 @@ +not_null(unknown_key, str) \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-18 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-18 new file mode 100644 index 00000000000..b516b2c489f --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-18 @@ -0,0 +1 @@ +@ \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-180 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-180 new file mode 100644 index 00000000000..e047d486682 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-180 @@ -0,0 +1 @@ +not_null(unknown_key, foo.bar, empty_list, str) \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-181 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-181 new file mode 100644 index 00000000000..c4cc87b9c12 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-181 @@ -0,0 +1 @@ +not_null(unknown_key, null_key, empty_list, str) \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-182 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-182 new file mode 100644 index 00000000000..2c7fa0a9c1e --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-182 @@ -0,0 +1 @@ +not_null(all, expressions, are_null) \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-183 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-183 new file mode 100644 index 00000000000..eb096e61cdd --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-183 @@ -0,0 +1 @@ +numbers[].to_string(@) \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-184 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-184 new file mode 100644 index 00000000000..4958abaec45 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-184 @@ -0,0 +1 @@ +array[].to_number(@) \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-185 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-185 new file mode 100644 index 00000000000..1027084724d --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-185 @@ -0,0 +1 @@ +foo[].not_null(f, e, d, c, b, a) \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-186 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-186 new file mode 100644 index 00000000000..83cb9161282 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-186 @@ -0,0 +1 @@ +sort_by(people, &age) \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-187 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-187 new file mode 100644 index 00000000000..a494d6c4bf1 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-187 @@ -0,0 +1 @@ +sort_by(people, &to_number(age_str)) \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-188 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-188 new file mode 100644 index 00000000000..2294fc54d12 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-188 @@ -0,0 +1 @@ +sort_by(people, &age)[].name \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-189 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-189 new file mode 100644 index 00000000000..bb8c2b46d1f --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-189 @@ -0,0 +1 @@ +sort_by(people, &age)[].extra \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-19 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-19 new file mode 100644 index 00000000000..e3ed49ac653 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-19 @@ -0,0 +1 @@ +@.bar \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-190 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-190 new file mode 100644 index 00000000000..3ab0290340a --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-190 @@ -0,0 +1 @@ +sort_by(`[]`, &age) \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-191 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-191 new file mode 100644 index 00000000000..97db56f7b67 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-191 @@ -0,0 +1 @@ +max_by(people, &age) \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-192 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-192 new file mode 100644 index 00000000000..a7e648de963 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-192 @@ -0,0 +1 @@ +max_by(people, &age_str) \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-193 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-193 new file mode 100644 index 00000000000..be4348d0c1e --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-193 @@ -0,0 +1 @@ +max_by(people, &to_number(age_str)) \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-194 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-194 new file mode 100644 index 00000000000..a707283d499 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-194 @@ -0,0 +1 @@ +min_by(people, &age) \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-195 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-195 new file mode 100644 index 00000000000..2cd6618d84b --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-195 @@ -0,0 +1 @@ +min_by(people, &age_str) \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-196 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-196 new file mode 100644 index 00000000000..833e6837382 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-196 @@ -0,0 +1 @@ +min_by(people, &to_number(age_str)) \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-198 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-198 new file mode 100644 index 00000000000..706dbda89a8 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-198 @@ -0,0 +1 @@ +__L \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-199 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-199 new file mode 100644 index 00000000000..ca593ca93c1 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-199 @@ -0,0 +1 @@ +"!\r" \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-2 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-2 new file mode 100644 index 00000000000..4d5f9756e55 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-2 @@ -0,0 +1 @@ +foo.bar \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-20 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-20 new file mode 100644 index 00000000000..f300ab91782 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-20 @@ -0,0 +1 @@ +@.foo[0] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-200 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-200 new file mode 100644 index 00000000000..9c93843541d --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-200 @@ -0,0 +1 @@ +Y_1623 \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-201 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-201 new file mode 100644 index 00000000000..c1b0730e013 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-201 @@ -0,0 +1 @@ +x \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-202 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-202 new file mode 100644 index 00000000000..1552ec63a6f --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-202 @@ -0,0 +1 @@ +"\tF\uCebb" \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-203 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-203 new file mode 100644 index 00000000000..047041273f0 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-203 @@ -0,0 +1 @@ +" \t" \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-204 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-204 new file mode 100644 index 00000000000..efd782cc325 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-204 @@ -0,0 +1 @@ +" " \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-205 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-205 new file mode 100644 index 00000000000..8494ac27064 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-205 @@ -0,0 +1 @@ +v2 \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-206 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-206 new file mode 100644 index 00000000000..c61f7f7ebd8 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-206 @@ -0,0 +1 @@ +"\t" \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-207 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-207 new file mode 100644 index 00000000000..f6055f1898f --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-207 @@ -0,0 +1 @@ +_X \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-208 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-208 new file mode 100644 index 00000000000..4f58e0e7bd2 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-208 @@ -0,0 +1 @@ +"\t4\ud9da\udd15" \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-209 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-209 new file mode 100644 index 00000000000..f536bfbf687 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-209 @@ -0,0 +1 @@ +v24_W \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-21 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-21 new file mode 100644 index 00000000000..ef47ff2c056 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-21 @@ -0,0 +1 @@ +"foo.bar" \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-210 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-210 new file mode 100644 index 00000000000..69759281cb4 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-210 @@ -0,0 +1 @@ +"H" \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-211 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-211 new file mode 100644 index 00000000000..c3e8b5927fb --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-211 @@ -0,0 +1 @@ +"\f" \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-212 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-212 new file mode 100644 index 00000000000..24ecc222cbf --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-212 @@ -0,0 +1 @@ +"E4" \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-213 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-213 new file mode 100644 index 00000000000..5693009d2e4 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-213 @@ -0,0 +1 @@ +"!" \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-214 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-214 new file mode 100644 index 00000000000..62dd220e719 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-214 @@ -0,0 +1 @@ +tM \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-215 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-215 new file mode 100644 index 00000000000..3c1e81f55ae --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-215 @@ -0,0 +1 @@ +" [" \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-216 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-216 new file mode 100644 index 00000000000..493daa673c4 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-216 @@ -0,0 +1 @@ +"R!" \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-217 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-217 new file mode 100644 index 00000000000..116b50ab38b --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-217 @@ -0,0 +1 @@ +_6W \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-218 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-218 new file mode 100644 index 00000000000..0073fac4520 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-218 @@ -0,0 +1 @@ +"\uaBA1\r" \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-219 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-219 new file mode 100644 index 00000000000..00d8fa37eeb --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-219 @@ -0,0 +1 @@ +tL7 \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-22 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-22 new file mode 100644 index 00000000000..661ebcfa337 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-22 @@ -0,0 +1 @@ +"foo bar" \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-220 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-220 new file mode 100644 index 00000000000..c14f16e0264 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-220 @@ -0,0 +1 @@ +"<" \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-257 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-257 new file mode 100644 index 00000000000..8a2443e6e90 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-257 @@ -0,0 +1 @@ +hvu \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-258 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-258 new file mode 100644 index 00000000000..c9ddacbb61f --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-258 @@ -0,0 +1 @@ +"; !" \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-259 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-259 new file mode 100644 index 00000000000..d0209c6df0a --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-259 @@ -0,0 +1 @@ +hU \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-26 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-26 new file mode 100644 index 00000000000..82649bd24ee --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-26 @@ -0,0 +1 @@ +"/unix/path" \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-260 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-260 new file mode 100644 index 00000000000..c07242aa44b --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-260 @@ -0,0 +1 @@ +"!I\n\/" \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-261 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-261 new file mode 100644 index 00000000000..7aae4effc7c --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-261 @@ -0,0 +1 @@ +"\uEEbF" \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-262 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-262 new file mode 100644 index 00000000000..c1574f35ffa --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-262 @@ -0,0 +1 @@ +"U)\t" \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-263 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-263 new file mode 100644 index 00000000000..5197e3a2bf5 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-263 @@ -0,0 +1 @@ +fa0_9 \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-264 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-264 new file mode 100644 index 00000000000..320558b0053 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-264 @@ -0,0 +1 @@ +"/" \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-265 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-265 new file mode 100644 index 00000000000..4a2cb086527 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-265 @@ -0,0 +1 @@ +Gy \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-266 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-266 new file mode 100644 index 00000000000..9524c83813c --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-266 @@ -0,0 +1 @@ +"\b" \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-267 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-267 new file mode 100644 index 00000000000..066b8d98b78 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-267 @@ -0,0 +1 @@ +"<" \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-268 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-268 new file mode 100644 index 00000000000..c61f7f7ebd8 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-268 @@ -0,0 +1 @@ +"\t" \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-269 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-269 new file mode 100644 index 00000000000..a582f62d282 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-269 @@ -0,0 +1 @@ +"\t&\\\r" \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-27 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-27 new file mode 100644 index 00000000000..a1d50731c78 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-27 @@ -0,0 +1 @@ +"\"\"\"" \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-270 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-270 new file mode 100644 index 00000000000..e3c5eedeb59 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-270 @@ -0,0 +1 @@ +"#" \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-271 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-271 new file mode 100644 index 00000000000..e75309a5241 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-271 @@ -0,0 +1 @@ +B__ \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-272 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-272 new file mode 100644 index 00000000000..027177272c5 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-272 @@ -0,0 +1 @@ +"\nS \n" \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-273 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-273 new file mode 100644 index 00000000000..99432276ec4 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-273 @@ -0,0 +1 @@ +Bp \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-274 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-274 new file mode 100644 index 00000000000..d4f8a788b80 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-274 @@ -0,0 +1 @@ +",\t;" \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-275 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-275 new file mode 100644 index 00000000000..56c384f7530 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-275 @@ -0,0 +1 @@ +B_q \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-276 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-276 new file mode 100644 index 00000000000..f093d2aa3bc --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-276 @@ -0,0 +1 @@ +"\/+\t\n\b!Z" \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-277 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-277 new file mode 100644 index 00000000000..11e1229d9e3 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-277 @@ -0,0 +1 @@ +"󇟇\\ueFAc" \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-278 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-278 new file mode 100644 index 00000000000..90dbfcfcd35 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-278 @@ -0,0 +1 @@ +":\f" \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-279 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-279 new file mode 100644 index 00000000000..b06b8302524 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-279 @@ -0,0 +1 @@ +"\/" \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-28 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-28 new file mode 100644 index 00000000000..5f55d73af66 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-28 @@ -0,0 +1 @@ +"bar"."baz" \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-280 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-280 new file mode 100644 index 00000000000..0e4bf7c113b --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-280 @@ -0,0 +1 @@ +_BW_6Hg_Gl \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-281 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-281 new file mode 100644 index 00000000000..81bb45f8059 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-281 @@ -0,0 +1 @@ +"􃰂" \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-282 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-282 new file mode 100644 index 00000000000..d0b4de14642 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-282 @@ -0,0 +1 @@ +zs1DC \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-283 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-283 new file mode 100644 index 00000000000..68797580caa --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-283 @@ -0,0 +1 @@ +__434 \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-284 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-284 new file mode 100644 index 00000000000..e61be91c4af --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-284 @@ -0,0 +1 @@ +"󵅁" \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-285 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-285 new file mode 100644 index 00000000000..026cb9cbb51 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-285 @@ -0,0 +1 @@ +Z_5 \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-286 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-286 new file mode 100644 index 00000000000..ca9587d06c0 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-286 @@ -0,0 +1 @@ +z_M_ \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-287 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-287 new file mode 100644 index 00000000000..67f6d9c42a3 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-287 @@ -0,0 +1 @@ +YU_2 \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-288 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-288 new file mode 100644 index 00000000000..927ab653a73 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-288 @@ -0,0 +1 @@ +_0 \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-289 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-289 new file mode 100644 index 00000000000..39307ab938e --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-289 @@ -0,0 +1 @@ +"\b+" \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-29 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-29 new file mode 100644 index 00000000000..8b0c5b41bd9 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-29 @@ -0,0 +1 @@ +foo[?name == 'a'] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-290 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-290 new file mode 100644 index 00000000000..a3ec2ed7a12 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-290 @@ -0,0 +1 @@ +"\"" \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-291 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-291 new file mode 100644 index 00000000000..26bf7e122de --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-291 @@ -0,0 +1 @@ +D7 \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-292 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-292 new file mode 100644 index 00000000000..d595c9f43a9 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-292 @@ -0,0 +1 @@ +_62L \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-293 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-293 new file mode 100644 index 00000000000..f6869694967 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-293 @@ -0,0 +1 @@ +"\tK\t" \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-294 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-294 new file mode 100644 index 00000000000..f3a9b7edb50 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-294 @@ -0,0 +1 @@ +"\n\\\f" \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-295 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-295 new file mode 100644 index 00000000000..455f00ffc29 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-295 @@ -0,0 +1 @@ +I_ \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-296 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-296 new file mode 100644 index 00000000000..ccd5968f9c1 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-296 @@ -0,0 +1 @@ +W_a0_ \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-297 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-297 new file mode 100644 index 00000000000..ee55c16fc81 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-297 @@ -0,0 +1 @@ +BQ \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-298 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-298 new file mode 100644 index 00000000000..0d1a169a67a --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-298 @@ -0,0 +1 @@ +"\tX$\uABBb" \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-299 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-299 new file mode 100644 index 00000000000..0573cfd73fd --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-299 @@ -0,0 +1 @@ +Z9 \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-3 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-3 new file mode 100644 index 00000000000..f0fcbd8eaf4 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-3 @@ -0,0 +1 @@ +foo.bar.baz \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-30 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-30 new file mode 100644 index 00000000000..4f8e6a17aab --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-30 @@ -0,0 +1 @@ +*[?[0] == `0`] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-300 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-300 new file mode 100644 index 00000000000..a0db02bebf1 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-300 @@ -0,0 +1 @@ +"\b%\"򞄏" \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-301 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-301 new file mode 100644 index 00000000000..56032f7a248 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-301 @@ -0,0 +1 @@ +_F \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-302 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-302 new file mode 100644 index 00000000000..4a8a3cff369 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-302 @@ -0,0 +1 @@ +"!," \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-303 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-303 new file mode 100644 index 00000000000..7c1efac0004 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-303 @@ -0,0 +1 @@ +"\"!" \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-304 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-304 new file mode 100644 index 00000000000..a0f489d532f --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-304 @@ -0,0 +1 @@ +Hh \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-305 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-305 new file mode 100644 index 00000000000..c64e8d5ac8b --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-305 @@ -0,0 +1 @@ +"&" \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-306 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-306 new file mode 100644 index 00000000000..0567e992f14 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-306 @@ -0,0 +1 @@ +"9\r\\R" \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-307 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-307 new file mode 100644 index 00000000000..ce8245c5b97 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-307 @@ -0,0 +1 @@ +M_k \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-308 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-308 new file mode 100644 index 00000000000..8f16a5ac048 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-308 @@ -0,0 +1 @@ +"!\b\n󑩒\"\"" \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-309 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-309 new file mode 100644 index 00000000000..504ff5ae39f --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-309 @@ -0,0 +1 @@ +"6" \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-31 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-31 new file mode 100644 index 00000000000..07fb57234b8 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-31 @@ -0,0 +1 @@ +foo[?first == last] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-310 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-310 new file mode 100644 index 00000000000..533dd8e5460 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-310 @@ -0,0 +1 @@ +_7 \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-311 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-311 new file mode 100644 index 00000000000..1e4a3a34155 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-311 @@ -0,0 +1 @@ +"0" \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-312 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-312 new file mode 100644 index 00000000000..37961f6ca42 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-312 @@ -0,0 +1 @@ +"\\8\\" \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-313 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-313 new file mode 100644 index 00000000000..23480cff14c --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-313 @@ -0,0 +1 @@ +b7eo \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-314 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-314 new file mode 100644 index 00000000000..e609f81a3b8 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-314 @@ -0,0 +1 @@ +xIUo9 \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-315 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-315 new file mode 100644 index 00000000000..d89a25f0b97 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-315 @@ -0,0 +1 @@ +"5" \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-316 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-316 new file mode 100644 index 00000000000..5adcf5e7dc5 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-316 @@ -0,0 +1 @@ +"?" \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-317 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-317 new file mode 100644 index 00000000000..ace4a897d33 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-317 @@ -0,0 +1 @@ +sU \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-318 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-318 new file mode 100644 index 00000000000..feffb7061b3 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-318 @@ -0,0 +1 @@ +"VH2&H\\\/" \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-319 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-319 new file mode 100644 index 00000000000..8223f1e51e3 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-319 @@ -0,0 +1 @@ +_C \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-32 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-32 new file mode 100644 index 00000000000..7e85c4bdfe9 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-32 @@ -0,0 +1 @@ +foo[?first == last].first \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-320 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-320 new file mode 100644 index 00000000000..c9cdc63b070 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-320 @@ -0,0 +1 @@ +_ \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-321 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-321 new file mode 100644 index 00000000000..c82f7982ee0 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-321 @@ -0,0 +1 @@ +"<\t" \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-322 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-322 new file mode 100644 index 00000000000..dae65c51554 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-322 @@ -0,0 +1 @@ +"\uD834\uDD1E" \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-323 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-323 new file mode 100644 index 00000000000..b6b3695438a --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-323 @@ -0,0 +1 @@ +foo.bar[0] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-324 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-324 new file mode 100644 index 00000000000..bf06e678c15 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-324 @@ -0,0 +1 @@ +foo.bar[1] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-325 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-325 new file mode 100644 index 00000000000..5d48e0205ce --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-325 @@ -0,0 +1 @@ +foo.bar[2] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-326 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-326 new file mode 100644 index 00000000000..de3af7230f9 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-326 @@ -0,0 +1 @@ +foo.bar[3] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-327 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-327 new file mode 100644 index 00000000000..a1c33350841 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-327 @@ -0,0 +1 @@ +foo.bar[-1] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-328 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-328 new file mode 100644 index 00000000000..ad0fef91cfa --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-328 @@ -0,0 +1 @@ +foo.bar[-2] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-329 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-329 new file mode 100644 index 00000000000..3e83c6f7306 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-329 @@ -0,0 +1 @@ +foo.bar[-3] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-33 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-33 new file mode 100644 index 00000000000..72fc0a53e79 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-33 @@ -0,0 +1 @@ +foo[?age > `25`] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-330 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-330 new file mode 100644 index 00000000000..433a737d65e --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-330 @@ -0,0 +1 @@ +foo.bar[-4] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-331 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-331 new file mode 100644 index 00000000000..4d5f9756e55 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-331 @@ -0,0 +1 @@ +foo.bar \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-332 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-332 new file mode 100644 index 00000000000..5e0d9b71772 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-332 @@ -0,0 +1 @@ +foo[0].bar \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-333 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-333 new file mode 100644 index 00000000000..3cd7e9460fe --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-333 @@ -0,0 +1 @@ +foo[1].bar \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-334 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-334 new file mode 100644 index 00000000000..74cb1765558 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-334 @@ -0,0 +1 @@ +foo[2].bar \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-335 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-335 new file mode 100644 index 00000000000..3cf2007f70d --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-335 @@ -0,0 +1 @@ +foo[3].notbar \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-336 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-336 new file mode 100644 index 00000000000..9674d880375 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-336 @@ -0,0 +1 @@ +foo[3].bar \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-337 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-337 new file mode 100644 index 00000000000..9b0b2f8189b --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-337 @@ -0,0 +1 @@ +foo[0] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-338 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-338 new file mode 100644 index 00000000000..83c639a185b --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-338 @@ -0,0 +1 @@ +foo[1] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-339 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-339 new file mode 100644 index 00000000000..3b76c9f64a4 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-339 @@ -0,0 +1 @@ +foo[2] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-34 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-34 new file mode 100644 index 00000000000..9a2b0184edf --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-34 @@ -0,0 +1 @@ +foo[?age >= `25`] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-340 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-340 new file mode 100644 index 00000000000..ff99e045d2e --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-340 @@ -0,0 +1 @@ +foo[3] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-341 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-341 new file mode 100644 index 00000000000..040ecb240c8 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-341 @@ -0,0 +1 @@ +foo[4] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-342 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-342 new file mode 100644 index 00000000000..6e7ea636eec --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-342 @@ -0,0 +1 @@ +[0] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-343 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-343 new file mode 100644 index 00000000000..bace2a0be17 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-343 @@ -0,0 +1 @@ +[1] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-344 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-344 new file mode 100644 index 00000000000..5d50c80c068 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-344 @@ -0,0 +1 @@ +[2] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-345 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-345 new file mode 100644 index 00000000000..99d21a2a0f0 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-345 @@ -0,0 +1 @@ +[-1] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-346 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-346 new file mode 100644 index 00000000000..133a9c6272f --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-346 @@ -0,0 +1 @@ +[-2] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-347 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-347 new file mode 100644 index 00000000000..b7f78c5dc51 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-347 @@ -0,0 +1 @@ +[-3] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-348 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-348 new file mode 100644 index 00000000000..bd9de815f45 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-348 @@ -0,0 +1 @@ +reservations[].instances[].foo \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-349 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-349 new file mode 100644 index 00000000000..55e6257352f --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-349 @@ -0,0 +1 @@ +reservations[].instances[].bar \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-35 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-35 new file mode 100644 index 00000000000..fa83f1da3b7 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-35 @@ -0,0 +1 @@ +foo[?age > `30`] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-350 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-350 new file mode 100644 index 00000000000..1661747c04d --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-350 @@ -0,0 +1 @@ +reservations[].notinstances[].foo \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-351 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-351 new file mode 100644 index 00000000000..1661747c04d --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-351 @@ -0,0 +1 @@ +reservations[].notinstances[].foo \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-352 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-352 new file mode 100644 index 00000000000..3debc70f895 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-352 @@ -0,0 +1 @@ +reservations[].instances[].foo[].bar \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-353 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-353 new file mode 100644 index 00000000000..75af2fda069 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-353 @@ -0,0 +1 @@ +reservations[].instances[].foo[].baz \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-354 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-354 new file mode 100644 index 00000000000..4a70cd8a03c --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-354 @@ -0,0 +1 @@ +reservations[].instances[].notfoo[].bar \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-355 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-355 new file mode 100644 index 00000000000..987985b002f --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-355 @@ -0,0 +1 @@ +reservations[].instances[].notfoo[].notbar \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-356 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-356 new file mode 100644 index 00000000000..1661747c04d --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-356 @@ -0,0 +1 @@ +reservations[].notinstances[].foo \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-357 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-357 new file mode 100644 index 00000000000..634f937e555 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-357 @@ -0,0 +1 @@ +reservations[].instances[].foo[].notbar \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-358 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-358 new file mode 100644 index 00000000000..09cb7b8bb1b --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-358 @@ -0,0 +1 @@ +reservations[].instances[].bar[].baz \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-359 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-359 new file mode 100644 index 00000000000..f5d9ac5b763 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-359 @@ -0,0 +1 @@ +reservations[].instances[].baz[].baz \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-36 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-36 new file mode 100644 index 00000000000..463a2a542db --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-36 @@ -0,0 +1 @@ +foo[?age < `25`] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-360 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-360 new file mode 100644 index 00000000000..d1016d6e75b --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-360 @@ -0,0 +1 @@ +reservations[].instances[].qux[].baz \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-361 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-361 new file mode 100644 index 00000000000..ef54cf52d67 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-361 @@ -0,0 +1 @@ +reservations[].instances[].qux[].baz[] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-362 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-362 new file mode 100644 index 00000000000..bea506ff235 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-362 @@ -0,0 +1 @@ +foo[] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-363 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-363 new file mode 100644 index 00000000000..20dd081e0e4 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-363 @@ -0,0 +1 @@ +foo[][0] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-364 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-364 new file mode 100644 index 00000000000..4803734b09e --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-364 @@ -0,0 +1 @@ +foo[][1] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-365 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-365 new file mode 100644 index 00000000000..1be56598534 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-365 @@ -0,0 +1 @@ +foo[][0][0] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-366 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-366 new file mode 100644 index 00000000000..d2cf6da59fe --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-366 @@ -0,0 +1 @@ +foo[][2][2] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-367 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-367 new file mode 100644 index 00000000000..c609ca64b16 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-367 @@ -0,0 +1 @@ +foo[][0][0][100] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-368 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-368 new file mode 100644 index 00000000000..19102815663 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-368 @@ -0,0 +1 @@ +foo \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-369 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-369 new file mode 100644 index 00000000000..bea506ff235 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-369 @@ -0,0 +1 @@ +foo[] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-37 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-37 new file mode 100644 index 00000000000..10ed5d3f61f --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-37 @@ -0,0 +1 @@ +foo[?age <= `25`] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-370 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-370 new file mode 100644 index 00000000000..13f2c4a0b4f --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-370 @@ -0,0 +1 @@ +foo[].bar \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-371 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-371 new file mode 100644 index 00000000000..edf3d92775d --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-371 @@ -0,0 +1 @@ +foo[].bar[] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-372 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-372 new file mode 100644 index 00000000000..2a3b993af24 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-372 @@ -0,0 +1 @@ +foo[].bar[].baz \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-373 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-373 new file mode 100644 index 00000000000..d5ca878a13b --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-373 @@ -0,0 +1 @@ +string[] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-374 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-374 new file mode 100644 index 00000000000..fcd255f5d0c --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-374 @@ -0,0 +1 @@ +hash[] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-375 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-375 new file mode 100644 index 00000000000..2d53bd7cdcd --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-375 @@ -0,0 +1 @@ +number[] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-376 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-376 new file mode 100644 index 00000000000..cb10d2497e1 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-376 @@ -0,0 +1 @@ +nullvalue[] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-377 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-377 new file mode 100644 index 00000000000..f6c79ca84ff --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-377 @@ -0,0 +1 @@ +string[].foo \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-378 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-378 new file mode 100644 index 00000000000..09bf36e8a90 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-378 @@ -0,0 +1 @@ +hash[].foo \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-379 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-379 new file mode 100644 index 00000000000..4c357818919 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-379 @@ -0,0 +1 @@ +number[].foo \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-38 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-38 new file mode 100644 index 00000000000..16a4c36acbd --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-38 @@ -0,0 +1 @@ +foo[?age < `20`] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-380 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-380 new file mode 100644 index 00000000000..2dd8ae21855 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-380 @@ -0,0 +1 @@ +nullvalue[].foo \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-381 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-381 new file mode 100644 index 00000000000..dfed8160389 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-381 @@ -0,0 +1 @@ +nullvalue[].foo[].bar \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-382 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-382 new file mode 100644 index 00000000000..d7628e646e1 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-382 @@ -0,0 +1 @@ +`"foo"` \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-383 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-383 new file mode 100644 index 00000000000..49c5269b12e --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-383 @@ -0,0 +1 @@ +`"\u03a6"` \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-384 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-384 new file mode 100644 index 00000000000..d5db721d012 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-384 @@ -0,0 +1 @@ +`"✓"` \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-385 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-385 new file mode 100644 index 00000000000..a2b6e4ec85d --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-385 @@ -0,0 +1 @@ +`[1, 2, 3]` \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-386 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-386 new file mode 100644 index 00000000000..f5801bdd680 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-386 @@ -0,0 +1 @@ +`{"a": "b"}` \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-387 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-387 new file mode 100644 index 00000000000..f87db59a8b7 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-387 @@ -0,0 +1 @@ +`true` \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-388 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-388 new file mode 100644 index 00000000000..3b20d905f33 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-388 @@ -0,0 +1 @@ +`false` \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-389 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-389 new file mode 100644 index 00000000000..70bcd29a7a8 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-389 @@ -0,0 +1 @@ +`null` \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-39 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-39 new file mode 100644 index 00000000000..351054d3e61 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-39 @@ -0,0 +1 @@ +foo[?age == `20`] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-390 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-390 new file mode 100644 index 00000000000..0918d41559b --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-390 @@ -0,0 +1 @@ +`0` \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-391 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-391 new file mode 100644 index 00000000000..ef70c4c11e7 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-391 @@ -0,0 +1 @@ +`1` \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-392 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-392 new file mode 100644 index 00000000000..b39a922f403 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-392 @@ -0,0 +1 @@ +`2` \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-393 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-393 new file mode 100644 index 00000000000..7e65687dbfc --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-393 @@ -0,0 +1 @@ +`3` \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-394 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-394 new file mode 100644 index 00000000000..770d1ece705 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-394 @@ -0,0 +1 @@ +`4` \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-395 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-395 new file mode 100644 index 00000000000..a8b81985c76 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-395 @@ -0,0 +1 @@ +`5` \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-396 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-396 new file mode 100644 index 00000000000..7f0861065e7 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-396 @@ -0,0 +1 @@ +`6` \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-397 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-397 new file mode 100644 index 00000000000..495114d919e --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-397 @@ -0,0 +1 @@ +`7` \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-398 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-398 new file mode 100644 index 00000000000..94f355c46ca --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-398 @@ -0,0 +1 @@ +`8` \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-399 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-399 new file mode 100644 index 00000000000..600d2aa3f49 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-399 @@ -0,0 +1 @@ +`9` \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-4 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-4 new file mode 100644 index 00000000000..31485223580 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-4 @@ -0,0 +1 @@ +foo.bar.baz.bad \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-40 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-40 new file mode 100644 index 00000000000..99d9258a625 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-40 @@ -0,0 +1 @@ +foo[?age != `20`] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-400 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-400 new file mode 100644 index 00000000000..637015b5fde --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-400 @@ -0,0 +1 @@ +`"foo\`bar"` \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-401 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-401 new file mode 100644 index 00000000000..6fa7557b8d8 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-401 @@ -0,0 +1 @@ +`"foo\"bar"` \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-402 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-402 new file mode 100644 index 00000000000..5aabeec3419 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-402 @@ -0,0 +1 @@ +`"1\`"` \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-403 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-403 new file mode 100644 index 00000000000..8302ea1984d --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-403 @@ -0,0 +1 @@ +`"\\"`.{a:`"b"`} \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-404 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-404 new file mode 100644 index 00000000000..d88d014a96c --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-404 @@ -0,0 +1 @@ +`{"a": "b"}`.a \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-405 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-405 new file mode 100644 index 00000000000..47152dddb73 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-405 @@ -0,0 +1 @@ +`{"a": {"b": "c"}}`.a.b \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-406 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-406 new file mode 100644 index 00000000000..895d4293878 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-406 @@ -0,0 +1 @@ +`[0, 1, 2]`[1] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-407 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-407 new file mode 100644 index 00000000000..42500a368cc --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-407 @@ -0,0 +1 @@ +` {"foo": true}` \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-408 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-408 new file mode 100644 index 00000000000..08b944dad4a --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-408 @@ -0,0 +1 @@ +`{"foo": true} ` \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-409 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-409 new file mode 100644 index 00000000000..6de163f80bc --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-409 @@ -0,0 +1 @@ +'foo' \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-41 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-41 new file mode 100644 index 00000000000..5bc357d9fa6 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-41 @@ -0,0 +1 @@ +foo[?top.name == 'a'] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-410 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-410 new file mode 100644 index 00000000000..b84bbdb29fb --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-410 @@ -0,0 +1 @@ +' foo ' \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-411 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-411 new file mode 100644 index 00000000000..bf6a07ace3d --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-411 @@ -0,0 +1 @@ +'0' \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-412 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-412 new file mode 100644 index 00000000000..c742f5b0c97 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-412 @@ -0,0 +1,2 @@ +'newline +' \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-413 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-413 new file mode 100644 index 00000000000..04e9b3ade60 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-413 @@ -0,0 +1,2 @@ +' +' \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-414 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-414 new file mode 100644 index 00000000000..ebdaf120d7b --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-414 @@ -0,0 +1 @@ +'✓' \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-415 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-415 new file mode 100644 index 00000000000..d0ba5d7facb --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-415 @@ -0,0 +1 @@ +'𝄞' \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-416 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-416 new file mode 100644 index 00000000000..19c2e2ef41c --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-416 @@ -0,0 +1 @@ +' [foo] ' \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-417 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-417 new file mode 100644 index 00000000000..5faa483b197 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-417 @@ -0,0 +1 @@ +'[foo]' \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-418 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-418 new file mode 100644 index 00000000000..e3c05c163a3 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-418 @@ -0,0 +1 @@ +'\u03a6' \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-419 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-419 new file mode 100644 index 00000000000..7c13861ac72 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-419 @@ -0,0 +1 @@ +foo.{bar: bar} \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-42 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-42 new file mode 100644 index 00000000000..d037a0a4ddf --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-42 @@ -0,0 +1 @@ +foo[?top.first == top.last] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-420 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-420 new file mode 100644 index 00000000000..f795c255219 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-420 @@ -0,0 +1 @@ +foo.{"bar": bar} \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-421 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-421 new file mode 100644 index 00000000000..772c45639cc --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-421 @@ -0,0 +1 @@ +foo.{"foo.bar": bar} \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-422 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-422 new file mode 100644 index 00000000000..8808e92bf31 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-422 @@ -0,0 +1 @@ +foo.{bar: bar, baz: baz} \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-423 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-423 new file mode 100644 index 00000000000..3f13757a10c --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-423 @@ -0,0 +1 @@ +foo.{"bar": bar, "baz": baz} \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-424 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-424 new file mode 100644 index 00000000000..23cd8903e73 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-424 @@ -0,0 +1 @@ +{"baz": baz, "qux\"": "qux\""} \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-425 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-425 new file mode 100644 index 00000000000..fabb6da4fe8 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-425 @@ -0,0 +1 @@ +foo.{bar:bar,baz:baz} \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-426 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-426 new file mode 100644 index 00000000000..4c3f615b1cd --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-426 @@ -0,0 +1 @@ +foo.{bar: bar,qux: qux} \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-427 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-427 new file mode 100644 index 00000000000..8bc46535ac5 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-427 @@ -0,0 +1 @@ +foo.{bar: bar, noexist: noexist} \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-428 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-428 new file mode 100644 index 00000000000..2024b6f118d --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-428 @@ -0,0 +1 @@ +foo.{noexist: noexist, alsonoexist: alsonoexist} \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-429 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-429 new file mode 100644 index 00000000000..b52191d10a4 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-429 @@ -0,0 +1 @@ +foo.badkey.{nokey: nokey, alsonokey: alsonokey} \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-43 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-43 new file mode 100644 index 00000000000..8534a5cae9f --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-43 @@ -0,0 +1 @@ +foo[?top == `{"first": "foo", "last": "bar"}`] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-430 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-430 new file mode 100644 index 00000000000..5cd310b6d24 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-430 @@ -0,0 +1 @@ +foo.nested.*.{a: a,b: b} \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-431 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-431 new file mode 100644 index 00000000000..0b24ef53526 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-431 @@ -0,0 +1 @@ +foo.nested.three.{a: a, cinner: c.inner} \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-432 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-432 new file mode 100644 index 00000000000..473c1c351b4 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-432 @@ -0,0 +1 @@ +foo.nested.three.{a: a, c: c.inner.bad.key} \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-433 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-433 new file mode 100644 index 00000000000..44ba735ab10 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-433 @@ -0,0 +1 @@ +foo.{a: nested.one.a, b: nested.two.b} \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-434 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-434 new file mode 100644 index 00000000000..f5f89b12b5c --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-434 @@ -0,0 +1 @@ +{bar: bar, baz: baz} \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-435 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-435 new file mode 100644 index 00000000000..697764cb306 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-435 @@ -0,0 +1 @@ +{bar: bar} \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-436 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-436 new file mode 100644 index 00000000000..20447fb1054 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-436 @@ -0,0 +1 @@ +{otherkey: bar} \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-437 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-437 new file mode 100644 index 00000000000..310b9b1dd27 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-437 @@ -0,0 +1 @@ +{no: no, exist: exist} \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-438 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-438 new file mode 100644 index 00000000000..c79b2e24068 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-438 @@ -0,0 +1 @@ +foo.[bar] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-439 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-439 new file mode 100644 index 00000000000..ab498ef654c --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-439 @@ -0,0 +1 @@ +foo.[bar,baz] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-44 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-44 new file mode 100644 index 00000000000..71307c40947 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-44 @@ -0,0 +1 @@ +foo[?key == `true`] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-440 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-440 new file mode 100644 index 00000000000..4b8f39a468e --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-440 @@ -0,0 +1 @@ +foo.[bar,qux] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-441 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-441 new file mode 100644 index 00000000000..b8f9020f8e7 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-441 @@ -0,0 +1 @@ +foo.[bar,noexist] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-442 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-442 new file mode 100644 index 00000000000..b7c7b3f6556 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-442 @@ -0,0 +1 @@ +foo.[noexist,alsonoexist] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-443 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-443 new file mode 100644 index 00000000000..fabb6da4fe8 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-443 @@ -0,0 +1 @@ +foo.{bar:bar,baz:baz} \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-444 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-444 new file mode 100644 index 00000000000..c15c39f82c1 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-444 @@ -0,0 +1 @@ +foo.[bar,baz[0]] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-445 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-445 new file mode 100644 index 00000000000..9cebd89844f --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-445 @@ -0,0 +1 @@ +foo.[bar,baz[1]] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-446 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-446 new file mode 100644 index 00000000000..c5bbfbf848f --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-446 @@ -0,0 +1 @@ +foo.[bar,baz[2]] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-447 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-447 new file mode 100644 index 00000000000..d81cb2b9041 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-447 @@ -0,0 +1 @@ +foo.[bar,baz[3]] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-448 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-448 new file mode 100644 index 00000000000..3a65aa7d6f1 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-448 @@ -0,0 +1 @@ +foo.[bar[0],baz[3]] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-449 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-449 new file mode 100644 index 00000000000..8808e92bf31 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-449 @@ -0,0 +1 @@ +foo.{bar: bar, baz: baz} \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-45 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-45 new file mode 100644 index 00000000000..e142b22a25f --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-45 @@ -0,0 +1 @@ +foo[?key == `false`] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-450 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-450 new file mode 100644 index 00000000000..ab498ef654c --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-450 @@ -0,0 +1 @@ +foo.[bar,baz] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-451 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-451 new file mode 100644 index 00000000000..8e3d22dc53f --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-451 @@ -0,0 +1 @@ +foo.{bar: bar.baz[1],includeme: includeme} \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-452 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-452 new file mode 100644 index 00000000000..398c7f8b06e --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-452 @@ -0,0 +1 @@ +foo.{"bar.baz.two": bar.baz[1].two, includeme: includeme} \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-453 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-453 new file mode 100644 index 00000000000..a1764448785 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-453 @@ -0,0 +1 @@ +foo.[includeme, bar.baz[*].common] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-454 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-454 new file mode 100644 index 00000000000..da5225ddccb --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-454 @@ -0,0 +1 @@ +foo.[includeme, bar.baz[*].none] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-455 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-455 new file mode 100644 index 00000000000..a8870b22bcc --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-455 @@ -0,0 +1 @@ +foo.[includeme, bar.baz[].common] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-456 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-456 new file mode 100644 index 00000000000..420b1a57c45 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-456 @@ -0,0 +1 @@ +reservations[*].instances[*].{id: id, name: name} \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-457 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-457 new file mode 100644 index 00000000000..0761ee16dc0 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-457 @@ -0,0 +1 @@ +reservations[].instances[].{id: id, name: name} \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-458 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-458 new file mode 100644 index 00000000000..aa1191a48cd --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-458 @@ -0,0 +1 @@ +reservations[].instances[].[id, name] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-459 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-459 new file mode 100644 index 00000000000..19102815663 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-459 @@ -0,0 +1 @@ +foo \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-46 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-46 new file mode 100644 index 00000000000..9a24a464eed --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-46 @@ -0,0 +1 @@ +foo[?key == `0`] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-460 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-460 new file mode 100644 index 00000000000..bea506ff235 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-460 @@ -0,0 +1 @@ +foo[] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-461 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-461 new file mode 100644 index 00000000000..13f2c4a0b4f --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-461 @@ -0,0 +1 @@ +foo[].bar \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-462 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-462 new file mode 100644 index 00000000000..edf3d92775d --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-462 @@ -0,0 +1 @@ +foo[].bar[] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-463 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-463 new file mode 100644 index 00000000000..d965466e91c --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-463 @@ -0,0 +1 @@ +foo[].bar[].[baz, qux] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-464 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-464 new file mode 100644 index 00000000000..f1822a1742b --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-464 @@ -0,0 +1 @@ +foo[].bar[].[baz] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-465 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-465 new file mode 100644 index 00000000000..c6f77b80c33 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-465 @@ -0,0 +1 @@ +foo[].bar[].[baz, qux][] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-466 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-466 new file mode 100644 index 00000000000..db56262a4ea --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-466 @@ -0,0 +1 @@ +foo.[baz[*].bar, qux[0]] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-467 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-467 new file mode 100644 index 00000000000..b901067d271 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-467 @@ -0,0 +1 @@ +foo.[baz[*].[bar, boo], qux[0]] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-468 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-468 new file mode 100644 index 00000000000..738479fa69b --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-468 @@ -0,0 +1 @@ +foo.[baz[*].not_there || baz[*].bar, qux[0]] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-469 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-469 new file mode 100644 index 00000000000..6926996a7b6 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-469 @@ -0,0 +1 @@ +[[*],*] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-47 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-47 new file mode 100644 index 00000000000..6d33cc72c4e --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-47 @@ -0,0 +1 @@ +foo[?key == `1`] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-470 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-470 new file mode 100644 index 00000000000..736be0a31f2 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-470 @@ -0,0 +1 @@ +[[*]] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-471 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-471 new file mode 100644 index 00000000000..29e1fb20a55 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-471 @@ -0,0 +1 @@ +outer.foo || outer.bar \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-472 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-472 new file mode 100644 index 00000000000..c0070ba783a --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-472 @@ -0,0 +1 @@ +outer.foo||outer.bar \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-473 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-473 new file mode 100644 index 00000000000..661b0bec5e3 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-473 @@ -0,0 +1 @@ +outer.bar || outer.baz \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-474 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-474 new file mode 100644 index 00000000000..296d5aeee16 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-474 @@ -0,0 +1 @@ +outer.bar||outer.baz \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-475 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-475 new file mode 100644 index 00000000000..ca140f8aa33 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-475 @@ -0,0 +1 @@ +outer.bad || outer.foo \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-476 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-476 new file mode 100644 index 00000000000..15d30924274 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-476 @@ -0,0 +1 @@ +outer.bad||outer.foo \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-477 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-477 new file mode 100644 index 00000000000..56148d957b7 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-477 @@ -0,0 +1 @@ +outer.foo || outer.bad \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-478 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-478 new file mode 100644 index 00000000000..6d3cf6d9069 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-478 @@ -0,0 +1 @@ +outer.foo||outer.bad \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-479 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-479 new file mode 100644 index 00000000000..100fa8339d5 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-479 @@ -0,0 +1 @@ +outer.bad || outer.alsobad \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-48 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-48 new file mode 100644 index 00000000000..de56fc042cb --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-48 @@ -0,0 +1 @@ +foo[?key == `[0]`] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-480 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-480 new file mode 100644 index 00000000000..64490352bf0 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-480 @@ -0,0 +1 @@ +outer.bad||outer.alsobad \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-481 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-481 new file mode 100644 index 00000000000..af901bde17e --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-481 @@ -0,0 +1 @@ +outer.empty_string || outer.foo \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-482 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-482 new file mode 100644 index 00000000000..36b63e462c4 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-482 @@ -0,0 +1 @@ +outer.nokey || outer.bool || outer.empty_list || outer.empty_string || outer.foo \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-483 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-483 new file mode 100644 index 00000000000..aba584f99ed --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-483 @@ -0,0 +1 @@ +foo.*.baz | [0] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-484 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-484 new file mode 100644 index 00000000000..4234ac01922 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-484 @@ -0,0 +1 @@ +foo.*.baz | [1] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-485 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-485 new file mode 100644 index 00000000000..12330d9902c --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-485 @@ -0,0 +1 @@ +foo.*.baz | [2] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-486 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-486 new file mode 100644 index 00000000000..1b2d93e1952 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-486 @@ -0,0 +1 @@ +foo.bar.* | [0] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-487 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-487 new file mode 100644 index 00000000000..c371fc6457a --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-487 @@ -0,0 +1 @@ +foo.*.notbaz | [*] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-488 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-488 new file mode 100644 index 00000000000..3c835642eb2 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-488 @@ -0,0 +1 @@ +foo | bar \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-489 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-489 new file mode 100644 index 00000000000..decaa0421d6 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-489 @@ -0,0 +1 @@ +foo | bar | baz \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-49 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-49 new file mode 100644 index 00000000000..49d9c63a390 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-49 @@ -0,0 +1 @@ +foo[?key == `{"bar": [0]}`] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-490 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-490 new file mode 100644 index 00000000000..b91068037b1 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-490 @@ -0,0 +1 @@ +foo|bar| baz \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-491 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-491 new file mode 100644 index 00000000000..11df74d8b46 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-491 @@ -0,0 +1 @@ +not_there | [0] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-492 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-492 new file mode 100644 index 00000000000..11df74d8b46 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-492 @@ -0,0 +1 @@ +not_there | [0] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-493 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-493 new file mode 100644 index 00000000000..37da9fc0b71 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-493 @@ -0,0 +1 @@ +[foo.bar, foo.other] | [0] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-494 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-494 new file mode 100644 index 00000000000..1f4fc943d70 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-494 @@ -0,0 +1 @@ +{"a": foo.bar, "b": foo.other} | a \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-495 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-495 new file mode 100644 index 00000000000..67c7ea9cfe4 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-495 @@ -0,0 +1 @@ +{"a": foo.bar, "b": foo.other} | b \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-496 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-496 new file mode 100644 index 00000000000..d87f9bba4cd --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-496 @@ -0,0 +1 @@ +{"a": foo.bar, "b": foo.other} | *.baz \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-497 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-497 new file mode 100644 index 00000000000..ebf8e271140 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-497 @@ -0,0 +1 @@ +foo.bam || foo.bar | baz \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-498 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-498 new file mode 100644 index 00000000000..f32bc6db510 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-498 @@ -0,0 +1 @@ +foo | not_there || bar \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-499 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-499 new file mode 100644 index 00000000000..d04459d9090 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-499 @@ -0,0 +1 @@ +foo[*].bar[*] | [0][0] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-5 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-5 new file mode 100644 index 00000000000..b537264a1d5 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-5 @@ -0,0 +1 @@ +foo.bar.bad \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-50 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-50 new file mode 100644 index 00000000000..c17c1df1706 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-50 @@ -0,0 +1 @@ +foo[?key == `null`] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-500 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-500 new file mode 100644 index 00000000000..3eb869f435b --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-500 @@ -0,0 +1 @@ +bar[0:10] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-501 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-501 new file mode 100644 index 00000000000..aa5d6be52c7 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-501 @@ -0,0 +1 @@ +foo[0:10:1] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-502 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-502 new file mode 100644 index 00000000000..1a4d1682da0 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-502 @@ -0,0 +1 @@ +foo[0:10] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-503 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-503 new file mode 100644 index 00000000000..5925a578b52 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-503 @@ -0,0 +1 @@ +foo[0:10:] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-504 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-504 new file mode 100644 index 00000000000..081e93abd98 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-504 @@ -0,0 +1 @@ +foo[0::1] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-505 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-505 new file mode 100644 index 00000000000..92270014959 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-505 @@ -0,0 +1 @@ +foo[0::] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-506 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-506 new file mode 100644 index 00000000000..fd2294d6646 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-506 @@ -0,0 +1 @@ +foo[0:] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-507 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-507 new file mode 100644 index 00000000000..c6b551d5eae --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-507 @@ -0,0 +1 @@ +foo[:10:1] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-508 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-508 new file mode 100644 index 00000000000..503f58da6e3 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-508 @@ -0,0 +1 @@ +foo[::1] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-509 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-509 new file mode 100644 index 00000000000..f78bb770caa --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-509 @@ -0,0 +1 @@ +foo[:10:] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-51 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-51 new file mode 100644 index 00000000000..589a214f453 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-51 @@ -0,0 +1 @@ +foo[?key == `[1]`] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-510 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-510 new file mode 100644 index 00000000000..eb9d2ba881e --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-510 @@ -0,0 +1 @@ +foo[::] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-511 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-511 new file mode 100644 index 00000000000..1921a3d9865 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-511 @@ -0,0 +1 @@ +foo[:] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-512 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-512 new file mode 100644 index 00000000000..a87afcb1b32 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-512 @@ -0,0 +1 @@ +foo[1:9] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-513 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-513 new file mode 100644 index 00000000000..dbf51d8cde4 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-513 @@ -0,0 +1 @@ +foo[0:10:2] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-514 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-514 new file mode 100644 index 00000000000..f7288763a71 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-514 @@ -0,0 +1 @@ +foo[5:] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-515 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-515 new file mode 100644 index 00000000000..64395761df6 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-515 @@ -0,0 +1 @@ +foo[5::2] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-516 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-516 new file mode 100644 index 00000000000..706bb14dd7e --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-516 @@ -0,0 +1 @@ +foo[::2] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-517 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-517 new file mode 100644 index 00000000000..8fcfaee95c6 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-517 @@ -0,0 +1 @@ +foo[::-1] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-518 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-518 new file mode 100644 index 00000000000..f6a00bf9bbc --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-518 @@ -0,0 +1 @@ +foo[1::2] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-519 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-519 new file mode 100644 index 00000000000..ea068ee06fb --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-519 @@ -0,0 +1 @@ +foo[10:0:-1] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-52 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-52 new file mode 100644 index 00000000000..214917ac068 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-52 @@ -0,0 +1 @@ +foo[?key == `{"a":2}`] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-520 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-520 new file mode 100644 index 00000000000..1fe14258edc --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-520 @@ -0,0 +1 @@ +foo[10:5:-1] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-521 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-521 new file mode 100644 index 00000000000..4ba0e130228 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-521 @@ -0,0 +1 @@ +foo[8:2:-2] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-522 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-522 new file mode 100644 index 00000000000..25db439ff7d --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-522 @@ -0,0 +1 @@ +foo[0:20] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-523 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-523 new file mode 100644 index 00000000000..8a965920af5 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-523 @@ -0,0 +1 @@ +foo[10:-20:-1] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-524 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-524 new file mode 100644 index 00000000000..b1e5ba3734f --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-524 @@ -0,0 +1 @@ +foo[10:-20] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-525 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-525 new file mode 100644 index 00000000000..06253112e4e --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-525 @@ -0,0 +1 @@ +foo[-4:-1] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-526 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-526 new file mode 100644 index 00000000000..1e14a6a4c5e --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-526 @@ -0,0 +1 @@ +foo[:-5:-1] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-527 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-527 new file mode 100644 index 00000000000..aef5c2747d2 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-527 @@ -0,0 +1 @@ +foo[:2].a \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-528 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-528 new file mode 100644 index 00000000000..93c95fcf689 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-528 @@ -0,0 +1 @@ +foo[:2].b \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-529 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-529 new file mode 100644 index 00000000000..7e0733e595e --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-529 @@ -0,0 +1 @@ +foo[:2].a.b \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-53 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-53 new file mode 100644 index 00000000000..4c002ed80d6 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-53 @@ -0,0 +1 @@ +foo[?`true` == key] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-530 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-530 new file mode 100644 index 00000000000..2438b25762d --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-530 @@ -0,0 +1 @@ +bar[::-1].a.b \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-531 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-531 new file mode 100644 index 00000000000..549994b6bc4 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-531 @@ -0,0 +1 @@ +bar[:2].a.b \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-532 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-532 new file mode 100644 index 00000000000..ab98292b452 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-532 @@ -0,0 +1 @@ +baz[:2].a \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-533 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-533 new file mode 100644 index 00000000000..65fca968764 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-533 @@ -0,0 +1 @@ +[:] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-534 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-534 new file mode 100644 index 00000000000..18c5daf7bea --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-534 @@ -0,0 +1 @@ +[:2].a \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-535 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-535 new file mode 100644 index 00000000000..1bb84f7d4bd --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-535 @@ -0,0 +1 @@ +[::-1].a \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-536 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-536 new file mode 100644 index 00000000000..7a0416f0566 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-536 @@ -0,0 +1 @@ +[:2].b \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-537 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-537 new file mode 100644 index 00000000000..4d5f9756e55 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-537 @@ -0,0 +1 @@ +foo.bar \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-538 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-538 new file mode 100644 index 00000000000..19102815663 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-538 @@ -0,0 +1 @@ +foo \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-539 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-539 new file mode 100644 index 00000000000..f59ec20aabf --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-539 @@ -0,0 +1 @@ +* \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-54 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-54 new file mode 100644 index 00000000000..23d27073e97 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-54 @@ -0,0 +1 @@ +foo[?`false` == key] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-540 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-540 new file mode 100644 index 00000000000..dee5695746e --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-540 @@ -0,0 +1 @@ +*.* \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-541 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-541 new file mode 100644 index 00000000000..1a16f7418d2 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-541 @@ -0,0 +1 @@ +*.foo \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-542 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-542 new file mode 100644 index 00000000000..7e8066d39f5 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-542 @@ -0,0 +1 @@ +*[0] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-543 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-543 new file mode 100644 index 00000000000..0637a088a01 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-543 @@ -0,0 +1 @@ +[] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-544 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-544 new file mode 100644 index 00000000000..6e7ea636eec --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-544 @@ -0,0 +1 @@ +[0] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-545 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-545 new file mode 100644 index 00000000000..5a5194647ad --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-545 @@ -0,0 +1 @@ +[*] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-546 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-546 new file mode 100644 index 00000000000..416127425c2 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-546 @@ -0,0 +1 @@ +*.["0"] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-547 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-547 new file mode 100644 index 00000000000..cd9fb6ba778 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-547 @@ -0,0 +1 @@ +[*].bar \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-548 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-548 new file mode 100644 index 00000000000..9f3ada48077 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-548 @@ -0,0 +1 @@ +[*][0] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-549 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-549 new file mode 100644 index 00000000000..9b0b2f8189b --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-549 @@ -0,0 +1 @@ +foo[0] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-55 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-55 new file mode 100644 index 00000000000..6d840ee568f --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-55 @@ -0,0 +1 @@ +foo[?`0` == key] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-550 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-550 new file mode 100644 index 00000000000..b23413b92af --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-550 @@ -0,0 +1 @@ +foo.[*] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-551 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-551 new file mode 100644 index 00000000000..08ab2e1c420 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-551 @@ -0,0 +1 @@ +foo.[abc] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-552 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-552 new file mode 100644 index 00000000000..78b05a5c64e --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-552 @@ -0,0 +1 @@ +foo.[abc, def] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-553 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-553 new file mode 100644 index 00000000000..1e7b886e79e --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-553 @@ -0,0 +1 @@ +a.{foo: bar} \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-554 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-554 new file mode 100644 index 00000000000..91b4c9896e1 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-554 @@ -0,0 +1 @@ +a.{foo: bar, baz: bam} \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-555 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-555 new file mode 100644 index 00000000000..8301ef981ef --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-555 @@ -0,0 +1 @@ +{"\\":{" ":*}} \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-556 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-556 new file mode 100644 index 00000000000..8f75cc91334 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-556 @@ -0,0 +1 @@ +foo || bar \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-557 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-557 new file mode 100644 index 00000000000..e5f122c5691 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-557 @@ -0,0 +1 @@ +foo.[a || b] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-558 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-558 new file mode 100644 index 00000000000..39d1914328b --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-558 @@ -0,0 +1 @@ +foo[?bar==`"baz"`] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-559 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-559 new file mode 100644 index 00000000000..d08bbe2501e --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-559 @@ -0,0 +1 @@ +foo[? bar == `"baz"` ] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-56 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-56 new file mode 100644 index 00000000000..addaf204c5b --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-56 @@ -0,0 +1 @@ +foo[?`1` == key] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-560 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-560 new file mode 100644 index 00000000000..a77f355812c --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-560 @@ -0,0 +1 @@ +foo[?a.b.c==d.e.f] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-561 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-561 new file mode 100644 index 00000000000..c9697aa4870 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-561 @@ -0,0 +1 @@ +foo[?bar==`[0, 1, 2]`] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-562 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-562 new file mode 100644 index 00000000000..fd7064a0868 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-562 @@ -0,0 +1 @@ +foo[?bar==`["a", "b", "c"]`] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-563 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-563 new file mode 100644 index 00000000000..61e5e1b8f71 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-563 @@ -0,0 +1 @@ +foo[?bar==`["foo\`bar"]`] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-564 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-564 new file mode 100644 index 00000000000..bc9d8af1d92 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-564 @@ -0,0 +1 @@ +[?"\\">`"foo"`] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-565 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-565 new file mode 100644 index 00000000000..2dd54dc3904 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-565 @@ -0,0 +1 @@ +[?"\\" > `"foo"`] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-566 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-566 new file mode 100644 index 00000000000..19102815663 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-566 @@ -0,0 +1 @@ +foo \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-567 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-567 new file mode 100644 index 00000000000..7e9668e7834 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-567 @@ -0,0 +1 @@ +"foo" \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-568 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-568 new file mode 100644 index 00000000000..d58ac16bf03 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-568 @@ -0,0 +1 @@ +"\\" \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-569 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-569 new file mode 100644 index 00000000000..33ac9fba6ff --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-569 @@ -0,0 +1 @@ +*||*|*|* \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-57 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-57 new file mode 100644 index 00000000000..acf2435c7cb --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-57 @@ -0,0 +1 @@ +foo[?`[0]` == key] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-570 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-570 new file mode 100644 index 00000000000..99e19638ce4 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-570 @@ -0,0 +1 @@ +*[]||[*] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-571 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-571 new file mode 100644 index 00000000000..be0845011c3 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-571 @@ -0,0 +1 @@ +[*.*] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-572 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-572 new file mode 100644 index 00000000000..a84b51e1cda --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-572 @@ -0,0 +1 @@ +foo[]."✓" \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-573 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-573 new file mode 100644 index 00000000000..c2de55815f0 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-573 @@ -0,0 +1 @@ +"☯" \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-574 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-574 new file mode 100644 index 00000000000..dc2dda0bb68 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-574 @@ -0,0 +1 @@ +"♪♫•*¨*•.¸¸❤¸¸.•*¨*•♫♪" \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-575 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-575 new file mode 100644 index 00000000000..a2d3d5f6ae0 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-575 @@ -0,0 +1 @@ +"☃" \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-576 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-576 new file mode 100644 index 00000000000..0971c37eaf7 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-576 @@ -0,0 +1 @@ +foo.*.baz \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-577 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-577 new file mode 100644 index 00000000000..0e39dfd695d --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-577 @@ -0,0 +1 @@ +foo.bar.* \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-578 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-578 new file mode 100644 index 00000000000..89c1ce22dc7 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-578 @@ -0,0 +1 @@ +foo.*.notbaz \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-579 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-579 new file mode 100644 index 00000000000..5199b9f95d4 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-579 @@ -0,0 +1 @@ +foo.*.notbaz[0] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-58 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-58 new file mode 100644 index 00000000000..99fe382c6c6 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-58 @@ -0,0 +1 @@ +foo[?`{"bar": [0]}` == key] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-580 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-580 new file mode 100644 index 00000000000..5bb6d4ae783 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-580 @@ -0,0 +1 @@ +foo.*.notbaz[-1] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-581 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-581 new file mode 100644 index 00000000000..edac73189d7 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-581 @@ -0,0 +1 @@ +foo.* \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-582 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-582 new file mode 100644 index 00000000000..458d0a6ddd0 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-582 @@ -0,0 +1 @@ +foo.*.* \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-583 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-583 new file mode 100644 index 00000000000..f757fd53459 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-583 @@ -0,0 +1 @@ +foo.*.*.* \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-584 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-584 new file mode 100644 index 00000000000..670049d96f7 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-584 @@ -0,0 +1 @@ +foo.*.*.*.* \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-585 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-585 new file mode 100644 index 00000000000..3c88caafe88 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-585 @@ -0,0 +1 @@ +*.bar \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-586 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-586 new file mode 100644 index 00000000000..f59ec20aabf --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-586 @@ -0,0 +1 @@ +* \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-587 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-587 new file mode 100644 index 00000000000..0852fcc7895 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-587 @@ -0,0 +1 @@ +*.sub1 \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-588 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-588 new file mode 100644 index 00000000000..dee5695746e --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-588 @@ -0,0 +1 @@ +*.* \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-589 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-589 new file mode 100644 index 00000000000..66781bba40a --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-589 @@ -0,0 +1 @@ +*.*.foo \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-59 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-59 new file mode 100644 index 00000000000..4aad20ae69e --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-59 @@ -0,0 +1 @@ +foo[?`null` == key] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-590 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-590 new file mode 100644 index 00000000000..0db15d97e44 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-590 @@ -0,0 +1 @@ +*.sub1.foo \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-591 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-591 new file mode 100644 index 00000000000..b24be9d7d1c --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-591 @@ -0,0 +1 @@ +foo[*].bar \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-592 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-592 new file mode 100644 index 00000000000..e6efe133fcd --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-592 @@ -0,0 +1 @@ +foo[*].notbar \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-593 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-593 new file mode 100644 index 00000000000..5a5194647ad --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-593 @@ -0,0 +1 @@ +[*] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-594 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-594 new file mode 100644 index 00000000000..cd9fb6ba778 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-594 @@ -0,0 +1 @@ +[*].bar \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-595 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-595 new file mode 100644 index 00000000000..cbf1a5d596a --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-595 @@ -0,0 +1 @@ +[*].notbar \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-596 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-596 new file mode 100644 index 00000000000..8bd13b7eb49 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-596 @@ -0,0 +1 @@ +foo.bar[*].baz \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-597 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-597 new file mode 100644 index 00000000000..7239f3e887e --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-597 @@ -0,0 +1 @@ +foo.bar[*].baz[0] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-598 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-598 new file mode 100644 index 00000000000..f5e431d9e3f --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-598 @@ -0,0 +1 @@ +foo.bar[*].baz[1] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-599 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-599 new file mode 100644 index 00000000000..d0c25953968 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-599 @@ -0,0 +1 @@ +foo.bar[*].baz[2] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-6 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-6 new file mode 100644 index 00000000000..b9749b74897 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-6 @@ -0,0 +1 @@ +foo.bad \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-60 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-60 new file mode 100644 index 00000000000..dac67509bb4 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-60 @@ -0,0 +1 @@ +foo[?`[1]` == key] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-600 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-600 new file mode 100644 index 00000000000..a6388271e41 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-600 @@ -0,0 +1 @@ +foo.bar[*].baz[3] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-601 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-601 new file mode 100644 index 00000000000..2a66ffe93b8 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-601 @@ -0,0 +1 @@ +foo.bar[*] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-602 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-602 new file mode 100644 index 00000000000..b6b3695438a --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-602 @@ -0,0 +1 @@ +foo.bar[0] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-603 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-603 new file mode 100644 index 00000000000..7e57f9e74ce --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-603 @@ -0,0 +1 @@ +foo.bar[0][0] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-604 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-604 new file mode 100644 index 00000000000..c5f8bef0bee --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-604 @@ -0,0 +1 @@ +foo.bar[0][0][0] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-605 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-605 new file mode 100644 index 00000000000..3decf08030f --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-605 @@ -0,0 +1 @@ +foo.bar[0][0][0][0] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-606 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-606 new file mode 100644 index 00000000000..655e2959bea --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-606 @@ -0,0 +1 @@ +foo[0][0] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-607 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-607 new file mode 100644 index 00000000000..2aa159718c8 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-607 @@ -0,0 +1 @@ +foo[*].bar[*].kind \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-608 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-608 new file mode 100644 index 00000000000..556b380bab1 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-608 @@ -0,0 +1 @@ +foo[*].bar[0].kind \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-609 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-609 new file mode 100644 index 00000000000..0de3229b83e --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-609 @@ -0,0 +1 @@ +foo[*].bar.kind \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-61 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-61 new file mode 100644 index 00000000000..130ed3b379e --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-61 @@ -0,0 +1 @@ +foo[?`{"a":2}` == key] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-610 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-610 new file mode 100644 index 00000000000..3b511f13351 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-610 @@ -0,0 +1 @@ +foo[*].bar[0] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-611 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-611 new file mode 100644 index 00000000000..c8dfa16e6bc --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-611 @@ -0,0 +1 @@ +foo[*].bar[1] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-612 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-612 new file mode 100644 index 00000000000..69f04ee23ff --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-612 @@ -0,0 +1 @@ +foo[*].bar[2] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-613 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-613 new file mode 100644 index 00000000000..3b511f13351 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-613 @@ -0,0 +1 @@ +foo[*].bar[0] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-614 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-614 new file mode 100644 index 00000000000..03e0c0cb93b --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-614 @@ -0,0 +1 @@ +foo[*][0] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-615 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-615 new file mode 100644 index 00000000000..ac1c8966821 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-615 @@ -0,0 +1 @@ +foo[*][1] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-616 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-616 new file mode 100644 index 00000000000..03e0c0cb93b --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-616 @@ -0,0 +1 @@ +foo[*][0] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-617 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-617 new file mode 100644 index 00000000000..ac1c8966821 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-617 @@ -0,0 +1 @@ +foo[*][1] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-618 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-618 new file mode 100644 index 00000000000..6494cf1c6a0 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-618 @@ -0,0 +1 @@ +foo[*][0][0] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-619 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-619 new file mode 100644 index 00000000000..1406be5721f --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-619 @@ -0,0 +1 @@ +foo[*][1][0] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-62 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-62 new file mode 100644 index 00000000000..3d15fcc1697 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-62 @@ -0,0 +1 @@ +foo[?key != `true`] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-620 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-620 new file mode 100644 index 00000000000..72b5aa281a9 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-620 @@ -0,0 +1 @@ +foo[*][0][1] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-621 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-621 new file mode 100644 index 00000000000..02a26491ae4 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-621 @@ -0,0 +1 @@ +foo[*][1][1] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-622 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-622 new file mode 100644 index 00000000000..cb08037e209 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-622 @@ -0,0 +1 @@ +foo[*][2] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-623 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-623 new file mode 100644 index 00000000000..91d695995a4 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-623 @@ -0,0 +1 @@ +foo[*][2][2] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-624 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-624 new file mode 100644 index 00000000000..f40f261ad17 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-624 @@ -0,0 +1 @@ +bar[*] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-625 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-625 new file mode 100644 index 00000000000..03904b1dece --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-625 @@ -0,0 +1 @@ +bar[*].baz[*] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-626 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-626 new file mode 100644 index 00000000000..fd7c21c340c --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-626 @@ -0,0 +1 @@ +string[*] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-627 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-627 new file mode 100644 index 00000000000..d7ca4719a99 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-627 @@ -0,0 +1 @@ +hash[*] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-628 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-628 new file mode 100644 index 00000000000..b3ddffe3cfe --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-628 @@ -0,0 +1 @@ +number[*] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-629 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-629 new file mode 100644 index 00000000000..c03cd39ebf5 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-629 @@ -0,0 +1 @@ +nullvalue[*] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-63 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-63 new file mode 100644 index 00000000000..08731af6908 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-63 @@ -0,0 +1 @@ +foo[?key != `false`] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-630 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-630 new file mode 100644 index 00000000000..b3c40cd533f --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-630 @@ -0,0 +1 @@ +string[*].foo \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-631 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-631 new file mode 100644 index 00000000000..c5930d543f3 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-631 @@ -0,0 +1 @@ +hash[*].foo \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-632 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-632 new file mode 100644 index 00000000000..cc0b1a4896a --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-632 @@ -0,0 +1 @@ +number[*].foo \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-633 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-633 new file mode 100644 index 00000000000..d677b965852 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-633 @@ -0,0 +1 @@ +nullvalue[*].foo \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-634 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-634 new file mode 100644 index 00000000000..c1166640155 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-634 @@ -0,0 +1 @@ +nullvalue[*].foo[*].bar \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-635 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-635 new file mode 100644 index 00000000000..e3399771088 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-635 @@ -0,0 +1 @@ +string.* \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-636 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-636 new file mode 100644 index 00000000000..76f53453a8a --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-636 @@ -0,0 +1 @@ +hash.* \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-637 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-637 new file mode 100644 index 00000000000..dd485072f26 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-637 @@ -0,0 +1 @@ +number.* \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-638 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-638 new file mode 100644 index 00000000000..16000c003cd --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-638 @@ -0,0 +1 @@ +array.* \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-639 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-639 new file mode 100644 index 00000000000..1d0d03ed3b5 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-639 @@ -0,0 +1 @@ +nullvalue.* \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-64 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-64 new file mode 100644 index 00000000000..b67aebe98ad --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-64 @@ -0,0 +1 @@ +foo[?key != `0`] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-640 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-640 new file mode 100644 index 00000000000..7e8066d39f5 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-640 @@ -0,0 +1 @@ +*[0] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-641 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-641 new file mode 100644 index 00000000000..41ebe5ba9d7 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-641 @@ -0,0 +1 @@ +`foo` \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-642 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-642 new file mode 100644 index 00000000000..fe0397993c5 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-642 @@ -0,0 +1 @@ +`foo\"quote` \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-643 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-643 new file mode 100644 index 00000000000..1a27fd80c3c --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-643 @@ -0,0 +1 @@ +`✓` \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-644 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-644 new file mode 100644 index 00000000000..559a13456be --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-644 @@ -0,0 +1 @@ +`foo\"bar` \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-645 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-645 new file mode 100644 index 00000000000..e31621b438e --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-645 @@ -0,0 +1 @@ +`1\`` \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-646 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-646 new file mode 100644 index 00000000000..6bf7a10362a --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-646 @@ -0,0 +1 @@ +`\\`.{a:`b`} \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-647 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-647 new file mode 100644 index 00000000000..41ebe5ba9d7 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-647 @@ -0,0 +1 @@ +`foo` \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-648 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-648 new file mode 100644 index 00000000000..28b9bcbbb52 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-648 @@ -0,0 +1 @@ +` foo` \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-649 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-649 new file mode 100644 index 00000000000..41ebe5ba9d7 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-649 @@ -0,0 +1 @@ +`foo` \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-65 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-65 new file mode 100644 index 00000000000..d3ac793bb6b --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-65 @@ -0,0 +1 @@ +foo[?key != `1`] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-650 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-650 new file mode 100644 index 00000000000..fe0397993c5 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-650 @@ -0,0 +1 @@ +`foo\"quote` \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-651 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-651 new file mode 100644 index 00000000000..1a27fd80c3c --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-651 @@ -0,0 +1 @@ +`✓` \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-652 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-652 new file mode 100644 index 00000000000..559a13456be --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-652 @@ -0,0 +1 @@ +`foo\"bar` \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-653 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-653 new file mode 100644 index 00000000000..e31621b438e --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-653 @@ -0,0 +1 @@ +`1\`` \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-654 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-654 new file mode 100644 index 00000000000..6bf7a10362a --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-654 @@ -0,0 +1 @@ +`\\`.{a:`b`} \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-655 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-655 new file mode 100644 index 00000000000..41ebe5ba9d7 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-655 @@ -0,0 +1 @@ +`foo` \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-656 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-656 new file mode 100644 index 00000000000..28b9bcbbb52 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-656 @@ -0,0 +1 @@ +` foo` \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-66 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-66 new file mode 100644 index 00000000000..065295bc17a --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-66 @@ -0,0 +1 @@ +foo[?key != `null`] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-67 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-67 new file mode 100644 index 00000000000..43d164927d4 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-67 @@ -0,0 +1 @@ +foo[?key != `[1]`] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-68 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-68 new file mode 100644 index 00000000000..6b884fa866f --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-68 @@ -0,0 +1 @@ +foo[?key != `{"a":2}`] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-69 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-69 new file mode 100644 index 00000000000..d85c779d0a3 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-69 @@ -0,0 +1 @@ +foo[?`true` != key] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-7 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-7 new file mode 100644 index 00000000000..44d6628cdc6 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-7 @@ -0,0 +1 @@ +bad \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-70 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-70 new file mode 100644 index 00000000000..3e6dcf3045a --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-70 @@ -0,0 +1 @@ +foo[?`false` != key] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-71 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-71 new file mode 100644 index 00000000000..bdb820b30b3 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-71 @@ -0,0 +1 @@ +foo[?`0` != key] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-72 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-72 new file mode 100644 index 00000000000..3f3048a004c --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-72 @@ -0,0 +1 @@ +foo[?`1` != key] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-73 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-73 new file mode 100644 index 00000000000..dacc2572451 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-73 @@ -0,0 +1 @@ +foo[?`null` != key] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-74 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-74 new file mode 100644 index 00000000000..32ebae8800b --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-74 @@ -0,0 +1 @@ +foo[?`[1]` != key] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-75 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-75 new file mode 100644 index 00000000000..dcd023e0fbc --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-75 @@ -0,0 +1 @@ +foo[?`{"a":2}` != key] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-76 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-76 new file mode 100644 index 00000000000..e08cc13cbe3 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-76 @@ -0,0 +1 @@ +reservations[].instances[?bar==`1`] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-77 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-77 new file mode 100644 index 00000000000..1ec43f45fce --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-77 @@ -0,0 +1 @@ +reservations[*].instances[?bar==`1`] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-78 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-78 new file mode 100644 index 00000000000..30387116349 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-78 @@ -0,0 +1 @@ +reservations[].instances[?bar==`1`][] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-79 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-79 new file mode 100644 index 00000000000..e3875746b35 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-79 @@ -0,0 +1 @@ +foo[?bar==`1`].bar[0] \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-8 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-8 new file mode 100644 index 00000000000..da7bc1ccfd0 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-8 @@ -0,0 +1 @@ +bad.morebad.morebad \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-80 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-80 new file mode 100644 index 00000000000..5c3d683565d --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-80 @@ -0,0 +1 @@ +foo[?a==`1`].b.c \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-81 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-81 new file mode 100644 index 00000000000..6232808f0ae --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-81 @@ -0,0 +1 @@ +abs(foo) \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-82 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-82 new file mode 100644 index 00000000000..6232808f0ae --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-82 @@ -0,0 +1 @@ +abs(foo) \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-83 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-83 new file mode 100644 index 00000000000..29497f4ff54 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-83 @@ -0,0 +1 @@ +abs(array[1]) \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-84 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-84 new file mode 100644 index 00000000000..29497f4ff54 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-84 @@ -0,0 +1 @@ +abs(array[1]) \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-85 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-85 new file mode 100644 index 00000000000..346696563f8 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-85 @@ -0,0 +1 @@ +abs(`-24`) \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-86 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-86 new file mode 100644 index 00000000000..346696563f8 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-86 @@ -0,0 +1 @@ +abs(`-24`) \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-87 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-87 new file mode 100644 index 00000000000..c6268f8473b --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-87 @@ -0,0 +1 @@ +avg(numbers) \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-88 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-88 new file mode 100644 index 00000000000..7ce703695ee --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-88 @@ -0,0 +1 @@ +ceil(`1.2`) \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-89 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-89 new file mode 100644 index 00000000000..0561bc26d9a --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-89 @@ -0,0 +1 @@ +ceil(decimals[0]) \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-9 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-9 new file mode 100644 index 00000000000..19102815663 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-9 @@ -0,0 +1 @@ +foo \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-90 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-90 new file mode 100644 index 00000000000..c78c1fc3002 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-90 @@ -0,0 +1 @@ +ceil(decimals[1]) \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-91 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-91 new file mode 100644 index 00000000000..ebcb4bbdbb9 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-91 @@ -0,0 +1 @@ +ceil(decimals[2]) \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-92 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-92 new file mode 100644 index 00000000000..6edbf1afe4a --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-92 @@ -0,0 +1 @@ +contains('abc', 'a') \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-93 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-93 new file mode 100644 index 00000000000..d2b2f070dab --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-93 @@ -0,0 +1 @@ +contains('abc', 'd') \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-94 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-94 new file mode 100644 index 00000000000..3535da2eca6 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-94 @@ -0,0 +1 @@ +contains(strings, 'a') \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-95 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-95 new file mode 100644 index 00000000000..ba839fe60d1 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-95 @@ -0,0 +1 @@ +contains(decimals, `1.2`) \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-96 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-96 new file mode 100644 index 00000000000..f4358186979 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-96 @@ -0,0 +1 @@ +contains(decimals, `false`) \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-97 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-97 new file mode 100644 index 00000000000..adb65fc01f0 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-97 @@ -0,0 +1 @@ +ends_with(str, 'r') \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-98 b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-98 new file mode 100644 index 00000000000..93d6901bead --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/corpus/expr-98 @@ -0,0 +1 @@ +ends_with(str, 'tr') \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/jmespath.go b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/jmespath.go new file mode 100644 index 00000000000..c7df08782a1 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/fuzz/jmespath.go @@ -0,0 +1,13 @@ +package jmespath + +import "github.com/jmespath/go-jmespath" + +// Fuzz will fuzz test the JMESPath parser. +func Fuzz(data []byte) int { + p := jmespath.NewParser() + _, err := p.Parse(string(data)) + if err != nil { + return 1 + } + return 0 +} diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/interpreter.go b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/interpreter.go new file mode 100644 index 00000000000..13c74604c2c --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/interpreter.go @@ -0,0 +1,418 @@ +package jmespath + +import ( + "errors" + "reflect" + "unicode" + "unicode/utf8" +) + +/* This is a tree based interpreter. It walks the AST and directly + interprets the AST to search through a JSON document. +*/ + +type treeInterpreter struct { + fCall *functionCaller +} + +func newInterpreter() *treeInterpreter { + interpreter := treeInterpreter{} + interpreter.fCall = newFunctionCaller() + return &interpreter +} + +type expRef struct { + ref ASTNode +} + +// Execute takes an ASTNode and input data and interprets the AST directly. +// It will produce the result of applying the JMESPath expression associated +// with the ASTNode to the input data "value". +func (intr *treeInterpreter) Execute(node ASTNode, value interface{}) (interface{}, error) { + switch node.nodeType { + case ASTComparator: + left, err := intr.Execute(node.children[0], value) + if err != nil { + return nil, err + } + right, err := intr.Execute(node.children[1], value) + if err != nil { + return nil, err + } + switch node.value { + case tEQ: + return objsEqual(left, right), nil + case tNE: + return !objsEqual(left, right), nil + } + leftNum, ok := left.(float64) + if !ok { + return nil, nil + } + rightNum, ok := right.(float64) + if !ok { + return nil, nil + } + switch node.value { + case tGT: + return leftNum > rightNum, nil + case tGTE: + return leftNum >= rightNum, nil + case tLT: + return leftNum < rightNum, nil + case tLTE: + return leftNum <= rightNum, nil + } + case ASTExpRef: + return expRef{ref: node.children[0]}, nil + case ASTFunctionExpression: + resolvedArgs := []interface{}{} + for _, arg := range node.children { + current, err := intr.Execute(arg, value) + if err != nil { + return nil, err + } + resolvedArgs = append(resolvedArgs, current) + } + return intr.fCall.CallFunction(node.value.(string), resolvedArgs, intr) + case ASTField: + if m, ok := value.(map[string]interface{}); ok { + key := node.value.(string) + return m[key], nil + } + return intr.fieldFromStruct(node.value.(string), value) + case ASTFilterProjection: + left, err := intr.Execute(node.children[0], value) + if err != nil { + return nil, nil + } + sliceType, ok := left.([]interface{}) + if !ok { + if isSliceType(left) { + return intr.filterProjectionWithReflection(node, left) + } + return nil, nil + } + compareNode := node.children[2] + collected := []interface{}{} + for _, element := range sliceType { + result, err := intr.Execute(compareNode, element) + if err != nil { + return nil, err + } + if !isFalse(result) { + current, err := intr.Execute(node.children[1], element) + if err != nil { + return nil, err + } + if current != nil { + collected = append(collected, current) + } + } + } + return collected, nil + case ASTFlatten: + left, err := intr.Execute(node.children[0], value) + if err != nil { + return nil, nil + } + sliceType, ok := left.([]interface{}) + if !ok { + // If we can't type convert to []interface{}, there's + // a chance this could still work via reflection if we're + // dealing with user provided types. + if isSliceType(left) { + return intr.flattenWithReflection(left) + } + return nil, nil + } + flattened := []interface{}{} + for _, element := range sliceType { + if elementSlice, ok := element.([]interface{}); ok { + flattened = append(flattened, elementSlice...) + } else if isSliceType(element) { + reflectFlat := []interface{}{} + v := reflect.ValueOf(element) + for i := 0; i < v.Len(); i++ { + reflectFlat = append(reflectFlat, v.Index(i).Interface()) + } + flattened = append(flattened, reflectFlat...) + } else { + flattened = append(flattened, element) + } + } + return flattened, nil + case ASTIdentity, ASTCurrentNode: + return value, nil + case ASTIndex: + if sliceType, ok := value.([]interface{}); ok { + index := node.value.(int) + if index < 0 { + index += len(sliceType) + } + if index < len(sliceType) && index >= 0 { + return sliceType[index], nil + } + return nil, nil + } + // Otherwise try via reflection. + rv := reflect.ValueOf(value) + if rv.Kind() == reflect.Slice { + index := node.value.(int) + if index < 0 { + index += rv.Len() + } + if index < rv.Len() && index >= 0 { + v := rv.Index(index) + return v.Interface(), nil + } + } + return nil, nil + case ASTKeyValPair: + return intr.Execute(node.children[0], value) + case ASTLiteral: + return node.value, nil + case ASTMultiSelectHash: + if value == nil { + return nil, nil + } + collected := make(map[string]interface{}) + for _, child := range node.children { + current, err := intr.Execute(child, value) + if err != nil { + return nil, err + } + key := child.value.(string) + collected[key] = current + } + return collected, nil + case ASTMultiSelectList: + if value == nil { + return nil, nil + } + collected := []interface{}{} + for _, child := range node.children { + current, err := intr.Execute(child, value) + if err != nil { + return nil, err + } + collected = append(collected, current) + } + return collected, nil + case ASTOrExpression: + matched, err := intr.Execute(node.children[0], value) + if err != nil { + return nil, err + } + if isFalse(matched) { + matched, err = intr.Execute(node.children[1], value) + if err != nil { + return nil, err + } + } + return matched, nil + case ASTAndExpression: + matched, err := intr.Execute(node.children[0], value) + if err != nil { + return nil, err + } + if isFalse(matched) { + return matched, nil + } + return intr.Execute(node.children[1], value) + case ASTNotExpression: + matched, err := intr.Execute(node.children[0], value) + if err != nil { + return nil, err + } + if isFalse(matched) { + return true, nil + } + return false, nil + case ASTPipe: + result := value + var err error + for _, child := range node.children { + result, err = intr.Execute(child, result) + if err != nil { + return nil, err + } + } + return result, nil + case ASTProjection: + left, err := intr.Execute(node.children[0], value) + if err != nil { + return nil, err + } + sliceType, ok := left.([]interface{}) + if !ok { + if isSliceType(left) { + return intr.projectWithReflection(node, left) + } + return nil, nil + } + collected := []interface{}{} + var current interface{} + for _, element := range sliceType { + current, err = intr.Execute(node.children[1], element) + if err != nil { + return nil, err + } + if current != nil { + collected = append(collected, current) + } + } + return collected, nil + case ASTSubexpression, ASTIndexExpression: + left, err := intr.Execute(node.children[0], value) + if err != nil { + return nil, err + } + return intr.Execute(node.children[1], left) + case ASTSlice: + sliceType, ok := value.([]interface{}) + if !ok { + if isSliceType(value) { + return intr.sliceWithReflection(node, value) + } + return nil, nil + } + parts := node.value.([]*int) + sliceParams := make([]sliceParam, 3) + for i, part := range parts { + if part != nil { + sliceParams[i].Specified = true + sliceParams[i].N = *part + } + } + return slice(sliceType, sliceParams) + case ASTValueProjection: + left, err := intr.Execute(node.children[0], value) + if err != nil { + return nil, nil + } + mapType, ok := left.(map[string]interface{}) + if !ok { + return nil, nil + } + values := make([]interface{}, len(mapType)) + for _, value := range mapType { + values = append(values, value) + } + collected := []interface{}{} + for _, element := range values { + current, err := intr.Execute(node.children[1], element) + if err != nil { + return nil, err + } + if current != nil { + collected = append(collected, current) + } + } + return collected, nil + } + return nil, errors.New("Unknown AST node: " + node.nodeType.String()) +} + +func (intr *treeInterpreter) fieldFromStruct(key string, value interface{}) (interface{}, error) { + rv := reflect.ValueOf(value) + first, n := utf8.DecodeRuneInString(key) + fieldName := string(unicode.ToUpper(first)) + key[n:] + if rv.Kind() == reflect.Struct { + v := rv.FieldByName(fieldName) + if !v.IsValid() { + return nil, nil + } + return v.Interface(), nil + } else if rv.Kind() == reflect.Ptr { + // Handle multiple levels of indirection? + if rv.IsNil() { + return nil, nil + } + rv = rv.Elem() + v := rv.FieldByName(fieldName) + if !v.IsValid() { + return nil, nil + } + return v.Interface(), nil + } + return nil, nil +} + +func (intr *treeInterpreter) flattenWithReflection(value interface{}) (interface{}, error) { + v := reflect.ValueOf(value) + flattened := []interface{}{} + for i := 0; i < v.Len(); i++ { + element := v.Index(i).Interface() + if reflect.TypeOf(element).Kind() == reflect.Slice { + // Then insert the contents of the element + // slice into the flattened slice, + // i.e flattened = append(flattened, mySlice...) + elementV := reflect.ValueOf(element) + for j := 0; j < elementV.Len(); j++ { + flattened = append( + flattened, elementV.Index(j).Interface()) + } + } else { + flattened = append(flattened, element) + } + } + return flattened, nil +} + +func (intr *treeInterpreter) sliceWithReflection(node ASTNode, value interface{}) (interface{}, error) { + v := reflect.ValueOf(value) + parts := node.value.([]*int) + sliceParams := make([]sliceParam, 3) + for i, part := range parts { + if part != nil { + sliceParams[i].Specified = true + sliceParams[i].N = *part + } + } + final := []interface{}{} + for i := 0; i < v.Len(); i++ { + element := v.Index(i).Interface() + final = append(final, element) + } + return slice(final, sliceParams) +} + +func (intr *treeInterpreter) filterProjectionWithReflection(node ASTNode, value interface{}) (interface{}, error) { + compareNode := node.children[2] + collected := []interface{}{} + v := reflect.ValueOf(value) + for i := 0; i < v.Len(); i++ { + element := v.Index(i).Interface() + result, err := intr.Execute(compareNode, element) + if err != nil { + return nil, err + } + if !isFalse(result) { + current, err := intr.Execute(node.children[1], element) + if err != nil { + return nil, err + } + if current != nil { + collected = append(collected, current) + } + } + } + return collected, nil +} + +func (intr *treeInterpreter) projectWithReflection(node ASTNode, value interface{}) (interface{}, error) { + collected := []interface{}{} + v := reflect.ValueOf(value) + for i := 0; i < v.Len(); i++ { + element := v.Index(i).Interface() + result, err := intr.Execute(node.children[1], element) + if err != nil { + return nil, err + } + if result != nil { + collected = append(collected, result) + } + } + return collected, nil +} diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/interpreter_test.go b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/interpreter_test.go new file mode 100644 index 00000000000..5b529c4f313 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/interpreter_test.go @@ -0,0 +1,213 @@ +package jmespath + +import ( + "encoding/json" + "testing" + + "github.com/stretchr/testify/assert" +) + +type scalars struct { + Foo string + Bar string +} + +type sliceType struct { + A string + B []scalars + C []*scalars +} + +type benchmarkStruct struct { + Fooasdfasdfasdfasdf string +} + +type benchmarkNested struct { + Fooasdfasdfasdfasdf nestedA +} + +type nestedA struct { + Fooasdfasdfasdfasdf nestedB +} + +type nestedB struct { + Fooasdfasdfasdfasdf nestedC +} + +type nestedC struct { + Fooasdfasdfasdfasdf string +} + +type nestedSlice struct { + A []sliceType +} + +func TestCanSupportEmptyInterface(t *testing.T) { + assert := assert.New(t) + data := make(map[string]interface{}) + data["foo"] = "bar" + result, err := Search("foo", data) + assert.Nil(err) + assert.Equal("bar", result) +} + +func TestCanSupportUserDefinedStructsValue(t *testing.T) { + assert := assert.New(t) + s := scalars{Foo: "one", Bar: "bar"} + result, err := Search("Foo", s) + assert.Nil(err) + assert.Equal("one", result) +} + +func TestCanSupportUserDefinedStructsRef(t *testing.T) { + assert := assert.New(t) + s := scalars{Foo: "one", Bar: "bar"} + result, err := Search("Foo", &s) + assert.Nil(err) + assert.Equal("one", result) +} + +func TestCanSupportStructWithSliceAll(t *testing.T) { + assert := assert.New(t) + data := sliceType{A: "foo", B: []scalars{scalars{"f1", "b1"}, scalars{"correct", "b2"}}} + result, err := Search("B[].Foo", data) + assert.Nil(err) + assert.Equal([]interface{}{"f1", "correct"}, result) +} + +func TestCanSupportStructWithSlicingExpression(t *testing.T) { + assert := assert.New(t) + data := sliceType{A: "foo", B: []scalars{scalars{"f1", "b1"}, scalars{"correct", "b2"}}} + result, err := Search("B[:].Foo", data) + assert.Nil(err) + assert.Equal([]interface{}{"f1", "correct"}, result) +} + +func TestCanSupportStructWithFilterProjection(t *testing.T) { + assert := assert.New(t) + data := sliceType{A: "foo", B: []scalars{scalars{"f1", "b1"}, scalars{"correct", "b2"}}} + result, err := Search("B[? `true` ].Foo", data) + assert.Nil(err) + assert.Equal([]interface{}{"f1", "correct"}, result) +} + +func TestCanSupportStructWithSlice(t *testing.T) { + assert := assert.New(t) + data := sliceType{A: "foo", B: []scalars{scalars{"f1", "b1"}, scalars{"correct", "b2"}}} + result, err := Search("B[-1].Foo", data) + assert.Nil(err) + assert.Equal("correct", result) +} + +func TestCanSupportStructWithOrExpressions(t *testing.T) { + assert := assert.New(t) + data := sliceType{A: "foo", C: nil} + result, err := Search("C || A", data) + assert.Nil(err) + assert.Equal("foo", result) +} + +func TestCanSupportStructWithSlicePointer(t *testing.T) { + assert := assert.New(t) + data := sliceType{A: "foo", C: []*scalars{&scalars{"f1", "b1"}, &scalars{"correct", "b2"}}} + result, err := Search("C[-1].Foo", data) + assert.Nil(err) + assert.Equal("correct", result) +} + +func TestWillAutomaticallyCapitalizeFieldNames(t *testing.T) { + assert := assert.New(t) + s := scalars{Foo: "one", Bar: "bar"} + // Note that there's a lower cased "foo" instead of "Foo", + // but it should still correspond to the Foo field in the + // scalars struct + result, err := Search("foo", &s) + assert.Nil(err) + assert.Equal("one", result) +} + +func TestCanSupportStructWithSliceLowerCased(t *testing.T) { + assert := assert.New(t) + data := sliceType{A: "foo", B: []scalars{scalars{"f1", "b1"}, scalars{"correct", "b2"}}} + result, err := Search("b[-1].foo", data) + assert.Nil(err) + assert.Equal("correct", result) +} + +func TestCanSupportStructWithNestedPointers(t *testing.T) { + assert := assert.New(t) + data := struct{ A *struct{ B int } }{} + result, err := Search("A.B", data) + assert.Nil(err) + assert.Nil(result) +} + +func TestCanSupportFlattenNestedSlice(t *testing.T) { + assert := assert.New(t) + data := nestedSlice{A: []sliceType{ + {B: []scalars{{Foo: "f1a"}, {Foo: "f1b"}}}, + {B: []scalars{{Foo: "f2a"}, {Foo: "f2b"}}}, + }} + result, err := Search("A[].B[].Foo", data) + assert.Nil(err) + assert.Equal([]interface{}{"f1a", "f1b", "f2a", "f2b"}, result) +} + +func TestCanSupportFlattenNestedEmptySlice(t *testing.T) { + assert := assert.New(t) + data := nestedSlice{A: []sliceType{ + {}, {B: []scalars{{Foo: "a"}}}, + }} + result, err := Search("A[].B[].Foo", data) + assert.Nil(err) + assert.Equal([]interface{}{"a"}, result) +} + +func TestCanSupportProjectionsWithStructs(t *testing.T) { + assert := assert.New(t) + data := nestedSlice{A: []sliceType{ + {A: "first"}, {A: "second"}, {A: "third"}, + }} + result, err := Search("A[*].A", data) + assert.Nil(err) + assert.Equal([]interface{}{"first", "second", "third"}, result) +} + +func BenchmarkInterpretSingleFieldStruct(b *testing.B) { + intr := newInterpreter() + parser := NewParser() + ast, _ := parser.Parse("fooasdfasdfasdfasdf") + data := benchmarkStruct{"foobarbazqux"} + for i := 0; i < b.N; i++ { + intr.Execute(ast, &data) + } +} + +func BenchmarkInterpretNestedStruct(b *testing.B) { + intr := newInterpreter() + parser := NewParser() + ast, _ := parser.Parse("fooasdfasdfasdfasdf.fooasdfasdfasdfasdf.fooasdfasdfasdfasdf.fooasdfasdfasdfasdf") + data := benchmarkNested{ + nestedA{ + nestedB{ + nestedC{"foobarbazqux"}, + }, + }, + } + for i := 0; i < b.N; i++ { + intr.Execute(ast, &data) + } +} + +func BenchmarkInterpretNestedMaps(b *testing.B) { + jsonData := []byte(`{"fooasdfasdfasdfasdf": {"fooasdfasdfasdfasdf": {"fooasdfasdfasdfasdf": {"fooasdfasdfasdfasdf": "foobarbazqux"}}}}`) + var data interface{} + json.Unmarshal(jsonData, &data) + + intr := newInterpreter() + parser := NewParser() + ast, _ := parser.Parse("fooasdfasdfasdfasdf.fooasdfasdfasdfasdf.fooasdfasdfasdfasdf.fooasdfasdfasdfasdf") + for i := 0; i < b.N; i++ { + intr.Execute(ast, data) + } +} diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/lexer.go b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/lexer.go new file mode 100644 index 00000000000..817900c8f52 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/lexer.go @@ -0,0 +1,420 @@ +package jmespath + +import ( + "bytes" + "encoding/json" + "fmt" + "strconv" + "strings" + "unicode/utf8" +) + +type token struct { + tokenType tokType + value string + position int + length int +} + +type tokType int + +const eof = -1 + +// Lexer contains information about the expression being tokenized. +type Lexer struct { + expression string // The expression provided by the user. + currentPos int // The current position in the string. + lastWidth int // The width of the current rune. This + buf bytes.Buffer // Internal buffer used for building up values. +} + +// SyntaxError is the main error used whenever a lexing or parsing error occurs. +type SyntaxError struct { + msg string // Error message displayed to user + Expression string // Expression that generated a SyntaxError + Offset int // The location in the string where the error occurred +} + +func (e SyntaxError) Error() string { + // In the future, it would be good to underline the specific + // location where the error occurred. + return "SyntaxError: " + e.msg +} + +// HighlightLocation will show where the syntax error occurred. +// It will place a "^" character on a line below the expression +// at the point where the syntax error occurred. +func (e SyntaxError) HighlightLocation() string { + return e.Expression + "\n" + strings.Repeat(" ", e.Offset) + "^" +} + +//go:generate stringer -type=tokType +const ( + tUnknown tokType = iota + tStar + tDot + tFilter + tFlatten + tLparen + tRparen + tLbracket + tRbracket + tLbrace + tRbrace + tOr + tPipe + tNumber + tUnquotedIdentifier + tQuotedIdentifier + tComma + tColon + tLT + tLTE + tGT + tGTE + tEQ + tNE + tJSONLiteral + tStringLiteral + tCurrent + tExpref + tAnd + tNot + tEOF +) + +var basicTokens = map[rune]tokType{ + '.': tDot, + '*': tStar, + ',': tComma, + ':': tColon, + '{': tLbrace, + '}': tRbrace, + ']': tRbracket, // tLbracket not included because it could be "[]" + '(': tLparen, + ')': tRparen, + '@': tCurrent, +} + +// Bit mask for [a-zA-Z_] shifted down 64 bits to fit in a single uint64. +// When using this bitmask just be sure to shift the rune down 64 bits +// before checking against identifierStartBits. +const identifierStartBits uint64 = 576460745995190270 + +// Bit mask for [a-zA-Z0-9], 128 bits -> 2 uint64s. +var identifierTrailingBits = [2]uint64{287948901175001088, 576460745995190270} + +var whiteSpace = map[rune]bool{ + ' ': true, '\t': true, '\n': true, '\r': true, +} + +func (t token) String() string { + return fmt.Sprintf("Token{%+v, %s, %d, %d}", + t.tokenType, t.value, t.position, t.length) +} + +// NewLexer creates a new JMESPath lexer. +func NewLexer() *Lexer { + lexer := Lexer{} + return &lexer +} + +func (lexer *Lexer) next() rune { + if lexer.currentPos >= len(lexer.expression) { + lexer.lastWidth = 0 + return eof + } + r, w := utf8.DecodeRuneInString(lexer.expression[lexer.currentPos:]) + lexer.lastWidth = w + lexer.currentPos += w + return r +} + +func (lexer *Lexer) back() { + lexer.currentPos -= lexer.lastWidth +} + +func (lexer *Lexer) peek() rune { + t := lexer.next() + lexer.back() + return t +} + +// tokenize takes an expression and returns corresponding tokens. +func (lexer *Lexer) tokenize(expression string) ([]token, error) { + var tokens []token + lexer.expression = expression + lexer.currentPos = 0 + lexer.lastWidth = 0 +loop: + for { + r := lexer.next() + if identifierStartBits&(1<<(uint64(r)-64)) > 0 { + t := lexer.consumeUnquotedIdentifier() + tokens = append(tokens, t) + } else if val, ok := basicTokens[r]; ok { + // Basic single char token. + t := token{ + tokenType: val, + value: string(r), + position: lexer.currentPos - lexer.lastWidth, + length: 1, + } + tokens = append(tokens, t) + } else if r == '-' || (r >= '0' && r <= '9') { + t := lexer.consumeNumber() + tokens = append(tokens, t) + } else if r == '[' { + t := lexer.consumeLBracket() + tokens = append(tokens, t) + } else if r == '"' { + t, err := lexer.consumeQuotedIdentifier() + if err != nil { + return tokens, err + } + tokens = append(tokens, t) + } else if r == '\'' { + t, err := lexer.consumeRawStringLiteral() + if err != nil { + return tokens, err + } + tokens = append(tokens, t) + } else if r == '`' { + t, err := lexer.consumeLiteral() + if err != nil { + return tokens, err + } + tokens = append(tokens, t) + } else if r == '|' { + t := lexer.matchOrElse(r, '|', tOr, tPipe) + tokens = append(tokens, t) + } else if r == '<' { + t := lexer.matchOrElse(r, '=', tLTE, tLT) + tokens = append(tokens, t) + } else if r == '>' { + t := lexer.matchOrElse(r, '=', tGTE, tGT) + tokens = append(tokens, t) + } else if r == '!' { + t := lexer.matchOrElse(r, '=', tNE, tNot) + tokens = append(tokens, t) + } else if r == '=' { + t := lexer.matchOrElse(r, '=', tEQ, tUnknown) + tokens = append(tokens, t) + } else if r == '&' { + t := lexer.matchOrElse(r, '&', tAnd, tExpref) + tokens = append(tokens, t) + } else if r == eof { + break loop + } else if _, ok := whiteSpace[r]; ok { + // Ignore whitespace + } else { + return tokens, lexer.syntaxError(fmt.Sprintf("Unknown char: %s", strconv.QuoteRuneToASCII(r))) + } + } + tokens = append(tokens, token{tEOF, "", len(lexer.expression), 0}) + return tokens, nil +} + +// Consume characters until the ending rune "r" is reached. +// If the end of the expression is reached before seeing the +// terminating rune "r", then an error is returned. +// If no error occurs then the matching substring is returned. +// The returned string will not include the ending rune. +func (lexer *Lexer) consumeUntil(end rune) (string, error) { + start := lexer.currentPos + current := lexer.next() + for current != end && current != eof { + if current == '\\' && lexer.peek() != eof { + lexer.next() + } + current = lexer.next() + } + if lexer.lastWidth == 0 { + // Then we hit an EOF so we never reached the closing + // delimiter. + return "", SyntaxError{ + msg: "Unclosed delimiter: " + string(end), + Expression: lexer.expression, + Offset: len(lexer.expression), + } + } + return lexer.expression[start : lexer.currentPos-lexer.lastWidth], nil +} + +func (lexer *Lexer) consumeLiteral() (token, error) { + start := lexer.currentPos + value, err := lexer.consumeUntil('`') + if err != nil { + return token{}, err + } + value = strings.Replace(value, "\\`", "`", -1) + return token{ + tokenType: tJSONLiteral, + value: value, + position: start, + length: len(value), + }, nil +} + +func (lexer *Lexer) consumeRawStringLiteral() (token, error) { + start := lexer.currentPos + currentIndex := start + current := lexer.next() + for current != '\'' && lexer.peek() != eof { + if current == '\\' && lexer.peek() == '\'' { + chunk := lexer.expression[currentIndex : lexer.currentPos-1] + lexer.buf.WriteString(chunk) + lexer.buf.WriteString("'") + lexer.next() + currentIndex = lexer.currentPos + } + current = lexer.next() + } + if lexer.lastWidth == 0 { + // Then we hit an EOF so we never reached the closing + // delimiter. + return token{}, SyntaxError{ + msg: "Unclosed delimiter: '", + Expression: lexer.expression, + Offset: len(lexer.expression), + } + } + if currentIndex < lexer.currentPos { + lexer.buf.WriteString(lexer.expression[currentIndex : lexer.currentPos-1]) + } + value := lexer.buf.String() + // Reset the buffer so it can reused again. + lexer.buf.Reset() + return token{ + tokenType: tStringLiteral, + value: value, + position: start, + length: len(value), + }, nil +} + +func (lexer *Lexer) syntaxError(msg string) SyntaxError { + return SyntaxError{ + msg: msg, + Expression: lexer.expression, + Offset: lexer.currentPos - 1, + } +} + +// Checks for a two char token, otherwise matches a single character +// token. This is used whenever a two char token overlaps a single +// char token, e.g. "||" -> tPipe, "|" -> tOr. +func (lexer *Lexer) matchOrElse(first rune, second rune, matchedType tokType, singleCharType tokType) token { + start := lexer.currentPos - lexer.lastWidth + nextRune := lexer.next() + var t token + if nextRune == second { + t = token{ + tokenType: matchedType, + value: string(first) + string(second), + position: start, + length: 2, + } + } else { + lexer.back() + t = token{ + tokenType: singleCharType, + value: string(first), + position: start, + length: 1, + } + } + return t +} + +func (lexer *Lexer) consumeLBracket() token { + // There's three options here: + // 1. A filter expression "[?" + // 2. A flatten operator "[]" + // 3. A bare rbracket "[" + start := lexer.currentPos - lexer.lastWidth + nextRune := lexer.next() + var t token + if nextRune == '?' { + t = token{ + tokenType: tFilter, + value: "[?", + position: start, + length: 2, + } + } else if nextRune == ']' { + t = token{ + tokenType: tFlatten, + value: "[]", + position: start, + length: 2, + } + } else { + t = token{ + tokenType: tLbracket, + value: "[", + position: start, + length: 1, + } + lexer.back() + } + return t +} + +func (lexer *Lexer) consumeQuotedIdentifier() (token, error) { + start := lexer.currentPos + value, err := lexer.consumeUntil('"') + if err != nil { + return token{}, err + } + var decoded string + asJSON := []byte("\"" + value + "\"") + if err := json.Unmarshal([]byte(asJSON), &decoded); err != nil { + return token{}, err + } + return token{ + tokenType: tQuotedIdentifier, + value: decoded, + position: start - 1, + length: len(decoded), + }, nil +} + +func (lexer *Lexer) consumeUnquotedIdentifier() token { + // Consume runes until we reach the end of an unquoted + // identifier. + start := lexer.currentPos - lexer.lastWidth + for { + r := lexer.next() + if r < 0 || r > 128 || identifierTrailingBits[uint64(r)/64]&(1<<(uint64(r)%64)) == 0 { + lexer.back() + break + } + } + value := lexer.expression[start:lexer.currentPos] + return token{ + tokenType: tUnquotedIdentifier, + value: value, + position: start, + length: lexer.currentPos - start, + } +} + +func (lexer *Lexer) consumeNumber() token { + // Consume runes until we reach something that's not a number. + start := lexer.currentPos - lexer.lastWidth + for { + r := lexer.next() + if r < '0' || r > '9' { + lexer.back() + break + } + } + value := lexer.expression[start:lexer.currentPos] + return token{ + tokenType: tNumber, + value: value, + position: start, + length: lexer.currentPos - start, + } +} diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/lexer_test.go b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/lexer_test.go new file mode 100644 index 00000000000..7a9a9ee24bf --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/lexer_test.go @@ -0,0 +1,161 @@ +package jmespath + +import ( + "fmt" + "testing" + + "github.com/stretchr/testify/assert" +) + +var lexingTests = []struct { + expression string + expected []token +}{ + {"*", []token{token{tStar, "*", 0, 1}}}, + {".", []token{token{tDot, ".", 0, 1}}}, + {"[?", []token{token{tFilter, "[?", 0, 2}}}, + {"[]", []token{token{tFlatten, "[]", 0, 2}}}, + {"(", []token{token{tLparen, "(", 0, 1}}}, + {")", []token{token{tRparen, ")", 0, 1}}}, + {"[", []token{token{tLbracket, "[", 0, 1}}}, + {"]", []token{token{tRbracket, "]", 0, 1}}}, + {"{", []token{token{tLbrace, "{", 0, 1}}}, + {"}", []token{token{tRbrace, "}", 0, 1}}}, + {"||", []token{token{tOr, "||", 0, 2}}}, + {"|", []token{token{tPipe, "|", 0, 1}}}, + {"29", []token{token{tNumber, "29", 0, 2}}}, + {"2", []token{token{tNumber, "2", 0, 1}}}, + {"0", []token{token{tNumber, "0", 0, 1}}}, + {"-20", []token{token{tNumber, "-20", 0, 3}}}, + {"foo", []token{token{tUnquotedIdentifier, "foo", 0, 3}}}, + {`"bar"`, []token{token{tQuotedIdentifier, "bar", 0, 3}}}, + // Escaping the delimiter + {`"bar\"baz"`, []token{token{tQuotedIdentifier, `bar"baz`, 0, 7}}}, + {",", []token{token{tComma, ",", 0, 1}}}, + {":", []token{token{tColon, ":", 0, 1}}}, + {"<", []token{token{tLT, "<", 0, 1}}}, + {"<=", []token{token{tLTE, "<=", 0, 2}}}, + {">", []token{token{tGT, ">", 0, 1}}}, + {">=", []token{token{tGTE, ">=", 0, 2}}}, + {"==", []token{token{tEQ, "==", 0, 2}}}, + {"!=", []token{token{tNE, "!=", 0, 2}}}, + {"`[0, 1, 2]`", []token{token{tJSONLiteral, "[0, 1, 2]", 1, 9}}}, + {"'foo'", []token{token{tStringLiteral, "foo", 1, 3}}}, + {"'a'", []token{token{tStringLiteral, "a", 1, 1}}}, + {`'foo\'bar'`, []token{token{tStringLiteral, "foo'bar", 1, 7}}}, + {"@", []token{token{tCurrent, "@", 0, 1}}}, + {"&", []token{token{tExpref, "&", 0, 1}}}, + // Quoted identifier unicode escape sequences + {`"\u2713"`, []token{token{tQuotedIdentifier, "✓", 0, 3}}}, + {`"\\"`, []token{token{tQuotedIdentifier, `\`, 0, 1}}}, + {"`\"foo\"`", []token{token{tJSONLiteral, "\"foo\"", 1, 5}}}, + // Combinations of tokens. + {"foo.bar", []token{ + token{tUnquotedIdentifier, "foo", 0, 3}, + token{tDot, ".", 3, 1}, + token{tUnquotedIdentifier, "bar", 4, 3}, + }}, + {"foo[0]", []token{ + token{tUnquotedIdentifier, "foo", 0, 3}, + token{tLbracket, "[", 3, 1}, + token{tNumber, "0", 4, 1}, + token{tRbracket, "]", 5, 1}, + }}, + {"foo[?a 0 { + output += fmt.Sprintf("%schildren: {\n", strings.Repeat(" ", nextIndent)) + childIndent := nextIndent + 2 + for _, elem := range node.children { + output += elem.PrettyPrint(childIndent) + } + } + output += fmt.Sprintf("%s}\n", spaces) + return output +} + +var bindingPowers = map[tokType]int{ + tEOF: 0, + tUnquotedIdentifier: 0, + tQuotedIdentifier: 0, + tRbracket: 0, + tRparen: 0, + tComma: 0, + tRbrace: 0, + tNumber: 0, + tCurrent: 0, + tExpref: 0, + tColon: 0, + tPipe: 1, + tOr: 2, + tAnd: 3, + tEQ: 5, + tLT: 5, + tLTE: 5, + tGT: 5, + tGTE: 5, + tNE: 5, + tFlatten: 9, + tStar: 20, + tFilter: 21, + tDot: 40, + tNot: 45, + tLbrace: 50, + tLbracket: 55, + tLparen: 60, +} + +// Parser holds state about the current expression being parsed. +type Parser struct { + expression string + tokens []token + index int +} + +// NewParser creates a new JMESPath parser. +func NewParser() *Parser { + p := Parser{} + return &p +} + +// Parse will compile a JMESPath expression. +func (p *Parser) Parse(expression string) (ASTNode, error) { + lexer := NewLexer() + p.expression = expression + p.index = 0 + tokens, err := lexer.tokenize(expression) + if err != nil { + return ASTNode{}, err + } + p.tokens = tokens + parsed, err := p.parseExpression(0) + if err != nil { + return ASTNode{}, err + } + if p.current() != tEOF { + return ASTNode{}, p.syntaxError(fmt.Sprintf( + "Unexpected token at the end of the expresssion: %s", p.current())) + } + return parsed, nil +} + +func (p *Parser) parseExpression(bindingPower int) (ASTNode, error) { + var err error + leftToken := p.lookaheadToken(0) + p.advance() + leftNode, err := p.nud(leftToken) + if err != nil { + return ASTNode{}, err + } + currentToken := p.current() + for bindingPower < bindingPowers[currentToken] { + p.advance() + leftNode, err = p.led(currentToken, leftNode) + if err != nil { + return ASTNode{}, err + } + currentToken = p.current() + } + return leftNode, nil +} + +func (p *Parser) parseIndexExpression() (ASTNode, error) { + if p.lookahead(0) == tColon || p.lookahead(1) == tColon { + return p.parseSliceExpression() + } + indexStr := p.lookaheadToken(0).value + parsedInt, err := strconv.Atoi(indexStr) + if err != nil { + return ASTNode{}, err + } + indexNode := ASTNode{nodeType: ASTIndex, value: parsedInt} + p.advance() + if err := p.match(tRbracket); err != nil { + return ASTNode{}, err + } + return indexNode, nil +} + +func (p *Parser) parseSliceExpression() (ASTNode, error) { + parts := []*int{nil, nil, nil} + index := 0 + current := p.current() + for current != tRbracket && index < 3 { + if current == tColon { + index++ + p.advance() + } else if current == tNumber { + parsedInt, err := strconv.Atoi(p.lookaheadToken(0).value) + if err != nil { + return ASTNode{}, err + } + parts[index] = &parsedInt + p.advance() + } else { + return ASTNode{}, p.syntaxError( + "Expected tColon or tNumber" + ", received: " + p.current().String()) + } + current = p.current() + } + if err := p.match(tRbracket); err != nil { + return ASTNode{}, err + } + return ASTNode{ + nodeType: ASTSlice, + value: parts, + }, nil +} + +func (p *Parser) match(tokenType tokType) error { + if p.current() == tokenType { + p.advance() + return nil + } + return p.syntaxError("Expected " + tokenType.String() + ", received: " + p.current().String()) +} + +func (p *Parser) led(tokenType tokType, node ASTNode) (ASTNode, error) { + switch tokenType { + case tDot: + if p.current() != tStar { + right, err := p.parseDotRHS(bindingPowers[tDot]) + return ASTNode{ + nodeType: ASTSubexpression, + children: []ASTNode{node, right}, + }, err + } + p.advance() + right, err := p.parseProjectionRHS(bindingPowers[tDot]) + return ASTNode{ + nodeType: ASTValueProjection, + children: []ASTNode{node, right}, + }, err + case tPipe: + right, err := p.parseExpression(bindingPowers[tPipe]) + return ASTNode{nodeType: ASTPipe, children: []ASTNode{node, right}}, err + case tOr: + right, err := p.parseExpression(bindingPowers[tOr]) + return ASTNode{nodeType: ASTOrExpression, children: []ASTNode{node, right}}, err + case tAnd: + right, err := p.parseExpression(bindingPowers[tAnd]) + return ASTNode{nodeType: ASTAndExpression, children: []ASTNode{node, right}}, err + case tLparen: + name := node.value + var args []ASTNode + for p.current() != tRparen { + expression, err := p.parseExpression(0) + if err != nil { + return ASTNode{}, err + } + if p.current() == tComma { + if err := p.match(tComma); err != nil { + return ASTNode{}, err + } + } + args = append(args, expression) + } + if err := p.match(tRparen); err != nil { + return ASTNode{}, err + } + return ASTNode{ + nodeType: ASTFunctionExpression, + value: name, + children: args, + }, nil + case tFilter: + return p.parseFilter(node) + case tFlatten: + left := ASTNode{nodeType: ASTFlatten, children: []ASTNode{node}} + right, err := p.parseProjectionRHS(bindingPowers[tFlatten]) + return ASTNode{ + nodeType: ASTProjection, + children: []ASTNode{left, right}, + }, err + case tEQ, tNE, tGT, tGTE, tLT, tLTE: + right, err := p.parseExpression(bindingPowers[tokenType]) + if err != nil { + return ASTNode{}, err + } + return ASTNode{ + nodeType: ASTComparator, + value: tokenType, + children: []ASTNode{node, right}, + }, nil + case tLbracket: + tokenType := p.current() + var right ASTNode + var err error + if tokenType == tNumber || tokenType == tColon { + right, err = p.parseIndexExpression() + if err != nil { + return ASTNode{}, err + } + return p.projectIfSlice(node, right) + } + // Otherwise this is a projection. + if err := p.match(tStar); err != nil { + return ASTNode{}, err + } + if err := p.match(tRbracket); err != nil { + return ASTNode{}, err + } + right, err = p.parseProjectionRHS(bindingPowers[tStar]) + if err != nil { + return ASTNode{}, err + } + return ASTNode{ + nodeType: ASTProjection, + children: []ASTNode{node, right}, + }, nil + } + return ASTNode{}, p.syntaxError("Unexpected token: " + tokenType.String()) +} + +func (p *Parser) nud(token token) (ASTNode, error) { + switch token.tokenType { + case tJSONLiteral: + var parsed interface{} + err := json.Unmarshal([]byte(token.value), &parsed) + if err != nil { + return ASTNode{}, err + } + return ASTNode{nodeType: ASTLiteral, value: parsed}, nil + case tStringLiteral: + return ASTNode{nodeType: ASTLiteral, value: token.value}, nil + case tUnquotedIdentifier: + return ASTNode{ + nodeType: ASTField, + value: token.value, + }, nil + case tQuotedIdentifier: + node := ASTNode{nodeType: ASTField, value: token.value} + if p.current() == tLparen { + return ASTNode{}, p.syntaxErrorToken("Can't have quoted identifier as function name.", token) + } + return node, nil + case tStar: + left := ASTNode{nodeType: ASTIdentity} + var right ASTNode + var err error + if p.current() == tRbracket { + right = ASTNode{nodeType: ASTIdentity} + } else { + right, err = p.parseProjectionRHS(bindingPowers[tStar]) + } + return ASTNode{nodeType: ASTValueProjection, children: []ASTNode{left, right}}, err + case tFilter: + return p.parseFilter(ASTNode{nodeType: ASTIdentity}) + case tLbrace: + return p.parseMultiSelectHash() + case tFlatten: + left := ASTNode{ + nodeType: ASTFlatten, + children: []ASTNode{ASTNode{nodeType: ASTIdentity}}, + } + right, err := p.parseProjectionRHS(bindingPowers[tFlatten]) + if err != nil { + return ASTNode{}, err + } + return ASTNode{nodeType: ASTProjection, children: []ASTNode{left, right}}, nil + case tLbracket: + tokenType := p.current() + //var right ASTNode + if tokenType == tNumber || tokenType == tColon { + right, err := p.parseIndexExpression() + if err != nil { + return ASTNode{}, nil + } + return p.projectIfSlice(ASTNode{nodeType: ASTIdentity}, right) + } else if tokenType == tStar && p.lookahead(1) == tRbracket { + p.advance() + p.advance() + right, err := p.parseProjectionRHS(bindingPowers[tStar]) + if err != nil { + return ASTNode{}, err + } + return ASTNode{ + nodeType: ASTProjection, + children: []ASTNode{ASTNode{nodeType: ASTIdentity}, right}, + }, nil + } else { + return p.parseMultiSelectList() + } + case tCurrent: + return ASTNode{nodeType: ASTCurrentNode}, nil + case tExpref: + expression, err := p.parseExpression(bindingPowers[tExpref]) + if err != nil { + return ASTNode{}, err + } + return ASTNode{nodeType: ASTExpRef, children: []ASTNode{expression}}, nil + case tNot: + expression, err := p.parseExpression(bindingPowers[tNot]) + if err != nil { + return ASTNode{}, err + } + return ASTNode{nodeType: ASTNotExpression, children: []ASTNode{expression}}, nil + case tLparen: + expression, err := p.parseExpression(0) + if err != nil { + return ASTNode{}, err + } + if err := p.match(tRparen); err != nil { + return ASTNode{}, err + } + return expression, nil + case tEOF: + return ASTNode{}, p.syntaxErrorToken("Incomplete expression", token) + } + + return ASTNode{}, p.syntaxErrorToken("Invalid token: "+token.tokenType.String(), token) +} + +func (p *Parser) parseMultiSelectList() (ASTNode, error) { + var expressions []ASTNode + for { + expression, err := p.parseExpression(0) + if err != nil { + return ASTNode{}, err + } + expressions = append(expressions, expression) + if p.current() == tRbracket { + break + } + err = p.match(tComma) + if err != nil { + return ASTNode{}, err + } + } + err := p.match(tRbracket) + if err != nil { + return ASTNode{}, err + } + return ASTNode{ + nodeType: ASTMultiSelectList, + children: expressions, + }, nil +} + +func (p *Parser) parseMultiSelectHash() (ASTNode, error) { + var children []ASTNode + for { + keyToken := p.lookaheadToken(0) + if err := p.match(tUnquotedIdentifier); err != nil { + if err := p.match(tQuotedIdentifier); err != nil { + return ASTNode{}, p.syntaxError("Expected tQuotedIdentifier or tUnquotedIdentifier") + } + } + keyName := keyToken.value + err := p.match(tColon) + if err != nil { + return ASTNode{}, err + } + value, err := p.parseExpression(0) + if err != nil { + return ASTNode{}, err + } + node := ASTNode{ + nodeType: ASTKeyValPair, + value: keyName, + children: []ASTNode{value}, + } + children = append(children, node) + if p.current() == tComma { + err := p.match(tComma) + if err != nil { + return ASTNode{}, nil + } + } else if p.current() == tRbrace { + err := p.match(tRbrace) + if err != nil { + return ASTNode{}, nil + } + break + } + } + return ASTNode{ + nodeType: ASTMultiSelectHash, + children: children, + }, nil +} + +func (p *Parser) projectIfSlice(left ASTNode, right ASTNode) (ASTNode, error) { + indexExpr := ASTNode{ + nodeType: ASTIndexExpression, + children: []ASTNode{left, right}, + } + if right.nodeType == ASTSlice { + right, err := p.parseProjectionRHS(bindingPowers[tStar]) + return ASTNode{ + nodeType: ASTProjection, + children: []ASTNode{indexExpr, right}, + }, err + } + return indexExpr, nil +} +func (p *Parser) parseFilter(node ASTNode) (ASTNode, error) { + var right, condition ASTNode + var err error + condition, err = p.parseExpression(0) + if err != nil { + return ASTNode{}, err + } + if err := p.match(tRbracket); err != nil { + return ASTNode{}, err + } + if p.current() == tFlatten { + right = ASTNode{nodeType: ASTIdentity} + } else { + right, err = p.parseProjectionRHS(bindingPowers[tFilter]) + if err != nil { + return ASTNode{}, err + } + } + + return ASTNode{ + nodeType: ASTFilterProjection, + children: []ASTNode{node, right, condition}, + }, nil +} + +func (p *Parser) parseDotRHS(bindingPower int) (ASTNode, error) { + lookahead := p.current() + if tokensOneOf([]tokType{tQuotedIdentifier, tUnquotedIdentifier, tStar}, lookahead) { + return p.parseExpression(bindingPower) + } else if lookahead == tLbracket { + if err := p.match(tLbracket); err != nil { + return ASTNode{}, err + } + return p.parseMultiSelectList() + } else if lookahead == tLbrace { + if err := p.match(tLbrace); err != nil { + return ASTNode{}, err + } + return p.parseMultiSelectHash() + } + return ASTNode{}, p.syntaxError("Expected identifier, lbracket, or lbrace") +} + +func (p *Parser) parseProjectionRHS(bindingPower int) (ASTNode, error) { + current := p.current() + if bindingPowers[current] < 10 { + return ASTNode{nodeType: ASTIdentity}, nil + } else if current == tLbracket { + return p.parseExpression(bindingPower) + } else if current == tFilter { + return p.parseExpression(bindingPower) + } else if current == tDot { + err := p.match(tDot) + if err != nil { + return ASTNode{}, err + } + return p.parseDotRHS(bindingPower) + } else { + return ASTNode{}, p.syntaxError("Error") + } +} + +func (p *Parser) lookahead(number int) tokType { + return p.lookaheadToken(number).tokenType +} + +func (p *Parser) current() tokType { + return p.lookahead(0) +} + +func (p *Parser) lookaheadToken(number int) token { + return p.tokens[p.index+number] +} + +func (p *Parser) advance() { + p.index++ +} + +func tokensOneOf(elements []tokType, token tokType) bool { + for _, elem := range elements { + if elem == token { + return true + } + } + return false +} + +func (p *Parser) syntaxError(msg string) SyntaxError { + return SyntaxError{ + msg: msg, + Expression: p.expression, + Offset: p.lookaheadToken(0).position, + } +} + +// Create a SyntaxError based on the provided token. +// This differs from syntaxError() which creates a SyntaxError +// based on the current lookahead token. +func (p *Parser) syntaxErrorToken(msg string, t token) SyntaxError { + return SyntaxError{ + msg: msg, + Expression: p.expression, + Offset: t.position, + } +} diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/parser_test.go b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/parser_test.go new file mode 100644 index 00000000000..997a0f4d7c1 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/parser_test.go @@ -0,0 +1,136 @@ +package jmespath + +import ( + "fmt" + "testing" + + "github.com/stretchr/testify/assert" +) + +var parsingErrorTests = []struct { + expression string + msg string +}{ + {"foo.", "Incopmlete expression"}, + {"[foo", "Incopmlete expression"}, + {"]", "Invalid"}, + {")", "Invalid"}, + {"}", "Invalid"}, + {"foo..bar", "Invalid"}, + {`foo."bar`, "Forwards lexer errors"}, + {`{foo: bar`, "Incomplete expression"}, + {`{foo bar}`, "Invalid"}, + {`[foo bar]`, "Invalid"}, + {`foo@`, "Invalid"}, + {`&&&&&&&&&&&&t(`, "Invalid"}, + {`[*][`, "Invalid"}, +} + +func TestParsingErrors(t *testing.T) { + assert := assert.New(t) + parser := NewParser() + for _, tt := range parsingErrorTests { + _, err := parser.Parse(tt.expression) + assert.NotNil(err, fmt.Sprintf("Expected parsing error: %s, for expression: %s", tt.msg, tt.expression)) + } +} + +var prettyPrinted = `ASTProjection { + children: { + ASTField { + value: "foo" + } + ASTSubexpression { + children: { + ASTSubexpression { + children: { + ASTField { + value: "bar" + } + ASTField { + value: "baz" + } + } + ASTField { + value: "qux" + } + } +} +` + +var prettyPrintedCompNode = `ASTFilterProjection { + children: { + ASTField { + value: "a" + } + ASTIdentity { + } + ASTComparator { + value: tLTE + children: { + ASTField { + value: "b" + } + ASTField { + value: "c" + } + } +} +` + +func TestPrettyPrintedAST(t *testing.T) { + assert := assert.New(t) + parser := NewParser() + parsed, _ := parser.Parse("foo[*].bar.baz.qux") + assert.Equal(parsed.PrettyPrint(0), prettyPrinted) +} + +func TestPrettyPrintedCompNode(t *testing.T) { + assert := assert.New(t) + parser := NewParser() + parsed, _ := parser.Parse("a[?b<=c]") + assert.Equal(parsed.PrettyPrint(0), prettyPrintedCompNode) +} + +func BenchmarkParseIdentifier(b *testing.B) { + runParseBenchmark(b, exprIdentifier) +} + +func BenchmarkParseSubexpression(b *testing.B) { + runParseBenchmark(b, exprSubexpr) +} + +func BenchmarkParseDeeplyNested50(b *testing.B) { + runParseBenchmark(b, deeplyNested50) +} + +func BenchmarkParseDeepNested50Pipe(b *testing.B) { + runParseBenchmark(b, deeplyNested50Pipe) +} + +func BenchmarkParseDeepNested50Index(b *testing.B) { + runParseBenchmark(b, deeplyNested50Index) +} + +func BenchmarkParseQuotedIdentifier(b *testing.B) { + runParseBenchmark(b, exprQuotedIdentifier) +} + +func BenchmarkParseQuotedIdentifierEscapes(b *testing.B) { + runParseBenchmark(b, quotedIdentifierEscapes) +} + +func BenchmarkParseRawStringLiteral(b *testing.B) { + runParseBenchmark(b, rawStringLiteral) +} + +func BenchmarkParseDeepProjection104(b *testing.B) { + runParseBenchmark(b, deepProjection104) +} + +func runParseBenchmark(b *testing.B, expression string) { + parser := NewParser() + for i := 0; i < b.N; i++ { + parser.Parse(expression) + } +} diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/toktype_string.go b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/toktype_string.go new file mode 100644 index 00000000000..dae79cbdf33 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/toktype_string.go @@ -0,0 +1,16 @@ +// generated by stringer -type=tokType; DO NOT EDIT + +package jmespath + +import "fmt" + +const _tokType_name = "tUnknowntStartDottFiltertFlattentLparentRparentLbrackettRbrackettLbracetRbracetOrtPipetNumbertUnquotedIdentifiertQuotedIdentifiertCommatColontLTtLTEtGTtGTEtEQtNEtJSONLiteraltStringLiteraltCurrenttExpreftAndtNottEOF" + +var _tokType_index = [...]uint8{0, 8, 13, 17, 24, 32, 39, 46, 55, 64, 71, 78, 81, 86, 93, 112, 129, 135, 141, 144, 148, 151, 155, 158, 161, 173, 187, 195, 202, 206, 210, 214} + +func (i tokType) String() string { + if i < 0 || i >= tokType(len(_tokType_index)-1) { + return fmt.Sprintf("tokType(%d)", i) + } + return _tokType_name[_tokType_index[i]:_tokType_index[i+1]] +} diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/util.go b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/util.go new file mode 100644 index 00000000000..ddc1b7d7d46 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/util.go @@ -0,0 +1,185 @@ +package jmespath + +import ( + "errors" + "reflect" +) + +// IsFalse determines if an object is false based on the JMESPath spec. +// JMESPath defines false values to be any of: +// - An empty string array, or hash. +// - The boolean value false. +// - nil +func isFalse(value interface{}) bool { + switch v := value.(type) { + case bool: + return !v + case []interface{}: + return len(v) == 0 + case map[string]interface{}: + return len(v) == 0 + case string: + return len(v) == 0 + case nil: + return true + } + // Try the reflection cases before returning false. + rv := reflect.ValueOf(value) + switch rv.Kind() { + case reflect.Struct: + // A struct type will never be false, even if + // all of its values are the zero type. + return false + case reflect.Slice, reflect.Map: + return rv.Len() == 0 + case reflect.Ptr: + if rv.IsNil() { + return true + } + // If it's a pointer type, we'll try to deref the pointer + // and evaluate the pointer value for isFalse. + element := rv.Elem() + return isFalse(element.Interface()) + } + return false +} + +// ObjsEqual is a generic object equality check. +// It will take two arbitrary objects and recursively determine +// if they are equal. +func objsEqual(left interface{}, right interface{}) bool { + return reflect.DeepEqual(left, right) +} + +// SliceParam refers to a single part of a slice. +// A slice consists of a start, a stop, and a step, similar to +// python slices. +type sliceParam struct { + N int + Specified bool +} + +// Slice supports [start:stop:step] style slicing that's supported in JMESPath. +func slice(slice []interface{}, parts []sliceParam) ([]interface{}, error) { + computed, err := computeSliceParams(len(slice), parts) + if err != nil { + return nil, err + } + start, stop, step := computed[0], computed[1], computed[2] + result := []interface{}{} + if step > 0 { + for i := start; i < stop; i += step { + result = append(result, slice[i]) + } + } else { + for i := start; i > stop; i += step { + result = append(result, slice[i]) + } + } + return result, nil +} + +func computeSliceParams(length int, parts []sliceParam) ([]int, error) { + var start, stop, step int + if !parts[2].Specified { + step = 1 + } else if parts[2].N == 0 { + return nil, errors.New("Invalid slice, step cannot be 0") + } else { + step = parts[2].N + } + var stepValueNegative bool + if step < 0 { + stepValueNegative = true + } else { + stepValueNegative = false + } + + if !parts[0].Specified { + if stepValueNegative { + start = length - 1 + } else { + start = 0 + } + } else { + start = capSlice(length, parts[0].N, step) + } + + if !parts[1].Specified { + if stepValueNegative { + stop = -1 + } else { + stop = length + } + } else { + stop = capSlice(length, parts[1].N, step) + } + return []int{start, stop, step}, nil +} + +func capSlice(length int, actual int, step int) int { + if actual < 0 { + actual += length + if actual < 0 { + if step < 0 { + actual = -1 + } else { + actual = 0 + } + } + } else if actual >= length { + if step < 0 { + actual = length - 1 + } else { + actual = length + } + } + return actual +} + +// ToArrayNum converts an empty interface type to a slice of float64. +// If any element in the array cannot be converted, then nil is returned +// along with a second value of false. +func toArrayNum(data interface{}) ([]float64, bool) { + // Is there a better way to do this with reflect? + if d, ok := data.([]interface{}); ok { + result := make([]float64, len(d)) + for i, el := range d { + item, ok := el.(float64) + if !ok { + return nil, false + } + result[i] = item + } + return result, true + } + return nil, false +} + +// ToArrayStr converts an empty interface type to a slice of strings. +// If any element in the array cannot be converted, then nil is returned +// along with a second value of false. If the input data could be entirely +// converted, then the converted data, along with a second value of true, +// will be returned. +func toArrayStr(data interface{}) ([]string, bool) { + // Is there a better way to do this with reflect? + if d, ok := data.([]interface{}); ok { + result := make([]string, len(d)) + for i, el := range d { + item, ok := el.(string) + if !ok { + return nil, false + } + result[i] = item + } + return result, true + } + return nil, false +} + +func isSliceType(v interface{}) bool { + if v == nil { + return false + } + return reflect.TypeOf(v).Kind() == reflect.Slice +} diff --git a/Godeps/_workspace/src/github.com/jmespath/go-jmespath/util_test.go b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/util_test.go new file mode 100644 index 00000000000..1e2cd935206 --- /dev/null +++ b/Godeps/_workspace/src/github.com/jmespath/go-jmespath/util_test.go @@ -0,0 +1,73 @@ +package jmespath + +import ( + "github.com/stretchr/testify/assert" + "testing" +) + +func TestSlicePositiveStep(t *testing.T) { + assert := assert.New(t) + input := make([]interface{}, 5) + input[0] = 0 + input[1] = 1 + input[2] = 2 + input[3] = 3 + input[4] = 4 + result, err := slice(input, []sliceParam{sliceParam{0, true}, sliceParam{3, true}, sliceParam{1, true}}) + assert.Nil(err) + assert.Equal(input[:3], result) +} + +func TestIsFalseJSONTypes(t *testing.T) { + assert := assert.New(t) + assert.True(isFalse(false)) + assert.True(isFalse("")) + var empty []interface{} + assert.True(isFalse(empty)) + m := make(map[string]interface{}) + assert.True(isFalse(m)) + assert.True(isFalse(nil)) + +} + +func TestIsFalseWithUserDefinedStructs(t *testing.T) { + assert := assert.New(t) + type nilStructType struct { + SliceOfPointers []*string + } + nilStruct := nilStructType{SliceOfPointers: nil} + assert.True(isFalse(nilStruct.SliceOfPointers)) + + // A user defined struct will never be false though, + // even if it's fields are the zero type. + assert.False(isFalse(nilStruct)) +} + +func TestIsFalseWithNilInterface(t *testing.T) { + assert := assert.New(t) + var a *int = nil + var nilInterface interface{} + nilInterface = a + assert.True(isFalse(nilInterface)) +} + +func TestIsFalseWithMapOfUserStructs(t *testing.T) { + assert := assert.New(t) + type foo struct { + Bar string + Baz string + } + m := make(map[int]foo) + assert.True(isFalse(m)) +} + +func TestObjsEqual(t *testing.T) { + assert := assert.New(t) + assert.True(objsEqual("foo", "foo")) + assert.True(objsEqual(20, 20)) + assert.True(objsEqual([]int{1, 2, 3}, []int{1, 2, 3})) + assert.True(objsEqual(nil, nil)) + assert.True(!objsEqual(nil, "foo")) + assert.True(objsEqual([]int{}, []int{})) + assert.True(!objsEqual([]int{}, nil)) +} diff --git a/Godeps/_workspace/src/github.com/vaughan0/go-ini/LICENSE b/Godeps/_workspace/src/github.com/vaughan0/go-ini/LICENSE deleted file mode 100644 index 968b45384d0..00000000000 --- a/Godeps/_workspace/src/github.com/vaughan0/go-ini/LICENSE +++ /dev/null @@ -1,14 +0,0 @@ -Copyright (c) 2013 Vaughan Newton - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated -documentation files (the "Software"), to deal in the Software without restriction, including without limitation the -rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit -persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the -Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE -WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR -COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/Godeps/_workspace/src/github.com/vaughan0/go-ini/README.md b/Godeps/_workspace/src/github.com/vaughan0/go-ini/README.md deleted file mode 100644 index d5cd4e74b00..00000000000 --- a/Godeps/_workspace/src/github.com/vaughan0/go-ini/README.md +++ /dev/null @@ -1,70 +0,0 @@ -go-ini -====== - -INI parsing library for Go (golang). - -View the API documentation [here](http://godoc.org/github.com/vaughan0/go-ini). - -Usage ------ - -Parse an INI file: - -```go -import "github.com/vaughan0/go-ini" - -file, err := ini.LoadFile("myfile.ini") -``` - -Get data from the parsed file: - -```go -name, ok := file.Get("person", "name") -if !ok { - panic("'name' variable missing from 'person' section") -} -``` - -Iterate through values in a section: - -```go -for key, value := range file["mysection"] { - fmt.Printf("%s => %s\n", key, value) -} -``` - -Iterate through sections in a file: - -```go -for name, section := range file { - fmt.Printf("Section name: %s\n", name) -} -``` - -File Format ------------ - -INI files are parsed by go-ini line-by-line. Each line may be one of the following: - - * A section definition: [section-name] - * A property: key = value - * A comment: #blahblah _or_ ;blahblah - * Blank. The line will be ignored. - -Properties defined before any section headers are placed in the default section, which has -the empty string as it's key. - -Example: - -```ini -# I am a comment -; So am I! - -[apples] -colour = red or green -shape = applish - -[oranges] -shape = square -colour = blue -``` diff --git a/Godeps/_workspace/src/github.com/vaughan0/go-ini/ini.go b/Godeps/_workspace/src/github.com/vaughan0/go-ini/ini.go deleted file mode 100644 index 81aeb32f8b2..00000000000 --- a/Godeps/_workspace/src/github.com/vaughan0/go-ini/ini.go +++ /dev/null @@ -1,123 +0,0 @@ -// Package ini provides functions for parsing INI configuration files. -package ini - -import ( - "bufio" - "fmt" - "io" - "os" - "regexp" - "strings" -) - -var ( - sectionRegex = regexp.MustCompile(`^\[(.*)\]$`) - assignRegex = regexp.MustCompile(`^([^=]+)=(.*)$`) -) - -// ErrSyntax is returned when there is a syntax error in an INI file. -type ErrSyntax struct { - Line int - Source string // The contents of the erroneous line, without leading or trailing whitespace -} - -func (e ErrSyntax) Error() string { - return fmt.Sprintf("invalid INI syntax on line %d: %s", e.Line, e.Source) -} - -// A File represents a parsed INI file. -type File map[string]Section - -// A Section represents a single section of an INI file. -type Section map[string]string - -// Returns a named Section. A Section will be created if one does not already exist for the given name. -func (f File) Section(name string) Section { - section := f[name] - if section == nil { - section = make(Section) - f[name] = section - } - return section -} - -// Looks up a value for a key in a section and returns that value, along with a boolean result similar to a map lookup. -func (f File) Get(section, key string) (value string, ok bool) { - if s := f[section]; s != nil { - value, ok = s[key] - } - return -} - -// Loads INI data from a reader and stores the data in the File. -func (f File) Load(in io.Reader) (err error) { - bufin, ok := in.(*bufio.Reader) - if !ok { - bufin = bufio.NewReader(in) - } - return parseFile(bufin, f) -} - -// Loads INI data from a named file and stores the data in the File. -func (f File) LoadFile(file string) (err error) { - in, err := os.Open(file) - if err != nil { - return - } - defer in.Close() - return f.Load(in) -} - -func parseFile(in *bufio.Reader, file File) (err error) { - section := "" - lineNum := 0 - for done := false; !done; { - var line string - if line, err = in.ReadString('\n'); err != nil { - if err == io.EOF { - done = true - } else { - return - } - } - lineNum++ - line = strings.TrimSpace(line) - if len(line) == 0 { - // Skip blank lines - continue - } - if line[0] == ';' || line[0] == '#' { - // Skip comments - continue - } - - if groups := assignRegex.FindStringSubmatch(line); groups != nil { - key, val := groups[1], groups[2] - key, val = strings.TrimSpace(key), strings.TrimSpace(val) - file.Section(section)[key] = val - } else if groups := sectionRegex.FindStringSubmatch(line); groups != nil { - name := strings.TrimSpace(groups[1]) - section = name - // Create the section if it does not exist - file.Section(section) - } else { - return ErrSyntax{lineNum, line} - } - - } - return nil -} - -// Loads and returns a File from a reader. -func Load(in io.Reader) (File, error) { - file := make(File) - err := file.Load(in) - return file, err -} - -// Loads and returns an INI File from a file on disk. -func LoadFile(filename string) (File, error) { - file := make(File) - err := file.LoadFile(filename) - return file, err -} diff --git a/Godeps/_workspace/src/github.com/vaughan0/go-ini/ini_linux_test.go b/Godeps/_workspace/src/github.com/vaughan0/go-ini/ini_linux_test.go deleted file mode 100644 index 38a6f0004cf..00000000000 --- a/Godeps/_workspace/src/github.com/vaughan0/go-ini/ini_linux_test.go +++ /dev/null @@ -1,43 +0,0 @@ -package ini - -import ( - "reflect" - "syscall" - "testing" -) - -func TestLoadFile(t *testing.T) { - originalOpenFiles := numFilesOpen(t) - - file, err := LoadFile("test.ini") - if err != nil { - t.Fatal(err) - } - - if originalOpenFiles != numFilesOpen(t) { - t.Error("test.ini not closed") - } - - if !reflect.DeepEqual(file, File{"default": {"stuff": "things"}}) { - t.Error("file not read correctly") - } -} - -func numFilesOpen(t *testing.T) (num uint64) { - var rlimit syscall.Rlimit - err := syscall.Getrlimit(syscall.RLIMIT_NOFILE, &rlimit) - if err != nil { - t.Fatal(err) - } - maxFds := int(rlimit.Cur) - - var stat syscall.Stat_t - for i := 0; i < maxFds; i++ { - if syscall.Fstat(i, &stat) == nil { - num++ - } else { - return - } - } - return -} diff --git a/Godeps/_workspace/src/github.com/vaughan0/go-ini/ini_test.go b/Godeps/_workspace/src/github.com/vaughan0/go-ini/ini_test.go deleted file mode 100644 index 06a4d05eaf0..00000000000 --- a/Godeps/_workspace/src/github.com/vaughan0/go-ini/ini_test.go +++ /dev/null @@ -1,89 +0,0 @@ -package ini - -import ( - "reflect" - "strings" - "testing" -) - -func TestLoad(t *testing.T) { - src := ` - # Comments are ignored - - herp = derp - - [foo] - hello=world - whitespace should = not matter - ; sneaky semicolon-style comment - multiple = equals = signs - - [bar] - this = that` - - file, err := Load(strings.NewReader(src)) - if err != nil { - t.Fatal(err) - } - check := func(section, key, expect string) { - if value, _ := file.Get(section, key); value != expect { - t.Errorf("Get(%q, %q): expected %q, got %q", section, key, expect, value) - } - } - - check("", "herp", "derp") - check("foo", "hello", "world") - check("foo", "whitespace should", "not matter") - check("foo", "multiple", "equals = signs") - check("bar", "this", "that") -} - -func TestSyntaxError(t *testing.T) { - src := ` - # Line 2 - [foo] - bar = baz - # Here's an error on line 6: - wut? - herp = derp` - _, err := Load(strings.NewReader(src)) - t.Logf("%T: %v", err, err) - if err == nil { - t.Fatal("expected an error, got nil") - } - syntaxErr, ok := err.(ErrSyntax) - if !ok { - t.Fatal("expected an error of type ErrSyntax") - } - if syntaxErr.Line != 6 { - t.Fatal("incorrect line number") - } - if syntaxErr.Source != "wut?" { - t.Fatal("incorrect source") - } -} - -func TestDefinedSectionBehaviour(t *testing.T) { - check := func(src string, expect File) { - file, err := Load(strings.NewReader(src)) - if err != nil { - t.Fatal(err) - } - if !reflect.DeepEqual(file, expect) { - t.Errorf("expected %v, got %v", expect, file) - } - } - // No sections for an empty file - check("", File{}) - // Default section only if there are actually values for it - check("foo=bar", File{"": {"foo": "bar"}}) - // User-defined sections should always be present, even if empty - check("[a]\n[b]\nfoo=bar", File{ - "a": {}, - "b": {"foo": "bar"}, - }) - check("foo=bar\n[a]\nthis=that", File{ - "": {"foo": "bar"}, - "a": {"this": "that"}, - }) -} diff --git a/Godeps/_workspace/src/github.com/vaughan0/go-ini/test.ini b/Godeps/_workspace/src/github.com/vaughan0/go-ini/test.ini deleted file mode 100644 index d13c999e254..00000000000 --- a/Godeps/_workspace/src/github.com/vaughan0/go-ini/test.ini +++ /dev/null @@ -1,2 +0,0 @@ -[default] -stuff = things diff --git a/README.md b/README.md index a346acaaa8a..3886c32a971 100644 --- a/README.md +++ b/README.md @@ -6,16 +6,14 @@ [Email](mailto:contact@grafana.org) Grafana is an open source, feature rich metrics dashboard and graph editor for -Graphite, InfluxDB & OpenTSDB. +Graphite, Elasticsearch, OpenTSDB, Prometheus and InfluxDB. ![](http://grafana.org/assets/img/start_page_bg.png) -## Grafana 2.0 -The develop branch has now been merged with master. For 1.9 users this is a big change as Grafana is no longer -a standalone frontend only web application. Grafana 2.0 comes with a backend. -- [Install instructions](http://docs.grafana.org/v2.0/installation/) -- [Migrating from 1.x to 2.x](http://docs.grafana.org/v2.0/installation/migrating_to2/) -- [What's New in Grafana 2.0](http://docs.grafana.org/v2.0/guides/whats-new-in-v2/) +- [Install instructions](http://docs.grafana.org/installation/) +- [What's New in Grafana 2.0](http://docs.grafana.org/guides/whats-new-in-v2/) +- [What's New in Grafana 2.1](http://docs.grafana.org/guides/whats-new-in-v2-1/) +- [What's New in Grafana 2.5](http://docs.grafana.org/guides/whats-new-in-v2-5/) ## Features ### Graphite Target Editor @@ -30,7 +28,7 @@ a standalone frontend only web application. Grafana 2.0 comes with a backend. - Click and drag to zoom - Multiple Y-axis, logarithmic scales - Bars, Lines, Points -- Smart Y-axis formating +- Smart Y-axis formatting - Series toggles & color selector - Legend values, and formatting options - Grid thresholds, axis labels @@ -47,6 +45,9 @@ a standalone frontend only web application. Grafana 2.0 comes with a backend. - [Time range controls](http://docs.grafana.org/reference/timerange/) - [Share snapshots publicly](http://docs.grafana.org/v2.0/reference/sharing/) +### Elasticsearch +- Feature rich query editor UI + ### InfluxDB - Use InfluxDB as a metric data source, annotation source - Query editor with series and column typeahead, easy group by and function selection @@ -74,7 +75,7 @@ the latest master builds [here](http://grafana.org/download/builds) ### Dependencies -- Go 1.4 +- Go 1.5 - NodeJS ### Get Code @@ -84,11 +85,12 @@ go get github.com/grafana/grafana ``` ### Building the backend +Replace X.Y.Z by actual version number. ``` cd $GOPATH/src/github.com/grafana/grafana go run build.go setup (only needed once to install godep) godep restore (will pull down all golang lib dependencies in your current GOPATH) -go build . +go run build.go build ``` ### Building frontend assets @@ -111,7 +113,7 @@ bra run ### Running ``` -./grafana +./bin/grafana-server ``` Open grafana in your browser (default http://localhost:3000) and login with admin user (default user/pass = admin/admin). @@ -127,13 +129,14 @@ You only need to add the options you want to override. Config files are applied ## Create a pull request Before or after you create a pull request, sign the [contributor license agreement](http://grafana.org/docs/contributing/cla.html). + ## Contribute If you have any idea for an improvement or found a bug do not hesitate to open an issue. And if you have time clone this repo and submit a pull request and help me make Grafana the kickass metrics & devops dashboard we all dream about! Before creating a pull request be sure that "grunt test" runs without any style or unit test errors, also -please [sign the CLA](http://grafana.org/docs/contributing/cla.html) +please [sign the CLA](http://docs.grafana.org/project/cla/) ## License diff --git a/appveyor.yml b/appveyor.yml index 993f8f2882c..83506312912 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -5,7 +5,7 @@ os: Windows Server 2012 R2 clone_folder: c:\gopath\src\github.com\grafana\grafana environment: - nodejs_version: "0.12.2" + nodejs_version: "4" GOPATH: c:\gopath install: diff --git a/build.go b/build.go index 4a345c5fc73..fcd7289cd6a 100644 --- a/build.go +++ b/build.go @@ -76,6 +76,14 @@ func main() { grunt("release") createLinuxPackages() + case "pkg-rpm": + grunt("release") + createRpmPackages() + + case "pkg-deb": + grunt("release") + createDebPackages() + case "latest": makeLatestDistCopies() @@ -147,7 +155,7 @@ type linuxPackageOptions struct { depends []string } -func createLinuxPackages() { +func createDebPackages() { createPackage(linuxPackageOptions{ packageType: "deb", homeDir: "/usr/share/grafana", @@ -167,7 +175,9 @@ func createLinuxPackages() { depends: []string{"adduser", "libfontconfig"}, }) +} +func createRpmPackages() { createPackage(linuxPackageOptions{ packageType: "rpm", homeDir: "/usr/share/grafana", @@ -189,6 +199,11 @@ func createLinuxPackages() { }) } +func createLinuxPackages() { + createDebPackages() + createRpmPackages() +} + func createPackage(options linuxPackageOptions) { packageRoot, _ := ioutil.TempDir("", "grafana-linux-pack") @@ -315,6 +330,8 @@ func build(pkg string, tags []string) { args = append(args, "-o", binary) args = append(args, pkg) setBuildEnv() + + runPrint("go", "version") runPrint("go", args...) // Create an md5 checksum of the binary, to be included in the archive for diff --git a/conf/defaults.ini b/conf/defaults.ini index 69d045dc4ae..06938b9370b 100644 --- a/conf/defaults.ini +++ b/conf/defaults.ini @@ -15,6 +15,10 @@ data = data # Directory where grafana can store logs # logs = data/log +# +# Directory where grafana will automatically scan and look for plugins +# +plugins = data/plugins #################################### Server #################################### [server] @@ -125,6 +129,12 @@ disable_gravatar = false # data source proxy whitelist (ip_or_domain:port seperated by spaces) data_source_proxy_whitelist = +[snapshots] +# snapshot sharing options +external_enabled = true +external_snapshot_url = https://snapshots-origin.raintank.io +external_snapshot_name = Publish to snapshot.raintank.io + #################################### Users #################################### [users] # disable user signup / registration @@ -142,6 +152,9 @@ auto_assign_org_role = Viewer # Require email validation before sign up completes verify_email_enabled = false +# Background text for the user field on the login page +login_hint = email or username + #################################### Anonymous Auth ########################## [auth.anonymous] # enable anonymous access @@ -225,7 +238,7 @@ level = Info [log.console] level = # Set formatting to "false" to disable color formatting of console logs -formatting = true +formatting = false # For "file" mode only [log.file] @@ -245,6 +258,18 @@ daily_rotate = true # Expired days of log file(delete after max days), default is 7 max_days = 7 +[log.syslog] +level = +# Syslog network type and address. This can be udp, tcp, or unix. If left blank, the default unix endpoints will be used. +network = +address = + +# Syslog facility. user, daemon and local0 through local7 are valid. +facility = + +# Syslog tag. By default, the process' argv[0] is used. +tag = + #################################### AMPQ Event Publisher ########################## [event_publisher] enabled = false diff --git a/conf/sample.ini b/conf/sample.ini index e8550c66c1a..b875cbda093 100644 --- a/conf/sample.ini +++ b/conf/sample.ini @@ -15,7 +15,12 @@ # Directory where grafana can store logs # ;logs = /var/log/grafana +# +# Directory where grafana will automatically scan and look for plugins +# +;plugins = /var/lib/grafana/plugins +# #################################### Server #################################### [server] # Protocol (http or https) @@ -120,6 +125,12 @@ # data source proxy whitelist (ip_or_domain:port seperated by spaces) ;data_source_proxy_whitelist = +[snapshots] +# snapshot sharing options +;external_enabled = true +;external_snapshot_url = https://snapshots-origin.raintank.io +;external_snapshot_name = Publish to snapshot.raintank.io + #################################### Users #################################### [users] # disable user signup / registration @@ -134,6 +145,9 @@ # Default role new users will be automatically assigned (if disabled above is set to true) ;auto_assign_org_role = Viewer +# Background text for the user field on the login page +;login_hint = email or username + #################################### Anonymous Auth ########################## [auth.anonymous] # enable anonymous access diff --git a/docker/production/README.md b/docker/production/README.md index f6da10e62f6..9b0e23baf75 100644 --- a/docker/production/README.md +++ b/docker/production/README.md @@ -2,7 +2,7 @@ # Grafana docker image This container currently only contains the in development alpha of Grafana 2.0 (ie non production use). The -`#develop` tag is constantly updated as we make progress torwards a beta release. +`#develop` tag is constantly updated as we make progress towards a beta release. ## Running your Grafana image @@ -17,7 +17,7 @@ Try it out, default admin user is admin/admin. ## Configuring your Grafana container -All options defined in conf/grafana.ini can be overriden using environment variables, for example: +All options defined in conf/grafana.ini can be overridden using environment variables, for example: ``` diff --git a/docs/VERSION b/docs/VERSION index 437459cd94c..e70b4523ae7 100644 --- a/docs/VERSION +++ b/docs/VERSION @@ -1 +1 @@ -2.5.0 +2.6.0 diff --git a/docs/mkdocs.yml b/docs/mkdocs.yml index 7931ae81c3c..7bca7e2f01f 100644 --- a/docs/mkdocs.yml +++ b/docs/mkdocs.yml @@ -45,19 +45,22 @@ pages: - ['guides/basic_concepts.md', 'User Guides', 'Basic Concepts'] - ['guides/gettingstarted.md', 'User Guides', 'Getting Started'] -- ['guides/whats-new-in-v2.md', 'User Guides', "What's New in Grafana v2.0"] +- ['guides/whats-new-in-v2-6.md', 'User Guides', "What's New in Grafana v2.6"] +- ['guides/whats-new-in-v2-5.md', 'User Guides', "What's New in Grafana v2.5"] - ['guides/whats-new-in-v2-1.md', 'User Guides', "What's New in Grafana v2.1"] +- ['guides/whats-new-in-v2.md', 'User Guides', "What's New in Grafana v2.0"] - ['guides/screencasts.md', 'User Guides', 'Screencasts'] - ['reference/graph.md', 'Reference', 'Graph Panel'] - ['reference/singlestat.md', 'Reference', 'Singlestat Panel'] +- ['reference/table_panel.md', 'Reference', 'Table Panel'] - ['reference/dashlist.md', 'Reference', 'Dashboard List Panel'] - ['reference/sharing.md', 'Reference', 'Sharing'] - ['reference/annotations.md', 'Reference', 'Annotations'] -- ['reference/timerange.md', 'Reference', 'Time Range Controls'] -- ['reference/search.md', 'Reference', 'Dashboard Search'] -- ['reference/templating.md', 'Reference', 'Templated Dashboards'] -- ['reference/scripting.md', 'Reference', 'Scripted Dashboards'] +- ['reference/timerange.md', 'Reference', 'Time Range'] +- ['reference/search.md', 'Reference', 'Search'] +- ['reference/templating.md', 'Reference', 'Templating'] +- ['reference/scripting.md', 'Reference', 'Scripting'] - ['reference/playlist.md', 'Reference', 'Playlist'] - ['reference/export_import.md', 'Reference', 'Import & Export'] - ['reference/admin.md', 'Reference', 'Administration'] diff --git a/docs/sources/datasources/cloudwatch.md b/docs/sources/datasources/cloudwatch.md index fa73824361e..4d87c4a0743 100644 --- a/docs/sources/datasources/cloudwatch.md +++ b/docs/sources/datasources/cloudwatch.md @@ -24,13 +24,14 @@ Name | Description ------------ | ------------- Name | The data source name, important that this is the same as in Grafana v1.x if you plan to import old dashboards. Default | Default data source means that it will be pre-selected for new panels. -Default-Region | Used in query editor to set region (can be changed on per query basis) +Credentials profile name | Specify the name of the profile to use (if you use `~/aws/credentials` file), leave blank for default. This option was introduced in Grafana 2.5.1 +Default Region | Used in query editor to set region (can be changed on per query basis) ## Authentication ### IAM Roles -Currently all access to CloudWatch is done server side by the Grafana backend using the offical AWS SDK. If you grafana +Currently all access to CloudWatch is done server side by the Grafana backend using the official AWS SDK. If you grafana server is running on AWS you can use IAM Roles and authentication will be handled automatically. Checkout AWS docs on [IAM Roles]](http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/iam-roles-for-amazon-ec2.html) @@ -53,12 +54,26 @@ Example content: You need to specify a namespace, metric, at least one stat, and at least one dimension. +## Templated queries +CloudWatch Datasource Plugin provides the following functions in `Variables values query` field in Templating Editor to query `region`, `namespaces`, `metric names` and `dimension keys/values` on the CloudWatch. + +Name | Description +------- | -------- +`regions()` | Returns a list of regions AWS provides their service. +`namespaces()` | Returns a list of namespaces CloudWatch support. +`metrics(namespace)` | Returns a list of metrics in the namespace. +`dimension_keys(namespace)` | Returns a list of dimension keys in the namespace. +`dimension_values(region, namespace, metric, dimension_key)` | Returns a list of dimension values matching the specified `region`, `namespace`, `metric` and `dimension_key`. + +For details about the metrics CloudWatch provides, please refer to the [CloudWatch documentation](https://docs.aws.amazon.com/AmazonCloudWatch/latest/DeveloperGuide/CW_Support_For_AWS.html). + +![](/img/v2/cloudwatch_templating.png) ## Cost It's worth to mention that Amazon will charge you for CloudWatch API usage. CloudWatch costs $0.01 per 1,000 GetMetricStatistics or ListMetrics requests. For each query Grafana will -issue a GetMetricStatistics request and every time you pick a dimenion in the query editor +issue a GetMetricStatistics request and every time you pick a dimension in the query editor Grafana will issue a ListMetrics request. diff --git a/docs/sources/datasources/elasticsearch.md b/docs/sources/datasources/elasticsearch.md index 76b0040ecd3..de9ada2bf58 100644 --- a/docs/sources/datasources/elasticsearch.md +++ b/docs/sources/datasources/elasticsearch.md @@ -53,6 +53,35 @@ a time pattern for the index name or a wildcard. The Elasticsearch query editor allows you to select multiple metrics and group by multiple terms or filters. Use the plus and minus icons to the right to add / remove metrics or group bys. Some metrics and group by have options, click the option text to expand the the row to view and edit metric or group by options. +## Pipeline metrics + +If you have Elasticsearch 2.x and Grafana 2.6 or above then you can use pipeline metric aggregations like +**Moving Average** and **Derivative**. Elasticsearch pipeline metrics require another metric to be based on. Use the eye icon next to the metric +to hide metrics from appearing in the graph. This is useful for metrics you only have in the query to be used +in a pipeline metric. + +![](/img/elasticsearch/pipeline_metrics_editor.png) + +## Templating + +The Elasticsearch datasource supports two types of queries you can use to fill template variables with values. + +### Possible values for a field + +```json +{"find": "terms", "field": "@hostname"} +``` + +### Fields filtered by type +```json +{"find": "fields", "type": "string"} +``` + +### Multi format / All format +Use lucene format. + + + ## Annotations TODO diff --git a/docs/sources/datasources/influxdb.md b/docs/sources/datasources/influxdb.md index e57d5a63fbc..da8ca08f549 100644 --- a/docs/sources/datasources/influxdb.md +++ b/docs/sources/datasources/influxdb.md @@ -38,29 +38,47 @@ Password | Database user's password > Direct access is still supported because in some cases it may be useful to access a Data Source directly depending on the use case and topology of Grafana, the user, and the Data Source. -## InfluxDB 0.9.x +## Query Editor -![](/img/influxdb/InfluxDB_09_editor.png) +![](/img/influxdb/editor_v3.png) You find the InfluxDB editor in the metrics tab in Graph or Singlestat panel's edit mode. You enter edit mode by clicking the panel title, then edit. The editor allows you to select metrics and tags. -### Editor tag filters +### Filter data (WHERE) To add a tag filter click the plus icon to the right of the `WHERE` condition. You can remove tag filters by clicking on the tag key and select `--remove tag filter--`. -### Regex matching +**Regex matching** + You can type in regex patterns for metric names or tag filter values, be sure to wrap the regex pattern in forward slashes (`/`). Grafana will automatically adjust the filter tag condition to use the InfluxDB regex match condition operator (`=~`). -### Editor group by -To group by a tag click the plus icon after the `GROUP BY ($interval)` text. Pick a tag from the dropdown that appears. -You can remove the group by by clicking on the tag and then select `--remove group by--` from the dropdown. +### Field & Aggregation functions +In the `SELECT` row you can specify what fields and functions you want to use. If you have a +group by time you need an aggregation function. Some functions like derivative require an aggregation function. -### Editor RAW Query -You can switch to raw query mode by pressing the pen icon. +The editor tries simplify and unify this part of the query. For example: +![](/img/influxdb/select_editor.png) -> If you use Raw Query be sure your query at minimum have `WHERE $timeFilter` clause and ends with `order by asc`. +The above will generate the following InfluxDB `SELECT` clause: + +```sql +SELECT derivative(mean("value"), 10s) /10 AS "REQ/s" FROM .... +``` + +#### Select multiple fields +Use the plus button and select Field > field to add another SELECT clause. You can also +specify an asterix `*` to select all fields. + +### Group By +To group by a tag click the plus icon at the end of the GROUP BY row. Pick a tag from the dropdown that appears. +You can remove the group by by clicking on the `tag` and then click on the x icon. + +### Text Editor Mode (RAW) +You can switch to raw query mode by clicking hamburger icon and then `Switch editor mode`. + +> If you use Raw Query be sure your query at minimum have `WHERE $timeFilter` > Also please always have a group by time and an aggregation function, otherwise InfluxDB can easily return hundreds of thousands > of data points that will hang the browser. @@ -72,7 +90,15 @@ You can switch to raw query mode by pressing the pen icon. - $tag_hostname = replaced with the value of the hostname tag - You can also use [[tag_hostname]] pattern replacement syntax -### Templating +### Table query / raw data + +![](/img/influxdb/raw_data.png) + +You can remove the group by time by clicking on the `time` part and then the `x` icon. You can +change the option `Format As` to `Table` if you want to show raw data in the `Table` panel. + + +## Templating You can create a template variable in Grafana and have that variable filled with values from any InfluxDB metric exploration query. You can then use this variable in your InfluxDB metric queries. @@ -93,7 +119,7 @@ SHOW TAG VALUES WITH KEY = "hostname" WHERE region =~ /$region/ ![](/img/influxdb/templating_simple_ex1.png) -### Annotations +## Annotations Annotations allows you to overlay rich event information on top of graphs. An example query: @@ -102,10 +128,4 @@ An example query: SELECT title, description from events WHERE $timeFilter order asc ``` -### InfluxDB 0.8.x - -![](/img/v1/influxdb_editor.png) - - - diff --git a/docs/sources/datasources/opentsdb.md b/docs/sources/datasources/opentsdb.md index 3368c39a0ae..43fcda643ee 100644 --- a/docs/sources/datasources/opentsdb.md +++ b/docs/sources/datasources/opentsdb.md @@ -30,18 +30,23 @@ Open a graph in edit mode by click the title. ![](/img/v2/opentsdb_query_editor.png) ### Auto complete suggestions -You should get auto complete suggestions for tags and tag values. If you do not you need to enable `tsd.core.meta.enable_realtime_ts` in -the OpenTSDB server settings. +As soon as you start typing metric names, tag names and tag values , you should see highlighted auto complete suggestions for them. - > Note: This is required for the OpenTSDB `lookup` api to work. + > Note: This is required for the OpenTSDB `suggest` api to work. ## Templating queries Grafana's OpenTSDB data source now supports template variable values queries. This means you can create template variables that fetch the values from OpenTSDB (for example metric names, tag names, or tag values). The query editor is also enhanced to limiting tags by metric. When using OpenTSDB with a template variable of `query` type you can use following syntax for lookup. - metrics() // returns metric names + metrics(prefix) // returns metric names with specific prefix (can be empty) tag_names(cpu) // return tag names (i.e. keys) for a specific cpu metric tag_values(cpu, hostname) // return tag values for metric cpu and tag key hostname + suggest_tagk(prefix) // return tag names (i.e. keys) for all metrics with specific prefix (can be empty) + suggest_tagv(prefix) // return tag values for all metrics with specific prefix (can be empty) -For details on opentsdb metric queries checkout the official [OpenTSDB documentation](http://opentsdb.net/docs/build/html/index.html) \ No newline at end of file +If you do not see template variables being populated in `Preview of values` section, you need to enable `tsd.core.meta.enable_realtime_ts` in the OpenTSDB server settings. Also, to populate metadata of the existing time series data in OpenTSDB, you need to run `tsdb uid metasync` on the OpenTSDB server. + +> Note: This is required for the OpenTSDB `lookup` api to work. + +For details on opentsdb metric queries checkout the official [OpenTSDB documentation](http://opentsdb.net/docs/build/html/index.html) diff --git a/docs/sources/guides/whats-new-in-v2-5.md b/docs/sources/guides/whats-new-in-v2-5.md new file mode 100644 index 00000000000..f02d0d43fd0 --- /dev/null +++ b/docs/sources/guides/whats-new-in-v2-5.md @@ -0,0 +1,105 @@ +--- +page_title: What's New in Grafana v2.5 +page_description: What's new in Grafana v2.5 +page_keywords: grafana, new, changes, features, documentation +--- + +# What's new in Grafana v2.5 + +## Release highlights +This is an exciting release, and we want to share some of the highlights. The release includes many +fixes and enhancements to all areas of Grafana, like new Data Sources, a new and improved timepicker, user invites, panel +resize handles and improved InfluxDB and OpenTSDB support. + +### New time range controls +New Time picker + +A new timepicker with room for more quick ranges as well as new types of relative ranges, like `Today`, +`The day so far` and `This day last week`. Also an improved time & calendar picker that now works +correctly in UTC mode. + +### Elasticsearch + +Elasticsearch example +
+ +This release brings a fully featured query editor for Elasticsearch. You will now be able to visualize +logs or any kind of data stored in Elasticserarch. The query editor allows you to build both simple +and complex queries for logs or metrics. + +- Compute metrics from your documents, supported Elasticsearch aggregations: + - Count, Avg, Min, Max, Sum + - Percentiles, Std Dev, etc. +- Group by multiple terms or filters + - Specify group by options like Top 5 based on Avg @value +- Auto completion for field names +- Query only relevant indices based on time pattern +- Alias patterns for short readable series names + +Try the new Elasticsearch query editor on the [play.grafana.org](http://play.grafana.org/dashboard/db/elasticsearch-metrics) site. + +### CloudWatch + +Cloudwatch editor + +Grafana 2.5 ships with a new CloudWatch datasource that will allow you to query and visualize CloudWatch +metrics directly from Grafana. + +- Rich editor with auto completion for metric names, namespaces and dimensions +- Templating queries for generic dashboards +- Alias patterns for short readable series names + +### Prometheus + +Prometheus editor + +Grafana 2.5 ships with a new Prometheus datasource that will allow you to query and visualize data +stored in Prometheus. + + +### Mix different data sources +Mix data sources in the same dashboard or in the same graph! + +In previous releases you have been able to mix different data sources on the same dashboard. In v2.5 you +will be able to mix then on the same graph! You can enable this by selecting the built in `-- Mixed --` data source. +When selected this will allow you to specify data source on a per query basis. This will, for example, allow you +to plot metrics from different Graphite servers on the same Graph or plot data from Elasticsearch alongside +data from Prometheus. Mixing different data sources on the same graph works for any data source, even custom ones. + +### Panel Resize handles + + +This release adds resize handles to the the bottom right corners of panels making is easy to resize both width and height. + +### User invites + + +This version also brings some new features for user management. + +- Organization admins can now invite new users (via email or manually via invite link) +- Users can signup using invite link and get automatically added to invited organization +- User signup workflow can (if enabled) contain an email verification step. +- Check out [#2353](https://github.com/grafana/grafana/issues/2353) for more info. + +### Miscellaneous improvements + +- InfluxDB query editor now supports math and AS expressions +- InfluxDB query editor now supports custom group by interval +- Panel drilldown link is easier to reach +- LDAP improvements (can now search for group membership if your LDAP server does not support memberOf attribute) +- More units for graph and singlestat panel (Length, Volume, Temperature, Pressure, Currency) +- Admin page for all organizations (remove / edit) + +### Breaking changes +There have been some changes to the data source plugin API. If you are using a custom plugin check that there is an update for it before you upgrade. Also +the new time picker does not currently support custom quick ranges like the last one did. This will likely be added in a +future release. + +### Changelog +For a detailed list and link to github issues for everything included in the 2.5 release please +view the [CHANGELOG.md](https://github.com/grafana/grafana/blob/master/CHANGELOG.md) file. + +- - - + +### Download Grafana 2.5 now + diff --git a/docs/sources/guides/whats-new-in-v2-6.md b/docs/sources/guides/whats-new-in-v2-6.md new file mode 100644 index 00000000000..ac644ad44af --- /dev/null +++ b/docs/sources/guides/whats-new-in-v2-6.md @@ -0,0 +1,123 @@ +--- +page_title: What's New in Grafana v2.6 +page_description: What's new in Grafana v2.6 +page_keywords: grafana, new, changes, features, documentation, table +--- + +# What's new in Grafana v2.6 + +## Release highlights +The release includes a new Table panel, a new InfluxDB query editor, support for Elasticsearch Pipeline Metrics and +support for multiple Cloudwatch credentials. + +## Table Panel + + +The new table panel is very flexible, supporting both multiple modes for time series as well as for +table, annotation and raw JSON data. It also provides date formating and value formating and coloring options. + +### Time series to rows + +In the most simple mode you can turn time series to rows. This means you get a `Time`, `Metric` and a `Value` column. +Where `Metric` is the name of the time series. + + + +### Table Transform +Above you see the options tab for the **Table Panel**. The most important option is the `To Table Transform`. +This option controls how the result of the metric/data query is turned into a table. + +### Column Styles +The column styles allow you control how dates and numbers are formatted. + +### Time series to columns +This transform allows you to take multiple time series and group them by time. Which will result in a `Time` column +and a column for each time series. + + + +In the screenshot above you can see how the same time series query as in the previous example can be transformed into +a different table by changing the `To Table Transform` to `Time series to columns`. + +### Time series to aggregations +This transform works very similar to the legend values in the Graph panel. Each series gets its own row. In the Options +tab you can select which aggregations you want using the plus button the Columns section. + + + +You have to think about how accurate the aggregations will be. It depends on what aggregation is used in the time series query, +how many data points are fetched, etc. The time series aggregations are calculated by Grafana after aggregation is performed +by the time series database. + +### Raw logs queries + +If you want to show documents from Elasticsearch pick `Raw Document` as the first metric. + + + +This in combination with the `JSON Data` table transform will allow you to pick which fields in the document +you want to show in the table. + + + +### Elasticsearch aggregations + +You can also make Elasticsearch aggregation queries without a `Date Histogram`. This allows you to +use Elasticsearch metric aggregations to get accurate aggregations for the selected time range. + + + +### Annotations + +The table can also show any annotations you have enabled in the dashboard. + + + +## The New InfluxDB Editor +The new InfluxDB editor is a lot more flexible and powerful. It supports nested functions, like `derivative`. +It also uses the same technique as the Graphite query editor in that it presents nested functions as chain of function +transformations. It tries to simplify and unify the complicated nature of InfluxDB's query language. + + + +In the `SELECT` row you can specify what fields and functions you want to use. If you have a +group by time you need an aggregation function. Some functions like derivative require an aggregation function. + +The editor tries simplify and unify this part of the query. For example: +![](/img/influxdb/select_editor.png) + +The above will generate the following InfluxDB `SELECT` clause: + +```sql +SELECT derivative(mean("value"), 10s) /10 AS "REQ/s" FROM .... +``` + +### Select multiple fields +Use the plus button and select Field > field to add another SELECT clause. You can also +specify an asterix `*` to select all fields. + +### Group By +To group by a tag click the plus icon at the end of the GROUP BY row. Pick a tag from the dropdown that appears. +You can remove the group by by clicking on the `tag` and then click on the x icon. + +The new editor also allows you to remove group by time and select `raw` table data. Which is very useful +in combination with the new Table panel to show raw log data stored in InfluxDB. + + + +## Pipeline metrics + +If you have Elasticsearch 2.x and Grafana 2.6 or above then you can use pipeline metric aggregations like +**Moving Average** and **Derivative**. Elasticsearch pipeline metrics require another metric to be based on. Use the eye icon next to the metric +to hide metrics from appearing in the graph. + +![](/img/elasticsearch/pipeline_metrics_editor.png) + +## Changelog +For a detailed list and link to github issues for everything included in the 2.6 release please +view the [CHANGELOG.md](https://github.com/grafana/grafana/blob/master/CHANGELOG.md) file. + +- - - + +Download Grafana 2.6 now + diff --git a/docs/sources/installation/debian.md b/docs/sources/installation/debian.md index 048474af3eb..ec6e30b35f1 100644 --- a/docs/sources/installation/debian.md +++ b/docs/sources/installation/debian.md @@ -10,13 +10,13 @@ page_keywords: grafana, installation, debian, ubuntu, guide Description | Download ------------ | ------------- -.deb for Debian-based Linux | [grafana_2.1.3_amd64.deb](https://grafanarel.s3.amazonaws.com/builds/grafana_2.1.3_amd64.deb) +.deb for Debian-based Linux | [grafana_2.6.0_amd64.deb](https://grafanarel.s3.amazonaws.com/builds/grafana_2.6.0_amd64.deb) ## Install - $ wget https://grafanarel.s3.amazonaws.com/builds/grafana_2.1.3_amd64.deb + $ wget https://grafanarel.s3.amazonaws.com/builds/grafana_2.6.0_amd64.deb $ sudo apt-get install -y adduser libfontconfig - $ sudo dpkg -i grafana_2.1.3_amd64.deb + $ sudo dpkg -i grafana_2.6.0_amd64.deb ## APT Repository @@ -122,7 +122,7 @@ To configure Grafana add a configuration file named `custom.ini` to the `conf` folder and override any of the settings defined in `conf/defaults.ini`. -Start Grafana by executing `./grafana web`. The `grafana` binary needs +Start Grafana by executing `./grafana-server web`. The `grafana-server` binary needs the working directory to be the root install directory (where the binary and the `public` folder is located). diff --git a/docs/sources/installation/performance.md b/docs/sources/installation/performance.md index 51ab747bcd2..f09686687ca 100644 --- a/docs/sources/installation/performance.md +++ b/docs/sources/installation/performance.md @@ -8,7 +8,7 @@ page_keywords: grafana, performance, documentation ## Graphite -Graphite 0.9.13 adds a much needed feature to the JSON rendering API +Graphite 0.9.14 adds a much needed feature to the JSON rendering API that is very important for Grafana. If you are experiencing slow load & rendering times for large time ranges then it is most likely caused by running Graphite 0.9.12 or lower. @@ -17,6 +17,6 @@ The latest version of Graphite adds a `maxDataPoints` parameter to the JSON render API. Without this feature Graphite can return hundreds of thousands of data points per graph, which can hang your browser. Be sure to upgrade to -[0.9.13](http://graphite.readthedocs.org/en/latest/releases/0_9_13.html). +[0.9.14](http://graphite.readthedocs.org/en/latest/releases/0_9_14.html). diff --git a/docs/sources/installation/rpm.md b/docs/sources/installation/rpm.md index 67057384af0..ec4f648e44b 100644 --- a/docs/sources/installation/rpm.md +++ b/docs/sources/installation/rpm.md @@ -10,24 +10,24 @@ page_keywords: grafana, installation, centos, fedora, opensuse, redhat, guide Description | Download ------------ | ------------- -.RPM for CentOS / Fedora / OpenSuse / Redhat Linux | [grafana-2.1.3-1.x86_64.rpm](https://grafanarel.s3.amazonaws.com/builds/grafana-2.1.3-1.x86_64.rpm) +.RPM for CentOS / Fedora / OpenSuse / Redhat Linux | [grafana-2.6.0-1.x86_64.rpm](https://grafanarel.s3.amazonaws.com/builds/grafana-2.6.0-1.x86_64.rpm) ## Install from package file You can install Grafana using Yum directly. - $ sudo yum install https://grafanarel.s3.amazonaws.com/builds/grafana-2.1.3-1.x86_64.rpm + $ sudo yum install https://grafanarel.s3.amazonaws.com/builds/grafana-2.6.0-1.x86_64.rpm Or install manually using `rpm`. #### On CentOS / Fedora / Redhat: $ sudo yum install initscripts fontconfig - $ sudo rpm -Uvh grafana-2.1.3-1.x86_64.rpm + $ sudo rpm -Uvh grafana-2.6.0-1.x86_64.rpm #### On OpenSuse: - $ sudo rpm -i --nodeps grafana-2.1.3-1.x86_64.rpm + $ sudo rpm -i --nodeps grafana-2.6.0-1.x86_64.rpm ## Install via YUM Repository diff --git a/docs/sources/installation/windows.md b/docs/sources/installation/windows.md index 1ef98ae4896..1bc2b5a2b92 100644 --- a/docs/sources/installation/windows.md +++ b/docs/sources/installation/windows.md @@ -10,7 +10,7 @@ page_keywords: grafana, installation, windows guide Description | Download ------------ | ------------- -Zip package for Windows | [grafana.2.1.3.windows-x64.zip](https://grafanarel.s3.amazonaws.com/winbuilds/dist/grafana-2.1.3.windows-x64.zip) +Zip package for Windows | [grafana.2.5.0.windows-x64.zip](https://grafanarel.s3.amazonaws.com/winbuilds/dist/grafana-2.5.0.windows-x64.zip) ## Configure diff --git a/docs/sources/reference/dashboard.md b/docs/sources/reference/dashboard.md new file mode 100644 index 00000000000..93adf5cd789 --- /dev/null +++ b/docs/sources/reference/dashboard.md @@ -0,0 +1,422 @@ +---- +page_title: Dashboard JSON +page_description: Dashboard JSON Reference +page_keywords: grafana, dashboard, json, documentation +--- + +# Dashboard JSON + +## Overview + +A dashboard in Grafana is represented by a JSON object, which stores metadata of its dashboard. Dashboard metadata includes dashboard properties, metadata from rows, panels, template variables, panel queries, etc. + +To view the JSON of a dashboard, follow the steps mentioned below: + + 1. Go to a dashboard + 2. Click on `Manage dashboard` menu on the top navigation bar + 3. Select `View JSON` from the dropdown menu + +## JSON fields + +When a user creates a new dashboard, a new dashboard JSON object is initialized with the following fields: + +> Note: In the following JSON, id is shown as null which is the default value assigned to it until a dashboard is saved. Once a dashboard is saved, an integer value is assigned to the `id` field. + +``` +{ + "id": null, + "title": "New dashboard", + "originalTitle": "New dashboard", + "tags": [], + "style": "dark", + "timezone": "browser", + "editable": true, + "hideControls": false, + "sharedCrosshair": false, + "rows": [], + "time": { + "from": "now-6h", + "to": "now" + }, + "timepicker": { + "time_options": [], + "refresh_intervals": [] + }, + "templating": { + "list": [] + }, + "annotations": { + "list": [] + }, + "schemaVersion": 7, + "version": 0, + "links": [] +} +``` +Each field in the dashboard JSON is explained below with its usage: + +| Name | Usage | +| ---- | ----- | +| **id** | unique dashboard id, an integer | +| **title** | current title of dashboard | +| **originalTitle** | title of dashboard when saved for the first time | +| **tags** | tags associated with dashboard, an array of strings | +| **style** | theme of dashboard, i.e. `dark` or `light` | +| **timezone** | timezone of dashboard, i.e. `utc` or `browser` | +| **editable** | whether a dashboard is editable or not | +| **hideControls** | whether row controls on the left in green are hidden or not | +| **sharedCrosshair** | TODO | +| **rows** | row metadata, see [rows section](/docs/sources/reference/dashboard.md/#rows) for details | +| **time** | time range for dashboard, i.e. last 6 hours, last 7 days, etc | +| **timepicker** | timepicker metadata, see [timepicker section](/docs/sources/reference/dashboard.md/#timepicker) for details | +| **templating** | templating metadata, see [templating section](/docs/sources/reference/dashboard.md/#templating) for details | +| **annotations** | annotations metadata, see [annotations section](/docs/sources/reference/dashboard.md/#annotations) for details | +| **schemaVersion** | TODO | +| **version** | TODO | +| **links** | TODO | + +### rows + +`rows` field consists of an array of JSON object representing each row in a dashboard, such as shown below: + +``` + "rows": [ + { + "collapse": false, + "editable": true, + "height": "200px", + "panels": [], + "title": "New row" + }, + { + "collapse": true, + "editable": true, + "height": "300px", + "panels": [], + "title": "New row" + } + ] +``` + +Usage of the fields is explained below: + +| Name | Usage | +| ---- | ----- | +| **collapse** | whether row is collapsed or not | +| **editable** | whether a row is editable or not | +| **height** | height of the row in pixels | +| **panels** | panels metadata, see [panels section](/docs/sources/reference/dashboard.md/#panels) for details | +| **title** | title of row | + +#### panels + +Panels are the building blocks a dashboard. It consists of datasource queries, type of graphs, aliases, etc. Panel JSON consists of an array of JSON objects, each representing a different panel in a row. Most of the fields are common for all panels but some fields depends on the panel type. Following is an example of panel JSON representing a `graph` panel type: + +``` +"panels": [ + { + "aliasColors": {}, + "bars": false, + "datasource": null, + "editable": true, + "error": false, + "fill": 0, + "grid": { + "leftLogBase": 1, + "leftMax": null, + "leftMin": null, + "rightLogBase": 1, + "rightMax": null, + "rightMin": null, + "threshold1": null, + "threshold1Color": "rgba(216, 200, 27, 0.27)", + "threshold2": null, + "threshold2Color": "rgba(234, 112, 112, 0.22)" + }, + "id": 1, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": true, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "links": [], + "nullPointMode": "connected", + "percentage": false, + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "span": 4, + "stack": false, + "steppedLine": false, + "targets": [ + { + "aggregator": "max", + "alias": "$tag_instance_id", + "currentTagKey": "", + "currentTagValue": "", + "downsampleAggregator": "avg", + "downsampleInterval": "", + "errors": {}, + "metric": "memory.percent-used", + "refId": "A", + "shouldComputeRate": false, + "tags": { + "app": "$app", + "env": "stage", + "instance_id": "*" + } + } + ], + "timeFrom": null, + "timeShift": null, + "title": "Memory Utilization", + "tooltip": { + "shared": true, + "value_type": "cumulative" + }, + "type": "graph", + "x-axis": true, + "y-axis": true, + "y_formats": [ + "percent", + "short" + ] + }, + { + "aliasColors": {}, + "bars": false, + "datasource": null, + "editable": true, + "error": false, + "fill": 0, + "grid": { + "leftLogBase": 1, + "leftMax": null, + "leftMin": null, + "rightLogBase": 1, + "rightMax": null, + "rightMin": null, + "threshold1": null, + "threshold1Color": "rgba(216, 200, 27, 0.27)", + "threshold2": null, + "threshold2Color": "rgba(234, 112, 112, 0.22)" + }, + "id": 2, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": true, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "links": [], + "nullPointMode": "connected", + "percentage": false, + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "span": 4, + "stack": false, + "steppedLine": false, + "targets": [ + { + "aggregator": "avg", + "alias": "$tag_instance_id", + "currentTagKey": "", + "currentTagValue": "", + "downsampleAggregator": "avg", + "downsampleInterval": "", + "errors": {}, + "metric": "memory.percent-cached", + "refId": "A", + "shouldComputeRate": false, + "tags": { + "app": "$app", + "env": "prod", + "instance_id": "*" + } + } + ], + "timeFrom": null, + "timeShift": null, + "title": "Memory Cached", + "tooltip": { + "shared": true, + "value_type": "cumulative" + }, + "type": "graph", + "x-axis": true, + "y-axis": true, + "y_formats": [ + "short", + "short" + ] + }, +``` + +Usage of each field is explained below: + +| Name | Usage | +| ---- | ----- | +| TODO | TODO | + +### timepicker + +Description: TODO + +``` +"timepicker": { + "collapse": false, + "enable": true, + "notice": false, + "now": true, + "refresh_intervals": [ + "5s", + "10s", + "30s", + "1m", + "5m", + "15m", + "30m", + "1h", + "2h", + "1d" + ], + "status": "Stable", + "time_options": [ + "5m", + "15m", + "1h", + "3h", + "6h", + "12h", + "24h", + "2d", + "3d", + "4d", + "7d", + "30d" + ], + "type": "timepicker" + } +``` + +Usage of the fields is explained below: + +| Name | Usage | +| ---- | ----- | +| **collapse** | whether timepicker is collapsed or not | +| **enable** | whether timepicker is enabled or not | +| **notice** | TODO | +| **now** | TODO | +| **refresh_intervals** | TODO | +| **status** | TODO | +| **time_options** | TODO | +| **type** | TODO | + +### templating + +`templating` fields contains array of template variables with their saved values along with some other metadata, for example: + +``` + "templating": { + "enable": true, + "list": [ + { + "allFormat": "wildcard", + "current": { + "tags": [], + "text": "prod", + "value": "prod" + }, + "datasource": null, + "includeAll": true, + "name": "env", + "options": [ + { + "selected": false, + "text": "All", + "value": "*" + }, + { + "selected": false, + "text": "stage", + "value": "stage" + }, + { + "selected": false, + "text": "test", + "value": "test" + } + ], + "query": "tag_values(cpu.utilization.average,env)", + "refresh": false, + "refresh": false, + "type": "query" + }, + { + "allFormat": "wildcard", + "current": { + "text": "apache", + "value": "apache" + }, + "datasource": null, + "includeAll": false, + "multi": false, + "multiFormat": "glob", + "name": "app", + "options": [ + { + "selected": true, + "text": "tomcat", + "value": "tomcat" + }, + { + "selected": false, + "text": "cassandra", + "value": "cassandra" + } + ], + "query": "tag_values(cpu.utilization.average,app)", + "refresh": false, + "regex": "", + "type": "query" + } + ] + } +``` + +Usage of the above mentioned fields in the templating section is explained below: + +| Name | Usage | +| ---- | ----- | +| **enable** | whether templating is enabled or not | +| **list** | an array of objects representing, each representing one template variable | +| **allFormat** | format to use while fetching all values from datasource, eg: `wildcard`, `glob`, `regex`, `pipe`, etc. | +| **current** | shows current selected variable text/value on the dashboard | +| **datasource** | shows datasource for the variables | +| **includeAll** | whether all value option is available or not | +| **multi** | whether multiple values can be selected or not from variable value list | +| **multiFormat** | format to use while fetching timeseries from datasource | +| **name** | name of variable | +| **options** | array of variable text/value pairs available for selection on dashboard | +| **query** | datasource query used to fetch values for a variable | +| **refresh** | TODO | +| **regex** | TODO | +| **type** | type of variable, i.e. `custom`, `query` or `interval` | + +### annotations + +TODO diff --git a/docs/sources/reference/http_api.md b/docs/sources/reference/http_api.md index 609f12269ca..15e7a06f3b8 100644 --- a/docs/sources/reference/http_api.md +++ b/docs/sources/reference/http_api.md @@ -36,9 +36,9 @@ You use the token in all requests in the `Authorization` header, like this: **Example**: - GET http://your.grafana.com/api/dashboards/db/mydash HTTP/1.1 - Accept: application/json - Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk + GET http://your.grafana.com/api/dashboards/db/mydash HTTP/1.1 + Accept: application/json + Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk The `Authorization` header value should be `Bearer `. @@ -52,26 +52,26 @@ Creates a new dashboard or updates an existing dashboard. **Example Request for new dashboard**: - POST /api/dashboards/db HTTP/1.1 - Accept: application/json - Content-Type: application/json - Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk + POST /api/dashboards/db HTTP/1.1 + Accept: application/json + Content-Type: application/json + Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk - { - "dashboard": { - "id": null, - "title": "Production Overview", - "tags": [ "templated" ], - "timezone": "browser", - "rows": [ - { - } - ], - "schemaVersion": 6, - "version": 0 - }, - "overwrite": false - } + { + "dashboard": { + "id": null, + "title": "Production Overview", + "tags": [ "templated" ], + "timezone": "browser", + "rows": [ + { + } + ], + "schemaVersion": 6, + "version": 0 + }, + "overwrite": false + } JSON Body schema: @@ -119,34 +119,34 @@ Will return the dashboard given the dashboard slug. Slug is the url friendly ver **Example Request**: - GET /api/dashboards/db/production-overview HTTP/1.1 - Accept: application/json - Content-Type: application/json - Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk + GET /api/dashboards/db/production-overview HTTP/1.1 + Accept: application/json + Content-Type: application/json + Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk **Example Response**: - HTTP/1.1 200 - Content-Type: application/json + HTTP/1.1 200 + Content-Type: application/json - { - "meta": { - "isStarred": false, - "slug": "production-overview" - }, - "model": { - "id": null, - "title": "Production Overview", - "tags": [ "templated" ], - "timezone": "browser", - "rows": [ - { - } - ] - "schemaVersion": 6, - "version": 0 - }, - } + { + "meta": { + "isStarred": false, + "slug": "production-overview" + }, + "model": { + "id": null, + "title": "Production Overview", + "tags": [ "templated" ], + "timezone": "browser", + "rows": [ + { + } + ], + "schemaVersion": 6, + "version": 0 + } + } ### Delete dashboard @@ -156,17 +156,17 @@ The above will delete the dashboard with the specified slug. The slug is the url **Example Request**: - DELETE /api/dashboards/db/test HTTP/1.1 - Accept: application/json - Content-Type: application/json - Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk + DELETE /api/dashboards/db/test HTTP/1.1 + Accept: application/json + Content-Type: application/json + Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk **Example Response**: - HTTP/1.1 200 - Content-Type: application/json + HTTP/1.1 200 + Content-Type: application/json - {"title": "Test"} + {"title": "Test"} ### Gets the home dashboard @@ -176,53 +176,53 @@ Will return the home dashboard. **Example Request**: - GET /api/dashboards/home HTTP/1.1 - Accept: application/json - Content-Type: application/json - Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk + GET /api/dashboards/home HTTP/1.1 + Accept: application/json + Content-Type: application/json + Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk **Example Response**: - HTTP/1.1 200 - Content-Type: application/json + HTTP/1.1 200 + Content-Type: application/json - { - "meta": { - "isHome":true, - "canSave":false, - "canEdit":false, - "canStar":false, - "slug":"", - "expires":"0001-01-01T00:00:00Z", - "created":"0001-01-01T00:00:00Z" - }, - "dashboard": { - "editable":false, - "hideControls":true, - "nav":[ - { - "enable":false, - "type":"timepicker" - } - ], - "rows": [ - { - - } - ], - "style":"dark", - "tags":[], - "templating":{ - "list":[ - ] - }, - "time":{ - }, - "timezone":"browser", - "title":"Home", - "version":5 - } + { + "meta": { + "isHome":true, + "canSave":false, + "canEdit":false, + "canStar":false, + "slug":"", + "expires":"0001-01-01T00:00:00Z", + "created":"0001-01-01T00:00:00Z" + }, + "dashboard": { + "editable":false, + "hideControls":true, + "nav":[ + { + "enable":false, + "type":"timepicker" } + ], + "rows": [ + { + + } + ], + "style":"dark", + "tags":[], + "templating":{ + "list":[ + ] + }, + "time":{ + }, + "timezone":"browser", + "title":"Home", + "version":5 + } + } ### Tags for Dashboard @@ -233,27 +233,27 @@ Get all tabs of dashboards **Example Request**: - GET /api/dashboards/home HTTP/1.1 - Accept: application/json - Content-Type: application/json - Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk + GET /api/dashboards/home HTTP/1.1 + Accept: application/json + Content-Type: application/json + Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk **Example Response**: - HTTP/1.1 200 - Content-Type: application/json + HTTP/1.1 200 + Content-Type: application/json + + [ + { + "term":"tag1", + "count":1 + }, + { + "term":"tag2", + "count":4 + } + ] - [ - { - "term":"tag1", - "count":1 - }, - { - "term":"tag2", - "count":4 - } - ] - ### Dashboard from JSON file `GET /file/:file` @@ -271,27 +271,27 @@ Status Codes: **Example Request**: - GET /api/search?query=MyDashboard&starred=true&tag=prod HTTP/1.1 - Accept: application/json - Content-Type: application/json - Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk + GET /api/search?query=MyDashboard&starred=true&tag=prod HTTP/1.1 + Accept: application/json + Content-Type: application/json + Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk **Example Response**: - HTTP/1.1 200 - Content-Type: application/json - - [ - { - "id":1, - "title":"Production Overview", - "uri":"db/production-overview", - "type":"dash-db", - "tags":[], - "isStarred":false - } - ] - + HTTP/1.1 200 + Content-Type: application/json + + [ + { + "id":1, + "title":"Production Overview", + "uri":"db/production-overview", + "type":"dash-db", + "tags":[], + "isStarred":false + } + ] + ## Data sources ### Get all datasources @@ -300,34 +300,34 @@ Status Codes: **Example Request**: - GET /api/datasources HTTP/1.1 - Accept: application/json - Content-Type: application/json - Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk + GET /api/datasources HTTP/1.1 + Accept: application/json + Content-Type: application/json + Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk **Example Response**: - HTTP/1.1 200 - Content-Type: application/json + HTTP/1.1 200 + Content-Type: application/json - [ - { - "id":1, - "orgId":1, - "name":"datasource_elastic", - "type":"elasticsearch", - "access":"proxy", - "url":"http://mydatasource.com", - "password":"", - "user":"", - "database":"grafana-dash", - "basicAuth":false, - "basicAuthUser":"", - "basicAuthPassword":"", - "isDefault":false, - "jsonData":null - } - ] + [ + { + "id":1, + "orgId":1, + "name":"datasource_elastic", + "type":"elasticsearch", + "access":"proxy", + "url":"http://mydatasource.com", + "password":"", + "user":"", + "database":"grafana-dash", + "basicAuth":false, + "basicAuthUser":"", + "basicAuthPassword":"", + "isDefault":false, + "jsonData":null + } + ] ### Get a single data sources by Id @@ -335,32 +335,32 @@ Status Codes: **Example Request**: - GET /api/datasources/1 HTTP/1.1 - Accept: application/json - Content-Type: application/json - Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk + GET /api/datasources/1 HTTP/1.1 + Accept: application/json + Content-Type: application/json + Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk **Example Response**: - HTTP/1.1 200 - Content-Type: application/json + HTTP/1.1 200 + Content-Type: application/json - { - "id":1, - "orgId":1, - "name":"test_datasource", - "type":"graphite", - "access":"proxy", - "url":"http://mydatasource.com", - "password":"", - "user":"", - "database":"", - "basicAuth":false, - "basicAuthUser":"", - "basicAuthPassword":"", - "isDefault":false, - "jsonData":null - } + { + "id":1, + "orgId":1, + "name":"test_datasource", + "type":"graphite", + "access":"proxy", + "url":"http://mydatasource.com", + "password":"", + "user":"", + "database":"", + "basicAuth":false, + "basicAuthUser":"", + "basicAuthPassword":"", + "isDefault":false, + "jsonData":null + } ### Create data source @@ -368,26 +368,26 @@ Status Codes: **Example Request**: - POST /api/datasources HTTP/1.1 - Accept: application/json - Content-Type: application/json - Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk + POST /api/datasources HTTP/1.1 + Accept: application/json + Content-Type: application/json + Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk - { - "name":"test_datasource", - "type":"graphite", - "url":"http://mydatasource.com", - "access":"proxy", - "basicAuth":false - } + { + "name":"test_datasource", + "type":"graphite", + "url":"http://mydatasource.com", + "access":"proxy", + "basicAuth":false + } **Example Response**: - HTTP/1.1 200 - Content-Type: application/json + HTTP/1.1 200 + Content-Type: application/json - {"id":1,"message":"Datasource added"} + {"id":1,"message":"Datasource added"} ### Update an existing data source @@ -395,34 +395,34 @@ Status Codes: **Example Request**: - PUT /api/datasources/1 HTTP/1.1 - Accept: application/json - Content-Type: application/json - Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk - - { - "id":1, - "orgId":1, - "name":"test_datasource", - "type":"graphite", - "access":"proxy", - "url":"http://mydatasource.com", - "password":"", - "user":"", - "database":"", - "basicAuth":true, - "basicAuthUser":"basicuser", - "basicAuthPassword":"basicuser", - "isDefault":false, - "jsonData":null - } + PUT /api/datasources/1 HTTP/1.1 + Accept: application/json + Content-Type: application/json + Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk + + { + "id":1, + "orgId":1, + "name":"test_datasource", + "type":"graphite", + "access":"proxy", + "url":"http://mydatasource.com", + "password":"", + "user":"", + "database":"", + "basicAuth":true, + "basicAuthUser":"basicuser", + "basicAuthPassword":"basicuser", + "isDefault":false, + "jsonData":null + } **Example Response**: - HTTP/1.1 200 - Content-Type: application/json + HTTP/1.1 200 + Content-Type: application/json - {"message":"Datasource updated"} + {"message":"Datasource updated"} ### Delete an existing data source @@ -430,17 +430,17 @@ Status Codes: **Example Request**: - DELETE /api/datasources/1 HTTP/1.1 - Accept: application/json - Content-Type: application/json - Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk + DELETE /api/datasources/1 HTTP/1.1 + Accept: application/json + Content-Type: application/json + Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk **Example Response**: - HTTP/1.1 200 - Content-Type: application/json + HTTP/1.1 200 + Content-Type: application/json - {"message":"Data source deleted"} + {"message":"Data source deleted"} ### Available data source types @@ -448,29 +448,29 @@ Status Codes: **Example Request**: - GET /api/datasources/plugins HTTP/1.1 - Accept: application/json - Content-Type: application/json - Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk - + GET /api/datasources/plugins HTTP/1.1 + Accept: application/json + Content-Type: application/json + Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk + **Example Response**: - HTTP/1.1 200 - Content-Type: application/json + HTTP/1.1 200 + Content-Type: application/json + + { + "grafana":{ + "metrics":true,"module":"plugins/datasource/grafana/datasource", + "name":"Grafana (for testing)", + "partials":{ + "query":"app/plugins/datasource/grafana/partials/query.editor.html" + }, + "pluginType":"datasource", + "serviceName":"GrafanaDatasource", + "type":"grafana" + } + } - { - "grafana":{ - "metrics":true,"module":"plugins/datasource/grafana/datasource", - "name":"Grafana (for testing)", - "partials":{ - "query":"app/plugins/datasource/grafana/partials/query.editor.html" - }, - "pluginType":"datasource", - "serviceName":"GrafanaDatasource", - "type":"grafana" - } - } - ## Data source proxy calls `GET /api/datasources/proxy/:datasourceId/*` @@ -485,20 +485,20 @@ Proxies all calls to the actual datasource. **Example Request**: - GET /api/org HTTP/1.1 - Accept: application/json - Content-Type: application/json - Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk + GET /api/org HTTP/1.1 + Accept: application/json + Content-Type: application/json + Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk **Example Response**: - HTTP/1.1 200 - Content-Type: application/json + HTTP/1.1 200 + Content-Type: application/json - { - "id":1, - "name":"Main Org." - } + { + "id":1, + "name":"Main Org." + } ### Update current Organisation @@ -506,49 +506,49 @@ Proxies all calls to the actual datasource. **Example Request**: - PUT /api/org HTTP/1.1 - Accept: application/json - Content-Type: application/json - Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk + PUT /api/org HTTP/1.1 + Accept: application/json + Content-Type: application/json + Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk + + { + "name":"Main Org." + } + - { - "name":"Main Org." - } - - **Example Response**: - HTTP/1.1 200 - Content-Type: application/json + HTTP/1.1 200 + Content-Type: application/json + + {"message":"Organization updated"} + - {"message":"Organization updated"} - - ### Get all users within the actual organisation `GET /api/org/users` **Example Request**: - GET /api/org/users HTTP/1.1 - Accept: application/json - Content-Type: application/json - Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk + GET /api/org/users HTTP/1.1 + Accept: application/json + Content-Type: application/json + Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk **Example Response**: - HTTP/1.1 200 - Content-Type: application/json + HTTP/1.1 200 + Content-Type: application/json - [ - { - "orgId":1, - "userId":1, - "email":"admin@mygraf.com", - "login":"admin", - "role":"Admin" - } - ] + [ + { + "orgId":1, + "userId":1, + "email":"admin@mygraf.com", + "login":"admin", + "role":"Admin" + } + ] ### Add a new user to the actual organisation @@ -558,65 +558,65 @@ Adds a global user to the actual organisation. **Example Request**: - POST /api/org/users HTTP/1.1 - Accept: application/json - Content-Type: application/json - Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk + POST /api/org/users HTTP/1.1 + Accept: application/json + Content-Type: application/json + Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk + + { + "role": "Admin", + "loginOrEmail": "admin" + } + - { - "role": "Admin", - "loginOrEmail": "admin" - } - - **Example Response**: - HTTP/1.1 200 - Content-Type: application/json - - {"message":"User added to organization"} - + HTTP/1.1 200 + Content-Type: application/json + + {"message":"User added to organization"} + ### Updates the given user `PATCH /api/org/users/:userId` **Example Request**: - PATCH /api/org/users/1 HTTP/1.1 - Accept: application/json - Content-Type: application/json - Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk + PATCH /api/org/users/1 HTTP/1.1 + Accept: application/json + Content-Type: application/json + Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk + + { + "role": "Viewer", + } + - { - "role": "Viewer", - } - - **Example Response**: - HTTP/1.1 200 - Content-Type: application/json - - {"message":"Organization user updated"} + HTTP/1.1 200 + Content-Type: application/json + + {"message":"Organization user updated"} + - ### Delete user in actual organisation `DELETE /api/org/users/:userId` **Example Request**: - DELETE /api/org/users/1 HTTP/1.1 - Accept: application/json - Content-Type: application/json - Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk + DELETE /api/org/users/1 HTTP/1.1 + Accept: application/json + Content-Type: application/json + Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk **Example Response**: - HTTP/1.1 200 - Content-Type: application/json - - {"message":"User removed from organization"} + HTTP/1.1 200 + Content-Type: application/json + + {"message":"User removed from organization"} ## Organisations @@ -627,22 +627,22 @@ Adds a global user to the actual organisation. **Example Request**: - GET /api/orgs HTTP/1.1 - Accept: application/json - Content-Type: application/json - Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk + GET /api/orgs HTTP/1.1 + Accept: application/json + Content-Type: application/json + Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk **Example Response**: - HTTP/1.1 200 - Content-Type: application/json - - [ - { - "id":1, - "name":"Main Org." - } - ] + HTTP/1.1 200 + Content-Type: application/json + + [ + { + "id":1, + "name":"Main Org." + } + ] ### Update Organisation @@ -652,22 +652,22 @@ Update Organisation, fields *Adress 1*, *Adress 2*, *City* are not implemented y **Example Request**: - PUT /api/orgs/1 HTTP/1.1 - Accept: application/json - Content-Type: application/json - Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk + PUT /api/orgs/1 HTTP/1.1 + Accept: application/json + Content-Type: application/json + Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk + + { + "name":"Main Org 2." + } + - { - "name":"Main Org 2." - } - - **Example Response**: - HTTP/1.1 200 - Content-Type: application/json - - {"message":"Organization updated"} + HTTP/1.1 200 + Content-Type: application/json + + {"message":"Organization updated"} ### Get Users in Organisation @@ -675,24 +675,24 @@ Update Organisation, fields *Adress 1*, *Adress 2*, *City* are not implemented y **Example Request**: - GET /api/orgs/1/users HTTP/1.1 - Accept: application/json - Content-Type: application/json - Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk + GET /api/orgs/1/users HTTP/1.1 + Accept: application/json + Content-Type: application/json + Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk **Example Response**: - HTTP/1.1 200 - Content-Type: application/json - [ - { - "orgId":1, - "userId":1, - "email":"admin@mygraf.com", - "login":"admin", - "role":"Admin" - } - ] + HTTP/1.1 200 + Content-Type: application/json + [ + { + "orgId":1, + "userId":1, + "email":"admin@mygraf.com", + "login":"admin", + "role":"Admin" + } + ] ### Add User in Organisation @@ -700,22 +700,22 @@ Update Organisation, fields *Adress 1*, *Adress 2*, *City* are not implemented y **Example Request**: - POST /api/orgs/1/users HTTP/1.1 - Accept: application/json - Content-Type: application/json - Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk + POST /api/orgs/1/users HTTP/1.1 + Accept: application/json + Content-Type: application/json + Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk + + { + "loginOrEmail":"user", + "role":"Viewer" + } - { - "loginOrEmail":"user", - "role":"Viewer" - } - **Example Response**: - HTTP/1.1 200 - Content-Type: application/json - - {"message":"User added to organization"} + HTTP/1.1 200 + Content-Type: application/json + + {"message":"User added to organization"} ### Update Users in Organisation @@ -723,21 +723,21 @@ Update Organisation, fields *Adress 1*, *Adress 2*, *City* are not implemented y **Example Request**: - PATCH /api/orgs/1/users/2 HTTP/1.1 - Accept: application/json - Content-Type: application/json - Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk + PATCH /api/orgs/1/users/2 HTTP/1.1 + Accept: application/json + Content-Type: application/json + Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk + + { + "role":"Admin" + } - { - "role":"Admin" - } - **Example Response**: - HTTP/1.1 200 - Content-Type: application/json - - {"message":"Organization user updated"} + HTTP/1.1 200 + Content-Type: application/json + + {"message":"Organization user updated"} ### Delete User in Organisation @@ -745,17 +745,17 @@ Update Organisation, fields *Adress 1*, *Adress 2*, *City* are not implemented y **Example Request**: - DELETE /api/orgs/1/users/2 HTTP/1.1 - Accept: application/json - Content-Type: application/json - Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk - + DELETE /api/orgs/1/users/2 HTTP/1.1 + Accept: application/json + Content-Type: application/json + Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk + **Example Response**: - HTTP/1.1 200 - Content-Type: application/json - - {"message":"User removed from organization"} + HTTP/1.1 200 + Content-Type: application/json + + {"message":"User removed from organization"} ## Users @@ -765,31 +765,32 @@ Update Organisation, fields *Adress 1*, *Adress 2*, *City* are not implemented y **Example Request**: - GET /api/users HTTP/1.1 - Accept: application/json - Content-Type: application/json - Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk + GET /api/users HTTP/1.1 + Accept: application/json + Content-Type: application/json + Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk **Example Response**: - HTTP/1.1 200 - Content-Type: application/json - [ - { - "id": 1, - "name": "Admin", - "login": "admin", - "email": "admin@mygraf.com", - "isAdmin": true - }, - { - "id": 2, - "name": "User", - "login": "user", - "email": "user@mygraf.com" - "isAdmin": false - } - ] + HTTP/1.1 200 + Content-Type: application/json + + [ + { + "id": 1, + "name": "Admin", + "login": "admin", + "email": "admin@mygraf.com", + "isAdmin": true + }, + { + "id": 2, + "name": "User", + "login": "user", + "email": "user@mygraf.com", + "isAdmin": false + } + ] ### Get single user by Id @@ -797,24 +798,24 @@ Update Organisation, fields *Adress 1*, *Adress 2*, *City* are not implemented y **Example Request**: - GET /api/users/1 HTTP/1.1 - Accept: application/json - Content-Type: application/json - Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk + GET /api/users/1 HTTP/1.1 + Accept: application/json + Content-Type: application/json + Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk **Example Response**: - HTTP/1.1 200 - Content-Type: application/json - - { - "email": "user@mygraf.com" - "name": "admin", - "login": "admin", - "theme": "light", - "orgId": 1, - "isGrafanaAdmin": true - } + HTTP/1.1 200 + Content-Type: application/json + + { + "email": "user@mygraf.com" + "name": "admin", + "login": "admin", + "theme": "light", + "orgId": 1, + "isGrafanaAdmin": true + } ### User Update @@ -822,23 +823,24 @@ Update Organisation, fields *Adress 1*, *Adress 2*, *City* are not implemented y **Example Request**: - PUT /api/users/2 HTTP/1.1 - Accept: application/json - Content-Type: application/json - Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk - - { - "email":"user@mygraf.com", - "name":"User2", - "login":"user", - "theme":"light" - } + PUT /api/users/2 HTTP/1.1 + Accept: application/json + Content-Type: application/json + Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk + + { + "email":"user@mygraf.com", + "name":"User2", + "login":"user", + "theme":"light" + } + **Example Response**: - - HTTP/1.1 200 - Content-Type: application/json - - {"message":"User updated"} + + HTTP/1.1 200 + Content-Type: application/json + + {"message":"User updated"} ### Get Organisations for user @@ -847,23 +849,23 @@ Update Organisation, fields *Adress 1*, *Adress 2*, *City* are not implemented y **Example Request**: - GET /api/users/1/orgs HTTP/1.1 - Accept: application/json - Content-Type: application/json - Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk + GET /api/users/1/orgs HTTP/1.1 + Accept: application/json + Content-Type: application/json + Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk **Example Response**: - HTTP/1.1 200 - Content-Type: application/json + HTTP/1.1 200 + Content-Type: application/json - [ - { - "orgId":1, - "name":"Main Org.", - "role":"Admin" - } - ] + [ + { + "orgId":1, + "name":"Main Org.", + "role":"Admin" + } + ] ## User @@ -873,24 +875,24 @@ Update Organisation, fields *Adress 1*, *Adress 2*, *City* are not implemented y **Example Request**: - GET /api/user HTTP/1.1 - Accept: application/json - Content-Type: application/json - Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk - + GET /api/user HTTP/1.1 + Accept: application/json + Content-Type: application/json + Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk + **Example Response**: - HTTP/1.1 200 - Content-Type: application/json - - { - "email":"admin@mygraf.com", - "name":"Admin", - "login":"admin", - "theme":"light", - "orgId":1, - "isGrafanaAdmin":true - } + HTTP/1.1 200 + Content-Type: application/json + + { + "email":"admin@mygraf.com", + "name":"Admin", + "login":"admin", + "theme":"light", + "orgId":1, + "isGrafanaAdmin":true + } ### Change Password @@ -900,22 +902,23 @@ Changes the password for the user **Example Request**: - PUT /api/user/password HTTP/1.1 - Accept: application/json - Content-Type: application/json - Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk + PUT /api/user/password HTTP/1.1 + Accept: application/json + Content-Type: application/json + Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk + + { + "oldPassword": "old_password", + "newPassword": "new_password", + "confirmNew": "confirm_new_password" + } - { - "password": ""new_password" - } - - **Example Response**: - HTTP/1.1 200 - Content-Type: application/json - - {"message":"User password updated"} + HTTP/1.1 200 + Content-Type: application/json + + {"message":"User password changed"} ### Switch user context @@ -925,17 +928,17 @@ Switch user context to the given organisation. **Example Request**: - POST /api/user/using/2 HTTP/1.1 - Accept: application/json - Content-Type: application/json - Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk - + POST /api/user/using/2 HTTP/1.1 + Accept: application/json + Content-Type: application/json + Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk + **Example Response**: - HTTP/1.1 200 - Content-Type: application/json - - {"message":"Active organization changed"} + HTTP/1.1 200 + Content-Type: application/json + + {"message":"Active organization changed"} ### Organisations of the actual User @@ -945,23 +948,23 @@ Return a list of all organisations of the current user. **Example Request**: - GET /api/user/orgs HTTP/1.1 - Accept: application/json - Content-Type: application/json - Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk - + GET /api/user/orgs HTTP/1.1 + Accept: application/json + Content-Type: application/json + Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk + **Example Response**: - HTTP/1.1 200 - Content-Type: application/json - - [ - { - "orgId":1, - "name":"Main Org.", - "role":"Admin" - } - ] + HTTP/1.1 200 + Content-Type: application/json + + [ + { + "orgId":1, + "name":"Main Org.", + "role":"Admin" + } + ] ### Star a dashboard @@ -971,17 +974,17 @@ Stars the given Dashboard for the actual user. **Example Request**: - POST /api/user/stars/dashboard/1 HTTP/1.1 - Accept: application/json - Content-Type: application/json - Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk - + POST /api/user/stars/dashboard/1 HTTP/1.1 + Accept: application/json + Content-Type: application/json + Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk + **Example Response**: - HTTP/1.1 200 - Content-Type: application/json - - {"message":"Dashboard starred!"} + HTTP/1.1 200 + Content-Type: application/json + + {"message":"Dashboard starred!"} ### Unstar a dashboard @@ -991,17 +994,17 @@ Deletes the starring of the given Dashboard for the actual user. **Example Request**: - DELETE /api/user/stars/dashboard/1 HTTP/1.1 - Accept: application/json - Content-Type: application/json - Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk - + DELETE /api/user/stars/dashboard/1 HTTP/1.1 + Accept: application/json + Content-Type: application/json + Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk + **Example Response**: - HTTP/1.1 200 - Content-Type: application/json - - {"message":"Dashboard unstarred"} + HTTP/1.1 200 + Content-Type: application/json + + {"message":"Dashboard unstarred"} ## Snapshots @@ -1012,112 +1015,111 @@ Deletes the starring of the given Dashboard for the actual user. **Example Request**: - POST /api/snapshots HTTP/1.1 - Accept: application/json - Content-Type: application/json - Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk - - { - "dashboard": { - "editable":false, - "hideControls":true, - "nav":[ - { - "enable":false, - "type":"timepicker" - } - ], - "rows": [ - { - - } - ], - "style":"dark", - "tags":[], - "templating":{ - "list":[ - ] - }, - "time":{ - }, - "timezone":"browser", - "title":"Home", - "version":5 - } - "expires": 3600 - } - + POST /api/snapshots HTTP/1.1 + Accept: application/json + Content-Type: application/json + Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk + + { + "dashboard": { + "editable":false, + "hideControls":true, + "nav":[ + { + "enable":false, + "type":"timepicker" + } + ], + "rows": [ + { + + } + ], + "style":"dark", + "tags":[], + "templating":{ + "list":[ + ] + }, + "time":{ + }, + "timezone":"browser", + "title":"Home", + "version":5 + }, + "expires": 3600 + } + **Example Response**: - HTTP/1.1 200 - Content-Type: application/json - { - "deleteKey":"XXXXXXX", - "deleteUrl":"myurl/dashboard/snapshot/XXXXXXX", - "key":"YYYYYYY", - "url":"myurl/dashboard/snapshot/YYYYYYY" - } + HTTP/1.1 200 + Content-Type: application/json + { + "deleteKey":"XXXXXXX", + "deleteUrl":"myurl/dashboard/snapshot/XXXXXXX", + "key":"YYYYYYY", + "url":"myurl/dashboard/snapshot/YYYYYYY" + } Keys: - **deleteKey** – Key generated to delete the snapshot - **key** – Key generated to share the dashboard - + ### Get Snapshot by Id - + `GET /api/snapshots/:key` **Example Request**: - GET /api/snapshots/YYYYYYY HTTP/1.1 - Accept: application/json - Content-Type: application/json - Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk - + GET /api/snapshots/YYYYYYY HTTP/1.1 + Accept: application/json + Content-Type: application/json + Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk + **Example Response**: - HTTP/1.1 200 - Content-Type: application/json - - { - "meta":{ - "isSnapshot":true, - "type":"snapshot", - "canSave":false, - "canEdit":false, - "canStar":false, - "slug":"", - "expires":"2200-13-32T25:23:23+02:00", - "created":"2200-13-32T28:24:23+02:00"}, - - { - "dashboard": { - "editable":false, - "hideControls":true, - "nav":[ - { - "enable":false, - "type":"timepicker" - } - ], - "rows": [ - { - - } - ], - "style":"dark", - "tags":[], - "templating":{ - "list":[ - ] - }, - "time":{ - }, - "timezone":"browser", - "title":"Home", - "version":5 - } - } + HTTP/1.1 200 + Content-Type: application/json + + { + "meta":{ + "isSnapshot":true, + "type":"snapshot", + "canSave":false, + "canEdit":false, + "canStar":false, + "slug":"", + "expires":"2200-13-32T25:23:23+02:00", + "created":"2200-13-32T28:24:23+02:00" + }, + "dashboard": { + "editable":false, + "hideControls":true, + "nav":[ + { + "enable":false, + "type":"timepicker" + } + ], + "rows": [ + { + + } + ], + "style":"dark", + "tags":[], + "templating":{ + "list":[ + ] + }, + "time":{ + }, + "timezone":"browser", + "title":"Home", + "version":5 + } + } ### Delete Snapshot by Id @@ -1125,18 +1127,18 @@ Keys: **Example Request**: - GET /api/snapshots/YYYYYYY HTTP/1.1 - Accept: application/json - Content-Type: application/json - Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk + GET /api/snapshots/YYYYYYY HTTP/1.1 + Accept: application/json + Content-Type: application/json + Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk **Example Response**: - HTTP/1.1 200 - Content-Type: application/json - - {"message":"Snapshot deleted. It might take an hour before it's cleared from a CDN cache."} - + HTTP/1.1 200 + Content-Type: application/json + + {"message":"Snapshot deleted. It might take an hour before it's cleared from a CDN cache."} + ## Frontend Settings @@ -1146,45 +1148,44 @@ Keys: **Example Request**: - GET /api/frontend/settings HTTP/1.1 - Accept: application/json - Content-Type: application/json - Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk + GET /api/frontend/settings HTTP/1.1 + Accept: application/json + Content-Type: application/json + Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk **Example Response**: - HTTP/1.1 200 - Content-Type: application/json - - { - "allowOrgCreate":true, - "appSubUrl":"", - "buildInfo":{ - "buildstamp":xxxxxx, - "commit":"vyyyy", - "version":"zzzzz" - }, - "datasources":{ - "datasourcename":{ - "index":"grafana-dash", - "meta":{ - "annotations":true, - "module":"plugins/datasource/grafana/datasource", - "name":"Grafana", - "partials":{ - "annotations":"app/plugins/datasource/grafana/partials/annotations.editor.html", - "config":"app/plugins/datasource/grafana/partials/config.html" - }, - "pluginType":"datasource", - "serviceName":"Grafana", - "type":"grafanasearch" - } - } - } - - defaultDatasource: "Grafana" - } - + HTTP/1.1 200 + Content-Type: application/json + + { + "allowOrgCreate":true, + "appSubUrl":"", + "buildInfo":{ + "buildstamp":xxxxxx, + "commit":"vyyyy", + "version":"zzzzz" + }, + "datasources":{ + "datasourcename":{ + "index":"grafana-dash", + "meta":{ + "annotations":true, + "module":"plugins/datasource/grafana/datasource", + "name":"Grafana", + "partials":{ + "annotations":"app/plugins/datasource/grafana/partials/annotations.editor.html", + "config":"app/plugins/datasource/grafana/partials/config.html" + }, + "pluginType":"datasource", + "serviceName":"Grafana", + "type":"grafanasearch" + } + } + }, + "defaultDatasource": "Grafana" + } + ## Login ### Renew session based on remember cookie @@ -1193,18 +1194,18 @@ Keys: **Example Request**: - GET /api/login/ping HTTP/1.1 - Accept: application/json - Content-Type: application/json - Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk + GET /api/login/ping HTTP/1.1 + Accept: application/json + Content-Type: application/json + Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk **Example Response**: - HTTP/1.1 200 - Content-Type: application/json - - {"message": "Logged in"} - + HTTP/1.1 200 + Content-Type: application/json + + {"message": "Logged in"} + ## Admin ### Settings @@ -1213,155 +1214,155 @@ Keys: **Example Request**: - GET /api/admin/settings - Accept: application/json - Content-Type: application/json - Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk + GET /api/admin/settings + Accept: application/json + Content-Type: application/json + Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk **Example Response**: - HTTP/1.1 200 - Content-Type: application/json - - { - "DEFAULT": - { - "app_mode":"production"}, - "analytics": - { - "google_analytics_ua_id":"", - "reporting_enabled":"false" - }, - "auth.anonymous":{ - "enabled":"true", - "org_name":"Main Org.", - "org_role":"Viewer" - }, - "auth.basic":{ - "enabled":"false" - }, - "auth.github":{ - "allow_sign_up":"false", - "allowed_domains":"", - "allowed_organizations":"", - "api_url":"https://api.github.com/user", - "auth_url":"https://github.com/login/oauth/authorize", - "client_id":"some_id", - "client_secret":"************", - "enabled":"false", - "scopes":"user:email", - "team_ids":"", - "token_url":"https://github.com/login/oauth/access_token" - }, - "auth.google":{ - "allow_sign_up":"false","allowed_domains":"", - "api_url":"https://www.googleapis.com/oauth2/v1/userinfo", - "auth_url":"https://accounts.google.com/o/oauth2/auth", - "client_id":"some_client_id", - "client_secret":"************", - "enabled":"false", - "scopes":"https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email", - "token_url":"https://accounts.google.com/o/oauth2/token" - }, - "auth.ldap":{ - "config_file":"/etc/grafana/ldap.toml", - "enabled":"false" - }, - "auth.proxy":{ - "auto_sign_up":"true", - "enabled":"false", - "header_name":"X-WEBAUTH-USER", - "header_property":"username" - }, - "dashboards.json":{ - "enabled":"false", - "path":"/var/lib/grafana/dashboards" - }, - "database":{ - "host":"127.0.0.1:0000", - "name":"grafana", - "password":"************", - "path":"grafana.db", - "ssl_mode":"disable", - "type":"sqlite3", - "user":"root" - }, - "emails":{ - "templates_pattern":"emails/*.html", - "welcome_email_on_sign_up":"false" - }, - "event_publisher":{ - "enabled":"false", - "exchange":"grafana_events", - "rabbitmq_url":"amqp://localhost/" - }, - "log":{ - "buffer_len":"10000", - "level":"Info", - "mode":"file" - }, - "log.console":{ - "level":"" - }, - "log.file":{ - "daily_rotate":"true", - "file_name":"", - "level":"", - "log_rotate":"true", - "max_days":"7", - "max_lines":"1000000", - "max_lines_shift":"28", - "max_size_shift":"" - }, - "paths":{ - "data":"/tsdb/grafana", - "logs":"/logs/apps/grafana"}, - "security":{ - "admin_password":"************", - "admin_user":"admin", - "cookie_remember_name":"grafana_remember", - "cookie_username":"grafana_user", - "disable_gravatar":"false", - "login_remember_days":"7", - "secret_key":"************" - }, - "server":{ - "cert_file":"", - "cert_key":"", - "domain":"mygraf.com", - "enable_gzip":"false", - "enforce_domain":"false", - "http_addr":"127.0.0.1", - "http_port":"0000", - "protocol":"http", - "root_url":"%(protocol)s://%(domain)s:%(http_port)s/", - "router_logging":"true", - "static_root_path":"public" - }, - "session":{ - "cookie_name":"grafana_sess", - "cookie_secure":"false", - "gc_interval_time":"", - "provider":"file", - "provider_config":"sessions", - "session_life_time":"86400" - }, - "smtp":{ - "cert_file":"", - "enabled":"false", - "from_address":"admin@grafana.localhost", - "host":"localhost:25", - "key_file":"", - "password":"************", - "skip_verify":"false", - "user":""}, - "users":{ - "allow_org_create":"true", - "allow_sign_up":"false", - "auto_assign_org":"true", - "auto_assign_org_role":"Viewer" - } - } + HTTP/1.1 200 + Content-Type: application/json + + { + "DEFAULT": + { + "app_mode":"production"}, + "analytics": + { + "google_analytics_ua_id":"", + "reporting_enabled":"false" + }, + "auth.anonymous":{ + "enabled":"true", + "org_name":"Main Org.", + "org_role":"Viewer" + }, + "auth.basic":{ + "enabled":"false" + }, + "auth.github":{ + "allow_sign_up":"false", + "allowed_domains":"", + "allowed_organizations":"", + "api_url":"https://api.github.com/user", + "auth_url":"https://github.com/login/oauth/authorize", + "client_id":"some_id", + "client_secret":"************", + "enabled":"false", + "scopes":"user:email", + "team_ids":"", + "token_url":"https://github.com/login/oauth/access_token" + }, + "auth.google":{ + "allow_sign_up":"false","allowed_domains":"", + "api_url":"https://www.googleapis.com/oauth2/v1/userinfo", + "auth_url":"https://accounts.google.com/o/oauth2/auth", + "client_id":"some_client_id", + "client_secret":"************", + "enabled":"false", + "scopes":"https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email", + "token_url":"https://accounts.google.com/o/oauth2/token" + }, + "auth.ldap":{ + "config_file":"/etc/grafana/ldap.toml", + "enabled":"false" + }, + "auth.proxy":{ + "auto_sign_up":"true", + "enabled":"false", + "header_name":"X-WEBAUTH-USER", + "header_property":"username" + }, + "dashboards.json":{ + "enabled":"false", + "path":"/var/lib/grafana/dashboards" + }, + "database":{ + "host":"127.0.0.1:0000", + "name":"grafana", + "password":"************", + "path":"grafana.db", + "ssl_mode":"disable", + "type":"sqlite3", + "user":"root" + }, + "emails":{ + "templates_pattern":"emails/*.html", + "welcome_email_on_sign_up":"false" + }, + "event_publisher":{ + "enabled":"false", + "exchange":"grafana_events", + "rabbitmq_url":"amqp://localhost/" + }, + "log":{ + "buffer_len":"10000", + "level":"Info", + "mode":"file" + }, + "log.console":{ + "level":"" + }, + "log.file":{ + "daily_rotate":"true", + "file_name":"", + "level":"", + "log_rotate":"true", + "max_days":"7", + "max_lines":"1000000", + "max_lines_shift":"28", + "max_size_shift":"" + }, + "paths":{ + "data":"/tsdb/grafana", + "logs":"/logs/apps/grafana"}, + "security":{ + "admin_password":"************", + "admin_user":"admin", + "cookie_remember_name":"grafana_remember", + "cookie_username":"grafana_user", + "disable_gravatar":"false", + "login_remember_days":"7", + "secret_key":"************" + }, + "server":{ + "cert_file":"", + "cert_key":"", + "domain":"mygraf.com", + "enable_gzip":"false", + "enforce_domain":"false", + "http_addr":"127.0.0.1", + "http_port":"0000", + "protocol":"http", + "root_url":"%(protocol)s://%(domain)s:%(http_port)s/", + "router_logging":"true", + "static_root_path":"public" + }, + "session":{ + "cookie_name":"grafana_sess", + "cookie_secure":"false", + "gc_interval_time":"", + "provider":"file", + "provider_config":"sessions", + "session_life_time":"86400" + }, + "smtp":{ + "cert_file":"", + "enabled":"false", + "from_address":"admin@grafana.localhost", + "host":"localhost:25", + "key_file":"", + "password":"************", + "skip_verify":"false", + "user":""}, + "users":{ + "allow_org_create":"true", + "allow_sign_up":"false", + "auto_assign_org":"true", + "auto_assign_org_role":"Viewer" + } + } ### Global Users @@ -1371,24 +1372,24 @@ Create new user **Example Request**: - POST /api/admin/users HTTP/1.1 - Accept: application/json - Content-Type: application/json - Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk - - { - "name":"User", - "email":"user@graf.com", - "login":"user", - "password":"userpassword" - } + POST /api/admin/users HTTP/1.1 + Accept: application/json + Content-Type: application/json + Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk + + { + "name":"User", + "email":"user@graf.com", + "login":"user", + "password":"userpassword" + } **Example Response**: - HTTP/1.1 200 - Content-Type: application/json - - {"message":"User created"} + HTTP/1.1 200 + Content-Type: application/json + + {"id":5,"message":"User created"} ### Password for User @@ -1398,17 +1399,17 @@ Change password for specific user **Example Request**: - PUT /api/admin/users/2/password HTTP/1.1 - Accept: application/json - Content-Type: application/json - Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk - + PUT /api/admin/users/2/password HTTP/1.1 + Accept: application/json + Content-Type: application/json + Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk + **Example Response**: - HTTP/1.1 200 - Content-Type: application/json - - {"password":"userpassword"} + HTTP/1.1 200 + Content-Type: application/json + + {"password":"userpassword"} ### Permissions @@ -1416,17 +1417,17 @@ Change password for specific user **Example Request**: - PUT /api/admin/users/2/permissions HTTP/1.1 - Accept: application/json - Content-Type: application/json - Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk - + PUT /api/admin/users/2/permissions HTTP/1.1 + Accept: application/json + Content-Type: application/json + Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk + **Example Response**: - HTTP/1.1 200 - Content-Type: application/json - - {message: "User permissions updated"} + HTTP/1.1 200 + Content-Type: application/json + + {message: "User permissions updated"} ### Delete global User @@ -1434,14 +1435,14 @@ Change password for specific user **Example Request**: - DELETE /api/admin/users/2 HTTP/1.1 - Accept: application/json - Content-Type: application/json - Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk + DELETE /api/admin/users/2 HTTP/1.1 + Accept: application/json + Content-Type: application/json + Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk **Example Response**: - HTTP/1.1 200 - Content-Type: application/json - - {message: "User deleted"} + HTTP/1.1 200 + Content-Type: application/json + + {message: "User deleted"} diff --git a/docs/sources/reference/keyboard_shortcuts.md b/docs/sources/reference/keyboard_shortcuts.md index 627bfc5c3dd..c9da3d5c6a1 100644 --- a/docs/sources/reference/keyboard_shortcuts.md +++ b/docs/sources/reference/keyboard_shortcuts.md @@ -17,7 +17,7 @@ Press `Shift`+`?` to open the keyboard shortcut dialog from anywhere within the |Shortcut|Action| |---|---| |`Esc`|Exit fullscreen edit/view mode, close search or any editor view| -|`CTRL`+`F`|Open dashboard search view (also contains import/playlist controls)| +|`F`|Open dashboard search view (also contains import/playlist controls)| |`CTRL`+`S`|Save dashboard| |`CTRL`+`H`|Hide row controls| |`CTRL`+`Z`|Zoom out| @@ -25,8 +25,6 @@ Press `Shift`+`?` to open the keyboard shortcut dialog from anywhere within the |`CTRL`+`O`|Enable/Disable shared graph crosshair| +**Note**: Grafana keyboard shortcuts are the same across operating system. -**Note**: Grafana keyboard shortcuts are the same across operating system. For example, `CTRL`+`F` will open the dashboard picker on a Mac as well, **not** `⌘`+`F` - - -Have a suggestion for a new keyboard shortcut? Let us know. \ No newline at end of file +Have a suggestion for a new keyboard shortcut? Let us know. diff --git a/docs/sources/reference/singlestat.md b/docs/sources/reference/singlestat.md index 6f7c9fbd965..91724e89882 100644 --- a/docs/sources/reference/singlestat.md +++ b/docs/sources/reference/singlestat.md @@ -54,4 +54,21 @@ Value to text mapping allows you to translate the value of the summary stat into +## Troubleshooting +### Multiple Series Error + + + + +Grafana 2.5 introduced stricter checking for multiple-series on singlestat panels. In previous versions, the panel logic did not verify that only a single series was used, and instead, displayed the first series encountered. Depending on your data source, this could have lead to inconsistent data being shown and/or a general confusion about which metric was being displayed. + +To fix your singlestat panel: + +- Edit your panel by clicking the Panel Title and selecting *Edit*. + +- Do you have multiple queries in the metrics tab? + - Solution: Select a single query to visualize. You can toggle whether a query is visualized by clicking the eye icon on each line. If the error persists, continue to the next solution. + +- Do you have one query? + - Solution: This likely means your query is returning multiple series. You will want to reduce this down to a single series. This can be accomplished in many ways, depending on your data source. Some common practices include summing the series, averaging or any number of other functions. Consult the documentation for your data source for additional information. diff --git a/docs/sources/reference/table_panel.md b/docs/sources/reference/table_panel.md new file mode 100644 index 00000000000..65437f85bd7 --- /dev/null +++ b/docs/sources/reference/table_panel.md @@ -0,0 +1,86 @@ +---- +page_title: Table Panel +page_description: Table Panel Reference +page_keywords: grafana, table, panel, documentation +--- + +# Table Panel + + + +The new table panel is very flexible, supporting both multiple modes for time series as well as for +table, annotation and raw JSON data. It also provides date formatting and value formatting and coloring options. + +To view table panels in action and test different configurations with sample data, check out the [Table Panel Showcase in the Grafana Playground](http://play.grafana.org/dashboard/db/table-panel-showcase). + +## Options overview + +The table panel has many ways to manipulate your data for optimal presentation. + + + +1. `Data`: Control how your query is transformed into a table. +2. `Table Display`: Table display options. +3. `Column Styles`: Column value formatting and display options. + +## Data to Table + + + +The data section contains the **To Table Transform (1)**. This is the primary option for how your data/metric +query should be transformed into a table format. The **Columns (2)** option allows you to select what columns +you want in the table. Only applicable for some transforms. + +### Time series to rows + + + +In the most simple mode you can turn time series to rows. This means you get a `Time`, `Metric` and a `Value` column. Where `Metric` is the name of the time series. + +### Time series to columns + +![](/img/v2/table_ts_to_columns.png) + +This transform allows you to take multiple time series and group them by time. Which will result in the primary column being `Time` and a column for each time series. + +### Time series aggregations + +![](/img/v2/table_ts_to_aggregations.png) +This table transformation will lay out your table into rows by metric, allowing columns of `Avg`, `Min`, `Max`, `Total`, `Current` and `Count`. More than one column can be added. + +### Annotations +![](/img/v2/table_annotations.png) + +If you have annotations enabled in the dashboard you can have the table show them. If you configure this +mode then any queries you have in the metrics tab will be ignored. + +### JSON Data +![](/img/v2/table_json_data.png) + +If you have an Elasticsearch **Raw Document** query or an Elasticsearch query without a `date histogram` use this +transform mode and pick the columns using the **Columns** section. + +![](/img/v2/elastic_raw_doc.png) + +## Table Display + + + +1. `Pagination (Page Size)`: The table display fields allow you to control The `Pagination` (page size) is the threshold at which the table rows will be broken into pages. For example, if your table had 95 records with a pagination value of 10, your table would be split across 9 pages. +2. `Scroll`: The `scroll bar` checkbox toggles the ability to scroll within the panel, when unchecked, the panel height will grow to display all rows. +3. `Font Size`: The `font size` field allows you to increase or decrease the size for the panel, relative to the default font size. + + +## Column Styles + +The column styles allow you control how dates and numbers are formatted. + + + +1. `Name or regex`: The Name or Regex field controls what columns the rule should be applied to. The regex or name filter will be matched against the column name not against column values. +2. `Type`: The three supported types of types are `Number`, `String` and `Date`. +3. `Format`: Specify date format. Only available when `Type` is set to `Date`. +4. `Coloring` and `Thresholds`: Specify color mode and thresholds limits. +5. `Unit` and `Decimals`: Specify unit and decimal precision for numbers. +6. `Add column style rule`: Add new column rule. + diff --git a/docs/sources/tutorials/stack_guide_graphite.md b/docs/sources/tutorials/stack_guide_graphite.md index a9025cf9a71..1145cab2249 100644 --- a/docs/sources/tutorials/stack_guide_graphite.md +++ b/docs/sources/tutorials/stack_guide_graphite.md @@ -27,7 +27,7 @@ that is not really the case, or, at least, that it is a lot better than you expe To begin with we are going to install the 3 main components that define our metric stack. Later in the guide we will install StatsD, but that is optional. -- Carbon is the graphite ingestion deamon responsible for +- Carbon is the graphite ingestion daemon responsible for receiving metrics and storing them. - Graphite-api is light weight version of graphite-web with only the HTTP api and is responsible for executing metric queries. @@ -90,7 +90,7 @@ pattern = .* retentions = 10s:1d,1m:7d,10m:1y ``` -This config specifies the resolution of metrics and the retention periods. For example for all metrics begining with the word `carbon` receive metrics every minute and store for 30 days, then +This config specifies the resolution of metrics and the retention periods. For example for all metrics beginning with the word `carbon` receive metrics every minute and store for 30 days, then roll them up into 10 minute buckets and store those for 1 year, then roll those up into 1 hour buckets and store those for 5 years. For all other metrics the default rule will be applied with other retention periods. @@ -206,7 +206,7 @@ Reload supervisor supervisorctl reload -A carbon-cache deamon and graphite-api should now be running. Type `supervisorctl status` to verify that they are running. You can +A carbon-cache daemon and graphite-api should now be running. Type `supervisorctl status` to verify that they are running. You can also open `http://your_server_ip:8888/metrics/find?query?*` in your browser. You should see a json snippet. @@ -243,12 +243,12 @@ Open http://your_server_ip:3000 in your browser and login with the default user - Select `Add Panel` > `Graph` from the row menu - An empty graph panel should appear with title `no title (click here)`. Click on this title and then `Edit` - This will open the graph in edit mode and take you to the metrics tab. -- There is one query already added (asigned letter A) but it is empty. +- There is one query already added (assigned letter A) but it is empty. - Click on `select metric` to pick the first graphite metric node. A new `select metric` link will appear until you reached a leaf node. - Try picking the metric paths for `carbon.agents..cpuUsage`, you should now see a line appear in the graph! ## Writing metrics to Graphite -Graphite has the simples metric write protocol imaginable. Something that has surely contributed to its wide adoption by metric +Graphite has the simplest metric write protocol imaginable. Something that has surely contributed to its wide adoption by metric frameworks and numerous integrations. prod.server1.requests.count 10 1398969187 diff --git a/docs/sources/versions.html_fragment b/docs/sources/versions.html_fragment index d9f6a4c655b..d699cc6b6ac 100644 --- a/docs/sources/versions.html_fragment +++ b/docs/sources/versions.html_fragment @@ -1,4 +1,5 @@ -
  • Version v2.5
  • +
  • Version v2.6
  • +
  • Version v2.5
  • Version v2.1
  • Version v2.0
  • Version v1.9
  • diff --git a/main.go b/main.go index 9639d432bea..4a052ea4934 100644 --- a/main.go +++ b/main.go @@ -2,6 +2,7 @@ package main import ( "flag" + "fmt" "io/ioutil" "os" "os/signal" @@ -27,6 +28,7 @@ import ( var version = "master" var commit = "NA" var buildstamp string +var build_date string var configFile = flag.String("config", "", "path to config file") var homePath = flag.String("homepath", "", "path to grafana install/home path, defaults to working directory") @@ -38,6 +40,14 @@ func init() { } func main() { + + v := flag.Bool("v", false, "prints current version and exits") + flag.Parse() + if *v { + fmt.Printf("Version %s (commit: %s)\n", version, commit) + os.Exit(0) + } + buildstampInt64, _ := strconv.ParseInt(buildstamp, 10, 64) setting.BuildVersion = version diff --git a/package.json b/package.json index 047f30f7ed0..f23ede64e26 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "company": "Coding Instinct AB" }, "name": "grafana", - "version": "2.5.0-pre1", + "version": "3.0.0-pre1", "repository": { "type": "git", "url": "http://github.com/torkelo/grafana.git" @@ -21,7 +21,7 @@ "grunt-contrib-connect": "~0.5.0", "grunt-contrib-copy": "~0.5.0", "grunt-contrib-cssmin": "~0.6.1", - "grunt-contrib-htmlmin": "~0.1.3", + "grunt-contrib-htmlmin": "~0.6.0", "grunt-contrib-jshint": "~0.10.0", "grunt-contrib-less": "~0.7.0", "grunt-contrib-requirejs": "~0.4.4", diff --git a/packaging/deb/default/grafana-server b/packaging/deb/default/grafana-server index 14d2545f6ce..dd06906b903 100644 --- a/packaging/deb/default/grafana-server +++ b/packaging/deb/default/grafana-server @@ -15,3 +15,5 @@ CONF_DIR=/etc/grafana CONF_FILE=/etc/grafana/grafana.ini RESTART_ON_UPGRADE=false + +PLUGINS_DIR=/var/lib/grafana/plugins diff --git a/packaging/deb/init.d/grafana-server b/packaging/deb/init.d/grafana-server index 9de4bf42092..61e82d4c612 100755 --- a/packaging/deb/init.d/grafana-server +++ b/packaging/deb/init.d/grafana-server @@ -30,12 +30,14 @@ GRAFANA_HOME=/usr/share/grafana CONF_DIR=/etc/grafana WORK_DIR=$GRAFANA_HOME DATA_DIR=/var/lib/grafana +PLUGINS_DIR=/var/lib/grafana/plugins LOG_DIR=/var/log/grafana CONF_FILE=$CONF_DIR/grafana.ini MAX_OPEN_FILES=10000 PID_FILE=/var/run/$NAME.pid DAEMON=/usr/sbin/$NAME + umask 0027 if [ `id -u` -ne 0 ]; then @@ -59,7 +61,7 @@ if [ -f "$DEFAULT" ]; then . "$DEFAULT" fi -DAEMON_OPTS="--pidfile=${PID_FILE} --config=${CONF_FILE} cfg:default.paths.data=${DATA_DIR} cfg:default.paths.logs=${LOG_DIR}" +DAEMON_OPTS="--pidfile=${PID_FILE} --config=${CONF_FILE} cfg:default.paths.data=${DATA_DIR} cfg:default.paths.logs=${LOG_DIR} cfg:default.paths.plugins=${PLUGINS_DIR}" case "$1" in start) diff --git a/packaging/deb/systemd/grafana-server.service b/packaging/deb/systemd/grafana-server.service index dd5d2097149..923a0d76cc2 100644 --- a/packaging/deb/systemd/grafana-server.service +++ b/packaging/deb/systemd/grafana-server.service @@ -14,7 +14,8 @@ ExecStart=/usr/sbin/grafana-server \ --config=${CONF_FILE} \ --pidfile=${PID_FILE} \ cfg:default.paths.logs=${LOG_DIR} \ - cfg:default.paths.data=${DATA_DIR} + cfg:default.paths.data=${DATA_DIR} \ + cfg:default.paths.plugins=${PLUGINS_DIR} LimitNOFILE=10000 TimeoutStopSec=20 UMask=0027 diff --git a/packaging/publish/publish.sh b/packaging/publish/publish.sh new file mode 100755 index 00000000000..1d039ae1028 --- /dev/null +++ b/packaging/publish/publish.sh @@ -0,0 +1,17 @@ +#! /usr/bin/env bash + +version=2.6.0 + +wget https://grafanarel.s3.amazonaws.com/builds/grafana_${version}_amd64.deb + +package_cloud push grafana/stable/debian/jessie grafana_${version}_amd64.deb +package_cloud push grafana/stable/debian/wheezy grafana_${version}_amd64.deb +package_cloud push grafana/testing/debian/jessie grafana_${version}_amd64.deb +package_cloud push grafana/testing/debian/wheezy grafana_${version}_amd64.deb + +wget https://grafanarel.s3.amazonaws.com/builds/grafana-${version}-1.x86_64.rpm + +package_cloud push grafana/testing/el/6 grafana-${version}-1.x86_64.rpm +package_cloud push grafana/testing/el/7 grafana-${version}-1.x86_64.rpm +package_cloud push grafana/stable/el/7 grafana-${version}-1.x86_64.rpm +package_cloud push grafana/stable/el/6 grafana-${version}-1.x86_64.rpm diff --git a/packaging/rpm/init.d/grafana-server b/packaging/rpm/init.d/grafana-server index bb27882f625..c60f4fb6080 100755 --- a/packaging/rpm/init.d/grafana-server +++ b/packaging/rpm/init.d/grafana-server @@ -29,6 +29,7 @@ GRAFANA_HOME=/usr/share/grafana CONF_DIR=/etc/grafana WORK_DIR=$GRAFANA_HOME DATA_DIR=/var/lib/grafana +PLUGINS_DIR=/var/lib/grafana/plugins LOG_DIR=/var/log/grafana CONF_FILE=$CONF_DIR/grafana.ini MAX_OPEN_FILES=10000 @@ -63,7 +64,7 @@ fi # overwrite settings from default file [ -e /etc/sysconfig/$NAME ] && . /etc/sysconfig/$NAME -DAEMON_OPTS="--pidfile=${PID_FILE} --config=${CONF_FILE} cfg:default.paths.data=${DATA_DIR} cfg:default.paths.logs=${LOG_DIR}" +DAEMON_OPTS="--pidfile=${PID_FILE} --config=${CONF_FILE} cfg:default.paths.data=${DATA_DIR} cfg:default.paths.logs=${LOG_DIR} cfg:default.paths.plugins=${PLUGINS_DIR}" function isRunning() { status -p $PID_FILE $NAME > /dev/null 2>&1 diff --git a/packaging/rpm/sysconfig/grafana-server b/packaging/rpm/sysconfig/grafana-server index 14d2545f6ce..dd06906b903 100644 --- a/packaging/rpm/sysconfig/grafana-server +++ b/packaging/rpm/sysconfig/grafana-server @@ -15,3 +15,5 @@ CONF_DIR=/etc/grafana CONF_FILE=/etc/grafana/grafana.ini RESTART_ON_UPGRADE=false + +PLUGINS_DIR=/var/lib/grafana/plugins diff --git a/packaging/rpm/systemd/grafana-server.service b/packaging/rpm/systemd/grafana-server.service index fb2ec24d123..20762ff6935 100644 --- a/packaging/rpm/systemd/grafana-server.service +++ b/packaging/rpm/systemd/grafana-server.service @@ -14,7 +14,8 @@ ExecStart=/usr/sbin/grafana-server \ --config=${CONF_FILE} \ --pidfile=${PID_FILE} \ cfg:default.paths.logs=${LOG_DIR} \ - cfg:default.paths.data=${DATA_DIR} + cfg:default.paths.data=${DATA_DIR} \ + cfg:default.paths.plugins=${PLUGINS_DIR} LimitNOFILE=10000 TimeoutStopSec=20 diff --git a/pkg/api/admin_settings.go b/pkg/api/admin_settings.go index 06413d6a0b1..1f800cfe558 100644 --- a/pkg/api/admin_settings.go +++ b/pkg/api/admin_settings.go @@ -17,7 +17,7 @@ func AdminGetSettings(c *middleware.Context) { for _, key := range section.Keys() { keyName := key.Name() value := key.Value() - if strings.Contains(keyName, "secret") || strings.Contains(keyName, "password") || (strings.Contains(keyName, "provider_config") && strings.Contains(value, "@")) { + if strings.Contains(keyName, "secret") || strings.Contains(keyName, "password") || (strings.Contains(keyName, "provider_config")) { value = "************" } diff --git a/pkg/api/admin_users.go b/pkg/api/admin_users.go index a293032c200..7690630aaa2 100644 --- a/pkg/api/admin_users.go +++ b/pkg/api/admin_users.go @@ -37,7 +37,14 @@ func AdminCreateUser(c *middleware.Context, form dtos.AdminCreateUserForm) { metrics.M_Api_Admin_User_Create.Inc(1) - c.JsonOK("User created") + user := cmd.Result + + result := m.UserIdDTO{ + Message: "User created", + Id: user.Id, + } + + c.JSON(200, result) } func AdminUpdateUserPassword(c *middleware.Context, form dtos.AdminUpdateUserPasswordForm) { diff --git a/pkg/api/api.go b/pkg/api/api.go index 013b2ebe076..839978845ab 100644 --- a/pkg/api/api.go +++ b/pkg/api/api.go @@ -13,7 +13,7 @@ func Register(r *macaron.Macaron) { reqSignedIn := middleware.Auth(&middleware.AuthOptions{ReqSignedIn: true}) reqGrafanaAdmin := middleware.Auth(&middleware.AuthOptions{ReqSignedIn: true, ReqGrafanaAdmin: true}) reqEditorRole := middleware.RoleAuth(m.ROLE_EDITOR, m.ROLE_ADMIN) - regOrgAdmin := middleware.RoleAuth(m.ROLE_ADMIN) + reqOrgAdmin := middleware.RoleAuth(m.ROLE_ADMIN) quota := middleware.Quota bind := binding.Bind @@ -41,6 +41,9 @@ func Register(r *macaron.Macaron) { r.Get("/admin/orgs", reqGrafanaAdmin, Index) r.Get("/admin/orgs/edit/:id", reqGrafanaAdmin, Index) + r.Get("/plugins", reqSignedIn, Index) + r.Get("/plugins/edit/*", reqSignedIn, Index) + r.Get("/dashboard/*", reqSignedIn, Index) r.Get("/dashboard-solo/*", reqSignedIn, Index) @@ -65,6 +68,7 @@ func Register(r *macaron.Macaron) { r.Post("/api/snapshots/", bind(m.CreateDashboardSnapshotCommand{}), CreateDashboardSnapshot) r.Get("/dashboard/snapshot/*", Index) + r.Get("/api/snapshot/shared-options/", GetSharingOptions) r.Get("/api/snapshots/:key", GetDashboardSnapshot) r.Get("/api/snapshots-delete/:key", DeleteDashboardSnapshot) @@ -113,7 +117,7 @@ func Register(r *macaron.Macaron) { r.Get("/invites", wrap(GetPendingOrgInvites)) r.Post("/invites", quota("user"), bind(dtos.AddInviteForm{}), wrap(AddOrgInvite)) r.Patch("/invites/:code/revoke", wrap(RevokeInvite)) - }, regOrgAdmin) + }, reqOrgAdmin) // create new org r.Post("/orgs", quota("org"), bind(m.CreateOrgCommand{}), wrap(CreateOrg)) @@ -140,7 +144,7 @@ func Register(r *macaron.Macaron) { r.Get("/", wrap(GetApiKeys)) r.Post("/", quota("api_key"), bind(m.AddApiKeyCommand{}), wrap(AddApiKey)) r.Delete("/:id", wrap(DeleteApiKey)) - }, regOrgAdmin) + }, reqOrgAdmin) // Data sources r.Group("/datasources", func() { @@ -148,9 +152,9 @@ func Register(r *macaron.Macaron) { r.Post("/", quota("data_source"), bind(m.AddDataSourceCommand{}), AddDataSource) r.Put("/:id", bind(m.UpdateDataSourceCommand{}), UpdateDataSource) r.Delete("/:id", DeleteDataSource) - r.Get("/:id", GetDataSourceById) + r.Get("/:id", wrap(GetDataSourceById)) r.Get("/plugins", GetDataSourcePlugins) - }, regOrgAdmin) + }, reqOrgAdmin) r.Get("/frontend/settings/", GetFrontendSettings) r.Any("/datasources/proxy/:id/*", reqSignedIn, ProxyDataSourceRequest) diff --git a/pkg/api/cloudwatch/cloudwatch.go b/pkg/api/cloudwatch/cloudwatch.go index 6f2afdaa9e2..0995c88da4b 100644 --- a/pkg/api/cloudwatch/cloudwatch.go +++ b/pkg/api/cloudwatch/cloudwatch.go @@ -7,9 +7,15 @@ import ( "time" "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/awsutil" + "github.com/aws/aws-sdk-go/aws/credentials" + "github.com/aws/aws-sdk-go/aws/credentials/ec2rolecreds" + "github.com/aws/aws-sdk-go/aws/ec2metadata" + "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/cloudwatch" "github.com/aws/aws-sdk-go/service/ec2" "github.com/grafana/grafana/pkg/middleware" + m "github.com/grafana/grafana/pkg/models" ) type actionHandler func(*cwRequest, *middleware.Context) @@ -17,25 +23,41 @@ type actionHandler func(*cwRequest, *middleware.Context) var actionHandlers map[string]actionHandler type cwRequest struct { - Region string `json:"region"` - Action string `json:"action"` - Body []byte `json:"-"` + Region string `json:"region"` + Action string `json:"action"` + Body []byte `json:"-"` + DataSource *m.DataSource } func init() { actionHandlers = map[string]actionHandler{ - "GetMetricStatistics": handleGetMetricStatistics, - "ListMetrics": handleListMetrics, - "DescribeInstances": handleDescribeInstances, - "__GetRegions": handleGetRegions, - "__GetNamespaces": handleGetNamespaces, - "__GetMetrics": handleGetMetrics, - "__GetDimensions": handleGetDimensions, + "GetMetricStatistics": handleGetMetricStatistics, + "ListMetrics": handleListMetrics, + "DescribeAlarmsForMetric": handleDescribeAlarmsForMetric, + "DescribeAlarmHistory": handleDescribeAlarmHistory, + "DescribeInstances": handleDescribeInstances, + "__GetRegions": handleGetRegions, + "__GetNamespaces": handleGetNamespaces, + "__GetMetrics": handleGetMetrics, + "__GetDimensions": handleGetDimensions, } } func handleGetMetricStatistics(req *cwRequest, c *middleware.Context) { - svc := cloudwatch.New(&aws.Config{Region: aws.String(req.Region)}) + sess := session.New() + creds := credentials.NewChainCredentials( + []credentials.Provider{ + &credentials.EnvProvider{}, + &credentials.SharedCredentialsProvider{Filename: "", Profile: req.DataSource.Database}, + &ec2rolecreds.EC2RoleProvider{Client: ec2metadata.New(sess), ExpiryWindow: 5 * time.Minute}, + }) + + cfg := &aws.Config{ + Region: aws.String(req.Region), + Credentials: creds, + } + + svc := cloudwatch.New(session.New(cfg), cfg) reqParam := &struct { Parameters struct { @@ -70,7 +92,21 @@ func handleGetMetricStatistics(req *cwRequest, c *middleware.Context) { } func handleListMetrics(req *cwRequest, c *middleware.Context) { - svc := cloudwatch.New(&aws.Config{Region: aws.String(req.Region)}) + sess := session.New() + creds := credentials.NewChainCredentials( + []credentials.Provider{ + &credentials.EnvProvider{}, + &credentials.SharedCredentialsProvider{Filename: "", Profile: req.DataSource.Database}, + &ec2rolecreds.EC2RoleProvider{Client: ec2metadata.New(sess), ExpiryWindow: 5 * time.Minute}, + }) + + cfg := &aws.Config{ + Region: aws.String(req.Region), + Credentials: creds, + } + + svc := cloudwatch.New(session.New(cfg), cfg) + reqParam := &struct { Parameters struct { Namespace string `json:"namespace"` @@ -78,7 +114,6 @@ func handleListMetrics(req *cwRequest, c *middleware.Context) { Dimensions []*cloudwatch.DimensionFilter `json:"dimensions"` } `json:"parameters"` }{} - json.Unmarshal(req.Body, reqParam) params := &cloudwatch.ListMetricsInput{ @@ -87,7 +122,107 @@ func handleListMetrics(req *cwRequest, c *middleware.Context) { Dimensions: reqParam.Parameters.Dimensions, } - resp, err := svc.ListMetrics(params) + var resp cloudwatch.ListMetricsOutput + err := svc.ListMetricsPages(params, + func(page *cloudwatch.ListMetricsOutput, lastPage bool) bool { + metrics, _ := awsutil.ValuesAtPath(page, "Metrics") + for _, metric := range metrics { + resp.Metrics = append(resp.Metrics, metric.(*cloudwatch.Metric)) + } + return !lastPage + }) + if err != nil { + c.JsonApiErr(500, "Unable to call AWS API", err) + return + } + + c.JSON(200, resp) +} + +func handleDescribeAlarmsForMetric(req *cwRequest, c *middleware.Context) { + sess := session.New() + creds := credentials.NewChainCredentials( + []credentials.Provider{ + &credentials.EnvProvider{}, + &credentials.SharedCredentialsProvider{Filename: "", Profile: req.DataSource.Database}, + &ec2rolecreds.EC2RoleProvider{Client: ec2metadata.New(sess), ExpiryWindow: 5 * time.Minute}, + }) + + cfg := &aws.Config{ + Region: aws.String(req.Region), + Credentials: creds, + } + + svc := cloudwatch.New(session.New(cfg), cfg) + + reqParam := &struct { + Parameters struct { + Namespace string `json:"namespace"` + MetricName string `json:"metricName"` + Dimensions []*cloudwatch.Dimension `json:"dimensions"` + Statistic string `json:"statistic"` + Period int64 `json:"period"` + } `json:"parameters"` + }{} + json.Unmarshal(req.Body, reqParam) + + params := &cloudwatch.DescribeAlarmsForMetricInput{ + Namespace: aws.String(reqParam.Parameters.Namespace), + MetricName: aws.String(reqParam.Parameters.MetricName), + Period: aws.Int64(reqParam.Parameters.Period), + } + if len(reqParam.Parameters.Dimensions) != 0 { + params.Dimensions = reqParam.Parameters.Dimensions + } + if reqParam.Parameters.Statistic != "" { + params.Statistic = aws.String(reqParam.Parameters.Statistic) + } + + resp, err := svc.DescribeAlarmsForMetric(params) + if err != nil { + c.JsonApiErr(500, "Unable to call AWS API", err) + return + } + + c.JSON(200, resp) +} + +func handleDescribeAlarmHistory(req *cwRequest, c *middleware.Context) { + sess := session.New() + creds := credentials.NewChainCredentials( + []credentials.Provider{ + &credentials.EnvProvider{}, + &credentials.SharedCredentialsProvider{Filename: "", Profile: req.DataSource.Database}, + &ec2rolecreds.EC2RoleProvider{Client: ec2metadata.New(sess), ExpiryWindow: 5 * time.Minute}, + }) + + cfg := &aws.Config{ + Region: aws.String(req.Region), + Credentials: creds, + } + + svc := cloudwatch.New(session.New(cfg), cfg) + + reqParam := &struct { + Parameters struct { + AlarmName string `json:"alarmName"` + HistoryItemType string `json:"historyItemType"` + StartDate int64 `json:"startDate"` + EndDate int64 `json:"endDate"` + } `json:"parameters"` + }{} + json.Unmarshal(req.Body, reqParam) + + params := &cloudwatch.DescribeAlarmHistoryInput{ + AlarmName: aws.String(reqParam.Parameters.AlarmName), + StartDate: aws.Time(time.Unix(reqParam.Parameters.StartDate, 0)), + EndDate: aws.Time(time.Unix(reqParam.Parameters.EndDate, 0)), + } + if reqParam.Parameters.HistoryItemType != "" { + params.HistoryItemType = aws.String(reqParam.Parameters.HistoryItemType) + } + + resp, err := svc.DescribeAlarmHistory(params) if err != nil { c.JsonApiErr(500, "Unable to call AWS API", err) return @@ -97,7 +232,20 @@ func handleListMetrics(req *cwRequest, c *middleware.Context) { } func handleDescribeInstances(req *cwRequest, c *middleware.Context) { - svc := ec2.New(&aws.Config{Region: aws.String(req.Region)}) + sess := session.New() + creds := credentials.NewChainCredentials( + []credentials.Provider{ + &credentials.EnvProvider{}, + &credentials.SharedCredentialsProvider{Filename: "", Profile: req.DataSource.Database}, + &ec2rolecreds.EC2RoleProvider{Client: ec2metadata.New(sess), ExpiryWindow: 5 * time.Minute}, + }) + + cfg := &aws.Config{ + Region: aws.String(req.Region), + Credentials: creds, + } + + svc := ec2.New(session.New(cfg), cfg) reqParam := &struct { Parameters struct { @@ -115,7 +263,15 @@ func handleDescribeInstances(req *cwRequest, c *middleware.Context) { params.InstanceIds = reqParam.Parameters.InstanceIds } - resp, err := svc.DescribeInstances(params) + var resp ec2.DescribeInstancesOutput + err := svc.DescribeInstancesPages(params, + func(page *ec2.DescribeInstancesOutput, lastPage bool) bool { + reservations, _ := awsutil.ValuesAtPath(page, "Reservations") + for _, reservation := range reservations { + resp.Reservations = append(resp.Reservations, reservation.(*ec2.Reservation)) + } + return !lastPage + }) if err != nil { c.JsonApiErr(500, "Unable to call AWS API", err) return @@ -124,9 +280,10 @@ func handleDescribeInstances(req *cwRequest, c *middleware.Context) { c.JSON(200, resp) } -func HandleRequest(c *middleware.Context) { +func HandleRequest(c *middleware.Context, ds *m.DataSource) { var req cwRequest req.Body, _ = ioutil.ReadAll(c.Req.Request.Body) + req.DataSource = ds json.Unmarshal(req.Body, &req) if handler, found := actionHandlers[req.Action]; !found { diff --git a/pkg/api/cloudwatch/metrics.go b/pkg/api/cloudwatch/metrics.go index 6d6ff10dfb9..e3255eccf7e 100644 --- a/pkg/api/cloudwatch/metrics.go +++ b/pkg/api/cloudwatch/metrics.go @@ -2,6 +2,7 @@ package cloudwatch import ( "encoding/json" + "sort" "github.com/grafana/grafana/pkg/middleware" "github.com/grafana/grafana/pkg/util" @@ -14,30 +15,47 @@ func init() { metricsMap = map[string][]string{ "AWS/AutoScaling": {"GroupMinSize", "GroupMaxSize", "GroupDesiredCapacity", "GroupInServiceInstances", "GroupPendingInstances", "GroupStandbyInstances", "GroupTerminatingInstances", "GroupTotalInstances"}, "AWS/Billing": {"EstimatedCharges"}, - "AWS/EC2": {"CPUCreditUsage", "CPUCreditBalance", "CPUUtilization", "DiskReadOps", "DiskWriteOps", "DiskReadBytes", "DiskWriteBytes", "NetworkIn", "NetworkOut", "StatusCheckFailed", "StatusCheckFailed_Instance", "StatusCheckFailed_System"}, "AWS/CloudFront": {"Requests", "BytesDownloaded", "BytesUploaded", "TotalErrorRate", "4xxErrorRate", "5xxErrorRate"}, "AWS/CloudSearch": {"SuccessfulRequests", "SearchableDocuments", "IndexUtilization", "Partitions"}, "AWS/DynamoDB": {"ConditionalCheckFailedRequests", "ConsumedReadCapacityUnits", "ConsumedWriteCapacityUnits", "OnlineIndexConsumedWriteCapacity", "OnlineIndexPercentageProgress", "OnlineIndexThrottleEvents", "ProvisionedReadCapacityUnits", "ProvisionedWriteCapacityUnits", "ReadThrottleEvents", "ReturnedItemCount", "SuccessfulRequestLatency", "SystemErrors", "ThrottledRequests", "UserErrors", "WriteThrottleEvents"}, + "AWS/ECS": {"CPUUtilization", "MemoryUtilization"}, "AWS/ElastiCache": { - "CPUUtilization", "SwapUsage", "FreeableMemory", "NetworkBytesIn", "NetworkBytesOut", + "CPUUtilization", "FreeableMemory", "NetworkBytesIn", "NetworkBytesOut", "SwapUsage", "BytesUsedForCacheItems", "BytesReadIntoMemcached", "BytesWrittenOutFromMemcached", "CasBadval", "CasHits", "CasMisses", "CmdFlush", "CmdGet", "CmdSet", "CurrConnections", "CurrItems", "DecrHits", "DecrMisses", "DeleteHits", "DeleteMisses", "Evictions", "GetHits", "GetMisses", "IncrHits", "IncrMisses", "Reclaimed", - "CurrConnections", "Evictions", "Reclaimed", "NewConnections", "BytesUsedForCache", "CacheHits", "CacheMisses", "ReplicationLag", "GetTypeCmds", "SetTypeCmds", "KeyBasedCmds", "StringBasedCmds", "HashBasedCmds", "ListBasedCmds", "SetBasedCmds", "SortedSetBasedCmds", "CurrItems", + "BytesUsedForHash", "CmdConfigGet", "CmdConfigSet", "CmdTouch", "CurrConfig", "EvictedUnfetched", "ExpiredUnfetched", "SlabsMoved", "TouchHits", "TouchMisses", + "NewConnections", "NewItems", "UnusedMemory", + "BytesUsedForCache", "CacheHits", "CacheMisses", "CurrConnections", "Evictions", "HyperLogLogBasedCmds", "NewConnections", "Reclaimed", "ReplicationBytes", "ReplicationLag", "SaveInProgress", + "CurrItems", "GetTypeCmds", "HashBasedCmds", "KeyBasedCmds", "ListBasedCmds", "SetBasedCmds", "SetTypeCmds", "SortedSetBasedCmds", "StringBasedCmds", }, - "AWS/EBS": {"VolumeReadBytes", "VolumeWriteBytes", "VolumeReadOps", "VolumeWriteOps", "VolumeTotalReadTime", "VolumeTotalWriteTime", "VolumeIdleTime", "VolumeQueueLength", "VolumeThroughputPercentage", "VolumeConsumedReadWriteOps"}, - "AWS/ELB": {"HealthyHostCount", "UnHealthyHostCount", "RequestCount", "Latency", "HTTPCode_ELB_4XX", "HTTPCode_ELB_5XX", "HTTPCode_Backend_2XX", "HTTPCode_Backend_3XX", "HTTPCode_Backend_4XX", "HTTPCode_Backend_5XX", "BackendConnectionErrors", "SurgeQueueLength", "SpilloverCount"}, - "AWS/ElasticMapReduce": {"CoreNodesPending", "CoreNodesRunning", "HBaseBackupFailed", "HBaseMostRecentBackupDuration", "HBaseTimeSinceLastSuccessfulBackup", "HDFSBytesRead", "HDFSBytesWritten", "HDFSUtilization", "IsIdle", "JobsFailed", "JobsRunning", "LiveDataNodes", "LiveTaskTrackers", "MapSlotsOpen", "MissingBlocks", "ReduceSlotsOpen", "RemainingMapTasks", "RemainingMapTasksPerSlot", "RemainingReduceTasks", "RunningMapTasks", "RunningReduceTasks", "S3BytesRead", "S3BytesWritten", "TaskNodesPending", "TaskNodesRunning", "TotalLoad"}, - "AWS/Kinesis": {"PutRecord.Bytes", "PutRecord.Latency", "PutRecord.Success", "PutRecords.Bytes", "PutRecords.Latency", "PutRecords.Records", "PutRecords.Success", "IncomingBytes", "IncomingRecords", "GetRecords.Bytes", "GetRecords.IteratorAgeMilliseconds", "GetRecords.Latency", "GetRecords.Success"}, - "AWS/ML": {"PredictCount", "PredictFailureCount"}, - "AWS/OpsWorks": {"cpu_idle", "cpu_nice", "cpu_system", "cpu_user", "cpu_waitio", "load_1", "load_5", "load_15", "memory_buffers", "memory_cached", "memory_free", "memory_swap", "memory_total", "memory_used", "procs"}, - "AWS/Redshift": {"CPUUtilization", "DatabaseConnections", "HealthStatus", "MaintenanceMode", "NetworkReceiveThroughput", "NetworkTransmitThroughput", "PercentageDiskSpaceUsed", "ReadIOPS", "ReadLatency", "ReadThroughput", "WriteIOPS", "WriteLatency", "WriteThroughput"}, - "AWS/RDS": {"BinLogDiskUsage", "CPUUtilization", "DatabaseConnections", "DiskQueueDepth", "FreeableMemory", "FreeStorageSpace", "ReplicaLag", "SwapUsage", "ReadIOPS", "WriteIOPS", "ReadLatency", "WriteLatency", "ReadThroughput", "WriteThroughput", "NetworkReceiveThroughput", "NetworkTransmitThroughput"}, - "AWS/Route53": {"HealthCheckStatus", "HealthCheckPercentageHealthy"}, - "AWS/SNS": {"NumberOfMessagesPublished", "PublishSize", "NumberOfNotificationsDelivered", "NumberOfNotificationsFailed"}, - "AWS/SQS": {"NumberOfMessagesSent", "SentMessageSize", "NumberOfMessagesReceived", "NumberOfEmptyReceives", "NumberOfMessagesDeleted", "ApproximateNumberOfMessagesDelayed", "ApproximateNumberOfMessagesVisible", "ApproximateNumberOfMessagesNotVisible"}, - "AWS/S3": {"BucketSizeBytes", "NumberOfObjects"}, - "AWS/SWF": {"DecisionTaskScheduleToStartTime", "DecisionTaskStartToCloseTime", "DecisionTasksCompleted", "StartedDecisionTasksTimedOutOnClose", "WorkflowStartToCloseTime", "WorkflowsCanceled", "WorkflowsCompleted", "WorkflowsContinuedAsNew", "WorkflowsFailed", "WorkflowsTerminated", "WorkflowsTimedOut"}, - "AWS/StorageGateway": {"CacheHitPercent", "CachePercentUsed", "CachePercentDirty", "CloudBytesDownloaded", "CloudDownloadLatency", "CloudBytesUploaded", "UploadBufferFree", "UploadBufferPercentUsed", "UploadBufferUsed", "QueuedWrites", "ReadBytes", "ReadTime", "TotalCacheSize", "WriteBytes", "WriteTime", "WorkingStorageFree", "WorkingStoragePercentUsed", "WorkingStorageUsed", "CacheHitPercent", "CachePercentUsed", "CachePercentDirty", "ReadBytes", "ReadTime", "WriteBytes", "WriteTime", "QueuedWrites"}, - "AWS/WorkSpaces": {"Available", "Unhealthy", "ConnectionAttempt", "ConnectionSuccess", "ConnectionFailure", "SessionLaunchTime", "InSessionLatency", "SessionDisconnect"}, + "AWS/EBS": {"VolumeReadBytes", "VolumeWriteBytes", "VolumeReadOps", "VolumeWriteOps", "VolumeTotalReadTime", "VolumeTotalWriteTime", "VolumeIdleTime", "VolumeQueueLength", "VolumeThroughputPercentage", "VolumeConsumedReadWriteOps"}, + "AWS/EC2": {"CPUCreditUsage", "CPUCreditBalance", "CPUUtilization", "DiskReadOps", "DiskWriteOps", "DiskReadBytes", "DiskWriteBytes", "NetworkIn", "NetworkOut", "StatusCheckFailed", "StatusCheckFailed_Instance", "StatusCheckFailed_System"}, + "AWS/ELB": {"HealthyHostCount", "UnHealthyHostCount", "RequestCount", "Latency", "HTTPCode_ELB_4XX", "HTTPCode_ELB_5XX", "HTTPCode_Backend_2XX", "HTTPCode_Backend_3XX", "HTTPCode_Backend_4XX", "HTTPCode_Backend_5XX", "BackendConnectionErrors", "SurgeQueueLength", "SpilloverCount"}, + "AWS/ElasticMapReduce": {"IsIdle", "JobsRunning", "JobsFailed", + "MapTasksRunning", "MapTasksRemaining", "MapSlotsOpen", "RemainingMapTasksPerSlot", "ReduceTasksRunning", "ReduceTasksRemaining", "ReduceSlotsOpen", + "CoreNodesRunning", "CoreNodesPending", "LiveDataNodes", "TaskNodesRunning", "TaskNodesPending", "LiveTaskTrackers", + "S3BytesWritten", "S3BytesRead", "HDFSUtilization", "HDFSBytesRead", "HDFSBytesWritten", "MissingBlocks", "TotalLoad", + "BackupFailed", "MostRecentBackupDuration", "TimeSinceLastSuccessfulBackup", + "IsIdle", "ContainerAllocated", "ContainerReserved", "ContainerPending", "AppsCompleted", "AppsFailed", "AppsKilled", "AppsPending", "AppsRunning", "AppsSubmitted", + "CoreNodesRunning", "CoreNodesPending", "LiveDataNodes", "MRTotalNodes", "MRActiveNodes", "MRLostNodes", "MRUnhealthyNodes", "MRDecommissionedNodes", "MRRebootedNodes", + "S3BytesWritten", "S3BytesRead", "HDFSUtilization", "HDFSBytesRead", "HDFSBytesWritten", "MissingBlocks", "CorruptBlocks", "TotalLoad", "MemoryTotalMB", "MemoryReservedMB", "MemoryAvailableMB", "MemoryAllocatedMB", "PendingDeletionBlocks", "UnderReplicatedBlocks", "DfsPendingReplicationBlocks", "CapacityRemainingGB", + "HbaseBackupFailed", "MostRecentBackupDuration", "TimeSinceLastSuccessfulBackup"}, + "AWS/ES": {"ClusterStatus.green", "ClusterStatus.yellow", "ClusterStatus.red", "Nodes", "SearchableDocuments", "DeletedDocuments", "CPUUtilization", "FreeStorageSpace", "JVMMemoryPressure", "AutomatedSnapshotFailure", "MasterCPUUtilization", "MasterFreeStorageSpace", "MasterJVMMemoryPressure", "ReadLatency", "WriteLatency", "ReadThroughput", "WriteThroughput", "DiskQueueLength", "ReadIOPS", "WriteIOPS"}, + "AWS/Kinesis": {"PutRecord.Bytes", "PutRecord.Latency", "PutRecord.Success", "PutRecords.Bytes", "PutRecords.Latency", "PutRecords.Records", "PutRecords.Success", "IncomingBytes", "IncomingRecords", "GetRecords.Bytes", "GetRecords.IteratorAgeMilliseconds", "GetRecords.Latency", "GetRecords.Success"}, + "AWS/Lambda": {"Invocations", "Errors", "Duration", "Throttles"}, + "AWS/ML": {"PredictCount", "PredictFailureCount"}, + "AWS/OpsWorks": {"cpu_idle", "cpu_nice", "cpu_system", "cpu_user", "cpu_waitio", "load_1", "load_5", "load_15", "memory_buffers", "memory_cached", "memory_free", "memory_swap", "memory_total", "memory_used", "procs"}, + "AWS/Redshift": {"CPUUtilization", "DatabaseConnections", "HealthStatus", "MaintenanceMode", "NetworkReceiveThroughput", "NetworkTransmitThroughput", "PercentageDiskSpaceUsed", "ReadIOPS", "ReadLatency", "ReadThroughput", "WriteIOPS", "WriteLatency", "WriteThroughput"}, + "AWS/RDS": {"BinLogDiskUsage", "CPUUtilization", "CPUCreditUsage", "CPUCreditBalance", "DatabaseConnections", "DiskQueueDepth", "FreeableMemory", "FreeStorageSpace", "ReplicaLag", "SwapUsage", "ReadIOPS", "WriteIOPS", "ReadLatency", "WriteLatency", "ReadThroughput", "WriteThroughput", "NetworkReceiveThroughput", "NetworkTransmitThroughput"}, + "AWS/Route53": {"HealthCheckStatus", "HealthCheckPercentageHealthy"}, + "AWS/SNS": {"NumberOfMessagesPublished", "PublishSize", "NumberOfNotificationsDelivered", "NumberOfNotificationsFailed"}, + "AWS/SQS": {"NumberOfMessagesSent", "SentMessageSize", "NumberOfMessagesReceived", "NumberOfEmptyReceives", "NumberOfMessagesDeleted", "ApproximateNumberOfMessagesDelayed", "ApproximateNumberOfMessagesVisible", "ApproximateNumberOfMessagesNotVisible"}, + "AWS/S3": {"BucketSizeBytes", "NumberOfObjects"}, + "AWS/SWF": {"DecisionTaskScheduleToStartTime", "DecisionTaskStartToCloseTime", "DecisionTasksCompleted", "StartedDecisionTasksTimedOutOnClose", "WorkflowStartToCloseTime", "WorkflowsCanceled", "WorkflowsCompleted", "WorkflowsContinuedAsNew", "WorkflowsFailed", "WorkflowsTerminated", "WorkflowsTimedOut", + "ActivityTaskScheduleToCloseTime", "ActivityTaskScheduleToStartTime", "ActivityTaskStartToCloseTime", "ActivityTasksCanceled", "ActivityTasksCompleted", "ActivityTasksFailed", "ScheduledActivityTasksTimedOutOnClose", "ScheduledActivityTasksTimedOutOnStart", "StartedActivityTasksTimedOutOnClose", "StartedActivityTasksTimedOutOnHeartbeat"}, + "AWS/StorageGateway": {"CacheHitPercent", "CachePercentUsed", "CachePercentDirty", "CloudBytesDownloaded", "CloudDownloadLatency", "CloudBytesUploaded", "UploadBufferFree", "UploadBufferPercentUsed", "UploadBufferUsed", "QueuedWrites", "ReadBytes", "ReadTime", "TotalCacheSize", "WriteBytes", "WriteTime", "TimeSinceLastRecoveryPoint", "WorkingStorageFree", "WorkingStoragePercentUsed", "WorkingStorageUsed", + "CacheHitPercent", "CachePercentUsed", "CachePercentDirty", "ReadBytes", "ReadTime", "WriteBytes", "WriteTime", "QueuedWrites"}, + "AWS/WAF": {"AllowedRequests", "BlockedRequests", "CountedRequests"}, + "AWS/WorkSpaces": {"Available", "Unhealthy", "ConnectionAttempt", "ConnectionSuccess", "ConnectionFailure", "SessionLaunchTime", "InSessionLatency", "SessionDisconnect"}, } dimensionsMap = map[string][]string{ "AWS/AutoScaling": {"AutoScalingGroupName"}, @@ -45,12 +63,15 @@ func init() { "AWS/CloudFront": {"DistributionId", "Region"}, "AWS/CloudSearch": {}, "AWS/DynamoDB": {"TableName", "GlobalSecondaryIndexName", "Operation"}, + "AWS/ECS": {"ClusterName", "ServiceName"}, "AWS/ElastiCache": {"CacheClusterId", "CacheNodeId"}, "AWS/EBS": {"VolumeId"}, "AWS/EC2": {"AutoScalingGroupName", "ImageId", "InstanceId", "InstanceType"}, "AWS/ELB": {"LoadBalancerName", "AvailabilityZone"}, - "AWS/ElasticMapReduce": {"ClusterId", "JobId"}, + "AWS/ElasticMapReduce": {"ClusterId", "JobFlowId", "JobId"}, + "AWS/ES": {}, "AWS/Kinesis": {"StreamName"}, + "AWS/Lambda": {"FunctionName"}, "AWS/ML": {"MLModelId", "RequestMode"}, "AWS/OpsWorks": {"StackId", "LayerId", "InstanceId"}, "AWS/Redshift": {"NodeID", "ClusterIdentifier"}, @@ -59,16 +80,19 @@ func init() { "AWS/SNS": {"Application", "Platform", "TopicName"}, "AWS/SQS": {"QueueName"}, "AWS/S3": {"BucketName", "StorageType"}, - "AWS/SWF": {"Domain", "ActivityTypeName", "ActivityTypeVersion"}, + "AWS/SWF": {"Domain", "WorkflowTypeName", "WorkflowTypeVersion", "ActivityTypeName", "ActivityTypeVersion"}, "AWS/StorageGateway": {"GatewayId", "GatewayName", "VolumeId"}, + "AWS/WAF": {"Rule", "WebACL"}, "AWS/WorkSpaces": {"DirectoryId", "WorkspaceId"}, } } +// Whenever this list is updated, frontend list should also be updated. +// Please update the region list in public/app/plugins/datasource/cloudwatch/partials/config.html func handleGetRegions(req *cwRequest, c *middleware.Context) { regions := []string{ - "us-west-2", "us-west-1", "eu-west-1", "eu-central-1", "ap-southeast-1", - "ap-southeast-2", "ap-northeast-1", "sa-east-1", + "ap-northeast-1", "ap-southeast-1", "ap-southeast-2", "cn-north-1", + "eu-central-1", "eu-west-1", "sa-east-1", "us-east-1", "us-west-1", "us-west-2", } result := []interface{}{} @@ -80,8 +104,14 @@ func handleGetRegions(req *cwRequest, c *middleware.Context) { } func handleGetNamespaces(req *cwRequest, c *middleware.Context) { - result := []interface{}{} + keys := []string{} for key := range metricsMap { + keys = append(keys, key) + } + sort.Sort(sort.StringSlice(keys)) + + result := []interface{}{} + for _, key := range keys { result = append(result, util.DynMap{"text": key, "value": key}) } @@ -102,6 +132,7 @@ func handleGetMetrics(req *cwRequest, c *middleware.Context) { c.JsonApiErr(404, "Unable to find namespace "+reqParam.Parameters.Namespace, nil) return } + sort.Sort(sort.StringSlice(namespaceMetrics)) result := []interface{}{} for _, name := range namespaceMetrics { @@ -125,6 +156,7 @@ func handleGetDimensions(req *cwRequest, c *middleware.Context) { c.JsonApiErr(404, "Unable to find dimension "+reqParam.Parameters.Namespace, nil) return } + sort.Sort(sort.StringSlice(dimensionValues)) result := []interface{}{} for _, name := range dimensionValues { diff --git a/pkg/api/dashboard.go b/pkg/api/dashboard.go index 8d7d3f6adfd..6490a118861 100644 --- a/pkg/api/dashboard.go +++ b/pkg/api/dashboard.go @@ -57,6 +57,8 @@ func GetDashboard(c *middleware.Context) { CanStar: c.IsSignedIn, CanSave: c.OrgRole == m.ROLE_ADMIN || c.OrgRole == m.ROLE_EDITOR, CanEdit: canEditDashboard(c.OrgRole), + Created: dash.Created, + Updated: dash.Updated, }, } diff --git a/pkg/api/dashboard_snapshot.go b/pkg/api/dashboard_snapshot.go index be044cc25eb..521dee29a63 100644 --- a/pkg/api/dashboard_snapshot.go +++ b/pkg/api/dashboard_snapshot.go @@ -12,6 +12,14 @@ import ( "github.com/grafana/grafana/pkg/util" ) +func GetSharingOptions(c *middleware.Context) { + c.JSON(200, util.DynMap{ + "externalSnapshotURL": setting.ExternalSnapshotUrl, + "externalSnapshotName": setting.ExternalSnapshotName, + "externalEnabled": setting.ExternalEnabled, + }) +} + func CreateDashboardSnapshot(c *middleware.Context, cmd m.CreateDashboardSnapshotCommand) { if cmd.External { // external snapshot ref requires key and delete key diff --git a/pkg/api/dataproxy.go b/pkg/api/dataproxy.go index 3aa215eac15..7193198155f 100644 --- a/pkg/api/dataproxy.go +++ b/pkg/api/dataproxy.go @@ -97,7 +97,7 @@ func ProxyDataSourceRequest(c *middleware.Context) { } if ds.Type == m.DS_CLOUDWATCH { - cloudwatch.HandleRequest(c) + cloudwatch.HandleRequest(c, ds) } else { proxyPath := c.Params("*") proxy := NewReverseProxy(ds, proxyPath, targetUrl) diff --git a/pkg/api/datasources.go b/pkg/api/datasources.go index 717211d438d..bef24d61d24 100644 --- a/pkg/api/datasources.go +++ b/pkg/api/datasources.go @@ -37,20 +37,22 @@ func GetDataSources(c *middleware.Context) { c.JSON(200, result) } -func GetDataSourceById(c *middleware.Context) { +func GetDataSourceById(c *middleware.Context) Response { query := m.GetDataSourceByIdQuery{ Id: c.ParamsInt64(":id"), OrgId: c.OrgId, } if err := bus.Dispatch(&query); err != nil { - c.JsonApiErr(500, "Failed to query datasources", err) - return + if err == m.ErrDataSourceNotFound { + return ApiError(404, "Data source not found", nil) + } + return ApiError(500, "Failed to query datasources", err) } ds := query.Result - c.JSON(200, &dtos.DataSource{ + return Json(200, &dtos.DataSource{ Id: ds.Id, OrgId: ds.OrgId, Name: ds.Name, @@ -63,6 +65,7 @@ func GetDataSourceById(c *middleware.Context) { BasicAuth: ds.BasicAuth, BasicAuthUser: ds.BasicAuthUser, BasicAuthPassword: ds.BasicAuthPassword, + WithCredentials: ds.WithCredentials, IsDefault: ds.IsDefault, JsonData: ds.JsonData, }) @@ -115,7 +118,7 @@ func GetDataSourcePlugins(c *middleware.Context) { dsList := make(map[string]interface{}) for key, value := range plugins.DataSources { - if value.(map[string]interface{})["builtIn"] == nil { + if !value.BuiltIn { dsList[key] = value } } diff --git a/pkg/api/dtos/index.go b/pkg/api/dtos/index.go new file mode 100644 index 00000000000..1314d2d94ac --- /dev/null +++ b/pkg/api/dtos/index.go @@ -0,0 +1,25 @@ +package dtos + +type IndexViewData struct { + User *CurrentUser + Settings map[string]interface{} + AppUrl string + AppSubUrl string + GoogleAnalyticsId string + GoogleTagManagerId string + + PluginCss []*PluginCss + PluginJs []string + MainNavLinks []*NavLink +} + +type PluginCss struct { + Light string `json:"light"` + Dark string `json:"dark"` +} + +type NavLink struct { + Text string `json:"text"` + Icon string `json:"icon"` + Href string `json:"href"` +} diff --git a/pkg/api/dtos/models.go b/pkg/api/dtos/models.go index 9a4400adbdf..50db279b25b 100644 --- a/pkg/api/dtos/models.go +++ b/pkg/api/dtos/models.go @@ -40,6 +40,7 @@ type DashboardMeta struct { Slug string `json:"slug"` Expires time.Time `json:"expires"` Created time.Time `json:"created"` + Updated time.Time `json:"updated"` } type DashboardFullWithMeta struct { @@ -60,6 +61,7 @@ type DataSource struct { BasicAuth bool `json:"basicAuth"` BasicAuthUser string `json:"basicAuthUser"` BasicAuthPassword string `json:"basicAuthPassword"` + WithCredentials bool `json:"withCredentials"` IsDefault bool `json:"isDefault"` JsonData map[string]interface{} `json:"jsonData"` } diff --git a/pkg/api/dtos/plugin_bundle.go b/pkg/api/dtos/plugin_bundle.go new file mode 100644 index 00000000000..f043da39904 --- /dev/null +++ b/pkg/api/dtos/plugin_bundle.go @@ -0,0 +1,8 @@ +package dtos + +type PluginBundle struct { + Type string `json:"type"` + Enabled bool `json:"enabled"` + Module string `json:"module"` + JsonData map[string]interface{} `json:"jsonData"` +} diff --git a/pkg/api/frontendsettings.go b/pkg/api/frontendsettings.go index cc07b9cfb49..5cba3258122 100644 --- a/pkg/api/frontendsettings.go +++ b/pkg/api/frontendsettings.go @@ -62,6 +62,9 @@ func getFrontendSettingsMap(c *middleware.Context) (map[string]interface{}, erro if ds.BasicAuth { dsMap["basicAuth"] = util.GetBasicAuthHeader(ds.BasicAuthUser, ds.BasicAuthPassword) } + if ds.WithCredentials { + dsMap["withCredentials"] = ds.WithCredentials + } if ds.Type == m.DS_INFLUXDB_08 { dsMap["username"] = ds.User @@ -106,11 +109,21 @@ func getFrontendSettingsMap(c *middleware.Context) (map[string]interface{}, erro defaultDatasource = "-- Grafana --" } + panels := map[string]interface{}{} + for _, panel := range plugins.Panels { + panels[panel.Type] = map[string]interface{}{ + "module": panel.Module, + "name": panel.Name, + } + } + jsonObj := map[string]interface{}{ "defaultDatasource": defaultDatasource, "datasources": datasources, + "panels": panels, "appSubUrl": setting.AppSubUrl, "allowOrgCreate": (setting.AllowUserOrgCreate && c.IsSignedIn) || c.IsGrafanaAdmin, + "authProxyEnabled": setting.AuthProxyEnabled, "buildInfo": map[string]interface{}{ "version": setting.BuildVersion, "commit": setting.BuildCommit, diff --git a/pkg/api/index.go b/pkg/api/index.go index 556db006b2f..9a39837261f 100644 --- a/pkg/api/index.go +++ b/pkg/api/index.go @@ -3,65 +3,74 @@ package api import ( "github.com/grafana/grafana/pkg/api/dtos" "github.com/grafana/grafana/pkg/middleware" + m "github.com/grafana/grafana/pkg/models" "github.com/grafana/grafana/pkg/setting" ) -func setIndexViewData(c *middleware.Context) error { +func setIndexViewData(c *middleware.Context) (*dtos.IndexViewData, error) { settings, err := getFrontendSettingsMap(c) if err != nil { - return err + return nil, err } - currentUser := &dtos.CurrentUser{ - Id: c.UserId, - IsSignedIn: c.IsSignedIn, - Login: c.Login, - Email: c.Email, - Name: c.Name, - LightTheme: c.Theme == "light", - OrgId: c.OrgId, - OrgName: c.OrgName, - OrgRole: c.OrgRole, - GravatarUrl: dtos.GetGravatarUrl(c.Email), - IsGrafanaAdmin: c.IsGrafanaAdmin, + var data = dtos.IndexViewData{ + User: &dtos.CurrentUser{ + Id: c.UserId, + IsSignedIn: c.IsSignedIn, + Login: c.Login, + Email: c.Email, + Name: c.Name, + LightTheme: c.Theme == "light", + OrgId: c.OrgId, + OrgName: c.OrgName, + OrgRole: c.OrgRole, + GravatarUrl: dtos.GetGravatarUrl(c.Email), + IsGrafanaAdmin: c.IsGrafanaAdmin, + }, + Settings: settings, + AppUrl: setting.AppUrl, + AppSubUrl: setting.AppSubUrl, + GoogleAnalyticsId: setting.GoogleAnalyticsId, + GoogleTagManagerId: setting.GoogleTagManagerId, } if setting.DisableGravatar { - currentUser.GravatarUrl = setting.AppSubUrl + "/img/user_profile.png" + data.User.GravatarUrl = setting.AppSubUrl + "/img/user_profile.png" } - if len(currentUser.Name) == 0 { - currentUser.Name = currentUser.Login + if len(data.User.Name) == 0 { + data.User.Name = data.User.Login } themeUrlParam := c.Query("theme") if themeUrlParam == "light" { - currentUser.LightTheme = true + data.User.LightTheme = true } - c.Data["User"] = currentUser - c.Data["Settings"] = settings - c.Data["AppUrl"] = setting.AppUrl - c.Data["AppSubUrl"] = setting.AppSubUrl + data.MainNavLinks = append(data.MainNavLinks, &dtos.NavLink{ + Text: "Dashboards", + Icon: "fa fa-fw fa-th-large", + Href: "/", + }) - if setting.GoogleAnalyticsId != "" { - c.Data["GoogleAnalyticsId"] = setting.GoogleAnalyticsId + if c.OrgRole == m.ROLE_ADMIN { + data.MainNavLinks = append(data.MainNavLinks, &dtos.NavLink{ + Text: "Data Sources", + Icon: "fa fa-fw fa-database", + Href: "/datasources", + }) } - if setting.GoogleTagManagerId != "" { - c.Data["GoogleTagManagerId"] = setting.GoogleTagManagerId - } - - return nil + return &data, nil } func Index(c *middleware.Context) { - if err := setIndexViewData(c); err != nil { + if data, err := setIndexViewData(c); err != nil { c.Handle(500, "Failed to get settings", err) return + } else { + c.HTML(200, "index", data) } - - c.HTML(200, "index") } func NotFoundHandler(c *middleware.Context) { @@ -70,10 +79,10 @@ func NotFoundHandler(c *middleware.Context) { return } - if err := setIndexViewData(c); err != nil { + if data, err := setIndexViewData(c); err != nil { c.Handle(500, "Failed to get settings", err) return + } else { + c.HTML(404, "index", data) } - - c.HTML(404, "index") } diff --git a/pkg/api/login.go b/pkg/api/login.go index 8863e1b10c1..d0aace4235c 100644 --- a/pkg/api/login.go +++ b/pkg/api/login.go @@ -19,18 +19,19 @@ const ( ) func LoginView(c *middleware.Context) { - if err := setIndexViewData(c); err != nil { + viewData, err := setIndexViewData(c) + if err != nil { c.Handle(500, "Failed to get settings", err) return } - settings := c.Data["Settings"].(map[string]interface{}) - settings["googleAuthEnabled"] = setting.OAuthService.Google - settings["githubAuthEnabled"] = setting.OAuthService.GitHub - settings["disableUserSignUp"] = !setting.AllowUserSignUp + viewData.Settings["googleAuthEnabled"] = setting.OAuthService.Google + viewData.Settings["githubAuthEnabled"] = setting.OAuthService.GitHub + viewData.Settings["disableUserSignUp"] = !setting.AllowUserSignUp + viewData.Settings["loginHint"] = setting.LoginHint if !tryLoginUsingRememberCookie(c) { - c.HTML(200, VIEW_INDEX) + c.HTML(200, VIEW_INDEX, viewData) return } diff --git a/pkg/cmd/web.go b/pkg/cmd/web.go index 69843b6b095..1debde98a0e 100644 --- a/pkg/cmd/web.go +++ b/pkg/cmd/web.go @@ -14,6 +14,7 @@ import ( "github.com/grafana/grafana/pkg/api/static" "github.com/grafana/grafana/pkg/log" "github.com/grafana/grafana/pkg/middleware" + "github.com/grafana/grafana/pkg/plugins" "github.com/grafana/grafana/pkg/setting" ) @@ -28,12 +29,18 @@ func newMacaron() *macaron.Macaron { m.Use(middleware.Gziper()) } - mapStatic(m, "", "public") - mapStatic(m, "app", "app") - mapStatic(m, "css", "css") - mapStatic(m, "img", "img") - mapStatic(m, "fonts", "fonts") - mapStatic(m, "robots.txt", "robots.txt") + for _, route := range plugins.StaticRoutes { + pluginRoute := path.Join("/public/plugins/", route.Url) + log.Info("Plugin: Adding static route %s -> %s", pluginRoute, route.Path) + mapStatic(m, route.Path, "", pluginRoute) + } + + mapStatic(m, setting.StaticRootPath, "", "public") + mapStatic(m, setting.StaticRootPath, "app", "app") + mapStatic(m, setting.StaticRootPath, "css", "css") + mapStatic(m, setting.StaticRootPath, "img", "img") + mapStatic(m, setting.StaticRootPath, "fonts", "fonts") + mapStatic(m, setting.StaticRootPath, "robots.txt", "robots.txt") m.Use(macaron.Renderer(macaron.RenderOptions{ Directory: path.Join(setting.StaticRootPath, "views"), @@ -51,7 +58,7 @@ func newMacaron() *macaron.Macaron { return m } -func mapStatic(m *macaron.Macaron, dir string, prefix string) { +func mapStatic(m *macaron.Macaron, rootDir string, dir string, prefix string) { headers := func(c *macaron.Context) { c.Resp.Header().Set("Cache-Control", "public, max-age=3600") } @@ -63,7 +70,7 @@ func mapStatic(m *macaron.Macaron, dir string, prefix string) { } m.Use(httpstatic.Static( - path.Join(setting.StaticRootPath, dir), + path.Join(rootDir, dir), httpstatic.StaticOptions{ SkipLogging: true, Prefix: prefix, diff --git a/pkg/log/syslog.go b/pkg/log/syslog.go new file mode 100644 index 00000000000..bc1780056e8 --- /dev/null +++ b/pkg/log/syslog.go @@ -0,0 +1,95 @@ +//+build !windows,!nacl,!plan9 + +package log + +import ( + "encoding/json" + "errors" + "log/syslog" +) + +type SyslogWriter struct { + syslog *syslog.Writer + Network string `json:"network"` + Address string `json:"address"` + Facility string `json:"facility"` + Tag string `json:"tag"` +} + +func NewSyslog() LoggerInterface { + return new(SyslogWriter) +} + +func (sw *SyslogWriter) Init(config string) error { + if err := json.Unmarshal([]byte(config), sw); err != nil { + return err + } + + prio, err := parseFacility(sw.Facility) + if err != nil { + return err + } + + w, err := syslog.Dial(sw.Network, sw.Address, prio, sw.Tag) + if err != nil { + return err + } + + sw.syslog = w + return nil +} + +func (sw *SyslogWriter) WriteMsg(msg string, skip, level int) error { + var err error + + switch level { + case TRACE, DEBUG: + err = sw.syslog.Debug(msg) + case INFO: + err = sw.syslog.Info(msg) + case WARN: + err = sw.syslog.Warning(msg) + case ERROR: + err = sw.syslog.Err(msg) + case CRITICAL: + err = sw.syslog.Crit(msg) + case FATAL: + err = sw.syslog.Alert(msg) + default: + err = errors.New("invalid syslog level") + } + + return err +} + +func (sw *SyslogWriter) Destroy() { + sw.syslog.Close() +} + +func (sw *SyslogWriter) Flush() {} + +var facilities = map[string]syslog.Priority{ + "user": syslog.LOG_USER, + "daemon": syslog.LOG_DAEMON, + "local0": syslog.LOG_LOCAL0, + "local1": syslog.LOG_LOCAL1, + "local2": syslog.LOG_LOCAL2, + "local3": syslog.LOG_LOCAL3, + "local4": syslog.LOG_LOCAL4, + "local5": syslog.LOG_LOCAL5, + "local6": syslog.LOG_LOCAL6, + "local7": syslog.LOG_LOCAL7, +} + +func parseFacility(facility string) (syslog.Priority, error) { + prio, ok := facilities[facility] + if !ok { + return syslog.LOG_LOCAL0, errors.New("invalid syslog facility") + } + + return prio, nil +} + +func init() { + Register("syslog", NewSyslog) +} diff --git a/pkg/login/ldap.go b/pkg/login/ldap.go index 355b4fd100a..24c6a99a8f5 100644 --- a/pkg/login/ldap.go +++ b/pkg/login/ldap.go @@ -131,8 +131,8 @@ func (a *ldapAuther) getGrafanaUserFor(ldapUser *ldapUserInfo) (*m.User, error) } return userQuery.Result, nil -} +} func (a *ldapAuther) createGrafanaUser(ldapUser *ldapUserInfo) (*m.User, error) { cmd := m.CreateUserCommand{ Login: ldapUser.Username, diff --git a/pkg/middleware/logger.go b/pkg/middleware/logger.go index eb5c7b8dde4..38262de573d 100644 --- a/pkg/middleware/logger.go +++ b/pkg/middleware/logger.go @@ -32,7 +32,12 @@ func Logger() macaron.Handler { rw := res.(macaron.ResponseWriter) c.Next() - content := fmt.Sprintf("Completed %s %v %s in %v", req.URL.Path, rw.Status(), http.StatusText(rw.Status()), time.Since(start)) + uname := c.GetCookie(setting.CookieUserName) + if len(uname) == 0 { + uname = "-" + } + + content := fmt.Sprintf("Completed %s %s \"%s %s %s\" %v %s %d bytes in %dus", c.RemoteAddr(), uname, req.Method, req.URL.Path, req.Proto, rw.Status(), http.StatusText(rw.Status()), rw.Size(), time.Since(start)/time.Microsecond) switch rw.Status() { case 200, 304: diff --git a/pkg/models/dashboards.go b/pkg/models/dashboards.go index 7d4a2690556..5b926c3e314 100644 --- a/pkg/models/dashboards.go +++ b/pkg/models/dashboards.go @@ -43,6 +43,8 @@ func NewDashboard(title string) *Dashboard { dash.Data = make(map[string]interface{}) dash.Data["title"] = title dash.Title = title + dash.Created = time.Now() + dash.Updated = time.Now() dash.UpdateSlug() return dash } @@ -73,9 +75,12 @@ func NewDashboardFromJson(data map[string]interface{}) *Dashboard { if dash.Data["version"] != nil { dash.Version = int(dash.Data["version"].(float64)) + dash.Updated = time.Now() } } else { dash.Data["version"] = 0 + dash.Created = time.Now() + dash.Updated = time.Now() } return dash diff --git a/pkg/models/datasource.go b/pkg/models/datasource.go index 38273598ab1..88abd03c319 100644 --- a/pkg/models/datasource.go +++ b/pkg/models/datasource.go @@ -40,6 +40,7 @@ type DataSource struct { BasicAuth bool BasicAuthUser string BasicAuthPassword string + WithCredentials bool IsDefault bool JsonData map[string]interface{} @@ -83,6 +84,7 @@ type AddDataSourceCommand struct { BasicAuth bool `json:"basicAuth"` BasicAuthUser string `json:"basicAuthUser"` BasicAuthPassword string `json:"basicAuthPassword"` + WithCredentials bool `json:"withCredentials"` IsDefault bool `json:"isDefault"` JsonData map[string]interface{} `json:"jsonData"` @@ -103,6 +105,7 @@ type UpdateDataSourceCommand struct { BasicAuth bool `json:"basicAuth"` BasicAuthUser string `json:"basicAuthUser"` BasicAuthPassword string `json:"basicAuthPassword"` + WithCredentials bool `json:"withCredentials"` IsDefault bool `json:"isDefault"` JsonData map[string]interface{} `json:"jsonData"` diff --git a/pkg/models/plugin_bundle.go b/pkg/models/plugin_bundle.go new file mode 100644 index 00000000000..5f4e508b9b2 --- /dev/null +++ b/pkg/models/plugin_bundle.go @@ -0,0 +1,34 @@ +package models + +import "time" + +type PluginBundle struct { + Id int64 + Type string + OrgId int64 + Enabled bool + JsonData map[string]interface{} + + Created time.Time + Updated time.Time +} + +// ---------------------- +// COMMANDS + +// Also acts as api DTO +type UpdatePluginBundleCmd struct { + Type string `json:"type" binding:"Required"` + Enabled bool `json:"enabled"` + JsonData map[string]interface{} `json:"jsonData"` + + Id int64 `json:"-"` + OrgId int64 `json:"-"` +} + +// --------------------- +// QUERIES +type GetPluginBundlesQuery struct { + OrgId int64 + Result []*PluginBundle +} diff --git a/pkg/models/user.go b/pkg/models/user.go index 64067d59654..2842bad490d 100644 --- a/pkg/models/user.go +++ b/pkg/models/user.go @@ -157,3 +157,8 @@ type UserSearchHitDTO struct { Email string `json:"email"` IsAdmin bool `json:"isAdmin"` } + +type UserIdDTO struct { + Id int64 `json:"id"` + Message string `json:"message"` +} diff --git a/pkg/plugins/models.go b/pkg/plugins/models.go new file mode 100644 index 00000000000..889229e79b9 --- /dev/null +++ b/pkg/plugins/models.go @@ -0,0 +1,26 @@ +package plugins + +type DataSourcePlugin struct { + Type string `json:"type"` + Name string `json:"name"` + ServiceName string `json:"serviceName"` + Module string `json:"module"` + Partials map[string]interface{} `json:"partials"` + DefaultMatchFormat string `json:"defaultMatchFormat"` + Annotations bool `json:"annotations"` + Metrics bool `json:"metrics"` + BuiltIn bool `json:"builtIn"` + StaticRootConfig *StaticRootConfig `json:"staticRoot"` +} + +type PanelPlugin struct { + Type string `json:"type"` + Name string `json:"name"` + Module string `json:"module"` + StaticRootConfig *StaticRootConfig `json:"staticRoot"` +} + +type StaticRootConfig struct { + Url string `json:"url"` + Path string `json:"path"` +} diff --git a/pkg/plugins/plugins.go b/pkg/plugins/plugins.go index 665cf6a36ca..e7de4d5f2dd 100644 --- a/pkg/plugins/plugins.go +++ b/pkg/plugins/plugins.go @@ -6,18 +6,17 @@ import ( "os" "path" "path/filepath" + "strings" "github.com/grafana/grafana/pkg/log" "github.com/grafana/grafana/pkg/setting" + "github.com/grafana/grafana/pkg/util" ) -type PluginMeta struct { - Type string `json:"type"` - Name string `json:"name"` -} - var ( - DataSources map[string]interface{} + DataSources map[string]DataSourcePlugin + Panels map[string]PanelPlugin + StaticRoutes []*StaticRootConfig ) type PluginScanner struct { @@ -25,18 +24,37 @@ type PluginScanner struct { errors []error } -func Init() { +func Init() error { + DataSources = make(map[string]DataSourcePlugin) + StaticRoutes = make([]*StaticRootConfig, 0) + Panels = make(map[string]PanelPlugin) + scan(path.Join(setting.StaticRootPath, "app/plugins")) + scan(path.Join(setting.PluginsPath)) + checkExternalPluginPaths() + + return nil +} + +func checkExternalPluginPaths() error { + for _, section := range setting.Cfg.Sections() { + if strings.HasPrefix(section.Name(), "plugin.") { + path := section.Key("path").String() + if path != "" { + log.Info("Plugin: Scaning dir %s", path) + scan(path) + } + } + } + return nil } func scan(pluginDir string) error { - DataSources = make(map[string]interface{}) - scanner := &PluginScanner{ pluginPath: pluginDir, } - if err := filepath.Walk(pluginDir, scanner.walker); err != nil { + if err := util.Walk(pluginDir, true, true, scanner.walker); err != nil { return err } @@ -47,7 +65,7 @@ func scan(pluginDir string) error { return nil } -func (scanner *PluginScanner) walker(path string, f os.FileInfo, err error) error { +func (scanner *PluginScanner) walker(currentPath string, f os.FileInfo, err error) error { if err != nil { return err } @@ -57,17 +75,25 @@ func (scanner *PluginScanner) walker(path string, f os.FileInfo, err error) erro } if f.Name() == "plugin.json" { - err := scanner.loadPluginJson(path) + err := scanner.loadPluginJson(currentPath) if err != nil { - log.Error(3, "Failed to load plugin json file: %v, err: %v", path, err) + log.Error(3, "Failed to load plugin json file: %v, err: %v", currentPath, err) scanner.errors = append(scanner.errors, err) } } return nil } -func (scanner *PluginScanner) loadPluginJson(path string) error { - reader, err := os.Open(path) +func addStaticRoot(staticRootConfig *StaticRootConfig, currentDir string) { + if staticRootConfig != nil { + staticRootConfig.Path = path.Join(currentDir, staticRootConfig.Path) + StaticRoutes = append(StaticRoutes, staticRootConfig) + } +} + +func (scanner *PluginScanner) loadPluginJson(pluginJsonFilePath string) error { + currentDir := filepath.Dir(pluginJsonFilePath) + reader, err := os.Open(pluginJsonFilePath) if err != nil { return err } @@ -87,11 +113,33 @@ func (scanner *PluginScanner) loadPluginJson(path string) error { } if pluginType == "datasource" { - datasourceType, exists := pluginJson["type"] - if !exists { + p := DataSourcePlugin{} + reader.Seek(0, 0) + if err := jsonParser.Decode(&p); err != nil { + return err + } + + if p.Type == "" { return errors.New("Did not find type property in plugin.json") } - DataSources[datasourceType.(string)] = pluginJson + + DataSources[p.Type] = p + addStaticRoot(p.StaticRootConfig, currentDir) + } + + if pluginType == "panel" { + p := PanelPlugin{} + reader.Seek(0, 0) + if err := jsonParser.Decode(&p); err != nil { + return err + } + + if p.Type == "" { + return errors.New("Did not find type property in plugin.json") + } + + Panels[p.Type] = p + addStaticRoot(p.StaticRootConfig, currentDir) } return nil diff --git a/pkg/plugins/plugins_test.go b/pkg/plugins/plugins_test.go index 4d3e2c98836..bbeac4bba81 100644 --- a/pkg/plugins/plugins_test.go +++ b/pkg/plugins/plugins_test.go @@ -4,14 +4,17 @@ import ( "path/filepath" "testing" + "github.com/grafana/grafana/pkg/setting" . "github.com/smartystreets/goconvey/convey" + "gopkg.in/ini.v1" ) func TestPluginScans(t *testing.T) { Convey("When scaning for plugins", t, func() { - path, _ := filepath.Abs("../../public/app/plugins") - err := scan(path) + setting.StaticRootPath, _ = filepath.Abs("../../public/") + setting.Cfg = ini.Empty() + err := Init() So(err, ShouldBeNil) So(len(DataSources), ShouldBeGreaterThan, 1) diff --git a/pkg/services/sqlstore/datasource.go b/pkg/services/sqlstore/datasource.go index ebb2ad977b1..4e1292afaa6 100644 --- a/pkg/services/sqlstore/datasource.go +++ b/pkg/services/sqlstore/datasource.go @@ -114,12 +114,14 @@ func UpdateDataSource(cmd *m.UpdateDataSourceCommand) error { BasicAuth: cmd.BasicAuth, BasicAuthUser: cmd.BasicAuthUser, BasicAuthPassword: cmd.BasicAuthPassword, + WithCredentials: cmd.WithCredentials, JsonData: cmd.JsonData, Updated: time.Now(), } sess.UseBool("is_default") sess.UseBool("basic_auth") + sess.UseBool("with_credentials") _, err := sess.Where("id=? and org_id=?", ds.Id, ds.OrgId).Update(ds) if err != nil { diff --git a/pkg/services/sqlstore/migrations/datasource_mig.go b/pkg/services/sqlstore/migrations/datasource_mig.go index 4f046b1f8e9..90f7dac85e6 100644 --- a/pkg/services/sqlstore/migrations/datasource_mig.go +++ b/pkg/services/sqlstore/migrations/datasource_mig.go @@ -96,4 +96,9 @@ func addDataSourceMigration(mg *Migrator) { })) mg.AddMigration("Drop old table data_source_v1 #2", NewDropTableMigration("data_source_v1")) + + // add column to activate withCredentials option + mg.AddMigration("Add column with_credentials", NewAddColumnMigration(tableV2, &Column{ + Name: "with_credentials", Type: DB_Bool, Nullable: false, Default: "0", + })) } diff --git a/pkg/services/sqlstore/migrations/migrations.go b/pkg/services/sqlstore/migrations/migrations.go index 8f7054d3959..569d26282ed 100644 --- a/pkg/services/sqlstore/migrations/migrations.go +++ b/pkg/services/sqlstore/migrations/migrations.go @@ -18,6 +18,7 @@ func AddMigrations(mg *Migrator) { addApiKeyMigrations(mg) addDashboardSnapshotMigrations(mg) addQuotaMigration(mg) + addPluginBundleMigration(mg) } func addMigrationLogMigrations(mg *Migrator) { diff --git a/pkg/services/sqlstore/migrations/plugin_bundle.go b/pkg/services/sqlstore/migrations/plugin_bundle.go new file mode 100644 index 00000000000..b56ea74a13e --- /dev/null +++ b/pkg/services/sqlstore/migrations/plugin_bundle.go @@ -0,0 +1,26 @@ +package migrations + +import . "github.com/grafana/grafana/pkg/services/sqlstore/migrator" + +func addPluginBundleMigration(mg *Migrator) { + + var pluginBundleV1 = Table{ + Name: "plugin_bundle", + Columns: []*Column{ + {Name: "id", Type: DB_BigInt, IsPrimaryKey: true, IsAutoIncrement: true}, + {Name: "org_id", Type: DB_BigInt, Nullable: true}, + {Name: "type", Type: DB_NVarchar, Length: 255, Nullable: false}, + {Name: "enabled", Type: DB_Bool, Nullable: false}, + {Name: "json_data", Type: DB_Text, Nullable: true}, + {Name: "created", Type: DB_DateTime, Nullable: false}, + {Name: "updated", Type: DB_DateTime, Nullable: false}, + }, + Indices: []*Index{ + {Cols: []string{"org_id", "type"}, Type: UniqueIndex}, + }, + } + mg.AddMigration("create plugin_bundle table v1", NewAddTableMigration(pluginBundleV1)) + + //------- indexes ------------------ + addTableIndicesMigrations(mg, "v1", pluginBundleV1) +} diff --git a/pkg/services/sqlstore/migrator/column.go b/pkg/services/sqlstore/migrator/column.go index db2db6dea04..11d6a1b8b08 100644 --- a/pkg/services/sqlstore/migrator/column.go +++ b/pkg/services/sqlstore/migrator/column.go @@ -55,7 +55,7 @@ func (col *Column) StringNoPk(d Dialect) string { } if col.Default != "" { - sql += "DEFAULT " + col.Default + " " + sql += "DEFAULT " + d.Default(col) + " " } return sql diff --git a/pkg/services/sqlstore/migrator/dialect.go b/pkg/services/sqlstore/migrator/dialect.go index f2fffbb16b3..0c94eb82234 100644 --- a/pkg/services/sqlstore/migrator/dialect.go +++ b/pkg/services/sqlstore/migrator/dialect.go @@ -17,10 +17,11 @@ type Dialect interface { SqlType(col *Column) string SupportEngine() bool LikeStr() string + Default(col *Column) string CreateIndexSql(tableName string, index *Index) string CreateTableSql(table *Table) string - AddColumnSql(tableName string, Col *Column) string + AddColumnSql(tableName string, col *Column) string CopyTableData(sourceTable string, targetTable string, sourceCols []string, targetCols []string) string DropTable(tableName string) string DropIndexSql(tableName string, index *Index) string @@ -71,6 +72,10 @@ func (b *BaseDialect) EqStr() string { return "=" } +func (b *BaseDialect) Default(col *Column) string { + return col.Default +} + func (b *BaseDialect) CreateTableSql(table *Table) string { var sql string sql = "CREATE TABLE IF NOT EXISTS " diff --git a/pkg/services/sqlstore/migrator/migrations.go b/pkg/services/sqlstore/migrator/migrations.go index a65c7ec7e81..7d97abb6bb9 100644 --- a/pkg/services/sqlstore/migrator/migrations.go +++ b/pkg/services/sqlstore/migrator/migrations.go @@ -64,6 +64,10 @@ type AddColumnMigration struct { column *Column } +func NewAddColumnMigration(table Table, col *Column) *AddColumnMigration { + return &AddColumnMigration{tableName: table.Name, column: col} +} + func (m *AddColumnMigration) Table(tableName string) *AddColumnMigration { m.tableName = tableName return m diff --git a/pkg/services/sqlstore/migrator/postgres_dialect.go b/pkg/services/sqlstore/migrator/postgres_dialect.go index 3ab13f49b49..826a00a1410 100644 --- a/pkg/services/sqlstore/migrator/postgres_dialect.go +++ b/pkg/services/sqlstore/migrator/postgres_dialect.go @@ -36,6 +36,17 @@ func (db *Postgres) AutoIncrStr() string { return "" } +func (b *Postgres) Default(col *Column) string { + if col.Type == DB_Bool { + if col.Default == "0" { + return "FALSE" + } else { + return "TRUE" + } + } + return col.Default +} + func (db *Postgres) SqlType(c *Column) string { var res string switch t := c.Type; t { diff --git a/pkg/services/sqlstore/plugin_bundle.go b/pkg/services/sqlstore/plugin_bundle.go new file mode 100644 index 00000000000..c15c263a100 --- /dev/null +++ b/pkg/services/sqlstore/plugin_bundle.go @@ -0,0 +1,46 @@ +package sqlstore + +import ( + "time" + + "github.com/grafana/grafana/pkg/bus" + m "github.com/grafana/grafana/pkg/models" +) + +func init() { + bus.AddHandler("sql", GetPluginBundles) + bus.AddHandler("sql", UpdatePluginBundle) +} + +func GetPluginBundles(query *m.GetPluginBundlesQuery) error { + sess := x.Where("org_id=?", query.OrgId) + + query.Result = make([]*m.PluginBundle, 0) + return sess.Find(&query.Result) +} + +func UpdatePluginBundle(cmd *m.UpdatePluginBundleCmd) error { + return inTransaction2(func(sess *session) error { + var bundle m.PluginBundle + + exists, err := sess.Where("org_id=? and type=?", cmd.OrgId, cmd.Type).Get(&bundle) + sess.UseBool("enabled") + if !exists { + bundle = m.PluginBundle{ + Type: cmd.Type, + OrgId: cmd.OrgId, + Enabled: cmd.Enabled, + JsonData: cmd.JsonData, + Created: time.Now(), + Updated: time.Now(), + } + _, err = sess.Insert(&bundle) + return err + } else { + bundle.Enabled = cmd.Enabled + bundle.JsonData = cmd.JsonData + _, err = sess.Id(bundle.Id).Update(&bundle) + return err + } + }) +} diff --git a/pkg/services/sqlstore/user.go b/pkg/services/sqlstore/user.go index 6c6f581dcc4..96b8c24b8fc 100644 --- a/pkg/services/sqlstore/user.go +++ b/pkg/services/sqlstore/user.go @@ -321,7 +321,7 @@ func DeleteUser(cmd *m.DeleteUserCommand) error { return inTransaction(func(sess *xorm.Session) error { deletes := []string{ "DELETE FROM star WHERE user_id = ?", - "DELETE FROM user WHERE id = ?", + "DELETE FROM " + dialect.Quote("user") + " WHERE id = ?", } for _, sql := range deletes { diff --git a/pkg/setting/setting.go b/pkg/setting/setting.go index d6a853a9cdc..4e081e4e00b 100644 --- a/pkg/setting/setting.go +++ b/pkg/setting/setting.go @@ -48,9 +48,10 @@ var ( BuildStamp int64 // Paths - LogsPath string - HomePath string - DataPath string + LogsPath string + HomePath string + DataPath string + PluginsPath string // Log settings. LogModes []string @@ -76,12 +77,18 @@ var ( EmailCodeValidMinutes int DataProxyWhiteList map[string]bool + // Snapshots + ExternalSnapshotUrl string + ExternalSnapshotName string + ExternalEnabled bool + // User settings AllowUserSignUp bool AllowUserOrgCreate bool AutoAssignOrg bool AutoAssignOrgRole string VerifyEmailEnabled bool + LoginHint string // Http auth AdminUser string @@ -174,6 +181,9 @@ func applyEnvVariableOverrides() { if len(envValue) > 0 { key.SetValue(envValue) + if strings.Contains(envKey, "PASSWORD") { + envValue = "*********" + } appliedEnvOverrides = append(appliedEnvOverrides, fmt.Sprintf("%s=%s", envKey, envValue)) } } @@ -188,6 +198,9 @@ func applyCommandLineDefaultProperties(props map[string]string) { value, exists := props[keyString] if exists { key.SetValue(value) + if strings.Contains(keyString, "password") { + value = "*********" + } appliedCommandLineProperties = append(appliedCommandLineProperties, fmt.Sprintf("%s=%s", keyString, value)) } } @@ -275,13 +288,11 @@ func loadSpecifedConfigFile(configFile string) { defaultSec, err := Cfg.GetSection(section.Name()) if err != nil { - log.Error(3, "Unknown config section %s defined in %s", section.Name(), configFile) - continue + defaultSec, _ = Cfg.NewSection(section.Name()) } defaultKey, err := defaultSec.GetKey(key.Name()) if err != nil { - log.Error(3, "Unknown config key %s defined in section %s, in file %s", key.Name(), section.Name(), configFile) - continue + defaultKey, _ = defaultSec.NewKey(key.Name(), key.Value()) } defaultKey.SetValue(key.Value()) } @@ -383,6 +394,7 @@ func NewConfigContext(args *CommandLineArgs) error { loadConfiguration(args) Env = Cfg.Section("").Key("app_mode").MustString("development") + PluginsPath = Cfg.Section("paths").Key("plugins").String() server := Cfg.Section("server") AppUrl, AppSubUrl = parseAppUrlAndSubUrl(server) @@ -414,6 +426,12 @@ func NewConfigContext(args *CommandLineArgs) error { CookieRememberName = security.Key("cookie_remember_name").String() DisableGravatar = security.Key("disable_gravatar").MustBool(true) + // read snapshots settings + snapshots := Cfg.Section("snapshots") + ExternalSnapshotUrl = snapshots.Key("external_snapshot_url").String() + ExternalSnapshotName = snapshots.Key("external_snapshot_name").String() + ExternalEnabled = snapshots.Key("external_enabled").MustBool(true) + // read data source proxy white list DataProxyWhiteList = make(map[string]bool) for _, hostAndIp := range security.Key("data_source_proxy_whitelist").Strings(" ") { @@ -430,6 +448,7 @@ func NewConfigContext(args *CommandLineArgs) error { AutoAssignOrg = users.Key("auto_assign_org").MustBool(true) AutoAssignOrgRole = users.Key("auto_assign_org_role").In("Editor", []string{"Editor", "Admin", "Read Only Editor", "Viewer"}) VerifyEmailEnabled = users.Key("verify_email_enabled").MustBool(false) + LoginHint = users.Key("login_hint").String() // anonymous access AnonymousEnabled = Cfg.Section("auth.anonymous").Key("enabled").MustBool(false) @@ -567,6 +586,14 @@ func initLogging(args *CommandLineArgs) { "driver": sec.Key("driver").String(), "conn": sec.Key("conn").String(), } + case "syslog": + LogConfigs[i] = util.DynMap{ + "level": level, + "network": sec.Key("network").MustString(""), + "address": sec.Key("address").MustString(""), + "facility": sec.Key("facility").MustString("local7"), + "tag": sec.Key("tag").MustString(""), + } } cfgJsonBytes, _ := json.Marshal(LogConfigs[i]) @@ -601,6 +628,7 @@ func LogConfigurationInfo() { text.WriteString(fmt.Sprintf(" home: %s\n", HomePath)) text.WriteString(fmt.Sprintf(" data: %s\n", DataPath)) text.WriteString(fmt.Sprintf(" logs: %s\n", LogsPath)) + text.WriteString(fmt.Sprintf(" plugins: %s\n", PluginsPath)) log.Info(text.String()) } diff --git a/pkg/social/social.go b/pkg/social/social.go index 1a00934b937..4a8cb8bac5d 100644 --- a/pkg/social/social.go +++ b/pkg/social/social.go @@ -193,7 +193,7 @@ func (s *SocialGithub) FetchPrivateEmail(client *http.Client) (string, error) { Verified bool `json:"verified"` } - emailsUrl := fmt.Sprintf("https://api.github.com/user/emails") + emailsUrl := fmt.Sprintf(s.apiUrl + "/emails") r, err := client.Get(emailsUrl) if err != nil { return "", err @@ -222,7 +222,7 @@ func (s *SocialGithub) FetchTeamMemberships(client *http.Client) ([]int, error) Id int `json:"id"` } - membershipUrl := fmt.Sprintf("https://api.github.com/user/teams") + membershipUrl := fmt.Sprintf(s.apiUrl + "/teams") r, err := client.Get(membershipUrl) if err != nil { return nil, err @@ -249,7 +249,7 @@ func (s *SocialGithub) FetchOrganizations(client *http.Client) ([]string, error) Login string `json:"login"` } - url := fmt.Sprintf("https://api.github.com/user/orgs") + url := fmt.Sprintf(s.apiUrl + "/orgs") r, err := client.Get(url) if err != nil { return nil, err diff --git a/pkg/util/filepath.go b/pkg/util/filepath.go new file mode 100644 index 00000000000..d0e27926956 --- /dev/null +++ b/pkg/util/filepath.go @@ -0,0 +1,98 @@ +package util + +import ( + "errors" + "fmt" + "io/ioutil" + "os" + "path/filepath" +) + +//WalkSkipDir is the Error returned when we want to skip descending into a directory +var WalkSkipDir = errors.New("skip this directory") + +//WalkFunc is a callback function called for each path as a directory is walked +//If resolvedPath != "", then we are following symbolic links. +type WalkFunc func(resolvedPath string, info os.FileInfo, err error) error + +//Walk walks a path, optionally following symbolic links, and for each path, +//it calls the walkFn passed. +// +//It is similar to filepath.Walk, except that it supports symbolic links and +//can detect infinite loops while following sym links. +//It solves the issue where your WalkFunc needs a path relative to the symbolic link +//(resolving links within walkfunc loses the path to the symbolic link for each traversal). +func Walk(path string, followSymlinks bool, detectSymlinkInfiniteLoop bool, walkFn WalkFunc) error { + info, err := os.Lstat(path) + if err != nil { + return err + } + var symlinkPathsFollowed map[string]bool + var resolvedPath string + if followSymlinks { + resolvedPath = path + if detectSymlinkInfiniteLoop { + symlinkPathsFollowed = make(map[string]bool, 8) + } + } + return walk(path, info, resolvedPath, symlinkPathsFollowed, walkFn) +} + +//walk walks the path. It is a helper/sibling function to Walk. +//It takes a resolvedPath into consideration. This way, paths being walked are +//always relative to the path argument, even if symbolic links were resolved). +// +//If resolvedPath is "", then we are not following symbolic links. +//If symlinkPathsFollowed is not nil, then we need to detect infinite loop. +func walk(path string, info os.FileInfo, resolvedPath string, + symlinkPathsFollowed map[string]bool, walkFn WalkFunc) error { + if info == nil { + return errors.New("Walk: Nil FileInfo passed") + } + err := walkFn(resolvedPath, info, nil) + if err != nil { + if info.IsDir() && err == WalkSkipDir { + err = nil + } + return err + } + if resolvedPath != "" && info.Mode()&os.ModeSymlink == os.ModeSymlink { + path2, err := os.Readlink(resolvedPath) + if err != nil { + return err + } + //vout("SymLink Path: %v, links to: %v", resolvedPath, path2) + if symlinkPathsFollowed != nil { + if _, ok := symlinkPathsFollowed[path2]; ok { + errMsg := "Potential SymLink Infinite Loop. Path: %v, Link To: %v" + return fmt.Errorf(errMsg, resolvedPath, path2) + } else { + symlinkPathsFollowed[path2] = true + } + } + info2, err := os.Lstat(path2) + if err != nil { + return err + } + return walk(path, info2, path2, symlinkPathsFollowed, walkFn) + } + if info.IsDir() { + list, err := ioutil.ReadDir(path) + if err != nil { + return walkFn(resolvedPath, info, err) + } + for _, fileInfo := range list { + path2 := filepath.Join(path, fileInfo.Name()) + var resolvedPath2 string + if resolvedPath != "" { + resolvedPath2 = filepath.Join(resolvedPath, fileInfo.Name()) + } + err = walk(path2, fileInfo, resolvedPath2, symlinkPathsFollowed, walkFn) + if err != nil { + return err + } + } + return nil + } + return nil +} diff --git a/public/app/app.js b/public/app/app.js index 1e7acf2e56f..b8d6579dea1 100644 --- a/public/app/app.js +++ b/public/app/app.js @@ -2,19 +2,18 @@ define([ 'angular', 'jquery', 'lodash', + 'app/core/config', 'require', - 'config', 'bootstrap', 'angular-route', 'angular-sanitize', 'angular-strap', 'angular-dragdrop', 'angular-ui', - 'extend-jquery', 'bindonce', 'app/core/core', ], -function (angular, $, _, appLevelRequire) { +function (angular, $, _, config, appLevelRequire) { "use strict"; var app = angular.module('grafana', []); @@ -37,6 +36,8 @@ function (angular, $, _, appLevelRequire) { } else { _.extend(module, register_fns); } + // push it into the apps dependencies + apps_deps.push(module.name); return module; }; @@ -66,16 +67,15 @@ function (angular, $, _, appLevelRequire) { var module_name = 'grafana.'+type; // create the module app.useModule(angular.module(module_name, [])); - // push it into the apps dependencies - apps_deps.push(module_name); }); - var preBootRequires = [ - 'app/services/all', - 'app/features/all', - 'app/controllers/all', - 'app/components/partials', - ]; + var preBootRequires = ['app/features/all']; + var pluginModules = config.bootData.pluginModules || []; + + // add plugin modules + for (var i = 0; i < pluginModules.length; i++) { + preBootRequires.push(pluginModules[i]); + } app.boot = function() { require(preBootRequires, function () { diff --git a/public/app/components/settings.js b/public/app/components/settings.js deleted file mode 100644 index a9e1d382dd5..00000000000 --- a/public/app/components/settings.js +++ /dev/null @@ -1,57 +0,0 @@ -define([ - 'lodash', -], -function (_) { - "use strict"; - - return function Settings (options) { - /** - * To add a setting, you MUST define a default. Also, - * THESE ARE ONLY DEFAULTS. - * They are overridden by config.js in the root directory - * @type {Object} - */ - var defaults = { - datasources : {}, - window_title_prefix : 'Grafana - ', - panels : { - 'graph': { path: 'app/panels/graph', name: 'Graph' }, - 'singlestat': { path: 'app/panels/singlestat', name: 'Single stat' }, - 'text': { path: 'app/panels/text', name: 'Text' }, - 'dashlist': { path: 'app/panels/dashlist', name: 'Dashboard list' }, - }, - new_panel_title: 'no title (click here)', - plugins: {}, - default_route: '/dashboard/file/default.json', - playlist_timespan: "1m", - unsaved_changes_warning: true, - search: { max_results: 100 }, - appSubUrl: "" - }; - - var settings = _.extend({}, defaults, options); - - // var parseBasicAuth = function(datasource) { - // var passwordEnd = datasource.url.indexOf('@'); - // if (passwordEnd > 0) { - // var userStart = datasource.url.indexOf('//') + 2; - // var userAndPassword = datasource.url.substring(userStart, passwordEnd); - // var bytes = crypto.charenc.Binary.stringToBytes(userAndPassword); - // datasource.basicAuth = crypto.util.bytesToBase64(bytes); - // - // var urlHead = datasource.url.substring(0, userStart); - // datasource.url = urlHead + datasource.url.substring(passwordEnd + 1); - // } - // - // return datasource; - // }; - // - // _.each(settings.datasources, function(datasource, key) { - // datasource.name = key; - // if (datasource.url) { parseBasicAuth(datasource); } - // if (datasource.type === 'influxdb') { parseMultipleHosts(datasource); } - // }); - - return settings; - }; -}); diff --git a/public/app/controllers/all.js b/public/app/controllers/all.js deleted file mode 100644 index 1a313e6b019..00000000000 --- a/public/app/controllers/all.js +++ /dev/null @@ -1,12 +0,0 @@ -define([ - './grafanaCtrl', - './search', - './inspectCtrl', - './jsonEditorCtrl', - './loginCtrl', - './invitedCtrl', - './signupCtrl', - './resetPasswordCtrl', - './sidemenuCtrl', - './errorCtrl', -], function () {}); diff --git a/public/app/controllers/console-ctrl.js b/public/app/controllers/console-ctrl.js deleted file mode 100644 index 8a673d99476..00000000000 --- a/public/app/controllers/console-ctrl.js +++ /dev/null @@ -1,108 +0,0 @@ -define([ - 'angular', - 'lodash', - 'moment', - 'store' -], -function (angular, _, moment, store) { - 'use strict'; - - var module = angular.module('grafana.controllers'); - var consoleEnabled = store.getBool('grafanaConsole'); - - if (!consoleEnabled) { - return; - } - - var events = []; - - function ConsoleEvent(type, title, data) { - this.type = type; - this.title = title; - this.data = data; - this.time = moment().format('hh:mm:ss'); - - if (data.config) { - this.method = data.config.method; - this.elapsed = (new Date().getTime() - data.config.$grafana_timestamp) + ' ms'; - if (data.config.params && data.config.params.q) { - this.field2 = data.config.params.q; - } - if (_.isString(data.config.data)) { - this.field2 = data.config.data; - } - if (data.status !== 200) { - this.error = true; - this.field3 = data.data; - } - - if (_.isArray(data.data)) { - this.extractTimeseriesInfo(data.data); - } - } - } - - ConsoleEvent.prototype.extractTimeseriesInfo = function(series) { - if (series.length === 0) { - return; - } - - var points = 0; - var ok = false; - - if (series[0].datapoints) { - points = _.reduce(series, function(memo, val) { - return memo + val.datapoints.length; - }, 0); - ok = true; - } - if (series[0].columns) { - points = _.reduce(series, function(memo, val) { - return memo + val.points.length; - }, 0); - ok = true; - } - - if (ok) { - this.field1 = '(' + series.length + ' series'; - this.field1 += ', ' + points + ' points)'; - } - }; - - module.config(function($provide, $httpProvider) { - $provide.factory('mupp', function($q) { - return { - 'request': function(config) { - if (config.inspect) { - config.$grafana_timestamp = new Date().getTime(); - } - return config; - }, - 'response': function(response) { - if (response.config.inspect) { - events.push(new ConsoleEvent(response.config.inspect.type, response.config.url, response)); - } - return response; - }, - 'requestError': function(rejection) { - console.log('requestError', rejection); - return $q.reject(rejection); - }, - 'responseError': function (rejection) { - var inspect = rejection.config.inspect || { type: 'error' }; - events.push(new ConsoleEvent(inspect.type, rejection.config.url, rejection)); - return $q.reject(rejection); - } - }; - }); - - $httpProvider.interceptors.push('mupp'); - }); - - module.controller('ConsoleCtrl', function($scope) { - - $scope.events = events; - - }); - -}); diff --git a/public/app/controllers/metricKeys.js b/public/app/controllers/metricKeys.js deleted file mode 100644 index be743112cf8..00000000000 --- a/public/app/controllers/metricKeys.js +++ /dev/null @@ -1,186 +0,0 @@ -define([ - 'angular', - 'lodash', - 'config' -], -function (angular, _, config) { - 'use strict'; - - var module = angular.module('grafana.controllers'); - - module.controller('MetricKeysCtrl', function($scope, $http, $q) { - var elasticSearchUrlForMetricIndex = config.elasticsearch + '/' + config.grafana_metrics_index + '/'; - var httpOptions = {}; - if (config.elasticsearchBasicAuth) { - httpOptions.withCredentials = true; - httpOptions.headers = { - "Authorization": "Basic " + config.elasticsearchBasicAuth - }; - } - $scope.init = function () { - $scope.metricPath = "prod.apps.api.boobarella.*"; - $scope.metricCounter = 0; - }; - - $scope.createIndex = function () { - $scope.errorText = null; - $scope.infoText = null; - - deleteIndex() - .then(createIndex) - .then(function () { - $scope.infoText = "Index created!"; - }) - .then(null, function (err) { - $scope.errorText = angular.toJson(err); - }); - }; - - $scope.loadMetricsFromPath = function() { - $scope.errorText = null; - $scope.infoText = null; - $scope.metricCounter = 0; - - return loadMetricsRecursive($scope.metricPath) - .then(function() { - $scope.infoText = "Indexing completed!"; - }, function(err) { - $scope.errorText = "Error: " + err; - }); - }; - - $scope.loadAll = function() { - $scope.infoText = "Fetching all metrics from graphite..."; - - getFromEachGraphite('/metrics/index.json', saveMetricsArray) - .then(function() { - $scope.infoText = "Indexing complete!"; - }).then(null, function(err) { - $scope.errorText = err; - }); - }; - - function getFromEachGraphite(request, data_callback, error_callback) { - return $q.all(_.map(config.datasources, function(datasource) { - if (datasource.type = 'graphite') { - return $http.get(datasource.url + request) - .then(data_callback, error_callback); - } - })); - } - - function saveMetricsArray(data, currentIndex) { - if (!data && !data.data && data.data.length === 0) { - return $q.reject('No metrics from graphite'); - } - - if (data.data.length === currentIndex) { - return $q.when('done'); - } - - currentIndex = currentIndex || 0; - - return saveMetricKey(data.data[currentIndex]) - .then(function() { - return saveMetricsArray(data, currentIndex + 1); - }); - } - - function deleteIndex() - { - var deferred = $q.defer(); - $http.delete(elasticSearchUrlForMetricIndex, httpOptions) - .success(function() { - deferred.resolve('ok'); - }) - .error(function(data, status) { - if (status === 404) { - deferred.resolve('ok'); - } - else { - deferred.reject('elastic search returned unexpected error'); - } - }); - - return deferred.promise; - } - - function createIndex() - { - return $http.put(elasticSearchUrlForMetricIndex, { - settings: { - analysis: { - analyzer: { - metric_path_ngram : { tokenizer : "my_ngram_tokenizer" } - }, - tokenizer: { - my_ngram_tokenizer : { - type : "nGram", - min_gram : "3", - max_gram : "8", - token_chars: ["letter", "digit", "punctuation", "symbol"] - } - } - } - }, - mappings: { - metricKey: { - properties: { - metricPath: { - type: "multi_field", - fields: { - "metricPath": { type: "string", index: "analyzed", index_analyzer: "standard" }, - "metricPath_ng": { type: "string", index: "analyzed", index_analyzer: "metric_path_ngram" } - } - } - } - } - } - }, httpOptions); - } - - function receiveMetric(result) { - var data = result.data; - if (!data || data.length === 0) { - console.log('no data'); - return; - } - - var funcs = _.map(data, function(metric) { - if (metric.expandable) { - return loadMetricsRecursive(metric.id + ".*"); - } - if (metric.leaf) { - return saveMetricKey(metric.id); - } - }); - - return $q.all(funcs); - } - - function saveMetricKey(metricId) { - - // Create request with id as title. Rethink this. - var request = $scope.ejs.Document(config.grafana_metrics_index, 'metricKey', metricId).source({ - metricPath: metricId - }); - - return request.doIndex( - function() { - $scope.infoText = "Indexing " + metricId; - $scope.metricCounter = $scope.metricCounter + 1; - }, - function() { - $scope.errorText = "failed to save metric " + metricId; - } - ); - } - - function loadMetricsRecursive(metricPath) - { - return getFromEachGraphite('/metrics/find/?query=' + metricPath, receiveMetric); - } - - }); - -}); diff --git a/public/app/components/config.js b/public/app/core/config.js similarity index 77% rename from public/app/components/config.js rename to public/app/core/config.js index e26a55e097b..410d47f7b9a 100644 --- a/public/app/components/config.js +++ b/public/app/core/config.js @@ -1,11 +1,12 @@ define([ - 'settings', + 'app/core/settings', ], function (Settings) { "use strict"; var bootData = window.grafanaBootData || { settings: {} }; var options = bootData.settings; + options.bootData = bootData; return new Settings(options); diff --git a/public/app/core/controllers/all.js b/public/app/core/controllers/all.js new file mode 100644 index 00000000000..d22010cffdc --- /dev/null +++ b/public/app/core/controllers/all.js @@ -0,0 +1,12 @@ +define([ + './grafana_ctrl', + './search_ctrl', + './inspect_ctrl', + './json_editor_ctrl', + './login_ctrl', + './invited_ctrl', + './signup_ctrl', + './reset_password_ctrl', + './sidemenu_ctrl', + './error_ctrl', +], function () {}); diff --git a/public/app/controllers/errorCtrl.js b/public/app/core/controllers/error_ctrl.js similarity index 60% rename from public/app/controllers/errorCtrl.js rename to public/app/core/controllers/error_ctrl.js index 13b64584226..9816928fa6c 100644 --- a/public/app/controllers/errorCtrl.js +++ b/public/app/core/controllers/error_ctrl.js @@ -1,13 +1,11 @@ define([ 'angular', - 'lodash' + '../core_module', ], -function (angular) { +function (angular, coreModule) { 'use strict'; - var module = angular.module('grafana.controllers'); - - module.controller('ErrorCtrl', function($scope, contextSrv) { + coreModule.controller('ErrorCtrl', function($scope, contextSrv) { var showSideMenu = contextSrv.sidemenu; contextSrv.sidemenu = false; diff --git a/public/app/controllers/grafanaCtrl.js b/public/app/core/controllers/grafana_ctrl.js similarity index 94% rename from public/app/controllers/grafanaCtrl.js rename to public/app/core/controllers/grafana_ctrl.js index 77c4d5f70c5..baafd15938e 100644 --- a/public/app/controllers/grafanaCtrl.js +++ b/public/app/core/controllers/grafana_ctrl.js @@ -1,16 +1,15 @@ define([ 'angular', - 'config', 'lodash', 'jquery', - 'store', + '../core_module', + 'app/core/config', + 'app/core/store', ], -function (angular, config, _, $, store) { +function (angular, _, $, coreModule, config, store) { "use strict"; - var module = angular.module('grafana.controllers'); - - module.controller('GrafanaCtrl', function($scope, alertSrv, utilSrv, $rootScope, $controller, contextSrv) { + coreModule.controller('GrafanaCtrl', function($scope, alertSrv, utilSrv, $rootScope, $controller, contextSrv) { $scope.init = function() { $scope.contextSrv = contextSrv; diff --git a/public/app/controllers/inspectCtrl.js b/public/app/core/controllers/inspect_ctrl.js similarity index 92% rename from public/app/controllers/inspectCtrl.js rename to public/app/core/controllers/inspect_ctrl.js index e70a88323e9..81cfaf64a85 100644 --- a/public/app/controllers/inspectCtrl.js +++ b/public/app/core/controllers/inspect_ctrl.js @@ -2,13 +2,12 @@ define([ 'angular', 'lodash', 'jquery', + '../core_module', ], -function (angular, _, $) { +function (angular, _, $, coreModule) { 'use strict'; - var module = angular.module('grafana.controllers'); - - module.controller('InspectCtrl', function($scope) { + coreModule.controller('InspectCtrl', function($scope) { var model = $scope.inspector; function getParametersFromQueryString(queryString) { diff --git a/public/app/controllers/invitedCtrl.js b/public/app/core/controllers/invited_ctrl.js similarity index 81% rename from public/app/controllers/invitedCtrl.js rename to public/app/core/controllers/invited_ctrl.js index 0b4a096fb1b..540cb01ca1c 100644 --- a/public/app/controllers/invitedCtrl.js +++ b/public/app/core/controllers/invited_ctrl.js @@ -1,16 +1,13 @@ define([ 'angular', - 'config', + '../core_module', + 'app/core/config', ], -function (angular, config) { +function (angular, coreModule, config) { 'use strict'; - var module = angular.module('grafana.controllers'); - - module.controller('InvitedCtrl', function($scope, $routeParams, contextSrv, backendSrv) { - + coreModule.controller('InvitedCtrl', function($scope, $routeParams, contextSrv, backendSrv) { contextSrv.sidemenu = false; - $scope.formModel = {}; $scope.init = function() { diff --git a/public/app/controllers/jsonEditorCtrl.js b/public/app/core/controllers/json_editor_ctrl.js similarity index 68% rename from public/app/controllers/jsonEditorCtrl.js rename to public/app/core/controllers/json_editor_ctrl.js index 60bda8514b7..0bfd5fcfb05 100644 --- a/public/app/controllers/jsonEditorCtrl.js +++ b/public/app/core/controllers/json_editor_ctrl.js @@ -1,13 +1,11 @@ define([ 'angular', - 'lodash' + '../core_module', ], -function (angular) { +function (angular, coreModule) { 'use strict'; - var module = angular.module('grafana.controllers'); - - module.controller('JsonEditorCtrl', function($scope) { + coreModule.controller('JsonEditorCtrl', function($scope) { $scope.json = angular.toJson($scope.object, true); $scope.canUpdate = $scope.updateHandler !== void 0; diff --git a/public/app/controllers/loginCtrl.js b/public/app/core/controllers/login_ctrl.js similarity index 90% rename from public/app/controllers/loginCtrl.js rename to public/app/core/controllers/login_ctrl.js index 0ee370fb979..df58112e871 100644 --- a/public/app/controllers/loginCtrl.js +++ b/public/app/core/controllers/login_ctrl.js @@ -1,13 +1,12 @@ define([ 'angular', - 'config', + '../core_module', + 'app/core/config', ], -function (angular, config) { +function (angular, coreModule, config) { 'use strict'; - var module = angular.module('grafana.controllers'); - - module.controller('LoginCtrl', function($scope, backendSrv, contextSrv, $location) { + coreModule.controller('LoginCtrl', function($scope, backendSrv, contextSrv, $location) { $scope.formModel = { user: '', email: '', @@ -19,6 +18,7 @@ function (angular, config) { $scope.googleAuthEnabled = config.googleAuthEnabled; $scope.githubAuthEnabled = config.githubAuthEnabled; $scope.disableUserSignUp = config.disableUserSignUp; + $scope.loginHint = config.loginHint; $scope.loginMode = true; $scope.submitBtnText = 'Log in'; diff --git a/public/app/controllers/resetPasswordCtrl.js b/public/app/core/controllers/reset_password_ctrl.js similarity index 84% rename from public/app/controllers/resetPasswordCtrl.js rename to public/app/core/controllers/reset_password_ctrl.js index ed693f0d45a..d414b059458 100644 --- a/public/app/controllers/resetPasswordCtrl.js +++ b/public/app/core/controllers/reset_password_ctrl.js @@ -1,13 +1,11 @@ define([ 'angular', + '../core_module', ], -function (angular) { +function (angular, coreModule) { 'use strict'; - var module = angular.module('grafana.controllers'); - - module.controller('ResetPasswordCtrl', function($scope, contextSrv, backendSrv, $location) { - + coreModule.controller('ResetPasswordCtrl', function($scope, contextSrv, backendSrv, $location) { contextSrv.sidemenu = false; $scope.formModel = {}; $scope.mode = 'send'; diff --git a/public/app/controllers/search.js b/public/app/core/controllers/search_ctrl.js similarity index 94% rename from public/app/controllers/search.js rename to public/app/core/controllers/search_ctrl.js index 279b3a1d793..bbf869b9f38 100644 --- a/public/app/controllers/search.js +++ b/public/app/core/controllers/search_ctrl.js @@ -1,14 +1,13 @@ define([ 'angular', 'lodash', - 'config', + '../core_module', + 'app/core/config', ], -function (angular, _, config) { +function (angular, _, coreModule, config) { 'use strict'; - var module = angular.module('grafana.controllers'); - - module.controller('SearchCtrl', function($scope, $location, $timeout, backendSrv) { + coreModule.controller('SearchCtrl', function($scope, $location, $timeout, backendSrv) { $scope.init = function() { $scope.giveSearchFocus = 0; diff --git a/public/app/controllers/sidemenuCtrl.js b/public/app/core/controllers/sidemenu_ctrl.js similarity index 84% rename from public/app/controllers/sidemenuCtrl.js rename to public/app/core/controllers/sidemenu_ctrl.js index b7ba32f0d35..17746b6b9d1 100644 --- a/public/app/controllers/sidemenuCtrl.js +++ b/public/app/core/controllers/sidemenu_ctrl.js @@ -2,33 +2,26 @@ define([ 'angular', 'lodash', 'jquery', - 'config', + '../core_module', + 'app/core/config', ], -function (angular, _, $, config) { +function (angular, _, $, coreModule, config) { 'use strict'; - var module = angular.module('grafana.controllers'); - - module.controller('SideMenuCtrl', function($scope, $location, contextSrv, backendSrv) { + coreModule.controller('SideMenuCtrl', function($scope, $location, contextSrv, backendSrv) { $scope.getUrl = function(url) { return config.appSubUrl + url; }; $scope.setupMainNav = function() { - $scope.mainLinks.push({ - text: "Dashboards", - icon: "fa fa-fw fa-th-large", - href: $scope.getUrl("/"), - }); - - if (contextSrv.hasRole('Admin')) { + _.each(config.bootData.mainNavLinks, function(item) { $scope.mainLinks.push({ - text: "Data Sources", - icon: "fa fa-fw fa-database", - href: $scope.getUrl("/datasources"), + text: item.text, + icon: item.icon, + href: $scope.getUrl(item.href) }); - } + }); }; $scope.loadOrgs = function() { @@ -121,6 +114,7 @@ function (angular, _, $, config) { }; $scope.init = function() { + $scope.showSignout = contextSrv.isSignedIn && !config['authProxyEnabled']; $scope.updateMenu(); $scope.$on('$routeChangeSuccess', $scope.updateMenu); }; diff --git a/public/app/controllers/signupCtrl.ts b/public/app/core/controllers/signup_ctrl.ts similarity index 85% rename from public/app/controllers/signupCtrl.ts rename to public/app/core/controllers/signup_ctrl.ts index d59f1f0eb68..9c18b121612 100644 --- a/public/app/controllers/signupCtrl.ts +++ b/public/app/core/controllers/signup_ctrl.ts @@ -1,9 +1,8 @@ -/// +/// import angular = require('angular'); -import config = require('config'); - -var module = angular.module('grafana.controllers'); +import config = require('app/core/config'); +import coreModule = require('../core_module'); export class SignUpCtrl { @@ -48,5 +47,5 @@ export class SignUpCtrl { }; } -module.controller('SignUpCtrl', SignUpCtrl); +coreModule.controller('SignUpCtrl', SignUpCtrl); diff --git a/public/app/core/core.ts b/public/app/core/core.ts index 98f487b236f..9b726de271a 100644 --- a/public/app/core/core.ts +++ b/public/app/core/core.ts @@ -16,6 +16,11 @@ /// /// +/// +/// +/// +/// + export * from './directives/array_join' export * from './directives/give_focus' export * from './filters/filters' diff --git a/public/app/core/directives/dash_upload.js b/public/app/core/directives/dash_upload.js index 4a42d38eea7..ed4253c71ca 100644 --- a/public/app/core/directives/dash_upload.js +++ b/public/app/core/directives/dash_upload.js @@ -1,8 +1,8 @@ define([ - 'kbn', '../core_module', + 'app/core/utils/kbn', ], -function (kbn, coreModule) { +function (coreModule, kbn) { 'use strict'; coreModule.directive('dashUpload', function(timer, alertSrv, $location) { diff --git a/public/app/core/directives/dropdown_typeahead.js b/public/app/core/directives/dropdown_typeahead.js index c306b9ff8e5..ad484bb18d7 100644 --- a/public/app/core/directives/dropdown_typeahead.js +++ b/public/app/core/directives/dropdown_typeahead.js @@ -45,16 +45,25 @@ function (_, $, coreModule) { } var typeaheadValues = _.reduce($scope.menuItems, function(memo, value, index) { - _.each(value.submenu, function(item, subIndex) { - item.click = 'menuItemSelected(' + index + ',' + subIndex + ')'; - memo.push(value.text + ' ' + item.text); - }); + if (!value.submenu) { + value.click = 'menuItemSelected(' + index + ')'; + memo.push(value.text); + } else { + _.each(value.submenu, function(item, subIndex) { + item.click = 'menuItemSelected(' + index + ',' + subIndex + ')'; + memo.push(value.text + ' ' + item.text); + }); + } return memo; }, []); $scope.menuItemSelected = function(index, subIndex) { - var item = $scope.menuItems[index]; - $scope.dropdownTypeaheadOnSelect({$item: item, $subItem: item.submenu[subIndex]}); + var menuItem = $scope.menuItems[index]; + var payload = {$item: menuItem}; + if (menuItem.submenu && subIndex !== void 0) { + payload.$subItem = menuItem.submenu[subIndex]; + } + $scope.dropdownTypeaheadOnSelect(payload); }; $input.attr('data-provide', 'typeahead'); @@ -65,9 +74,10 @@ function (_, $, coreModule) { updater: function (value) { var result = {}; _.each($scope.menuItems, function(menuItem) { + result.$item = menuItem; + _.each(menuItem.submenu, function(submenuItem) { if (value === (menuItem.text + ' ' + submenuItem.text)) { - result.$item = menuItem; result.$subItem = submenuItem; } }); diff --git a/public/app/core/directives/metric_segment.js b/public/app/core/directives/metric_segment.js index 6fdc171c1f8..bf7f7309b2b 100644 --- a/public/app/core/directives/metric_segment.js +++ b/public/app/core/directives/metric_segment.js @@ -20,13 +20,13 @@ function (_, $, coreModule) { getOptions: "&", onChange: "&", }, - link: function($scope, elem) { var $input = $(inputTemplate); var $button = $(buttonTemplate); var segment = $scope.segment; var options = null; var cancelBlur = null; + var linkMode = true; $input.appendTo(elem); $button.appendTo(elem); @@ -55,19 +55,21 @@ function (_, $, coreModule) { }); }; - $scope.switchToLink = function(now) { - if (now === true || cancelBlur) { - clearTimeout(cancelBlur); - cancelBlur = null; - $input.hide(); - $button.show(); - $scope.updateVariableValue($input.val()); - } - else { - // need to have long delay because the blur - // happens long before the click event on the typeahead options - cancelBlur = setTimeout($scope.switchToLink, 100); - } + $scope.switchToLink = function(fromClick) { + if (linkMode && !fromClick) { return; } + + clearTimeout(cancelBlur); + cancelBlur = null; + linkMode = true; + $input.hide(); + $button.show(); + $scope.updateVariableValue($input.val()); + }; + + $scope.inputBlur = function() { + // happens long before the click event on the typeahead options + // need to have long delay because the blur + cancelBlur = setTimeout($scope.switchToLink, 200); }; $scope.source = function(query, callback) { @@ -139,6 +141,8 @@ function (_, $, coreModule) { $input.show(); $input.focus(); + linkMode = false; + var typeahead = $input.data('typeahead'); if (typeahead) { $input.val(''); @@ -146,7 +150,7 @@ function (_, $, coreModule) { } }); - $input.blur($scope.switchToLink); + $input.blur($scope.inputBlur); $compile(elem.contents())($scope); } @@ -192,6 +196,8 @@ function (_, $, coreModule) { var option = _.findWhere($scope.options, {text: $scope.segment.value}); if (option && option.value !== $scope.property) { $scope.property = option.value; + } else if (attrs.custom !== 'false') { + $scope.property = $scope.segment.value; } } else { $scope.property = $scope.segment.value; diff --git a/public/app/core/directives/misc.js b/public/app/core/directives/misc.js index 5733774c3bd..0fe18f922f7 100644 --- a/public/app/core/directives/misc.js +++ b/public/app/core/directives/misc.js @@ -1,9 +1,9 @@ define([ 'angular', - 'kbn', '../core_module', + 'app/core/utils/kbn', ], -function (angular, kbn, coreModule) { +function (angular, coreModule, kbn) { 'use strict'; coreModule.directive('tip', function($compile) { diff --git a/public/app/core/directives/ng_model_on_blur.js b/public/app/core/directives/ng_model_on_blur.js index 5e32a28eb94..c4a645732c5 100644 --- a/public/app/core/directives/ng_model_on_blur.js +++ b/public/app/core/directives/ng_model_on_blur.js @@ -1,9 +1,9 @@ define([ - 'kbn', - 'app/core/core_module', + '../core_module', + 'app/core/utils/kbn', 'app/core/utils/rangeutil', ], -function (kbn, coreModule, rangeUtil) { +function (coreModule, kbn, rangeUtil) { 'use strict'; coreModule.directive('ngModelOnblur', function() { diff --git a/public/app/core/directives/value_select_dropdown.js b/public/app/core/directives/value_select_dropdown.js index 4f5076abd2f..873174c6fc6 100644 --- a/public/app/core/directives/value_select_dropdown.js +++ b/public/app/core/directives/value_select_dropdown.js @@ -156,7 +156,7 @@ function (angular, _, coreModule) { vm.selectionsChanged = function(commitChange) { vm.selectedValues = _.filter(vm.options, {selected: true}); - if (vm.selectedValues.length > 1 && vm.selectedValues.length !== vm.options.length) { + if (vm.selectedValues.length > 1) { if (vm.selectedValues[0].text === 'All') { vm.selectedValues[0].selected = false; vm.selectedValues = vm.selectedValues.slice(1, vm.selectedValues.length); diff --git a/public/app/components/extend-jquery.js b/public/app/core/jquery_extended.js similarity index 100% rename from public/app/components/extend-jquery.js rename to public/app/core/jquery_extended.js diff --git a/public/app/components/lodash.extended.js b/public/app/core/lodash_extended.js similarity index 100% rename from public/app/components/lodash.extended.js rename to public/app/core/lodash_extended.js diff --git a/public/app/components/partials.js b/public/app/core/partials.js similarity index 100% rename from public/app/components/partials.js rename to public/app/core/partials.js diff --git a/public/app/core/routes/all.js b/public/app/core/routes/all.js index a7e36a0e228..218310382d9 100644 --- a/public/app/core/routes/all.js +++ b/public/app/core/routes/all.js @@ -131,6 +131,19 @@ define([ templateUrl: 'app/partials/reset_password.html', controller : 'ResetPasswordCtrl', }) + .when('/plugins', { + templateUrl: 'app/features/org/partials/plugins.html', + controller: 'PluginsCtrl', + resolve: loadOrgBundle, + }) + .when('/plugins/edit/:type', { + templateUrl: 'app/features/org/partials/pluginEdit.html', + controller: 'PluginEditCtrl', + resolve: loadOrgBundle, + }) + .when('/global-alerts', { + templateUrl: 'app/features/dashboard/partials/globalAlerts.html', + }) .otherwise({ templateUrl: 'app/partials/error.html', controller: 'ErrorCtrl' diff --git a/public/app/services/alertSrv.js b/public/app/core/services/alert_srv.js similarity index 92% rename from public/app/services/alertSrv.js rename to public/app/core/services/alert_srv.js index 3d0f9e66ff2..f3b5329cd60 100644 --- a/public/app/services/alertSrv.js +++ b/public/app/core/services/alert_srv.js @@ -1,13 +1,12 @@ define([ 'angular', - 'lodash' + 'lodash', + '../core_module', ], -function (angular, _) { +function (angular, _, coreModule) { 'use strict'; - var module = angular.module('grafana.services'); - - module.service('alertSrv', function($timeout, $sce, $rootScope, $modal, $q) { + coreModule.service('alertSrv', function($timeout, $sce, $rootScope, $modal, $q) { var self = this; this.init = function() { diff --git a/public/app/core/services/all.js b/public/app/core/services/all.js new file mode 100644 index 00000000000..2d4415a8fa2 --- /dev/null +++ b/public/app/core/services/all.js @@ -0,0 +1,13 @@ +define([ + './alert_srv', + './util_srv', + './datasource_srv', + './context_srv', + './timer', + './keyboard_manager', + './analytics', + './popover_srv', + './segment_srv', + './backend_srv', +], +function () {}); diff --git a/public/app/services/analytics.js b/public/app/core/services/analytics.js similarity index 75% rename from public/app/services/analytics.js rename to public/app/core/services/analytics.js index 4bb7f0c79db..e09ee6c9b77 100644 --- a/public/app/services/analytics.js +++ b/public/app/core/services/analytics.js @@ -1,12 +1,11 @@ define([ 'angular', + '../core_module', ], -function(angular) { +function(angular, coreModule) { 'use strict'; - var module = angular.module('grafana.services'); - module.service('googleAnalyticsSrv', function($rootScope, $location) { - + coreModule.service('googleAnalyticsSrv', function($rootScope, $location) { var first = true; this.init = function() { diff --git a/public/app/services/backendSrv.js b/public/app/core/services/backend_srv.js similarity index 91% rename from public/app/services/backendSrv.js rename to public/app/core/services/backend_srv.js index 819ce9d938e..5d6ce8e0fe4 100644 --- a/public/app/services/backendSrv.js +++ b/public/app/core/services/backend_srv.js @@ -1,14 +1,13 @@ define([ 'angular', 'lodash', - 'config', + '../core_module', + 'app/core/config', ], -function (angular, _, config) { +function (angular, _, coreModule, config) { 'use strict'; - var module = angular.module('grafana.services'); - - module.service('backendSrv', function($http, alertSrv, $timeout) { + coreModule.service('backendSrv', function($http, alertSrv, $timeout) { var self = this; this.get = function(url, params) { @@ -106,6 +105,11 @@ function (angular, _, config) { }); } + // for Prometheus + if (!err.data.message && _.isString(err.data.error)) { + err.data.message = err.data.error; + } + throw err; }); }; diff --git a/public/app/services/contextSrv.js b/public/app/core/services/context_srv.js similarity index 84% rename from public/app/services/contextSrv.js rename to public/app/core/services/context_srv.js index b3f8a1ed164..b06a84fe5c3 100644 --- a/public/app/services/contextSrv.js +++ b/public/app/core/services/context_srv.js @@ -1,20 +1,19 @@ define([ 'angular', 'lodash', - 'store', - 'config', + '../core_module', + 'app/core/store', + 'app/core/config', ], -function (angular, _, store, config) { +function (angular, _, coreModule, store, config) { 'use strict'; - var module = angular.module('grafana.services'); - - module.service('contextSrv', function($rootScope, $timeout) { + coreModule.service('contextSrv', function($rootScope, $timeout) { var self = this; function User() { - if (window.grafanaBootData.user) { - _.extend(this, window.grafanaBootData.user); + if (config.bootData.user) { + _.extend(this, config.bootData.user); } } diff --git a/public/app/services/datasourceSrv.js b/public/app/core/services/datasource_srv.js similarity index 92% rename from public/app/services/datasourceSrv.js rename to public/app/core/services/datasource_srv.js index 644e84e8801..9709bb88cdf 100644 --- a/public/app/services/datasourceSrv.js +++ b/public/app/core/services/datasource_srv.js @@ -1,14 +1,13 @@ define([ 'angular', 'lodash', - 'config', + '../core_module', + 'app/core/config', ], -function (angular, _, config) { +function (angular, _, coreModule, config) { 'use strict'; - var module = angular.module('grafana.services'); - - module.service('datasourceSrv', function($q, $injector, $rootScope) { + coreModule.service('datasourceSrv', function($q, $injector, $rootScope) { var self = this; this.init = function() { diff --git a/public/app/services/keyboardManager.js b/public/app/core/services/keyboard_manager.js similarity index 97% rename from public/app/services/keyboardManager.js rename to public/app/core/services/keyboard_manager.js index f45ddad305b..14b65465281 100644 --- a/public/app/services/keyboardManager.js +++ b/public/app/core/services/keyboard_manager.js @@ -1,15 +1,14 @@ define([ 'angular', - 'lodash' + 'lodash', + '../core_module', ], -function (angular, _) { +function (angular, _, coreModule) { 'use strict'; - var module = angular.module('grafana.services'); - // This service was based on OpenJS library available in BSD License // http://www.openjs.com/scripts/events/keyboard_shortcuts/index.php - module.factory('keyboardManager', ['$window', '$timeout', function ($window, $timeout) { + coreModule.factory('keyboardManager', ['$window', '$timeout', function ($window, $timeout) { var keyboardManagerService = {}; var defaultOpt = { diff --git a/public/app/services/popoverSrv.js b/public/app/core/services/popover_srv.js similarity index 88% rename from public/app/services/popoverSrv.js rename to public/app/core/services/popover_srv.js index cec294178c0..26a935bf283 100644 --- a/public/app/services/popoverSrv.js +++ b/public/app/core/services/popover_srv.js @@ -2,13 +2,12 @@ define([ 'angular', 'lodash', 'jquery', + '../core_module', ], -function (angular, _, $) { +function (angular, _, $, coreModule) { 'use strict'; - var module = angular.module('grafana.services'); - - module.service('popoverSrv', function($templateCache, $timeout, $q, $http, $compile) { + coreModule.service('popoverSrv', function($templateCache, $timeout, $q, $http, $compile) { this.getTemplate = function(url) { return $q.when($templateCache.get(url) || $http.get(url, {cache: true})); diff --git a/public/app/services/uiSegmentSrv.js b/public/app/core/services/segment_srv.js similarity index 76% rename from public/app/services/uiSegmentSrv.js rename to public/app/core/services/segment_srv.js index 2973089b6ba..836437a6dc5 100644 --- a/public/app/services/uiSegmentSrv.js +++ b/public/app/core/services/segment_srv.js @@ -1,13 +1,13 @@ define([ 'angular', 'lodash', + '../core_module', ], -function (angular, _) { +function (angular, _, coreModule) { 'use strict'; - var module = angular.module('grafana.services'); - - module.service('uiSegmentSrv', function($sce, templateSrv) { + coreModule.service('uiSegmentSrv', function($sce, templateSrv) { + var self = this; function MetricSegment(options) { if (options === '*' || options.value === '*') { @@ -75,6 +75,24 @@ function (angular, _) { }); }; + this.transformToSegments = function(addTemplateVars, variableTypeFilter) { + return function(results) { + var segments = _.map(results, function(segment) { + return self.newSegment({ value: segment.text, expandable: segment.expandable }); + }); + + if (addTemplateVars) { + _.each(templateSrv.variables, function(variable) { + if (variableTypeFilter === void 0 || variableTypeFilter === variable.type) { + segments.unshift(self.newSegment({ type: 'template', value: '$' + variable.name, expandable: true })); + } + }); + } + + return segments; + }; + }; + this.newSelectMetric = function() { return new MetricSegment({value: 'select metric', fake: true}); }; diff --git a/public/app/services/timer.js b/public/app/core/services/timer.js similarity index 80% rename from public/app/services/timer.js rename to public/app/core/services/timer.js index 3939fe6b78f..668388a786e 100644 --- a/public/app/services/timer.js +++ b/public/app/core/services/timer.js @@ -1,13 +1,12 @@ define([ 'angular', - 'lodash' + 'lodash', + '../core_module', ], -function (angular, _) { +function (angular, _, coreModule) { 'use strict'; - var module = angular.module('grafana.services'); - - module.service('timer', function($timeout) { + coreModule.service('timer', function($timeout) { // This service really just tracks a list of $timeout promises to give us a // method for cancelling them all when we need to @@ -31,4 +30,4 @@ function (angular, _) { }; }); -}); \ No newline at end of file +}); diff --git a/public/app/services/utilSrv.js b/public/app/core/services/util_srv.js similarity index 78% rename from public/app/services/utilSrv.js rename to public/app/core/services/util_srv.js index b9e703443e4..2418546e5da 100644 --- a/public/app/services/utilSrv.js +++ b/public/app/core/services/util_srv.js @@ -1,12 +1,11 @@ define([ 'angular', + '../core_module', ], -function (angular) { +function (angular, coreModule) { 'use strict'; - var module = angular.module('grafana.services'); - - module.service('utilSrv', function($rootScope, $modal, $q) { + coreModule.service('utilSrv', function($rootScope, $modal, $q) { this.init = function() { $rootScope.onAppEvent('show-modal', this.showModal, $rootScope); diff --git a/public/app/core/settings.js b/public/app/core/settings.js new file mode 100644 index 00000000000..4c0b84f8da5 --- /dev/null +++ b/public/app/core/settings.js @@ -0,0 +1,20 @@ +define([ + 'lodash', +], +function (_) { + "use strict"; + + return function Settings (options) { + var defaults = { + datasources : {}, + window_title_prefix : 'Grafana - ', + panels : {}, + new_panel_title: 'Panel Title', + playlist_timespan: "1m", + unsaved_changes_warning: true, + appSubUrl: "" + }; + + return _.extend({}, defaults, options); + }; +}); diff --git a/public/app/components/store.js b/public/app/core/store.js similarity index 88% rename from public/app/components/store.js rename to public/app/core/store.js index 84e72b96314..504b0e5aff5 100644 --- a/public/app/components/store.js +++ b/public/app/core/store.js @@ -12,7 +12,7 @@ define([], function() { if (def !== void 0 && !this.exists(key)) { return def; } - return window.localStorage[key] === 'true' ? true : false; + return window.localStorage[key] === 'true'; }, exists: function(key) { return window.localStorage[key] !== void 0; diff --git a/public/app/core/table_model.ts b/public/app/core/table_model.ts new file mode 100644 index 00000000000..7eb8d5ad92a --- /dev/null +++ b/public/app/core/table_model.ts @@ -0,0 +1,39 @@ + +class TableModel { + columns: any[]; + rows: any[]; + type: string; + + constructor() { + this.columns = []; + this.rows = []; + this.type = 'table'; + } + + sort(options) { + if (options.col === null || this.columns.length <= options.col) { + return; + } + + this.rows.sort(function(a, b) { + a = a[options.col]; + b = b[options.col]; + if (a < b) { + return -1; + } + if (a > b) { + return 1; + } + return 0; + }); + + this.columns[options.col].sort = true; + + if (options.desc) { + this.rows.reverse(); + this.columns[options.col].desc = true; + } + } +} + +export = TableModel; diff --git a/public/app/components/timeSeries.js b/public/app/core/time_series.ts similarity index 70% rename from public/app/components/timeSeries.js rename to public/app/core/time_series.ts index 74194e68ff9..429e3882e8b 100644 --- a/public/app/components/timeSeries.js +++ b/public/app/core/time_series.ts @@ -1,11 +1,48 @@ -define([ - 'lodash', - 'kbn' -], -function (_, kbn) { - 'use strict'; +/// - function TimeSeries(opts) { +import _ = require('lodash'); +import kbn = require('app/core/utils/kbn'); + +function matchSeriesOverride(aliasOrRegex, seriesAlias) { + if (!aliasOrRegex) { return false; } + + if (aliasOrRegex[0] === '/') { + var regex = kbn.stringToJsRegex(aliasOrRegex); + return seriesAlias.match(regex) != null; + } + + return aliasOrRegex === seriesAlias; +} + +function translateFillOption(fill) { + return fill === 0 ? 0.001 : fill/10; +} + +class TimeSeries { + datapoints: any; + id: string; + label: string; + alias: string; + color: string; + valueFormater: any; + stats: any; + legend: boolean; + allIsNull: boolean; + allIsZero: boolean; + decimals: number; + scaledDecimals: number; + + lines: any; + bars: any; + points: any; + yaxis: any; + zindex: any; + stack: any; + nullPointMode: any; + fillBelowTo: any; + transform: any; + + constructor(opts) { this.datapoints = opts.datapoints; this.label = opts.alias; this.id = opts.alias; @@ -16,27 +53,13 @@ function (_, kbn) { this.legend = true; } - function matchSeriesOverride(aliasOrRegex, seriesAlias) { - if (!aliasOrRegex) { return false; } - - if (aliasOrRegex[0] === '/') { - var regex = kbn.stringToJsRegex(aliasOrRegex); - return seriesAlias.match(regex) != null; - } - - return aliasOrRegex === seriesAlias; - } - - function translateFillOption(fill) { - return fill === 0 ? 0.001 : fill/10; - } - - TimeSeries.prototype.applySeriesOverrides = function(overrides) { + applySeriesOverrides(overrides) { this.lines = {}; this.points = {}; this.bars = {}; this.yaxis = 1; this.zindex = 0; + this.nullPointMode = null; delete this.stack; for (var i = 0; i < overrides.length; i++) { @@ -50,6 +73,7 @@ function (_, kbn) { if (override.fill !== void 0) { this.lines.fill = translateFillOption(override.fill); } if (override.stack !== void 0) { this.stack = override.stack; } if (override.linewidth !== void 0) { this.lines.lineWidth = override.linewidth; } + if (override.nullPointMode !== void 0) { this.nullPointMode = override.nullPointMode; } if (override.pointradius !== void 0) { this.points.radius = override.pointradius; } if (override.steppedLine !== void 0) { this.lines.steps = override.steppedLine; } if (override.zindex !== void 0) { this.zindex = override.zindex; } @@ -64,7 +88,7 @@ function (_, kbn) { } }; - TimeSeries.prototype.getFlotPairs = function (fillStyle) { + getFlotPairs(fillStyle) { var result = []; this.stats.total = 0; @@ -73,11 +97,13 @@ function (_, kbn) { this.stats.avg = null; this.stats.current = null; this.allIsNull = true; + this.allIsZero = true; var ignoreNulls = fillStyle === 'connected'; var nullAsZero = fillStyle === 'null as zero'; var currentTime; var currentValue; + var nonNulls = 0; for (var i = 0; i < this.datapoints.length; i++) { currentValue = this.datapoints[i][0]; @@ -94,6 +120,7 @@ function (_, kbn) { if (_.isNumber(currentValue)) { this.stats.total += currentValue; this.allIsNull = false; + nonNulls++; } if (currentValue > this.stats.max) { @@ -105,6 +132,10 @@ function (_, kbn) { } } + if (currentValue != 0) { + this.allIsZero = false; + } + result.push([currentTime, currentValue]); } @@ -116,26 +147,26 @@ function (_, kbn) { if (this.stats.min === Number.MAX_VALUE) { this.stats.min = null; } if (result.length) { - this.stats.avg = (this.stats.total / result.length); + this.stats.avg = (this.stats.total / nonNulls); this.stats.current = result[result.length-1][1]; if (this.stats.current === null && result.length > 1) { this.stats.current = result[result.length-2][1]; } } + this.stats.count = result.length; return result; - }; + } - TimeSeries.prototype.updateLegendValues = function(formater, decimals, scaledDecimals) { + updateLegendValues(formater, decimals, scaledDecimals) { this.valueFormater = formater; this.decimals = decimals; this.scaledDecimals = scaledDecimals; - }; + } - TimeSeries.prototype.formatValue = function(value) { + formatValue(value) { return this.valueFormater(value, this.decimals, this.scaledDecimals); - }; + } +} - return TimeSeries; - -}); +export = TimeSeries; diff --git a/public/app/core/utils/flatten.ts b/public/app/core/utils/flatten.ts new file mode 100644 index 00000000000..fb4c47d1e3d --- /dev/null +++ b/public/app/core/utils/flatten.ts @@ -0,0 +1,39 @@ +// Copyright (c) 2014, Hugh Kennedy +// Based on code from https://github.com/hughsk/flat/blob/master/index.js +// +function flatten(target, opts): any { + opts = opts || {}; + + var delimiter = opts.delimiter || '.'; + var maxDepth = opts.maxDepth || 3; + var currentDepth = 1; + var output = {}; + + function step(object, prev) { + Object.keys(object).forEach(function(key) { + var value = object[key]; + var isarray = opts.safe && Array.isArray(value); + var type = Object.prototype.toString.call(value); + var isobject = type === "[object Object]"; + + var newKey = prev ? prev + delimiter + key : key; + + if (!opts.maxDepth) { + maxDepth = currentDepth + 1; + } + + if (!isarray && isobject && Object.keys(value).length && currentDepth < maxDepth) { + ++currentDepth; + return step(value, newKey); + } + + output[newKey] = value; + }); + } + + step(target, null); + + return output; +} + +export = flatten; diff --git a/public/app/components/kbn.js b/public/app/core/utils/kbn.js similarity index 85% rename from public/app/components/kbn.js rename to public/app/core/utils/kbn.js index ad2d4c3c422..cc296324eb5 100644 --- a/public/app/components/kbn.js +++ b/public/app/core/utils/kbn.js @@ -192,7 +192,7 @@ function($, _) { kbn.stringToJsRegex = function(str) { if (str[0] !== '/') { - return new RegExp(str); + return new RegExp('^' + str + '$'); } var match = str.match(new RegExp('^/(.*?)/(g?i?m?y?)$')); @@ -310,6 +310,16 @@ function($, _) { }; }; + kbn.formatBuilders.simpleCountUnit = function(symbol) { + var units = ['', 'K', 'M', 'B', 'T']; + var scaler = kbn.formatBuilders.scaledUnits(1000, units); + return function(size, decimals, scaledDecimals) { + if (size === null) { return ""; } + var scaled = scaler(size, decimals, scaledDecimals); + return scaled + " " + symbol; + }; + }; + ///// VALUE FORMATS ///// // Dimensionless Units @@ -331,6 +341,8 @@ function($, _) { // Currencies kbn.valueFormats.currencyUSD = kbn.formatBuilders.currency('$'); kbn.valueFormats.currencyGBP = kbn.formatBuilders.currency('£'); + kbn.valueFormats.currencyEUR = kbn.formatBuilders.currency('€'); + kbn.valueFormats.currencyJPY = kbn.formatBuilders.currency('¥'); // Data kbn.valueFormats.bits = kbn.formatBuilders.binarySIPrefix('b'); @@ -344,6 +356,12 @@ function($, _) { kbn.valueFormats.bps = kbn.formatBuilders.decimalSIPrefix('bps'); kbn.valueFormats.Bps = kbn.formatBuilders.decimalSIPrefix('Bps'); + // Throughput + kbn.valueFormats.ops = kbn.formatBuilders.simpleCountUnit('ops'); + kbn.valueFormats.rps = kbn.formatBuilders.simpleCountUnit('rps'); + kbn.valueFormats.wps = kbn.formatBuilders.simpleCountUnit('wps'); + kbn.valueFormats.iops = kbn.formatBuilders.simpleCountUnit('iops'); + // Energy kbn.valueFormats.watt = kbn.formatBuilders.decimalSIPrefix('W'); kbn.valueFormats.kwatt = kbn.formatBuilders.decimalSIPrefix('W', 1); @@ -381,6 +399,7 @@ function($, _) { // Volume kbn.valueFormats.litre = kbn.formatBuilders.decimalSIPrefix('L'); kbn.valueFormats.mlitre = kbn.formatBuilders.decimalSIPrefix('L', -1); + kbn.valueFormats.m3 = kbn.formatBuilders.decimalSIPrefix('m3'); // Time kbn.valueFormats.hertz = kbn.formatBuilders.decimalSIPrefix('Hz'); @@ -414,7 +433,7 @@ function($, _) { kbn.valueFormats.s = function(size, decimals, scaledDecimals) { if (size === null) { return ""; } - if (Math.abs(size) < 600) { + if (Math.abs(size) < 60) { return kbn.toFixed(size, decimals) + " s"; } // Less than 1 hour, devide in minutes @@ -471,6 +490,57 @@ function($, _) { } }; + kbn.valueFormats.m = function(size, decimals, scaledDecimals) { + if (size === null) { return ""; } + + if (Math.abs(size) < 60) { + return kbn.toFixed(size, decimals) + " min"; + } + else if (Math.abs(size) < 1440) { + return kbn.toFixedScaled(size / 60, decimals, scaledDecimals, 2, " hour"); + } + else if (Math.abs(size) < 10080) { + return kbn.toFixedScaled(size / 1440, decimals, scaledDecimals, 3, " day"); + } + else if (Math.abs(size) < 604800) { + return kbn.toFixedScaled(size / 10080, decimals, scaledDecimals, 4, " week"); + } + else { + return kbn.toFixedScaled(size / 5.25948e5, decimals, scaledDecimals, 5, " year"); + } + }; + + kbn.valueFormats.h = function(size, decimals, scaledDecimals) { + if (size === null) { return ""; } + + if (Math.abs(size) < 24) { + return kbn.toFixed(size, decimals) + " hour"; + } + else if (Math.abs(size) < 168) { + return kbn.toFixedScaled(size / 24, decimals, scaledDecimals, 2, " day"); + } + else if (Math.abs(size) < 8760) { + return kbn.toFixedScaled(size / 168, decimals, scaledDecimals, 3, " week"); + } + else { + return kbn.toFixedScaled(size / 8760, decimals, scaledDecimals, 4, " year"); + } + }; + + kbn.valueFormats.d = function(size, decimals, scaledDecimals) { + if (size === null) { return ""; } + + if (Math.abs(size) < 7) { + return kbn.toFixed(size, decimals) + " day"; + } + else if (Math.abs(size) < 365) { + return kbn.toFixedScaled(size / 7, decimals, scaledDecimals, 2, " week"); + } + else { + return kbn.toFixedScaled(size / 365, decimals, scaledDecimals, 3, " year"); + } + }; + ///// FORMAT MENU ///// kbn.getUnitFormats = function() { @@ -492,6 +562,8 @@ function($, _) { submenu: [ {text: 'Dollars ($)', value: 'currencyUSD'}, {text: 'Pounds (£)', value: 'currencyGBP'}, + {text: 'Euro (€)', value: 'currencyEUR'}, + {text: 'Yen (¥)', value: 'currencyJPY'}, ] }, { @@ -502,6 +574,9 @@ function($, _) { {text: 'microseconds (µs)', value: 'µs' }, {text: 'milliseconds (ms)', value: 'ms' }, {text: 'seconds (s)', value: 's' }, + {text: 'minutes (m)', value: 'm' }, + {text: 'hours (h)', value: 'h' }, + {text: 'days (d)', value: 'd' }, ] }, { @@ -522,6 +597,15 @@ function($, _) { {text: 'bytes/sec', value: 'Bps'}, ] }, + { + text: 'throughput', + submenu: [ + {text: 'ops/sec (ops)', value: 'ops' }, + {text: 'reads/sec (rps)', value: 'rps' }, + {text: 'writes/sec (wps)', value: 'wps' }, + {text: 'I/O ops/sec (iops)', value: 'iops'}, + ] + }, { text: 'length', submenu: [ @@ -543,8 +627,9 @@ function($, _) { { text: 'volume', submenu: [ - {text: 'millilitre', value: 'mlitre'}, - {text: 'litre', value: 'litre' }, + {text: 'millilitre', value: 'mlitre'}, + {text: 'litre', value: 'litre' }, + {text: 'cubic metre', value: 'm3' }, ] }, { @@ -576,7 +661,7 @@ function($, _) { {text: 'Inches of mercury', value: 'pressurehg' }, {text: 'PSI', value: 'pressurepsi' }, ] - }, + } ]; }; diff --git a/public/app/core/utils/rangeutil.ts b/public/app/core/utils/rangeutil.ts index 1e64fcc0061..535dda7833e 100644 --- a/public/app/core/utils/rangeutil.ts +++ b/public/app/core/utils/rangeutil.ts @@ -17,9 +17,9 @@ var spans = { var rangeOptions = [ { from: 'now/d', to: 'now/d', display: 'Today', section: 2 }, - { from: 'now/d', to: 'now', display: 'The day so far', section: 2 }, + { from: 'now/d', to: 'now', display: 'Today so far', section: 2 }, { from: 'now/w', to: 'now/w', display: 'This week', section: 2 }, - { from: 'now/w', to: 'now', display: 'Week to date', section: 2 }, + { from: 'now/w', to: 'now', display: 'This week so far', section: 2 }, { from: 'now/M', to: 'now/M', display: 'This month', section: 2 }, { from: 'now/y', to: 'now/y', display: 'This year', section: 2 }, @@ -34,11 +34,12 @@ var rangeOptions = [ { from: 'now-15m', to: 'now', display: 'Last 15 minutes', section: 3 }, { from: 'now-30m', to: 'now', display: 'Last 30 minutes', section: 3 }, { from: 'now-1h', to: 'now', display: 'Last 1 hour', section: 3 }, + { from: 'now-3h', to: 'now', display: 'Last 3 hours', section: 3 }, { from: 'now-6h', to: 'now', display: 'Last 6 hours', section: 3 }, { from: 'now-12h', to: 'now', display: 'Last 12 hours', section: 3 }, { from: 'now-24h', to: 'now', display: 'Last 24 hours', section: 3 }, - { from: 'now-7d', to: 'now', display: 'Last 7 days', section: 3 }, + { from: 'now-7d', to: 'now', display: 'Last 7 days', section: 0 }, { from: 'now-30d', to: 'now', display: 'Last 30 days', section: 0 }, { from: 'now-60d', to: 'now', display: 'Last 60 days', section: 0 }, { from: 'now-90d', to: 'now', display: 'Last 90 days', section: 0 }, @@ -133,8 +134,12 @@ _.each(rangeOptions, function (frame) { return from.fromNow() + ' to ' + formatDate(range.to); } - var res = describeTextRange(range.from); - return res.display; + if (range.to.toString() === 'now') { + var res = describeTextRange(range.from); + return res.display; + } + + return range.from.toString() + ' to ' + range.to.toString(); } export = { diff --git a/public/app/features/admin/partials/orgs.html b/public/app/features/admin/partials/orgs.html index fe87073eb6c..01d2483c7a7 100644 --- a/public/app/features/admin/partials/orgs.html +++ b/public/app/features/admin/partials/orgs.html @@ -4,32 +4,35 @@ -
    -
    +
    +

    Organizations

    - - - - - - - - - - - +
    IdName
    {{org.name}} - - - Edit - -    - - - -
    + + + + + + + + + + + + + +
    IdName
    {{org.id}}{{org.name}} + + + Edit + +    + + + +
    -
    diff --git a/public/app/features/admin/partials/users.html b/public/app/features/admin/partials/users.html index 6f8365e75dd..c7839b755e0 100644 --- a/public/app/features/admin/partials/users.html +++ b/public/app/features/admin/partials/users.html @@ -5,38 +5,42 @@ -
    -
    +
    +

    Users

    - - - - - - - - - - - - - - - - - +
    IdNameLoginEmailGrafana Admin
    {{user.id}}{{user.name}}{{user.login}}{{user.email}}{{user.isAdmin}} - - - Edit - -    - - - -
    + + + + + + + + + + + + + + + + + + + +
    IdNameLoginEmailGrafana Admin
    {{user.id}}{{user.name}}{{user.login}}{{user.email}}{{user.isAdmin}} + + + Edit + +    + + + +
    diff --git a/public/app/features/annotations/annotationsSrv.js b/public/app/features/annotations/annotationsSrv.js index 89c9b72ec1f..f131ad28393 100644 --- a/public/app/features/annotations/annotationsSrv.js +++ b/public/app/features/annotations/annotationsSrv.js @@ -7,14 +7,14 @@ define([ var module = angular.module('grafana.services'); - module.service('annotationsSrv', function(datasourceSrv, $q, alertSrv, $rootScope) { + module.service('annotationsSrv', function($rootScope, $q, datasourceSrv, alertSrv, timeSrv) { var promiseCached; var list = []; var self = this; this.init = function() { $rootScope.onAppEvent('refresh', this.clearCache, $rootScope); - $rootScope.onAppEvent('setup-dashboard', this.clearCache, $rootScope); + $rootScope.onAppEvent('dashboard-loaded', this.clearCache, $rootScope); }; this.clearCache = function() { @@ -22,7 +22,7 @@ define([ list = []; }; - this.getAnnotations = function(rangeUnparsed, dashboard) { + this.getAnnotations = function(dashboard) { if (dashboard.annotations.list.length === 0) { return $q.when(null); } @@ -34,9 +34,13 @@ define([ self.dashboard = dashboard; var annotations = _.where(dashboard.annotations.list, {enable: true}); + var range = timeSrv.timeRange(); + var rangeRaw = timeSrv.timeRange(false); + var promises = _.map(annotations, function(annotation) { return datasourceSrv.get(annotation.datasource).then(function(datasource) { - return datasource.annotationQuery(annotation, rangeUnparsed) + var query = {range: range, rangeRaw: rangeRaw, annotation: annotation}; + return datasource.annotationQuery(query) .then(self.receiveAnnotationResults) .then(null, errorHandler); }, this); diff --git a/public/app/features/dashboard/dashboardCtrl.js b/public/app/features/dashboard/dashboardCtrl.js index 80b3a101f3f..eb2aa3bad89 100644 --- a/public/app/features/dashboard/dashboardCtrl.js +++ b/public/app/features/dashboard/dashboardCtrl.js @@ -1,10 +1,10 @@ define([ 'angular', 'jquery', - 'config', - 'lodash', + 'app/core/config', + 'moment', ], -function (angular, $, config) { +function (angular, $, config, moment) { "use strict"; var module = angular.module('grafana.controllers'); @@ -150,6 +150,10 @@ function (angular, $, config) { }); }; + $scope.formatDate = function(date) { + return moment(date).format('MMM Do YYYY, h:mm:ss a'); + }; + }); }); diff --git a/public/app/features/dashboard/dashboardLoaderSrv.js b/public/app/features/dashboard/dashboardLoaderSrv.js index 85e6374e0a3..f578a9d1075 100644 --- a/public/app/features/dashboard/dashboardLoaderSrv.js +++ b/public/app/features/dashboard/dashboardLoaderSrv.js @@ -3,7 +3,7 @@ define([ 'moment', 'lodash', 'jquery', - 'kbn', + 'app/core/utils/kbn', 'app/core/utils/datemath', ], function (angular, moment, _, $, kbn, dateMath) { diff --git a/public/app/features/dashboard/dashboardNavCtrl.js b/public/app/features/dashboard/dashboardNavCtrl.js index eef2a8595a7..f367652d0c4 100644 --- a/public/app/features/dashboard/dashboardNavCtrl.js +++ b/public/app/features/dashboard/dashboardNavCtrl.js @@ -1,9 +1,7 @@ define([ 'angular', 'lodash', - 'config', - 'store', - 'filesaver' + 'vendor/filesaver' ], function (angular, _) { 'use strict'; @@ -51,6 +49,21 @@ function (angular, _) { $scope.appEvent('hide-dash-search'); }; + $scope.makeEditable = function() { + $scope.dashboard.editable = true; + + var clone = $scope.dashboard.getSaveModelClone(); + + backendSrv.saveDashboard(clone, {overwrite: false}).then(function(data) { + $scope.dashboard.version = data.version; + $scope.appEvent('dashboard-saved', $scope.dashboard); + $scope.appEvent('alert-success', ['Dashboard saved', 'Saved as ' + clone.title]); + + //force refresh whole page + window.location.href = window.location.href; + }, $scope.handleSaveDashError); + }; + $scope.saveDashboard = function(options) { if ($scope.dashboardMeta.canSave === false) { return; diff --git a/public/app/features/dashboard/dashboardSrv.js b/public/app/features/dashboard/dashboardSrv.js index 21318ac8370..559adff5c54 100644 --- a/public/app/features/dashboard/dashboardSrv.js +++ b/public/app/features/dashboard/dashboardSrv.js @@ -1,11 +1,10 @@ define([ 'angular', 'jquery', - 'kbn', 'lodash', 'moment', ], -function (angular, $, kbn, _, moment) { +function (angular, $, _, moment) { 'use strict'; var module = angular.module('grafana.services'); @@ -27,7 +26,7 @@ function (angular, $, kbn, _, moment) { this.tags = data.tags || []; this.style = data.style || "dark"; this.timezone = data.timezone || 'browser'; - this.editable = data.editable === false ? false : true; + this.editable = data.editable !== false; this.hideControls = data.hideControls || false; this.sharedCrosshair = data.sharedCrosshair || false; this.rows = data.rows || []; @@ -49,10 +48,10 @@ function (angular, $, kbn, _, moment) { p._initMeta = function(meta) { meta = meta || {}; - meta.canShare = meta.canShare === false ? false : true; - meta.canSave = meta.canSave === false ? false : true; - meta.canStar = meta.canStar === false ? false : true; - meta.canEdit = meta.canEdit === false ? false : true; + meta.canShare = meta.canShare !== false; + meta.canSave = meta.canSave !== false; + meta.canStar = meta.canStar !== false; + meta.canEdit = meta.canEdit !== false; if (!this.editable) { meta.canEdit = false; @@ -152,7 +151,6 @@ function (angular, $, kbn, _, moment) { result.panel = panel; result.row = row; result.index = index; - return; } }); }); @@ -216,10 +214,7 @@ function (angular, $, kbn, _, moment) { }; p.formatDate = function(date, format) { - if (!moment.isMoment(date)) { - date = moment(date); - } - + date = moment.isMoment(date) ? date : moment(date); format = format || 'YYYY-MM-DD HH:mm:ss'; return this.timezone === 'browser' ? @@ -227,13 +222,21 @@ function (angular, $, kbn, _, moment) { moment.utc(date).format(format); }; + p.getRelativeTime = function(date) { + date = moment.isMoment(date) ? date : moment(date); + + return this.timezone === 'browser' ? + moment(date).fromNow() : + moment.utc(date).fromNow(); + }; + p._updateSchema = function(old) { var i, j, k; var oldVersion = this.schemaVersion; var panelUpgrades = []; - this.schemaVersion = 7; + this.schemaVersion = 8; - if (oldVersion === 7) { + if (oldVersion === 8) { return; } @@ -344,6 +347,49 @@ function (angular, $, kbn, _, moment) { }); } + if (oldVersion < 8) { + panelUpgrades.push(function(panel) { + _.each(panel.targets, function(target) { + // update old influxdb query schema + if (target.fields && target.tags && target.groupBy) { + if (target.rawQuery) { + delete target.fields; + delete target.fill; + } else { + target.select = _.map(target.fields, function(field) { + var parts = []; + parts.push({type: 'field', params: [field.name]}); + parts.push({type: field.func, params: []}); + if (field.mathExpr) { + parts.push({type: 'math', params: [field.mathExpr]}); + } + if (field.asExpr) { + parts.push({type: 'alias', params: [field.asExpr]}); + } + return parts; + }); + delete target.fields; + _.each(target.groupBy, function(part) { + if (part.type === 'time' && part.interval) { + part.params = [part.interval]; + delete part.interval; + } + if (part.type === 'tag' && part.key) { + part.params = [part.key]; + delete part.key; + } + }); + + if (target.fill) { + target.groupBy.push({type: 'fill', params: [target.fill]}); + delete target.fill; + } + } + } + }); + }); + } + if (panelUpgrades.length === 0) { return; } diff --git a/public/app/features/dashboard/graphiteImportCtrl.js b/public/app/features/dashboard/graphiteImportCtrl.js index 2b6660c2a22..53338883274 100644 --- a/public/app/features/dashboard/graphiteImportCtrl.js +++ b/public/app/features/dashboard/graphiteImportCtrl.js @@ -1,7 +1,7 @@ define([ 'angular', 'lodash', - 'kbn' + 'app/core/utils/kbn' ], function (angular, _, kbn) { 'use strict'; diff --git a/public/app/features/dashboard/keybindings.js b/public/app/features/dashboard/keybindings.js index b417382bc45..2219cab2d4c 100644 --- a/public/app/features/dashboard/keybindings.js +++ b/public/app/features/dashboard/keybindings.js @@ -33,7 +33,7 @@ function(angular, $) { }, { inputDisabled: true }); - keyboardManager.bind('ctrl+f', function() { + keyboardManager.bind('f', function() { scope.appEvent('show-dash-search'); }, { inputDisabled: true }); diff --git a/public/app/features/dashboard/partials/dashboardTopNav.html b/public/app/features/dashboard/partials/dashboardTopNav.html index 49fd6f412ac..c2e4d75cd95 100644 --- a/public/app/features/dashboard/partials/dashboardTopNav.html +++ b/public/app/features/dashboard/partials/dashboardTopNav.html @@ -37,6 +37,7 @@
  • Templating
  • Export
  • View JSON
  • +
  • Make Editable
  • Save As...
  • Delete dashboard
  • diff --git a/public/app/features/dashboard/partials/globalAlerts.html b/public/app/features/dashboard/partials/globalAlerts.html new file mode 100644 index 00000000000..a849f50ffdd --- /dev/null +++ b/public/app/features/dashboard/partials/globalAlerts.html @@ -0,0 +1,282 @@ + + + + +
    +
    +

    Global alerts

    + +
    +
    +
      +
    • Filters:
    • +
    • Alert State
    • +
    • +
    • Dashboards
    • +
    • +
    • + + + +
    • +
    +
    +
    +
    +
      +
    • + +
    • +
    • + +
    • +
    • + +
    • +
    • + 2 selected, showing 6 of 6 total +
    • +
    +
      +
    • + +
      +
      Alert query configure alerting
      +
      +
        +
      • A
      • +
      • apps
      • +
      • +
      • fakesite
      • +
      • counters
      • +
      • requests
      • +
      • count
      • +
      • scaleToSeconds(1)
      • +
      • aliasByNode(2)
      • +
      +
      +
      +
      +
    • +
    • + +
      +
      Alert query configure alerting
      +
      +
        +
      • A
      • +
      • apps
      • +
      • +
      • fakesite
      • +
      • counters
      • +
      • requests
      • +
      • count
      • +
      • scaleToSeconds(1)
      • +
      • aliasByNode(2)
      • +
      +
      +
      +
      +
    • +
    • + +
      +
      Alert query configure alerting
      +
      +
        +
      • A
      • +
      • apps
      • +
      • +
      • fakesite
      • +
      • counters
      • +
      • requests
      • +
      • count
      • +
      • scaleToSeconds(1)
      • +
      • aliasByNode(2)
      • +
      +
      +
      +
      +
    • +
    • + +
      +
      Alert query configure alerting
      +
      +
        +
      • A
      • +
      • apps
      • +
      • +
      • fakesite
      • +
      • counters
      • +
      • requests
      • +
      • count
      • +
      • scaleToSeconds(1)
      • +
      • aliasByNode(2)
      • +
      +
      +
      +
      +
    • +
    • + +
      +
      Alert query configure alerting
      +
      +
        +
      • A
      • +
      • apps
      • +
      • +
      • fakesite
      • +
      • counters
      • +
      • requests
      • +
      • count
      • +
      • scaleToSeconds(1)
      • +
      • aliasByNode(2)
      • +
      +
      +
      +
      +
    • +
    +
    +
    diff --git a/public/app/features/dashboard/partials/graphiteImport.html b/public/app/features/dashboard/partials/graphiteImport.html index 343b5d52e41..9c351346fe6 100644 --- a/public/app/features/dashboard/partials/graphiteImport.html +++ b/public/app/features/dashboard/partials/graphiteImport.html @@ -25,7 +25,7 @@ diff --git a/public/app/features/dashboard/partials/settings.html b/public/app/features/dashboard/partials/settings.html index 543fad9de22..9b0e5674fe0 100644 --- a/public/app/features/dashboard/partials/settings.html +++ b/public/app/features/dashboard/partials/settings.html @@ -5,7 +5,7 @@
    -
    +
    @@ -77,28 +77,30 @@
    Rows settings
    -
    -
      -
    • - Title -
    • -
    • - -
    • -
    • - -
    • -
    • - -
    • -
    • - -
    • -
    • - -
    • -
    -
    +
    +
    +
      +
    • + Title +
    • +
    • + +
    • +
    • + +
    • +
    • + +
    • +
    • + +
    • +
    • + +
    • +
    +
    +
    @@ -112,6 +114,36 @@
    +
    +
    +
    +
    Dashboard info
    +
    +
      +
    • + Last updated at: +
    • +
    • + {{formatDate(dashboardMeta.updated)}} +
    • +
    +
    +
    +
    +
      +
    • + Created at: +
    • +
    • + {{formatDate(dashboardMeta.created)}} +
    • +
    +
    +
    +
    +
    +
    +
    diff --git a/public/app/features/dashboard/partials/shareModal.html b/public/app/features/dashboard/partials/shareModal.html index 75af7ee4c22..a8db481ca91 100644 --- a/public/app/features/dashboard/partials/shareModal.html +++ b/public/app/features/dashboard/partials/shareModal.html @@ -107,7 +107,7 @@ - - - - - - - - - -
    -
    -

    - Drag and drop between the two lists. -

    -
    - -

    Beasts

    - -

    Left column of beasts is not draggable and accepts both beasts and priests

    - -
    - -
    -
    -
      -
    • - {{man}} -
    • -
    -
    -
    -
      -
    • - {{woman}} -
    • -
    -
    -
    - -
    - -

    Priests

    - -
    - -
    -
    -
      -
    • - {{man}} -
    • -
    -
    -
    -
      -
    • - {{woman}} -
    • -
    -
    -
    - -
    - -

    Terrorists

    - -

    Each terrorist list item accepts a new terrorist. Shows inserting into a particular - position in an array.

    - -
    - - -
    -
    -
      -
    • - {{man}} -
    • -
    -
    -
    -
      -
    • - {{woman}} -
    • -
    -
    -
    -
    - - - diff --git a/public/vendor/angular-native-dragdrop/demo/js/app.js b/public/vendor/angular-native-dragdrop/demo/js/app.js deleted file mode 100644 index 7fca20ac0ce..00000000000 --- a/public/vendor/angular-native-dragdrop/demo/js/app.js +++ /dev/null @@ -1,46 +0,0 @@ -angular.module('app', [ - 'hljs', - 'ang-drag-drop' -]).controller('MainCtrl', function($scope) { - $scope.men = [ - 'John', - 'Jack', - 'Mark', - 'Ernie', - 'Mike (Locked)' - ]; - - - $scope.women = [ - 'Jane', - 'Jill', - 'Betty', - 'Mary' - ]; - - $scope.addText = ''; - - $scope.dropValidateHandler = function($drop, $event, $data) { - if ($data === 'Mike (Locked)') { - return false; - } - if ($drop.element[0] === $event.srcElement.parentNode) { - // Don't allow moving to same container - return false; - } - return true; - }; - - $scope.dropSuccessHandler = function($event, index, array) { - array.splice(index, 1); - }; - - $scope.onDrop = function($event, $data, array, index) { - if (index !== undefined) { - array.splice(index, 0, $data); - } else { - array.push($data); - } - }; - -}); diff --git a/public/vendor/angular-native-dragdrop/docs/css/styles.css b/public/vendor/angular-native-dragdrop/docs/css/styles.css deleted file mode 100644 index d4480e8b536..00000000000 --- a/public/vendor/angular-native-dragdrop/docs/css/styles.css +++ /dev/null @@ -1,32 +0,0 @@ -.content { - margin : 50px auto; - font-size: 1.0em; - line-height: 1.5em; -} - -.content a{ - color: #677BA6; - cursor: pointer; -} - -body { - background-color: #f8f7f8; -} - -.jumbotron h1, -.jumbotron p{ - font-family: 'Open Sans'; -} - -.heading{ - border-bottom: 1px solid #b7b7b7; - padding-bottom: 10px; - margin-bottom: 10px; -} - -.ribbon{ - position: fixed; - top : 0; - right : 0; - z-index: 2000; -} \ No newline at end of file diff --git a/public/vendor/angular-native-dragdrop/docs/index.html b/public/vendor/angular-native-dragdrop/docs/index.html deleted file mode 100644 index 25603db4e34..00000000000 --- a/public/vendor/angular-native-dragdrop/docs/index.html +++ /dev/null @@ -1,323 +0,0 @@ - - - - Angular DragDrop - - - - - - - - - - -Fork me on GitHub -
    -
    -

    Angular Drag and Drop

    - -

    Angular-DragDrop is a AngularJS HTML5 Drag and Drop directive written in pure with no dependency on JQuery.

    - - -
    - - -
    -
    -

    Directives

    -
    - -

    ui-draggable

    - -

    - directive in module ngDragDrop -

    - -

    The ui-draggable attribute tells Angular that the element is draggable. ui-draggable - takes an expression as the attribute value. The expression should evaluate to either true or false. - You can toggle the draggability of an element using this expression. -

    - - -

    Additional Attributes

    - -

    drag

    - -

    The drag property is used to assign the data that needs to be passed along with the dragging - element.

    -
    -

    drag-handle-class

    - -

    The class used to mark child elements of draggable object to be used as drag handle. Default class name is - drag-handle.

    -
    - NOTE: If attribute is not present drag handle feature is not active. -
    -
    -

    on-drop-success

    - -

    The on-drop-success attribute takes a function. We can consider this to be an on-drop-success - handler function. - This can be useful if you need to do some post processing after the dragged element is dropped successfully on - the drop site. - -

    - NOTE: This callback function is only called when the drop succeeds. -
    - You can request the drag-end event ( very similiar to requesting the click event in - ng-click ) - by passing $event in the event handler. -

    - -
    -

    on-drop-failure

    - -

    The on-drop-failure attribute takes a function. We can consider this to be an on-drop-failure - handler function. - This can be useful if you need to do some post processing after the dragged element is dropped unsuccessfully on - any drop site. - -

    - NOTE: This callback function is only called when the drop fails. -
    - You can request the drag-end event ( very similiar to requesting the click event in - ng-click ) - by passing $event in the event handler. -

    - - -
    -

    Usage

    - -

    - -

    - ... - -
    -

    - -

    Details

    - -

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    ParamTypeDetails
    ui-draggableExpression that should be - evaluated. The given expression should resolve to true or false. -
    dragTakes any JSON convertable $scope variable.
    drag-handle-classClass name used to mark child elements of draggable object to be used as drag handle.
    If attribute - is not present drag handle feature is not used.
    If attribute is present but have no value - drag-handle used as default.
    on-drop-successTakes any $scope function. Can also pass $event.
    on-drop-failureTakes any $scope function. Can also pass $event.
    drag-channelTakes a string that can be used as the channel name for the dragging operation. - Default channel is "defaultchannel" -
    -

    -
    - -

    Events

    - -

    On start of dragging an Angular Event ANGULAR_DRAG_START is dispatched from the - $rootScope. The event also carries - carries the information about the channel in which the dragging has started. -

    - -

    On end of dragging an Angular Event ANGULAR_DRAG_END is dispatched from the $rootScope. - The event also carries - carries the information about the channel in which the dragging has started. -

    - -

    When hovering a draggable element on top of a drop area an Angular Event ANGULAR_HOVER - is dispatched from the $rootScope. - The event also carries the information about the channel in which the dragging has started. -

    - -
    - -

    ui-on-drop

    - -

    - directive in module ngDragDrop -

    - -

    The ui-on-drop attribute tells Angular that the element is a drop site. ui-on-drop - takes a function as the attribute value. The function will be called when a valid dragged element is dropped in - that location. - A valid dragged element is one which has the same channel as the drop location. - -

    - NOTE : This callback function is only called when the drop succeeds. -
    - The ui-on-drop callback can request additional parameters. The data that is dragged is available to the - callback as $data and its channel as $channel. Apart from this the drop event is exposed as $event. -

    -

    Additional Attributes

    - -

    drop-channel

    - -

    The channel that the drop site accepts. The dragged element should have the same channel as this drop site for it - to be droppable at this location. It is possible to provide comma separated list of channels. - -

    - NOTE: Also special value of drag-channel attribute is available to accept - dragged element with any channel value — * -
    -

    - -
    - -

    drop-validate

    - -

    Extra validation that makes sure that the drop site accepts the dragged element beyond having the same channel. If - not defined, no extra validation is made. - -

    - NOTE: This callback function is called only if the channel condition is met, when the element - starts being dragged -
    -

    - -
    - -

    drag-enter-class

    - -

    The class that will be added to the the droppable element when a dragged element ( which is droppable ) - enters the drop location. The default value for this is on-drag-enter

    - -

    drag-hover-class

    - -

    The class that will be added to the drop area element when hovering with an element. - The default value for this is on-drag-hover

    - -
    -

    Usage

    - -

    - -

    - ... -
    -

    - -

    Details

    - -

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    ParamTypeDetails
    ui-on-dropTakes any $scope function. Can also pass $event, $data and $channel. -
    drop-channelThe channel on which the drop has to listen for drag events.
    - Single value, comma separated list or special value * are possible
    drop-validateTakes any $scope function. Can also pass $data and $channel -
    drag-enter-classA class name that will be put on the droppable element when the dragged objects enters its boundaries. -
    Default class name is on-drag-enter.
    drag-hover-classA class name that will be put on the drop area when an element is dragged onto it.
    Default class - name is on-drag-hover.
    -

    -
    -

    Demo

    - - - -
    -
    - - - - - diff --git a/public/vendor/angular-native-dragdrop/package.json b/public/vendor/angular-native-dragdrop/package.json deleted file mode 100644 index 30aa4f51205..00000000000 --- a/public/vendor/angular-native-dragdrop/package.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "name": "angular-native-dragdrop", - "version": "1.1.1", - "description": "Angular HTML5 Drag and Drop directive written in pure with no dependency on JQuery.", - "main": "draganddrop.js", - "scripts": { - "test": "gulp" - }, - "repository": { - "type": "git", - "url": "https://github.com/angular-dragdrop/angular-dragdrop.git" - }, - "author": "ganarajpr", - "license": "MIT", - "bugs": { - "url": "https://github.com/angular-dragdrop/angular-dragdrop/issues" - }, - "homepage": "http://angular-dragdrop.github.io/angular-dragdrop", - "devDependencies": { - "gulp": "^3.8.11", - "gulp-jshint": "^1.9.2", - "jshint-stylish": "^1.0.1" - } -} diff --git a/public/vendor/flot/jquery.flot.events.js b/public/vendor/flot/jquery.flot.events.js index 48ebf2b67fd..6d8a0cf3c42 100644 --- a/public/vendor/flot/jquery.flot.events.js +++ b/public/vendor/flot/jquery.flot.events.js @@ -50,7 +50,7 @@ height: 10 }; - var _events = [], _types, _eventsEnabled = false, lastRange; + var _events = [], _types, _eventsEnabled = false; plot.getEvents = function(){ return _events; @@ -94,8 +94,6 @@ // check for first run if (_events.length < 1) { - _lastRange = xaxis.max - xaxis.min; - // check for clustering if (options.events.clustering) { var ed = _clusterEvents(options.events.types, options.events.data, xaxis.max - xaxis.min); diff --git a/public/app/panels/text/lib/showdown.js b/public/vendor/showdown.js similarity index 99% rename from public/app/panels/text/lib/showdown.js rename to public/vendor/showdown.js index 9493071ca68..0286b0598f1 100644 --- a/public/app/panels/text/lib/showdown.js +++ b/public/vendor/showdown.js @@ -855,7 +855,7 @@ var _DoLists = function(text) { // Turn double returns into triple returns, so that we can make a // paragraph for the last item in a list, if necessary: - list = list.replace(/\n{2,}/g,"\n\n\n");; + list = list.replace(/\n{2,}/g,"\n\n\n"); var result = _ProcessListItems(list); // Trim any trailing whitespace, to put the closing `` @@ -875,7 +875,7 @@ var _DoLists = function(text) { var list_type = (m3.search(/[*+-]/g)>-1) ? "ul" : "ol"; // Turn double returns into triple returns, so that we can make a // paragraph for the last item in a list, if necessary: - var list = list.replace(/\n{2,}/g,"\n\n\n");; + list = list.replace(/\n{2,}/g,"\n\n\n"); var result = _ProcessListItems(list); result = runup + "<"+list_type+">\n" + result + "\n"; return result; @@ -1451,4 +1451,4 @@ if (typeof define === 'function' && define.amd) { define(function() { return Showdown; }); -} \ No newline at end of file +} diff --git a/public/vendor/ZeroClipboard.js b/public/vendor/zero_clipboard.js similarity index 100% rename from public/vendor/ZeroClipboard.js rename to public/vendor/zero_clipboard.js diff --git a/public/vendor/ZeroClipboard.swf b/public/vendor/zero_clipboard.swf similarity index 100% rename from public/vendor/ZeroClipboard.swf rename to public/vendor/zero_clipboard.swf diff --git a/public/views/index.html b/public/views/index.html index d19e244fc99..b1bffae89ee 100644 --- a/public/views/index.html +++ b/public/views/index.html @@ -9,17 +9,25 @@ Grafana [[if .User.LightTheme]] - + + [[ range $css := .PluginCss ]] + + [[ end ]] [[else]] - + + [[ range $css := .PluginCss ]] + + [[ end ]] [[end]] - + + + - + - + @@ -50,10 +58,12 @@ window.grafanaBootData = { user:[[.User]], settings: [[.Settings]], + pluginModules: [[.PluginJs]], + mainNavLinks: [[.MainNavLinks]] }; require(['app/app'], function (app) { - app.boot(); + app.boot(); }) diff --git a/tasks/build_task.js b/tasks/build_task.js index 7773299a06d..54562dfbde1 100644 --- a/tasks/build_task.js +++ b/tasks/build_task.js @@ -13,7 +13,7 @@ module.exports = function(grunt) { 'karma:test', 'phantomjs', 'css', - 'htmlmin:build', + // 'htmlmin:build', 'ngtemplates', 'cssmin:build', 'ngAnnotate:build', @@ -34,8 +34,8 @@ module.exports = function(grunt) { for(var key in summary){ if(summary.hasOwnProperty(key)){ - var orig = key.replace(root, root+'/[[.AppSubUrl]]'); - var revved = summary[key].replace(root, root+'/[[.AppSubUrl]]'); + var orig = key.replace(root, root+'/[[.AppSubUrl]]/public'); + var revved = summary[key].replace(root, root+'/[[.AppSubUrl]]/public'); fixed[orig] = revved; } } diff --git a/tasks/options/clean.js b/tasks/options/clean.js index 49f09f10e7c..331864082dc 100644 --- a/tasks/options/clean.js +++ b/tasks/options/clean.js @@ -4,6 +4,7 @@ module.exports = function(config) { return { release: ['<%= destDir %>', '<%= tempDir %>', '<%= genDir %>'], gen: ['<%= genDir %>'], - temp: ['<%= tempDir %>'] + temp: ['<%= tempDir %>'], + css: ['<%= genDir %>/css'] }; }; diff --git a/tasks/options/concat.js b/tasks/options/concat.js index c15aa8a2d6e..4e6927b306a 100644 --- a/tasks/options/concat.js +++ b/tasks/options/concat.js @@ -27,7 +27,7 @@ module.exports = function(config) { js: { src: [ '<%= tempDir %>/vendor/requirejs/require.js', - '<%= tempDir %>/app/components/require.config.js', + '<%= tempDir %>/app/require_config.js', '<%= tempDir %>/app/app.js', ], dest: '<%= genDir %>/app/app.js' diff --git a/tasks/options/htmlmin.js b/tasks/options/htmlmin.js index 2fa6a769a09..af8677452e7 100644 --- a/tasks/options/htmlmin.js +++ b/tasks/options/htmlmin.js @@ -8,9 +8,7 @@ module.exports = function(config) { expand: true, cwd: '<%= genDir %>', src: [ - //'index.html', - 'app/panels/**/*.html', - 'app/partials/**/*.html' + 'app/**/*.html', ], dest: '<%= genDir %>' } diff --git a/tasks/options/jscs.js b/tasks/options/jscs.js index 7a5dee05778..c27c1aff09d 100644 --- a/tasks/options/jscs.js +++ b/tasks/options/jscs.js @@ -4,7 +4,6 @@ module.exports = function(config) { 'Gruntfile.js', '<%= srcDir %>/app/**/*.js', '<%= srcDir %>/plugins/**/*.js', - '!<%= srcDir %>/app/panels/*/{lib,leaflet}/*', '!<%= srcDir %>/app/dashboards/*' ], options: { @@ -20,4 +19,4 @@ module.exports = function(config) { "disallowRightStickedOperators": ["?", "+", "/", "*", ":", "=", "==", "===", "!=", "!==", ">", ">=", "<", "<="], "requireRightStickedOperators": ["!"], "requireLeftStickedOperators": [","], - */ \ No newline at end of file + */ diff --git a/tasks/options/jshint.js b/tasks/options/jshint.js index 60c212e785d..8e4969c37c0 100644 --- a/tasks/options/jshint.js +++ b/tasks/options/jshint.js @@ -18,9 +18,8 @@ module.exports = function(config) { 'dist/*', 'sample/*', '<%= srcDir %>/vendor/*', - '<%= srcDir %>/app/panels/*/{lib,leaflet}/*', '<%= srcDir %>/app/dashboards/*' ] } }; -}; \ No newline at end of file +}; diff --git a/tasks/options/ngtemplates.js b/tasks/options/ngtemplates.js index 10c39a49c39..cf965e0162d 100644 --- a/tasks/options/ngtemplates.js +++ b/tasks/options/ngtemplates.js @@ -3,11 +3,11 @@ module.exports = function(config) { grafana: { cwd: '<%= genDir %>', src: ['app/**/*.html'], - dest: '<%= genDir %>/app/components/partials.js', + dest: '<%= genDir %>/app/core/partials.js', options: { bootstrap: function(module, script) { - return "define('app/components/partials', ['angular'], function(angular) { \n" + - "angular.module('grafana').run(['$templateCache', function($templateCache) { \n" + + return "define('app/core/partials', ['app/core/core_module'], function(coreModule) { \n" + + "coreModule.run(['$templateCache', function($templateCache) { \n" + script + '\n}]);' + '\n});'; diff --git a/tasks/options/phantomjs.js b/tasks/options/phantomjs.js index 7eac7cb36ac..300688f5ba2 100644 --- a/tasks/options/phantomjs.js +++ b/tasks/options/phantomjs.js @@ -6,6 +6,11 @@ module.exports = function(config,grunt) { var dest = './vendor/phantomjs/phantomjs'; var confDir = './node_modules/karma-phantomjs-launcher/node_modules/phantomjs/lib/' + if (!grunt.file.exists(confDir)) { + // npm 3 or npm 2 with dedupe + confDir = './node_modules/phantomjs/lib/'; + } + if (!grunt.file.exists(dest)){ var m=grunt.file.read(confDir+"location.js") diff --git a/tasks/options/requirejs.js b/tasks/options/requirejs.js index a1636af98e5..fd6603e16f4 100644 --- a/tasks/options/requirejs.js +++ b/tasks/options/requirejs.js @@ -6,7 +6,7 @@ module.exports = function(config,grunt) { var options = { appDir: '<%= genDir %>', dir: '<%= tempDir %>', - mainConfigFile: '<%= genDir %>/app/components/require.config.js', + mainConfigFile: '<%= genDir %>/app/require_config.js', baseUrl: './', waitSeconds: 0, @@ -41,38 +41,32 @@ module.exports = function(config,grunt) { // main/common module name: 'app/app', include: [ - 'kbn', 'text', 'jquery', - 'angular', - 'settings', 'bootstrap', 'modernizr', 'timepicker', 'datepicker', - 'lodash', 'jquery.flot', 'angular-strap', 'angular-dragdrop', 'app/core/core', - 'app/services/all', 'app/features/all', - 'app/controllers/all', - 'app/components/partials', // bundle the datasources 'app/plugins/datasource/grafana/datasource', 'app/plugins/datasource/graphite/datasource', + 'app/plugins/datasource/elasticsearch/datasource', 'app/plugins/datasource/influxdb/datasource', ] }, ]; var fs = require('fs'); - var panelPath = config.srcDir + '/app/panels'; + var panelPath = config.srcDir + '/app/plugins/panels'; // create a module for each directory in public/app/panels/ fs.readdirSync(panelPath).forEach(function (panelName) { - requireModules[0].include.push('app/panels/'+panelName+'/module'); + requireModules[0].include.push('app/plugins/panels/'+panelName+'/module'); }); return { options: options }; diff --git a/tasks/options/watch.js b/tasks/options/watch.js index 0341b444c95..2be128a3112 100644 --- a/tasks/options/watch.js +++ b/tasks/options/watch.js @@ -1,39 +1,48 @@ -module.exports = function(config) { +module.exports = function(config, grunt) { 'use strict'; - return { - // css: { - // files: [ '<%= srcDir %>/less#<{(||)}>#*.less' ], - // tasks: ['css'], - // options: { - // spawn: false - // } - // }, + grunt.event.on('watch', function(action, filepath) { + var newPath; + grunt.log.writeln('File Changed: ' + filepath); + + if (/(\.html)$/.test(filepath)) { + newPath = filepath.replace(/^public/, 'public_gen'); + grunt.log.writeln('Copying to ' + newPath); + grunt.file.copy(filepath, newPath); + } + + if (/(\.js)$/.test(filepath)) { + newPath = filepath.replace(/^public/, 'public_gen'); + grunt.log.writeln('Copying to ' + newPath); + grunt.file.copy(filepath, newPath); + + grunt.task.run('jshint'); + grunt.task.run('jscs'); + } + + if (/(\.less)$/.test(filepath)) { + grunt.task.run('clean:css'); + grunt.task.run('css'); + } + + if (/(\.ts)$/.test(filepath)) { + //changes changed file source to that of the changed file + var option = 'typescript.build.src'; + var result = filepath; + grunt.config(option, result); + grunt.task.run('typescript:build'); + grunt.task.run('tslint'); + } + }); + + return { copy_to_gen: { files: ['<%= srcDir %>/**/*'], - tasks: [ - 'clean:gen', - 'copy:public_to_gen', - 'css', - 'typescript:build', - 'jshint', - 'jscs', - 'tslint', - 'karma:test' - ], + tasks: [], options: { spawn: false } }, - - // typescript: { - // files: ['<%= srcDir %>/app#<{(||)}>#*.ts', '<%= srcDir %>/test#<{(||)}>#*.ts'], - // tasks: ['tslint', 'typescript:build'], - // options: { - // spawn: false - // } - // } - }; }; diff --git a/vendor/phantomjs/render.js b/vendor/phantomjs/render.js index 33fda200cba..057d464a74c 100644 --- a/vendor/phantomjs/render.js +++ b/vendor/phantomjs/render.js @@ -36,7 +36,8 @@ page.open(params.url, function (status) { var canvas = page.evaluate(function() { var body = angular.element(document.body); // 1 var rootScope = body.scope().$root; - return rootScope.performance.panelsRendered > 0; + var panelsToLoad = angular.element('div.panel').length; + return rootScope.performance.panelsRendered >= panelsToLoad; }); if (canvas || tries === 1000) {