packer-cn/vendor/github.com/jmespath/go-jmespath
Adrien Delorme 0fa60c68fb
Drop the iso_checksum_type & iso_checksum_url fields (#8437)
* Drop the iso_checksum_type & iso_checksum_url fields

In favor of simply using iso_checksum that will know what to do.

* fix after master merge

* Update builder_test.go

* Update builder_test.go

* Update builder_test.go

* Update builder_test.go

* Update builder_test.go

* remove checksum lowercasing tests

* Update builder_test.go

* Update builder_test.go

* better docs

* Update builder_test.go

* even better docs

* Update config.go

* Update builder_test.go

* Update step_create_vmx_test.go

* make generate

* better docs

* fix imports

* up tests

* Update _ISOConfig-required.html.md

* Update builder_test.go

* don't use sha1.Sum("none") as a caching path

* Update builder_test.go

* better docs

* Update iso_config_test.go

remove ISOChecksumType/ISOChecksumURL references

* Update step_download_test.go

* add iso_checksum_url and iso_checksum_type fixers + tests

* add concrete examples of checksum values

* add examples of checksumming from local file

* update go-getter dep

* up deps

* use new go-getter version

* up ESX5Driver.VerifyChecksum: use go-getter's checksumming

* ISOConfig.Prepare: get checksum there in case we need it as a string in ESX5Driver.VerifyChecksum

* Update iso_config.go

* get go-getter from v2 branch

* Update driver_esx5.go

add more comments

* Update driver_esx5.go

* show better error message when the checksum is invalid

* Update builder_test.go

put in a valid checksum to fix tests, checksum is md5("packer")

* Update builder_test.go

test invalid and valid checksum

* more test updating

* fix default md5 string to be a valid md5

* TestChecksumFileNameMixedCaseBug: use 'file:' prefix for file checksumming

* Update iso_config_test.go

* Update iso_config_test.go

* Update builder_test.go

* Update builder_test.go

* Update builder_test.go

* Update CHANGELOG.md

* Update CHANGELOG.md

* Update go.mod

* Update go.mod

* Update CHANGELOG.md
2020-05-28 11:02:09 +02:00
..
.gitignore GO111MODULE=on go mod vendor && git add vendor/github.com/aws && git add github.com/jmespath/go-jmespath 2019-01-18 12:48:57 +01:00
.travis.yml Drop the iso_checksum_type & iso_checksum_url fields (#8437) 2020-05-28 11:02:09 +02:00
LICENSE Revert "Remove a bunch of unused dependencies (godep v54+ required)" 2016-02-22 11:44:12 -08:00
Makefile GO111MODULE=on go mod vendor && git add vendor/github.com/aws && git add github.com/jmespath/go-jmespath 2019-01-18 12:48:57 +01:00
README.md Drop the iso_checksum_type & iso_checksum_url fields (#8437) 2020-05-28 11:02:09 +02:00
api.go Drop the iso_checksum_type & iso_checksum_url fields (#8437) 2020-05-28 11:02:09 +02:00
astnodetype_string.go Revert "Remove a bunch of unused dependencies (godep v54+ required)" 2016-02-22 11:44:12 -08:00
functions.go GO111MODULE=on go mod vendor && git add vendor/github.com/aws && git add github.com/jmespath/go-jmespath 2019-01-18 12:48:57 +01:00
go.mod Drop the iso_checksum_type & iso_checksum_url fields (#8437) 2020-05-28 11:02:09 +02:00
go.sum Drop the iso_checksum_type & iso_checksum_url fields (#8437) 2020-05-28 11:02:09 +02:00
interpreter.go Revert "Remove a bunch of unused dependencies (godep v54+ required)" 2016-02-22 11:44:12 -08:00
lexer.go Revert "Remove a bunch of unused dependencies (godep v54+ required)" 2016-02-22 11:44:12 -08:00
parser.go Drop the iso_checksum_type & iso_checksum_url fields (#8437) 2020-05-28 11:02:09 +02:00
toktype_string.go Revert "Remove a bunch of unused dependencies (godep v54+ required)" 2016-02-22 11:44:12 -08:00
util.go Revert "Remove a bunch of unused dependencies (godep v54+ required)" 2016-02-22 11:44:12 -08:00

README.md

go-jmespath - A JMESPath implementation in Go

Build Status

go-jmespath is a GO implementation of JMESPath, which is a query language for JSON. It will take a JSON document and transform it into another JSON document through a JMESPath expression.

Using go-jmespath is really easy. There's a single function you use, jmespath.search:

> import "github.com/jmespath/go-jmespath"
>
> var jsondata = []byte(`{"foo": {"bar": {"baz": [0, 1, 2, 3, 4]}}}`) // your data
> var data interface{}
> err := json.Unmarshal(jsondata, &data)
> result, err := jmespath.Search("foo.bar.baz[2]", data)
result = 2

In the example we gave the search function input data of {"foo": {"bar": {"baz": [0, 1, 2, 3, 4]}}} as well as the JMESPath expression foo.bar.baz[2], and the search function evaluated the expression against the input data to produce the result 2.

The JMESPath language can do a lot more than select an element from a list. Here are a few more examples:

> var jsondata = []byte(`{"foo": {"bar": {"baz": [0, 1, 2, 3, 4]}}}`) // your data
> var data interface{}
> err := json.Unmarshal(jsondata, &data)
> result, err := jmespath.search("foo.bar", data)
result = { "baz": [ 0, 1, 2, 3, 4 ] }


> var jsondata  = []byte(`{"foo": [{"first": "a", "last": "b"},
                           {"first": "c", "last": "d"}]}`) // your data
> var data interface{}
> err := json.Unmarshal(jsondata, &data)
> result, err := jmespath.search({"foo[*].first", data)
result [ 'a', 'c' ]


> var jsondata = []byte(`{"foo": [{"age": 20}, {"age": 25},
                           {"age": 30}, {"age": 35},
                           {"age": 40}]}`) // your data
> var data interface{}
> err := json.Unmarshal(jsondata, &data)
> result, err := jmespath.search("foo[?age > `30`]")
result = [ { age: 35 }, { age: 40 } ]

You can also pre-compile your query. This is usefull if you are going to run multiple searches with it:

	> var jsondata = []byte(`{"foo": "bar"}`)
	> var data interface{}
    > err := json.Unmarshal(jsondata, &data)
	> precompiled, err := Compile("foo")
	> if err != nil{
    >   // ... handle the error
    > }
    > result, err := precompiled.Search(data)
	result = "bar"

More Resources

The example above only show a small amount of what a JMESPath expression can do. If you want to take a tour of the language, the best place to go is the JMESPath Tutorial.

One of the best things about JMESPath is that it is implemented in many different programming languages including python, ruby, php, lua, etc. To see a complete list of libraries, check out the JMESPath libraries page.

And finally, the full JMESPath specification can be found on the JMESPath site.