├── .dockerignore ├── .gitignore ├── CONTRIBUTING.md ├── DCO ├── Dockerfile ├── Documentation ├── delete-example.md ├── deletion-order.md ├── filter-example.md ├── kubernetes-cronjob.md ├── parse-example.md ├── tag-example.md └── usage-notes-and-tips.md ├── Jenkinsfile ├── LICENSE ├── MAINTAINERS ├── Makefile ├── NOTICE ├── README.md ├── arn ├── arn.go └── arn_test.go ├── cmd └── grafiti │ ├── delete.go │ ├── filter.go │ ├── filter_test.go │ ├── main.go │ ├── parse.go │ ├── parse_test.go │ ├── tag.go │ └── tag_test.go ├── code-of-conduct.md ├── config.toml ├── cronjob.yaml ├── deleter ├── autoscaling.go ├── autoscaling_test.go ├── deleter.go ├── ec2.go ├── elb.go ├── iam.go ├── retryer │ └── retryer.go ├── route53.go └── s3.go ├── design-principles.md ├── example-tags-input.json ├── glide.lock ├── glide.yaml ├── graph ├── graph.go └── graph_test.go ├── jenkins-jobs ├── grafiti_multibranch_job.groovy └── grafiti_pr_trigger.groovy ├── roadmap.md ├── scripts ├── docker-build ├── docker-test └── git-version ├── testdata ├── config │ ├── empty-test-config.toml │ └── test-config.toml ├── filter │ ├── input-filter.json │ ├── input-ignore-tags.json │ └── output-filter.json ├── parse │ ├── cloudtrail-api-input.json │ ├── cloudtrail-logfile-input-error.json │ ├── cloudtrail-logfile-input.json │ ├── parsed-api-output-tagged.json │ ├── parsed-api-output.json │ ├── parsed-logfile-output-tagged.json │ └── parsed-logfile-output.json └── tag │ ├── test-data-input-no-tags.json │ └── test-data-input.json └── vendor ├── github.com ├── aws │ └── aws-sdk-go │ │ ├── LICENSE.txt │ │ ├── NOTICE.txt │ │ ├── aws │ │ ├── awserr │ │ │ ├── error.go │ │ │ └── types.go │ │ ├── awsutil │ │ │ ├── copy.go │ │ │ ├── equal.go │ │ │ ├── path_value.go │ │ │ ├── prettify.go │ │ │ └── string_value.go │ │ ├── client │ │ │ ├── client.go │ │ │ ├── default_retryer.go │ │ │ ├── logger.go │ │ │ └── metadata │ │ │ │ └── client_info.go │ │ ├── config.go │ │ ├── context.go │ │ ├── context_1_6.go │ │ ├── context_1_7.go │ │ ├── convert_types.go │ │ ├── corehandlers │ │ │ ├── handlers.go │ │ │ └── param_validator.go │ │ ├── credentials │ │ │ ├── chain_provider.go │ │ │ ├── credentials.go │ │ │ ├── ec2rolecreds │ │ │ │ └── ec2_role_provider.go │ │ │ ├── endpointcreds │ │ │ │ └── provider.go │ │ │ ├── env_provider.go │ │ │ ├── shared_credentials_provider.go │ │ │ ├── static_provider.go │ │ │ └── stscreds │ │ │ │ └── assume_role_provider.go │ │ ├── defaults │ │ │ ├── defaults.go │ │ │ └── shared_config.go │ │ ├── doc.go │ │ ├── ec2metadata │ │ │ ├── api.go │ │ │ └── service.go │ │ ├── endpoints │ │ │ ├── decode.go │ │ │ ├── defaults.go │ │ │ ├── doc.go │ │ │ ├── endpoints.go │ │ │ ├── v3model.go │ │ │ └── v3model_codegen.go │ │ ├── errors.go │ │ ├── jsonvalue.go │ │ ├── logger.go │ │ ├── request │ │ │ ├── connection_reset_error.go │ │ │ ├── connection_reset_error_other.go │ │ │ ├── handlers.go │ │ │ ├── http_request.go │ │ │ ├── offset_reader.go │ │ │ ├── request.go │ │ │ ├── request_1_7.go │ │ │ ├── request_1_8.go │ │ │ ├── request_context.go │ │ │ ├── request_context_1_6.go │ │ │ ├── request_pagination.go │ │ │ ├── retryer.go │ │ │ ├── timeout_read_closer.go │ │ │ ├── validation.go │ │ │ └── waiter.go │ │ ├── session │ │ │ ├── doc.go │ │ │ ├── env_config.go │ │ │ ├── session.go │ │ │ └── shared_config.go │ │ ├── signer │ │ │ └── v4 │ │ │ │ ├── header_rules.go │ │ │ │ ├── options.go │ │ │ │ ├── uri_path.go │ │ │ │ └── v4.go │ │ ├── types.go │ │ ├── url.go │ │ ├── url_1_7.go │ │ └── version.go │ │ ├── doc.go │ │ ├── internal │ │ └── shareddefaults │ │ │ └── shared_config.go │ │ ├── private │ │ └── protocol │ │ │ ├── ec2query │ │ │ ├── build.go │ │ │ └── unmarshal.go │ │ │ ├── idempotency.go │ │ │ ├── json │ │ │ └── jsonutil │ │ │ │ ├── build.go │ │ │ │ └── unmarshal.go │ │ │ ├── jsonrpc │ │ │ └── jsonrpc.go │ │ │ ├── query │ │ │ ├── build.go │ │ │ ├── queryutil │ │ │ │ └── queryutil.go │ │ │ ├── unmarshal.go │ │ │ └── unmarshal_error.go │ │ │ ├── rest │ │ │ ├── build.go │ │ │ ├── payload.go │ │ │ └── unmarshal.go │ │ │ ├── restxml │ │ │ └── restxml.go │ │ │ ├── unmarshal.go │ │ │ └── xml │ │ │ └── xmlutil │ │ │ ├── build.go │ │ │ ├── unmarshal.go │ │ │ └── xml_to_struct.go │ │ └── service │ │ ├── autoscaling │ │ ├── api.go │ │ ├── autoscalingiface │ │ │ └── interface.go │ │ ├── doc.go │ │ ├── errors.go │ │ ├── service.go │ │ └── waiters.go │ │ ├── cloudtrail │ │ ├── api.go │ │ ├── cloudtrailiface │ │ │ └── interface.go │ │ ├── doc.go │ │ ├── errors.go │ │ └── service.go │ │ ├── ec2 │ │ ├── api.go │ │ ├── customizations.go │ │ ├── doc.go │ │ ├── ec2iface │ │ │ └── interface.go │ │ ├── errors.go │ │ ├── service.go │ │ └── waiters.go │ │ ├── elb │ │ ├── api.go │ │ ├── doc.go │ │ ├── elbiface │ │ │ └── interface.go │ │ ├── errors.go │ │ ├── service.go │ │ └── waiters.go │ │ ├── iam │ │ ├── api.go │ │ ├── doc.go │ │ ├── errors.go │ │ ├── iamiface │ │ │ └── interface.go │ │ ├── service.go │ │ └── waiters.go │ │ ├── resourcegroupstaggingapi │ │ ├── api.go │ │ ├── doc.go │ │ ├── errors.go │ │ ├── resourcegroupstaggingapiiface │ │ │ └── interface.go │ │ └── service.go │ │ ├── route53 │ │ ├── api.go │ │ ├── customizations.go │ │ ├── doc.go │ │ ├── errors.go │ │ ├── route53iface │ │ │ └── interface.go │ │ ├── service.go │ │ ├── unmarshal_error.go │ │ └── waiters.go │ │ ├── s3 │ │ ├── api.go │ │ ├── bucket_location.go │ │ ├── content_md5.go │ │ ├── customizations.go │ │ ├── doc.go │ │ ├── doc_custom.go │ │ ├── errors.go │ │ ├── host_style_bucket.go │ │ ├── platform_handlers.go │ │ ├── platform_handlers_go1.6.go │ │ ├── s3iface │ │ │ └── interface.go │ │ ├── service.go │ │ ├── sse.go │ │ ├── statusok_error.go │ │ ├── unmarshal_error.go │ │ └── waiters.go │ │ └── sts │ │ ├── api.go │ │ ├── customizations.go │ │ ├── doc.go │ │ ├── errors.go │ │ └── service.go ├── estroz │ └── jqpipe-go │ │ ├── LICENSE │ │ └── jqpipe.go ├── fsnotify │ └── fsnotify │ │ ├── LICENSE │ │ ├── fen.go │ │ ├── fsnotify.go │ │ ├── inotify.go │ │ ├── inotify_poller.go │ │ ├── kqueue.go │ │ ├── open_mode_bsd.go │ │ ├── open_mode_darwin.go │ │ └── windows.go ├── go-ini │ └── ini │ │ ├── LICENSE │ │ ├── error.go │ │ ├── ini.go │ │ ├── key.go │ │ ├── parser.go │ │ ├── section.go │ │ └── struct.go ├── hashicorp │ └── hcl │ │ ├── LICENSE │ │ ├── decoder.go │ │ ├── hcl.go │ │ ├── hcl │ │ ├── ast │ │ │ ├── ast.go │ │ │ └── walk.go │ │ ├── parser │ │ │ ├── error.go │ │ │ └── parser.go │ │ ├── scanner │ │ │ └── scanner.go │ │ ├── strconv │ │ │ └── quote.go │ │ └── token │ │ │ ├── position.go │ │ │ └── token.go │ │ ├── json │ │ ├── parser │ │ │ ├── flatten.go │ │ │ └── parser.go │ │ ├── scanner │ │ │ └── scanner.go │ │ └── token │ │ │ ├── position.go │ │ │ └── token.go │ │ ├── lex.go │ │ └── parse.go ├── inconshreveable │ └── mousetrap │ │ ├── LICENSE │ │ ├── trap_others.go │ │ ├── trap_windows.go │ │ └── trap_windows_1.4.go ├── jmespath │ └── go-jmespath │ │ ├── LICENSE │ │ ├── api.go │ │ ├── astnodetype_string.go │ │ ├── functions.go │ │ ├── interpreter.go │ │ ├── lexer.go │ │ ├── parser.go │ │ ├── toktype_string.go │ │ └── util.go ├── magiconair │ └── properties │ │ ├── LICENSE │ │ ├── decode.go │ │ ├── doc.go │ │ ├── integrate.go │ │ ├── lex.go │ │ ├── load.go │ │ ├── parser.go │ │ ├── properties.go │ │ └── rangecheck.go ├── mitchellh │ └── mapstructure │ │ ├── LICENSE │ │ ├── decode_hooks.go │ │ ├── error.go │ │ └── mapstructure.go ├── pelletier │ └── go-toml │ │ ├── LICENSE │ │ ├── doc.go │ │ ├── keysparsing.go │ │ ├── lexer.go │ │ ├── marshal.go │ │ ├── parser.go │ │ ├── position.go │ │ ├── token.go │ │ ├── toml.go │ │ ├── tomltree_create.go │ │ └── tomltree_write.go ├── sirupsen │ └── logrus │ │ ├── LICENSE │ │ ├── alt_exit.go │ │ ├── doc.go │ │ ├── entry.go │ │ ├── exported.go │ │ ├── formatter.go │ │ ├── hooks.go │ │ ├── json_formatter.go │ │ ├── logger.go │ │ ├── logrus.go │ │ ├── terminal_appengine.go │ │ ├── terminal_bsd.go │ │ ├── terminal_linux.go │ │ ├── terminal_notwindows.go │ │ ├── terminal_solaris.go │ │ ├── terminal_windows.go │ │ ├── text_formatter.go │ │ └── writer.go ├── spf13 │ ├── afero │ │ ├── LICENSE.txt │ │ ├── afero.go │ │ ├── basepath.go │ │ ├── cacheOnReadFs.go │ │ ├── const_bsds.go │ │ ├── const_win_unix.go │ │ ├── copyOnWriteFs.go │ │ ├── httpFs.go │ │ ├── ioutil.go │ │ ├── mem │ │ │ ├── dir.go │ │ │ ├── dirmap.go │ │ │ └── file.go │ │ ├── memmap.go │ │ ├── memradix.go │ │ ├── os.go │ │ ├── path.go │ │ ├── readonlyfs.go │ │ ├── regexpfs.go │ │ ├── unionFile.go │ │ └── util.go │ ├── cast │ │ ├── LICENSE │ │ ├── cast.go │ │ └── caste.go │ ├── cobra │ │ ├── LICENSE.txt │ │ ├── bash_completions.go │ │ ├── cobra.go │ │ ├── command.go │ │ ├── command_notwin.go │ │ └── command_win.go │ ├── jwalterweatherman │ │ ├── LICENSE │ │ ├── default_notepad.go │ │ ├── log_counter.go │ │ └── notepad.go │ ├── pflag │ │ ├── LICENSE │ │ ├── bool.go │ │ ├── bool_slice.go │ │ ├── count.go │ │ ├── duration.go │ │ ├── flag.go │ │ ├── float32.go │ │ ├── float64.go │ │ ├── golangflag.go │ │ ├── int.go │ │ ├── int32.go │ │ ├── int64.go │ │ ├── int8.go │ │ ├── int_slice.go │ │ ├── ip.go │ │ ├── ip_slice.go │ │ ├── ipmask.go │ │ ├── ipnet.go │ │ ├── string.go │ │ ├── string_array.go │ │ ├── string_slice.go │ │ ├── uint.go │ │ ├── uint16.go │ │ ├── uint32.go │ │ ├── uint64.go │ │ ├── uint8.go │ │ └── uint_slice.go │ └── viper │ │ ├── LICENSE │ │ ├── flags.go │ │ ├── util.go │ │ └── viper.go └── tidwall │ ├── gjson │ ├── LICENSE │ └── gjson.go │ └── match │ ├── LICENSE │ └── match.go ├── golang.org └── x │ ├── sys │ ├── LICENSE │ ├── PATENTS │ └── unix │ │ ├── asm.s │ │ ├── asm_darwin_386.s │ │ ├── asm_darwin_amd64.s │ │ ├── asm_darwin_arm.s │ │ ├── asm_darwin_arm64.s │ │ ├── asm_dragonfly_386.s │ │ ├── asm_dragonfly_amd64.s │ │ ├── asm_freebsd_386.s │ │ ├── asm_freebsd_amd64.s │ │ ├── asm_freebsd_arm.s │ │ ├── asm_linux_386.s │ │ ├── asm_linux_amd64.s │ │ ├── asm_linux_arm.s │ │ ├── asm_linux_arm64.s │ │ ├── asm_linux_ppc64x.s │ │ ├── asm_netbsd_386.s │ │ ├── asm_netbsd_amd64.s │ │ ├── asm_netbsd_arm.s │ │ ├── asm_openbsd_386.s │ │ ├── asm_openbsd_amd64.s │ │ ├── asm_solaris_amd64.s │ │ ├── constants.go │ │ ├── env_unix.go │ │ ├── env_unset.go │ │ ├── flock.go │ │ ├── flock_linux_32bit.go │ │ ├── gccgo.go │ │ ├── gccgo_c.c │ │ ├── gccgo_linux_amd64.go │ │ ├── race.go │ │ ├── race0.go │ │ ├── sockcmsg_linux.go │ │ ├── sockcmsg_unix.go │ │ ├── str.go │ │ ├── syscall.go │ │ ├── syscall_bsd.go │ │ ├── syscall_darwin.go │ │ ├── syscall_darwin_386.go │ │ ├── syscall_darwin_amd64.go │ │ ├── syscall_darwin_arm.go │ │ ├── syscall_darwin_arm64.go │ │ ├── syscall_dragonfly.go │ │ ├── syscall_dragonfly_386.go │ │ ├── syscall_dragonfly_amd64.go │ │ ├── syscall_freebsd.go │ │ ├── syscall_freebsd_386.go │ │ ├── syscall_freebsd_amd64.go │ │ ├── syscall_freebsd_arm.go │ │ ├── syscall_linux.go │ │ ├── syscall_linux_386.go │ │ ├── syscall_linux_amd64.go │ │ ├── syscall_linux_arm.go │ │ ├── syscall_linux_arm64.go │ │ ├── syscall_linux_ppc64x.go │ │ ├── syscall_netbsd.go │ │ ├── syscall_netbsd_386.go │ │ ├── syscall_netbsd_amd64.go │ │ ├── syscall_netbsd_arm.go │ │ ├── syscall_no_getwd.go │ │ ├── syscall_openbsd.go │ │ ├── syscall_openbsd_386.go │ │ ├── syscall_openbsd_amd64.go │ │ ├── syscall_solaris.go │ │ ├── syscall_solaris_amd64.go │ │ ├── syscall_unix.go │ │ ├── types_darwin.go │ │ ├── types_dragonfly.go │ │ ├── types_freebsd.go │ │ ├── types_linux.go │ │ ├── types_netbsd.go │ │ ├── types_openbsd.go │ │ ├── types_solaris.go │ │ ├── zerrors_darwin_386.go │ │ ├── zerrors_darwin_amd64.go │ │ ├── zerrors_darwin_arm.go │ │ ├── zerrors_darwin_arm64.go │ │ ├── zerrors_dragonfly_386.go │ │ ├── zerrors_dragonfly_amd64.go │ │ ├── zerrors_freebsd_386.go │ │ ├── zerrors_freebsd_amd64.go │ │ ├── zerrors_freebsd_arm.go │ │ ├── zerrors_linux_386.go │ │ ├── zerrors_linux_amd64.go │ │ ├── zerrors_linux_arm.go │ │ ├── zerrors_linux_arm64.go │ │ ├── zerrors_linux_ppc64.go │ │ ├── zerrors_linux_ppc64le.go │ │ ├── zerrors_netbsd_386.go │ │ ├── zerrors_netbsd_amd64.go │ │ ├── zerrors_netbsd_arm.go │ │ ├── zerrors_openbsd_386.go │ │ ├── zerrors_openbsd_amd64.go │ │ ├── zerrors_solaris_amd64.go │ │ ├── zsyscall_darwin_386.go │ │ ├── zsyscall_darwin_amd64.go │ │ ├── zsyscall_darwin_arm.go │ │ ├── zsyscall_darwin_arm64.go │ │ ├── zsyscall_dragonfly_386.go │ │ ├── zsyscall_dragonfly_amd64.go │ │ ├── zsyscall_freebsd_386.go │ │ ├── zsyscall_freebsd_amd64.go │ │ ├── zsyscall_freebsd_arm.go │ │ ├── zsyscall_linux_386.go │ │ ├── zsyscall_linux_amd64.go │ │ ├── zsyscall_linux_arm.go │ │ ├── zsyscall_linux_arm64.go │ │ ├── zsyscall_linux_ppc64.go │ │ ├── zsyscall_linux_ppc64le.go │ │ ├── zsyscall_netbsd_386.go │ │ ├── zsyscall_netbsd_amd64.go │ │ ├── zsyscall_netbsd_arm.go │ │ ├── zsyscall_openbsd_386.go │ │ ├── zsyscall_openbsd_amd64.go │ │ ├── zsyscall_solaris_amd64.go │ │ ├── zsysctl_openbsd.go │ │ ├── zsysnum_darwin_386.go │ │ ├── zsysnum_darwin_amd64.go │ │ ├── zsysnum_darwin_arm.go │ │ ├── zsysnum_darwin_arm64.go │ │ ├── zsysnum_dragonfly_386.go │ │ ├── zsysnum_dragonfly_amd64.go │ │ ├── zsysnum_freebsd_386.go │ │ ├── zsysnum_freebsd_amd64.go │ │ ├── zsysnum_freebsd_arm.go │ │ ├── zsysnum_linux_386.go │ │ ├── zsysnum_linux_amd64.go │ │ ├── zsysnum_linux_arm.go │ │ ├── zsysnum_linux_arm64.go │ │ ├── zsysnum_linux_ppc64.go │ │ ├── zsysnum_linux_ppc64le.go │ │ ├── zsysnum_netbsd_386.go │ │ ├── zsysnum_netbsd_amd64.go │ │ ├── zsysnum_netbsd_arm.go │ │ ├── zsysnum_openbsd_386.go │ │ ├── zsysnum_openbsd_amd64.go │ │ ├── zsysnum_solaris_amd64.go │ │ ├── ztypes_darwin_386.go │ │ ├── ztypes_darwin_amd64.go │ │ ├── ztypes_darwin_arm.go │ │ ├── ztypes_darwin_arm64.go │ │ ├── ztypes_dragonfly_386.go │ │ ├── ztypes_dragonfly_amd64.go │ │ ├── ztypes_freebsd_386.go │ │ ├── ztypes_freebsd_amd64.go │ │ ├── ztypes_freebsd_arm.go │ │ ├── ztypes_linux_386.go │ │ ├── ztypes_linux_amd64.go │ │ ├── ztypes_linux_arm.go │ │ ├── ztypes_linux_arm64.go │ │ ├── ztypes_linux_ppc64.go │ │ ├── ztypes_linux_ppc64le.go │ │ ├── ztypes_netbsd_386.go │ │ ├── ztypes_netbsd_amd64.go │ │ ├── ztypes_netbsd_arm.go │ │ ├── ztypes_openbsd_386.go │ │ ├── ztypes_openbsd_amd64.go │ │ └── ztypes_solaris_amd64.go │ └── text │ ├── LICENSE │ ├── PATENTS │ ├── doc.go │ ├── gen.go │ ├── transform │ └── transform.go │ └── unicode │ └── norm │ ├── composition.go │ ├── forminfo.go │ ├── input.go │ ├── iter.go │ ├── maketables.go │ ├── normalize.go │ ├── readwriter.go │ ├── tables.go │ ├── transform.go │ ├── trie.go │ └── triegen.go └── gopkg.in └── yaml.v2 ├── LICENSE ├── LICENSE.libyaml ├── apic.go ├── decode.go ├── emitterc.go ├── encode.go ├── parserc.go ├── readerc.go ├── resolve.go ├── scannerc.go ├── sorter.go ├── writerc.go ├── yaml.go ├── yamlh.go └── yamlprivateh.go /.dockerignore: -------------------------------------------------------------------------------- 1 | * 2 | !_output/bin 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | 3 | # Compiled Object files, Static and Dynamic libs (Shared Objects) 4 | *.o 5 | *.a 6 | *.so 7 | 8 | # Folders 9 | _obj 10 | _test 11 | _output 12 | bin 13 | 14 | # Architecture specific extensions/prefixes 15 | *.[568vq] 16 | [568vq].out 17 | 18 | *.cgo1.go 19 | *.cgo2.c 20 | _cgo_defun.c 21 | _cgo_gotypes.go 22 | _cgo_export.* 23 | 24 | _testmain.go 25 | 26 | *.exe 27 | *.test 28 | *.prof 29 | 30 | # Output of the go coverage tool, specifically when used with LiteIDE 31 | *.out 32 | 33 | .idea 34 | .python-version 35 | -------------------------------------------------------------------------------- /DCO: -------------------------------------------------------------------------------- 1 | Developer Certificate of Origin 2 | Version 1.1 3 | 4 | Copyright (C) 2004, 2006 The Linux Foundation and its contributors. 5 | 660 York Street, Suite 102, 6 | San Francisco, CA 94110 USA 7 | 8 | Everyone is permitted to copy and distribute verbatim copies of this 9 | license document, but changing it is not allowed. 10 | 11 | 12 | Developer's Certificate of Origin 1.1 13 | 14 | By making a contribution to this project, I certify that: 15 | 16 | (a) The contribution was created in whole or in part by me and I 17 | have the right to submit it under the open source license 18 | indicated in the file; or 19 | 20 | (b) The contribution is based upon previous work that, to the best 21 | of my knowledge, is covered under an appropriate open source 22 | license and I have the right under that license to submit that 23 | work with modifications, whether created in whole or in part 24 | by me, under the same open source license (unless I am 25 | permitted to submit under a different license), as indicated 26 | in the file; or 27 | 28 | (c) The contribution was provided directly to me by some other 29 | person who certified (a), (b) or (c) and I have not modified 30 | it. 31 | 32 | (d) I understand and agree that this project and the contribution 33 | are public and that a record of the contribution (including all 34 | personal information I submit with it, including my sign-off) is 35 | maintained indefinitely and may be redistributed consistent with 36 | this project or the open source license(s) involved. 37 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM alpine:3.5 2 | MAINTAINER Eric Stroczynski 3 | 4 | # Utils a user might need while running grafiti in a container 5 | RUN apk add --no-cache jq 6 | 7 | # Copy built binary into image 8 | COPY _output/bin/grafiti /usr/local/bin/grafiti 9 | 10 | WORKDIR / 11 | 12 | CMD ["grafiti", "--help"] 13 | -------------------------------------------------------------------------------- /Documentation/delete-example.md: -------------------------------------------------------------------------------- 1 | # Deleting 2 | 3 | These examples demonstrate usage of the `delete` sub-command. 4 | 5 | Grafiti supports deleting resources based on matching Tags. Delete input file (see [`example-tags-input.json`][file-example-tags-input]) has the form: 6 | 7 | ```json 8 | { 9 | "TagFilters": [ 10 | { 11 | "Key": "TagKey", 12 | "Values": ["TagValue1", "TagValue2"] 13 | } 14 | ] 15 | } 16 | ``` 17 | 18 | **Note**: Both tag keys and values are _case sensitive_. 19 | 20 | As with `grafiti filter`'s input tag file, TagFilters have the same form as AWS TagFilter JSON. See the [AWS docs for details](aws-docs-rgta-tagfilter). Of note is tag value chaining with AND and OR e.g. `"Values": ["Yes", "OR", "Maybe"]` 21 | 22 | From stdin: 23 | ```sh 24 | echo "{\"TagFilters\":[{\"Key\": \"DeleteMe\", \"Values\": [\"Yes\"]}]}" | grafiti -c config.toml delete 25 | ``` 26 | From file: 27 | ```sh 28 | grafiti -c config.toml delete -f example-delete-tags.json 29 | ``` 30 | 31 | [aws-docs-rgta-tagfilter]: http://docs.aws.amazon.com/resourcegroupstagging/latest/APIReference/API_TagFilter.html 32 | 33 | [file-example-tags-input]: ../example-tags-input.json 34 | -------------------------------------------------------------------------------- /Documentation/deletion-order.md: -------------------------------------------------------------------------------- 1 | # AWS resource deletion order 2 | 3 | AWS resources have (potentially many) dependencies that must be explicitly detached/removed/deleted before deleting a top-level resource (ex. a VPC). Therefore a deletion order must be enforced. This order is universal for all AWS resources and is not use-case-specific, because deletion actions will only run if a resource with a specific tag, or one of it's dependencies, is detected. 4 | 5 | ## Order 6 | 7 | The following order is not fixed and subject to change as more resource types are supported by grafiti. Sublists of resources are children that are implicitly deleted, i.e. deleted only when deleting their parent resource. 8 | 9 | 1. S3 Bucket 10 | 1. S3 Object 11 | 1. Route53 HostedZone 12 | 1. Route53 RecordSet 13 | 1. EC2 RouteTableAssociation 14 | 1. EC2 Instance 15 | 1. AutoScaling Group 16 | 1. AutoScaling LaunchConfiguration 17 | 1. ElasticLoadBalancer 18 | 1. EC2 NAT Gateway 19 | 1. ElasticIPAssociation 20 | 1. ElasticIP (Allocation) 21 | 1. IAM InstanceProfile 22 | 1. IAM Role Association 23 | 1. IAM Role 24 | 1. IAM User 25 | 1. EC2 InternetGateway 26 | 1. EC2 InternetGatewayAttachment 27 | 1. EC2 NetworkInterface 28 | 1. EC2 NetworkACL 29 | 1. EC2 NetworkACL Entry 30 | 1. EC2 VPN Connection 31 | 1. EC2 VPN Connection Route 32 | 1. EC2 CustomerGateway 33 | 1. EBS Volume 34 | 1. EC2 Subnet 35 | 1. EC2 RouteTable 36 | 1. EC2 RouteTable Route 37 | 1. EC2 SecurityGroup 38 | 1. EC2 SecurityGroup Ingress Rule 39 | 1. EC2 SecurityGroup Egress Rule 40 | 1. EC2 VPN Gateway 41 | 1. EC2 VPN Gateway Attachment 42 | 1. EC2 VPC 43 | 1. EC2 VPC CIDRBlock 44 | -------------------------------------------------------------------------------- /Documentation/filter-example.md: -------------------------------------------------------------------------------- 1 | # Filtering 2 | 3 | These examples demonstrate usage of the `filter` sub-command. 4 | 5 | Grafiti can filter resources parsed from CloudTrail events by their tag using the `filter` sub-command. Specifically, the `--ignore-file`/`-i` option takes a file with TagFilters corresponding to resource tags; resources with these tags will be removed from`grafiti parse` output, and remaining resources can be filtered into `grafiti tag`. 6 | 7 | Filter input file (see [`example-tags-input.json`][file-example-tags-input]) has the form: 8 | 9 | ```json 10 | { 11 | "TagFilters": [ 12 | { 13 | "Key": "TagKey", 14 | "Values": ["TagValue"] 15 | } 16 | ] 17 | } 18 | ``` 19 | 20 | **Note**: Both tag keys and values are _case sensitive_. 21 | 22 | TagFilters have the same form as the AWS Resource Group Tagging API `TagFilter`. See the [AWS docs for details][aws-docs-rgta-tagfilter]. Of note is tag value chaining with AND and OR e.g. `"Values": ["Yes", "OR", "Maybe"]` 23 | 24 | Filtering can be done like so: 25 | ```bash 26 | grafiti -c config.toml parse | \ 27 | grafiti -c config.toml filter -i example-tags-input.json | \ 28 | grafiti -c config.toml tag 29 | ``` 30 | 31 | [aws-docs-rgta-tagfilter]: http://docs.aws.amazon.com/resourcegroupstagging/latest/APIReference/API_TagFilter.html 32 | 33 | [file-example-tags-input]: ../example-tags-input.json 34 | -------------------------------------------------------------------------------- /Documentation/tag-example.md: -------------------------------------------------------------------------------- 1 | # Tagging 2 | 3 | These examples demonstrate usage of the `tag` sub-command. 4 | 5 | Tagging input has the form: 6 | 7 | ```json 8 | { 9 | "TaggingMetadata": { 10 | "ResourceName": "string", 11 | "ResourceType": "string", 12 | "ResourceARN": "arn:aws:namespace:region:account-id:resource-info", 13 | "CreatorARN": "arn:aws:iam::account-id:user/user-name", 14 | "CreatorName": "string", 15 | }, 16 | "Tags": { 17 | "TagName": "TagValue" 18 | } 19 | } 20 | ``` 21 | This will apply the tags to the referenced resource. 22 | 23 | Once resources have been tagged, you can view them in your AWS Console by resource type, region, and tag. 24 | 1. In the main AWS console, open the `Resource Groups` dropdown in the top navigation bar. 25 | 2. Select `Tag Editor`. 26 | 3. Once navigated to the editor, search for your tags by region, resource type(s), and tag key(s) and value(s). 27 | 28 | ## Parsing + Tagging 29 | 30 | Parsing and tagging are often done together, as `tag` input naturally takes `parse` output. 31 | 32 | ### Tag EC2 instances with CreatedBy, CreatedAt, and TaggedAt 33 | 34 | This is a full example of parsing events and generating tags from them. 35 | 36 | config.toml 37 | ```toml 38 | resourceTypes = ["AWS::EC2::Instance"] 39 | endHour = 0 40 | startHour = -8 41 | maxNumRequestRetries = 11 42 | includeEvent = false 43 | tagPatterns = [ 44 | "{CreatedBy: .userIdentity.arn}", 45 | "{CreatedAt: .eventTime}", 46 | "{TaggedAt: now|todate}", 47 | ] 48 | filterPatterns = [ 49 | ".TaggingMetadata.ResourceType == \"AWS::EC2::Instance\"", 50 | ] 51 | ``` 52 | 53 | Run: 54 | ```sh 55 | grafiti parse -c config.toml | grafiti tag -c config.toml 56 | ``` 57 | 58 | The above command will tag all matching resources with tags that look like: 59 | 60 | ```json 61 | { 62 | "CreatedBy": "arn:aws:iam::0123456789101:root", 63 | "CreatedAt": "20170512T01:02:03Z", 64 | "TaggedAt": "2017-04-28" 65 | } 66 | ``` 67 | -------------------------------------------------------------------------------- /Documentation/usage-notes-and-tips.md: -------------------------------------------------------------------------------- 1 | # Usage notes and tips 2 | 3 | Grafiti is highly configurable, and with complex configuration often comes confusion. This document discusses points that the authors and users of grafiti think enhance the user experience. 4 | 5 | ## Error handling 6 | 7 | We **highly recommend** using the `--ignore-errors` flag when deleting resources. Many top-level resources have dependencies that, if not first deleted, will cause API errors that interrupt deletion loops. `--ignore-errors` instead handles errors gracefully by continuing deletion loops and printing error messages to stdout in JSON format: 8 | 9 | ```json 10 | { 11 | "level": "error", 12 | "msg": "error message", 13 | "time": "2017-08-01T123:59:59-07:00" 14 | } 15 | ``` 16 | 17 | ## Deleting dependencies 18 | 19 | By default, `grafiti delete` will not trace relationships between resources and add them to the deletion graph. Passing the `--all-deps` flag will trace these relationships and add all found dependencies to the deletion graph. 20 | 21 | For example, if a tagged VPC has a user-created (non-default) subnet that is not tagged, running `grafiti delete` will not delete the subnet, and in all likelihood will not delete the VPC due to dependency issues imposed by AWS. 22 | 23 | ## Deleted resources report 24 | 25 | The `--report` flag will enable `grafiti delete` to aggregate all failed resource deletions and pretty-print them after a run. Log records of failed deletions will be saved as JSON objects in a log file in your current directory. Logging functionality uses the [logrus][logrus-repo] package, which allows you to both create and parse log entries. However, because grafiti log entries are verbose, the logrus log parser might not function as expected. We recommend using `jq` to parse log data. 26 | 27 | ## Logging 28 | 29 | Grafiti supports two forms of logging: to a file or stderr. Logs are sent to stderr by default, and to a log file if the `logDir` config field (`GRF_LOG_DIR` environment variable) is not empty. In the latter case, grafiti log files of the format `grafiti-yyyymmdd_HHMMSS.log` are created by each `grafiti` execution. 30 | 31 | [logrus-repo]: https://github.com/sirupsen/logrus 32 | -------------------------------------------------------------------------------- /Jenkinsfile: -------------------------------------------------------------------------------- 1 | def creds = [ 2 | usernamePassword( 3 | credentialsId: 'jenkins-tectonic-installer', 4 | usernameVariable: 'AWS_ACCESS_KEY_ID', 5 | passwordVariable: 'AWS_SECRET_ACCESS_KEY' 6 | ) 7 | ] 8 | 9 | def quay_creds = [ 10 | usernamePassword( 11 | credentialsId: 'quay-robot', 12 | passwordVariable: 'QUAY_ROBOT_SECRET', 13 | usernameVariable: 'QUAY_ROBOT_USERNAME' 14 | ) 15 | ] 16 | 17 | node('worker && ec2') { 18 | 19 | checkout scm 20 | 21 | def grafiti_version = sh(returnStdout: true, script: "./scripts/git-version").trim() 22 | 23 | stage('Test') { 24 | withCredentials(creds) { 25 | sh """#!/bin/bash -ex 26 | . ./scripts/docker-test 27 | """ 28 | } 29 | } 30 | stage('Push') { 31 | if (env.BRANCH_NAME == 'master') { 32 | withCredentials(quay_creds) { 33 | sh """#!/bin/bash -ex 34 | docker login -u="$QUAY_ROBOT_USERNAME" -p="$QUAY_ROBOT_SECRET" quay.io 35 | make docker-image 36 | docker push quay.io/coreos/grafiti:$grafiti_version 37 | """ 38 | } 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /MAINTAINERS: -------------------------------------------------------------------------------- 1 | Evan Cordell (@ecordell) pkg:* 2 | Eric Stroczynski (@estroz) pkg:* 3 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | PROJ=grafiti 2 | ORG_PATH=github.com/coreos 3 | REPO_PATH=$(ORG_PATH)/$(PROJ) 4 | INSTALL_PATH=$(REPO_PATH)/cmd/grafiti 5 | export PATH := $(PWD)/bin:$(PATH) 6 | 7 | VERSION ?= $(shell ./scripts/git-version) 8 | 9 | DOCKER_REPO=quay.io/coreos/grafiti 10 | DOCKER_IMAGE=$(DOCKER_REPO):$(VERSION) 11 | 12 | $( shell mkdir -p bin ) 13 | $( shell mkdir -p _output/images ) 14 | $( shell mkdir -p _output/bin ) 15 | 16 | user=$(shell id -u -n) 17 | group=$(shell id -g -n) 18 | 19 | export GOBIN=$(PWD)/bin 20 | 21 | LD_FLAGS="-w -X $(REPO_PATH)/version.Version=$(VERSION)" 22 | 23 | build: bin/grafiti 24 | 25 | bin/grafiti: 26 | @go install -v -ldflags $(LD_FLAGS) $(INSTALL_PATH) 27 | 28 | install: 29 | @GOBIN=$(GOPATH)/bin go install -v -ldflags $(LD_FLAGS) $(INSTALL_PATH) 30 | 31 | .PHONY: release-binary 32 | release-binary: 33 | @go build -o /go/bin/grafiti -v -ldflags $(LD_FLAGS) $(INSTALL_PATH) 34 | 35 | .PHONY: revendor 36 | revendor: 37 | @glide up -v 38 | @glide-vc --use-lock-file --no-tests --only-code 39 | 40 | test: 41 | @go test -v -i $(shell go list ./... | grep -v '/vendor/') 42 | @go test -v $(shell go list ./... | grep -v '/vendor/') 43 | 44 | testrace: 45 | @go test -v -i --race $(shell go list ./... | grep -v '/vendor/') 46 | @go test -v --race $(shell go list ./... | grep -v '/vendor/') 47 | 48 | vet: 49 | @go vet $(shell go list ./... | grep -v '/vendor/') 50 | 51 | fmt: 52 | @go fmt $(shell go list ./... | grep -v '/vendor/') 53 | 54 | lint: 55 | @for package in $(shell go list ./... | grep -v '/vendor/' | grep -v '/api' | grep -v '/server/internal'); do \ 56 | golint -set_exit_status $$package $$i || exit 1; \ 57 | done 58 | 59 | _output/bin/grafiti: 60 | @./scripts/docker-build 61 | @sudo chown $(user):$(group) _output/bin/grafiti 62 | 63 | .PHONY: docker-image 64 | docker-image: clean-release _output/bin/grafiti 65 | @sudo docker build -t $(DOCKER_IMAGE) . 66 | 67 | clean: clean-release 68 | @rm -rf bin/ 69 | 70 | .PHONY: clean-release 71 | clean-release: 72 | @rm -rf _output/ 73 | 74 | testall: testrace vet fmt lint 75 | 76 | FORCE: 77 | 78 | .PHONY: build install test testrace vet fmt lint testall 79 | -------------------------------------------------------------------------------- /NOTICE: -------------------------------------------------------------------------------- 1 | CoreOS Project 2 | Copyright 2017 CoreOS, Inc 3 | 4 | This product includes software developed at CoreOS, Inc. 5 | (http://www.coreos.com/). 6 | -------------------------------------------------------------------------------- /config.toml: -------------------------------------------------------------------------------- 1 | resourceTypes = ["AWS::EC2::Instance"] 2 | endHour = 0 3 | startHour = -8 4 | # endTimeStamp = "2017-06-14T08:00:00Z" # RFC-3339 format in UTC 5 | # startTimeStamp = "2017-06-13T00:00:00Z" 6 | maxNumRequestRetries = 8 7 | includeEvent = false 8 | tagPatterns = [ 9 | "{CreatedBy: .userIdentity.arn}", 10 | # "{CreatedAt: .eventTime}", 11 | # "{TaggedAt: now|todate}", 12 | "{TaggedAt: now|strftime(\"%Y-%m-%d\")}", 13 | "{ExpiresAt: (now+(60*60*24*14))|strftime(\"%Y-%m-%d\")}" # Expire in 2 weeks 14 | ] 15 | filterPatterns = [ 16 | # ".TaggingMetadata.ResourceType == \"AWS::EC2::Instance\"", 17 | # ".TaggingMetadata.ResourceType == \"AWS::ElasticLoadBalancing::LoadBalancer\"", 18 | ] 19 | logDir = "/tmp" 20 | -------------------------------------------------------------------------------- /cronjob.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: batch/v2alpha1 2 | kind: CronJob 3 | metadata: 4 | name: grafiti-deleter 5 | spec: 6 | schedule: "* */6 * * *" 7 | jobTemplate: 8 | spec: 9 | template: 10 | spec: 11 | containers: 12 | - command: 13 | - /bin/bash 14 | - -c 15 | - grafiti -e -c /opt/config.toml delete --all-deps -f /opt/tags.json 16 | env: 17 | - name: AWS_REGION 18 | value: ${AWS_REGION} 19 | name: grafiti-deleter 20 | image: your/registry/grafiti:v0.1.1 21 | volumeMounts: 22 | - mountPath: /root/.aws/credentials 23 | name: grafiti-aws-credentials 24 | readOnly: true 25 | - mountPath: /opt/config.toml 26 | name: config-path 27 | - mountPath: /opt/tags.json 28 | name: tags-path 29 | securityContext: 30 | runAsNonRoot: true 31 | runAsUser: 1000 32 | volumes: 33 | - hostPath: 34 | path: ${HOME}/.aws/credentials 35 | name: grafiti-aws-credentials 36 | - hostPath: 37 | path: ./config.toml 38 | name: config-path 39 | - hostPath: 40 | path: ./example-tags-input.json 41 | name: tags-path 42 | restartPolicy: OnFailure 43 | -------------------------------------------------------------------------------- /deleter/autoscaling_test.go: -------------------------------------------------------------------------------- 1 | package deleter 2 | 3 | import ( 4 | "reflect" 5 | "testing" 6 | 7 | "github.com/aws/aws-sdk-go/aws" 8 | "github.com/aws/aws-sdk-go/service/autoscaling" 9 | ) 10 | 11 | func TestCreateInstanceProfileMap(t *testing.T) { 12 | cases := []struct { 13 | InputLCs []*autoscaling.LaunchConfiguration 14 | Expected map[string]struct{} 15 | }{ 16 | { 17 | InputLCs: []*autoscaling.LaunchConfiguration{ 18 | &autoscaling.LaunchConfiguration{ 19 | IamInstanceProfile: aws.String("instance-profile-name-1"), 20 | }, 21 | &autoscaling.LaunchConfiguration{ 22 | IamInstanceProfile: aws.String("arn:aws:iam:::instance-profile/instance-profile-name-2"), 23 | }, 24 | }, 25 | Expected: map[string]struct{}{ 26 | "instance-profile-name-1": {}, 27 | "instance-profile-name-2": {}, 28 | }, 29 | }, 30 | } 31 | 32 | for i, c := range cases { 33 | got := createInstanceProfileMap(c.InputLCs) 34 | if !reflect.DeepEqual(c.Expected, got) { 35 | t.Errorf("createInstanceProfileMap case %d failed\nwanted %s\ngot %s\n", i+i, c.Expected, got) 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /deleter/retryer/retryer.go: -------------------------------------------------------------------------------- 1 | package retryer 2 | 3 | import ( 4 | "time" 5 | 6 | "github.com/aws/aws-sdk-go/aws/awserr" 7 | "github.com/aws/aws-sdk-go/aws/client" 8 | "github.com/aws/aws-sdk-go/aws/request" 9 | ) 10 | 11 | // Retryable codes specific to ResourceDeleters 12 | var retryableCodes = map[string]struct{}{ 13 | "DependencyViolation": {}, 14 | } 15 | 16 | // DeleteRetryer configures retrying for all AWS delete requests 17 | type DeleteRetryer struct { 18 | NumMaxRetries int 19 | } 20 | 21 | // RetryRules define how a request is retried upon failure. Uses the 22 | // client.DefaultRetryer.RetryRules function to calculate exponential backoff 23 | func (dr DeleteRetryer) RetryRules(r *request.Request) time.Duration { 24 | retryer := client.DefaultRetryer{NumMaxRetries: dr.NumMaxRetries} 25 | return retryer.RetryRules(r) 26 | } 27 | 28 | // ShouldRetry returns whether a request should be retried. Requests will be 29 | // retried if the error code is in retryableCodes or is a retryable/throttle 30 | // code 31 | func (dr DeleteRetryer) ShouldRetry(r *request.Request) bool { 32 | aerr, ok := r.Error.(awserr.Error) 33 | if (ok && isCodeRetryable(aerr.Code())) || r.HTTPResponse.StatusCode >= 500 { 34 | return true 35 | } 36 | 37 | return r.IsErrorRetryable() || r.IsErrorThrottle() 38 | } 39 | 40 | func isCodeRetryable(code string) bool { 41 | _, ok := retryableCodes[code] 42 | return ok 43 | } 44 | 45 | // MaxRetries returns the number of retries the retryer should attempt 46 | func (dr DeleteRetryer) MaxRetries() int { 47 | return dr.NumMaxRetries 48 | } 49 | -------------------------------------------------------------------------------- /example-tags-input.json: -------------------------------------------------------------------------------- 1 | { 2 | "TagFilters": [ 3 | { 4 | "Key": "Purpose", 5 | "Values": ["Testing", "Test"] 6 | }, 7 | { 8 | "Key": "KubernetesCluster", 9 | "Values": ["release-test-1"] 10 | } 11 | ] 12 | } 13 | -------------------------------------------------------------------------------- /glide.yaml: -------------------------------------------------------------------------------- 1 | package: github.com/coreos/grafiti 2 | import: 3 | - package: github.com/sirupsen/logrus 4 | version: ~1.0.0 5 | - package: github.com/spf13/pflag 6 | version: e57e3eeb33f795204c1ca35f56c44f83227c6e66 7 | - package: github.com/spf13/cobra 8 | version: 8c6fa02d2225de0f9bdcb7ca912556f68d172d8c 9 | - package: github.com/spf13/viper 10 | version: c1de95864d73a5465492829d7cb2dd422b19ac96 11 | - package: github.com/aws/aws-sdk-go 12 | version: ~1.8.7 13 | - package: github.com/tidwall/gjson 14 | version: e30a9c1037e0f9fbde93a6a9848a2dd5c59d3b91 15 | - package: github.com/estroz/jqpipe-go 16 | version: 45ea8aa7bda10952dad138dec86b7060519e77cb 17 | -------------------------------------------------------------------------------- /graph/graph_test.go: -------------------------------------------------------------------------------- 1 | package graph 2 | 3 | import ( 4 | "reflect" 5 | "testing" 6 | 7 | "github.com/coreos/grafiti/arn" 8 | "github.com/coreos/grafiti/deleter" 9 | ) 10 | 11 | func TestFillDependencyGraph(t *testing.T) { 12 | cases := []struct { 13 | Input map[arn.ResourceType]deleter.ResourceDeleter 14 | Expected map[arn.ResourceType]deleter.ResourceDeleter 15 | }{ 16 | { 17 | Input: map[arn.ResourceType]deleter.ResourceDeleter{ 18 | arn.AutoScalingGroupRType: &deleter.AutoScalingGroupDeleter{}, 19 | arn.AutoScalingLaunchConfigurationRType: &deleter.AutoScalingLaunchConfigurationDeleter{}, 20 | }, 21 | Expected: map[arn.ResourceType]deleter.ResourceDeleter{ 22 | arn.AutoScalingGroupRType: &deleter.AutoScalingGroupDeleter{}, 23 | arn.AutoScalingLaunchConfigurationRType: &deleter.AutoScalingLaunchConfigurationDeleter{}, 24 | }, 25 | }, 26 | } 27 | 28 | for _, c := range cases { 29 | FillDependencyGraph(c.Input) 30 | 31 | if !reflect.DeepEqual(c.Input, c.Expected) { 32 | t.Errorf("FillDependencyGraph failed\nwanted\n%s\ngot\n%s\n", c.Expected, c.Input) 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /jenkins-jobs/grafiti_multibranch_job.groovy: -------------------------------------------------------------------------------- 1 | #!/bin/env groovy​ 2 | 3 | multibranchPipelineJob("grafiti") { 4 | description("Tag and remove AWS Resources with Automation.\nThis job is managed by grafiti git repository.\nChanges here will be reverted automatically.") 5 | branchSources { 6 | branchSource { 7 | source { 8 | github { 9 | scanCredentialsId("37477e0c-2ab6-46fe-a83b-64b1add4777d") 10 | checkoutCredentialsId("37477e0c-2ab6-46fe-a83b-64b1add4777d") 11 | apiUri("") 12 | repoOwner("coreos") 13 | repository("grafiti") 14 | buildForkPRHead(false) 15 | buildForkPRMerge(true) 16 | buildOriginBranch(true) 17 | buildOriginBranchWithPR(false) 18 | buildOriginPRHead(false) 19 | buildOriginPRMerge(true) 20 | } 21 | } 22 | strategy { 23 | defaultBranchPropertyStrategy { 24 | props { 25 | noTriggerBranchProperty() 26 | } 27 | } 28 | } 29 | } 30 | } 31 | orphanedItemStrategy { 32 | discardOldItems { 33 | numToKeep(50) 34 | } 35 | } 36 | triggers { 37 | periodic(10080) 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /jenkins-jobs/grafiti_pr_trigger.groovy: -------------------------------------------------------------------------------- 1 | #!/bin/env groovy​ 2 | 3 | folder("grafiti-project") 4 | 5 | job("grafiti-project/grafiti-pr-trigger") { 6 | description('Grafiti PR Trigger.\nChanges here will be reverted automatically.') 7 | 8 | concurrentBuild() 9 | 10 | logRotator(30, 100) 11 | label("master") 12 | 13 | properties { 14 | githubProjectUrl('https://github.com/coreos/grafiti') 15 | } 16 | 17 | wrappers { 18 | colorizeOutput() 19 | timestamps() 20 | } 21 | 22 | triggers { 23 | ghprbTrigger { 24 | gitHubAuthId("") 25 | adminlist("") 26 | orgslist("coreos\ncoreos-inc") 27 | whitelist("") 28 | cron("H/5 * * * *") 29 | triggerPhrase("ok to test") 30 | onlyTriggerPhrase(false) 31 | useGitHubHooks(true) 32 | permitAll(false) 33 | autoCloseFailedPullRequests(false) 34 | displayBuildErrorsOnDownstreamBuilds(false) 35 | commentFilePath("") 36 | skipBuildPhrase(".*\\[skip\\W+ci\\].*") 37 | blackListCommitAuthor("") 38 | allowMembersOfWhitelistedOrgsAsAdmin(true) 39 | msgSuccess("") 40 | msgFailure("") 41 | commitStatusContext("Jenkins-Grafiti") 42 | buildDescTemplate("#\$pullId: \$abbrTitle") 43 | blackListLabels("do-not-test") 44 | whiteListLabels("") 45 | includedRegions("") 46 | excludedRegions("") 47 | } 48 | } 49 | 50 | steps { 51 | downstreamParameterized { 52 | trigger('grafiti/PR-\${ghprbPullId}') 53 | } 54 | } 55 | 56 | publishers { 57 | wsCleanup() 58 | slackNotifier { 59 | authTokenCredentialId('tectonic-slack-token') 60 | customMessage("Grafiti PR Trigger") 61 | includeCustomMessage(true) 62 | notifyBackToNormal(true) 63 | notifyFailure(true) 64 | room('#tectonic-installer-ci') 65 | teamDomain('coreos') 66 | } 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /roadmap.md: -------------------------------------------------------------------------------- 1 | # Grafiti Roadmap 2 | 3 | This document tracks desired grafiti features and their timelines. 4 | 5 | ## Grafiti 0.2 6 | 7 | The 0.2 grafiti release includes better error reporting and parallelism features. 8 | 9 | Goals: 10 | 11 | * Comprehensive error reporting and logging. 12 | * **Status:** WIP, PR: [#111](https://github.com/coreos/grafiti/pull/111) 13 | * **Issues:** [#107](https://github.com/coreos/grafiti/issues/107) 14 | * **Timeline:** 2017/8/18 15 | * Rate limiting on all API calls in order to support parallelism. 16 | * **Status:** WIP 17 | * **Issues:** [#7](https://github.com/coreos/grafiti/issues/7) 18 | * **Timeline:** 2017/8/18 19 | 20 | ## Beyond 0.2 21 | 22 | All features required for the 1.0 release are documented below. These features will be constantly updated as new user stories surface. 23 | 24 | * Slack integration to notify users of dangling resources and deletions. 25 | * Parallelism in requests. 26 | -------------------------------------------------------------------------------- /scripts/docker-build: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | mkdir -p _output/bin 4 | 5 | sudo docker run \ 6 | --cidfile=cid \ 7 | -v "$PWD":/go/src/github.com/coreos/grafiti:ro \ 8 | -w /go/src/github.com/coreos/grafiti \ 9 | golang:1.8.3-alpine \ 10 | /bin/sh -x -c \ 11 | 'apk add --no-cache --update alpine-sdk && make release-binary' 12 | 13 | sudo docker cp "$(cat cid)":/go/bin/grafiti _output/bin/grafiti 14 | sudo docker rm "$(cat cid)" 15 | sudo rm cid 16 | -------------------------------------------------------------------------------- /scripts/docker-test: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | # Using golang:X.X.X-stretch because `go test` does not work as expected in 4 | # 'golang:1.8.3-alpine' 5 | sudo docker run \ 6 | -v "$PWD":/go/src/github.com/coreos/grafiti \ 7 | -w /go/src/github.com/coreos/grafiti \ 8 | -e AWS_ACCESS_KEY_ID="$AWS_ACCESS_KEY_ID" \ 9 | -e AWS_SECRET_ACCESS_KEY="$AWS_SECRET_ACCESS_KEY" \ 10 | -e AWS_REGION="${AWS_REGION:-us-east-1}" \ 11 | golang:1.8.3-stretch \ 12 | /bin/bash -x -c \ 13 | 'apt-get update && apt-get install -y jq \ 14 | && go get -u github.com/golang/lint/golint \ 15 | && make testall' 16 | -------------------------------------------------------------------------------- /scripts/git-version: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | # Parse the current git commit hash 4 | COMMIT="$(git rev-parse HEAD)" 5 | 6 | # Check if the current commit has a matching tag 7 | TAG=$(git describe --exact-match --abbrev=0 --tags "$COMMIT" 2> /dev/null || true) 8 | 9 | # Use the matching tag as the version, if available 10 | if [ -z "$TAG" ]; then 11 | VERSION="$COMMIT" 12 | else 13 | VERSION="$TAG" 14 | fi 15 | 16 | # Check for changed files (not untracked files) 17 | if [ -n "$(git diff --shortstat 2> /dev/null | tail -n1)" ]; then 18 | VERSION="${VERSION}-dirty" 19 | fi 20 | 21 | echo "$VERSION" 22 | -------------------------------------------------------------------------------- /testdata/config/empty-test-config.toml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coreos/grafiti/0f34cabd472524cc217f8f961ff1c37d9f8aa5e8/testdata/config/empty-test-config.toml -------------------------------------------------------------------------------- /testdata/config/test-config.toml: -------------------------------------------------------------------------------- 1 | resourceTypes = ["AWS::EC2::Instance"] 2 | endHour = 0 3 | startHour = -8 4 | # endTimeStamp = "2017-06-14T08:00:00Z" # RFC-3339 format in UTC 5 | # startTimeStamp = "2017-06-13T00:00:00Z" 6 | maxNumRequestRetries = 8 7 | includeEvent = false 8 | tagPatterns = [ 9 | # "{CreatedBy: .userIdentity.arn}", 10 | # "{CreatedAt: .eventTime}", 11 | # "{TaggedAt: now|todate}", 12 | # "{TaggedAt: now|strftime(\"%Y-%m-%d\")}", 13 | # "{ExpiresAt: (now+(60*60*24*14))|strftime(\"%Y-%m-%d\")}" # Expire in 2 weeks 14 | ] 15 | filterPatterns = [ 16 | # ".TaggingMetadata.ResourceType == \"AWS::EC2::Instance\"", 17 | # ".TaggingMetadata.ResourceType == \"AWS::ElasticLoadBalancing::LoadBalancer\"", 18 | ] 19 | # logDir = "/tmp" 20 | -------------------------------------------------------------------------------- /testdata/filter/input-ignore-tags.json: -------------------------------------------------------------------------------- 1 | { 2 | "TagFilters": [ 3 | { 4 | "Key": "ExpiresAt", 5 | "Values": ["2017-06-11"] 6 | }, 7 | { 8 | "Key": "CreatedBy", 9 | "Values": ["arn:aws:iam::123456789101:user/test-user-1"] 10 | } 11 | ] 12 | } -------------------------------------------------------------------------------- /testdata/filter/output-filter.json: -------------------------------------------------------------------------------- 1 | {"TaggingMetadata":{"ResourceName":"i-0e846a0fc3863ffff","ResourceType":"AWS::EC2::Instance","ResourceARN":"arn:aws:ec2:us-west-2:123456789101:instance/i-0e846a0fc3863ffff","CreatorARN":"arn:aws:iam::123456789101:user/test-user","CreatorName":"test-user"},"Tags":{"CreatedBy":"arn:aws:iam::123456789101:user/test-user","ExpiresAt":"2017-06-12","TaggedAt":"2017-05-31"}} 2 | {"TaggingMetadata":{"ResourceName":"s3-bucket-name-2","ResourceType":"AWS::S3::Bucket","ResourceARN":"arn:aws:s3:::bucket/s3-bucket-name-2","CreatorARN":"arn:aws:iam::123456789101:user/test-user-2","CreatorName":"test-user-2"},"Tags":{"CreatedBy":"arn:aws:iam::123456789101:user/test-user-2","ExpiresAt":"2017-06-12","TaggedAt":"2017-05-31"}} 3 | {"TaggingMetadata":{"ResourceName":"autoscaling-group-2","ResourceType":"AWS::AutoScaling::AutoScalingGroup","ResourceARN":"arn:aws:autoscaling:us-west-2:123456789101:autoScalingGroup:big-long-string:autoScalingGroupName/autoscaling-group-2","CreatorARN":"arn:aws:iam::123456789101:user/test-user","CreatorName":"test-user"},"Tags":{"CreatedBy":"arn:aws:iam::123456789101:user/test-user","ExpiresAt":"2017-06-12","TaggedAt":"2017-05-31"}} 4 | {"TaggingMetadata":{"ResourceName":"HOSTEDZONEEXAMPLE2","ResourceType":"AWS::Route53::HostedZone","ResourceARN":"arn:aws:route53:::hostedzone/HOSTEDZONEEXAMPLE2","CreatorARN":"arn:aws:iam::123456789101:user/test-user-2","CreatorName":"test-user-2"},"Tags":{"CreatedBy":"arn:aws:iam::123456789101:user/test-user-2","ExpiresAt":"2017-06-12","TaggedAt":"2017-05-31"}} 5 | -------------------------------------------------------------------------------- /testdata/parse/cloudtrail-logfile-input-error.json: -------------------------------------------------------------------------------- 1 | { 2 | "Records": [{ 3 | "eventVersion": "1.05", 4 | "userIdentity": { 5 | "type": "Root", 6 | "principalId": "123456789101", 7 | "arn": "arn:aws:iam::123456789101:root", 8 | "accountId": "123456789101", 9 | "userName": "coreostectonic", 10 | "invokedBy": "elasticloadbalancing.amazonaws.com" 11 | }, 12 | "eventTime": "2017-06-01T00:04:14Z", 13 | "eventSource": "ec2.amazonaws.com", 14 | "eventName": "CreateNetworkInterface", 15 | "awsRegion": "us-west-2", 16 | "sourceIPAddress": "12.34.56.78", 17 | "userAgent": "elasticloadbalancing.amazonaws.com", 18 | "errorCode": "Client.InvalidSecurityGroupID.NotFound", 19 | "errorMessage": "The securityGroup ID 'sg-2e266855' does not exist", 20 | "requestParameters": { 21 | "subnetId": "subnet-df85a3b8", 22 | "description": "ELB tf-aws-pr-810-1-console", 23 | "groupSet": { 24 | "items": [{ 25 | "groupId": "sg-2e266855" 26 | }] 27 | }, 28 | "privateIpAddressesSet": {}, 29 | "ipv6AddressCount": 0 30 | }, 31 | "responseElements": null, 32 | "requestID": "62d67c6b-d2e7-440b-8259-b67737aa359a", 33 | "eventID": "example-9859-4394-bea2-60e9c6c4a329", 34 | "eventType": "AwsApiCall", 35 | "recipientAccountId": "123456789101" 36 | }] 37 | } 38 | -------------------------------------------------------------------------------- /testdata/parse/parsed-api-output.json: -------------------------------------------------------------------------------- 1 | {"TaggingMetadata":{"ResourceName":"ami-e5af3185","ResourceType":"AWS::EC2::Ami","ResourceARN":"arn:aws:ec2:us-west-2::image/ami-e5af3185","CreatorARN":"arn:aws:iam::123456789101:user/test-user","CreatorName":"test-user"},"Tags":{}} 2 | {"TaggingMetadata":{"ResourceName":"eni-ece025c6","ResourceType":"AWS::EC2::NetworkInterface","ResourceARN":"arn:aws:ec2:us-west-2:123456789101:network-interface/eni-ece025c6","CreatorARN":"arn:aws:iam::123456789101:user/test-user","CreatorName":"test-user"},"Tags":{}} 3 | {"TaggingMetadata":{"ResourceName":"i-0e846a0fc386398df","ResourceType":"AWS::EC2::Instance","ResourceARN":"arn:aws:ec2:us-west-2:123456789101:instance/i-0e846a0fc386398df","CreatorARN":"arn:aws:iam::123456789101:user/test-user","CreatorName":"test-user"},"Tags":{}} 4 | {"TaggingMetadata":{"ResourceName":"terraform-000c7cdeded6cac152dc85db5c","ResourceType":"AWS::EC2::SecurityGroup","ResourceARN":"arn:aws:ec2:us-west-2:123456789101:security-group/terraform-000c7cdeded6cac152dc85db5c","CreatorARN":"arn:aws:iam::123456789101:user/test-user","CreatorName":"test-user"},"Tags":{}} 5 | {"TaggingMetadata":{"ResourceName":"subnet-11725a76","ResourceType":"AWS::EC2::Subnet","ResourceARN":"arn:aws:ec2:us-west-2:123456789101:subnet/subnet-11725a76","CreatorARN":"arn:aws:iam::123456789101:user/test-user","CreatorName":"test-user"},"Tags":{}} 6 | {"TaggingMetadata":{"ResourceName":"vpc-34dcc053","ResourceType":"AWS::EC2::VPC","ResourceARN":"arn:aws:ec2:us-west-2:123456789101:vpc/vpc-34dcc053","CreatorARN":"arn:aws:iam::123456789101:user/test-user","CreatorName":"test-user"},"Tags":{}} 7 | {"TaggingMetadata":{"ResourceName":"tester","ResourceType":"AWS::EC2::KeyPair","ResourceARN":"arn:aws:ec2:us-west-2:123456789101:key-pair/tester","CreatorARN":"arn:aws:iam::123456789101:user/test-user","CreatorName":"test-user"},"Tags":{}} 8 | {"TaggingMetadata":{"ResourceName":"sg-a1e7c0da","ResourceType":"AWS::EC2::SecurityGroup","ResourceARN":"arn:aws:ec2:us-west-2:123456789101:security-group/sg-a1e7c0da","CreatorARN":"arn:aws:iam::123456789101:user/test-user","CreatorName":"test-user"},"Tags":{}} 9 | -------------------------------------------------------------------------------- /testdata/parse/parsed-logfile-output.json: -------------------------------------------------------------------------------- 1 | {"TaggingMetadata":{"ResourceName":"i-0aad897efd1368e2c","ResourceType":"AWS::EC2::Instance","ResourceARN":"arn:aws:ec2:us-west-2:123456789101:instance/i-0aad897efd1368e2c","CreatorARN":"arn:aws:iam::123456789101:root","CreatorName":"root-user"},"Tags":{}} 2 | {"TaggingMetadata":{"ResourceName":"aaws-pr-751","ResourceType":"AWS::S3::Bucket","ResourceARN":"arn:aws:s3:::aaws-pr-751","CreatorARN":"arn:aws:iam::123456789101:user/test-user","CreatorName":"test-user"},"Tags":{}} 3 | {"TaggingMetadata":{"ResourceName":"vpc-48fae42f","ResourceType":"AWS::EC2::VPC","ResourceARN":"arn:aws:ec2:us-west-2:123456789101:vpc/vpc-48fae42f","CreatorARN":"arn:aws:iam::123456789101:user/test-user","CreatorName":"test-user"},"Tags":{}} 4 | {"TaggingMetadata":{"ResourceName":"subnet-77466c10","ResourceType":"AWS::EC2::Subnet","ResourceARN":"arn:aws:ec2:us-west-2:123456789101:subnet/subnet-77466c10","CreatorARN":"arn:aws:iam::123456789101:user/test-user","CreatorName":"test-user"},"Tags":{}} 5 | {"TaggingMetadata":{"ResourceName":"aws-pr-751-ext","ResourceType":"AWS::ElasticLoadBalancing::LoadBalancer","ResourceARN":"arn:aws:elasticloadbalancing:us-west-2:123456789101:loadbalancer/aws-pr-751-ext","CreatorARN":"arn:aws:iam::123456789101:user/test-user","CreatorName":"test-user"},"Tags":{}} 6 | {"TaggingMetadata":{"ResourceName":"igw-748c5d13","ResourceType":"AWS::EC2::InternetGateway","ResourceARN":"arn:aws:ec2:us-west-2:123456789101:internet-gateway/igw-748c5d13","CreatorARN":"arn:aws:iam::123456789101:user/test-user","CreatorName":"test-user"},"Tags":{}} 7 | {"TaggingMetadata":{"ResourceName":"sg-889bb9f3","ResourceType":"AWS::EC2::SecurityGroup","ResourceARN":"arn:aws:ec2:us-west-2:123456789101:security-group/sg-889bb9f3","CreatorARN":"arn:aws:iam::123456789101:user/test-user","CreatorName":"test-user"},"Tags":{}} 8 | {"TaggingMetadata":{"ResourceName":"eni-d08b5afa","ResourceType":"AWS::EC2::NetworkInterface","ResourceARN":"arn:aws:ec2:us-west-2:123456789101:network-interface/eni-d08b5afa","CreatorARN":"arn:aws:iam::123456789101:root","CreatorName":"root-user"},"Tags":{}} 9 | -------------------------------------------------------------------------------- /testdata/tag/test-data-input-no-tags.json: -------------------------------------------------------------------------------- 1 | {"TaggingMetadata":{"ResourceName":"demo-master","ResourceType":"AWS::AutoScaling::AutoScalingGroup","ResourceARN":"arn:aws:autoscaling:us-west-2:123456789101:autoScalingGroup:big-long-string:autoScalingGroupName/demo-master","CreatorARN":"arn:aws:iam::123456789101:user/test-user","CreatorName":"test-user","CreatedAt":""},"Tags":{}} 2 | {"TaggingMetadata":{"ResourceName":"i-0e846a0fc386398df","ResourceType":"AWS::EC2::Instance","ResourceARN":"arn:aws:ec2:us-west-2:123456789101:instance/i-0e846a0fc386398df","CreatorARN":"arn:aws:iam::123456789101:user/test-user","CreatorName":"test-user"},"Tags":{}} 3 | {"TaggingMetadata":{"ResourceName":"ZHZDDDD1GKNAC","ResourceType":"AWS::Route53::HostedZone","ResourceARN":"arn:aws:route53:::hostedzone/ZHZDDDD1GKNAC","CreatorARN":"","CreatorName":""},"Tags":{}} 4 | -------------------------------------------------------------------------------- /testdata/tag/test-data-input.json: -------------------------------------------------------------------------------- 1 | {"TaggingMetadata":{"ResourceName":"demo-master","ResourceType":"AWS::AutoScaling::AutoScalingGroup","ResourceARN":"arn:aws:autoscaling:us-west-2:123456789101:autoScalingGroup:big-long-string:autoScalingGroupName/demo-master","CreatorARN":"arn:aws:iam::123456789101:user/test-user","CreatorName":"test-user"},"Tags":{"CreatedBy":"arn:aws:iam::123456789101:user/test-user","ExpiresAt":"2017-06-12","TaggedAt":"2017-05-31"}} 2 | {"TaggingMetadata":{"ResourceName":"i-0e846a0fc386398df","ResourceType":"AWS::EC2::Instance","ResourceARN":"arn:aws:ec2:us-west-2:123456789101:instance/i-0e846a0fc386398df","CreatorARN":"arn:aws:iam::123456789101:user/test-user","CreatorName":"test-user"},"Tags":{"CreatedBy":"arn:aws:iam::123456789101:user/test-user","ExpiresAt":"2017-06-12","TaggedAt":"2017-05-31"}} 3 | {"TaggingMetadata":{"ResourceName":"ZHZDDDD1GKNAC","ResourceType":"AWS::Route53::HostedZone","ResourceARN":"arn:aws:route53:::hostedzone/ZHZDDDD1GKNAC","CreatorARN":"","CreatorName":""},"Tags":{"CreatedBy":"arn:aws:iam::123456789101:user/test-user","ExpiresAt":"2017-06-12","TaggedAt":"2017-05-31"}} 4 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/NOTICE.txt: -------------------------------------------------------------------------------- 1 | AWS SDK for Go 2 | Copyright 2015 Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | Copyright 2014-2015 Stripe, Inc. 4 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/aws/awsutil/equal.go: -------------------------------------------------------------------------------- 1 | package awsutil 2 | 3 | import ( 4 | "reflect" 5 | ) 6 | 7 | // DeepEqual returns if the two values are deeply equal like reflect.DeepEqual. 8 | // In addition to this, this method will also dereference the input values if 9 | // possible so the DeepEqual performed will not fail if one parameter is a 10 | // pointer and the other is not. 11 | // 12 | // DeepEqual will not perform indirection of nested values of the input parameters. 13 | func DeepEqual(a, b interface{}) bool { 14 | ra := reflect.Indirect(reflect.ValueOf(a)) 15 | rb := reflect.Indirect(reflect.ValueOf(b)) 16 | 17 | if raValid, rbValid := ra.IsValid(), rb.IsValid(); !raValid && !rbValid { 18 | // If the elements are both nil, and of the same type the are equal 19 | // If they are of different types they are not equal 20 | return reflect.TypeOf(a) == reflect.TypeOf(b) 21 | } else if raValid != rbValid { 22 | // Both values must be valid to be equal 23 | return false 24 | } 25 | 26 | return reflect.DeepEqual(ra.Interface(), rb.Interface()) 27 | } 28 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/aws/client/metadata/client_info.go: -------------------------------------------------------------------------------- 1 | package metadata 2 | 3 | // ClientInfo wraps immutable data from the client.Client structure. 4 | type ClientInfo struct { 5 | ServiceName string 6 | APIVersion string 7 | Endpoint string 8 | SigningName string 9 | SigningRegion string 10 | JSONVersion string 11 | TargetPrefix string 12 | } 13 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/aws/context_1_6.go: -------------------------------------------------------------------------------- 1 | // +build !go1.7 2 | 3 | package aws 4 | 5 | import "time" 6 | 7 | // An emptyCtx is a copy of the the Go 1.7 context.emptyCtx type. This 8 | // is copied to provide a 1.6 and 1.5 safe version of context that is compatible 9 | // with Go 1.7's Context. 10 | // 11 | // An emptyCtx is never canceled, has no values, and has no deadline. It is not 12 | // struct{}, since vars of this type must have distinct addresses. 13 | type emptyCtx int 14 | 15 | func (*emptyCtx) Deadline() (deadline time.Time, ok bool) { 16 | return 17 | } 18 | 19 | func (*emptyCtx) Done() <-chan struct{} { 20 | return nil 21 | } 22 | 23 | func (*emptyCtx) Err() error { 24 | return nil 25 | } 26 | 27 | func (*emptyCtx) Value(key interface{}) interface{} { 28 | return nil 29 | } 30 | 31 | func (e *emptyCtx) String() string { 32 | switch e { 33 | case backgroundCtx: 34 | return "aws.BackgroundContext" 35 | } 36 | return "unknown empty Context" 37 | } 38 | 39 | var ( 40 | backgroundCtx = new(emptyCtx) 41 | ) 42 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/aws/context_1_7.go: -------------------------------------------------------------------------------- 1 | // +build go1.7 2 | 3 | package aws 4 | 5 | import "context" 6 | 7 | var ( 8 | backgroundCtx = context.Background() 9 | ) 10 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/aws/corehandlers/param_validator.go: -------------------------------------------------------------------------------- 1 | package corehandlers 2 | 3 | import "github.com/aws/aws-sdk-go/aws/request" 4 | 5 | // ValidateParametersHandler is a request handler to validate the input parameters. 6 | // Validating parameters only has meaning if done prior to the request being sent. 7 | var ValidateParametersHandler = request.NamedHandler{Name: "core.ValidateParametersHandler", Fn: func(r *request.Request) { 8 | if !r.ParamsFilled() { 9 | return 10 | } 11 | 12 | if v, ok := r.Params.(request.Validator); ok { 13 | if err := v.Validate(); err != nil { 14 | r.Error = err 15 | } 16 | } 17 | }} 18 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/aws/credentials/static_provider.go: -------------------------------------------------------------------------------- 1 | package credentials 2 | 3 | import ( 4 | "github.com/aws/aws-sdk-go/aws/awserr" 5 | ) 6 | 7 | // StaticProviderName provides a name of Static provider 8 | const StaticProviderName = "StaticProvider" 9 | 10 | var ( 11 | // ErrStaticCredentialsEmpty is emitted when static credentials are empty. 12 | // 13 | // @readonly 14 | ErrStaticCredentialsEmpty = awserr.New("EmptyStaticCreds", "static credentials are empty", nil) 15 | ) 16 | 17 | // A StaticProvider is a set of credentials which are set programmatically, 18 | // and will never expire. 19 | type StaticProvider struct { 20 | Value 21 | } 22 | 23 | // NewStaticCredentials returns a pointer to a new Credentials object 24 | // wrapping a static credentials value provider. 25 | func NewStaticCredentials(id, secret, token string) *Credentials { 26 | return NewCredentials(&StaticProvider{Value: Value{ 27 | AccessKeyID: id, 28 | SecretAccessKey: secret, 29 | SessionToken: token, 30 | }}) 31 | } 32 | 33 | // NewStaticCredentialsFromCreds returns a pointer to a new Credentials object 34 | // wrapping the static credentials value provide. Same as NewStaticCredentials 35 | // but takes the creds Value instead of individual fields 36 | func NewStaticCredentialsFromCreds(creds Value) *Credentials { 37 | return NewCredentials(&StaticProvider{Value: creds}) 38 | } 39 | 40 | // Retrieve returns the credentials or error if the credentials are invalid. 41 | func (s *StaticProvider) Retrieve() (Value, error) { 42 | if s.AccessKeyID == "" || s.SecretAccessKey == "" { 43 | return Value{ProviderName: StaticProviderName}, ErrStaticCredentialsEmpty 44 | } 45 | 46 | if len(s.Value.ProviderName) == 0 { 47 | s.Value.ProviderName = StaticProviderName 48 | } 49 | return s.Value, nil 50 | } 51 | 52 | // IsExpired returns if the credentials are expired. 53 | // 54 | // For StaticProvider, the credentials never expired. 55 | func (s *StaticProvider) IsExpired() bool { 56 | return false 57 | } 58 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/aws/defaults/shared_config.go: -------------------------------------------------------------------------------- 1 | package defaults 2 | 3 | import ( 4 | "github.com/aws/aws-sdk-go/internal/shareddefaults" 5 | ) 6 | 7 | // SharedCredentialsFilename returns the SDK's default file path 8 | // for the shared credentials file. 9 | // 10 | // Builds the shared config file path based on the OS's platform. 11 | // 12 | // - Linux/Unix: $HOME/.aws/credentials 13 | // - Windows: %USERPROFILE%\.aws\credentials 14 | func SharedCredentialsFilename() string { 15 | return shareddefaults.SharedCredentialsFilename() 16 | } 17 | 18 | // SharedConfigFilename returns the SDK's default file path for 19 | // the shared config file. 20 | // 21 | // Builds the shared config file path based on the OS's platform. 22 | // 23 | // - Linux/Unix: $HOME/.aws/config 24 | // - Windows: %USERPROFILE%\.aws\config 25 | func SharedConfigFilename() string { 26 | return shareddefaults.SharedConfigFilename() 27 | } 28 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/aws/errors.go: -------------------------------------------------------------------------------- 1 | package aws 2 | 3 | import "github.com/aws/aws-sdk-go/aws/awserr" 4 | 5 | var ( 6 | // ErrMissingRegion is an error that is returned if region configuration is 7 | // not found. 8 | // 9 | // @readonly 10 | ErrMissingRegion = awserr.New("MissingRegion", "could not find region configuration", nil) 11 | 12 | // ErrMissingEndpoint is an error that is returned if an endpoint cannot be 13 | // resolved for a service. 14 | // 15 | // @readonly 16 | ErrMissingEndpoint = awserr.New("MissingEndpoint", "'Endpoint' configuration is required for this service", nil) 17 | ) 18 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/aws/jsonvalue.go: -------------------------------------------------------------------------------- 1 | package aws 2 | 3 | // JSONValue is a representation of a grab bag type that will be marshaled 4 | // into a json string. This type can be used just like any other map. 5 | // 6 | // Example: 7 | // 8 | // values := aws.JSONValue{ 9 | // "Foo": "Bar", 10 | // } 11 | // values["Baz"] = "Qux" 12 | type JSONValue map[string]interface{} 13 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/aws/request/connection_reset_error.go: -------------------------------------------------------------------------------- 1 | // +build !appengine,!plan9 2 | 3 | package request 4 | 5 | import ( 6 | "net" 7 | "os" 8 | "syscall" 9 | ) 10 | 11 | func isErrConnectionReset(err error) bool { 12 | if opErr, ok := err.(*net.OpError); ok { 13 | if sysErr, ok := opErr.Err.(*os.SyscallError); ok { 14 | return sysErr.Err == syscall.ECONNRESET 15 | } 16 | } 17 | 18 | return false 19 | } 20 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/aws/request/connection_reset_error_other.go: -------------------------------------------------------------------------------- 1 | // +build appengine plan9 2 | 3 | package request 4 | 5 | import ( 6 | "strings" 7 | ) 8 | 9 | func isErrConnectionReset(err error) bool { 10 | return strings.Contains(err.Error(), "connection reset") 11 | } 12 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/aws/request/http_request.go: -------------------------------------------------------------------------------- 1 | package request 2 | 3 | import ( 4 | "io" 5 | "net/http" 6 | "net/url" 7 | ) 8 | 9 | func copyHTTPRequest(r *http.Request, body io.ReadCloser) *http.Request { 10 | req := new(http.Request) 11 | *req = *r 12 | req.URL = &url.URL{} 13 | *req.URL = *r.URL 14 | req.Body = body 15 | 16 | req.Header = http.Header{} 17 | for k, v := range r.Header { 18 | for _, vv := range v { 19 | req.Header.Add(k, vv) 20 | } 21 | } 22 | 23 | return req 24 | } 25 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/aws/request/offset_reader.go: -------------------------------------------------------------------------------- 1 | package request 2 | 3 | import ( 4 | "io" 5 | "sync" 6 | ) 7 | 8 | // offsetReader is a thread-safe io.ReadCloser to prevent racing 9 | // with retrying requests 10 | type offsetReader struct { 11 | buf io.ReadSeeker 12 | lock sync.Mutex 13 | closed bool 14 | } 15 | 16 | func newOffsetReader(buf io.ReadSeeker, offset int64) *offsetReader { 17 | reader := &offsetReader{} 18 | buf.Seek(offset, 0) 19 | 20 | reader.buf = buf 21 | return reader 22 | } 23 | 24 | // Close will close the instance of the offset reader's access to 25 | // the underlying io.ReadSeeker. 26 | func (o *offsetReader) Close() error { 27 | o.lock.Lock() 28 | defer o.lock.Unlock() 29 | o.closed = true 30 | return nil 31 | } 32 | 33 | // Read is a thread-safe read of the underlying io.ReadSeeker 34 | func (o *offsetReader) Read(p []byte) (int, error) { 35 | o.lock.Lock() 36 | defer o.lock.Unlock() 37 | 38 | if o.closed { 39 | return 0, io.EOF 40 | } 41 | 42 | return o.buf.Read(p) 43 | } 44 | 45 | // Seek is a thread-safe seeking operation. 46 | func (o *offsetReader) Seek(offset int64, whence int) (int64, error) { 47 | o.lock.Lock() 48 | defer o.lock.Unlock() 49 | 50 | return o.buf.Seek(offset, whence) 51 | } 52 | 53 | // CloseAndCopy will return a new offsetReader with a copy of the old buffer 54 | // and close the old buffer. 55 | func (o *offsetReader) CloseAndCopy(offset int64) *offsetReader { 56 | o.Close() 57 | return newOffsetReader(o.buf, offset) 58 | } 59 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/aws/request/request_1_7.go: -------------------------------------------------------------------------------- 1 | // +build !go1.8 2 | 3 | package request 4 | 5 | import "io" 6 | 7 | // NoBody is an io.ReadCloser with no bytes. Read always returns EOF 8 | // and Close always returns nil. It can be used in an outgoing client 9 | // request to explicitly signal that a request has zero bytes. 10 | // An alternative, however, is to simply set Request.Body to nil. 11 | // 12 | // Copy of Go 1.8 NoBody type from net/http/http.go 13 | type noBody struct{} 14 | 15 | func (noBody) Read([]byte) (int, error) { return 0, io.EOF } 16 | func (noBody) Close() error { return nil } 17 | func (noBody) WriteTo(io.Writer) (int64, error) { return 0, nil } 18 | 19 | // NoBody is an empty reader that will trigger the Go HTTP client to not include 20 | // and body in the HTTP request. 21 | var NoBody = noBody{} 22 | 23 | // ResetBody rewinds the request body back to its starting position, and 24 | // set's the HTTP Request body reference. When the body is read prior 25 | // to being sent in the HTTP request it will need to be rewound. 26 | // 27 | // ResetBody will automatically be called by the SDK's build handler, but if 28 | // the request is being used directly ResetBody must be called before the request 29 | // is Sent. SetStringBody, SetBufferBody, and SetReaderBody will automatically 30 | // call ResetBody. 31 | func (r *Request) ResetBody() { 32 | body, err := r.getNextRequestBody() 33 | if err != nil { 34 | r.Error = err 35 | return 36 | } 37 | 38 | r.HTTPRequest.Body = body 39 | } 40 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/aws/request/request_1_8.go: -------------------------------------------------------------------------------- 1 | // +build go1.8 2 | 3 | package request 4 | 5 | import ( 6 | "net/http" 7 | ) 8 | 9 | // NoBody is a http.NoBody reader instructing Go HTTP client to not include 10 | // and body in the HTTP request. 11 | var NoBody = http.NoBody 12 | 13 | // ResetBody rewinds the request body back to its starting position, and 14 | // set's the HTTP Request body reference. When the body is read prior 15 | // to being sent in the HTTP request it will need to be rewound. 16 | // 17 | // ResetBody will automatically be called by the SDK's build handler, but if 18 | // the request is being used directly ResetBody must be called before the request 19 | // is Sent. SetStringBody, SetBufferBody, and SetReaderBody will automatically 20 | // call ResetBody. 21 | // 22 | // Will also set the Go 1.8's http.Request.GetBody member to allow retrying 23 | // PUT/POST redirects. 24 | func (r *Request) ResetBody() { 25 | body, err := r.getNextRequestBody() 26 | if err != nil { 27 | r.Error = err 28 | return 29 | } 30 | 31 | r.HTTPRequest.Body = body 32 | r.HTTPRequest.GetBody = r.getNextRequestBody 33 | } 34 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/aws/request/request_context.go: -------------------------------------------------------------------------------- 1 | // +build go1.7 2 | 3 | package request 4 | 5 | import "github.com/aws/aws-sdk-go/aws" 6 | 7 | // setContext updates the Request to use the passed in context for cancellation. 8 | // Context will also be used for request retry delay. 9 | // 10 | // Creates shallow copy of the http.Request with the WithContext method. 11 | func setRequestContext(r *Request, ctx aws.Context) { 12 | r.context = ctx 13 | r.HTTPRequest = r.HTTPRequest.WithContext(ctx) 14 | } 15 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/aws/request/request_context_1_6.go: -------------------------------------------------------------------------------- 1 | // +build !go1.7 2 | 3 | package request 4 | 5 | import "github.com/aws/aws-sdk-go/aws" 6 | 7 | // setContext updates the Request to use the passed in context for cancellation. 8 | // Context will also be used for request retry delay. 9 | // 10 | // Creates shallow copy of the http.Request with the WithContext method. 11 | func setRequestContext(r *Request, ctx aws.Context) { 12 | r.context = ctx 13 | r.HTTPRequest.Cancel = ctx.Done() 14 | } 15 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/aws/signer/v4/header_rules.go: -------------------------------------------------------------------------------- 1 | package v4 2 | 3 | import ( 4 | "net/http" 5 | "strings" 6 | ) 7 | 8 | // validator houses a set of rule needed for validation of a 9 | // string value 10 | type rules []rule 11 | 12 | // rule interface allows for more flexible rules and just simply 13 | // checks whether or not a value adheres to that rule 14 | type rule interface { 15 | IsValid(value string) bool 16 | } 17 | 18 | // IsValid will iterate through all rules and see if any rules 19 | // apply to the value and supports nested rules 20 | func (r rules) IsValid(value string) bool { 21 | for _, rule := range r { 22 | if rule.IsValid(value) { 23 | return true 24 | } 25 | } 26 | return false 27 | } 28 | 29 | // mapRule generic rule for maps 30 | type mapRule map[string]struct{} 31 | 32 | // IsValid for the map rule satisfies whether it exists in the map 33 | func (m mapRule) IsValid(value string) bool { 34 | _, ok := m[value] 35 | return ok 36 | } 37 | 38 | // whitelist is a generic rule for whitelisting 39 | type whitelist struct { 40 | rule 41 | } 42 | 43 | // IsValid for whitelist checks if the value is within the whitelist 44 | func (w whitelist) IsValid(value string) bool { 45 | return w.rule.IsValid(value) 46 | } 47 | 48 | // blacklist is a generic rule for blacklisting 49 | type blacklist struct { 50 | rule 51 | } 52 | 53 | // IsValid for whitelist checks if the value is within the whitelist 54 | func (b blacklist) IsValid(value string) bool { 55 | return !b.rule.IsValid(value) 56 | } 57 | 58 | type patterns []string 59 | 60 | // IsValid for patterns checks each pattern and returns if a match has 61 | // been found 62 | func (p patterns) IsValid(value string) bool { 63 | for _, pattern := range p { 64 | if strings.HasPrefix(http.CanonicalHeaderKey(value), pattern) { 65 | return true 66 | } 67 | } 68 | return false 69 | } 70 | 71 | // inclusiveRules rules allow for rules to depend on one another 72 | type inclusiveRules []rule 73 | 74 | // IsValid will return true if all rules are true 75 | func (r inclusiveRules) IsValid(value string) bool { 76 | for _, rule := range r { 77 | if !rule.IsValid(value) { 78 | return false 79 | } 80 | } 81 | return true 82 | } 83 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/aws/signer/v4/options.go: -------------------------------------------------------------------------------- 1 | package v4 2 | 3 | // WithUnsignedPayload will enable and set the UnsignedPayload field to 4 | // true of the signer. 5 | func WithUnsignedPayload(v4 *Signer) { 6 | v4.UnsignedPayload = true 7 | } 8 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/aws/signer/v4/uri_path.go: -------------------------------------------------------------------------------- 1 | // +build go1.5 2 | 3 | package v4 4 | 5 | import ( 6 | "net/url" 7 | "strings" 8 | ) 9 | 10 | func getURIPath(u *url.URL) string { 11 | var uri string 12 | 13 | if len(u.Opaque) > 0 { 14 | uri = "/" + strings.Join(strings.Split(u.Opaque, "/")[3:], "/") 15 | } else { 16 | uri = u.EscapedPath() 17 | } 18 | 19 | if len(uri) == 0 { 20 | uri = "/" 21 | } 22 | 23 | return uri 24 | } 25 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/aws/url.go: -------------------------------------------------------------------------------- 1 | // +build go1.8 2 | 3 | package aws 4 | 5 | import "net/url" 6 | 7 | // URLHostname will extract the Hostname without port from the URL value. 8 | // 9 | // Wrapper of net/url#URL.Hostname for backwards Go version compatibility. 10 | func URLHostname(url *url.URL) string { 11 | return url.Hostname() 12 | } 13 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/aws/url_1_7.go: -------------------------------------------------------------------------------- 1 | // +build !go1.8 2 | 3 | package aws 4 | 5 | import ( 6 | "net/url" 7 | "strings" 8 | ) 9 | 10 | // URLHostname will extract the Hostname without port from the URL value. 11 | // 12 | // Copy of Go 1.8's net/url#URL.Hostname functionality. 13 | func URLHostname(url *url.URL) string { 14 | return stripPort(url.Host) 15 | 16 | } 17 | 18 | // stripPort is copy of Go 1.8 url#URL.Hostname functionality. 19 | // https://golang.org/src/net/url/url.go 20 | func stripPort(hostport string) string { 21 | colon := strings.IndexByte(hostport, ':') 22 | if colon == -1 { 23 | return hostport 24 | } 25 | if i := strings.IndexByte(hostport, ']'); i != -1 { 26 | return strings.TrimPrefix(hostport[:i], "[") 27 | } 28 | return hostport[:colon] 29 | } 30 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/aws/version.go: -------------------------------------------------------------------------------- 1 | // Package aws provides core functionality for making requests to AWS services. 2 | package aws 3 | 4 | // SDKName is the name of this AWS SDK 5 | const SDKName = "aws-sdk-go" 6 | 7 | // SDKVersion is the version of this SDK 8 | const SDKVersion = "1.8.44" 9 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/internal/shareddefaults/shared_config.go: -------------------------------------------------------------------------------- 1 | package shareddefaults 2 | 3 | import ( 4 | "os" 5 | "path/filepath" 6 | "runtime" 7 | ) 8 | 9 | // SharedCredentialsFilename returns the SDK's default file path 10 | // for the shared credentials file. 11 | // 12 | // Builds the shared config file path based on the OS's platform. 13 | // 14 | // - Linux/Unix: $HOME/.aws/credentials 15 | // - Windows: %USERPROFILE%\.aws\credentials 16 | func SharedCredentialsFilename() string { 17 | return filepath.Join(UserHomeDir(), ".aws", "credentials") 18 | } 19 | 20 | // SharedConfigFilename returns the SDK's default file path for 21 | // the shared config file. 22 | // 23 | // Builds the shared config file path based on the OS's platform. 24 | // 25 | // - Linux/Unix: $HOME/.aws/config 26 | // - Windows: %USERPROFILE%\.aws\config 27 | func SharedConfigFilename() string { 28 | return filepath.Join(UserHomeDir(), ".aws", "config") 29 | } 30 | 31 | // UserHomeDir returns the home directory for the user the process is 32 | // running under. 33 | func UserHomeDir() string { 34 | if runtime.GOOS == "windows" { // Windows 35 | return os.Getenv("USERPROFILE") 36 | } 37 | 38 | // *nix 39 | return os.Getenv("HOME") 40 | } 41 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/private/protocol/ec2query/build.go: -------------------------------------------------------------------------------- 1 | // Package ec2query provides serialization of AWS EC2 requests and responses. 2 | package ec2query 3 | 4 | //go:generate go run -tags codegen ../../../models/protocol_tests/generate.go ../../../models/protocol_tests/input/ec2.json build_test.go 5 | 6 | import ( 7 | "net/url" 8 | 9 | "github.com/aws/aws-sdk-go/aws/awserr" 10 | "github.com/aws/aws-sdk-go/aws/request" 11 | "github.com/aws/aws-sdk-go/private/protocol/query/queryutil" 12 | ) 13 | 14 | // BuildHandler is a named request handler for building ec2query protocol requests 15 | var BuildHandler = request.NamedHandler{Name: "awssdk.ec2query.Build", Fn: Build} 16 | 17 | // Build builds a request for the EC2 protocol. 18 | func Build(r *request.Request) { 19 | body := url.Values{ 20 | "Action": {r.Operation.Name}, 21 | "Version": {r.ClientInfo.APIVersion}, 22 | } 23 | if err := queryutil.Parse(body, r.Params, true); err != nil { 24 | r.Error = awserr.New("SerializationError", "failed encoding EC2 Query request", err) 25 | } 26 | 27 | if r.ExpireTime == 0 { 28 | r.HTTPRequest.Method = "POST" 29 | r.HTTPRequest.Header.Set("Content-Type", "application/x-www-form-urlencoded; charset=utf-8") 30 | r.SetBufferBody([]byte(body.Encode())) 31 | } else { // This is a pre-signed request 32 | r.HTTPRequest.Method = "GET" 33 | r.HTTPRequest.URL.RawQuery = body.Encode() 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/private/protocol/query/build.go: -------------------------------------------------------------------------------- 1 | // Package query provides serialization of AWS query requests, and responses. 2 | package query 3 | 4 | //go:generate go run -tags codegen ../../../models/protocol_tests/generate.go ../../../models/protocol_tests/input/query.json build_test.go 5 | 6 | import ( 7 | "net/url" 8 | 9 | "github.com/aws/aws-sdk-go/aws/awserr" 10 | "github.com/aws/aws-sdk-go/aws/request" 11 | "github.com/aws/aws-sdk-go/private/protocol/query/queryutil" 12 | ) 13 | 14 | // BuildHandler is a named request handler for building query protocol requests 15 | var BuildHandler = request.NamedHandler{Name: "awssdk.query.Build", Fn: Build} 16 | 17 | // Build builds a request for an AWS Query service. 18 | func Build(r *request.Request) { 19 | body := url.Values{ 20 | "Action": {r.Operation.Name}, 21 | "Version": {r.ClientInfo.APIVersion}, 22 | } 23 | if err := queryutil.Parse(body, r.Params, false); err != nil { 24 | r.Error = awserr.New("SerializationError", "failed encoding Query request", err) 25 | return 26 | } 27 | 28 | if r.ExpireTime == 0 { 29 | r.HTTPRequest.Method = "POST" 30 | r.HTTPRequest.Header.Set("Content-Type", "application/x-www-form-urlencoded; charset=utf-8") 31 | r.SetBufferBody([]byte(body.Encode())) 32 | } else { // This is a pre-signed request 33 | r.HTTPRequest.Method = "GET" 34 | r.HTTPRequest.URL.RawQuery = body.Encode() 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/private/protocol/query/unmarshal.go: -------------------------------------------------------------------------------- 1 | package query 2 | 3 | //go:generate go run -tags codegen ../../../models/protocol_tests/generate.go ../../../models/protocol_tests/output/query.json unmarshal_test.go 4 | 5 | import ( 6 | "encoding/xml" 7 | 8 | "github.com/aws/aws-sdk-go/aws/awserr" 9 | "github.com/aws/aws-sdk-go/aws/request" 10 | "github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil" 11 | ) 12 | 13 | // UnmarshalHandler is a named request handler for unmarshaling query protocol requests 14 | var UnmarshalHandler = request.NamedHandler{Name: "awssdk.query.Unmarshal", Fn: Unmarshal} 15 | 16 | // UnmarshalMetaHandler is a named request handler for unmarshaling query protocol request metadata 17 | var UnmarshalMetaHandler = request.NamedHandler{Name: "awssdk.query.UnmarshalMeta", Fn: UnmarshalMeta} 18 | 19 | // Unmarshal unmarshals a response for an AWS Query service. 20 | func Unmarshal(r *request.Request) { 21 | defer r.HTTPResponse.Body.Close() 22 | if r.DataFilled() { 23 | decoder := xml.NewDecoder(r.HTTPResponse.Body) 24 | err := xmlutil.UnmarshalXML(r.Data, decoder, r.Operation.Name+"Result") 25 | if err != nil { 26 | r.Error = awserr.New("SerializationError", "failed decoding Query response", err) 27 | return 28 | } 29 | } 30 | } 31 | 32 | // UnmarshalMeta unmarshals header response values for an AWS Query service. 33 | func UnmarshalMeta(r *request.Request) { 34 | r.RequestID = r.HTTPResponse.Header.Get("X-Amzn-Requestid") 35 | } 36 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/private/protocol/query/unmarshal_error.go: -------------------------------------------------------------------------------- 1 | package query 2 | 3 | import ( 4 | "encoding/xml" 5 | "io/ioutil" 6 | 7 | "github.com/aws/aws-sdk-go/aws/awserr" 8 | "github.com/aws/aws-sdk-go/aws/request" 9 | ) 10 | 11 | type xmlErrorResponse struct { 12 | XMLName xml.Name `xml:"ErrorResponse"` 13 | Code string `xml:"Error>Code"` 14 | Message string `xml:"Error>Message"` 15 | RequestID string `xml:"RequestId"` 16 | } 17 | 18 | type xmlServiceUnavailableResponse struct { 19 | XMLName xml.Name `xml:"ServiceUnavailableException"` 20 | } 21 | 22 | // UnmarshalErrorHandler is a name request handler to unmarshal request errors 23 | var UnmarshalErrorHandler = request.NamedHandler{Name: "awssdk.query.UnmarshalError", Fn: UnmarshalError} 24 | 25 | // UnmarshalError unmarshals an error response for an AWS Query service. 26 | func UnmarshalError(r *request.Request) { 27 | defer r.HTTPResponse.Body.Close() 28 | 29 | bodyBytes, err := ioutil.ReadAll(r.HTTPResponse.Body) 30 | if err != nil { 31 | r.Error = awserr.New("SerializationError", "failed to read from query HTTP response body", err) 32 | return 33 | } 34 | 35 | // First check for specific error 36 | resp := xmlErrorResponse{} 37 | decodeErr := xml.Unmarshal(bodyBytes, &resp) 38 | if decodeErr == nil { 39 | reqID := resp.RequestID 40 | if reqID == "" { 41 | reqID = r.RequestID 42 | } 43 | r.Error = awserr.NewRequestFailure( 44 | awserr.New(resp.Code, resp.Message, nil), 45 | r.HTTPResponse.StatusCode, 46 | reqID, 47 | ) 48 | return 49 | } 50 | 51 | // Check for unhandled error 52 | servUnavailResp := xmlServiceUnavailableResponse{} 53 | unavailErr := xml.Unmarshal(bodyBytes, &servUnavailResp) 54 | if unavailErr == nil { 55 | r.Error = awserr.NewRequestFailure( 56 | awserr.New("ServiceUnavailableException", "service is unavailable", nil), 57 | r.HTTPResponse.StatusCode, 58 | r.RequestID, 59 | ) 60 | return 61 | } 62 | 63 | // Failed to retrieve any error message from the response body 64 | r.Error = awserr.New("SerializationError", 65 | "failed to decode query XML error response", decodeErr) 66 | } 67 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/private/protocol/rest/payload.go: -------------------------------------------------------------------------------- 1 | package rest 2 | 3 | import "reflect" 4 | 5 | // PayloadMember returns the payload field member of i if there is one, or nil. 6 | func PayloadMember(i interface{}) interface{} { 7 | if i == nil { 8 | return nil 9 | } 10 | 11 | v := reflect.ValueOf(i).Elem() 12 | if !v.IsValid() { 13 | return nil 14 | } 15 | if field, ok := v.Type().FieldByName("_"); ok { 16 | if payloadName := field.Tag.Get("payload"); payloadName != "" { 17 | field, _ := v.Type().FieldByName(payloadName) 18 | if field.Tag.Get("type") != "structure" { 19 | return nil 20 | } 21 | 22 | payload := v.FieldByName(payloadName) 23 | if payload.IsValid() || (payload.Kind() == reflect.Ptr && !payload.IsNil()) { 24 | return payload.Interface() 25 | } 26 | } 27 | } 28 | return nil 29 | } 30 | 31 | // PayloadType returns the type of a payload field member of i if there is one, or "". 32 | func PayloadType(i interface{}) string { 33 | v := reflect.Indirect(reflect.ValueOf(i)) 34 | if !v.IsValid() { 35 | return "" 36 | } 37 | if field, ok := v.Type().FieldByName("_"); ok { 38 | if payloadName := field.Tag.Get("payload"); payloadName != "" { 39 | if member, ok := v.Type().FieldByName(payloadName); ok { 40 | return member.Tag.Get("type") 41 | } 42 | } 43 | } 44 | return "" 45 | } 46 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/private/protocol/unmarshal.go: -------------------------------------------------------------------------------- 1 | package protocol 2 | 3 | import ( 4 | "io" 5 | "io/ioutil" 6 | 7 | "github.com/aws/aws-sdk-go/aws/request" 8 | ) 9 | 10 | // UnmarshalDiscardBodyHandler is a named request handler to empty and close a response's body 11 | var UnmarshalDiscardBodyHandler = request.NamedHandler{Name: "awssdk.shared.UnmarshalDiscardBody", Fn: UnmarshalDiscardBody} 12 | 13 | // UnmarshalDiscardBody is a request handler to empty a response's body and closing it. 14 | func UnmarshalDiscardBody(r *request.Request) { 15 | if r.HTTPResponse == nil || r.HTTPResponse.Body == nil { 16 | return 17 | } 18 | 19 | io.Copy(ioutil.Discard, r.HTTPResponse.Body) 20 | r.HTTPResponse.Body.Close() 21 | } 22 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/service/autoscaling/errors.go: -------------------------------------------------------------------------------- 1 | // Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. 2 | 3 | package autoscaling 4 | 5 | const ( 6 | 7 | // ErrCodeAlreadyExistsFault for service response error code 8 | // "AlreadyExists". 9 | // 10 | // You already have an Auto Scaling group or launch configuration with this 11 | // name. 12 | ErrCodeAlreadyExistsFault = "AlreadyExists" 13 | 14 | // ErrCodeInvalidNextToken for service response error code 15 | // "InvalidNextToken". 16 | // 17 | // The NextToken value is not valid. 18 | ErrCodeInvalidNextToken = "InvalidNextToken" 19 | 20 | // ErrCodeLimitExceededFault for service response error code 21 | // "LimitExceeded". 22 | // 23 | // You have already reached a limit for your Auto Scaling resources (for example, 24 | // groups, launch configurations, or lifecycle hooks). For more information, 25 | // see DescribeAccountLimits. 26 | ErrCodeLimitExceededFault = "LimitExceeded" 27 | 28 | // ErrCodeResourceContentionFault for service response error code 29 | // "ResourceContention". 30 | // 31 | // You already have a pending update to an Auto Scaling resource (for example, 32 | // a group, instance, or load balancer). 33 | ErrCodeResourceContentionFault = "ResourceContention" 34 | 35 | // ErrCodeResourceInUseFault for service response error code 36 | // "ResourceInUse". 37 | // 38 | // The operation can't be performed because the resource is in use. 39 | ErrCodeResourceInUseFault = "ResourceInUse" 40 | 41 | // ErrCodeScalingActivityInProgressFault for service response error code 42 | // "ScalingActivityInProgress". 43 | // 44 | // The operation can't be performed because there are scaling activities in 45 | // progress. 46 | ErrCodeScalingActivityInProgressFault = "ScalingActivityInProgress" 47 | ) 48 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/service/ec2/customizations.go: -------------------------------------------------------------------------------- 1 | package ec2 2 | 3 | import ( 4 | "time" 5 | 6 | "github.com/aws/aws-sdk-go/aws" 7 | "github.com/aws/aws-sdk-go/aws/awsutil" 8 | "github.com/aws/aws-sdk-go/aws/endpoints" 9 | "github.com/aws/aws-sdk-go/aws/request" 10 | ) 11 | 12 | func init() { 13 | initRequest = func(r *request.Request) { 14 | if r.Operation.Name == opCopySnapshot { // fill the PresignedURL parameter 15 | r.Handlers.Build.PushFront(fillPresignedURL) 16 | } 17 | } 18 | } 19 | 20 | func fillPresignedURL(r *request.Request) { 21 | if !r.ParamsFilled() { 22 | return 23 | } 24 | 25 | origParams := r.Params.(*CopySnapshotInput) 26 | 27 | // Stop if PresignedURL/DestinationRegion is set 28 | if origParams.PresignedUrl != nil || origParams.DestinationRegion != nil { 29 | return 30 | } 31 | 32 | origParams.DestinationRegion = r.Config.Region 33 | newParams := awsutil.CopyOf(r.Params).(*CopySnapshotInput) 34 | 35 | // Create a new request based on the existing request. We will use this to 36 | // presign the CopySnapshot request against the source region. 37 | cfg := r.Config.Copy(aws.NewConfig(). 38 | WithEndpoint(""). 39 | WithRegion(aws.StringValue(origParams.SourceRegion))) 40 | 41 | clientInfo := r.ClientInfo 42 | resolved, err := r.Config.EndpointResolver.EndpointFor( 43 | clientInfo.ServiceName, aws.StringValue(cfg.Region), 44 | func(opt *endpoints.Options) { 45 | opt.DisableSSL = aws.BoolValue(cfg.DisableSSL) 46 | opt.UseDualStack = aws.BoolValue(cfg.UseDualStack) 47 | }, 48 | ) 49 | if err != nil { 50 | r.Error = err 51 | return 52 | } 53 | 54 | clientInfo.Endpoint = resolved.URL 55 | clientInfo.SigningRegion = resolved.SigningRegion 56 | 57 | // Presign a CopySnapshot request with modified params 58 | req := request.New(*cfg, clientInfo, r.Handlers, r.Retryer, r.Operation, newParams, r.Data) 59 | url, err := req.Presign(5 * time.Minute) // 5 minutes should be enough. 60 | if err != nil { // bubble error back up to original request 61 | r.Error = err 62 | return 63 | } 64 | 65 | // We have our URL, set it on params 66 | origParams.PresignedUrl = &url 67 | } 68 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/service/ec2/errors.go: -------------------------------------------------------------------------------- 1 | // Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. 2 | 3 | package ec2 4 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/service/resourcegroupstaggingapi/errors.go: -------------------------------------------------------------------------------- 1 | // Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. 2 | 3 | package resourcegroupstaggingapi 4 | 5 | const ( 6 | 7 | // ErrCodeInternalServiceException for service response error code 8 | // "InternalServiceException". 9 | // 10 | // The request processing failed because of an unknown error, exception, or 11 | // failure. You can retry the request. 12 | ErrCodeInternalServiceException = "InternalServiceException" 13 | 14 | // ErrCodeInvalidParameterException for service response error code 15 | // "InvalidParameterException". 16 | // 17 | // A parameter is missing or a malformed string or invalid or out-of-range value 18 | // was supplied for the request parameter. 19 | ErrCodeInvalidParameterException = "InvalidParameterException" 20 | 21 | // ErrCodePaginationTokenExpiredException for service response error code 22 | // "PaginationTokenExpiredException". 23 | // 24 | // A PaginationToken is valid for a maximum of 15 minutes. Your request was 25 | // denied because the specified PaginationToken has expired. 26 | ErrCodePaginationTokenExpiredException = "PaginationTokenExpiredException" 27 | 28 | // ErrCodeThrottledException for service response error code 29 | // "ThrottledException". 30 | // 31 | // The request was denied to limit the frequency of submitted requests. 32 | ErrCodeThrottledException = "ThrottledException" 33 | ) 34 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/service/route53/customizations.go: -------------------------------------------------------------------------------- 1 | package route53 2 | 3 | import ( 4 | "net/url" 5 | "regexp" 6 | 7 | "github.com/aws/aws-sdk-go/aws/awserr" 8 | "github.com/aws/aws-sdk-go/aws/client" 9 | "github.com/aws/aws-sdk-go/aws/request" 10 | "github.com/aws/aws-sdk-go/private/protocol/restxml" 11 | ) 12 | 13 | func init() { 14 | initClient = func(c *client.Client) { 15 | c.Handlers.Build.PushBack(sanitizeURL) 16 | } 17 | 18 | initRequest = func(r *request.Request) { 19 | switch r.Operation.Name { 20 | case opChangeResourceRecordSets: 21 | r.Handlers.UnmarshalError.Remove(restxml.UnmarshalErrorHandler) 22 | r.Handlers.UnmarshalError.PushBack(unmarshalChangeResourceRecordSetsError) 23 | } 24 | } 25 | } 26 | 27 | var reSanitizeURL = regexp.MustCompile(`\/%2F\w+%2F`) 28 | 29 | func sanitizeURL(r *request.Request) { 30 | r.HTTPRequest.URL.RawPath = 31 | reSanitizeURL.ReplaceAllString(r.HTTPRequest.URL.RawPath, "/") 32 | 33 | // Update Path so that it reflects the cleaned RawPath 34 | updated, err := url.Parse(r.HTTPRequest.URL.RawPath) 35 | if err != nil { 36 | r.Error = awserr.New("SerializationError", "failed to clean Route53 URL", err) 37 | return 38 | } 39 | 40 | // Take the updated path so the requests's URL Path has parity with RawPath. 41 | r.HTTPRequest.URL.Path = updated.Path 42 | } 43 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/service/route53/unmarshal_error.go: -------------------------------------------------------------------------------- 1 | package route53 2 | 3 | import ( 4 | "bytes" 5 | "encoding/xml" 6 | "io/ioutil" 7 | 8 | "github.com/aws/aws-sdk-go/aws/awserr" 9 | "github.com/aws/aws-sdk-go/aws/request" 10 | "github.com/aws/aws-sdk-go/private/protocol/restxml" 11 | ) 12 | 13 | type baseXMLErrorResponse struct { 14 | XMLName xml.Name 15 | } 16 | 17 | type standardXMLErrorResponse struct { 18 | XMLName xml.Name `xml:"ErrorResponse"` 19 | Code string `xml:"Error>Code"` 20 | Message string `xml:"Error>Message"` 21 | RequestID string `xml:"RequestId"` 22 | } 23 | 24 | type invalidChangeBatchXMLErrorResponse struct { 25 | XMLName xml.Name `xml:"InvalidChangeBatch"` 26 | Messages []string `xml:"Messages>Message"` 27 | } 28 | 29 | func unmarshalChangeResourceRecordSetsError(r *request.Request) { 30 | defer r.HTTPResponse.Body.Close() 31 | 32 | responseBody, err := ioutil.ReadAll(r.HTTPResponse.Body) 33 | 34 | if err != nil { 35 | r.Error = awserr.New("SerializationError", "failed to read Route53 XML error response", err) 36 | return 37 | } 38 | 39 | baseError := &baseXMLErrorResponse{} 40 | 41 | if err := xml.Unmarshal(responseBody, baseError); err != nil { 42 | r.Error = awserr.New("SerializationError", "failed to decode Route53 XML error response", err) 43 | return 44 | } 45 | 46 | switch baseError.XMLName.Local { 47 | case "InvalidChangeBatch": 48 | unmarshalInvalidChangeBatchError(r, responseBody) 49 | default: 50 | r.HTTPResponse.Body = ioutil.NopCloser(bytes.NewReader(responseBody)) 51 | restxml.UnmarshalError(r) 52 | } 53 | } 54 | 55 | func unmarshalInvalidChangeBatchError(r *request.Request, requestBody []byte) { 56 | resp := &invalidChangeBatchXMLErrorResponse{} 57 | err := xml.Unmarshal(requestBody, resp) 58 | 59 | if err != nil { 60 | r.Error = awserr.New("SerializationError", "failed to decode query XML error response", err) 61 | return 62 | } 63 | 64 | const errorCode = "InvalidChangeBatch" 65 | errors := []error{} 66 | 67 | for _, msg := range resp.Messages { 68 | errors = append(errors, awserr.New(errorCode, msg, nil)) 69 | } 70 | 71 | r.Error = awserr.NewRequestFailure( 72 | awserr.NewBatchError(errorCode, "ChangeBatch errors occurred", errors), 73 | r.HTTPResponse.StatusCode, 74 | r.RequestID, 75 | ) 76 | 77 | } 78 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/service/route53/waiters.go: -------------------------------------------------------------------------------- 1 | // Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. 2 | 3 | package route53 4 | 5 | import ( 6 | "time" 7 | 8 | "github.com/aws/aws-sdk-go/aws" 9 | "github.com/aws/aws-sdk-go/aws/request" 10 | ) 11 | 12 | // WaitUntilResourceRecordSetsChanged uses the Route 53 API operation 13 | // GetChange to wait for a condition to be met before returning. 14 | // If the condition is not meet within the max attempt window an error will 15 | // be returned. 16 | func (c *Route53) WaitUntilResourceRecordSetsChanged(input *GetChangeInput) error { 17 | return c.WaitUntilResourceRecordSetsChangedWithContext(aws.BackgroundContext(), input) 18 | } 19 | 20 | // WaitUntilResourceRecordSetsChangedWithContext is an extended version of WaitUntilResourceRecordSetsChanged. 21 | // With the support for passing in a context and options to configure the 22 | // Waiter and the underlying request options. 23 | // 24 | // The context must be non-nil and will be used for request cancellation. If 25 | // the context is nil a panic will occur. In the future the SDK may create 26 | // sub-contexts for http.Requests. See https://golang.org/pkg/context/ 27 | // for more information on using Contexts. 28 | func (c *Route53) WaitUntilResourceRecordSetsChangedWithContext(ctx aws.Context, input *GetChangeInput, opts ...request.WaiterOption) error { 29 | w := request.Waiter{ 30 | Name: "WaitUntilResourceRecordSetsChanged", 31 | MaxAttempts: 60, 32 | Delay: request.ConstantWaiterDelay(30 * time.Second), 33 | Acceptors: []request.WaiterAcceptor{ 34 | { 35 | State: request.SuccessWaiterState, 36 | Matcher: request.PathWaiterMatch, Argument: "ChangeInfo.Status", 37 | Expected: "INSYNC", 38 | }, 39 | }, 40 | Logger: c.Config.Logger, 41 | NewRequest: func(opts []request.Option) (*request.Request, error) { 42 | var inCpy *GetChangeInput 43 | if input != nil { 44 | tmp := *input 45 | inCpy = &tmp 46 | } 47 | req, _ := c.GetChangeRequest(inCpy) 48 | req.SetContext(ctx) 49 | req.ApplyOptions(opts...) 50 | return req, nil 51 | }, 52 | } 53 | w.ApplyOptions(opts...) 54 | 55 | return w.WaitWithContext(ctx) 56 | } 57 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/service/s3/content_md5.go: -------------------------------------------------------------------------------- 1 | package s3 2 | 3 | import ( 4 | "crypto/md5" 5 | "encoding/base64" 6 | "io" 7 | 8 | "github.com/aws/aws-sdk-go/aws/awserr" 9 | "github.com/aws/aws-sdk-go/aws/request" 10 | ) 11 | 12 | // contentMD5 computes and sets the HTTP Content-MD5 header for requests that 13 | // require it. 14 | func contentMD5(r *request.Request) { 15 | h := md5.New() 16 | 17 | // hash the body. seek back to the first position after reading to reset 18 | // the body for transmission. copy errors may be assumed to be from the 19 | // body. 20 | _, err := io.Copy(h, r.Body) 21 | if err != nil { 22 | r.Error = awserr.New("ContentMD5", "failed to read body", err) 23 | return 24 | } 25 | _, err = r.Body.Seek(0, 0) 26 | if err != nil { 27 | r.Error = awserr.New("ContentMD5", "failed to seek body", err) 28 | return 29 | } 30 | 31 | // encode the md5 checksum in base64 and set the request header. 32 | sum := h.Sum(nil) 33 | sum64 := make([]byte, base64.StdEncoding.EncodedLen(len(sum))) 34 | base64.StdEncoding.Encode(sum64, sum) 35 | r.HTTPRequest.Header.Set("Content-MD5", string(sum64)) 36 | } 37 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/service/s3/customizations.go: -------------------------------------------------------------------------------- 1 | package s3 2 | 3 | import ( 4 | "github.com/aws/aws-sdk-go/aws/client" 5 | "github.com/aws/aws-sdk-go/aws/request" 6 | ) 7 | 8 | func init() { 9 | initClient = defaultInitClientFn 10 | initRequest = defaultInitRequestFn 11 | } 12 | 13 | func defaultInitClientFn(c *client.Client) { 14 | // Support building custom endpoints based on config 15 | c.Handlers.Build.PushFront(updateEndpointForS3Config) 16 | 17 | // Require SSL when using SSE keys 18 | c.Handlers.Validate.PushBack(validateSSERequiresSSL) 19 | c.Handlers.Build.PushBack(computeSSEKeys) 20 | 21 | // S3 uses custom error unmarshaling logic 22 | c.Handlers.UnmarshalError.Clear() 23 | c.Handlers.UnmarshalError.PushBack(unmarshalError) 24 | } 25 | 26 | func defaultInitRequestFn(r *request.Request) { 27 | // Add reuest handlers for specific platforms. 28 | // e.g. 100-continue support for PUT requests using Go 1.6 29 | platformRequestHandlers(r) 30 | 31 | switch r.Operation.Name { 32 | case opPutBucketCors, opPutBucketLifecycle, opPutBucketPolicy, 33 | opPutBucketTagging, opDeleteObjects, opPutBucketLifecycleConfiguration, 34 | opPutBucketReplication: 35 | // These S3 operations require Content-MD5 to be set 36 | r.Handlers.Build.PushBack(contentMD5) 37 | case opGetBucketLocation: 38 | // GetBucketLocation has custom parsing logic 39 | r.Handlers.Unmarshal.PushFront(buildGetBucketLocation) 40 | case opCreateBucket: 41 | // Auto-populate LocationConstraint with current region 42 | r.Handlers.Validate.PushFront(populateLocationConstraint) 43 | case opCopyObject, opUploadPartCopy, opCompleteMultipartUpload: 44 | r.Handlers.Unmarshal.PushFront(copyMultipartStatusOKUnmarhsalError) 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/service/s3/errors.go: -------------------------------------------------------------------------------- 1 | // Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. 2 | 3 | package s3 4 | 5 | const ( 6 | 7 | // ErrCodeBucketAlreadyExists for service response error code 8 | // "BucketAlreadyExists". 9 | // 10 | // The requested bucket name is not available. The bucket namespace is shared 11 | // by all users of the system. Please select a different name and try again. 12 | ErrCodeBucketAlreadyExists = "BucketAlreadyExists" 13 | 14 | // ErrCodeBucketAlreadyOwnedByYou for service response error code 15 | // "BucketAlreadyOwnedByYou". 16 | ErrCodeBucketAlreadyOwnedByYou = "BucketAlreadyOwnedByYou" 17 | 18 | // ErrCodeNoSuchBucket for service response error code 19 | // "NoSuchBucket". 20 | // 21 | // The specified bucket does not exist. 22 | ErrCodeNoSuchBucket = "NoSuchBucket" 23 | 24 | // ErrCodeNoSuchKey for service response error code 25 | // "NoSuchKey". 26 | // 27 | // The specified key does not exist. 28 | ErrCodeNoSuchKey = "NoSuchKey" 29 | 30 | // ErrCodeNoSuchUpload for service response error code 31 | // "NoSuchUpload". 32 | // 33 | // The specified multipart upload does not exist. 34 | ErrCodeNoSuchUpload = "NoSuchUpload" 35 | 36 | // ErrCodeObjectAlreadyInActiveTierError for service response error code 37 | // "ObjectAlreadyInActiveTierError". 38 | // 39 | // This operation is not allowed against this storage tier 40 | ErrCodeObjectAlreadyInActiveTierError = "ObjectAlreadyInActiveTierError" 41 | 42 | // ErrCodeObjectNotInActiveTierError for service response error code 43 | // "ObjectNotInActiveTierError". 44 | // 45 | // The source object of the COPY operation is not in the active tier and is 46 | // only stored in Amazon Glacier. 47 | ErrCodeObjectNotInActiveTierError = "ObjectNotInActiveTierError" 48 | ) 49 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/service/s3/platform_handlers.go: -------------------------------------------------------------------------------- 1 | // +build !go1.6 2 | 3 | package s3 4 | 5 | import "github.com/aws/aws-sdk-go/aws/request" 6 | 7 | func platformRequestHandlers(r *request.Request) { 8 | } 9 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/service/s3/platform_handlers_go1.6.go: -------------------------------------------------------------------------------- 1 | // +build go1.6 2 | 3 | package s3 4 | 5 | import ( 6 | "github.com/aws/aws-sdk-go/aws" 7 | "github.com/aws/aws-sdk-go/aws/request" 8 | ) 9 | 10 | func platformRequestHandlers(r *request.Request) { 11 | if r.Operation.HTTPMethod == "PUT" { 12 | // 100-Continue should only be used on put requests. 13 | r.Handlers.Sign.PushBack(add100Continue) 14 | } 15 | } 16 | 17 | func add100Continue(r *request.Request) { 18 | if aws.BoolValue(r.Config.S3Disable100Continue) { 19 | return 20 | } 21 | if r.HTTPRequest.ContentLength < 1024*1024*2 { 22 | // Ignore requests smaller than 2MB. This helps prevent delaying 23 | // requests unnecessarily. 24 | return 25 | } 26 | 27 | r.HTTPRequest.Header.Set("Expect", "100-Continue") 28 | } 29 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/service/s3/sse.go: -------------------------------------------------------------------------------- 1 | package s3 2 | 3 | import ( 4 | "crypto/md5" 5 | "encoding/base64" 6 | 7 | "github.com/aws/aws-sdk-go/aws/awserr" 8 | "github.com/aws/aws-sdk-go/aws/awsutil" 9 | "github.com/aws/aws-sdk-go/aws/request" 10 | ) 11 | 12 | var errSSERequiresSSL = awserr.New("ConfigError", "cannot send SSE keys over HTTP.", nil) 13 | 14 | func validateSSERequiresSSL(r *request.Request) { 15 | if r.HTTPRequest.URL.Scheme != "https" { 16 | p, _ := awsutil.ValuesAtPath(r.Params, "SSECustomerKey||CopySourceSSECustomerKey") 17 | if len(p) > 0 { 18 | r.Error = errSSERequiresSSL 19 | } 20 | } 21 | } 22 | 23 | func computeSSEKeys(r *request.Request) { 24 | headers := []string{ 25 | "x-amz-server-side-encryption-customer-key", 26 | "x-amz-copy-source-server-side-encryption-customer-key", 27 | } 28 | 29 | for _, h := range headers { 30 | md5h := h + "-md5" 31 | if key := r.HTTPRequest.Header.Get(h); key != "" { 32 | // Base64-encode the value 33 | b64v := base64.StdEncoding.EncodeToString([]byte(key)) 34 | r.HTTPRequest.Header.Set(h, b64v) 35 | 36 | // Add MD5 if it wasn't computed 37 | if r.HTTPRequest.Header.Get(md5h) == "" { 38 | sum := md5.Sum([]byte(key)) 39 | b64sum := base64.StdEncoding.EncodeToString(sum[:]) 40 | r.HTTPRequest.Header.Set(md5h, b64sum) 41 | } 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/service/s3/statusok_error.go: -------------------------------------------------------------------------------- 1 | package s3 2 | 3 | import ( 4 | "bytes" 5 | "io/ioutil" 6 | "net/http" 7 | 8 | "github.com/aws/aws-sdk-go/aws/awserr" 9 | "github.com/aws/aws-sdk-go/aws/request" 10 | ) 11 | 12 | func copyMultipartStatusOKUnmarhsalError(r *request.Request) { 13 | b, err := ioutil.ReadAll(r.HTTPResponse.Body) 14 | if err != nil { 15 | r.Error = awserr.New("SerializationError", "unable to read response body", err) 16 | return 17 | } 18 | body := bytes.NewReader(b) 19 | r.HTTPResponse.Body = ioutil.NopCloser(body) 20 | defer body.Seek(0, 0) 21 | 22 | if body.Len() == 0 { 23 | // If there is no body don't attempt to parse the body. 24 | return 25 | } 26 | 27 | unmarshalError(r) 28 | if err, ok := r.Error.(awserr.Error); ok && err != nil { 29 | if err.Code() == "SerializationError" { 30 | r.Error = nil 31 | return 32 | } 33 | r.HTTPResponse.StatusCode = http.StatusServiceUnavailable 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/service/sts/customizations.go: -------------------------------------------------------------------------------- 1 | package sts 2 | 3 | import "github.com/aws/aws-sdk-go/aws/request" 4 | 5 | func init() { 6 | initRequest = func(r *request.Request) { 7 | switch r.Operation.Name { 8 | case opAssumeRoleWithSAML, opAssumeRoleWithWebIdentity: 9 | r.Handlers.Sign.Clear() // these operations are unsigned 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /vendor/github.com/estroz/jqpipe-go/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2014, threatGRID 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 18 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 20 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 21 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 22 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 23 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- /vendor/github.com/fsnotify/fsnotify/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2012 The Go Authors. All rights reserved. 2 | Copyright (c) 2012 fsnotify Authors. All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are 6 | met: 7 | 8 | * Redistributions of source code must retain the above copyright 9 | notice, this list of conditions and the following disclaimer. 10 | * Redistributions in binary form must reproduce the above 11 | copyright notice, this list of conditions and the following disclaimer 12 | in the documentation and/or other materials provided with the 13 | distribution. 14 | * Neither the name of Google Inc. nor the names of its 15 | contributors may be used to endorse or promote products derived from 16 | this software without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | -------------------------------------------------------------------------------- /vendor/github.com/fsnotify/fsnotify/fen.go: -------------------------------------------------------------------------------- 1 | // Copyright 2010 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build solaris 6 | 7 | package fsnotify 8 | 9 | import ( 10 | "errors" 11 | ) 12 | 13 | // Watcher watches a set of files, delivering events to a channel. 14 | type Watcher struct { 15 | Events chan Event 16 | Errors chan error 17 | } 18 | 19 | // NewWatcher establishes a new watcher with the underlying OS and begins waiting for events. 20 | func NewWatcher() (*Watcher, error) { 21 | return nil, errors.New("FEN based watcher not yet supported for fsnotify\n") 22 | } 23 | 24 | // Close removes all watches and closes the events channel. 25 | func (w *Watcher) Close() error { 26 | return nil 27 | } 28 | 29 | // Add starts watching the named file or directory (non-recursively). 30 | func (w *Watcher) Add(name string) error { 31 | return nil 32 | } 33 | 34 | // Remove stops watching the the named file or directory (non-recursively). 35 | func (w *Watcher) Remove(name string) error { 36 | return nil 37 | } 38 | -------------------------------------------------------------------------------- /vendor/github.com/fsnotify/fsnotify/fsnotify.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !plan9 6 | 7 | // Package fsnotify provides a platform-independent interface for file system notifications. 8 | package fsnotify 9 | 10 | import ( 11 | "bytes" 12 | "errors" 13 | "fmt" 14 | ) 15 | 16 | // Event represents a single file system notification. 17 | type Event struct { 18 | Name string // Relative path to the file or directory. 19 | Op Op // File operation that triggered the event. 20 | } 21 | 22 | // Op describes a set of file operations. 23 | type Op uint32 24 | 25 | // These are the generalized file operations that can trigger a notification. 26 | const ( 27 | Create Op = 1 << iota 28 | Write 29 | Remove 30 | Rename 31 | Chmod 32 | ) 33 | 34 | func (op Op) String() string { 35 | // Use a buffer for efficient string concatenation 36 | var buffer bytes.Buffer 37 | 38 | if op&Create == Create { 39 | buffer.WriteString("|CREATE") 40 | } 41 | if op&Remove == Remove { 42 | buffer.WriteString("|REMOVE") 43 | } 44 | if op&Write == Write { 45 | buffer.WriteString("|WRITE") 46 | } 47 | if op&Rename == Rename { 48 | buffer.WriteString("|RENAME") 49 | } 50 | if op&Chmod == Chmod { 51 | buffer.WriteString("|CHMOD") 52 | } 53 | if buffer.Len() == 0 { 54 | return "" 55 | } 56 | return buffer.String()[1:] // Strip leading pipe 57 | } 58 | 59 | // String returns a string representation of the event in the form 60 | // "file: REMOVE|WRITE|..." 61 | func (e Event) String() string { 62 | return fmt.Sprintf("%q: %s", e.Name, e.Op.String()) 63 | } 64 | 65 | // Common errors that can be reported by a watcher 66 | var ErrEventOverflow = errors.New("fsnotify queue overflow") 67 | -------------------------------------------------------------------------------- /vendor/github.com/fsnotify/fsnotify/open_mode_bsd.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build freebsd openbsd netbsd dragonfly 6 | 7 | package fsnotify 8 | 9 | import "golang.org/x/sys/unix" 10 | 11 | const openMode = unix.O_NONBLOCK | unix.O_RDONLY 12 | -------------------------------------------------------------------------------- /vendor/github.com/fsnotify/fsnotify/open_mode_darwin.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build darwin 6 | 7 | package fsnotify 8 | 9 | import "golang.org/x/sys/unix" 10 | 11 | // note: this constant is not defined on BSD 12 | const openMode = unix.O_EVTONLY 13 | -------------------------------------------------------------------------------- /vendor/github.com/go-ini/ini/error.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 Unknwon 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"): you may 4 | // not use this file except in compliance with the License. You may obtain 5 | // a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 | // License for the specific language governing permissions and limitations 13 | // under the License. 14 | 15 | package ini 16 | 17 | import ( 18 | "fmt" 19 | ) 20 | 21 | type ErrDelimiterNotFound struct { 22 | Line string 23 | } 24 | 25 | func IsErrDelimiterNotFound(err error) bool { 26 | _, ok := err.(ErrDelimiterNotFound) 27 | return ok 28 | } 29 | 30 | func (err ErrDelimiterNotFound) Error() string { 31 | return fmt.Sprintf("key-value delimiter not found: %s", err.Line) 32 | } 33 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/hcl/hcl.go: -------------------------------------------------------------------------------- 1 | // Package hcl decodes HCL into usable Go structures. 2 | // 3 | // hcl input can come in either pure HCL format or JSON format. 4 | // It can be parsed into an AST, and then decoded into a structure, 5 | // or it can be decoded directly from a string into a structure. 6 | // 7 | // If you choose to parse HCL into a raw AST, the benefit is that you 8 | // can write custom visitor implementations to implement custom 9 | // semantic checks. By default, HCL does not perform any semantic 10 | // checks. 11 | package hcl 12 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/hcl/hcl/ast/walk.go: -------------------------------------------------------------------------------- 1 | package ast 2 | 3 | import "fmt" 4 | 5 | // WalkFunc describes a function to be called for each node during a Walk. The 6 | // returned node can be used to rewrite the AST. Walking stops the returned 7 | // bool is false. 8 | type WalkFunc func(Node) (Node, bool) 9 | 10 | // Walk traverses an AST in depth-first order: It starts by calling fn(node); 11 | // node must not be nil. If fn returns true, Walk invokes fn recursively for 12 | // each of the non-nil children of node, followed by a call of fn(nil). The 13 | // returned node of fn can be used to rewrite the passed node to fn. 14 | func Walk(node Node, fn WalkFunc) Node { 15 | rewritten, ok := fn(node) 16 | if !ok { 17 | return rewritten 18 | } 19 | 20 | switch n := node.(type) { 21 | case *File: 22 | n.Node = Walk(n.Node, fn) 23 | case *ObjectList: 24 | for i, item := range n.Items { 25 | n.Items[i] = Walk(item, fn).(*ObjectItem) 26 | } 27 | case *ObjectKey: 28 | // nothing to do 29 | case *ObjectItem: 30 | for i, k := range n.Keys { 31 | n.Keys[i] = Walk(k, fn).(*ObjectKey) 32 | } 33 | 34 | if n.Val != nil { 35 | n.Val = Walk(n.Val, fn) 36 | } 37 | case *LiteralType: 38 | // nothing to do 39 | case *ListType: 40 | for i, l := range n.List { 41 | n.List[i] = Walk(l, fn) 42 | } 43 | case *ObjectType: 44 | n.List = Walk(n.List, fn).(*ObjectList) 45 | default: 46 | // should we panic here? 47 | fmt.Printf("unknown type: %T\n", n) 48 | } 49 | 50 | fn(nil) 51 | return rewritten 52 | } 53 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/hcl/hcl/parser/error.go: -------------------------------------------------------------------------------- 1 | package parser 2 | 3 | import ( 4 | "fmt" 5 | 6 | "github.com/hashicorp/hcl/hcl/token" 7 | ) 8 | 9 | // PosError is a parse error that contains a position. 10 | type PosError struct { 11 | Pos token.Pos 12 | Err error 13 | } 14 | 15 | func (e *PosError) Error() string { 16 | return fmt.Sprintf("At %s: %s", e.Pos, e.Err) 17 | } 18 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/hcl/hcl/token/position.go: -------------------------------------------------------------------------------- 1 | package token 2 | 3 | import "fmt" 4 | 5 | // Pos describes an arbitrary source position 6 | // including the file, line, and column location. 7 | // A Position is valid if the line number is > 0. 8 | type Pos struct { 9 | Filename string // filename, if any 10 | Offset int // offset, starting at 0 11 | Line int // line number, starting at 1 12 | Column int // column number, starting at 1 (character count) 13 | } 14 | 15 | // IsValid returns true if the position is valid. 16 | func (p *Pos) IsValid() bool { return p.Line > 0 } 17 | 18 | // String returns a string in one of several forms: 19 | // 20 | // file:line:column valid position with file name 21 | // line:column valid position without file name 22 | // file invalid position with file name 23 | // - invalid position without file name 24 | func (p Pos) String() string { 25 | s := p.Filename 26 | if p.IsValid() { 27 | if s != "" { 28 | s += ":" 29 | } 30 | s += fmt.Sprintf("%d:%d", p.Line, p.Column) 31 | } 32 | if s == "" { 33 | s = "-" 34 | } 35 | return s 36 | } 37 | 38 | // Before reports whether the position p is before u. 39 | func (p Pos) Before(u Pos) bool { 40 | return u.Offset > p.Offset || u.Line > p.Line 41 | } 42 | 43 | // After reports whether the position p is after u. 44 | func (p Pos) After(u Pos) bool { 45 | return u.Offset < p.Offset || u.Line < p.Line 46 | } 47 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/hcl/json/token/position.go: -------------------------------------------------------------------------------- 1 | package token 2 | 3 | import "fmt" 4 | 5 | // Pos describes an arbitrary source position 6 | // including the file, line, and column location. 7 | // A Position is valid if the line number is > 0. 8 | type Pos struct { 9 | Filename string // filename, if any 10 | Offset int // offset, starting at 0 11 | Line int // line number, starting at 1 12 | Column int // column number, starting at 1 (character count) 13 | } 14 | 15 | // IsValid returns true if the position is valid. 16 | func (p *Pos) IsValid() bool { return p.Line > 0 } 17 | 18 | // String returns a string in one of several forms: 19 | // 20 | // file:line:column valid position with file name 21 | // line:column valid position without file name 22 | // file invalid position with file name 23 | // - invalid position without file name 24 | func (p Pos) String() string { 25 | s := p.Filename 26 | if p.IsValid() { 27 | if s != "" { 28 | s += ":" 29 | } 30 | s += fmt.Sprintf("%d:%d", p.Line, p.Column) 31 | } 32 | if s == "" { 33 | s = "-" 34 | } 35 | return s 36 | } 37 | 38 | // Before reports whether the position p is before u. 39 | func (p Pos) Before(u Pos) bool { 40 | return u.Offset > p.Offset || u.Line > p.Line 41 | } 42 | 43 | // After reports whether the position p is after u. 44 | func (p Pos) After(u Pos) bool { 45 | return u.Offset < p.Offset || u.Line < p.Line 46 | } 47 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/hcl/lex.go: -------------------------------------------------------------------------------- 1 | package hcl 2 | 3 | import ( 4 | "unicode" 5 | "unicode/utf8" 6 | ) 7 | 8 | type lexModeValue byte 9 | 10 | const ( 11 | lexModeUnknown lexModeValue = iota 12 | lexModeHcl 13 | lexModeJson 14 | ) 15 | 16 | // lexMode returns whether we're going to be parsing in JSON 17 | // mode or HCL mode. 18 | func lexMode(v []byte) lexModeValue { 19 | var ( 20 | r rune 21 | w int 22 | offset int 23 | ) 24 | 25 | for { 26 | r, w = utf8.DecodeRune(v[offset:]) 27 | offset += w 28 | if unicode.IsSpace(r) { 29 | continue 30 | } 31 | if r == '{' { 32 | return lexModeJson 33 | } 34 | break 35 | } 36 | 37 | return lexModeHcl 38 | } 39 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/hcl/parse.go: -------------------------------------------------------------------------------- 1 | package hcl 2 | 3 | import ( 4 | "fmt" 5 | 6 | "github.com/hashicorp/hcl/hcl/ast" 7 | hclParser "github.com/hashicorp/hcl/hcl/parser" 8 | jsonParser "github.com/hashicorp/hcl/json/parser" 9 | ) 10 | 11 | // ParseBytes accepts as input byte slice and returns ast tree. 12 | // 13 | // Input can be either JSON or HCL 14 | func ParseBytes(in []byte) (*ast.File, error) { 15 | return parse(in) 16 | } 17 | 18 | // ParseString accepts input as a string and returns ast tree. 19 | func ParseString(input string) (*ast.File, error) { 20 | return parse([]byte(input)) 21 | } 22 | 23 | func parse(in []byte) (*ast.File, error) { 24 | switch lexMode(in) { 25 | case lexModeHcl: 26 | return hclParser.Parse(in) 27 | case lexModeJson: 28 | return jsonParser.Parse(in) 29 | } 30 | 31 | return nil, fmt.Errorf("unknown config format") 32 | } 33 | 34 | // Parse parses the given input and returns the root object. 35 | // 36 | // The input format can be either HCL or JSON. 37 | func Parse(input string) (*ast.File, error) { 38 | return parse([]byte(input)) 39 | } 40 | -------------------------------------------------------------------------------- /vendor/github.com/inconshreveable/mousetrap/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2014 Alan Shreve 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | -------------------------------------------------------------------------------- /vendor/github.com/inconshreveable/mousetrap/trap_others.go: -------------------------------------------------------------------------------- 1 | // +build !windows 2 | 3 | package mousetrap 4 | 5 | // StartedByExplorer returns true if the program was invoked by the user 6 | // double-clicking on the executable from explorer.exe 7 | // 8 | // It is conservative and returns false if any of the internal calls fail. 9 | // It does not guarantee that the program was run from a terminal. It only can tell you 10 | // whether it was launched from explorer.exe 11 | // 12 | // On non-Windows platforms, it always returns false. 13 | func StartedByExplorer() bool { 14 | return false 15 | } 16 | -------------------------------------------------------------------------------- /vendor/github.com/inconshreveable/mousetrap/trap_windows_1.4.go: -------------------------------------------------------------------------------- 1 | // +build windows 2 | // +build go1.4 3 | 4 | package mousetrap 5 | 6 | import ( 7 | "os" 8 | "syscall" 9 | "unsafe" 10 | ) 11 | 12 | func getProcessEntry(pid int) (*syscall.ProcessEntry32, error) { 13 | snapshot, err := syscall.CreateToolhelp32Snapshot(syscall.TH32CS_SNAPPROCESS, 0) 14 | if err != nil { 15 | return nil, err 16 | } 17 | defer syscall.CloseHandle(snapshot) 18 | var procEntry syscall.ProcessEntry32 19 | procEntry.Size = uint32(unsafe.Sizeof(procEntry)) 20 | if err = syscall.Process32First(snapshot, &procEntry); err != nil { 21 | return nil, err 22 | } 23 | for { 24 | if procEntry.ProcessID == uint32(pid) { 25 | return &procEntry, nil 26 | } 27 | err = syscall.Process32Next(snapshot, &procEntry) 28 | if err != nil { 29 | return nil, err 30 | } 31 | } 32 | } 33 | 34 | // StartedByExplorer returns true if the program was invoked by the user double-clicking 35 | // on the executable from explorer.exe 36 | // 37 | // It is conservative and returns false if any of the internal calls fail. 38 | // It does not guarantee that the program was run from a terminal. It only can tell you 39 | // whether it was launched from explorer.exe 40 | func StartedByExplorer() bool { 41 | pe, err := getProcessEntry(os.Getppid()) 42 | if err != nil { 43 | return false 44 | } 45 | return "explorer.exe" == syscall.UTF16ToString(pe.ExeFile[:]) 46 | } 47 | -------------------------------------------------------------------------------- /vendor/github.com/jmespath/go-jmespath/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2015 James Saryerwinnie 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | -------------------------------------------------------------------------------- /vendor/github.com/jmespath/go-jmespath/api.go: -------------------------------------------------------------------------------- 1 | package jmespath 2 | 3 | import "strconv" 4 | 5 | // JmesPath is the epresentation of a compiled JMES path query. A JmesPath is 6 | // safe for concurrent use by multiple goroutines. 7 | type JMESPath struct { 8 | ast ASTNode 9 | intr *treeInterpreter 10 | } 11 | 12 | // Compile parses a JMESPath expression and returns, if successful, a JMESPath 13 | // object that can be used to match against data. 14 | func Compile(expression string) (*JMESPath, error) { 15 | parser := NewParser() 16 | ast, err := parser.Parse(expression) 17 | if err != nil { 18 | return nil, err 19 | } 20 | jmespath := &JMESPath{ast: ast, intr: newInterpreter()} 21 | return jmespath, nil 22 | } 23 | 24 | // MustCompile is like Compile but panics if the expression cannot be parsed. 25 | // It simplifies safe initialization of global variables holding compiled 26 | // JMESPaths. 27 | func MustCompile(expression string) *JMESPath { 28 | jmespath, err := Compile(expression) 29 | if err != nil { 30 | panic(`jmespath: Compile(` + strconv.Quote(expression) + `): ` + err.Error()) 31 | } 32 | return jmespath 33 | } 34 | 35 | // Search evaluates a JMESPath expression against input data and returns the result. 36 | func (jp *JMESPath) Search(data interface{}) (interface{}, error) { 37 | return jp.intr.Execute(jp.ast, data) 38 | } 39 | 40 | // Search evaluates a JMESPath expression against input data and returns the result. 41 | func Search(expression string, data interface{}) (interface{}, error) { 42 | intr := newInterpreter() 43 | parser := NewParser() 44 | ast, err := parser.Parse(expression) 45 | if err != nil { 46 | return nil, err 47 | } 48 | return intr.Execute(ast, data) 49 | } 50 | -------------------------------------------------------------------------------- /vendor/github.com/jmespath/go-jmespath/astnodetype_string.go: -------------------------------------------------------------------------------- 1 | // generated by stringer -type astNodeType; DO NOT EDIT 2 | 3 | package jmespath 4 | 5 | import "fmt" 6 | 7 | const _astNodeType_name = "ASTEmptyASTComparatorASTCurrentNodeASTExpRefASTFunctionExpressionASTFieldASTFilterProjectionASTFlattenASTIdentityASTIndexASTIndexExpressionASTKeyValPairASTLiteralASTMultiSelectHashASTMultiSelectListASTOrExpressionASTAndExpressionASTNotExpressionASTPipeASTProjectionASTSubexpressionASTSliceASTValueProjection" 8 | 9 | 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} 10 | 11 | func (i astNodeType) String() string { 12 | if i < 0 || i >= astNodeType(len(_astNodeType_index)-1) { 13 | return fmt.Sprintf("astNodeType(%d)", i) 14 | } 15 | return _astNodeType_name[_astNodeType_index[i]:_astNodeType_index[i+1]] 16 | } 17 | -------------------------------------------------------------------------------- /vendor/github.com/jmespath/go-jmespath/toktype_string.go: -------------------------------------------------------------------------------- 1 | // generated by stringer -type=tokType; DO NOT EDIT 2 | 3 | package jmespath 4 | 5 | import "fmt" 6 | 7 | const _tokType_name = "tUnknowntStartDottFiltertFlattentLparentRparentLbrackettRbrackettLbracetRbracetOrtPipetNumbertUnquotedIdentifiertQuotedIdentifiertCommatColontLTtLTEtGTtGTEtEQtNEtJSONLiteraltStringLiteraltCurrenttExpreftAndtNottEOF" 8 | 9 | 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} 10 | 11 | func (i tokType) String() string { 12 | if i < 0 || i >= tokType(len(_tokType_index)-1) { 13 | return fmt.Sprintf("tokType(%d)", i) 14 | } 15 | return _tokType_name[_tokType_index[i]:_tokType_index[i+1]] 16 | } 17 | -------------------------------------------------------------------------------- /vendor/github.com/magiconair/properties/LICENSE: -------------------------------------------------------------------------------- 1 | goproperties - properties file decoder for Go 2 | 3 | Copyright (c) 2013-2014 - Frank Schroeder 4 | 5 | All rights reserved. 6 | 7 | Redistribution and use in source and binary forms, with or without 8 | modification, are permitted provided that the following conditions are met: 9 | 10 | 1. Redistributions of source code must retain the above copyright notice, this 11 | list of conditions and the following disclaimer. 12 | 2. Redistributions in binary form must reproduce the above copyright notice, 13 | this list of conditions and the following disclaimer in the documentation 14 | and/or other materials provided with the distribution. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 20 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | -------------------------------------------------------------------------------- /vendor/github.com/magiconair/properties/integrate.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 Frank Schroeder. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package properties 6 | 7 | import "flag" 8 | 9 | // MustFlag sets flags that are skipped by dst.Parse when p contains 10 | // the respective key for flag.Flag.Name. 11 | // 12 | // It's use is recommended with command line arguments as in: 13 | // flag.Parse() 14 | // p.MustFlag(flag.CommandLine) 15 | func (p *Properties) MustFlag(dst *flag.FlagSet) { 16 | m := make(map[string]*flag.Flag) 17 | dst.VisitAll(func(f *flag.Flag) { 18 | m[f.Name] = f 19 | }) 20 | dst.Visit(func(f *flag.Flag) { 21 | delete(m, f.Name) // overridden 22 | }) 23 | 24 | for name, f := range m { 25 | v, ok := p.Get(name) 26 | if !ok { 27 | continue 28 | } 29 | 30 | if err := f.Value.Set(v); err != nil { 31 | ErrorHandler(err) 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /vendor/github.com/magiconair/properties/parser.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 Frank Schroeder. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package properties 6 | 7 | import ( 8 | "fmt" 9 | "runtime" 10 | ) 11 | 12 | type parser struct { 13 | lex *lexer 14 | } 15 | 16 | func parse(input string) (properties *Properties, err error) { 17 | p := &parser{lex: lex(input)} 18 | defer p.recover(&err) 19 | 20 | properties = NewProperties() 21 | key := "" 22 | comments := []string{} 23 | 24 | for { 25 | token := p.expectOneOf(itemComment, itemKey, itemEOF) 26 | switch token.typ { 27 | case itemEOF: 28 | goto done 29 | case itemComment: 30 | comments = append(comments, token.val) 31 | continue 32 | case itemKey: 33 | key = token.val 34 | if _, ok := properties.m[key]; !ok { 35 | properties.k = append(properties.k, key) 36 | } 37 | } 38 | 39 | token = p.expectOneOf(itemValue, itemEOF) 40 | if len(comments) > 0 { 41 | properties.c[key] = comments 42 | comments = []string{} 43 | } 44 | switch token.typ { 45 | case itemEOF: 46 | properties.m[key] = "" 47 | goto done 48 | case itemValue: 49 | properties.m[key] = token.val 50 | } 51 | } 52 | 53 | done: 54 | return properties, nil 55 | } 56 | 57 | func (p *parser) errorf(format string, args ...interface{}) { 58 | format = fmt.Sprintf("properties: Line %d: %s", p.lex.lineNumber(), format) 59 | panic(fmt.Errorf(format, args...)) 60 | } 61 | 62 | func (p *parser) expect(expected itemType) (token item) { 63 | token = p.lex.nextItem() 64 | if token.typ != expected { 65 | p.unexpected(token) 66 | } 67 | return token 68 | } 69 | 70 | func (p *parser) expectOneOf(expected ...itemType) (token item) { 71 | token = p.lex.nextItem() 72 | for _, v := range expected { 73 | if token.typ == v { 74 | return token 75 | } 76 | } 77 | p.unexpected(token) 78 | panic("unexpected token") 79 | } 80 | 81 | func (p *parser) unexpected(token item) { 82 | p.errorf(token.String()) 83 | } 84 | 85 | // recover is the handler that turns panics into returns from the top level of Parse. 86 | func (p *parser) recover(errp *error) { 87 | e := recover() 88 | if e != nil { 89 | if _, ok := e.(runtime.Error); ok { 90 | panic(e) 91 | } 92 | *errp = e.(error) 93 | } 94 | return 95 | } 96 | -------------------------------------------------------------------------------- /vendor/github.com/magiconair/properties/rangecheck.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 Frank Schroeder. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package properties 6 | 7 | import ( 8 | "fmt" 9 | "math" 10 | ) 11 | 12 | // make this a var to overwrite it in a test 13 | var is32Bit = ^uint(0) == math.MaxUint32 14 | 15 | // intRangeCheck checks if the value fits into the int type and 16 | // panics if it does not. 17 | func intRangeCheck(key string, v int64) int { 18 | if is32Bit && (v < math.MinInt32 || v > math.MaxInt32) { 19 | panic(fmt.Sprintf("Value %d for key %s out of range", v, key)) 20 | } 21 | return int(v) 22 | } 23 | 24 | // uintRangeCheck checks if the value fits into the uint type and 25 | // panics if it does not. 26 | func uintRangeCheck(key string, v uint64) uint { 27 | if is32Bit && v > math.MaxUint32 { 28 | panic(fmt.Sprintf("Value %d for key %s out of range", v, key)) 29 | } 30 | return uint(v) 31 | } 32 | -------------------------------------------------------------------------------- /vendor/github.com/mitchellh/mapstructure/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2013 Mitchell Hashimoto 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /vendor/github.com/mitchellh/mapstructure/error.go: -------------------------------------------------------------------------------- 1 | package mapstructure 2 | 3 | import ( 4 | "errors" 5 | "fmt" 6 | "sort" 7 | "strings" 8 | ) 9 | 10 | // Error implements the error interface and can represents multiple 11 | // errors that occur in the course of a single decode. 12 | type Error struct { 13 | Errors []string 14 | } 15 | 16 | func (e *Error) Error() string { 17 | points := make([]string, len(e.Errors)) 18 | for i, err := range e.Errors { 19 | points[i] = fmt.Sprintf("* %s", err) 20 | } 21 | 22 | sort.Strings(points) 23 | return fmt.Sprintf( 24 | "%d error(s) decoding:\n\n%s", 25 | len(e.Errors), strings.Join(points, "\n")) 26 | } 27 | 28 | // WrappedErrors implements the errwrap.Wrapper interface to make this 29 | // return value more useful with the errwrap and go-multierror libraries. 30 | func (e *Error) WrappedErrors() []error { 31 | if e == nil { 32 | return nil 33 | } 34 | 35 | result := make([]error, len(e.Errors)) 36 | for i, e := range e.Errors { 37 | result[i] = errors.New(e) 38 | } 39 | 40 | return result 41 | } 42 | 43 | func appendErrors(errors []string, err error) []string { 44 | switch e := err.(type) { 45 | case *Error: 46 | return append(errors, e.Errors...) 47 | default: 48 | return append(errors, e.Error()) 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /vendor/github.com/pelletier/go-toml/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2013 - 2017 Thomas Pelletier, Eric Anderton 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /vendor/github.com/pelletier/go-toml/doc.go: -------------------------------------------------------------------------------- 1 | // Package toml is a TOML parser and manipulation library. 2 | // 3 | // This version supports the specification as described in 4 | // https://github.com/toml-lang/toml/blob/master/versions/en/toml-v0.4.0.md 5 | // 6 | // Marshaling 7 | // 8 | // Go-toml can marshal and unmarshal TOML documents from and to data 9 | // structures. 10 | // 11 | // TOML document as a tree 12 | // 13 | // Go-toml can operate on a TOML document as a tree. Use one of the Load* 14 | // functions to parse TOML data and obtain a Tree instance, then one of its 15 | // methods to manipulate the tree. 16 | // 17 | // JSONPath-like queries 18 | // 19 | // The package github.com/pelletier/go-toml/query implements a system 20 | // similar to JSONPath to quickly retrive elements of a TOML document using a 21 | // single expression. See the package documentation for more information. 22 | // 23 | package toml 24 | -------------------------------------------------------------------------------- /vendor/github.com/pelletier/go-toml/keysparsing.go: -------------------------------------------------------------------------------- 1 | // Parsing keys handling both bare and quoted keys. 2 | 3 | package toml 4 | 5 | import ( 6 | "bytes" 7 | "errors" 8 | "fmt" 9 | "unicode" 10 | ) 11 | 12 | func parseKey(key string) ([]string, error) { 13 | groups := []string{} 14 | var buffer bytes.Buffer 15 | inQuotes := false 16 | wasInQuotes := false 17 | escapeNext := false 18 | ignoreSpace := true 19 | expectDot := false 20 | 21 | for _, char := range key { 22 | if ignoreSpace { 23 | if char == ' ' { 24 | continue 25 | } 26 | ignoreSpace = false 27 | } 28 | if escapeNext { 29 | buffer.WriteRune(char) 30 | escapeNext = false 31 | continue 32 | } 33 | switch char { 34 | case '\\': 35 | escapeNext = true 36 | continue 37 | case '"': 38 | if inQuotes { 39 | groups = append(groups, buffer.String()) 40 | buffer.Reset() 41 | wasInQuotes = true 42 | } 43 | inQuotes = !inQuotes 44 | expectDot = false 45 | case '.': 46 | if inQuotes { 47 | buffer.WriteRune(char) 48 | } else { 49 | if !wasInQuotes { 50 | if buffer.Len() == 0 { 51 | return nil, errors.New("empty table key") 52 | } 53 | groups = append(groups, buffer.String()) 54 | buffer.Reset() 55 | } 56 | ignoreSpace = true 57 | expectDot = false 58 | wasInQuotes = false 59 | } 60 | case ' ': 61 | if inQuotes { 62 | buffer.WriteRune(char) 63 | } else { 64 | expectDot = true 65 | } 66 | default: 67 | if !inQuotes && !isValidBareChar(char) { 68 | return nil, fmt.Errorf("invalid bare character: %c", char) 69 | } 70 | if !inQuotes && expectDot { 71 | return nil, errors.New("what?") 72 | } 73 | buffer.WriteRune(char) 74 | expectDot = false 75 | } 76 | } 77 | if inQuotes { 78 | return nil, errors.New("mismatched quotes") 79 | } 80 | if escapeNext { 81 | return nil, errors.New("unfinished escape sequence") 82 | } 83 | if buffer.Len() > 0 { 84 | groups = append(groups, buffer.String()) 85 | } 86 | if len(groups) == 0 { 87 | return nil, errors.New("empty key") 88 | } 89 | return groups, nil 90 | } 91 | 92 | func isValidBareChar(r rune) bool { 93 | return isAlphanumeric(r) || r == '-' || unicode.IsNumber(r) 94 | } 95 | -------------------------------------------------------------------------------- /vendor/github.com/pelletier/go-toml/position.go: -------------------------------------------------------------------------------- 1 | // Position support for go-toml 2 | 3 | package toml 4 | 5 | import ( 6 | "fmt" 7 | ) 8 | 9 | // Position of a document element within a TOML document. 10 | // 11 | // Line and Col are both 1-indexed positions for the element's line number and 12 | // column number, respectively. Values of zero or less will cause Invalid(), 13 | // to return true. 14 | type Position struct { 15 | Line int // line within the document 16 | Col int // column within the line 17 | } 18 | 19 | // String representation of the position. 20 | // Displays 1-indexed line and column numbers. 21 | func (p Position) String() string { 22 | return fmt.Sprintf("(%d, %d)", p.Line, p.Col) 23 | } 24 | 25 | // Invalid returns whether or not the position is valid (i.e. with negative or 26 | // null values) 27 | func (p Position) Invalid() bool { 28 | return p.Line <= 0 || p.Col <= 0 29 | } 30 | -------------------------------------------------------------------------------- /vendor/github.com/sirupsen/logrus/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Simon Eskildsen 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /vendor/github.com/sirupsen/logrus/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Package logrus is a structured logger for Go, completely API compatible with the standard library logger. 3 | 4 | 5 | The simplest way to use Logrus is simply the package-level exported logger: 6 | 7 | package main 8 | 9 | import ( 10 | log "github.com/sirupsen/logrus" 11 | ) 12 | 13 | func main() { 14 | log.WithFields(log.Fields{ 15 | "animal": "walrus", 16 | "number": 1, 17 | "size": 10, 18 | }).Info("A walrus appears") 19 | } 20 | 21 | Output: 22 | time="2015-09-07T08:48:33Z" level=info msg="A walrus appears" animal=walrus number=1 size=10 23 | 24 | For a full guide visit https://github.com/sirupsen/logrus 25 | */ 26 | package logrus 27 | -------------------------------------------------------------------------------- /vendor/github.com/sirupsen/logrus/formatter.go: -------------------------------------------------------------------------------- 1 | package logrus 2 | 3 | import "time" 4 | 5 | const DefaultTimestampFormat = time.RFC3339 6 | 7 | // The Formatter interface is used to implement a custom Formatter. It takes an 8 | // `Entry`. It exposes all the fields, including the default ones: 9 | // 10 | // * `entry.Data["msg"]`. The message passed from Info, Warn, Error .. 11 | // * `entry.Data["time"]`. The timestamp. 12 | // * `entry.Data["level"]. The level the entry was logged at. 13 | // 14 | // Any additional fields added with `WithField` or `WithFields` are also in 15 | // `entry.Data`. Format is expected to return an array of bytes which are then 16 | // logged to `logger.Out`. 17 | type Formatter interface { 18 | Format(*Entry) ([]byte, error) 19 | } 20 | 21 | // This is to not silently overwrite `time`, `msg` and `level` fields when 22 | // dumping it. If this code wasn't there doing: 23 | // 24 | // logrus.WithField("level", 1).Info("hello") 25 | // 26 | // Would just silently drop the user provided level. Instead with this code 27 | // it'll logged as: 28 | // 29 | // {"level": "info", "fields.level": 1, "msg": "hello", "time": "..."} 30 | // 31 | // It's not exported because it's still using Data in an opinionated way. It's to 32 | // avoid code duplication between the two default formatters. 33 | func prefixFieldClashes(data Fields) { 34 | if t, ok := data["time"]; ok { 35 | data["fields.time"] = t 36 | } 37 | 38 | if m, ok := data["msg"]; ok { 39 | data["fields.msg"] = m 40 | } 41 | 42 | if l, ok := data["level"]; ok { 43 | data["fields.level"] = l 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /vendor/github.com/sirupsen/logrus/hooks.go: -------------------------------------------------------------------------------- 1 | package logrus 2 | 3 | // A hook to be fired when logging on the logging levels returned from 4 | // `Levels()` on your implementation of the interface. Note that this is not 5 | // fired in a goroutine or a channel with workers, you should handle such 6 | // functionality yourself if your call is non-blocking and you don't wish for 7 | // the logging calls for levels returned from `Levels()` to block. 8 | type Hook interface { 9 | Levels() []Level 10 | Fire(*Entry) error 11 | } 12 | 13 | // Internal type for storing the hooks on a logger instance. 14 | type LevelHooks map[Level][]Hook 15 | 16 | // Add a hook to an instance of logger. This is called with 17 | // `log.Hooks.Add(new(MyHook))` where `MyHook` implements the `Hook` interface. 18 | func (hooks LevelHooks) Add(hook Hook) { 19 | for _, level := range hook.Levels() { 20 | hooks[level] = append(hooks[level], hook) 21 | } 22 | } 23 | 24 | // Fire all the hooks for the passed level. Used by `entry.log` to fire 25 | // appropriate hooks for a log entry. 26 | func (hooks LevelHooks) Fire(level Level, entry *Entry) error { 27 | for _, hook := range hooks[level] { 28 | if err := hook.Fire(entry); err != nil { 29 | return err 30 | } 31 | } 32 | 33 | return nil 34 | } 35 | -------------------------------------------------------------------------------- /vendor/github.com/sirupsen/logrus/json_formatter.go: -------------------------------------------------------------------------------- 1 | package logrus 2 | 3 | import ( 4 | "encoding/json" 5 | "fmt" 6 | ) 7 | 8 | type fieldKey string 9 | type FieldMap map[fieldKey]string 10 | 11 | const ( 12 | FieldKeyMsg = "msg" 13 | FieldKeyLevel = "level" 14 | FieldKeyTime = "time" 15 | ) 16 | 17 | func (f FieldMap) resolve(key fieldKey) string { 18 | if k, ok := f[key]; ok { 19 | return k 20 | } 21 | 22 | return string(key) 23 | } 24 | 25 | type JSONFormatter struct { 26 | // TimestampFormat sets the format used for marshaling timestamps. 27 | TimestampFormat string 28 | 29 | // DisableTimestamp allows disabling automatic timestamps in output 30 | DisableTimestamp bool 31 | 32 | // FieldMap allows users to customize the names of keys for various fields. 33 | // As an example: 34 | // formatter := &JSONFormatter{ 35 | // FieldMap: FieldMap{ 36 | // FieldKeyTime: "@timestamp", 37 | // FieldKeyLevel: "@level", 38 | // FieldKeyMsg: "@message", 39 | // }, 40 | // } 41 | FieldMap FieldMap 42 | } 43 | 44 | func (f *JSONFormatter) Format(entry *Entry) ([]byte, error) { 45 | data := make(Fields, len(entry.Data)+3) 46 | for k, v := range entry.Data { 47 | switch v := v.(type) { 48 | case error: 49 | // Otherwise errors are ignored by `encoding/json` 50 | // https://github.com/sirupsen/logrus/issues/137 51 | data[k] = v.Error() 52 | default: 53 | data[k] = v 54 | } 55 | } 56 | prefixFieldClashes(data) 57 | 58 | timestampFormat := f.TimestampFormat 59 | if timestampFormat == "" { 60 | timestampFormat = DefaultTimestampFormat 61 | } 62 | 63 | if !f.DisableTimestamp { 64 | data[f.FieldMap.resolve(FieldKeyTime)] = entry.Time.Format(timestampFormat) 65 | } 66 | data[f.FieldMap.resolve(FieldKeyMsg)] = entry.Message 67 | data[f.FieldMap.resolve(FieldKeyLevel)] = entry.Level.String() 68 | 69 | serialized, err := json.Marshal(data) 70 | if err != nil { 71 | return nil, fmt.Errorf("Failed to marshal fields to JSON, %v", err) 72 | } 73 | return append(serialized, '\n'), nil 74 | } 75 | -------------------------------------------------------------------------------- /vendor/github.com/sirupsen/logrus/terminal_appengine.go: -------------------------------------------------------------------------------- 1 | // +build appengine 2 | 3 | package logrus 4 | 5 | import "io" 6 | 7 | // IsTerminal returns true if stderr's file descriptor is a terminal. 8 | func IsTerminal(f io.Writer) bool { 9 | return true 10 | } 11 | -------------------------------------------------------------------------------- /vendor/github.com/sirupsen/logrus/terminal_bsd.go: -------------------------------------------------------------------------------- 1 | // +build darwin freebsd openbsd netbsd dragonfly 2 | // +build !appengine 3 | 4 | package logrus 5 | 6 | import "syscall" 7 | 8 | const ioctlReadTermios = syscall.TIOCGETA 9 | 10 | type Termios syscall.Termios 11 | -------------------------------------------------------------------------------- /vendor/github.com/sirupsen/logrus/terminal_linux.go: -------------------------------------------------------------------------------- 1 | // Based on ssh/terminal: 2 | // Copyright 2013 The Go Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style 4 | // license that can be found in the LICENSE file. 5 | 6 | // +build !appengine 7 | 8 | package logrus 9 | 10 | import "syscall" 11 | 12 | const ioctlReadTermios = syscall.TCGETS 13 | 14 | type Termios syscall.Termios 15 | -------------------------------------------------------------------------------- /vendor/github.com/sirupsen/logrus/terminal_notwindows.go: -------------------------------------------------------------------------------- 1 | // Based on ssh/terminal: 2 | // Copyright 2011 The Go Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style 4 | // license that can be found in the LICENSE file. 5 | 6 | // +build linux darwin freebsd openbsd netbsd dragonfly 7 | // +build !appengine 8 | 9 | package logrus 10 | 11 | import ( 12 | "io" 13 | "os" 14 | "syscall" 15 | "unsafe" 16 | ) 17 | 18 | // IsTerminal returns true if stderr's file descriptor is a terminal. 19 | func IsTerminal(f io.Writer) bool { 20 | var termios Termios 21 | switch v := f.(type) { 22 | case *os.File: 23 | _, _, err := syscall.Syscall6(syscall.SYS_IOCTL, uintptr(v.Fd()), ioctlReadTermios, uintptr(unsafe.Pointer(&termios)), 0, 0, 0) 24 | return err == 0 25 | default: 26 | return false 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /vendor/github.com/sirupsen/logrus/terminal_solaris.go: -------------------------------------------------------------------------------- 1 | // +build solaris,!appengine 2 | 3 | package logrus 4 | 5 | import ( 6 | "io" 7 | "os" 8 | 9 | "golang.org/x/sys/unix" 10 | ) 11 | 12 | // IsTerminal returns true if the given file descriptor is a terminal. 13 | func IsTerminal(f io.Writer) bool { 14 | switch v := f.(type) { 15 | case *os.File: 16 | _, err := unix.IoctlGetTermios(int(v.Fd()), unix.TCGETA) 17 | return err == nil 18 | default: 19 | return false 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /vendor/github.com/sirupsen/logrus/writer.go: -------------------------------------------------------------------------------- 1 | package logrus 2 | 3 | import ( 4 | "bufio" 5 | "io" 6 | "runtime" 7 | ) 8 | 9 | func (logger *Logger) Writer() *io.PipeWriter { 10 | return logger.WriterLevel(InfoLevel) 11 | } 12 | 13 | func (logger *Logger) WriterLevel(level Level) *io.PipeWriter { 14 | return NewEntry(logger).WriterLevel(level) 15 | } 16 | 17 | func (entry *Entry) Writer() *io.PipeWriter { 18 | return entry.WriterLevel(InfoLevel) 19 | } 20 | 21 | func (entry *Entry) WriterLevel(level Level) *io.PipeWriter { 22 | reader, writer := io.Pipe() 23 | 24 | var printFunc func(args ...interface{}) 25 | 26 | switch level { 27 | case DebugLevel: 28 | printFunc = entry.Debug 29 | case InfoLevel: 30 | printFunc = entry.Info 31 | case WarnLevel: 32 | printFunc = entry.Warn 33 | case ErrorLevel: 34 | printFunc = entry.Error 35 | case FatalLevel: 36 | printFunc = entry.Fatal 37 | case PanicLevel: 38 | printFunc = entry.Panic 39 | default: 40 | printFunc = entry.Print 41 | } 42 | 43 | go entry.writerScanner(reader, printFunc) 44 | runtime.SetFinalizer(writer, writerFinalizer) 45 | 46 | return writer 47 | } 48 | 49 | func (entry *Entry) writerScanner(reader *io.PipeReader, printFunc func(args ...interface{})) { 50 | scanner := bufio.NewScanner(reader) 51 | for scanner.Scan() { 52 | printFunc(scanner.Text()) 53 | } 54 | if err := scanner.Err(); err != nil { 55 | entry.Errorf("Error while reading from Writer: %s", err) 56 | } 57 | reader.Close() 58 | } 59 | 60 | func writerFinalizer(writer *io.PipeWriter) { 61 | writer.Close() 62 | } 63 | -------------------------------------------------------------------------------- /vendor/github.com/spf13/afero/const_bsds.go: -------------------------------------------------------------------------------- 1 | // Copyright © 2016 Steve Francia . 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // 8 | // Unless required by applicable law or agreed to in writing, software 9 | // distributed under the License is distributed on an "AS IS" BASIS, 10 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | // See the License for the specific language governing permissions and 12 | // limitations under the License. 13 | 14 | // +build darwin openbsd freebsd netbsd dragonfly 15 | 16 | package afero 17 | 18 | import ( 19 | "syscall" 20 | ) 21 | 22 | const BADFD = syscall.EBADF 23 | -------------------------------------------------------------------------------- /vendor/github.com/spf13/afero/const_win_unix.go: -------------------------------------------------------------------------------- 1 | // Copyright © 2016 Steve Francia . 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // 8 | // Unless required by applicable law or agreed to in writing, software 9 | // distributed under the License is distributed on an "AS IS" BASIS, 10 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | // See the License for the specific language governing permissions and 12 | // limitations under the License. 13 | // +build !darwin 14 | // +build !openbsd 15 | // +build !freebsd 16 | // +build !dragonfly 17 | // +build !netbsd 18 | 19 | package afero 20 | 21 | import ( 22 | "syscall" 23 | ) 24 | 25 | const BADFD = syscall.EBADFD 26 | -------------------------------------------------------------------------------- /vendor/github.com/spf13/afero/mem/dir.go: -------------------------------------------------------------------------------- 1 | // Copyright © 2014 Steve Francia . 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // 8 | // Unless required by applicable law or agreed to in writing, software 9 | // distributed under the License is distributed on an "AS IS" BASIS, 10 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | // See the License for the specific language governing permissions and 12 | // limitations under the License. 13 | 14 | package mem 15 | 16 | type Dir interface { 17 | Len() int 18 | Names() []string 19 | Files() []*FileData 20 | Add(*FileData) 21 | Remove(*FileData) 22 | } 23 | 24 | func RemoveFromMemDir(dir *FileData, f *FileData) { 25 | dir.memDir.Remove(f) 26 | } 27 | 28 | func AddToMemDir(dir *FileData, f *FileData) { 29 | dir.memDir.Add(f) 30 | } 31 | 32 | func InitializeDir(d *FileData) { 33 | if d.memDir == nil { 34 | d.dir = true 35 | d.memDir = &DirMap{} 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /vendor/github.com/spf13/afero/mem/dirmap.go: -------------------------------------------------------------------------------- 1 | // Copyright © 2015 Steve Francia . 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // 8 | // Unless required by applicable law or agreed to in writing, software 9 | // distributed under the License is distributed on an "AS IS" BASIS, 10 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | // See the License for the specific language governing permissions and 12 | // limitations under the License. 13 | 14 | package mem 15 | 16 | import "sort" 17 | 18 | type DirMap map[string]*FileData 19 | 20 | func (m DirMap) Len() int { return len(m) } 21 | func (m DirMap) Add(f *FileData) { m[f.name] = f } 22 | func (m DirMap) Remove(f *FileData) { delete(m, f.name) } 23 | func (m DirMap) Files() (files []*FileData) { 24 | for _, f := range m { 25 | files = append(files, f) 26 | } 27 | sort.Sort(filesSorter(files)) 28 | return files 29 | } 30 | 31 | // implement sort.Interface for []*FileData 32 | type filesSorter []*FileData 33 | 34 | func (s filesSorter) Len() int { return len(s) } 35 | func (s filesSorter) Swap(i, j int) { s[i], s[j] = s[j], s[i] } 36 | func (s filesSorter) Less(i, j int) bool { return s[i].name < s[j].name } 37 | 38 | func (m DirMap) Names() (names []string) { 39 | for x := range m { 40 | names = append(names, x) 41 | } 42 | return names 43 | } 44 | -------------------------------------------------------------------------------- /vendor/github.com/spf13/afero/memradix.go: -------------------------------------------------------------------------------- 1 | // Copyright © 2014 Steve Francia . 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // 8 | // Unless required by applicable law or agreed to in writing, software 9 | // distributed under the License is distributed on an "AS IS" BASIS, 10 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | // See the License for the specific language governing permissions and 12 | // limitations under the License. 13 | 14 | package afero 15 | -------------------------------------------------------------------------------- /vendor/github.com/spf13/afero/readonlyfs.go: -------------------------------------------------------------------------------- 1 | package afero 2 | 3 | import ( 4 | "os" 5 | "syscall" 6 | "time" 7 | ) 8 | 9 | type ReadOnlyFs struct { 10 | source Fs 11 | } 12 | 13 | func NewReadOnlyFs(source Fs) Fs { 14 | return &ReadOnlyFs{source: source} 15 | } 16 | 17 | func (r *ReadOnlyFs) ReadDir(name string) ([]os.FileInfo, error) { 18 | return ReadDir(r.source, name) 19 | } 20 | 21 | func (r *ReadOnlyFs) Chtimes(n string, a, m time.Time) error { 22 | return syscall.EPERM 23 | } 24 | 25 | func (r *ReadOnlyFs) Chmod(n string, m os.FileMode) error { 26 | return syscall.EPERM 27 | } 28 | 29 | func (r *ReadOnlyFs) Name() string { 30 | return "ReadOnlyFilter" 31 | } 32 | 33 | func (r *ReadOnlyFs) Stat(name string) (os.FileInfo, error) { 34 | return r.source.Stat(name) 35 | } 36 | 37 | func (r *ReadOnlyFs) Rename(o, n string) error { 38 | return syscall.EPERM 39 | } 40 | 41 | func (r *ReadOnlyFs) RemoveAll(p string) error { 42 | return syscall.EPERM 43 | } 44 | 45 | func (r *ReadOnlyFs) Remove(n string) error { 46 | return syscall.EPERM 47 | } 48 | 49 | func (r *ReadOnlyFs) OpenFile(name string, flag int, perm os.FileMode) (File, error) { 50 | if flag&(os.O_WRONLY|syscall.O_RDWR|os.O_APPEND|os.O_CREATE|os.O_TRUNC) != 0 { 51 | return nil, syscall.EPERM 52 | } 53 | return r.source.OpenFile(name, flag, perm) 54 | } 55 | 56 | func (r *ReadOnlyFs) Open(n string) (File, error) { 57 | return r.source.Open(n) 58 | } 59 | 60 | func (r *ReadOnlyFs) Mkdir(n string, p os.FileMode) error { 61 | return syscall.EPERM 62 | } 63 | 64 | func (r *ReadOnlyFs) MkdirAll(n string, p os.FileMode) error { 65 | return syscall.EPERM 66 | } 67 | 68 | func (r *ReadOnlyFs) Create(n string) (File, error) { 69 | return nil, syscall.EPERM 70 | } 71 | -------------------------------------------------------------------------------- /vendor/github.com/spf13/cast/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Steve Francia 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /vendor/github.com/spf13/cobra/command_notwin.go: -------------------------------------------------------------------------------- 1 | // +build !windows 2 | 3 | package cobra 4 | 5 | var preExecHookFn func(*Command) 6 | -------------------------------------------------------------------------------- /vendor/github.com/spf13/cobra/command_win.go: -------------------------------------------------------------------------------- 1 | // +build windows 2 | 3 | package cobra 4 | 5 | import ( 6 | "os" 7 | "time" 8 | 9 | "github.com/inconshreveable/mousetrap" 10 | ) 11 | 12 | var preExecHookFn = preExecHook 13 | 14 | // enables an information splash screen on Windows if the CLI is started from explorer.exe. 15 | var MousetrapHelpText string = `This is a command line tool 16 | 17 | You need to open cmd.exe and run it from there. 18 | ` 19 | 20 | func preExecHook(c *Command) { 21 | if mousetrap.StartedByExplorer() { 22 | c.Print(MousetrapHelpText) 23 | time.Sleep(5 * time.Second) 24 | os.Exit(1) 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /vendor/github.com/spf13/jwalterweatherman/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Steve Francia 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /vendor/github.com/spf13/jwalterweatherman/log_counter.go: -------------------------------------------------------------------------------- 1 | // Copyright © 2016 Steve Francia . 2 | // 3 | // Use of this source code is governed by an MIT-style 4 | // license that can be found in the LICENSE file. 5 | 6 | package jwalterweatherman 7 | 8 | import ( 9 | "sync/atomic" 10 | ) 11 | 12 | type logCounter struct { 13 | counter uint64 14 | } 15 | 16 | func (c *logCounter) incr() { 17 | atomic.AddUint64(&c.counter, 1) 18 | } 19 | 20 | func (c *logCounter) resetCounter() { 21 | atomic.StoreUint64(&c.counter, 0) 22 | } 23 | 24 | func (c *logCounter) getCount() uint64 { 25 | return atomic.LoadUint64(&c.counter) 26 | } 27 | 28 | func (c *logCounter) Write(p []byte) (n int, err error) { 29 | c.incr() 30 | return len(p), nil 31 | } 32 | 33 | // LogCountForLevel returns the number of log invocations for a given threshold. 34 | func (n *Notepad) LogCountForLevel(l Threshold) uint64 { 35 | return n.logCounters[l].getCount() 36 | } 37 | 38 | // LogCountForLevelsGreaterThanorEqualTo returns the number of log invocations 39 | // greater than or equal to a given threshold. 40 | func (n *Notepad) LogCountForLevelsGreaterThanorEqualTo(threshold Threshold) uint64 { 41 | var cnt uint64 42 | 43 | for i := int(threshold); i < len(n.logCounters); i++ { 44 | cnt += n.LogCountForLevel(Threshold(i)) 45 | } 46 | 47 | return cnt 48 | } 49 | 50 | // ResetLogCounters resets the invocation counters for all levels. 51 | func (n *Notepad) ResetLogCounters() { 52 | for _, np := range n.logCounters { 53 | np.resetCounter() 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /vendor/github.com/spf13/pflag/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2012 Alex Ogier. All rights reserved. 2 | Copyright (c) 2012 The Go Authors. All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are 6 | met: 7 | 8 | * Redistributions of source code must retain the above copyright 9 | notice, this list of conditions and the following disclaimer. 10 | * Redistributions in binary form must reproduce the above 11 | copyright notice, this list of conditions and the following disclaimer 12 | in the documentation and/or other materials provided with the 13 | distribution. 14 | * Neither the name of Google Inc. nor the names of its 15 | contributors may be used to endorse or promote products derived from 16 | this software without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | -------------------------------------------------------------------------------- /vendor/github.com/spf13/viper/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Steve Francia 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /vendor/github.com/spf13/viper/flags.go: -------------------------------------------------------------------------------- 1 | package viper 2 | 3 | import "github.com/spf13/pflag" 4 | 5 | // FlagValueSet is an interface that users can implement 6 | // to bind a set of flags to viper. 7 | type FlagValueSet interface { 8 | VisitAll(fn func(FlagValue)) 9 | } 10 | 11 | // FlagValue is an interface that users can implement 12 | // to bind different flags to viper. 13 | type FlagValue interface { 14 | HasChanged() bool 15 | Name() string 16 | ValueString() string 17 | ValueType() string 18 | } 19 | 20 | // pflagValueSet is a wrapper around *pflag.ValueSet 21 | // that implements FlagValueSet. 22 | type pflagValueSet struct { 23 | flags *pflag.FlagSet 24 | } 25 | 26 | // VisitAll iterates over all *pflag.Flag inside the *pflag.FlagSet. 27 | func (p pflagValueSet) VisitAll(fn func(flag FlagValue)) { 28 | p.flags.VisitAll(func(flag *pflag.Flag) { 29 | fn(pflagValue{flag}) 30 | }) 31 | } 32 | 33 | // pflagValue is a wrapper aroung *pflag.flag 34 | // that implements FlagValue 35 | type pflagValue struct { 36 | flag *pflag.Flag 37 | } 38 | 39 | // HasChanges returns whether the flag has changes or not. 40 | func (p pflagValue) HasChanged() bool { 41 | return p.flag.Changed 42 | } 43 | 44 | // Name returns the name of the flag. 45 | func (p pflagValue) Name() string { 46 | return p.flag.Name 47 | } 48 | 49 | // ValueString returns the value of the flag as a string. 50 | func (p pflagValue) ValueString() string { 51 | return p.flag.Value.String() 52 | } 53 | 54 | // ValueType returns the type of the flag as a string. 55 | func (p pflagValue) ValueType() string { 56 | return p.flag.Value.Type() 57 | } 58 | -------------------------------------------------------------------------------- /vendor/github.com/tidwall/gjson/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 Josh Baker 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | this software and associated documentation files (the "Software"), to deal in 7 | the Software without restriction, including without limitation the rights to 8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software is furnished to do so, 10 | subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /vendor/github.com/tidwall/match/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 Josh Baker 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | this software and associated documentation files (the "Software"), to deal in 7 | the Software without restriction, including without limitation the rights to 8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software is furnished to do so, 10 | subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2009 The Go Authors. All rights reserved. 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions are 5 | met: 6 | 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above 10 | copyright notice, this list of conditions and the following disclaimer 11 | in the documentation and/or other materials provided with the 12 | distribution. 13 | * Neither the name of Google Inc. nor the names of its 14 | contributors may be used to endorse or promote products derived from 15 | this software without specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/PATENTS: -------------------------------------------------------------------------------- 1 | Additional IP Rights Grant (Patents) 2 | 3 | "This implementation" means the copyrightable works distributed by 4 | Google as part of the Go project. 5 | 6 | Google hereby grants to You a perpetual, worldwide, non-exclusive, 7 | no-charge, royalty-free, irrevocable (except as stated in this section) 8 | patent license to make, have made, use, offer to sell, sell, import, 9 | transfer and otherwise run, modify and propagate the contents of this 10 | implementation of Go, where such license applies only to those patent 11 | claims, both currently owned or controlled by Google and acquired in 12 | the future, licensable by Google that are necessarily infringed by this 13 | implementation of Go. This grant does not include claims that would be 14 | infringed only as a consequence of further modification of this 15 | implementation. If you or your agent or exclusive licensee institute or 16 | order or agree to the institution of patent litigation against any 17 | entity (including a cross-claim or counterclaim in a lawsuit) alleging 18 | that this implementation of Go or any code incorporated within this 19 | implementation of Go constitutes direct or contributory patent 20 | infringement, or inducement of patent infringement, then any patent 21 | rights granted to you under this License for this implementation of Go 22 | shall terminate as of the date such litigation is filed. 23 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm.s: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | TEXT ·use(SB),NOSPLIT,$0 10 | RET 11 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_darwin_386.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for 386, Darwin 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-28 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-52 23 | JMP syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 26 | JMP syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 29 | JMP syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_darwin_amd64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for AMD64, Darwin 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-56 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-104 23 | JMP syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 26 | JMP syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 29 | JMP syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_darwin_arm.s: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | // +build arm,darwin 7 | 8 | #include "textflag.h" 9 | 10 | // 11 | // System call support for ARM, Darwin 12 | // 13 | 14 | // Just jump to package syscall's implementation for all these functions. 15 | // The runtime may know about them. 16 | 17 | TEXT ·Syscall(SB),NOSPLIT,$0-28 18 | B syscall·Syscall(SB) 19 | 20 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 21 | B syscall·Syscall6(SB) 22 | 23 | TEXT ·Syscall9(SB),NOSPLIT,$0-52 24 | B syscall·Syscall9(SB) 25 | 26 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 27 | B syscall·RawSyscall(SB) 28 | 29 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 30 | B syscall·RawSyscall6(SB) 31 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_darwin_arm64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | // +build arm64,darwin 7 | 8 | #include "textflag.h" 9 | 10 | // 11 | // System call support for AMD64, Darwin 12 | // 13 | 14 | // Just jump to package syscall's implementation for all these functions. 15 | // The runtime may know about them. 16 | 17 | TEXT ·Syscall(SB),NOSPLIT,$0-56 18 | B syscall·Syscall(SB) 19 | 20 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 21 | B syscall·Syscall6(SB) 22 | 23 | TEXT ·Syscall9(SB),NOSPLIT,$0-104 24 | B syscall·Syscall9(SB) 25 | 26 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 27 | B syscall·RawSyscall(SB) 28 | 29 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 30 | B syscall·RawSyscall6(SB) 31 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_dragonfly_386.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for 386, FreeBSD 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-32 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-44 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-56 23 | JMP syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-32 26 | JMP syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-44 29 | JMP syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_dragonfly_amd64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for AMD64, DragonFly 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-64 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-88 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-112 23 | JMP syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-64 26 | JMP syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-88 29 | JMP syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_freebsd_386.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for 386, FreeBSD 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-28 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-52 23 | JMP syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 26 | JMP syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 29 | JMP syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_freebsd_amd64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for AMD64, FreeBSD 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-56 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-104 23 | JMP syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 26 | JMP syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 29 | JMP syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_freebsd_arm.s: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for ARM, FreeBSD 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-28 17 | B syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 20 | B syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-52 23 | B syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 26 | B syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 29 | B syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_linux_386.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System calls for 386, Linux 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-28 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 23 | JMP syscall·RawSyscall(SB) 24 | 25 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 26 | JMP syscall·RawSyscall6(SB) 27 | 28 | TEXT ·socketcall(SB),NOSPLIT,$0-36 29 | JMP syscall·socketcall(SB) 30 | 31 | TEXT ·rawsocketcall(SB),NOSPLIT,$0-36 32 | JMP syscall·rawsocketcall(SB) 33 | 34 | TEXT ·seek(SB),NOSPLIT,$0-28 35 | JMP syscall·seek(SB) 36 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_linux_amd64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System calls for AMD64, Linux 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-56 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 23 | JMP syscall·RawSyscall(SB) 24 | 25 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 26 | JMP syscall·RawSyscall6(SB) 27 | 28 | TEXT ·gettimeofday(SB),NOSPLIT,$0-16 29 | JMP syscall·gettimeofday(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_linux_arm.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System calls for arm, Linux 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-28 17 | B syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 20 | B syscall·Syscall6(SB) 21 | 22 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 23 | B syscall·RawSyscall(SB) 24 | 25 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 26 | B syscall·RawSyscall6(SB) 27 | 28 | TEXT ·seek(SB),NOSPLIT,$0-32 29 | B syscall·seek(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_linux_arm64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build linux 6 | // +build arm64 7 | // +build !gccgo 8 | 9 | #include "textflag.h" 10 | 11 | // Just jump to package syscall's implementation for all these functions. 12 | // The runtime may know about them. 13 | 14 | TEXT ·Syscall(SB),NOSPLIT,$0-56 15 | B syscall·Syscall(SB) 16 | 17 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 18 | B syscall·Syscall6(SB) 19 | 20 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 21 | B syscall·RawSyscall(SB) 22 | 23 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 24 | B syscall·RawSyscall6(SB) 25 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_linux_ppc64x.s: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build linux 6 | // +build ppc64 ppc64le 7 | // +build !gccgo 8 | 9 | #include "textflag.h" 10 | 11 | // 12 | // System calls for ppc64, Linux 13 | // 14 | 15 | // Just jump to package syscall's implementation for all these functions. 16 | // The runtime may know about them. 17 | 18 | TEXT ·Syscall(SB),NOSPLIT,$0-56 19 | BR syscall·Syscall(SB) 20 | 21 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 22 | BR syscall·Syscall6(SB) 23 | 24 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 25 | BR syscall·RawSyscall(SB) 26 | 27 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 28 | BR syscall·RawSyscall6(SB) 29 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_netbsd_386.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for 386, NetBSD 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-28 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-52 23 | JMP syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 26 | JMP syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 29 | JMP syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_netbsd_amd64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for AMD64, NetBSD 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-56 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-104 23 | JMP syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 26 | JMP syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 29 | JMP syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_netbsd_arm.s: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for ARM, NetBSD 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-28 17 | B syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 20 | B syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-52 23 | B syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 26 | B syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 29 | B syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_openbsd_386.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for 386, OpenBSD 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-28 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-52 23 | JMP syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 26 | JMP syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 29 | JMP syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_openbsd_amd64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for AMD64, OpenBSD 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-56 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-104 23 | JMP syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 26 | JMP syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 29 | JMP syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_solaris_amd64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System calls for amd64, Solaris are implemented in runtime/syscall_solaris.go 11 | // 12 | 13 | TEXT ·sysvicall6(SB),NOSPLIT,$0-64 14 | JMP syscall·sysvicall6(SB) 15 | 16 | TEXT ·rawSysvicall6(SB),NOSPLIT,$0-64 17 | JMP syscall·rawSysvicall6(SB) 18 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/constants.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build darwin dragonfly freebsd linux netbsd openbsd solaris 6 | 7 | package unix 8 | 9 | const ( 10 | R_OK = 0x4 11 | W_OK = 0x2 12 | X_OK = 0x1 13 | ) 14 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/env_unix.go: -------------------------------------------------------------------------------- 1 | // Copyright 2010 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build darwin dragonfly freebsd linux netbsd openbsd solaris 6 | 7 | // Unix environment variables. 8 | 9 | package unix 10 | 11 | import "syscall" 12 | 13 | func Getenv(key string) (value string, found bool) { 14 | return syscall.Getenv(key) 15 | } 16 | 17 | func Setenv(key, value string) error { 18 | return syscall.Setenv(key, value) 19 | } 20 | 21 | func Clearenv() { 22 | syscall.Clearenv() 23 | } 24 | 25 | func Environ() []string { 26 | return syscall.Environ() 27 | } 28 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/env_unset.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build go1.4 6 | 7 | package unix 8 | 9 | import "syscall" 10 | 11 | func Unsetenv(key string) error { 12 | // This was added in Go 1.4. 13 | return syscall.Unsetenv(key) 14 | } 15 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/flock.go: -------------------------------------------------------------------------------- 1 | // +build linux darwin freebsd openbsd netbsd dragonfly 2 | 3 | // Copyright 2014 The Go Authors. All rights reserved. 4 | // Use of this source code is governed by a BSD-style 5 | // license that can be found in the LICENSE file. 6 | 7 | // +build darwin dragonfly freebsd linux netbsd openbsd 8 | 9 | package unix 10 | 11 | import "unsafe" 12 | 13 | // fcntl64Syscall is usually SYS_FCNTL, but is overridden on 32-bit Linux 14 | // systems by flock_linux_32bit.go to be SYS_FCNTL64. 15 | var fcntl64Syscall uintptr = SYS_FCNTL 16 | 17 | // FcntlFlock performs a fcntl syscall for the F_GETLK, F_SETLK or F_SETLKW command. 18 | func FcntlFlock(fd uintptr, cmd int, lk *Flock_t) error { 19 | _, _, errno := Syscall(fcntl64Syscall, fd, uintptr(cmd), uintptr(unsafe.Pointer(lk))) 20 | if errno == 0 { 21 | return nil 22 | } 23 | return errno 24 | } 25 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/flock_linux_32bit.go: -------------------------------------------------------------------------------- 1 | // +build linux,386 linux,arm 2 | 3 | // Copyright 2014 The Go Authors. All rights reserved. 4 | // Use of this source code is governed by a BSD-style 5 | // license that can be found in the LICENSE file. 6 | 7 | package unix 8 | 9 | func init() { 10 | // On 32-bit Linux systems, the fcntl syscall that matches Go's 11 | // Flock_t type is SYS_FCNTL64, not SYS_FCNTL. 12 | fcntl64Syscall = SYS_FCNTL64 13 | } 14 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/gccgo.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build gccgo 6 | 7 | package unix 8 | 9 | import "syscall" 10 | 11 | // We can't use the gc-syntax .s files for gccgo. On the plus side 12 | // much of the functionality can be written directly in Go. 13 | 14 | //extern gccgoRealSyscall 15 | func realSyscall(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r, errno uintptr) 16 | 17 | func Syscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno) { 18 | syscall.Entersyscall() 19 | r, errno := realSyscall(trap, a1, a2, a3, 0, 0, 0, 0, 0, 0) 20 | syscall.Exitsyscall() 21 | return r, 0, syscall.Errno(errno) 22 | } 23 | 24 | func Syscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno) { 25 | syscall.Entersyscall() 26 | r, errno := realSyscall(trap, a1, a2, a3, a4, a5, a6, 0, 0, 0) 27 | syscall.Exitsyscall() 28 | return r, 0, syscall.Errno(errno) 29 | } 30 | 31 | func Syscall9(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) { 32 | syscall.Entersyscall() 33 | r, errno := realSyscall(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9) 34 | syscall.Exitsyscall() 35 | return r, 0, syscall.Errno(errno) 36 | } 37 | 38 | func RawSyscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno) { 39 | r, errno := realSyscall(trap, a1, a2, a3, 0, 0, 0, 0, 0, 0) 40 | return r, 0, syscall.Errno(errno) 41 | } 42 | 43 | func RawSyscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno) { 44 | r, errno := realSyscall(trap, a1, a2, a3, a4, a5, a6, 0, 0, 0) 45 | return r, 0, syscall.Errno(errno) 46 | } 47 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/gccgo_c.c: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build gccgo 6 | 7 | #include 8 | #include 9 | #include 10 | 11 | #define _STRINGIFY2_(x) #x 12 | #define _STRINGIFY_(x) _STRINGIFY2_(x) 13 | #define GOSYM_PREFIX _STRINGIFY_(__USER_LABEL_PREFIX__) 14 | 15 | // Call syscall from C code because the gccgo support for calling from 16 | // Go to C does not support varargs functions. 17 | 18 | struct ret { 19 | uintptr_t r; 20 | uintptr_t err; 21 | }; 22 | 23 | struct ret 24 | gccgoRealSyscall(uintptr_t trap, uintptr_t a1, uintptr_t a2, uintptr_t a3, uintptr_t a4, uintptr_t a5, uintptr_t a6, uintptr_t a7, uintptr_t a8, uintptr_t a9) 25 | { 26 | struct ret r; 27 | 28 | errno = 0; 29 | r.r = syscall(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9); 30 | r.err = errno; 31 | return r; 32 | } 33 | 34 | // Define the use function in C so that it is not inlined. 35 | 36 | extern void use(void *) __asm__ (GOSYM_PREFIX GOPKGPATH ".use") __attribute__((noinline)); 37 | 38 | void 39 | use(void *p __attribute__ ((unused))) 40 | { 41 | } 42 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/gccgo_linux_amd64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build gccgo,linux,amd64 6 | 7 | package unix 8 | 9 | import "syscall" 10 | 11 | //extern gettimeofday 12 | func realGettimeofday(*Timeval, *byte) int32 13 | 14 | func gettimeofday(tv *Timeval) (err syscall.Errno) { 15 | r := realGettimeofday(tv, nil) 16 | if r < 0 { 17 | return syscall.GetErrno() 18 | } 19 | return 0 20 | } 21 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/race.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build darwin,race linux,race freebsd,race 6 | 7 | package unix 8 | 9 | import ( 10 | "runtime" 11 | "unsafe" 12 | ) 13 | 14 | const raceenabled = true 15 | 16 | func raceAcquire(addr unsafe.Pointer) { 17 | runtime.RaceAcquire(addr) 18 | } 19 | 20 | func raceReleaseMerge(addr unsafe.Pointer) { 21 | runtime.RaceReleaseMerge(addr) 22 | } 23 | 24 | func raceReadRange(addr unsafe.Pointer, len int) { 25 | runtime.RaceReadRange(addr, len) 26 | } 27 | 28 | func raceWriteRange(addr unsafe.Pointer, len int) { 29 | runtime.RaceWriteRange(addr, len) 30 | } 31 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/race0.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build darwin,!race linux,!race freebsd,!race netbsd openbsd solaris dragonfly 6 | 7 | package unix 8 | 9 | import ( 10 | "unsafe" 11 | ) 12 | 13 | const raceenabled = false 14 | 15 | func raceAcquire(addr unsafe.Pointer) { 16 | } 17 | 18 | func raceReleaseMerge(addr unsafe.Pointer) { 19 | } 20 | 21 | func raceReadRange(addr unsafe.Pointer, len int) { 22 | } 23 | 24 | func raceWriteRange(addr unsafe.Pointer, len int) { 25 | } 26 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/sockcmsg_linux.go: -------------------------------------------------------------------------------- 1 | // Copyright 2011 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // Socket control messages 6 | 7 | package unix 8 | 9 | import "unsafe" 10 | 11 | // UnixCredentials encodes credentials into a socket control message 12 | // for sending to another process. This can be used for 13 | // authentication. 14 | func UnixCredentials(ucred *Ucred) []byte { 15 | b := make([]byte, CmsgSpace(SizeofUcred)) 16 | h := (*Cmsghdr)(unsafe.Pointer(&b[0])) 17 | h.Level = SOL_SOCKET 18 | h.Type = SCM_CREDENTIALS 19 | h.SetLen(CmsgLen(SizeofUcred)) 20 | *((*Ucred)(cmsgData(h))) = *ucred 21 | return b 22 | } 23 | 24 | // ParseUnixCredentials decodes a socket control message that contains 25 | // credentials in a Ucred structure. To receive such a message, the 26 | // SO_PASSCRED option must be enabled on the socket. 27 | func ParseUnixCredentials(m *SocketControlMessage) (*Ucred, error) { 28 | if m.Header.Level != SOL_SOCKET { 29 | return nil, EINVAL 30 | } 31 | if m.Header.Type != SCM_CREDENTIALS { 32 | return nil, EINVAL 33 | } 34 | ucred := *(*Ucred)(unsafe.Pointer(&m.Data[0])) 35 | return &ucred, nil 36 | } 37 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/str.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build darwin dragonfly freebsd linux netbsd openbsd solaris 6 | 7 | package unix 8 | 9 | func itoa(val int) string { // do it here rather than with fmt to avoid dependency 10 | if val < 0 { 11 | return "-" + uitoa(uint(-val)) 12 | } 13 | return uitoa(uint(val)) 14 | } 15 | 16 | func uitoa(val uint) string { 17 | var buf [32]byte // big enough for int64 18 | i := len(buf) - 1 19 | for val >= 10 { 20 | buf[i] = byte(val%10 + '0') 21 | i-- 22 | val /= 10 23 | } 24 | buf[i] = byte(val + '0') 25 | return string(buf[i:]) 26 | } 27 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_darwin_arm.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package unix 6 | 7 | import ( 8 | "syscall" 9 | "unsafe" 10 | ) 11 | 12 | func Getpagesize() int { return 4096 } 13 | 14 | func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) } 15 | 16 | func NsecToTimespec(nsec int64) (ts Timespec) { 17 | ts.Sec = int32(nsec / 1e9) 18 | ts.Nsec = int32(nsec % 1e9) 19 | return 20 | } 21 | 22 | func TimevalToNsec(tv Timeval) int64 { return int64(tv.Sec)*1e9 + int64(tv.Usec)*1e3 } 23 | 24 | func NsecToTimeval(nsec int64) (tv Timeval) { 25 | nsec += 999 // round up to microsecond 26 | tv.Usec = int32(nsec % 1e9 / 1e3) 27 | tv.Sec = int32(nsec / 1e9) 28 | return 29 | } 30 | 31 | //sysnb gettimeofday(tp *Timeval) (sec int32, usec int32, err error) 32 | func Gettimeofday(tv *Timeval) (err error) { 33 | // The tv passed to gettimeofday must be non-nil 34 | // but is otherwise unused. The answers come back 35 | // in the two registers. 36 | sec, usec, err := gettimeofday(tv) 37 | tv.Sec = int32(sec) 38 | tv.Usec = int32(usec) 39 | return err 40 | } 41 | 42 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 43 | k.Ident = uint32(fd) 44 | k.Filter = int16(mode) 45 | k.Flags = uint16(flags) 46 | } 47 | 48 | func (iov *Iovec) SetLen(length int) { 49 | iov.Len = uint32(length) 50 | } 51 | 52 | func (msghdr *Msghdr) SetControllen(length int) { 53 | msghdr.Controllen = uint32(length) 54 | } 55 | 56 | func (cmsg *Cmsghdr) SetLen(length int) { 57 | cmsg.Len = uint32(length) 58 | } 59 | 60 | func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { 61 | var length = uint64(count) 62 | 63 | _, _, e1 := Syscall9(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr(*offset>>32), uintptr(unsafe.Pointer(&length)), 0, 0, 0, 0) 64 | 65 | written = int(length) 66 | 67 | if e1 != 0 { 68 | err = e1 69 | } 70 | return 71 | } 72 | 73 | func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) // sic 74 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_darwin_arm64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build arm64,darwin 6 | 7 | package unix 8 | 9 | import ( 10 | "syscall" 11 | "unsafe" 12 | ) 13 | 14 | func Getpagesize() int { return 16384 } 15 | 16 | func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) } 17 | 18 | func NsecToTimespec(nsec int64) (ts Timespec) { 19 | ts.Sec = nsec / 1e9 20 | ts.Nsec = nsec % 1e9 21 | return 22 | } 23 | 24 | func TimevalToNsec(tv Timeval) int64 { return int64(tv.Sec)*1e9 + int64(tv.Usec)*1e3 } 25 | 26 | func NsecToTimeval(nsec int64) (tv Timeval) { 27 | nsec += 999 // round up to microsecond 28 | tv.Usec = int32(nsec % 1e9 / 1e3) 29 | tv.Sec = int64(nsec / 1e9) 30 | return 31 | } 32 | 33 | //sysnb gettimeofday(tp *Timeval) (sec int64, usec int32, err error) 34 | func Gettimeofday(tv *Timeval) (err error) { 35 | // The tv passed to gettimeofday must be non-nil 36 | // but is otherwise unused. The answers come back 37 | // in the two registers. 38 | sec, usec, err := gettimeofday(tv) 39 | tv.Sec = sec 40 | tv.Usec = usec 41 | return err 42 | } 43 | 44 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 45 | k.Ident = uint64(fd) 46 | k.Filter = int16(mode) 47 | k.Flags = uint16(flags) 48 | } 49 | 50 | func (iov *Iovec) SetLen(length int) { 51 | iov.Len = uint64(length) 52 | } 53 | 54 | func (msghdr *Msghdr) SetControllen(length int) { 55 | msghdr.Controllen = uint32(length) 56 | } 57 | 58 | func (cmsg *Cmsghdr) SetLen(length int) { 59 | cmsg.Len = uint32(length) 60 | } 61 | 62 | func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { 63 | var length = uint64(count) 64 | 65 | _, _, e1 := Syscall6(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr(unsafe.Pointer(&length)), 0, 0) 66 | 67 | written = int(length) 68 | 69 | if e1 != 0 { 70 | err = e1 71 | } 72 | return 73 | } 74 | 75 | func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) // sic 76 | 77 | // SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions 78 | // of darwin/arm64 the syscall is called sysctl instead of __sysctl. 79 | const SYS___SYSCTL = SYS_SYSCTL 80 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_dragonfly_386.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build 386,dragonfly 6 | 7 | package unix 8 | 9 | import ( 10 | "syscall" 11 | "unsafe" 12 | ) 13 | 14 | func Getpagesize() int { return 4096 } 15 | 16 | func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) } 17 | 18 | func NsecToTimespec(nsec int64) (ts Timespec) { 19 | ts.Sec = int32(nsec / 1e9) 20 | ts.Nsec = int32(nsec % 1e9) 21 | return 22 | } 23 | 24 | func TimevalToNsec(tv Timeval) int64 { return int64(tv.Sec)*1e9 + int64(tv.Usec)*1e3 } 25 | 26 | func NsecToTimeval(nsec int64) (tv Timeval) { 27 | nsec += 999 // round up to microsecond 28 | tv.Usec = int32(nsec % 1e9 / 1e3) 29 | tv.Sec = int32(nsec / 1e9) 30 | return 31 | } 32 | 33 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 34 | k.Ident = uint32(fd) 35 | k.Filter = int16(mode) 36 | k.Flags = uint16(flags) 37 | } 38 | 39 | func (iov *Iovec) SetLen(length int) { 40 | iov.Len = uint32(length) 41 | } 42 | 43 | func (msghdr *Msghdr) SetControllen(length int) { 44 | msghdr.Controllen = uint32(length) 45 | } 46 | 47 | func (cmsg *Cmsghdr) SetLen(length int) { 48 | cmsg.Len = uint32(length) 49 | } 50 | 51 | func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { 52 | var writtenOut uint64 = 0 53 | _, _, e1 := Syscall9(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr((*offset)>>32), uintptr(count), 0, uintptr(unsafe.Pointer(&writtenOut)), 0, 0) 54 | 55 | written = int(writtenOut) 56 | 57 | if e1 != 0 { 58 | err = e1 59 | } 60 | return 61 | } 62 | 63 | func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) 64 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_dragonfly_amd64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build amd64,dragonfly 6 | 7 | package unix 8 | 9 | import ( 10 | "syscall" 11 | "unsafe" 12 | ) 13 | 14 | func Getpagesize() int { return 4096 } 15 | 16 | func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) } 17 | 18 | func NsecToTimespec(nsec int64) (ts Timespec) { 19 | ts.Sec = nsec / 1e9 20 | ts.Nsec = nsec % 1e9 21 | return 22 | } 23 | 24 | func TimevalToNsec(tv Timeval) int64 { return int64(tv.Sec)*1e9 + int64(tv.Usec)*1e3 } 25 | 26 | func NsecToTimeval(nsec int64) (tv Timeval) { 27 | nsec += 999 // round up to microsecond 28 | tv.Usec = nsec % 1e9 / 1e3 29 | tv.Sec = int64(nsec / 1e9) 30 | return 31 | } 32 | 33 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 34 | k.Ident = uint64(fd) 35 | k.Filter = int16(mode) 36 | k.Flags = uint16(flags) 37 | } 38 | 39 | func (iov *Iovec) SetLen(length int) { 40 | iov.Len = uint64(length) 41 | } 42 | 43 | func (msghdr *Msghdr) SetControllen(length int) { 44 | msghdr.Controllen = uint32(length) 45 | } 46 | 47 | func (cmsg *Cmsghdr) SetLen(length int) { 48 | cmsg.Len = uint32(length) 49 | } 50 | 51 | func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { 52 | var writtenOut uint64 = 0 53 | _, _, e1 := Syscall9(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr(count), 0, uintptr(unsafe.Pointer(&writtenOut)), 0, 0, 0) 54 | 55 | written = int(writtenOut) 56 | 57 | if e1 != 0 { 58 | err = e1 59 | } 60 | return 61 | } 62 | 63 | func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) 64 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_freebsd_386.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build 386,freebsd 6 | 7 | package unix 8 | 9 | import ( 10 | "syscall" 11 | "unsafe" 12 | ) 13 | 14 | func Getpagesize() int { return 4096 } 15 | 16 | func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) } 17 | 18 | func NsecToTimespec(nsec int64) (ts Timespec) { 19 | ts.Sec = int32(nsec / 1e9) 20 | ts.Nsec = int32(nsec % 1e9) 21 | return 22 | } 23 | 24 | func TimevalToNsec(tv Timeval) int64 { return int64(tv.Sec)*1e9 + int64(tv.Usec)*1e3 } 25 | 26 | func NsecToTimeval(nsec int64) (tv Timeval) { 27 | nsec += 999 // round up to microsecond 28 | tv.Usec = int32(nsec % 1e9 / 1e3) 29 | tv.Sec = int32(nsec / 1e9) 30 | return 31 | } 32 | 33 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 34 | k.Ident = uint32(fd) 35 | k.Filter = int16(mode) 36 | k.Flags = uint16(flags) 37 | } 38 | 39 | func (iov *Iovec) SetLen(length int) { 40 | iov.Len = uint32(length) 41 | } 42 | 43 | func (msghdr *Msghdr) SetControllen(length int) { 44 | msghdr.Controllen = uint32(length) 45 | } 46 | 47 | func (cmsg *Cmsghdr) SetLen(length int) { 48 | cmsg.Len = uint32(length) 49 | } 50 | 51 | func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { 52 | var writtenOut uint64 = 0 53 | _, _, e1 := Syscall9(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr((*offset)>>32), uintptr(count), 0, uintptr(unsafe.Pointer(&writtenOut)), 0, 0) 54 | 55 | written = int(writtenOut) 56 | 57 | if e1 != 0 { 58 | err = e1 59 | } 60 | return 61 | } 62 | 63 | func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) 64 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_freebsd_amd64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build amd64,freebsd 6 | 7 | package unix 8 | 9 | import ( 10 | "syscall" 11 | "unsafe" 12 | ) 13 | 14 | func Getpagesize() int { return 4096 } 15 | 16 | func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) } 17 | 18 | func NsecToTimespec(nsec int64) (ts Timespec) { 19 | ts.Sec = nsec / 1e9 20 | ts.Nsec = nsec % 1e9 21 | return 22 | } 23 | 24 | func TimevalToNsec(tv Timeval) int64 { return int64(tv.Sec)*1e9 + int64(tv.Usec)*1e3 } 25 | 26 | func NsecToTimeval(nsec int64) (tv Timeval) { 27 | nsec += 999 // round up to microsecond 28 | tv.Usec = nsec % 1e9 / 1e3 29 | tv.Sec = int64(nsec / 1e9) 30 | return 31 | } 32 | 33 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 34 | k.Ident = uint64(fd) 35 | k.Filter = int16(mode) 36 | k.Flags = uint16(flags) 37 | } 38 | 39 | func (iov *Iovec) SetLen(length int) { 40 | iov.Len = uint64(length) 41 | } 42 | 43 | func (msghdr *Msghdr) SetControllen(length int) { 44 | msghdr.Controllen = uint32(length) 45 | } 46 | 47 | func (cmsg *Cmsghdr) SetLen(length int) { 48 | cmsg.Len = uint32(length) 49 | } 50 | 51 | func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { 52 | var writtenOut uint64 = 0 53 | _, _, e1 := Syscall9(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr(count), 0, uintptr(unsafe.Pointer(&writtenOut)), 0, 0, 0) 54 | 55 | written = int(writtenOut) 56 | 57 | if e1 != 0 { 58 | err = e1 59 | } 60 | return 61 | } 62 | 63 | func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) 64 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_freebsd_arm.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build arm,freebsd 6 | 7 | package unix 8 | 9 | import ( 10 | "syscall" 11 | "unsafe" 12 | ) 13 | 14 | func Getpagesize() int { return 4096 } 15 | 16 | func TimespecToNsec(ts Timespec) int64 { return ts.Sec*1e9 + int64(ts.Nsec) } 17 | 18 | func NsecToTimespec(nsec int64) (ts Timespec) { 19 | ts.Sec = nsec / 1e9 20 | ts.Nsec = int32(nsec % 1e9) 21 | return 22 | } 23 | 24 | func TimevalToNsec(tv Timeval) int64 { return tv.Sec*1e9 + int64(tv.Usec)*1e3 } 25 | 26 | func NsecToTimeval(nsec int64) (tv Timeval) { 27 | nsec += 999 // round up to microsecond 28 | tv.Usec = int32(nsec % 1e9 / 1e3) 29 | tv.Sec = nsec / 1e9 30 | return 31 | } 32 | 33 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 34 | k.Ident = uint32(fd) 35 | k.Filter = int16(mode) 36 | k.Flags = uint16(flags) 37 | } 38 | 39 | func (iov *Iovec) SetLen(length int) { 40 | iov.Len = uint32(length) 41 | } 42 | 43 | func (msghdr *Msghdr) SetControllen(length int) { 44 | msghdr.Controllen = uint32(length) 45 | } 46 | 47 | func (cmsg *Cmsghdr) SetLen(length int) { 48 | cmsg.Len = uint32(length) 49 | } 50 | 51 | func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { 52 | var writtenOut uint64 = 0 53 | _, _, e1 := Syscall9(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr((*offset)>>32), uintptr(count), 0, uintptr(unsafe.Pointer(&writtenOut)), 0, 0) 54 | 55 | written = int(writtenOut) 56 | 57 | if e1 != 0 { 58 | err = e1 59 | } 60 | return 61 | } 62 | 63 | func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) 64 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_netbsd_386.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build 386,netbsd 6 | 7 | package unix 8 | 9 | func Getpagesize() int { return 4096 } 10 | 11 | func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) } 12 | 13 | func NsecToTimespec(nsec int64) (ts Timespec) { 14 | ts.Sec = int64(nsec / 1e9) 15 | ts.Nsec = int32(nsec % 1e9) 16 | return 17 | } 18 | 19 | func TimevalToNsec(tv Timeval) int64 { return int64(tv.Sec)*1e9 + int64(tv.Usec)*1e3 } 20 | 21 | func NsecToTimeval(nsec int64) (tv Timeval) { 22 | nsec += 999 // round up to microsecond 23 | tv.Usec = int32(nsec % 1e9 / 1e3) 24 | tv.Sec = int64(nsec / 1e9) 25 | return 26 | } 27 | 28 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 29 | k.Ident = uint32(fd) 30 | k.Filter = uint32(mode) 31 | k.Flags = uint32(flags) 32 | } 33 | 34 | func (iov *Iovec) SetLen(length int) { 35 | iov.Len = uint32(length) 36 | } 37 | 38 | func (msghdr *Msghdr) SetControllen(length int) { 39 | msghdr.Controllen = uint32(length) 40 | } 41 | 42 | func (cmsg *Cmsghdr) SetLen(length int) { 43 | cmsg.Len = uint32(length) 44 | } 45 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_netbsd_amd64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build amd64,netbsd 6 | 7 | package unix 8 | 9 | func Getpagesize() int { return 4096 } 10 | 11 | func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) } 12 | 13 | func NsecToTimespec(nsec int64) (ts Timespec) { 14 | ts.Sec = int64(nsec / 1e9) 15 | ts.Nsec = int64(nsec % 1e9) 16 | return 17 | } 18 | 19 | func TimevalToNsec(tv Timeval) int64 { return int64(tv.Sec)*1e9 + int64(tv.Usec)*1e3 } 20 | 21 | func NsecToTimeval(nsec int64) (tv Timeval) { 22 | nsec += 999 // round up to microsecond 23 | tv.Usec = int32(nsec % 1e9 / 1e3) 24 | tv.Sec = int64(nsec / 1e9) 25 | return 26 | } 27 | 28 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 29 | k.Ident = uint64(fd) 30 | k.Filter = uint32(mode) 31 | k.Flags = uint32(flags) 32 | } 33 | 34 | func (iov *Iovec) SetLen(length int) { 35 | iov.Len = uint64(length) 36 | } 37 | 38 | func (msghdr *Msghdr) SetControllen(length int) { 39 | msghdr.Controllen = uint32(length) 40 | } 41 | 42 | func (cmsg *Cmsghdr) SetLen(length int) { 43 | cmsg.Len = uint32(length) 44 | } 45 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_netbsd_arm.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build arm,netbsd 6 | 7 | package unix 8 | 9 | func Getpagesize() int { return 4096 } 10 | 11 | func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) } 12 | 13 | func NsecToTimespec(nsec int64) (ts Timespec) { 14 | ts.Sec = int64(nsec / 1e9) 15 | ts.Nsec = int32(nsec % 1e9) 16 | return 17 | } 18 | 19 | func TimevalToNsec(tv Timeval) int64 { return int64(tv.Sec)*1e9 + int64(tv.Usec)*1e3 } 20 | 21 | func NsecToTimeval(nsec int64) (tv Timeval) { 22 | nsec += 999 // round up to microsecond 23 | tv.Usec = int32(nsec % 1e9 / 1e3) 24 | tv.Sec = int64(nsec / 1e9) 25 | return 26 | } 27 | 28 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 29 | k.Ident = uint32(fd) 30 | k.Filter = uint32(mode) 31 | k.Flags = uint32(flags) 32 | } 33 | 34 | func (iov *Iovec) SetLen(length int) { 35 | iov.Len = uint32(length) 36 | } 37 | 38 | func (msghdr *Msghdr) SetControllen(length int) { 39 | msghdr.Controllen = uint32(length) 40 | } 41 | 42 | func (cmsg *Cmsghdr) SetLen(length int) { 43 | cmsg.Len = uint32(length) 44 | } 45 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_no_getwd.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build dragonfly freebsd netbsd openbsd 6 | 7 | package unix 8 | 9 | const ImplementsGetwd = false 10 | 11 | func Getwd() (string, error) { return "", ENOTSUP } 12 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_openbsd_386.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build 386,openbsd 6 | 7 | package unix 8 | 9 | func Getpagesize() int { return 4096 } 10 | 11 | func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) } 12 | 13 | func NsecToTimespec(nsec int64) (ts Timespec) { 14 | ts.Sec = int64(nsec / 1e9) 15 | ts.Nsec = int32(nsec % 1e9) 16 | return 17 | } 18 | 19 | func TimevalToNsec(tv Timeval) int64 { return int64(tv.Sec)*1e9 + int64(tv.Usec)*1e3 } 20 | 21 | func NsecToTimeval(nsec int64) (tv Timeval) { 22 | nsec += 999 // round up to microsecond 23 | tv.Usec = int32(nsec % 1e9 / 1e3) 24 | tv.Sec = int64(nsec / 1e9) 25 | return 26 | } 27 | 28 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 29 | k.Ident = uint32(fd) 30 | k.Filter = int16(mode) 31 | k.Flags = uint16(flags) 32 | } 33 | 34 | func (iov *Iovec) SetLen(length int) { 35 | iov.Len = uint32(length) 36 | } 37 | 38 | func (msghdr *Msghdr) SetControllen(length int) { 39 | msghdr.Controllen = uint32(length) 40 | } 41 | 42 | func (cmsg *Cmsghdr) SetLen(length int) { 43 | cmsg.Len = uint32(length) 44 | } 45 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_openbsd_amd64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build amd64,openbsd 6 | 7 | package unix 8 | 9 | func Getpagesize() int { return 4096 } 10 | 11 | func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) } 12 | 13 | func NsecToTimespec(nsec int64) (ts Timespec) { 14 | ts.Sec = nsec / 1e9 15 | ts.Nsec = nsec % 1e9 16 | return 17 | } 18 | 19 | func TimevalToNsec(tv Timeval) int64 { return int64(tv.Sec)*1e9 + int64(tv.Usec)*1e3 } 20 | 21 | func NsecToTimeval(nsec int64) (tv Timeval) { 22 | nsec += 999 // round up to microsecond 23 | tv.Usec = nsec % 1e9 / 1e3 24 | tv.Sec = nsec / 1e9 25 | return 26 | } 27 | 28 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 29 | k.Ident = uint64(fd) 30 | k.Filter = int16(mode) 31 | k.Flags = uint16(flags) 32 | } 33 | 34 | func (iov *Iovec) SetLen(length int) { 35 | iov.Len = uint64(length) 36 | } 37 | 38 | func (msghdr *Msghdr) SetControllen(length int) { 39 | msghdr.Controllen = uint32(length) 40 | } 41 | 42 | func (cmsg *Cmsghdr) SetLen(length int) { 43 | cmsg.Len = uint32(length) 44 | } 45 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_solaris_amd64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build amd64,solaris 6 | 7 | package unix 8 | 9 | func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) } 10 | 11 | func NsecToTimespec(nsec int64) (ts Timespec) { 12 | ts.Sec = nsec / 1e9 13 | ts.Nsec = nsec % 1e9 14 | return 15 | } 16 | 17 | func TimevalToNsec(tv Timeval) int64 { return int64(tv.Sec)*1e9 + int64(tv.Usec)*1e3 } 18 | 19 | func NsecToTimeval(nsec int64) (tv Timeval) { 20 | nsec += 999 // round up to microsecond 21 | tv.Usec = nsec % 1e9 / 1e3 22 | tv.Sec = int64(nsec / 1e9) 23 | return 24 | } 25 | 26 | func (iov *Iovec) SetLen(length int) { 27 | iov.Len = uint64(length) 28 | } 29 | 30 | func (cmsg *Cmsghdr) SetLen(length int) { 31 | cmsg.Len = uint32(length) 32 | } 33 | 34 | func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { 35 | // TODO(aram): implement this, see issue 5847. 36 | panic("unimplemented") 37 | } 38 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/zsysnum_solaris_amd64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build amd64,solaris 6 | 7 | package unix 8 | 9 | // TODO(aram): remove these before Go 1.3. 10 | const ( 11 | SYS_EXECVE = 59 12 | SYS_FCNTL = 62 13 | ) 14 | -------------------------------------------------------------------------------- /vendor/golang.org/x/text/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2009 The Go Authors. All rights reserved. 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions are 5 | met: 6 | 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above 10 | copyright notice, this list of conditions and the following disclaimer 11 | in the documentation and/or other materials provided with the 12 | distribution. 13 | * Neither the name of Google Inc. nor the names of its 14 | contributors may be used to endorse or promote products derived from 15 | this software without specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /vendor/golang.org/x/text/PATENTS: -------------------------------------------------------------------------------- 1 | Additional IP Rights Grant (Patents) 2 | 3 | "This implementation" means the copyrightable works distributed by 4 | Google as part of the Go project. 5 | 6 | Google hereby grants to You a perpetual, worldwide, non-exclusive, 7 | no-charge, royalty-free, irrevocable (except as stated in this section) 8 | patent license to make, have made, use, offer to sell, sell, import, 9 | transfer and otherwise run, modify and propagate the contents of this 10 | implementation of Go, where such license applies only to those patent 11 | claims, both currently owned or controlled by Google and acquired in 12 | the future, licensable by Google that are necessarily infringed by this 13 | implementation of Go. This grant does not include claims that would be 14 | infringed only as a consequence of further modification of this 15 | implementation. If you or your agent or exclusive licensee institute or 16 | order or agree to the institution of patent litigation against any 17 | entity (including a cross-claim or counterclaim in a lawsuit) alleging 18 | that this implementation of Go or any code incorporated within this 19 | implementation of Go constitutes direct or contributory patent 20 | infringement, or inducement of patent infringement, then any patent 21 | rights granted to you under this License for this implementation of Go 22 | shall terminate as of the date such litigation is filed. 23 | -------------------------------------------------------------------------------- /vendor/golang.org/x/text/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:generate go run gen.go 6 | 7 | // text is a repository of text-related packages related to internationalization 8 | // (i18n) and localization (l10n), such as character encodings, text 9 | // transformations, and locale-specific text handling. 10 | package text 11 | 12 | // TODO: more documentation on general concepts, such as Transformers, use 13 | // of normalization, etc. 14 | -------------------------------------------------------------------------------- /vendor/golang.org/x/text/unicode/norm/trie.go: -------------------------------------------------------------------------------- 1 | // Copyright 2011 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package norm 6 | 7 | type valueRange struct { 8 | value uint16 // header: value:stride 9 | lo, hi byte // header: lo:n 10 | } 11 | 12 | type sparseBlocks struct { 13 | values []valueRange 14 | offset []uint16 15 | } 16 | 17 | var nfcSparse = sparseBlocks{ 18 | values: nfcSparseValues[:], 19 | offset: nfcSparseOffset[:], 20 | } 21 | 22 | var nfkcSparse = sparseBlocks{ 23 | values: nfkcSparseValues[:], 24 | offset: nfkcSparseOffset[:], 25 | } 26 | 27 | var ( 28 | nfcData = newNfcTrie(0) 29 | nfkcData = newNfkcTrie(0) 30 | ) 31 | 32 | // lookupValue determines the type of block n and looks up the value for b. 33 | // For n < t.cutoff, the block is a simple lookup table. Otherwise, the block 34 | // is a list of ranges with an accompanying value. Given a matching range r, 35 | // the value for b is by r.value + (b - r.lo) * stride. 36 | func (t *sparseBlocks) lookup(n uint32, b byte) uint16 { 37 | offset := t.offset[n] 38 | header := t.values[offset] 39 | lo := offset + 1 40 | hi := lo + uint16(header.lo) 41 | for lo < hi { 42 | m := lo + (hi-lo)/2 43 | r := t.values[m] 44 | if r.lo <= b && b <= r.hi { 45 | return r.value + uint16(b-r.lo)*header.value 46 | } 47 | if b < r.lo { 48 | hi = m 49 | } else { 50 | lo = m + 1 51 | } 52 | } 53 | return 0 54 | } 55 | -------------------------------------------------------------------------------- /vendor/gopkg.in/yaml.v2/LICENSE.libyaml: -------------------------------------------------------------------------------- 1 | The following files were ported to Go from C files of libyaml, and thus 2 | are still covered by their original copyright and license: 3 | 4 | apic.go 5 | emitterc.go 6 | parserc.go 7 | readerc.go 8 | scannerc.go 9 | writerc.go 10 | yamlh.go 11 | yamlprivateh.go 12 | 13 | Copyright (c) 2006 Kirill Simonov 14 | 15 | Permission is hereby granted, free of charge, to any person obtaining a copy of 16 | this software and associated documentation files (the "Software"), to deal in 17 | the Software without restriction, including without limitation the rights to 18 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 19 | of the Software, and to permit persons to whom the Software is furnished to do 20 | so, subject to the following conditions: 21 | 22 | The above copyright notice and this permission notice shall be included in all 23 | copies or substantial portions of the Software. 24 | 25 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 26 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 27 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 28 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 29 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 30 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 31 | SOFTWARE. 32 | --------------------------------------------------------------------------------