├── vendor ├── github.com │ ├── prometheus │ │ ├── procfs │ │ │ ├── .gitignore │ │ │ ├── MAINTAINERS.md │ │ │ ├── go.mod │ │ │ ├── .golangci.yml │ │ │ ├── NOTICE │ │ │ ├── go.sum │ │ │ ├── CONTRIBUTING.md │ │ │ ├── Makefile │ │ │ ├── proc_environ.go │ │ │ ├── doc.go │ │ │ ├── fs.go │ │ │ ├── proc_io.go │ │ │ ├── internal │ │ │ │ └── fs │ │ │ │ │ └── fs.go │ │ │ ├── proc_ns.go │ │ │ ├── README.md │ │ │ └── buddyinfo.go │ │ ├── client_golang │ │ │ ├── prometheus │ │ │ │ ├── .gitignore │ │ │ │ ├── README.md │ │ │ │ ├── build_info_pre_1.12.go │ │ │ │ ├── build_info.go │ │ │ │ ├── fnv.go │ │ │ │ ├── untyped.go │ │ │ │ ├── timer.go │ │ │ │ ├── observer.go │ │ │ │ ├── process_collector_other.go │ │ │ │ ├── labels.go │ │ │ │ └── internal │ │ │ │ │ └── metric.go │ │ │ └── NOTICE │ │ ├── client_model │ │ │ └── NOTICE │ │ └── common │ │ │ ├── NOTICE │ │ │ ├── model │ │ │ ├── model.go │ │ │ ├── fnv.go │ │ │ └── fingerprinting.go │ │ │ ├── expfmt │ │ │ ├── fuzz.go │ │ │ ├── expfmt.go │ │ │ └── encode.go │ │ │ └── internal │ │ │ └── bitbucket.org │ │ │ └── ww │ │ │ └── goautoneg │ │ │ └── README.txt │ ├── matttproud │ │ └── golang_protobuf_extensions │ │ │ ├── pbutil │ │ │ ├── .gitignore │ │ │ ├── Makefile │ │ │ ├── doc.go │ │ │ ├── encode.go │ │ │ └── decode.go │ │ │ └── NOTICE │ ├── jmespath │ │ └── go-jmespath │ │ │ ├── .gitignore │ │ │ ├── .travis.yml │ │ │ ├── README.md │ │ │ ├── LICENSE │ │ │ ├── toktype_string.go │ │ │ ├── astnodetype_string.go │ │ │ ├── Makefile │ │ │ └── api.go │ ├── aws │ │ └── aws-sdk-go │ │ │ ├── NOTICE.txt │ │ │ ├── internal │ │ │ ├── ini │ │ │ │ ├── empty_token.go │ │ │ │ ├── comma_token.go │ │ │ │ ├── fuzz.go │ │ │ │ ├── ws_token.go │ │ │ │ ├── newline_token.go │ │ │ │ ├── walker.go │ │ │ │ ├── expression.go │ │ │ │ ├── comment_token.go │ │ │ │ ├── op_tokens.go │ │ │ │ ├── sep_tokens.go │ │ │ │ ├── doc.go │ │ │ │ ├── skipper.go │ │ │ │ ├── parse_error.go │ │ │ │ ├── statement.go │ │ │ │ ├── ini.go │ │ │ │ ├── parse_stack.go │ │ │ │ └── ast.go │ │ │ ├── sdkio │ │ │ │ ├── io_go1.6.go │ │ │ │ └── io_go1.7.go │ │ │ ├── shareddefaults │ │ │ │ ├── ecs_container.go │ │ │ │ └── shared_config.go │ │ │ ├── sdkuri │ │ │ │ └── path.go │ │ │ └── sdkrand │ │ │ │ └── locked_source.go │ │ │ ├── aws │ │ │ ├── signer │ │ │ │ └── v4 │ │ │ │ │ ├── options.go │ │ │ │ │ ├── uri_path.go │ │ │ │ │ └── header_rules.go │ │ │ ├── version.go │ │ │ ├── credentials │ │ │ │ ├── example.ini │ │ │ │ ├── static_provider.go │ │ │ │ └── env_provider.go │ │ │ ├── url.go │ │ │ ├── context_1_9.go │ │ │ ├── jsonvalue.go │ │ │ ├── client │ │ │ │ ├── metadata │ │ │ │ │ └── client_info.go │ │ │ │ ├── default_retryer.go │ │ │ │ └── client.go │ │ │ ├── request │ │ │ │ ├── connection_reset_error.go │ │ │ │ ├── request_context_1_6.go │ │ │ │ ├── http_request.go │ │ │ │ ├── request_context.go │ │ │ │ ├── request_1_8.go │ │ │ │ ├── request_1_7.go │ │ │ │ ├── offset_reader.go │ │ │ │ └── timeout_read_closer.go │ │ │ ├── csm │ │ │ │ ├── metric_exception.go │ │ │ │ ├── metric_chan.go │ │ │ │ ├── enable.go │ │ │ │ └── doc.go │ │ │ ├── errors.go │ │ │ ├── session │ │ │ │ ├── cabundle_transport_1_5.go │ │ │ │ ├── cabundle_transport_1_6.go │ │ │ │ └── cabundle_transport.go │ │ │ ├── corehandlers │ │ │ │ ├── param_validator.go │ │ │ │ └── user_agent.go │ │ │ ├── context_sleep.go │ │ │ ├── context_background_1_7.go │ │ │ ├── url_1_7.go │ │ │ ├── defaults │ │ │ │ └── shared_config.go │ │ │ ├── awsutil │ │ │ │ ├── equal.go │ │ │ │ ├── string_value.go │ │ │ │ ├── prettify.go │ │ │ │ └── copy.go │ │ │ ├── context_background_1_5.go │ │ │ ├── context_1_5.go │ │ │ ├── doc.go │ │ │ └── endpoints │ │ │ │ └── doc.go │ │ │ ├── service │ │ │ ├── sqs │ │ │ │ ├── customizations.go │ │ │ │ ├── doc.go │ │ │ │ └── service.go │ │ │ └── sts │ │ │ │ └── customizations.go │ │ │ └── private │ │ │ └── protocol │ │ │ ├── unmarshal.go │ │ │ ├── rest │ │ │ └── payload.go │ │ │ ├── query │ │ │ ├── build.go │ │ │ ├── unmarshal.go │ │ │ └── unmarshal_error.go │ │ │ ├── host_prefix.go │ │ │ ├── host.go │ │ │ ├── jsonvalue.go │ │ │ ├── timestamp.go │ │ │ ├── payload.go │ │ │ └── idempotency.go │ ├── golang │ │ └── protobuf │ │ │ ├── AUTHORS │ │ │ ├── CONTRIBUTORS │ │ │ ├── LICENSE │ │ │ └── proto │ │ │ └── deprecated.go │ └── beorn7 │ │ └── perks │ │ └── LICENSE ├── golang.org │ └── x │ │ └── sys │ │ ├── AUTHORS │ │ ├── CONTRIBUTORS │ │ ├── windows │ │ ├── aliases.go │ │ ├── asm_windows_arm.s │ │ ├── mksyscall.go │ │ ├── asm_windows_386.s │ │ ├── asm_windows_amd64.s │ │ ├── race0.go │ │ ├── types_windows_386.go │ │ ├── types_windows_amd64.go │ │ ├── types_windows_arm.go │ │ ├── str.go │ │ ├── race.go │ │ ├── memory_windows.go │ │ ├── eventlog.go │ │ ├── mkknownfolderids.bash │ │ ├── env_windows.go │ │ ├── mkerrors.bash │ │ ├── exec_windows.go │ │ └── syscall.go │ │ ├── PATENTS │ │ └── LICENSE └── modules.txt ├── icon └── tiamat.png ├── .gitignore ├── Dockerfile ├── prometheus ├── listen.go └── gauge.go ├── aws ├── aws.go └── sqs.go └── go.mod /vendor/github.com/prometheus/procfs/.gitignore: -------------------------------------------------------------------------------- 1 | /fixtures/ 2 | -------------------------------------------------------------------------------- /icon/tiamat.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hugobcar/tiamat/HEAD/icon/tiamat.png -------------------------------------------------------------------------------- /vendor/github.com/matttproud/golang_protobuf_extensions/pbutil/.gitignore: -------------------------------------------------------------------------------- 1 | cover.dat 2 | -------------------------------------------------------------------------------- /vendor/github.com/prometheus/client_golang/prometheus/.gitignore: -------------------------------------------------------------------------------- 1 | command-line-arguments.test 2 | -------------------------------------------------------------------------------- /vendor/github.com/jmespath/go-jmespath/.gitignore: -------------------------------------------------------------------------------- 1 | /jpgo 2 | jmespath-fuzz.zip 3 | cpu.out 4 | go-jmespath.test 5 | -------------------------------------------------------------------------------- /vendor/github.com/matttproud/golang_protobuf_extensions/NOTICE: -------------------------------------------------------------------------------- 1 | Copyright 2012 Matt T. Proud (matt.proud@gmail.com) 2 | -------------------------------------------------------------------------------- /vendor/github.com/prometheus/procfs/MAINTAINERS.md: -------------------------------------------------------------------------------- 1 | * Johannes 'fish' Ziemke @discordianfish 2 | * Paul Gier @pgier 3 | -------------------------------------------------------------------------------- /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/jmespath/go-jmespath/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | 3 | sudo: false 4 | 5 | go: 6 | - 1.4 7 | 8 | install: go get -v -t ./... 9 | script: make test 10 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/internal/ini/empty_token.go: -------------------------------------------------------------------------------- 1 | package ini 2 | 3 | // emptyToken is used to satisfy the Token interface 4 | var emptyToken = newToken(TokenNone, []rune{}, NoneType) 5 | -------------------------------------------------------------------------------- /vendor/github.com/prometheus/procfs/go.mod: -------------------------------------------------------------------------------- 1 | module github.com/prometheus/procfs 2 | 3 | require ( 4 | github.com/google/go-cmp v0.3.0 5 | golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4 6 | ) 7 | -------------------------------------------------------------------------------- /vendor/github.com/matttproud/golang_protobuf_extensions/pbutil/Makefile: -------------------------------------------------------------------------------- 1 | all: 2 | 3 | cover: 4 | go test -cover -v -coverprofile=cover.dat ./... 5 | go tool cover -func cover.dat 6 | 7 | .PHONY: cover 8 | -------------------------------------------------------------------------------- /vendor/github.com/prometheus/procfs/.golangci.yml: -------------------------------------------------------------------------------- 1 | # Run only staticcheck for now. Additional linters will be enabled one-by-one. 2 | linters: 3 | enable: 4 | - staticcheck 5 | - govet 6 | disable-all: true 7 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/AUTHORS: -------------------------------------------------------------------------------- 1 | # This source code refers to The Go Authors for copyright purposes. 2 | # The master list of authors is in the main Go distribution, 3 | # visible at http://tip.golang.org/AUTHORS. 4 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/CONTRIBUTORS: -------------------------------------------------------------------------------- 1 | # This source code was written by the Go contributors. 2 | # The master list of contributors is in the main Go distribution, 3 | # visible at http://tip.golang.org/CONTRIBUTORS. 4 | -------------------------------------------------------------------------------- /vendor/github.com/golang/protobuf/AUTHORS: -------------------------------------------------------------------------------- 1 | # This source code refers to The Go Authors for copyright purposes. 2 | # The master list of authors is in the main Go distribution, 3 | # visible at http://tip.golang.org/AUTHORS. 4 | -------------------------------------------------------------------------------- /vendor/github.com/golang/protobuf/CONTRIBUTORS: -------------------------------------------------------------------------------- 1 | # This source code was written by the Go contributors. 2 | # The master list of contributors is in the main Go distribution, 3 | # visible at http://tip.golang.org/CONTRIBUTORS. 4 | -------------------------------------------------------------------------------- /vendor/github.com/prometheus/client_golang/prometheus/README.md: -------------------------------------------------------------------------------- 1 | See [![go-doc](https://godoc.org/github.com/prometheus/client_golang/prometheus?status.svg)](https://godoc.org/github.com/prometheus/client_golang/prometheus). 2 | -------------------------------------------------------------------------------- /vendor/github.com/prometheus/client_model/NOTICE: -------------------------------------------------------------------------------- 1 | Data model artifacts for Prometheus. 2 | Copyright 2012-2015 The Prometheus Authors 3 | 4 | This product includes software developed at 5 | SoundCloud Ltd. (http://soundcloud.com/). 6 | -------------------------------------------------------------------------------- /vendor/github.com/prometheus/common/NOTICE: -------------------------------------------------------------------------------- 1 | Common libraries shared by Prometheus Go components. 2 | Copyright 2015 The Prometheus Authors 3 | 4 | This product includes software developed at 5 | SoundCloud Ltd. (http://soundcloud.com/). 6 | -------------------------------------------------------------------------------- /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/service/sqs/customizations.go: -------------------------------------------------------------------------------- 1 | package sqs 2 | 3 | import "github.com/aws/aws-sdk-go/aws/request" 4 | 5 | func init() { 6 | initRequest = func(r *request.Request) { 7 | setupChecksumValidation(r) 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /vendor/github.com/jmespath/go-jmespath/README.md: -------------------------------------------------------------------------------- 1 | # go-jmespath - A JMESPath implementation in Go 2 | 3 | [![Build Status](https://img.shields.io/travis/jmespath/go-jmespath.svg)](https://travis-ci.org/jmespath/go-jmespath) 4 | 5 | 6 | 7 | See http://jmespath.org for more info. 8 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/internal/ini/comma_token.go: -------------------------------------------------------------------------------- 1 | package ini 2 | 3 | var commaRunes = []rune(",") 4 | 5 | func isComma(b rune) bool { 6 | return b == ',' 7 | } 8 | 9 | func newCommaToken() Token { 10 | return newToken(TokenComma, commaRunes, NoneType) 11 | } 12 | -------------------------------------------------------------------------------- /vendor/github.com/prometheus/procfs/NOTICE: -------------------------------------------------------------------------------- 1 | procfs provides functions to retrieve system, kernel and process 2 | metrics from the pseudo-filesystem proc. 3 | 4 | Copyright 2014-2015 The Prometheus Authors 5 | 6 | This product includes software developed at 7 | SoundCloud Ltd. (http://soundcloud.com/). 8 | -------------------------------------------------------------------------------- /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.23.2" 9 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/internal/ini/fuzz.go: -------------------------------------------------------------------------------- 1 | // +build gofuzz 2 | 3 | package ini 4 | 5 | import ( 6 | "bytes" 7 | ) 8 | 9 | func Fuzz(data []byte) int { 10 | b := bytes.NewReader(data) 11 | 12 | if _, err := Parse(b); err != nil { 13 | return 0 14 | } 15 | 16 | return 1 17 | } 18 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/internal/sdkio/io_go1.6.go: -------------------------------------------------------------------------------- 1 | // +build !go1.7 2 | 3 | package sdkio 4 | 5 | // Copy of Go 1.7 io package's Seeker constants. 6 | const ( 7 | SeekStart = 0 // seek relative to the origin of the file 8 | SeekCurrent = 1 // seek relative to the current offset 9 | SeekEnd = 2 // seek relative to the end 10 | ) 11 | -------------------------------------------------------------------------------- /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 = customizeRequest 7 | } 8 | 9 | func customizeRequest(r *request.Request) { 10 | r.RetryErrorCodes = append(r.RetryErrorCodes, ErrCodeIDPCommunicationErrorException) 11 | } 12 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/aws/credentials/example.ini: -------------------------------------------------------------------------------- 1 | [default] 2 | aws_access_key_id = accessKey 3 | aws_secret_access_key = secret 4 | aws_session_token = token 5 | 6 | [no_token] 7 | aws_access_key_id = accessKey 8 | aws_secret_access_key = secret 9 | 10 | [with_colon] 11 | aws_access_key_id: accessKey 12 | aws_secret_access_key: secret 13 | -------------------------------------------------------------------------------- /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/context_1_9.go: -------------------------------------------------------------------------------- 1 | // +build go1.9 2 | 3 | package aws 4 | 5 | import "context" 6 | 7 | // Context is an alias of the Go stdlib's context.Context interface. 8 | // It can be used within the SDK's API operation "WithContext" methods. 9 | // 10 | // See https://golang.org/pkg/context on how to use contexts. 11 | type Context = context.Context 12 | -------------------------------------------------------------------------------- /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/golang.org/x/sys/windows/aliases.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 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 windows 6 | // +build go1.9 7 | 8 | package windows 9 | 10 | import "syscall" 11 | 12 | type Errno = syscall.Errno 13 | type SysProcAttr = syscall.SysProcAttr 14 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/windows/asm_windows_arm.s: -------------------------------------------------------------------------------- 1 | // Copyright 2018 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 | #include "textflag.h" 6 | 7 | TEXT ·getprocaddress(SB),NOSPLIT,$0 8 | B syscall·getprocaddress(SB) 9 | 10 | TEXT ·loadlibrary(SB),NOSPLIT,$0 11 | B syscall·loadlibrary(SB) 12 | -------------------------------------------------------------------------------- /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 | ServiceID string 7 | APIVersion string 8 | Endpoint string 9 | SigningName string 10 | SigningRegion string 11 | JSONVersion string 12 | TargetPrefix string 13 | } 14 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/internal/sdkio/io_go1.7.go: -------------------------------------------------------------------------------- 1 | // +build go1.7 2 | 3 | package sdkio 4 | 5 | import "io" 6 | 7 | // Alias for Go 1.7 io package Seeker constants 8 | const ( 9 | SeekStart = io.SeekStart // seek relative to the origin of the file 10 | SeekCurrent = io.SeekCurrent // seek relative to the current offset 11 | SeekEnd = io.SeekEnd // seek relative to the end 12 | ) 13 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # ide idea 2 | .idea 3 | 4 | # Binaries for programs and plugins 5 | *.exe 6 | *.exe~ 7 | *.dll 8 | *.so 9 | *.dylib 10 | 11 | # Test binary, built with `go test -c` 12 | *.test 13 | 14 | # Output of the go coverage tool, specifically when used with LiteIDE 15 | *.out 16 | 17 | # Dependency directories (remove the comment below to include it) 18 | #vendor/ 19 | 20 | # ConfigMap file 21 | config.json 22 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM golang:1.12.8 as builder 2 | WORKDIR /go/src/github.com/hugobcar/tiamat 3 | ADD . /go/src/github.com/hugobcar/tiamat 4 | # RUN GO111MODULE=on go mod vendor 5 | RUN CGO_ENABLED=0 go build -o tiamat 6 | 7 | FROM alpine:3.10.1 8 | RUN apk update && apk add ca-certificates && rm -rf /var/cache/apk/* 9 | WORKDIR /app 10 | COPY --from=builder /go/src/github.com/hugobcar/tiamat/tiamat . 11 | CMD ["./tiamat"] 12 | -------------------------------------------------------------------------------- /vendor/github.com/prometheus/procfs/go.sum: -------------------------------------------------------------------------------- 1 | github.com/google/go-cmp v0.3.0 h1:crn/baboCvb5fXaQ0IJ1SGTsTVrWpDsCWC8EGETZijY= 2 | github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= 3 | golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4 h1:YUO/7uOKsKeq9UokNS62b8FYywz3ker1l1vDZRCRefw= 4 | golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 5 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/windows/mksyscall.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 generate 6 | 7 | package windows 8 | 9 | //go:generate go run $GOROOT/src/syscall/mksyscall_windows.go -output zsyscall_windows.go eventlog.go service.go syscall_windows.go security_windows.go 10 | -------------------------------------------------------------------------------- /prometheus/listen.go: -------------------------------------------------------------------------------- 1 | package prometheus 2 | 3 | import ( 4 | "fmt" 5 | "net/http" 6 | "os" 7 | 8 | "github.com/prometheus/client_golang/prometheus/promhttp" 9 | ) 10 | 11 | // Run - Create Handle '/metrics' 12 | func Run() error { 13 | port := os.Getenv("PORT") 14 | if port == "" { 15 | port = "5000" 16 | } 17 | http.Handle("/metrics", promhttp.Handler()) 18 | return http.ListenAndServe(fmt.Sprintf(":%s", port), nil) 19 | } 20 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/aws/request/connection_reset_error.go: -------------------------------------------------------------------------------- 1 | package request 2 | 3 | import ( 4 | "strings" 5 | ) 6 | 7 | func isErrConnectionReset(err error) bool { 8 | if strings.Contains(err.Error(), "read: connection reset") { 9 | return false 10 | } 11 | 12 | if strings.Contains(err.Error(), "connection reset") || 13 | strings.Contains(err.Error(), "broken pipe") { 14 | return true 15 | } 16 | 17 | return false 18 | } 19 | -------------------------------------------------------------------------------- /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/golang.org/x/sys/windows/asm_windows_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 | // 6 | // System calls for 386, Windows are implemented in runtime/syscall_windows.goc 7 | // 8 | 9 | TEXT ·getprocaddress(SB), 7, $0-16 10 | JMP syscall·getprocaddress(SB) 11 | 12 | TEXT ·loadlibrary(SB), 7, $0-12 13 | JMP syscall·loadlibrary(SB) 14 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/windows/asm_windows_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 | // 6 | // System calls for amd64, Windows are implemented in runtime/syscall_windows.goc 7 | // 8 | 9 | TEXT ·getprocaddress(SB), 7, $0-32 10 | JMP syscall·getprocaddress(SB) 11 | 12 | TEXT ·loadlibrary(SB), 7, $0-24 13 | JMP syscall·loadlibrary(SB) 14 | -------------------------------------------------------------------------------- /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/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/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/csm/metric_exception.go: -------------------------------------------------------------------------------- 1 | package csm 2 | 3 | type metricException interface { 4 | Exception() string 5 | Message() string 6 | } 7 | 8 | type requestException struct { 9 | exception string 10 | message string 11 | } 12 | 13 | func (e requestException) Exception() string { 14 | return e.exception 15 | } 16 | func (e requestException) Message() string { 17 | return e.message 18 | } 19 | 20 | type awsException struct { 21 | requestException 22 | } 23 | 24 | type sdkException struct { 25 | requestException 26 | } 27 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/internal/shareddefaults/ecs_container.go: -------------------------------------------------------------------------------- 1 | package shareddefaults 2 | 3 | const ( 4 | // ECSCredsProviderEnvVar is an environmental variable key used to 5 | // determine which path needs to be hit. 6 | ECSCredsProviderEnvVar = "AWS_CONTAINER_CREDENTIALS_RELATIVE_URI" 7 | ) 8 | 9 | // ECSContainerCredentialsURI is the endpoint to retrieve container 10 | // credentials. This can be overridden to test to ensure the credential process 11 | // is behaving correctly. 12 | var ECSContainerCredentialsURI = "http://169.254.170.2" 13 | -------------------------------------------------------------------------------- /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 | ErrMissingRegion = awserr.New("MissingRegion", "could not find region configuration", nil) 9 | 10 | // ErrMissingEndpoint is an error that is returned if an endpoint cannot be 11 | // resolved for a service. 12 | ErrMissingEndpoint = awserr.New("MissingEndpoint", "'Endpoint' configuration is required for this service", nil) 13 | ) 14 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/aws/session/cabundle_transport_1_5.go: -------------------------------------------------------------------------------- 1 | // +build !go1.6,go1.5 2 | 3 | package session 4 | 5 | import ( 6 | "net" 7 | "net/http" 8 | "time" 9 | ) 10 | 11 | // Transport that should be used when a custom CA bundle is specified with the 12 | // SDK. 13 | func getCABundleTransport() *http.Transport { 14 | return &http.Transport{ 15 | Proxy: http.ProxyFromEnvironment, 16 | Dial: (&net.Dialer{ 17 | Timeout: 30 * time.Second, 18 | KeepAlive: 30 * time.Second, 19 | }).Dial, 20 | TLSHandshakeTimeout: 10 * time.Second, 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /aws/aws.go: -------------------------------------------------------------------------------- 1 | package aws 2 | 3 | import ( 4 | "github.com/aws/aws-sdk-go/aws" 5 | "github.com/aws/aws-sdk-go/aws/credentials" 6 | ) 7 | 8 | // AWS - AWS parameters 9 | type AWS struct { 10 | key string 11 | secret string 12 | region string 13 | } 14 | 15 | func (a *AWS) newConfig() *aws.Config { 16 | var config *aws.Config 17 | 18 | if a.key == "" { 19 | config = aws.NewConfig() 20 | } else { 21 | config = aws.NewConfig().WithCredentials( 22 | credentials.NewStaticCredentials(a.key, a.secret, ""), 23 | ) 24 | } 25 | 26 | return config.WithRegion(a.region) 27 | } 28 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/internal/ini/ws_token.go: -------------------------------------------------------------------------------- 1 | package ini 2 | 3 | import ( 4 | "unicode" 5 | ) 6 | 7 | // isWhitespace will return whether or not the character is 8 | // a whitespace character. 9 | // 10 | // Whitespace is defined as a space or tab. 11 | func isWhitespace(c rune) bool { 12 | return unicode.IsSpace(c) && c != '\n' && c != '\r' 13 | } 14 | 15 | func newWSToken(b []rune) (Token, int, error) { 16 | i := 0 17 | for ; i < len(b); i++ { 18 | if !isWhitespace(b[i]) { 19 | break 20 | } 21 | } 22 | 23 | return newToken(TokenWS, b[:i], NoneType), i, nil 24 | } 25 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/windows/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 windows,!race 6 | 7 | package windows 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/github.com/aws/aws-sdk-go/internal/sdkuri/path.go: -------------------------------------------------------------------------------- 1 | package sdkuri 2 | 3 | import ( 4 | "path" 5 | "strings" 6 | ) 7 | 8 | // PathJoin will join the elements of the path delimited by the "/" 9 | // character. Similar to path.Join with the exception the trailing "/" 10 | // character is preserved if present. 11 | func PathJoin(elems ...string) string { 12 | if len(elems) == 0 { 13 | return "" 14 | } 15 | 16 | hasTrailing := strings.HasSuffix(elems[len(elems)-1], "/") 17 | str := path.Join(elems...) 18 | if hasTrailing && str != "/" { 19 | str += "/" 20 | } 21 | 22 | return str 23 | } 24 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/windows/types_windows_386.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 windows 6 | 7 | type WSAData struct { 8 | Version uint16 9 | HighVersion uint16 10 | Description [WSADESCRIPTION_LEN + 1]byte 11 | SystemStatus [WSASYS_STATUS_LEN + 1]byte 12 | MaxSockets uint16 13 | MaxUdpDg uint16 14 | VendorInfo *byte 15 | } 16 | 17 | type Servent struct { 18 | Name *byte 19 | Aliases **byte 20 | Port uint16 21 | Proto *byte 22 | } 23 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/windows/types_windows_amd64.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 windows 6 | 7 | type WSAData struct { 8 | Version uint16 9 | HighVersion uint16 10 | MaxSockets uint16 11 | MaxUdpDg uint16 12 | VendorInfo *byte 13 | Description [WSADESCRIPTION_LEN + 1]byte 14 | SystemStatus [WSASYS_STATUS_LEN + 1]byte 15 | } 16 | 17 | type Servent struct { 18 | Name *byte 19 | Aliases **byte 20 | Proto *byte 21 | Port uint16 22 | } 23 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/windows/types_windows_arm.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 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 windows 6 | 7 | type WSAData struct { 8 | Version uint16 9 | HighVersion uint16 10 | Description [WSADESCRIPTION_LEN + 1]byte 11 | SystemStatus [WSASYS_STATUS_LEN + 1]byte 12 | MaxSockets uint16 13 | MaxUdpDg uint16 14 | VendorInfo *byte 15 | } 16 | 17 | type Servent struct { 18 | Name *byte 19 | Aliases **byte 20 | Port uint16 21 | Proto *byte 22 | } 23 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/aws/session/cabundle_transport_1_6.go: -------------------------------------------------------------------------------- 1 | // +build !go1.7,go1.6 2 | 3 | package session 4 | 5 | import ( 6 | "net" 7 | "net/http" 8 | "time" 9 | ) 10 | 11 | // Transport that should be used when a custom CA bundle is specified with the 12 | // SDK. 13 | func getCABundleTransport() *http.Transport { 14 | return &http.Transport{ 15 | Proxy: http.ProxyFromEnvironment, 16 | Dial: (&net.Dialer{ 17 | Timeout: 30 * time.Second, 18 | KeepAlive: 30 * time.Second, 19 | }).Dial, 20 | TLSHandshakeTimeout: 10 * time.Second, 21 | ExpectContinueTimeout: 1 * time.Second, 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/windows/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 windows 6 | 7 | package windows 8 | 9 | func itoa(val int) string { // do it here rather than with fmt to avoid dependency 10 | if val < 0 { 11 | return "-" + itoa(-val) 12 | } 13 | var buf [32]byte // big enough for int64 14 | i := len(buf) - 1 15 | for val >= 10 { 16 | buf[i] = byte(val%10 + '0') 17 | i-- 18 | val /= 10 19 | } 20 | buf[i] = byte(val + '0') 21 | return string(buf[i:]) 22 | } 23 | -------------------------------------------------------------------------------- /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/internal/ini/newline_token.go: -------------------------------------------------------------------------------- 1 | package ini 2 | 3 | func isNewline(b []rune) bool { 4 | if len(b) == 0 { 5 | return false 6 | } 7 | 8 | if b[0] == '\n' { 9 | return true 10 | } 11 | 12 | if len(b) < 2 { 13 | return false 14 | } 15 | 16 | return b[0] == '\r' && b[1] == '\n' 17 | } 18 | 19 | func newNewlineToken(b []rune) (Token, int, error) { 20 | i := 1 21 | if b[0] == '\r' && isNewline(b[1:]) { 22 | i++ 23 | } 24 | 25 | if !isNewline([]rune(b[:i])) { 26 | return emptyToken, 0, NewParseError("invalid new line token") 27 | } 28 | 29 | return newToken(TokenNL, b[:i], NoneType), i, nil 30 | } 31 | -------------------------------------------------------------------------------- /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/aws/aws-sdk-go/aws/context_sleep.go: -------------------------------------------------------------------------------- 1 | package aws 2 | 3 | import ( 4 | "time" 5 | ) 6 | 7 | // SleepWithContext will wait for the timer duration to expire, or the context 8 | // is canceled. Which ever happens first. If the context is canceled the Context's 9 | // error will be returned. 10 | // 11 | // Expects Context to always return a non-nil error if the Done channel is closed. 12 | func SleepWithContext(ctx Context, dur time.Duration) error { 13 | t := time.NewTimer(dur) 14 | defer t.Stop() 15 | 16 | select { 17 | case <-t.C: 18 | break 19 | case <-ctx.Done(): 20 | return ctx.Err() 21 | } 22 | 23 | return nil 24 | } 25 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/internal/ini/walker.go: -------------------------------------------------------------------------------- 1 | package ini 2 | 3 | // Walk will traverse the AST using the v, the Visitor. 4 | func Walk(tree []AST, v Visitor) error { 5 | for _, node := range tree { 6 | switch node.Kind { 7 | case ASTKindExpr, 8 | ASTKindExprStatement: 9 | 10 | if err := v.VisitExpr(node); err != nil { 11 | return err 12 | } 13 | case ASTKindStatement, 14 | ASTKindCompletedSectionStatement, 15 | ASTKindNestedSectionStatement, 16 | ASTKindCompletedNestedSectionStatement: 17 | 18 | if err := v.VisitStatement(node); err != nil { 19 | return err 20 | } 21 | } 22 | } 23 | 24 | return nil 25 | } 26 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/internal/ini/expression.go: -------------------------------------------------------------------------------- 1 | package ini 2 | 3 | // newExpression will return an expression AST. 4 | // Expr represents an expression 5 | // 6 | // grammar: 7 | // expr -> string | number 8 | func newExpression(tok Token) AST { 9 | return newASTWithRootToken(ASTKindExpr, tok) 10 | } 11 | 12 | func newEqualExpr(left AST, tok Token) AST { 13 | return newASTWithRootToken(ASTKindEqualExpr, tok, left) 14 | } 15 | 16 | // EqualExprKey will return a LHS value in the equal expr 17 | func EqualExprKey(ast AST) string { 18 | children := ast.GetChildren() 19 | if len(children) == 0 || ast.Kind != ASTKindEqualExpr { 20 | return "" 21 | } 22 | 23 | return string(children[0].Root.Raw()) 24 | } 25 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/internal/sdkrand/locked_source.go: -------------------------------------------------------------------------------- 1 | package sdkrand 2 | 3 | import ( 4 | "math/rand" 5 | "sync" 6 | "time" 7 | ) 8 | 9 | // lockedSource is a thread-safe implementation of rand.Source 10 | type lockedSource struct { 11 | lk sync.Mutex 12 | src rand.Source 13 | } 14 | 15 | func (r *lockedSource) Int63() (n int64) { 16 | r.lk.Lock() 17 | n = r.src.Int63() 18 | r.lk.Unlock() 19 | return 20 | } 21 | 22 | func (r *lockedSource) Seed(seed int64) { 23 | r.lk.Lock() 24 | r.src.Seed(seed) 25 | r.lk.Unlock() 26 | } 27 | 28 | // SeededRand is a new RNG using a thread safe implementation of rand.Source 29 | var SeededRand = rand.New(&lockedSource{src: rand.NewSource(time.Now().UnixNano())}) 30 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/aws/session/cabundle_transport.go: -------------------------------------------------------------------------------- 1 | // +build go1.7 2 | 3 | package session 4 | 5 | import ( 6 | "net" 7 | "net/http" 8 | "time" 9 | ) 10 | 11 | // Transport that should be used when a custom CA bundle is specified with the 12 | // SDK. 13 | func getCABundleTransport() *http.Transport { 14 | return &http.Transport{ 15 | Proxy: http.ProxyFromEnvironment, 16 | DialContext: (&net.Dialer{ 17 | Timeout: 30 * time.Second, 18 | KeepAlive: 30 * time.Second, 19 | DualStack: true, 20 | }).DialContext, 21 | MaxIdleConns: 100, 22 | IdleConnTimeout: 90 * time.Second, 23 | TLSHandshakeTimeout: 10 * time.Second, 24 | ExpectContinueTimeout: 1 * time.Second, 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /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/golang.org/x/sys/windows/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 windows,race 6 | 7 | package windows 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/github.com/aws/aws-sdk-go/aws/context_background_1_7.go: -------------------------------------------------------------------------------- 1 | // +build go1.7 2 | 3 | package aws 4 | 5 | import "context" 6 | 7 | // BackgroundContext returns a context that will never be canceled, has no 8 | // values, and no deadline. This context is used by the SDK to provide 9 | // backwards compatibility with non-context API operations and functionality. 10 | // 11 | // Go 1.6 and before: 12 | // This context function is equivalent to context.Background in the Go stdlib. 13 | // 14 | // Go 1.7 and later: 15 | // The context returned will be the value returned by context.Background() 16 | // 17 | // See https://golang.org/pkg/context for more information on Contexts. 18 | func BackgroundContext() Context { 19 | return context.Background() 20 | } 21 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/internal/ini/comment_token.go: -------------------------------------------------------------------------------- 1 | package ini 2 | 3 | // isComment will return whether or not the next byte(s) is a 4 | // comment. 5 | func isComment(b []rune) bool { 6 | if len(b) == 0 { 7 | return false 8 | } 9 | 10 | switch b[0] { 11 | case ';': 12 | return true 13 | case '#': 14 | return true 15 | } 16 | 17 | return false 18 | } 19 | 20 | // newCommentToken will create a comment token and 21 | // return how many bytes were read. 22 | func newCommentToken(b []rune) (Token, int, error) { 23 | i := 0 24 | for ; i < len(b); i++ { 25 | if b[i] == '\n' { 26 | break 27 | } 28 | 29 | if len(b)-i > 2 && b[i] == '\r' && b[i+1] == '\n' { 30 | break 31 | } 32 | } 33 | 34 | return newToken(TokenComment, b[:i], NoneType), i, nil 35 | } 36 | -------------------------------------------------------------------------------- /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/internal/ini/op_tokens.go: -------------------------------------------------------------------------------- 1 | package ini 2 | 3 | import ( 4 | "fmt" 5 | ) 6 | 7 | var ( 8 | equalOp = []rune("=") 9 | equalColonOp = []rune(":") 10 | ) 11 | 12 | func isOp(b []rune) bool { 13 | if len(b) == 0 { 14 | return false 15 | } 16 | 17 | switch b[0] { 18 | case '=': 19 | return true 20 | case ':': 21 | return true 22 | default: 23 | return false 24 | } 25 | } 26 | 27 | func newOpToken(b []rune) (Token, int, error) { 28 | tok := Token{} 29 | 30 | switch b[0] { 31 | case '=': 32 | tok = newToken(TokenOp, equalOp, NoneType) 33 | case ':': 34 | tok = newToken(TokenOp, equalColonOp, NoneType) 35 | default: 36 | return tok, 0, NewParseError(fmt.Sprintf("unexpected op type, %v", b[0])) 37 | } 38 | return tok, 1, nil 39 | } 40 | -------------------------------------------------------------------------------- /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/matttproud/golang_protobuf_extensions/pbutil/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 Matt T. Proud 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 | 15 | // Package pbutil provides record length-delimited Protocol Buffer streaming. 16 | package pbutil 17 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/internal/ini/sep_tokens.go: -------------------------------------------------------------------------------- 1 | package ini 2 | 3 | import ( 4 | "fmt" 5 | ) 6 | 7 | var ( 8 | emptyRunes = []rune{} 9 | ) 10 | 11 | func isSep(b []rune) bool { 12 | if len(b) == 0 { 13 | return false 14 | } 15 | 16 | switch b[0] { 17 | case '[', ']': 18 | return true 19 | default: 20 | return false 21 | } 22 | } 23 | 24 | var ( 25 | openBrace = []rune("[") 26 | closeBrace = []rune("]") 27 | ) 28 | 29 | func newSepToken(b []rune) (Token, int, error) { 30 | tok := Token{} 31 | 32 | switch b[0] { 33 | case '[': 34 | tok = newToken(TokenSep, openBrace, NoneType) 35 | case ']': 36 | tok = newToken(TokenSep, closeBrace, NoneType) 37 | default: 38 | return tok, 0, NewParseError(fmt.Sprintf("unexpected sep type, %v", b[0])) 39 | } 40 | return tok, 1, nil 41 | } 42 | -------------------------------------------------------------------------------- /vendor/github.com/prometheus/common/model/model.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Prometheus Authors 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | // You may obtain a copy of the License at 5 | // 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 model contains common data structures that are shared across 15 | // Prometheus components and libraries. 16 | package model 17 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/internal/ini/doc.go: -------------------------------------------------------------------------------- 1 | // Package ini is an LL(1) parser for configuration files. 2 | // 3 | // Example: 4 | // sections, err := ini.OpenFile("/path/to/file") 5 | // if err != nil { 6 | // panic(err) 7 | // } 8 | // 9 | // profile := "foo" 10 | // section, ok := sections.GetSection(profile) 11 | // if !ok { 12 | // fmt.Printf("section %q could not be found", profile) 13 | // } 14 | // 15 | // Below is the BNF that describes this parser 16 | // Grammar: 17 | // stmt -> value stmt' 18 | // stmt' -> epsilon | op stmt 19 | // value -> number | string | boolean | quoted_string 20 | // 21 | // section -> [ section' 22 | // section' -> value section_close 23 | // section_close -> ] 24 | // 25 | // SkipState will skip (NL WS)+ 26 | // 27 | // comment -> # comment' | ; comment' 28 | // comment' -> epsilon | value 29 | package ini 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/windows/memory_windows.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 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 windows 6 | 7 | const ( 8 | MEM_COMMIT = 0x00001000 9 | MEM_RESERVE = 0x00002000 10 | MEM_DECOMMIT = 0x00004000 11 | MEM_RELEASE = 0x00008000 12 | MEM_RESET = 0x00080000 13 | MEM_TOP_DOWN = 0x00100000 14 | MEM_WRITE_WATCH = 0x00200000 15 | MEM_PHYSICAL = 0x00400000 16 | MEM_RESET_UNDO = 0x01000000 17 | MEM_LARGE_PAGES = 0x20000000 18 | 19 | PAGE_NOACCESS = 0x01 20 | PAGE_READONLY = 0x02 21 | PAGE_READWRITE = 0x04 22 | PAGE_WRITECOPY = 0x08 23 | PAGE_EXECUTE_READ = 0x20 24 | PAGE_EXECUTE_READWRITE = 0x40 25 | PAGE_EXECUTE_WRITECOPY = 0x80 26 | ) 27 | -------------------------------------------------------------------------------- /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/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/golang.org/x/sys/windows/eventlog.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 windows 6 | 7 | package windows 8 | 9 | const ( 10 | EVENTLOG_SUCCESS = 0 11 | EVENTLOG_ERROR_TYPE = 1 12 | EVENTLOG_WARNING_TYPE = 2 13 | EVENTLOG_INFORMATION_TYPE = 4 14 | EVENTLOG_AUDIT_SUCCESS = 8 15 | EVENTLOG_AUDIT_FAILURE = 16 16 | ) 17 | 18 | //sys RegisterEventSource(uncServerName *uint16, sourceName *uint16) (handle Handle, err error) [failretval==0] = advapi32.RegisterEventSourceW 19 | //sys DeregisterEventSource(handle Handle) (err error) = advapi32.DeregisterEventSource 20 | //sys ReportEvent(log Handle, etype uint16, category uint16, eventId uint32, usrSId uintptr, numStrings uint16, dataSize uint32, strings **uint16, rawData *byte) (err error) = advapi32.ReportEventW 21 | -------------------------------------------------------------------------------- /vendor/github.com/prometheus/client_golang/NOTICE: -------------------------------------------------------------------------------- 1 | Prometheus instrumentation library for Go applications 2 | Copyright 2012-2015 The Prometheus Authors 3 | 4 | This product includes software developed at 5 | SoundCloud Ltd. (http://soundcloud.com/). 6 | 7 | 8 | The following components are included in this product: 9 | 10 | perks - a fork of https://github.com/bmizerany/perks 11 | https://github.com/beorn7/perks 12 | Copyright 2013-2015 Blake Mizerany, Björn Rabenstein 13 | See https://github.com/beorn7/perks/blob/master/README.md for license details. 14 | 15 | Go support for Protocol Buffers - Google's data interchange format 16 | http://github.com/golang/protobuf/ 17 | Copyright 2010 The Go Authors 18 | See source code for license details. 19 | 20 | Support for streaming Protocol Buffer messages for the Go language (golang). 21 | https://github.com/matttproud/golang_protobuf_extensions 22 | Copyright 2013 Matt T. Proud 23 | Licensed under the Apache License, Version 2.0 24 | -------------------------------------------------------------------------------- /vendor/github.com/prometheus/procfs/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | Prometheus uses GitHub to manage reviews of pull requests. 4 | 5 | * If you have a trivial fix or improvement, go ahead and create a pull request, 6 | addressing (with `@...`) the maintainer of this repository (see 7 | [MAINTAINERS.md](MAINTAINERS.md)) in the description of the pull request. 8 | 9 | * If you plan to do something more involved, first discuss your ideas 10 | on our [mailing list](https://groups.google.com/forum/?fromgroups#!forum/prometheus-developers). 11 | This will avoid unnecessary work and surely give you and us a good deal 12 | of inspiration. 13 | 14 | * Relevant coding style guidelines are the [Go Code Review 15 | Comments](https://code.google.com/p/go-wiki/wiki/CodeReviewComments) 16 | and the _Formatting and style_ section of Peter Bourgon's [Go: Best 17 | Practices for Production 18 | Environments](http://peter.bourgon.org/go-in-production/#formatting-and-style). 19 | -------------------------------------------------------------------------------- /vendor/github.com/prometheus/procfs/Makefile: -------------------------------------------------------------------------------- 1 | # Copyright 2018 The Prometheus Authors 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # 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 | include Makefile.common 15 | 16 | %/.unpacked: %.ttar 17 | @echo ">> extracting fixtures" 18 | ./ttar -C $(dir $*) -x -f $*.ttar 19 | touch $@ 20 | 21 | update_fixtures: 22 | rm -vf fixtures/.unpacked 23 | ./ttar -c -f fixtures.ttar fixtures/ 24 | 25 | .PHONY: build 26 | build: 27 | 28 | .PHONY: test 29 | test: fixtures/.unpacked common-test 30 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/internal/ini/skipper.go: -------------------------------------------------------------------------------- 1 | package ini 2 | 3 | // skipper is used to skip certain blocks of an ini file. 4 | // Currently skipper is used to skip nested blocks of ini 5 | // files. See example below 6 | // 7 | // [ foo ] 8 | // nested = ; this section will be skipped 9 | // a=b 10 | // c=d 11 | // bar=baz ; this will be included 12 | type skipper struct { 13 | shouldSkip bool 14 | TokenSet bool 15 | prevTok Token 16 | } 17 | 18 | func newSkipper() skipper { 19 | return skipper{ 20 | prevTok: emptyToken, 21 | } 22 | } 23 | 24 | func (s *skipper) ShouldSkip(tok Token) bool { 25 | if s.shouldSkip && 26 | s.prevTok.Type() == TokenNL && 27 | tok.Type() != TokenWS { 28 | 29 | s.Continue() 30 | return false 31 | } 32 | s.prevTok = tok 33 | 34 | return s.shouldSkip 35 | } 36 | 37 | func (s *skipper) Skip() { 38 | s.shouldSkip = true 39 | s.prevTok = emptyToken 40 | } 41 | 42 | func (s *skipper) Continue() { 43 | s.shouldSkip = false 44 | s.prevTok = emptyToken 45 | } 46 | -------------------------------------------------------------------------------- /vendor/github.com/prometheus/client_golang/prometheus/build_info_pre_1.12.go: -------------------------------------------------------------------------------- 1 | // Copyright 2019 The Prometheus Authors 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | // You may obtain a copy of the License at 5 | // 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 !go1.12 15 | 16 | package prometheus 17 | 18 | // readBuildInfo is a wrapper around debug.ReadBuildInfo for Go versions before 19 | // 1.12. Remove this whole file once the minimum supported Go version is 1.12. 20 | func readBuildInfo() (path, version, sum string) { 21 | return "unknown", "unknown", "unknown" 22 | } 23 | -------------------------------------------------------------------------------- /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 they 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/csm/metric_chan.go: -------------------------------------------------------------------------------- 1 | package csm 2 | 3 | import ( 4 | "sync/atomic" 5 | ) 6 | 7 | const ( 8 | runningEnum = iota 9 | pausedEnum 10 | ) 11 | 12 | var ( 13 | // MetricsChannelSize of metrics to hold in the channel 14 | MetricsChannelSize = 100 15 | ) 16 | 17 | type metricChan struct { 18 | ch chan metric 19 | paused int64 20 | } 21 | 22 | func newMetricChan(size int) metricChan { 23 | return metricChan{ 24 | ch: make(chan metric, size), 25 | } 26 | } 27 | 28 | func (ch *metricChan) Pause() { 29 | atomic.StoreInt64(&ch.paused, pausedEnum) 30 | } 31 | 32 | func (ch *metricChan) Continue() { 33 | atomic.StoreInt64(&ch.paused, runningEnum) 34 | } 35 | 36 | func (ch *metricChan) IsPaused() bool { 37 | v := atomic.LoadInt64(&ch.paused) 38 | return v == pausedEnum 39 | } 40 | 41 | // Push will push metrics to the metric channel if the channel 42 | // is not paused 43 | func (ch *metricChan) Push(m metric) bool { 44 | if ch.IsPaused() { 45 | return false 46 | } 47 | 48 | select { 49 | case ch.ch <- m: 50 | return true 51 | default: 52 | return false 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /vendor/github.com/prometheus/client_golang/prometheus/build_info.go: -------------------------------------------------------------------------------- 1 | // Copyright 2019 The Prometheus Authors 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | // You may obtain a copy of the License at 5 | // 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 go1.12 15 | 16 | package prometheus 17 | 18 | import "runtime/debug" 19 | 20 | // readBuildInfo is a wrapper around debug.ReadBuildInfo for Go 1.12+. 21 | func readBuildInfo() (path, version, sum string) { 22 | path, version, sum = "unknown", "unknown", "unknown" 23 | if bi, ok := debug.ReadBuildInfo(); ok { 24 | path = bi.Main.Path 25 | version = bi.Main.Version 26 | sum = bi.Main.Sum 27 | } 28 | return 29 | } 30 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/internal/ini/parse_error.go: -------------------------------------------------------------------------------- 1 | package ini 2 | 3 | import "fmt" 4 | 5 | const ( 6 | // ErrCodeParseError is returned when a parsing error 7 | // has occurred. 8 | ErrCodeParseError = "INIParseError" 9 | ) 10 | 11 | // ParseError is an error which is returned during any part of 12 | // the parsing process. 13 | type ParseError struct { 14 | msg string 15 | } 16 | 17 | // NewParseError will return a new ParseError where message 18 | // is the description of the error. 19 | func NewParseError(message string) *ParseError { 20 | return &ParseError{ 21 | msg: message, 22 | } 23 | } 24 | 25 | // Code will return the ErrCodeParseError 26 | func (err *ParseError) Code() string { 27 | return ErrCodeParseError 28 | } 29 | 30 | // Message returns the error's message 31 | func (err *ParseError) Message() string { 32 | return err.msg 33 | } 34 | 35 | // OrigError return nothing since there will never be any 36 | // original error. 37 | func (err *ParseError) OrigError() error { 38 | return nil 39 | } 40 | 41 | func (err *ParseError) Error() string { 42 | return fmt.Sprintf("%s: %s", err.Code(), err.Message()) 43 | } 44 | -------------------------------------------------------------------------------- /vendor/github.com/beorn7/perks/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (C) 2013 Blake Mizerany 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/internal/ini/statement.go: -------------------------------------------------------------------------------- 1 | package ini 2 | 3 | // Statement is an empty AST mostly used for transitioning states. 4 | func newStatement() AST { 5 | return newAST(ASTKindStatement, AST{}) 6 | } 7 | 8 | // SectionStatement represents a section AST 9 | func newSectionStatement(tok Token) AST { 10 | return newASTWithRootToken(ASTKindSectionStatement, tok) 11 | } 12 | 13 | // ExprStatement represents a completed expression AST 14 | func newExprStatement(ast AST) AST { 15 | return newAST(ASTKindExprStatement, ast) 16 | } 17 | 18 | // CommentStatement represents a comment in the ini definition. 19 | // 20 | // grammar: 21 | // comment -> #comment' | ;comment' 22 | // comment' -> epsilon | value 23 | func newCommentStatement(tok Token) AST { 24 | return newAST(ASTKindCommentStatement, newExpression(tok)) 25 | } 26 | 27 | // CompletedSectionStatement represents a completed section 28 | func newCompletedSectionStatement(ast AST) AST { 29 | return newAST(ASTKindCompletedSectionStatement, ast) 30 | } 31 | 32 | // SkipStatement is used to skip whole statements 33 | func newSkipStatement(ast AST) AST { 34 | return newAST(ASTKindSkipStatement, ast) 35 | } 36 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/aws/corehandlers/user_agent.go: -------------------------------------------------------------------------------- 1 | package corehandlers 2 | 3 | import ( 4 | "os" 5 | "runtime" 6 | 7 | "github.com/aws/aws-sdk-go/aws" 8 | "github.com/aws/aws-sdk-go/aws/request" 9 | ) 10 | 11 | // SDKVersionUserAgentHandler is a request handler for adding the SDK Version 12 | // to the user agent. 13 | var SDKVersionUserAgentHandler = request.NamedHandler{ 14 | Name: "core.SDKVersionUserAgentHandler", 15 | Fn: request.MakeAddToUserAgentHandler(aws.SDKName, aws.SDKVersion, 16 | runtime.Version(), runtime.GOOS, runtime.GOARCH), 17 | } 18 | 19 | const execEnvVar = `AWS_EXECUTION_ENV` 20 | const execEnvUAKey = `exec-env` 21 | 22 | // AddHostExecEnvUserAgentHander is a request handler appending the SDK's 23 | // execution environment to the user agent. 24 | // 25 | // If the environment variable AWS_EXECUTION_ENV is set, its value will be 26 | // appended to the user agent string. 27 | var AddHostExecEnvUserAgentHander = request.NamedHandler{ 28 | Name: "core.AddHostExecEnvUserAgentHander", 29 | Fn: func(r *request.Request) { 30 | v := os.Getenv(execEnvVar) 31 | if len(v) == 0 { 32 | return 33 | } 34 | 35 | request.AddToUserAgent(r, execEnvUAKey+"/"+v) 36 | }, 37 | } 38 | -------------------------------------------------------------------------------- /vendor/github.com/jmespath/go-jmespath/Makefile: -------------------------------------------------------------------------------- 1 | 2 | CMD = jpgo 3 | 4 | help: 5 | @echo "Please use \`make ' where is one of" 6 | @echo " test to run all the tests" 7 | @echo " build to build the library and jp executable" 8 | @echo " generate to run codegen" 9 | 10 | 11 | generate: 12 | go generate ./... 13 | 14 | build: 15 | rm -f $(CMD) 16 | go build ./... 17 | rm -f cmd/$(CMD)/$(CMD) && cd cmd/$(CMD)/ && go build ./... 18 | mv cmd/$(CMD)/$(CMD) . 19 | 20 | test: 21 | go test -v ./... 22 | 23 | check: 24 | go vet ./... 25 | @echo "golint ./..." 26 | @lint=`golint ./...`; \ 27 | lint=`echo "$$lint" | grep -v "astnodetype_string.go" | grep -v "toktype_string.go"`; \ 28 | echo "$$lint"; \ 29 | if [ "$$lint" != "" ]; then exit 1; fi 30 | 31 | htmlc: 32 | go test -coverprofile="/tmp/jpcov" && go tool cover -html="/tmp/jpcov" && unlink /tmp/jpcov 33 | 34 | buildfuzz: 35 | go-fuzz-build github.com/jmespath/go-jmespath/fuzz 36 | 37 | fuzz: buildfuzz 38 | go-fuzz -bin=./jmespath-fuzz.zip -workdir=fuzz/testdata 39 | 40 | bench: 41 | go test -bench . -cpuprofile cpu.out 42 | 43 | pprof-cpu: 44 | go tool pprof ./go-jmespath.test ./cpu.out 45 | -------------------------------------------------------------------------------- /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/aws/request/request_1_8.go: -------------------------------------------------------------------------------- 1 | // +build go1.8 2 | 3 | package request 4 | 5 | import ( 6 | "net/http" 7 | 8 | "github.com/aws/aws-sdk-go/aws/awserr" 9 | ) 10 | 11 | // NoBody is a http.NoBody reader instructing Go HTTP client to not include 12 | // and body in the HTTP request. 13 | var NoBody = http.NoBody 14 | 15 | // ResetBody rewinds the request body back to its starting position, and 16 | // sets the HTTP Request body reference. When the body is read prior 17 | // to being sent in the HTTP request it will need to be rewound. 18 | // 19 | // ResetBody will automatically be called by the SDK's build handler, but if 20 | // the request is being used directly ResetBody must be called before the request 21 | // is Sent. SetStringBody, SetBufferBody, and SetReaderBody will automatically 22 | // call ResetBody. 23 | // 24 | // Will also set the Go 1.8's http.Request.GetBody member to allow retrying 25 | // PUT/POST redirects. 26 | func (r *Request) ResetBody() { 27 | body, err := r.getNextRequestBody() 28 | if err != nil { 29 | r.Error = awserr.New(ErrCodeSerialization, 30 | "failed to reset request body", err) 31 | return 32 | } 33 | 34 | r.HTTPRequest.Body = body 35 | r.HTTPRequest.GetBody = r.getNextRequestBody 36 | } 37 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/internal/ini/ini.go: -------------------------------------------------------------------------------- 1 | package ini 2 | 3 | import ( 4 | "io" 5 | "os" 6 | 7 | "github.com/aws/aws-sdk-go/aws/awserr" 8 | ) 9 | 10 | // OpenFile takes a path to a given file, and will open and parse 11 | // that file. 12 | func OpenFile(path string) (Sections, error) { 13 | f, err := os.Open(path) 14 | if err != nil { 15 | return Sections{}, awserr.New(ErrCodeUnableToReadFile, "unable to open file", err) 16 | } 17 | defer f.Close() 18 | 19 | return Parse(f) 20 | } 21 | 22 | // Parse will parse the given file using the shared config 23 | // visitor. 24 | func Parse(f io.Reader) (Sections, error) { 25 | tree, err := ParseAST(f) 26 | if err != nil { 27 | return Sections{}, err 28 | } 29 | 30 | v := NewDefaultVisitor() 31 | if err = Walk(tree, v); err != nil { 32 | return Sections{}, err 33 | } 34 | 35 | return v.Sections, nil 36 | } 37 | 38 | // ParseBytes will parse the given bytes and return the parsed sections. 39 | func ParseBytes(b []byte) (Sections, error) { 40 | tree, err := ParseASTBytes(b) 41 | if err != nil { 42 | return Sections{}, err 43 | } 44 | 45 | v := NewDefaultVisitor() 46 | if err = Walk(tree, v); err != nil { 47 | return Sections{}, err 48 | } 49 | 50 | return v.Sections, nil 51 | } 52 | -------------------------------------------------------------------------------- /vendor/github.com/prometheus/common/expfmt/fuzz.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Prometheus Authors 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | // You may obtain a copy of the License at 5 | // 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 only when actually fuzzing 15 | // +build gofuzz 16 | 17 | package expfmt 18 | 19 | import "bytes" 20 | 21 | // Fuzz text metric parser with with github.com/dvyukov/go-fuzz: 22 | // 23 | // go-fuzz-build github.com/prometheus/common/expfmt 24 | // go-fuzz -bin expfmt-fuzz.zip -workdir fuzz 25 | // 26 | // Further input samples should go in the folder fuzz/corpus. 27 | func Fuzz(in []byte) int { 28 | parser := TextParser{} 29 | _, err := parser.TextToMetricFamilies(bytes.NewReader(in)) 30 | 31 | if err != nil { 32 | return 0 33 | } 34 | 35 | return 1 36 | } 37 | -------------------------------------------------------------------------------- /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/prometheus/procfs/proc_environ.go: -------------------------------------------------------------------------------- 1 | // Copyright 2019 The Prometheus Authors 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | // You may obtain a copy of the License at 5 | // 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 procfs 15 | 16 | import ( 17 | "io/ioutil" 18 | "os" 19 | "strings" 20 | ) 21 | 22 | // Environ reads process environments from /proc//environ 23 | func (p Proc) Environ() ([]string, error) { 24 | environments := make([]string, 0) 25 | 26 | f, err := os.Open(p.path("environ")) 27 | if err != nil { 28 | return environments, err 29 | } 30 | defer f.Close() 31 | 32 | data, err := ioutil.ReadAll(f) 33 | if err != nil { 34 | return environments, err 35 | } 36 | 37 | environments = strings.Split(string(data), "\000") 38 | if len(environments) > 0 { 39 | environments = environments[:len(environments)-1] 40 | } 41 | 42 | return environments, nil 43 | } 44 | -------------------------------------------------------------------------------- /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/github.com/prometheus/common/model/fnv.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Prometheus Authors 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | // You may obtain a copy of the License at 5 | // 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 model 15 | 16 | // Inline and byte-free variant of hash/fnv's fnv64a. 17 | 18 | const ( 19 | offset64 = 14695981039346656037 20 | prime64 = 1099511628211 21 | ) 22 | 23 | // hashNew initializies a new fnv64a hash value. 24 | func hashNew() uint64 { 25 | return offset64 26 | } 27 | 28 | // hashAdd adds a string to a fnv64a hash value, returning the updated hash. 29 | func hashAdd(h uint64, s string) uint64 { 30 | for i := 0; i < len(s); i++ { 31 | h ^= uint64(s[i]) 32 | h *= prime64 33 | } 34 | return h 35 | } 36 | 37 | // hashAddByte adds a byte to a fnv64a hash value, returning the updated hash. 38 | func hashAddByte(h uint64, b byte) uint64 { 39 | h ^= uint64(b) 40 | h *= prime64 41 | return h 42 | } 43 | -------------------------------------------------------------------------------- /vendor/github.com/prometheus/client_golang/prometheus/fnv.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Prometheus Authors 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | // You may obtain a copy of the License at 5 | // 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 prometheus 15 | 16 | // Inline and byte-free variant of hash/fnv's fnv64a. 17 | 18 | const ( 19 | offset64 = 14695981039346656037 20 | prime64 = 1099511628211 21 | ) 22 | 23 | // hashNew initializies a new fnv64a hash value. 24 | func hashNew() uint64 { 25 | return offset64 26 | } 27 | 28 | // hashAdd adds a string to a fnv64a hash value, returning the updated hash. 29 | func hashAdd(h uint64, s string) uint64 { 30 | for i := 0; i < len(s); i++ { 31 | h ^= uint64(s[i]) 32 | h *= prime64 33 | } 34 | return h 35 | } 36 | 37 | // hashAddByte adds a byte to a fnv64a hash value, returning the updated hash. 38 | func hashAddByte(h uint64, b byte) uint64 { 39 | h ^= uint64(b) 40 | h *= prime64 41 | return h 42 | } 43 | -------------------------------------------------------------------------------- /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(request.ErrCodeSerialization, "failed encoding Query request", err) 25 | return 26 | } 27 | 28 | if !r.IsPresigned() { 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/golang.org/x/sys/windows/mkknownfolderids.bash: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Copyright 2019 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 | set -e 8 | shopt -s nullglob 9 | 10 | knownfolders="$(printf '%s\n' "/mnt/c/Program Files (x86)/Windows Kits/"/*/Include/*/um/KnownFolders.h | sort -Vr | head -n 1)" 11 | [[ -n $knownfolders ]] || { echo "Unable to find KnownFolders.h" >&2; exit 1; } 12 | 13 | { 14 | echo "// Code generated by 'mkknownfolderids.bash'; DO NOT EDIT." 15 | echo 16 | echo "package windows" 17 | echo "type KNOWNFOLDERID GUID" 18 | echo "var (" 19 | while read -r line; do 20 | [[ $line =~ DEFINE_KNOWN_FOLDER\((FOLDERID_[^,]+),[\t\ ]*(0x[^,]+),[\t\ ]*(0x[^,]+),[\t\ ]*(0x[^,]+),[\t\ ]*(0x[^,]+),[\t\ ]*(0x[^,]+),[\t\ ]*(0x[^,]+),[\t\ ]*(0x[^,]+),[\t\ ]*(0x[^,]+),[\t\ ]*(0x[^,]+),[\t\ ]*(0x[^,]+),[\t\ ]*(0x[^,]+)\) ]] || continue 21 | printf "%s = &KNOWNFOLDERID{0x%08x, 0x%04x, 0x%04x, [8]byte{0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x}}\n" \ 22 | "${BASH_REMATCH[1]}" $(( "${BASH_REMATCH[2]}" )) $(( "${BASH_REMATCH[3]}" )) $(( "${BASH_REMATCH[4]}" )) \ 23 | $(( "${BASH_REMATCH[5]}" )) $(( "${BASH_REMATCH[6]}" )) $(( "${BASH_REMATCH[7]}" )) $(( "${BASH_REMATCH[8]}" )) \ 24 | $(( "${BASH_REMATCH[9]}" )) $(( "${BASH_REMATCH[10]}" )) $(( "${BASH_REMATCH[11]}" )) $(( "${BASH_REMATCH[12]}" )) 25 | done < "$knownfolders" 26 | echo ")" 27 | } | gofmt > "zknownfolderids_windows.go" 28 | -------------------------------------------------------------------------------- /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 | // sets 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/internal/ini/parse_stack.go: -------------------------------------------------------------------------------- 1 | package ini 2 | 3 | import ( 4 | "bytes" 5 | "fmt" 6 | ) 7 | 8 | // ParseStack is a stack that contains a container, the stack portion, 9 | // and the list which is the list of ASTs that have been successfully 10 | // parsed. 11 | type ParseStack struct { 12 | top int 13 | container []AST 14 | list []AST 15 | index int 16 | } 17 | 18 | func newParseStack(sizeContainer, sizeList int) ParseStack { 19 | return ParseStack{ 20 | container: make([]AST, sizeContainer), 21 | list: make([]AST, sizeList), 22 | } 23 | } 24 | 25 | // Pop will return and truncate the last container element. 26 | func (s *ParseStack) Pop() AST { 27 | s.top-- 28 | return s.container[s.top] 29 | } 30 | 31 | // Push will add the new AST to the container 32 | func (s *ParseStack) Push(ast AST) { 33 | s.container[s.top] = ast 34 | s.top++ 35 | } 36 | 37 | // MarkComplete will append the AST to the list of completed statements 38 | func (s *ParseStack) MarkComplete(ast AST) { 39 | s.list[s.index] = ast 40 | s.index++ 41 | } 42 | 43 | // List will return the completed statements 44 | func (s ParseStack) List() []AST { 45 | return s.list[:s.index] 46 | } 47 | 48 | // Len will return the length of the container 49 | func (s *ParseStack) Len() int { 50 | return s.top 51 | } 52 | 53 | func (s ParseStack) String() string { 54 | buf := bytes.Buffer{} 55 | for i, node := range s.list { 56 | buf.WriteString(fmt.Sprintf("%d: %v\n", i+1, node)) 57 | } 58 | 59 | return buf.String() 60 | } 61 | -------------------------------------------------------------------------------- /vendor/github.com/prometheus/procfs/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 Prometheus Team 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | // You may obtain a copy of the License at 5 | // 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 procfs provides functions to retrieve system, kernel and process 15 | // metrics from the pseudo-filesystem proc. 16 | // 17 | // Example: 18 | // 19 | // package main 20 | // 21 | // import ( 22 | // "fmt" 23 | // "log" 24 | // 25 | // "github.com/prometheus/procfs" 26 | // ) 27 | // 28 | // func main() { 29 | // p, err := procfs.Self() 30 | // if err != nil { 31 | // log.Fatalf("could not get process: %s", err) 32 | // } 33 | // 34 | // stat, err := p.NewStat() 35 | // if err != nil { 36 | // log.Fatalf("could not get process stat: %s", err) 37 | // } 38 | // 39 | // fmt.Printf("command: %s\n", stat.Comm) 40 | // fmt.Printf("cpu time: %fs\n", stat.CPUTime()) 41 | // fmt.Printf("vsize: %dB\n", stat.VirtualMemory()) 42 | // fmt.Printf("rss: %dB\n", stat.ResidentMemory()) 43 | // } 44 | // 45 | package procfs 46 | -------------------------------------------------------------------------------- /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/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.NewRequestFailure( 27 | awserr.New(request.ErrCodeSerialization, "failed decoding Query response", err), 28 | r.HTTPResponse.StatusCode, 29 | r.RequestID, 30 | ) 31 | return 32 | } 33 | } 34 | } 35 | 36 | // UnmarshalMeta unmarshals header response values for an AWS Query service. 37 | func UnmarshalMeta(r *request.Request) { 38 | r.RequestID = r.HTTPResponse.Header.Get("X-Amzn-Requestid") 39 | } 40 | -------------------------------------------------------------------------------- /vendor/github.com/golang/protobuf/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2010 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 | 29 | -------------------------------------------------------------------------------- /vendor/github.com/prometheus/procfs/fs.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Prometheus Authors 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | // You may obtain a copy of the License at 5 | // 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 procfs 15 | 16 | import ( 17 | "github.com/prometheus/procfs/internal/fs" 18 | ) 19 | 20 | // FS represents the pseudo-filesystem sys, which provides an interface to 21 | // kernel data structures. 22 | type FS struct { 23 | proc fs.FS 24 | } 25 | 26 | // DefaultMountPoint is the common mount point of the proc filesystem. 27 | const DefaultMountPoint = fs.DefaultProcMountPoint 28 | 29 | // NewDefaultFS returns a new proc FS mounted under the default proc mountPoint. 30 | // It will error if the mount point directory can't be read or is a file. 31 | func NewDefaultFS() (FS, error) { 32 | return NewFS(DefaultMountPoint) 33 | } 34 | 35 | // NewFS returns a new proc FS mounted under the given proc mountPoint. It will error 36 | // if the mount point directory can't be read or is a file. 37 | func NewFS(mountPoint string) (FS, error) { 38 | fs, err := fs.NewFS(mountPoint) 39 | if err != nil { 40 | return FS{}, err 41 | } 42 | return FS{fs}, nil 43 | } 44 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/private/protocol/host_prefix.go: -------------------------------------------------------------------------------- 1 | package protocol 2 | 3 | import ( 4 | "strings" 5 | 6 | "github.com/aws/aws-sdk-go/aws" 7 | "github.com/aws/aws-sdk-go/aws/request" 8 | ) 9 | 10 | // HostPrefixHandlerName is the handler name for the host prefix request 11 | // handler. 12 | const HostPrefixHandlerName = "awssdk.endpoint.HostPrefixHandler" 13 | 14 | // NewHostPrefixHandler constructs a build handler 15 | func NewHostPrefixHandler(prefix string, labelsFn func() map[string]string) request.NamedHandler { 16 | builder := HostPrefixBuilder{ 17 | Prefix: prefix, 18 | LabelsFn: labelsFn, 19 | } 20 | 21 | return request.NamedHandler{ 22 | Name: HostPrefixHandlerName, 23 | Fn: builder.Build, 24 | } 25 | } 26 | 27 | // HostPrefixBuilder provides the request handler to expand and prepend 28 | // the host prefix into the operation's request endpoint host. 29 | type HostPrefixBuilder struct { 30 | Prefix string 31 | LabelsFn func() map[string]string 32 | } 33 | 34 | // Build updates the passed in Request with the HostPrefix template expanded. 35 | func (h HostPrefixBuilder) Build(r *request.Request) { 36 | if aws.BoolValue(r.Config.DisableEndpointHostPrefix) { 37 | return 38 | } 39 | 40 | var labels map[string]string 41 | if h.LabelsFn != nil { 42 | labels = h.LabelsFn() 43 | } 44 | 45 | prefix := h.Prefix 46 | for name, value := range labels { 47 | prefix = strings.Replace(prefix, "{"+name+"}", value, -1) 48 | } 49 | 50 | r.HTTPRequest.URL.Host = prefix + r.HTTPRequest.URL.Host 51 | if len(r.HTTPRequest.Host) > 0 { 52 | r.HTTPRequest.Host = prefix + r.HTTPRequest.Host 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/aws/context_background_1_5.go: -------------------------------------------------------------------------------- 1 | // +build !go1.7 2 | 3 | package aws 4 | 5 | import "time" 6 | 7 | // An emptyCtx is a copy of the Go 1.7 context.emptyCtx type. This is copied to 8 | // provide a 1.6 and 1.5 safe version of context that is compatible with Go 9 | // 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 | 43 | // BackgroundContext returns a context that will never be canceled, has no 44 | // values, and no deadline. This context is used by the SDK to provide 45 | // backwards compatibility with non-context API operations and functionality. 46 | // 47 | // Go 1.6 and before: 48 | // This context function is equivalent to context.Background in the Go stdlib. 49 | // 50 | // Go 1.7 and later: 51 | // The context returned will be the value returned by context.Background() 52 | // 53 | // See https://golang.org/pkg/context for more information on Contexts. 54 | func BackgroundContext() Context { 55 | return backgroundCtx 56 | } 57 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/windows/env_windows.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 | // Windows environment variables. 6 | 7 | package windows 8 | 9 | import ( 10 | "syscall" 11 | "unicode/utf16" 12 | "unsafe" 13 | ) 14 | 15 | func Getenv(key string) (value string, found bool) { 16 | return syscall.Getenv(key) 17 | } 18 | 19 | func Setenv(key, value string) error { 20 | return syscall.Setenv(key, value) 21 | } 22 | 23 | func Clearenv() { 24 | syscall.Clearenv() 25 | } 26 | 27 | func Environ() []string { 28 | return syscall.Environ() 29 | } 30 | 31 | // Returns a default environment associated with the token, rather than the current 32 | // process. If inheritExisting is true, then this environment also inherits the 33 | // environment of the current process. 34 | func (token Token) Environ(inheritExisting bool) (env []string, err error) { 35 | var block *uint16 36 | err = CreateEnvironmentBlock(&block, token, inheritExisting) 37 | if err != nil { 38 | return nil, err 39 | } 40 | defer DestroyEnvironmentBlock(block) 41 | blockp := uintptr(unsafe.Pointer(block)) 42 | for { 43 | entry := (*[(1 << 30) - 1]uint16)(unsafe.Pointer(blockp))[:] 44 | for i, v := range entry { 45 | if v == 0 { 46 | entry = entry[:i] 47 | break 48 | } 49 | } 50 | if len(entry) == 0 { 51 | break 52 | } 53 | env = append(env, string(utf16.Decode(entry))) 54 | blockp += 2 * (uintptr(len(entry)) + 1) 55 | } 56 | return env, nil 57 | } 58 | 59 | func Unsetenv(key string) error { 60 | return syscall.Unsetenv(key) 61 | } 62 | -------------------------------------------------------------------------------- /vendor/github.com/prometheus/common/expfmt/expfmt.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Prometheus Authors 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | // You may obtain a copy of the License at 5 | // 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 expfmt contains tools for reading and writing Prometheus metrics. 15 | package expfmt 16 | 17 | // Format specifies the HTTP content type of the different wire protocols. 18 | type Format string 19 | 20 | // Constants to assemble the Content-Type values for the different wire protocols. 21 | const ( 22 | TextVersion = "0.0.4" 23 | ProtoType = `application/vnd.google.protobuf` 24 | ProtoProtocol = `io.prometheus.client.MetricFamily` 25 | ProtoFmt = ProtoType + "; proto=" + ProtoProtocol + ";" 26 | 27 | // The Content-Type values for the different wire protocols. 28 | FmtUnknown Format = `` 29 | FmtText Format = `text/plain; version=` + TextVersion + `; charset=utf-8` 30 | FmtProtoDelim Format = ProtoFmt + ` encoding=delimited` 31 | FmtProtoText Format = ProtoFmt + ` encoding=text` 32 | FmtProtoCompact Format = ProtoFmt + ` encoding=compact-text` 33 | ) 34 | 35 | const ( 36 | hdrContentType = "Content-Type" 37 | hdrAccept = "Accept" 38 | ) 39 | -------------------------------------------------------------------------------- /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/aws/aws-sdk-go/aws/context_1_5.go: -------------------------------------------------------------------------------- 1 | // +build !go1.9 2 | 3 | package aws 4 | 5 | import "time" 6 | 7 | // Context is an copy of the Go v1.7 stdlib's context.Context interface. 8 | // It is represented as a SDK interface to enable you to use the "WithContext" 9 | // API methods with Go v1.6 and a Context type such as golang.org/x/net/context. 10 | // 11 | // See https://golang.org/pkg/context on how to use contexts. 12 | type Context interface { 13 | // Deadline returns the time when work done on behalf of this context 14 | // should be canceled. Deadline returns ok==false when no deadline is 15 | // set. Successive calls to Deadline return the same results. 16 | Deadline() (deadline time.Time, ok bool) 17 | 18 | // Done returns a channel that's closed when work done on behalf of this 19 | // context should be canceled. Done may return nil if this context can 20 | // never be canceled. Successive calls to Done return the same value. 21 | Done() <-chan struct{} 22 | 23 | // Err returns a non-nil error value after Done is closed. Err returns 24 | // Canceled if the context was canceled or DeadlineExceeded if the 25 | // context's deadline passed. No other values for Err are defined. 26 | // After Done is closed, successive calls to Err return the same value. 27 | Err() error 28 | 29 | // Value returns the value associated with this context for key, or nil 30 | // if no value is associated with key. Successive calls to Value with 31 | // the same key returns the same result. 32 | // 33 | // Use context values only for request-scoped data that transits 34 | // processes and API boundaries, not for passing optional parameters to 35 | // functions. 36 | Value(key interface{}) interface{} 37 | } 38 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/aws/request/offset_reader.go: -------------------------------------------------------------------------------- 1 | package request 2 | 3 | import ( 4 | "io" 5 | "sync" 6 | 7 | "github.com/aws/aws-sdk-go/internal/sdkio" 8 | ) 9 | 10 | // offsetReader is a thread-safe io.ReadCloser to prevent racing 11 | // with retrying requests 12 | type offsetReader struct { 13 | buf io.ReadSeeker 14 | lock sync.Mutex 15 | closed bool 16 | } 17 | 18 | func newOffsetReader(buf io.ReadSeeker, offset int64) (*offsetReader, error) { 19 | reader := &offsetReader{} 20 | _, err := buf.Seek(offset, sdkio.SeekStart) 21 | if err != nil { 22 | return nil, err 23 | } 24 | 25 | reader.buf = buf 26 | return reader, nil 27 | } 28 | 29 | // Close will close the instance of the offset reader's access to 30 | // the underlying io.ReadSeeker. 31 | func (o *offsetReader) Close() error { 32 | o.lock.Lock() 33 | defer o.lock.Unlock() 34 | o.closed = true 35 | return nil 36 | } 37 | 38 | // Read is a thread-safe read of the underlying io.ReadSeeker 39 | func (o *offsetReader) Read(p []byte) (int, error) { 40 | o.lock.Lock() 41 | defer o.lock.Unlock() 42 | 43 | if o.closed { 44 | return 0, io.EOF 45 | } 46 | 47 | return o.buf.Read(p) 48 | } 49 | 50 | // Seek is a thread-safe seeking operation. 51 | func (o *offsetReader) Seek(offset int64, whence int) (int64, error) { 52 | o.lock.Lock() 53 | defer o.lock.Unlock() 54 | 55 | return o.buf.Seek(offset, whence) 56 | } 57 | 58 | // CloseAndCopy will return a new offsetReader with a copy of the old buffer 59 | // and close the old buffer. 60 | func (o *offsetReader) CloseAndCopy(offset int64) (*offsetReader, error) { 61 | if err := o.Close(); err != nil { 62 | return nil, err 63 | } 64 | return newOffsetReader(o.buf, offset) 65 | } 66 | -------------------------------------------------------------------------------- /vendor/github.com/matttproud/golang_protobuf_extensions/pbutil/encode.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 Matt T. Proud 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 | 15 | package pbutil 16 | 17 | import ( 18 | "encoding/binary" 19 | "io" 20 | 21 | "github.com/golang/protobuf/proto" 22 | ) 23 | 24 | // WriteDelimited encodes and dumps a message to the provided writer prefixed 25 | // with a 32-bit varint indicating the length of the encoded message, producing 26 | // a length-delimited record stream, which can be used to chain together 27 | // encoded messages of the same type together in a file. It returns the total 28 | // number of bytes written and any applicable error. This is roughly 29 | // equivalent to the companion Java API's MessageLite#writeDelimitedTo. 30 | func WriteDelimited(w io.Writer, m proto.Message) (n int, err error) { 31 | buffer, err := proto.Marshal(m) 32 | if err != nil { 33 | return 0, err 34 | } 35 | 36 | var buf [binary.MaxVarintLen32]byte 37 | encodedLength := binary.PutUvarint(buf[:], uint64(len(buffer))) 38 | 39 | sync, err := w.Write(buf[:encodedLength]) 40 | if err != nil { 41 | return sync, err 42 | } 43 | 44 | n, err = w.Write(buffer) 45 | return n + sync, err 46 | } 47 | -------------------------------------------------------------------------------- /vendor/github.com/prometheus/client_golang/prometheus/untyped.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Prometheus Authors 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | // You may obtain a copy of the License at 5 | // 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 prometheus 15 | 16 | // UntypedOpts is an alias for Opts. See there for doc comments. 17 | type UntypedOpts Opts 18 | 19 | // UntypedFunc works like GaugeFunc but the collected metric is of type 20 | // "Untyped". UntypedFunc is useful to mirror an external metric of unknown 21 | // type. 22 | // 23 | // To create UntypedFunc instances, use NewUntypedFunc. 24 | type UntypedFunc interface { 25 | Metric 26 | Collector 27 | } 28 | 29 | // NewUntypedFunc creates a new UntypedFunc based on the provided 30 | // UntypedOpts. The value reported is determined by calling the given function 31 | // from within the Write method. Take into account that metric collection may 32 | // happen concurrently. If that results in concurrent calls to Write, like in 33 | // the case where an UntypedFunc is directly registered with Prometheus, the 34 | // provided function must be concurrency-safe. 35 | func NewUntypedFunc(opts UntypedOpts, function func() float64) UntypedFunc { 36 | return newValueFunc(NewDesc( 37 | BuildFQName(opts.Namespace, opts.Subsystem, opts.Name), 38 | opts.Help, 39 | nil, 40 | opts.ConstLabels, 41 | ), UntypedValue, function) 42 | } 43 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/private/protocol/host.go: -------------------------------------------------------------------------------- 1 | package protocol 2 | 3 | import ( 4 | "strings" 5 | 6 | "github.com/aws/aws-sdk-go/aws/request" 7 | ) 8 | 9 | // ValidateEndpointHostHandler is a request handler that will validate the 10 | // request endpoint's hosts is a valid RFC 3986 host. 11 | var ValidateEndpointHostHandler = request.NamedHandler{ 12 | Name: "awssdk.protocol.ValidateEndpointHostHandler", 13 | Fn: func(r *request.Request) { 14 | err := ValidateEndpointHost(r.Operation.Name, r.HTTPRequest.URL.Host) 15 | if err != nil { 16 | r.Error = err 17 | } 18 | }, 19 | } 20 | 21 | // ValidateEndpointHost validates that the host string passed in is a valid RFC 22 | // 3986 host. Returns error if the host is not valid. 23 | func ValidateEndpointHost(opName, host string) error { 24 | paramErrs := request.ErrInvalidParams{Context: opName} 25 | labels := strings.Split(host, ".") 26 | 27 | for i, label := range labels { 28 | if i == len(labels)-1 && len(label) == 0 { 29 | // Allow trailing dot for FQDN hosts. 30 | continue 31 | } 32 | 33 | if !ValidHostLabel(label) { 34 | paramErrs.Add(request.NewErrParamFormat( 35 | "endpoint host label", "[a-zA-Z0-9-]{1,63}", label)) 36 | } 37 | } 38 | 39 | if len(host) > 255 { 40 | paramErrs.Add(request.NewErrParamMaxLen( 41 | "endpoint host", 255, host, 42 | )) 43 | } 44 | 45 | if paramErrs.Len() > 0 { 46 | return paramErrs 47 | } 48 | return nil 49 | } 50 | 51 | // ValidHostLabel returns if the label is a valid RFC 3986 host label. 52 | func ValidHostLabel(label string) bool { 53 | if l := len(label); l == 0 || l > 63 { 54 | return false 55 | } 56 | for _, r := range label { 57 | switch { 58 | case r >= '0' && r <= '9': 59 | case r >= 'A' && r <= 'Z': 60 | case r >= 'a' && r <= 'z': 61 | case r == '-': 62 | default: 63 | return false 64 | } 65 | } 66 | 67 | return true 68 | } 69 | -------------------------------------------------------------------------------- /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 | ErrStaticCredentialsEmpty = awserr.New("EmptyStaticCreds", "static credentials are empty", nil) 13 | ) 14 | 15 | // A StaticProvider is a set of credentials which are set programmatically, 16 | // and will never expire. 17 | type StaticProvider struct { 18 | Value 19 | } 20 | 21 | // NewStaticCredentials returns a pointer to a new Credentials object 22 | // wrapping a static credentials value provider. 23 | func NewStaticCredentials(id, secret, token string) *Credentials { 24 | return NewCredentials(&StaticProvider{Value: Value{ 25 | AccessKeyID: id, 26 | SecretAccessKey: secret, 27 | SessionToken: token, 28 | }}) 29 | } 30 | 31 | // NewStaticCredentialsFromCreds returns a pointer to a new Credentials object 32 | // wrapping the static credentials value provide. Same as NewStaticCredentials 33 | // but takes the creds Value instead of individual fields 34 | func NewStaticCredentialsFromCreds(creds Value) *Credentials { 35 | return NewCredentials(&StaticProvider{Value: creds}) 36 | } 37 | 38 | // Retrieve returns the credentials or error if the credentials are invalid. 39 | func (s *StaticProvider) Retrieve() (Value, error) { 40 | if s.AccessKeyID == "" || s.SecretAccessKey == "" { 41 | return Value{ProviderName: StaticProviderName}, ErrStaticCredentialsEmpty 42 | } 43 | 44 | if len(s.Value.ProviderName) == 0 { 45 | s.Value.ProviderName = StaticProviderName 46 | } 47 | return s.Value, nil 48 | } 49 | 50 | // IsExpired returns if the credentials are expired. 51 | // 52 | // For StaticProvider, the credentials never expired. 53 | func (s *StaticProvider) IsExpired() bool { 54 | return false 55 | } 56 | -------------------------------------------------------------------------------- /vendor/github.com/prometheus/procfs/proc_io.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Prometheus Authors 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | // You may obtain a copy of the License at 5 | // 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 procfs 15 | 16 | import ( 17 | "fmt" 18 | "io/ioutil" 19 | "os" 20 | ) 21 | 22 | // ProcIO models the content of /proc//io. 23 | type ProcIO struct { 24 | // Chars read. 25 | RChar uint64 26 | // Chars written. 27 | WChar uint64 28 | // Read syscalls. 29 | SyscR uint64 30 | // Write syscalls. 31 | SyscW uint64 32 | // Bytes read. 33 | ReadBytes uint64 34 | // Bytes written. 35 | WriteBytes uint64 36 | // Bytes written, but taking into account truncation. See 37 | // Documentation/filesystems/proc.txt in the kernel sources for 38 | // detailed explanation. 39 | CancelledWriteBytes int64 40 | } 41 | 42 | // IO creates a new ProcIO instance from a given Proc instance. 43 | func (p Proc) IO() (ProcIO, error) { 44 | pio := ProcIO{} 45 | 46 | f, err := os.Open(p.path("io")) 47 | if err != nil { 48 | return pio, err 49 | } 50 | defer f.Close() 51 | 52 | data, err := ioutil.ReadAll(f) 53 | if err != nil { 54 | return pio, err 55 | } 56 | 57 | ioFormat := "rchar: %d\nwchar: %d\nsyscr: %d\nsyscw: %d\n" + 58 | "read_bytes: %d\nwrite_bytes: %d\n" + 59 | "cancelled_write_bytes: %d\n" 60 | 61 | _, err = fmt.Sscanf(string(data), ioFormat, &pio.RChar, &pio.WChar, &pio.SyscR, 62 | &pio.SyscW, &pio.ReadBytes, &pio.WriteBytes, &pio.CancelledWriteBytes) 63 | 64 | return pio, err 65 | } 66 | -------------------------------------------------------------------------------- /vendor/github.com/prometheus/procfs/internal/fs/fs.go: -------------------------------------------------------------------------------- 1 | // Copyright 2019 The Prometheus Authors 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | // You may obtain a copy of the License at 5 | // 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 fs 15 | 16 | import ( 17 | "fmt" 18 | "os" 19 | "path/filepath" 20 | ) 21 | 22 | const ( 23 | // DefaultProcMountPoint is the common mount point of the proc filesystem. 24 | DefaultProcMountPoint = "/proc" 25 | 26 | // DefaultSysMountPoint is the common mount point of the sys filesystem. 27 | DefaultSysMountPoint = "/sys" 28 | 29 | // DefaultConfigfsMountPoint is the commont mount point of the configfs 30 | DefaultConfigfsMountPoint = "/sys/kernel/config" 31 | ) 32 | 33 | // FS represents a pseudo-filesystem, normally /proc or /sys, which provides an 34 | // interface to kernel data structures. 35 | type FS string 36 | 37 | // NewFS returns a new FS mounted under the given mountPoint. It will error 38 | // if the mount point can't be read. 39 | func NewFS(mountPoint string) (FS, error) { 40 | info, err := os.Stat(mountPoint) 41 | if err != nil { 42 | return "", fmt.Errorf("could not read %s: %s", mountPoint, err) 43 | } 44 | if !info.IsDir() { 45 | return "", fmt.Errorf("mount point %s is not a directory", mountPoint) 46 | } 47 | 48 | return FS(mountPoint), nil 49 | } 50 | 51 | // Path appends the given path elements to the filesystem path, adding separators 52 | // as necessary. 53 | func (fs FS) Path(p ...string) string { 54 | return filepath.Join(append([]string{string(fs)}, p...)...) 55 | } 56 | -------------------------------------------------------------------------------- /vendor/github.com/prometheus/client_golang/prometheus/timer.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Prometheus Authors 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | // You may obtain a copy of the License at 5 | // 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 prometheus 15 | 16 | import "time" 17 | 18 | // Timer is a helper type to time functions. Use NewTimer to create new 19 | // instances. 20 | type Timer struct { 21 | begin time.Time 22 | observer Observer 23 | } 24 | 25 | // NewTimer creates a new Timer. The provided Observer is used to observe a 26 | // duration in seconds. Timer is usually used to time a function call in the 27 | // following way: 28 | // func TimeMe() { 29 | // timer := NewTimer(myHistogram) 30 | // defer timer.ObserveDuration() 31 | // // Do actual work. 32 | // } 33 | func NewTimer(o Observer) *Timer { 34 | return &Timer{ 35 | begin: time.Now(), 36 | observer: o, 37 | } 38 | } 39 | 40 | // ObserveDuration records the duration passed since the Timer was created with 41 | // NewTimer. It calls the Observe method of the Observer provided during 42 | // construction with the duration in seconds as an argument. The observed 43 | // duration is also returned. ObserveDuration is usually called with a defer 44 | // statement. 45 | // 46 | // Note that this method is only guaranteed to never observe negative durations 47 | // if used with Go1.9+. 48 | func (t *Timer) ObserveDuration() time.Duration { 49 | d := time.Since(t.begin) 50 | if t.observer != nil { 51 | t.observer.Observe(d.Seconds()) 52 | } 53 | return d 54 | } 55 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/private/protocol/jsonvalue.go: -------------------------------------------------------------------------------- 1 | package protocol 2 | 3 | import ( 4 | "encoding/base64" 5 | "encoding/json" 6 | "fmt" 7 | "strconv" 8 | 9 | "github.com/aws/aws-sdk-go/aws" 10 | ) 11 | 12 | // EscapeMode is the mode that should be use for escaping a value 13 | type EscapeMode uint 14 | 15 | // The modes for escaping a value before it is marshaled, and unmarshaled. 16 | const ( 17 | NoEscape EscapeMode = iota 18 | Base64Escape 19 | QuotedEscape 20 | ) 21 | 22 | // EncodeJSONValue marshals the value into a JSON string, and optionally base64 23 | // encodes the string before returning it. 24 | // 25 | // Will panic if the escape mode is unknown. 26 | func EncodeJSONValue(v aws.JSONValue, escape EscapeMode) (string, error) { 27 | b, err := json.Marshal(v) 28 | if err != nil { 29 | return "", err 30 | } 31 | 32 | switch escape { 33 | case NoEscape: 34 | return string(b), nil 35 | case Base64Escape: 36 | return base64.StdEncoding.EncodeToString(b), nil 37 | case QuotedEscape: 38 | return strconv.Quote(string(b)), nil 39 | } 40 | 41 | panic(fmt.Sprintf("EncodeJSONValue called with unknown EscapeMode, %v", escape)) 42 | } 43 | 44 | // DecodeJSONValue will attempt to decode the string input as a JSONValue. 45 | // Optionally decoding base64 the value first before JSON unmarshaling. 46 | // 47 | // Will panic if the escape mode is unknown. 48 | func DecodeJSONValue(v string, escape EscapeMode) (aws.JSONValue, error) { 49 | var b []byte 50 | var err error 51 | 52 | switch escape { 53 | case NoEscape: 54 | b = []byte(v) 55 | case Base64Escape: 56 | b, err = base64.StdEncoding.DecodeString(v) 57 | case QuotedEscape: 58 | var u string 59 | u, err = strconv.Unquote(v) 60 | b = []byte(u) 61 | default: 62 | panic(fmt.Sprintf("DecodeJSONValue called with unknown EscapeMode, %v", escape)) 63 | } 64 | 65 | if err != nil { 66 | return nil, err 67 | } 68 | 69 | m := aws.JSONValue{} 70 | err = json.Unmarshal(b, &m) 71 | if err != nil { 72 | return nil, err 73 | } 74 | 75 | return m, nil 76 | } 77 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/windows/mkerrors.bash: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Copyright 2019 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 | set -e 8 | shopt -s nullglob 9 | 10 | winerror="$(printf '%s\n' "/mnt/c/Program Files (x86)/Windows Kits/"/*/Include/*/shared/winerror.h | sort -Vr | head -n 1)" 11 | [[ -n $winerror ]] || { echo "Unable to find winerror.h" >&2; exit 1; } 12 | 13 | declare -A errors 14 | 15 | { 16 | echo "// Code generated by 'mkerrors.bash'; DO NOT EDIT." 17 | echo 18 | echo "package windows" 19 | echo "import \"syscall\"" 20 | echo "const (" 21 | 22 | while read -r line; do 23 | unset vtype 24 | if [[ $line =~ ^#define\ +([A-Z0-9_]+k?)\ +([A-Z0-9_]+\()?([A-Z][A-Z0-9_]+k?)\)? ]]; then 25 | key="${BASH_REMATCH[1]}" 26 | value="${BASH_REMATCH[3]}" 27 | elif [[ $line =~ ^#define\ +([A-Z0-9_]+k?)\ +([A-Z0-9_]+\()?((0x)?[0-9A-Fa-f]+)L?\)? ]]; then 28 | key="${BASH_REMATCH[1]}" 29 | value="${BASH_REMATCH[3]}" 30 | vtype="${BASH_REMATCH[2]}" 31 | elif [[ $line =~ ^#define\ +([A-Z0-9_]+k?)\ +\(\(([A-Z]+)\)((0x)?[0-9A-Fa-f]+)L?\) ]]; then 32 | key="${BASH_REMATCH[1]}" 33 | value="${BASH_REMATCH[3]}" 34 | vtype="${BASH_REMATCH[2]}" 35 | else 36 | continue 37 | fi 38 | [[ -n $key && -n $value ]] || continue 39 | [[ -z ${errors["$key"]} ]] || continue 40 | errors["$key"]="$value" 41 | if [[ -v vtype ]]; then 42 | if [[ $key == FACILITY_* || $key == NO_ERROR ]]; then 43 | vtype="" 44 | elif [[ $vtype == *HANDLE* || $vtype == *HRESULT* ]]; then 45 | vtype="Handle" 46 | else 47 | vtype="syscall.Errno" 48 | fi 49 | last_vtype="$vtype" 50 | else 51 | vtype="" 52 | if [[ $last_vtype == Handle && $value == NO_ERROR ]]; then 53 | value="S_OK" 54 | elif [[ $last_vtype == syscall.Errno && $value == NO_ERROR ]]; then 55 | value="ERROR_SUCCESS" 56 | fi 57 | fi 58 | 59 | echo "$key $vtype = $value" 60 | done < "$winerror" 61 | 62 | echo ")" 63 | } | gofmt > "zerrors_windows.go" 64 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/private/protocol/query/unmarshal_error.go: -------------------------------------------------------------------------------- 1 | package query 2 | 3 | import ( 4 | "encoding/xml" 5 | "fmt" 6 | 7 | "github.com/aws/aws-sdk-go/aws/awserr" 8 | "github.com/aws/aws-sdk-go/aws/request" 9 | "github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil" 10 | ) 11 | 12 | // UnmarshalErrorHandler is a name request handler to unmarshal request errors 13 | var UnmarshalErrorHandler = request.NamedHandler{Name: "awssdk.query.UnmarshalError", Fn: UnmarshalError} 14 | 15 | type xmlErrorResponse struct { 16 | Code string `xml:"Error>Code"` 17 | Message string `xml:"Error>Message"` 18 | RequestID string `xml:"RequestId"` 19 | } 20 | 21 | type xmlResponseError struct { 22 | xmlErrorResponse 23 | } 24 | 25 | func (e *xmlResponseError) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { 26 | const svcUnavailableTagName = "ServiceUnavailableException" 27 | const errorResponseTagName = "ErrorResponse" 28 | 29 | switch start.Name.Local { 30 | case svcUnavailableTagName: 31 | e.Code = svcUnavailableTagName 32 | e.Message = "service is unavailable" 33 | return d.Skip() 34 | 35 | case errorResponseTagName: 36 | return d.DecodeElement(&e.xmlErrorResponse, &start) 37 | 38 | default: 39 | return fmt.Errorf("unknown error response tag, %v", start) 40 | } 41 | } 42 | 43 | // UnmarshalError unmarshals an error response for an AWS Query service. 44 | func UnmarshalError(r *request.Request) { 45 | defer r.HTTPResponse.Body.Close() 46 | 47 | var respErr xmlResponseError 48 | err := xmlutil.UnmarshalXMLError(&respErr, r.HTTPResponse.Body) 49 | if err != nil { 50 | r.Error = awserr.NewRequestFailure( 51 | awserr.New(request.ErrCodeSerialization, 52 | "failed to unmarshal error message", err), 53 | r.HTTPResponse.StatusCode, 54 | r.RequestID, 55 | ) 56 | return 57 | } 58 | 59 | reqID := respErr.RequestID 60 | if len(reqID) == 0 { 61 | reqID = r.RequestID 62 | } 63 | 64 | r.Error = awserr.NewRequestFailure( 65 | awserr.New(respErr.Code, respErr.Message, nil), 66 | r.HTTPResponse.StatusCode, 67 | reqID, 68 | ) 69 | } 70 | -------------------------------------------------------------------------------- /vendor/github.com/prometheus/client_golang/prometheus/observer.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Prometheus Authors 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | // You may obtain a copy of the License at 5 | // 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 prometheus 15 | 16 | // Observer is the interface that wraps the Observe method, which is used by 17 | // Histogram and Summary to add observations. 18 | type Observer interface { 19 | Observe(float64) 20 | } 21 | 22 | // The ObserverFunc type is an adapter to allow the use of ordinary 23 | // functions as Observers. If f is a function with the appropriate 24 | // signature, ObserverFunc(f) is an Observer that calls f. 25 | // 26 | // This adapter is usually used in connection with the Timer type, and there are 27 | // two general use cases: 28 | // 29 | // The most common one is to use a Gauge as the Observer for a Timer. 30 | // See the "Gauge" Timer example. 31 | // 32 | // The more advanced use case is to create a function that dynamically decides 33 | // which Observer to use for observing the duration. See the "Complex" Timer 34 | // example. 35 | type ObserverFunc func(float64) 36 | 37 | // Observe calls f(value). It implements Observer. 38 | func (f ObserverFunc) Observe(value float64) { 39 | f(value) 40 | } 41 | 42 | // ObserverVec is an interface implemented by `HistogramVec` and `SummaryVec`. 43 | type ObserverVec interface { 44 | GetMetricWith(Labels) (Observer, error) 45 | GetMetricWithLabelValues(lvs ...string) (Observer, error) 46 | With(Labels) Observer 47 | WithLabelValues(...string) Observer 48 | CurryWith(Labels) (ObserverVec, error) 49 | MustCurryWith(Labels) ObserverVec 50 | 51 | Collector 52 | } 53 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/private/protocol/timestamp.go: -------------------------------------------------------------------------------- 1 | package protocol 2 | 3 | import ( 4 | "strconv" 5 | "time" 6 | ) 7 | 8 | // Names of time formats supported by the SDK 9 | const ( 10 | RFC822TimeFormatName = "rfc822" 11 | ISO8601TimeFormatName = "iso8601" 12 | UnixTimeFormatName = "unixTimestamp" 13 | ) 14 | 15 | // Time formats supported by the SDK 16 | const ( 17 | // RFC 7231#section-7.1.1.1 timetamp format. e.g Tue, 29 Apr 2014 18:30:38 GMT 18 | RFC822TimeFormat = "Mon, 2 Jan 2006 15:04:05 GMT" 19 | 20 | // RFC3339 a subset of the ISO8601 timestamp format. e.g 2014-04-29T18:30:38Z 21 | ISO8601TimeFormat = "2006-01-02T15:04:05Z" 22 | ) 23 | 24 | // IsKnownTimestampFormat returns if the timestamp format name 25 | // is know to the SDK's protocols. 26 | func IsKnownTimestampFormat(name string) bool { 27 | switch name { 28 | case RFC822TimeFormatName: 29 | fallthrough 30 | case ISO8601TimeFormatName: 31 | fallthrough 32 | case UnixTimeFormatName: 33 | return true 34 | default: 35 | return false 36 | } 37 | } 38 | 39 | // FormatTime returns a string value of the time. 40 | func FormatTime(name string, t time.Time) string { 41 | t = t.UTC() 42 | 43 | switch name { 44 | case RFC822TimeFormatName: 45 | return t.Format(RFC822TimeFormat) 46 | case ISO8601TimeFormatName: 47 | return t.Format(ISO8601TimeFormat) 48 | case UnixTimeFormatName: 49 | return strconv.FormatInt(t.Unix(), 10) 50 | default: 51 | panic("unknown timestamp format name, " + name) 52 | } 53 | } 54 | 55 | // ParseTime attempts to parse the time given the format. Returns 56 | // the time if it was able to be parsed, and fails otherwise. 57 | func ParseTime(formatName, value string) (time.Time, error) { 58 | switch formatName { 59 | case RFC822TimeFormatName: 60 | return time.Parse(RFC822TimeFormat, value) 61 | case ISO8601TimeFormatName: 62 | return time.Parse(ISO8601TimeFormat, value) 63 | case UnixTimeFormatName: 64 | v, err := strconv.ParseFloat(value, 64) 65 | if err != nil { 66 | return time.Time{}, err 67 | } 68 | return time.Unix(int64(v), 0), nil 69 | default: 70 | panic("unknown timestamp format name, " + formatName) 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /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/prometheus/client_golang/prometheus/process_collector_other.go: -------------------------------------------------------------------------------- 1 | // Copyright 2019 The Prometheus Authors 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | // You may obtain a copy of the License at 5 | // 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 !windows 15 | 16 | package prometheus 17 | 18 | import ( 19 | "github.com/prometheus/procfs" 20 | ) 21 | 22 | func canCollectProcess() bool { 23 | _, err := procfs.NewDefaultFS() 24 | return err == nil 25 | } 26 | 27 | func (c *processCollector) processCollect(ch chan<- Metric) { 28 | pid, err := c.pidFn() 29 | if err != nil { 30 | c.reportError(ch, nil, err) 31 | return 32 | } 33 | 34 | p, err := procfs.NewProc(pid) 35 | if err != nil { 36 | c.reportError(ch, nil, err) 37 | return 38 | } 39 | 40 | if stat, err := p.Stat(); err == nil { 41 | ch <- MustNewConstMetric(c.cpuTotal, CounterValue, stat.CPUTime()) 42 | ch <- MustNewConstMetric(c.vsize, GaugeValue, float64(stat.VirtualMemory())) 43 | ch <- MustNewConstMetric(c.rss, GaugeValue, float64(stat.ResidentMemory())) 44 | if startTime, err := stat.StartTime(); err == nil { 45 | ch <- MustNewConstMetric(c.startTime, GaugeValue, startTime) 46 | } else { 47 | c.reportError(ch, c.startTime, err) 48 | } 49 | } else { 50 | c.reportError(ch, nil, err) 51 | } 52 | 53 | if fds, err := p.FileDescriptorsLen(); err == nil { 54 | ch <- MustNewConstMetric(c.openFDs, GaugeValue, float64(fds)) 55 | } else { 56 | c.reportError(ch, c.openFDs, err) 57 | } 58 | 59 | if limits, err := p.Limits(); err == nil { 60 | ch <- MustNewConstMetric(c.maxFDs, GaugeValue, float64(limits.OpenFiles)) 61 | ch <- MustNewConstMetric(c.maxVsize, GaugeValue, float64(limits.AddressSpace)) 62 | } else { 63 | c.reportError(ch, nil, err) 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /vendor/github.com/prometheus/procfs/proc_ns.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Prometheus Authors 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | // You may obtain a copy of the License at 5 | // 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 procfs 15 | 16 | import ( 17 | "fmt" 18 | "os" 19 | "strconv" 20 | "strings" 21 | ) 22 | 23 | // Namespace represents a single namespace of a process. 24 | type Namespace struct { 25 | Type string // Namespace type. 26 | Inode uint32 // Inode number of the namespace. If two processes are in the same namespace their inodes will match. 27 | } 28 | 29 | // Namespaces contains all of the namespaces that the process is contained in. 30 | type Namespaces map[string]Namespace 31 | 32 | // Namespaces reads from /proc//ns/* to get the namespaces of which the 33 | // process is a member. 34 | func (p Proc) Namespaces() (Namespaces, error) { 35 | d, err := os.Open(p.path("ns")) 36 | if err != nil { 37 | return nil, err 38 | } 39 | defer d.Close() 40 | 41 | names, err := d.Readdirnames(-1) 42 | if err != nil { 43 | return nil, fmt.Errorf("failed to read contents of ns dir: %v", err) 44 | } 45 | 46 | ns := make(Namespaces, len(names)) 47 | for _, name := range names { 48 | target, err := os.Readlink(p.path("ns", name)) 49 | if err != nil { 50 | return nil, err 51 | } 52 | 53 | fields := strings.SplitN(target, ":", 2) 54 | if len(fields) != 2 { 55 | return nil, fmt.Errorf("failed to parse namespace type and inode from '%v'", target) 56 | } 57 | 58 | typ := fields[0] 59 | inode, err := strconv.ParseUint(strings.Trim(fields[1], "[]"), 10, 32) 60 | if err != nil { 61 | return nil, fmt.Errorf("failed to parse inode from '%v': %v", fields[1], err) 62 | } 63 | 64 | ns[name] = Namespace{typ, uint32(inode)} 65 | } 66 | 67 | return ns, nil 68 | } 69 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/aws/awsutil/string_value.go: -------------------------------------------------------------------------------- 1 | package awsutil 2 | 3 | import ( 4 | "bytes" 5 | "fmt" 6 | "reflect" 7 | "strings" 8 | ) 9 | 10 | // StringValue returns the string representation of a value. 11 | func StringValue(i interface{}) string { 12 | var buf bytes.Buffer 13 | stringValue(reflect.ValueOf(i), 0, &buf) 14 | return buf.String() 15 | } 16 | 17 | func stringValue(v reflect.Value, indent int, buf *bytes.Buffer) { 18 | for v.Kind() == reflect.Ptr { 19 | v = v.Elem() 20 | } 21 | 22 | switch v.Kind() { 23 | case reflect.Struct: 24 | buf.WriteString("{\n") 25 | 26 | for i := 0; i < v.Type().NumField(); i++ { 27 | ft := v.Type().Field(i) 28 | fv := v.Field(i) 29 | 30 | if ft.Name[0:1] == strings.ToLower(ft.Name[0:1]) { 31 | continue // ignore unexported fields 32 | } 33 | if (fv.Kind() == reflect.Ptr || fv.Kind() == reflect.Slice) && fv.IsNil() { 34 | continue // ignore unset fields 35 | } 36 | 37 | buf.WriteString(strings.Repeat(" ", indent+2)) 38 | buf.WriteString(ft.Name + ": ") 39 | 40 | if tag := ft.Tag.Get("sensitive"); tag == "true" { 41 | buf.WriteString("") 42 | } else { 43 | stringValue(fv, indent+2, buf) 44 | } 45 | 46 | buf.WriteString(",\n") 47 | } 48 | 49 | buf.WriteString("\n" + strings.Repeat(" ", indent) + "}") 50 | case reflect.Slice: 51 | nl, id, id2 := "", "", "" 52 | if v.Len() > 3 { 53 | nl, id, id2 = "\n", strings.Repeat(" ", indent), strings.Repeat(" ", indent+2) 54 | } 55 | buf.WriteString("[" + nl) 56 | for i := 0; i < v.Len(); i++ { 57 | buf.WriteString(id2) 58 | stringValue(v.Index(i), indent+2, buf) 59 | 60 | if i < v.Len()-1 { 61 | buf.WriteString("," + nl) 62 | } 63 | } 64 | 65 | buf.WriteString(nl + id + "]") 66 | case reflect.Map: 67 | buf.WriteString("{\n") 68 | 69 | for i, k := range v.MapKeys() { 70 | buf.WriteString(strings.Repeat(" ", indent+2)) 71 | buf.WriteString(k.String() + ": ") 72 | stringValue(v.MapIndex(k), indent+2, buf) 73 | 74 | if i < v.Len()-1 { 75 | buf.WriteString(",\n") 76 | } 77 | } 78 | 79 | buf.WriteString("\n" + strings.Repeat(" ", indent) + "}") 80 | default: 81 | format := "%v" 82 | switch v.Interface().(type) { 83 | case string: 84 | format = "%q" 85 | } 86 | fmt.Fprintf(buf, format, v.Interface()) 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/aws/credentials/env_provider.go: -------------------------------------------------------------------------------- 1 | package credentials 2 | 3 | import ( 4 | "os" 5 | 6 | "github.com/aws/aws-sdk-go/aws/awserr" 7 | ) 8 | 9 | // EnvProviderName provides a name of Env provider 10 | const EnvProviderName = "EnvProvider" 11 | 12 | var ( 13 | // ErrAccessKeyIDNotFound is returned when the AWS Access Key ID can't be 14 | // found in the process's environment. 15 | ErrAccessKeyIDNotFound = awserr.New("EnvAccessKeyNotFound", "AWS_ACCESS_KEY_ID or AWS_ACCESS_KEY not found in environment", nil) 16 | 17 | // ErrSecretAccessKeyNotFound is returned when the AWS Secret Access Key 18 | // can't be found in the process's environment. 19 | ErrSecretAccessKeyNotFound = awserr.New("EnvSecretNotFound", "AWS_SECRET_ACCESS_KEY or AWS_SECRET_KEY not found in environment", nil) 20 | ) 21 | 22 | // A EnvProvider retrieves credentials from the environment variables of the 23 | // running process. Environment credentials never expire. 24 | // 25 | // Environment variables used: 26 | // 27 | // * Access Key ID: AWS_ACCESS_KEY_ID or AWS_ACCESS_KEY 28 | // 29 | // * Secret Access Key: AWS_SECRET_ACCESS_KEY or AWS_SECRET_KEY 30 | type EnvProvider struct { 31 | retrieved bool 32 | } 33 | 34 | // NewEnvCredentials returns a pointer to a new Credentials object 35 | // wrapping the environment variable provider. 36 | func NewEnvCredentials() *Credentials { 37 | return NewCredentials(&EnvProvider{}) 38 | } 39 | 40 | // Retrieve retrieves the keys from the environment. 41 | func (e *EnvProvider) Retrieve() (Value, error) { 42 | e.retrieved = false 43 | 44 | id := os.Getenv("AWS_ACCESS_KEY_ID") 45 | if id == "" { 46 | id = os.Getenv("AWS_ACCESS_KEY") 47 | } 48 | 49 | secret := os.Getenv("AWS_SECRET_ACCESS_KEY") 50 | if secret == "" { 51 | secret = os.Getenv("AWS_SECRET_KEY") 52 | } 53 | 54 | if id == "" { 55 | return Value{ProviderName: EnvProviderName}, ErrAccessKeyIDNotFound 56 | } 57 | 58 | if secret == "" { 59 | return Value{ProviderName: EnvProviderName}, ErrSecretAccessKeyNotFound 60 | } 61 | 62 | e.retrieved = true 63 | return Value{ 64 | AccessKeyID: id, 65 | SecretAccessKey: secret, 66 | SessionToken: os.Getenv("AWS_SESSION_TOKEN"), 67 | ProviderName: EnvProviderName, 68 | }, nil 69 | } 70 | 71 | // IsExpired returns if the credentials have been retrieved. 72 | func (e *EnvProvider) IsExpired() bool { 73 | return !e.retrieved 74 | } 75 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/windows/exec_windows.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 | // Fork, exec, wait, etc. 6 | 7 | package windows 8 | 9 | // EscapeArg rewrites command line argument s as prescribed 10 | // in http://msdn.microsoft.com/en-us/library/ms880421. 11 | // This function returns "" (2 double quotes) if s is empty. 12 | // Alternatively, these transformations are done: 13 | // - every back slash (\) is doubled, but only if immediately 14 | // followed by double quote ("); 15 | // - every double quote (") is escaped by back slash (\); 16 | // - finally, s is wrapped with double quotes (arg -> "arg"), 17 | // but only if there is space or tab inside s. 18 | func EscapeArg(s string) string { 19 | if len(s) == 0 { 20 | return "\"\"" 21 | } 22 | n := len(s) 23 | hasSpace := false 24 | for i := 0; i < len(s); i++ { 25 | switch s[i] { 26 | case '"', '\\': 27 | n++ 28 | case ' ', '\t': 29 | hasSpace = true 30 | } 31 | } 32 | if hasSpace { 33 | n += 2 34 | } 35 | if n == len(s) { 36 | return s 37 | } 38 | 39 | qs := make([]byte, n) 40 | j := 0 41 | if hasSpace { 42 | qs[j] = '"' 43 | j++ 44 | } 45 | slashes := 0 46 | for i := 0; i < len(s); i++ { 47 | switch s[i] { 48 | default: 49 | slashes = 0 50 | qs[j] = s[i] 51 | case '\\': 52 | slashes++ 53 | qs[j] = s[i] 54 | case '"': 55 | for ; slashes > 0; slashes-- { 56 | qs[j] = '\\' 57 | j++ 58 | } 59 | qs[j] = '\\' 60 | j++ 61 | qs[j] = s[i] 62 | } 63 | j++ 64 | } 65 | if hasSpace { 66 | for ; slashes > 0; slashes-- { 67 | qs[j] = '\\' 68 | j++ 69 | } 70 | qs[j] = '"' 71 | j++ 72 | } 73 | return string(qs[:j]) 74 | } 75 | 76 | func CloseOnExec(fd Handle) { 77 | SetHandleInformation(Handle(fd), HANDLE_FLAG_INHERIT, 0) 78 | } 79 | 80 | // FullPath retrieves the full path of the specified file. 81 | func FullPath(name string) (path string, err error) { 82 | p, err := UTF16PtrFromString(name) 83 | if err != nil { 84 | return "", err 85 | } 86 | n := uint32(100) 87 | for { 88 | buf := make([]uint16, n) 89 | n, err = GetFullPathName(p, uint32(len(buf)), &buf[0], nil) 90 | if err != nil { 91 | return "", err 92 | } 93 | if n <= uint32(len(buf)) { 94 | return UTF16ToString(buf[:n]), nil 95 | } 96 | } 97 | } 98 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/private/protocol/payload.go: -------------------------------------------------------------------------------- 1 | package protocol 2 | 3 | import ( 4 | "io" 5 | "io/ioutil" 6 | "net/http" 7 | 8 | "github.com/aws/aws-sdk-go/aws" 9 | "github.com/aws/aws-sdk-go/aws/client/metadata" 10 | "github.com/aws/aws-sdk-go/aws/request" 11 | ) 12 | 13 | // PayloadUnmarshaler provides the interface for unmarshaling a payload's 14 | // reader into a SDK shape. 15 | type PayloadUnmarshaler interface { 16 | UnmarshalPayload(io.Reader, interface{}) error 17 | } 18 | 19 | // HandlerPayloadUnmarshal implements the PayloadUnmarshaler from a 20 | // HandlerList. This provides the support for unmarshaling a payload reader to 21 | // a shape without needing a SDK request first. 22 | type HandlerPayloadUnmarshal struct { 23 | Unmarshalers request.HandlerList 24 | } 25 | 26 | // UnmarshalPayload unmarshals the io.Reader payload into the SDK shape using 27 | // the Unmarshalers HandlerList provided. Returns an error if unable 28 | // unmarshaling fails. 29 | func (h HandlerPayloadUnmarshal) UnmarshalPayload(r io.Reader, v interface{}) error { 30 | req := &request.Request{ 31 | HTTPRequest: &http.Request{}, 32 | HTTPResponse: &http.Response{ 33 | StatusCode: 200, 34 | Header: http.Header{}, 35 | Body: ioutil.NopCloser(r), 36 | }, 37 | Data: v, 38 | } 39 | 40 | h.Unmarshalers.Run(req) 41 | 42 | return req.Error 43 | } 44 | 45 | // PayloadMarshaler provides the interface for marshaling a SDK shape into and 46 | // io.Writer. 47 | type PayloadMarshaler interface { 48 | MarshalPayload(io.Writer, interface{}) error 49 | } 50 | 51 | // HandlerPayloadMarshal implements the PayloadMarshaler from a HandlerList. 52 | // This provides support for marshaling a SDK shape into an io.Writer without 53 | // needing a SDK request first. 54 | type HandlerPayloadMarshal struct { 55 | Marshalers request.HandlerList 56 | } 57 | 58 | // MarshalPayload marshals the SDK shape into the io.Writer using the 59 | // Marshalers HandlerList provided. Returns an error if unable if marshal 60 | // fails. 61 | func (h HandlerPayloadMarshal) MarshalPayload(w io.Writer, v interface{}) error { 62 | req := request.New( 63 | aws.Config{}, 64 | metadata.ClientInfo{}, 65 | request.Handlers{}, 66 | nil, 67 | &request.Operation{HTTPMethod: "GET"}, 68 | v, 69 | nil, 70 | ) 71 | 72 | h.Marshalers.Run(req) 73 | 74 | if req.Error != nil { 75 | return req.Error 76 | } 77 | 78 | io.Copy(w, req.GetBody()) 79 | 80 | return nil 81 | } 82 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/private/protocol/idempotency.go: -------------------------------------------------------------------------------- 1 | package protocol 2 | 3 | import ( 4 | "crypto/rand" 5 | "fmt" 6 | "reflect" 7 | ) 8 | 9 | // RandReader is the random reader the protocol package will use to read 10 | // random bytes from. This is exported for testing, and should not be used. 11 | var RandReader = rand.Reader 12 | 13 | const idempotencyTokenFillTag = `idempotencyToken` 14 | 15 | // CanSetIdempotencyToken returns true if the struct field should be 16 | // automatically populated with a Idempotency token. 17 | // 18 | // Only *string and string type fields that are tagged with idempotencyToken 19 | // which are not already set can be auto filled. 20 | func CanSetIdempotencyToken(v reflect.Value, f reflect.StructField) bool { 21 | switch u := v.Interface().(type) { 22 | // To auto fill an Idempotency token the field must be a string, 23 | // tagged for auto fill, and have a zero value. 24 | case *string: 25 | return u == nil && len(f.Tag.Get(idempotencyTokenFillTag)) != 0 26 | case string: 27 | return len(u) == 0 && len(f.Tag.Get(idempotencyTokenFillTag)) != 0 28 | } 29 | 30 | return false 31 | } 32 | 33 | // GetIdempotencyToken returns a randomly generated idempotency token. 34 | func GetIdempotencyToken() string { 35 | b := make([]byte, 16) 36 | RandReader.Read(b) 37 | 38 | return UUIDVersion4(b) 39 | } 40 | 41 | // SetIdempotencyToken will set the value provided with a Idempotency Token. 42 | // Given that the value can be set. Will panic if value is not setable. 43 | func SetIdempotencyToken(v reflect.Value) { 44 | if v.Kind() == reflect.Ptr { 45 | if v.IsNil() && v.CanSet() { 46 | v.Set(reflect.New(v.Type().Elem())) 47 | } 48 | v = v.Elem() 49 | } 50 | v = reflect.Indirect(v) 51 | 52 | if !v.CanSet() { 53 | panic(fmt.Sprintf("unable to set idempotnecy token %v", v)) 54 | } 55 | 56 | b := make([]byte, 16) 57 | _, err := rand.Read(b) 58 | if err != nil { 59 | // TODO handle error 60 | return 61 | } 62 | 63 | v.Set(reflect.ValueOf(UUIDVersion4(b))) 64 | } 65 | 66 | // UUIDVersion4 returns a Version 4 random UUID from the byte slice provided 67 | func UUIDVersion4(u []byte) string { 68 | // https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_4_.28random.29 69 | // 13th character is "4" 70 | u[6] = (u[6] | 0x40) & 0x4F 71 | // 17th character is "8", "9", "a", or "b" 72 | u[8] = (u[8] | 0x80) & 0xBF 73 | 74 | return fmt.Sprintf(`%X-%X-%X-%X-%X`, u[0:4], u[4:6], u[6:8], u[8:10], u[10:]) 75 | } 76 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/aws/csm/enable.go: -------------------------------------------------------------------------------- 1 | package csm 2 | 3 | import ( 4 | "fmt" 5 | "strings" 6 | "sync" 7 | ) 8 | 9 | var ( 10 | lock sync.Mutex 11 | ) 12 | 13 | const ( 14 | // DefaultPort is used when no port is specified. 15 | DefaultPort = "31000" 16 | 17 | // DefaultHost is the host that will be used when none is specified. 18 | DefaultHost = "127.0.0.1" 19 | ) 20 | 21 | // AddressWithDefaults returns a CSM address built from the host and port 22 | // values. If the host or port is not set, default values will be used 23 | // instead. If host is "localhost" it will be replaced with "127.0.0.1". 24 | func AddressWithDefaults(host, port string) string { 25 | if len(host) == 0 || strings.EqualFold(host, "localhost") { 26 | host = DefaultHost 27 | } 28 | 29 | if len(port) == 0 { 30 | port = DefaultPort 31 | } 32 | 33 | // Only IP6 host can contain a colon 34 | if strings.Contains(host, ":") { 35 | return "[" + host + "]:" + port 36 | } 37 | 38 | return host + ":" + port 39 | } 40 | 41 | // Start will start a long running go routine to capture 42 | // client side metrics. Calling start multiple time will only 43 | // start the metric listener once and will panic if a different 44 | // client ID or port is passed in. 45 | // 46 | // r, err := csm.Start("clientID", "127.0.0.1:31000") 47 | // if err != nil { 48 | // panic(fmt.Errorf("expected no error, but received %v", err)) 49 | // } 50 | // sess := session.NewSession() 51 | // r.InjectHandlers(sess.Handlers) 52 | // 53 | // svc := s3.New(sess) 54 | // out, err := svc.GetObject(&s3.GetObjectInput{ 55 | // Bucket: aws.String("bucket"), 56 | // Key: aws.String("key"), 57 | // }) 58 | func Start(clientID string, url string) (*Reporter, error) { 59 | lock.Lock() 60 | defer lock.Unlock() 61 | 62 | if sender == nil { 63 | sender = newReporter(clientID, url) 64 | } else { 65 | if sender.clientID != clientID { 66 | panic(fmt.Errorf("inconsistent client IDs. %q was expected, but received %q", sender.clientID, clientID)) 67 | } 68 | 69 | if sender.url != url { 70 | panic(fmt.Errorf("inconsistent URLs. %q was expected, but received %q", sender.url, url)) 71 | } 72 | } 73 | 74 | if err := connect(url); err != nil { 75 | sender = nil 76 | return nil, err 77 | } 78 | 79 | return sender, nil 80 | } 81 | 82 | // Get will return a reporter if one exists, if one does not exist, nil will 83 | // be returned. 84 | func Get() *Reporter { 85 | lock.Lock() 86 | defer lock.Unlock() 87 | 88 | return sender 89 | } 90 | -------------------------------------------------------------------------------- /go.mod: -------------------------------------------------------------------------------- 1 | module github.com/hugobcar/tiamat 2 | 3 | go 1.12 4 | 5 | require ( 6 | cloud.google.com/go v0.44.3 // indirect 7 | github.com/NYTimes/gziphandler v1.1.1 // indirect 8 | github.com/aws/aws-sdk-go v1.23.2 9 | github.com/docker/spdystream v0.0.0-20181023171402-6480d4af844c // indirect 10 | github.com/elazarl/goproxy v0.0.0-20190711103511-473e67f1d7d2 // indirect 11 | github.com/emicklei/go-restful v2.9.6+incompatible // indirect 12 | github.com/evanphx/json-patch v4.5.0+incompatible // indirect 13 | github.com/ghodss/yaml v1.0.0 // indirect 14 | github.com/go-kit/kit v0.9.0 // indirect 15 | github.com/go-openapi/spec v0.19.2 // indirect 16 | github.com/go-openapi/swag v0.19.4 // indirect 17 | github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6 // indirect 18 | github.com/google/go-cmp v0.3.1 // indirect 19 | github.com/google/pprof v0.0.0-20190723021845-34ac40c74b70 // indirect 20 | github.com/googleapis/gnostic v0.3.1 // indirect 21 | github.com/hashicorp/golang-lru v0.5.3 // indirect 22 | github.com/konsorten/go-windows-terminal-sequences v1.0.2 // indirect 23 | github.com/kr/pty v1.1.8 // indirect 24 | github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e // indirect 25 | github.com/munnerz/goautoneg v0.0.0-20190414153302-2ae31c8b6b30 // indirect 26 | github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f // indirect 27 | github.com/pkg/errors v0.8.1 // indirect 28 | github.com/prometheus/client_golang v1.1.0 29 | github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4 // indirect 30 | github.com/sirupsen/logrus v1.4.2 // indirect 31 | github.com/stretchr/testify v1.4.0 // indirect 32 | golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4 // indirect 33 | golang.org/x/mobile v0.0.0-20190814143026-e8b3e6111d02 // indirect 34 | golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7 // indirect 35 | golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a // indirect 36 | golang.org/x/tools v0.0.0-20190815235612-5b08f89bfc0c // indirect 37 | google.golang.org/grpc v1.23.0 // indirect 38 | gopkg.in/inf.v0 v0.9.1 // indirect 39 | honnef.co/go/tools v0.0.1-2019.2.2 // indirect 40 | k8s.io/api v0.0.0-20190814101207-0772a1bdf941 // indirect 41 | k8s.io/client-go v11.0.0+incompatible // indirect 42 | k8s.io/gengo v0.0.0-20190813173942-955ffa8fcfc9 // indirect 43 | k8s.io/kube-openapi v0.0.0-20190815110238-8ff09bc626d6 // indirect 44 | k8s.io/utils v0.0.0-20190809000727-6c36bc71fc4a // indirect 45 | sigs.k8s.io/structured-merge-diff v0.0.0-20190724202554-0c1d754dd648 // indirect 46 | ) 47 | -------------------------------------------------------------------------------- /vendor/github.com/prometheus/common/internal/bitbucket.org/ww/goautoneg/README.txt: -------------------------------------------------------------------------------- 1 | PACKAGE 2 | 3 | package goautoneg 4 | import "bitbucket.org/ww/goautoneg" 5 | 6 | HTTP Content-Type Autonegotiation. 7 | 8 | The functions in this package implement the behaviour specified in 9 | http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html 10 | 11 | Copyright (c) 2011, Open Knowledge Foundation Ltd. 12 | All rights reserved. 13 | 14 | Redistribution and use in source and binary forms, with or without 15 | modification, are permitted provided that the following conditions are 16 | met: 17 | 18 | Redistributions of source code must retain the above copyright 19 | notice, this list of conditions and the following disclaimer. 20 | 21 | Redistributions in binary form must reproduce the above copyright 22 | notice, this list of conditions and the following disclaimer in 23 | the documentation and/or other materials provided with the 24 | distribution. 25 | 26 | Neither the name of the Open Knowledge Foundation Ltd. nor the 27 | names of its contributors may be used to endorse or promote 28 | products derived from this software without specific prior written 29 | permission. 30 | 31 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 32 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 33 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 34 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 35 | HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 36 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 37 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 38 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 39 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 40 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 41 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 42 | 43 | 44 | FUNCTIONS 45 | 46 | func Negotiate(header string, alternatives []string) (content_type string) 47 | Negotiate the most appropriate content_type given the accept header 48 | and a list of alternatives. 49 | 50 | func ParseAccept(header string) (accept []Accept) 51 | Parse an Accept Header string returning a sorted list 52 | of clauses 53 | 54 | 55 | TYPES 56 | 57 | type Accept struct { 58 | Type, SubType string 59 | Q float32 60 | Params map[string]string 61 | } 62 | Structure to represent a clause in an HTTP Accept Header 63 | 64 | 65 | SUBDIRECTORIES 66 | 67 | .hg 68 | -------------------------------------------------------------------------------- /vendor/github.com/prometheus/procfs/README.md: -------------------------------------------------------------------------------- 1 | # procfs 2 | 3 | This procfs package provides functions to retrieve system, kernel and process 4 | metrics from the pseudo-filesystems /proc and /sys. 5 | 6 | *WARNING*: This package is a work in progress. Its API may still break in 7 | backwards-incompatible ways without warnings. Use it at your own risk. 8 | 9 | [![GoDoc](https://godoc.org/github.com/prometheus/procfs?status.png)](https://godoc.org/github.com/prometheus/procfs) 10 | [![Build Status](https://travis-ci.org/prometheus/procfs.svg?branch=master)](https://travis-ci.org/prometheus/procfs) 11 | [![Go Report Card](https://goreportcard.com/badge/github.com/prometheus/procfs)](https://goreportcard.com/report/github.com/prometheus/procfs) 12 | 13 | ## Usage 14 | 15 | The procfs library is organized by packages based on whether the gathered data is coming from 16 | /proc, /sys, or both. Each package contains an `FS` type which represents the path to either /proc, /sys, or both. For example, current cpu statistics are gathered from 17 | `/proc/stat` and are available via the root procfs package. First, the proc filesystem mount 18 | point is initialized, and then the stat information is read. 19 | 20 | ```go 21 | fs, err := procfs.NewFS("/proc") 22 | stats, err := fs.Stat() 23 | ``` 24 | 25 | Some sub-packages such as `blockdevice`, require access to both the proc and sys filesystems. 26 | 27 | ```go 28 | fs, err := blockdevice.NewFS("/proc", "/sys") 29 | stats, err := fs.ProcDiskstats() 30 | ``` 31 | 32 | ## Building and Testing 33 | 34 | The procfs library is normally built as part of another application. However, when making 35 | changes to the library, the `make test` command can be used to run the API test suite. 36 | 37 | ### Updating Test Fixtures 38 | 39 | The procfs library includes a set of test fixtures which include many example files from 40 | the `/proc` and `/sys` filesystems. These fixtures are included as a [ttar](https://github.com/ideaship/ttar) file 41 | which is extracted automatically during testing. To add/update the test fixtures, first 42 | ensure the `fixtures` directory is up to date by removing the existing directory and then 43 | extracting the ttar file using `make fixtures/.unpacked` or just `make test`. 44 | 45 | ```bash 46 | rm -rf fixtures 47 | make test 48 | ``` 49 | 50 | Next, make the required changes to the extracted files in the `fixtures` directory. When 51 | the changes are complete, run `make update_fixtures` to create a new `fixtures.ttar` file 52 | based on the updated `fixtures` directory. And finally, verify the changes using 53 | `git diff fixtures.ttar`. 54 | -------------------------------------------------------------------------------- /vendor/github.com/prometheus/procfs/buddyinfo.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Prometheus Authors 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | // You may obtain a copy of the License at 5 | // 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 procfs 15 | 16 | import ( 17 | "bufio" 18 | "fmt" 19 | "io" 20 | "os" 21 | "strconv" 22 | "strings" 23 | ) 24 | 25 | // A BuddyInfo is the details parsed from /proc/buddyinfo. 26 | // The data is comprised of an array of free fragments of each size. 27 | // The sizes are 2^n*PAGE_SIZE, where n is the array index. 28 | type BuddyInfo struct { 29 | Node string 30 | Zone string 31 | Sizes []float64 32 | } 33 | 34 | // NewBuddyInfo reads the buddyinfo statistics from the specified `proc` filesystem. 35 | func (fs FS) BuddyInfo() ([]BuddyInfo, error) { 36 | file, err := os.Open(fs.proc.Path("buddyinfo")) 37 | if err != nil { 38 | return nil, err 39 | } 40 | defer file.Close() 41 | 42 | return parseBuddyInfo(file) 43 | } 44 | 45 | func parseBuddyInfo(r io.Reader) ([]BuddyInfo, error) { 46 | var ( 47 | buddyInfo = []BuddyInfo{} 48 | scanner = bufio.NewScanner(r) 49 | bucketCount = -1 50 | ) 51 | 52 | for scanner.Scan() { 53 | var err error 54 | line := scanner.Text() 55 | parts := strings.Fields(line) 56 | 57 | if len(parts) < 4 { 58 | return nil, fmt.Errorf("invalid number of fields when parsing buddyinfo") 59 | } 60 | 61 | node := strings.TrimRight(parts[1], ",") 62 | zone := strings.TrimRight(parts[3], ",") 63 | arraySize := len(parts[4:]) 64 | 65 | if bucketCount == -1 { 66 | bucketCount = arraySize 67 | } else { 68 | if bucketCount != arraySize { 69 | return nil, fmt.Errorf("mismatch in number of buddyinfo buckets, previous count %d, new count %d", bucketCount, arraySize) 70 | } 71 | } 72 | 73 | sizes := make([]float64, arraySize) 74 | for i := 0; i < arraySize; i++ { 75 | sizes[i], err = strconv.ParseFloat(parts[i+4], 64) 76 | if err != nil { 77 | return nil, fmt.Errorf("invalid value in buddyinfo: %s", err) 78 | } 79 | } 80 | 81 | buddyInfo = append(buddyInfo, BuddyInfo{node, zone, sizes}) 82 | } 83 | 84 | return buddyInfo, scanner.Err() 85 | } 86 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/aws/doc.go: -------------------------------------------------------------------------------- 1 | // Package aws provides the core SDK's utilities and shared types. Use this package's 2 | // utilities to simplify setting and reading API operations parameters. 3 | // 4 | // Value and Pointer Conversion Utilities 5 | // 6 | // This package includes a helper conversion utility for each scalar type the SDK's 7 | // API use. These utilities make getting a pointer of the scalar, and dereferencing 8 | // a pointer easier. 9 | // 10 | // Each conversion utility comes in two forms. Value to Pointer and Pointer to Value. 11 | // The Pointer to value will safely dereference the pointer and return its value. 12 | // If the pointer was nil, the scalar's zero value will be returned. 13 | // 14 | // The value to pointer functions will be named after the scalar type. So get a 15 | // *string from a string value use the "String" function. This makes it easy to 16 | // to get pointer of a literal string value, because getting the address of a 17 | // literal requires assigning the value to a variable first. 18 | // 19 | // var strPtr *string 20 | // 21 | // // Without the SDK's conversion functions 22 | // str := "my string" 23 | // strPtr = &str 24 | // 25 | // // With the SDK's conversion functions 26 | // strPtr = aws.String("my string") 27 | // 28 | // // Convert *string to string value 29 | // str = aws.StringValue(strPtr) 30 | // 31 | // In addition to scalars the aws package also includes conversion utilities for 32 | // map and slice for commonly types used in API parameters. The map and slice 33 | // conversion functions use similar naming pattern as the scalar conversion 34 | // functions. 35 | // 36 | // var strPtrs []*string 37 | // var strs []string = []string{"Go", "Gophers", "Go"} 38 | // 39 | // // Convert []string to []*string 40 | // strPtrs = aws.StringSlice(strs) 41 | // 42 | // // Convert []*string to []string 43 | // strs = aws.StringValueSlice(strPtrs) 44 | // 45 | // SDK Default HTTP Client 46 | // 47 | // The SDK will use the http.DefaultClient if a HTTP client is not provided to 48 | // the SDK's Session, or service client constructor. This means that if the 49 | // http.DefaultClient is modified by other components of your application the 50 | // modifications will be picked up by the SDK as well. 51 | // 52 | // In some cases this might be intended, but it is a better practice to create 53 | // a custom HTTP Client to share explicitly through your application. You can 54 | // configure the SDK to use the custom HTTP Client by setting the HTTPClient 55 | // value of the SDK's Config type when creating a Session or service client. 56 | package aws 57 | -------------------------------------------------------------------------------- /prometheus/gauge.go: -------------------------------------------------------------------------------- 1 | package prometheus 2 | 3 | import ( 4 | "fmt" 5 | "strings" 6 | "sync" 7 | 8 | "github.com/prometheus/client_golang/prometheus" 9 | ) 10 | 11 | type QueueMetrics struct { 12 | Name string 13 | Total prometheus.Gauge 14 | Visible prometheus.Gauge 15 | InFlight prometheus.Gauge 16 | Legacy prometheus.Gauge 17 | } 18 | 19 | const ( 20 | Total = "total" 21 | Visible = "visible" 22 | InFlight = "in_flight" 23 | ) 24 | 25 | var ( 26 | mu *sync.Mutex 27 | RegistredGauges map[string]QueueMetrics 28 | ) 29 | 30 | func init() { 31 | mu = new(sync.Mutex) 32 | RegistredGauges = make(map[string]QueueMetrics) 33 | } 34 | 35 | // CreateGauges - Create Gauges in Prometheus 36 | func CreateGauges(queues []string, formatGaugeName bool, metricType string) { 37 | for _, queue := range queues { 38 | queueSplit := strings.Split(queue, "/") 39 | queueRegionSplit := strings.Split(strings.ReplaceAll(queueSplit[2], "sqs.", ""), ".") 40 | queueRegion := queueRegionSplit[0] 41 | queueAccount := queueSplit[3] 42 | queueName := strings.ToLower(strings.ReplaceAll(queueSplit[4], "-", "_")) 43 | 44 | var gName = "tiamat" 45 | if formatGaugeName { 46 | gName = fmt.Sprintf("tiamat_%s_%s_%s", queueAccount, metricType, queueName) 47 | } 48 | 49 | defaultLabels := prometheus.Labels{ 50 | "metric_type": metricType, 51 | "queue_region": queueRegion, 52 | "queue_account": queueAccount, 53 | "queue_name": queueName, 54 | "queue_url": queue, 55 | } 56 | 57 | if g, found := RegistredGauges[queue]; found { 58 | fmt.Println(g) 59 | } 60 | 61 | RegistredGauges[queue] = QueueMetrics{ 62 | Name: gName, 63 | Total: RegisterGauge(gName, fmt.Sprintf("%s_%s", gName, Total), defaultLabels, "SQS Total Messages metrics"), 64 | Visible: RegisterGauge(gName, fmt.Sprintf("%s_%s", gName, Visible), defaultLabels, "SQS Visible Messages metrics"), 65 | InFlight: RegisterGauge(gName, fmt.Sprintf("%s_%s", gName, InFlight), defaultLabels, "SQS In Fight Messages metrics"), 66 | Legacy: RegisterGauge(gName, gName, defaultLabels, "Legacy metric, use total metrics instead"), 67 | } 68 | } 69 | } 70 | 71 | // RegisterGauge -- register new prometheus guage metrics 72 | func RegisterGauge(name, metric string, labels prometheus.Labels, help string) prometheus.Gauge { 73 | if g, found := RegistredGauges[name]; found { 74 | fmt.Println(g) 75 | } 76 | 77 | g := prometheus.NewGauge( 78 | prometheus.GaugeOpts{ 79 | Name: metric, 80 | Help: help, 81 | ConstLabels: labels, 82 | }) 83 | 84 | if err := prometheus.Register(g); err != nil { 85 | fmt.Println(err) 86 | } 87 | return g 88 | } 89 | -------------------------------------------------------------------------------- /vendor/modules.txt: -------------------------------------------------------------------------------- 1 | # github.com/aws/aws-sdk-go v1.23.2 2 | github.com/aws/aws-sdk-go/aws 3 | github.com/aws/aws-sdk-go/aws/credentials 4 | github.com/aws/aws-sdk-go/aws/session 5 | github.com/aws/aws-sdk-go/service/sqs 6 | github.com/aws/aws-sdk-go/aws/awserr 7 | github.com/aws/aws-sdk-go/aws/endpoints 8 | github.com/aws/aws-sdk-go/internal/sdkio 9 | github.com/aws/aws-sdk-go/internal/ini 10 | github.com/aws/aws-sdk-go/internal/shareddefaults 11 | github.com/aws/aws-sdk-go/aws/client 12 | github.com/aws/aws-sdk-go/aws/corehandlers 13 | github.com/aws/aws-sdk-go/aws/credentials/processcreds 14 | github.com/aws/aws-sdk-go/aws/credentials/stscreds 15 | github.com/aws/aws-sdk-go/aws/csm 16 | github.com/aws/aws-sdk-go/aws/defaults 17 | github.com/aws/aws-sdk-go/aws/request 18 | github.com/aws/aws-sdk-go/aws/awsutil 19 | github.com/aws/aws-sdk-go/aws/client/metadata 20 | github.com/aws/aws-sdk-go/aws/signer/v4 21 | github.com/aws/aws-sdk-go/private/protocol 22 | github.com/aws/aws-sdk-go/private/protocol/query 23 | github.com/aws/aws-sdk-go/internal/sdkrand 24 | github.com/aws/aws-sdk-go/service/sts 25 | github.com/aws/aws-sdk-go/service/sts/stsiface 26 | github.com/aws/aws-sdk-go/aws/credentials/ec2rolecreds 27 | github.com/aws/aws-sdk-go/aws/credentials/endpointcreds 28 | github.com/aws/aws-sdk-go/aws/ec2metadata 29 | github.com/aws/aws-sdk-go/private/protocol/rest 30 | github.com/aws/aws-sdk-go/private/protocol/query/queryutil 31 | github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil 32 | github.com/aws/aws-sdk-go/internal/sdkuri 33 | github.com/aws/aws-sdk-go/private/protocol/json/jsonutil 34 | # github.com/beorn7/perks v1.0.1 35 | github.com/beorn7/perks/quantile 36 | # github.com/golang/protobuf v1.3.2 37 | github.com/golang/protobuf/proto 38 | # github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af 39 | github.com/jmespath/go-jmespath 40 | # github.com/matttproud/golang_protobuf_extensions v1.0.1 41 | github.com/matttproud/golang_protobuf_extensions/pbutil 42 | # github.com/prometheus/client_golang v1.1.0 43 | github.com/prometheus/client_golang/prometheus 44 | github.com/prometheus/client_golang/prometheus/promhttp 45 | github.com/prometheus/client_golang/prometheus/internal 46 | # github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4 47 | github.com/prometheus/client_model/go 48 | # github.com/prometheus/common v0.6.0 49 | github.com/prometheus/common/expfmt 50 | github.com/prometheus/common/model 51 | github.com/prometheus/common/internal/bitbucket.org/ww/goautoneg 52 | # github.com/prometheus/procfs v0.0.3 53 | github.com/prometheus/procfs 54 | github.com/prometheus/procfs/internal/fs 55 | # golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a 56 | golang.org/x/sys/windows 57 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/windows/syscall.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 windows 6 | 7 | // Package windows contains an interface to the low-level operating system 8 | // primitives. OS details vary depending on the underlying system, and 9 | // by default, godoc will display the OS-specific documentation for the current 10 | // system. If you want godoc to display syscall documentation for another 11 | // system, set $GOOS and $GOARCH to the desired system. For example, if 12 | // you want to view documentation for freebsd/arm on linux/amd64, set $GOOS 13 | // to freebsd and $GOARCH to arm. 14 | // 15 | // The primary use of this package is inside other packages that provide a more 16 | // portable interface to the system, such as "os", "time" and "net". Use 17 | // those packages rather than this one if you can. 18 | // 19 | // For details of the functions and data types in this package consult 20 | // the manuals for the appropriate operating system. 21 | // 22 | // These calls return err == nil to indicate success; otherwise 23 | // err represents an operating system error describing the failure and 24 | // holds a value of type syscall.Errno. 25 | package windows // import "golang.org/x/sys/windows" 26 | 27 | import ( 28 | "syscall" 29 | ) 30 | 31 | // ByteSliceFromString returns a NUL-terminated slice of bytes 32 | // containing the text of s. If s contains a NUL byte at any 33 | // location, it returns (nil, syscall.EINVAL). 34 | func ByteSliceFromString(s string) ([]byte, error) { 35 | for i := 0; i < len(s); i++ { 36 | if s[i] == 0 { 37 | return nil, syscall.EINVAL 38 | } 39 | } 40 | a := make([]byte, len(s)+1) 41 | copy(a, s) 42 | return a, nil 43 | } 44 | 45 | // BytePtrFromString returns a pointer to a NUL-terminated array of 46 | // bytes containing the text of s. If s contains a NUL byte at any 47 | // location, it returns (nil, syscall.EINVAL). 48 | func BytePtrFromString(s string) (*byte, error) { 49 | a, err := ByteSliceFromString(s) 50 | if err != nil { 51 | return nil, err 52 | } 53 | return &a[0], nil 54 | } 55 | 56 | // Single-word zero for use when we need a valid pointer to 0 bytes. 57 | // See mksyscall.pl. 58 | var _zero uintptr 59 | 60 | func (ts *Timespec) Unix() (sec int64, nsec int64) { 61 | return int64(ts.Sec), int64(ts.Nsec) 62 | } 63 | 64 | func (tv *Timeval) Unix() (sec int64, nsec int64) { 65 | return int64(tv.Sec), int64(tv.Usec) * 1000 66 | } 67 | 68 | func (ts *Timespec) Nano() int64 { 69 | return int64(ts.Sec)*1e9 + int64(ts.Nsec) 70 | } 71 | 72 | func (tv *Timeval) Nano() int64 { 73 | return int64(tv.Sec)*1e9 + int64(tv.Usec)*1000 74 | } 75 | -------------------------------------------------------------------------------- /vendor/github.com/golang/protobuf/proto/deprecated.go: -------------------------------------------------------------------------------- 1 | // Go support for Protocol Buffers - Google's data interchange format 2 | // 3 | // Copyright 2018 The Go Authors. All rights reserved. 4 | // https://github.com/golang/protobuf 5 | // 6 | // Redistribution and use in source and binary forms, with or without 7 | // modification, are permitted provided that the following conditions are 8 | // met: 9 | // 10 | // * Redistributions of source code must retain the above copyright 11 | // notice, this list of conditions and the following disclaimer. 12 | // * Redistributions in binary form must reproduce the above 13 | // copyright notice, this list of conditions and the following disclaimer 14 | // in the documentation and/or other materials provided with the 15 | // distribution. 16 | // * Neither the name of Google Inc. nor the names of its 17 | // contributors may be used to endorse or promote products derived from 18 | // this software without specific prior written permission. 19 | // 20 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 24 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 25 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 26 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | 32 | package proto 33 | 34 | import "errors" 35 | 36 | // Deprecated: do not use. 37 | type Stats struct{ Emalloc, Dmalloc, Encode, Decode, Chit, Cmiss, Size uint64 } 38 | 39 | // Deprecated: do not use. 40 | func GetStats() Stats { return Stats{} } 41 | 42 | // Deprecated: do not use. 43 | func MarshalMessageSet(interface{}) ([]byte, error) { 44 | return nil, errors.New("proto: not implemented") 45 | } 46 | 47 | // Deprecated: do not use. 48 | func UnmarshalMessageSet([]byte, interface{}) error { 49 | return errors.New("proto: not implemented") 50 | } 51 | 52 | // Deprecated: do not use. 53 | func MarshalMessageSetJSON(interface{}) ([]byte, error) { 54 | return nil, errors.New("proto: not implemented") 55 | } 56 | 57 | // Deprecated: do not use. 58 | func UnmarshalMessageSetJSON([]byte, interface{}) error { 59 | return errors.New("proto: not implemented") 60 | } 61 | 62 | // Deprecated: do not use. 63 | func RegisterMessageSetType(Message, int32, string) {} 64 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/service/sqs/doc.go: -------------------------------------------------------------------------------- 1 | // Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. 2 | 3 | // Package sqs provides the client and types for making API 4 | // requests to Amazon Simple Queue Service. 5 | // 6 | // Welcome to the Amazon Simple Queue Service API Reference. 7 | // 8 | // Amazon Simple Queue Service (Amazon SQS) is a reliable, highly-scalable hosted 9 | // queue for storing messages as they travel between applications or microservices. 10 | // Amazon SQS moves data between distributed application components and helps 11 | // you decouple these components. 12 | // 13 | // You can use AWS SDKs (http://aws.amazon.com/tools/#sdk) to access Amazon 14 | // SQS using your favorite programming language. The SDKs perform tasks such 15 | // as the following automatically: 16 | // 17 | // * Cryptographically sign your service requests 18 | // 19 | // * Retry requests 20 | // 21 | // * Handle error responses 22 | // 23 | // Additional Information 24 | // 25 | // * Amazon SQS Product Page (http://aws.amazon.com/sqs/) 26 | // 27 | // * Amazon Simple Queue Service Developer Guide Making API Requests (https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-making-api-requests.html) 28 | // Amazon SQS Message Attributes (https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-message-attributes.html) 29 | // Amazon SQS Dead-Letter Queues (https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-dead-letter-queues.html) 30 | // 31 | // * Amazon SQS in the AWS CLI Command Reference (http://docs.aws.amazon.com/cli/latest/reference/sqs/index.html) 32 | // 33 | // * Amazon Web Services General Reference Regions and Endpoints (https://docs.aws.amazon.com/general/latest/gr/rande.html#sqs_region) 34 | // 35 | // See https://docs.aws.amazon.com/goto/WebAPI/sqs-2012-11-05 for more information on this service. 36 | // 37 | // See sqs package documentation for more information. 38 | // https://docs.aws.amazon.com/sdk-for-go/api/service/sqs/ 39 | // 40 | // Using the Client 41 | // 42 | // To contact Amazon Simple Queue Service with the SDK use the New function to create 43 | // a new service client. With that client you can make API requests to the service. 44 | // These clients are safe to use concurrently. 45 | // 46 | // See the SDK's documentation for more information on how to use the SDK. 47 | // https://docs.aws.amazon.com/sdk-for-go/api/ 48 | // 49 | // See aws.Config documentation for more information on configuring SDK clients. 50 | // https://docs.aws.amazon.com/sdk-for-go/api/aws/#Config 51 | // 52 | // See the Amazon Simple Queue Service client SQS for more 53 | // information on creating client for this service. 54 | // https://docs.aws.amazon.com/sdk-for-go/api/service/sqs/#New 55 | package sqs 56 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/aws/request/timeout_read_closer.go: -------------------------------------------------------------------------------- 1 | package request 2 | 3 | import ( 4 | "io" 5 | "time" 6 | 7 | "github.com/aws/aws-sdk-go/aws/awserr" 8 | ) 9 | 10 | var timeoutErr = awserr.New( 11 | ErrCodeResponseTimeout, 12 | "read on body has reached the timeout limit", 13 | nil, 14 | ) 15 | 16 | type readResult struct { 17 | n int 18 | err error 19 | } 20 | 21 | // timeoutReadCloser will handle body reads that take too long. 22 | // We will return a ErrReadTimeout error if a timeout occurs. 23 | type timeoutReadCloser struct { 24 | reader io.ReadCloser 25 | duration time.Duration 26 | } 27 | 28 | // Read will spin off a goroutine to call the reader's Read method. We will 29 | // select on the timer's channel or the read's channel. Whoever completes first 30 | // will be returned. 31 | func (r *timeoutReadCloser) Read(b []byte) (int, error) { 32 | timer := time.NewTimer(r.duration) 33 | c := make(chan readResult, 1) 34 | 35 | go func() { 36 | n, err := r.reader.Read(b) 37 | timer.Stop() 38 | c <- readResult{n: n, err: err} 39 | }() 40 | 41 | select { 42 | case data := <-c: 43 | return data.n, data.err 44 | case <-timer.C: 45 | return 0, timeoutErr 46 | } 47 | } 48 | 49 | func (r *timeoutReadCloser) Close() error { 50 | return r.reader.Close() 51 | } 52 | 53 | const ( 54 | // HandlerResponseTimeout is what we use to signify the name of the 55 | // response timeout handler. 56 | HandlerResponseTimeout = "ResponseTimeoutHandler" 57 | ) 58 | 59 | // adaptToResponseTimeoutError is a handler that will replace any top level error 60 | // to a ErrCodeResponseTimeout, if its child is that. 61 | func adaptToResponseTimeoutError(req *Request) { 62 | if err, ok := req.Error.(awserr.Error); ok { 63 | aerr, ok := err.OrigErr().(awserr.Error) 64 | if ok && aerr.Code() == ErrCodeResponseTimeout { 65 | req.Error = aerr 66 | } 67 | } 68 | } 69 | 70 | // WithResponseReadTimeout is a request option that will wrap the body in a timeout read closer. 71 | // This will allow for per read timeouts. If a timeout occurred, we will return the 72 | // ErrCodeResponseTimeout. 73 | // 74 | // svc.PutObjectWithContext(ctx, params, request.WithTimeoutReadCloser(30 * time.Second) 75 | func WithResponseReadTimeout(duration time.Duration) Option { 76 | return func(r *Request) { 77 | 78 | var timeoutHandler = NamedHandler{ 79 | HandlerResponseTimeout, 80 | func(req *Request) { 81 | req.HTTPResponse.Body = &timeoutReadCloser{ 82 | reader: req.HTTPResponse.Body, 83 | duration: duration, 84 | } 85 | }} 86 | 87 | // remove the handler so we are not stomping over any new durations. 88 | r.Handlers.Send.RemoveByName(HandlerResponseTimeout) 89 | r.Handlers.Send.PushBackNamed(timeoutHandler) 90 | 91 | r.Handlers.Unmarshal.PushBack(adaptToResponseTimeoutError) 92 | r.Handlers.UnmarshalError.PushBack(adaptToResponseTimeoutError) 93 | } 94 | } 95 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/aws/csm/doc.go: -------------------------------------------------------------------------------- 1 | // Package csm provides the Client Side Monitoring (CSM) client which enables 2 | // sending metrics via UDP connection to the CSM agent. This package provides 3 | // control options, and configuration for the CSM client. The client can be 4 | // controlled manually, or automatically via the SDK's Session configuration. 5 | // 6 | // Enabling CSM client via SDK's Session configuration 7 | // 8 | // The CSM client can be enabled automatically via SDK's Session configuration. 9 | // The SDK's session configuration enables the CSM client if the AWS_CSM_PORT 10 | // environment variable is set to a non-empty value. 11 | // 12 | // The configuration options for the CSM client via the SDK's session 13 | // configuration are: 14 | // 15 | // * AWS_CSM_PORT= 16 | // The port number the CSM agent will receive metrics on. 17 | // 18 | // * AWS_CSM_HOST= 19 | // The hostname, or IP address the CSM agent will receive metrics on. 20 | // Without port number. 21 | // 22 | // Manually enabling the CSM client 23 | // 24 | // The CSM client can be started, paused, and resumed manually. The Start 25 | // function will enable the CSM client to publish metrics to the CSM agent. It 26 | // is safe to call Start concurrently, but if Start is called additional times 27 | // with different ClientID or address it will panic. 28 | // 29 | // r, err := csm.Start("clientID", ":31000") 30 | // if err != nil { 31 | // panic(fmt.Errorf("failed starting CSM: %v", err)) 32 | // } 33 | // 34 | // When controlling the CSM client manually, you must also inject its request 35 | // handlers into the SDK's Session configuration for the SDK's API clients to 36 | // publish metrics. 37 | // 38 | // sess, err := session.NewSession(&aws.Config{}) 39 | // if err != nil { 40 | // panic(fmt.Errorf("failed loading session: %v", err)) 41 | // } 42 | // 43 | // // Add CSM client's metric publishing request handlers to the SDK's 44 | // // Session Configuration. 45 | // r.InjectHandlers(&sess.Handlers) 46 | // 47 | // Controlling CSM client 48 | // 49 | // Once the CSM client has been enabled the Get function will return a Reporter 50 | // value that you can use to pause and resume the metrics published to the CSM 51 | // agent. If Get function is called before the reporter is enabled with the 52 | // Start function or via SDK's Session configuration nil will be returned. 53 | // 54 | // The Pause method can be called to stop the CSM client publishing metrics to 55 | // the CSM agent. The Continue method will resume metric publishing. 56 | // 57 | // // Get the CSM client Reporter. 58 | // r := csm.Get() 59 | // 60 | // // Will pause monitoring 61 | // r.Pause() 62 | // resp, err = client.GetObject(&s3.GetObjectInput{ 63 | // Bucket: aws.String("bucket"), 64 | // Key: aws.String("key"), 65 | // }) 66 | // 67 | // // Resume monitoring 68 | // r.Continue() 69 | package csm 70 | -------------------------------------------------------------------------------- /vendor/github.com/prometheus/common/expfmt/encode.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Prometheus Authors 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | // You may obtain a copy of the License at 5 | // 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 expfmt 15 | 16 | import ( 17 | "fmt" 18 | "io" 19 | "net/http" 20 | 21 | "github.com/golang/protobuf/proto" 22 | "github.com/matttproud/golang_protobuf_extensions/pbutil" 23 | "github.com/prometheus/common/internal/bitbucket.org/ww/goautoneg" 24 | 25 | dto "github.com/prometheus/client_model/go" 26 | ) 27 | 28 | // Encoder types encode metric families into an underlying wire protocol. 29 | type Encoder interface { 30 | Encode(*dto.MetricFamily) error 31 | } 32 | 33 | type encoder func(*dto.MetricFamily) error 34 | 35 | func (e encoder) Encode(v *dto.MetricFamily) error { 36 | return e(v) 37 | } 38 | 39 | // Negotiate returns the Content-Type based on the given Accept header. 40 | // If no appropriate accepted type is found, FmtText is returned. 41 | func Negotiate(h http.Header) Format { 42 | for _, ac := range goautoneg.ParseAccept(h.Get(hdrAccept)) { 43 | // Check for protocol buffer 44 | if ac.Type+"/"+ac.SubType == ProtoType && ac.Params["proto"] == ProtoProtocol { 45 | switch ac.Params["encoding"] { 46 | case "delimited": 47 | return FmtProtoDelim 48 | case "text": 49 | return FmtProtoText 50 | case "compact-text": 51 | return FmtProtoCompact 52 | } 53 | } 54 | // Check for text format. 55 | ver := ac.Params["version"] 56 | if ac.Type == "text" && ac.SubType == "plain" && (ver == TextVersion || ver == "") { 57 | return FmtText 58 | } 59 | } 60 | return FmtText 61 | } 62 | 63 | // NewEncoder returns a new encoder based on content type negotiation. 64 | func NewEncoder(w io.Writer, format Format) Encoder { 65 | switch format { 66 | case FmtProtoDelim: 67 | return encoder(func(v *dto.MetricFamily) error { 68 | _, err := pbutil.WriteDelimited(w, v) 69 | return err 70 | }) 71 | case FmtProtoCompact: 72 | return encoder(func(v *dto.MetricFamily) error { 73 | _, err := fmt.Fprintln(w, v.String()) 74 | return err 75 | }) 76 | case FmtProtoText: 77 | return encoder(func(v *dto.MetricFamily) error { 78 | _, err := fmt.Fprintln(w, proto.MarshalTextString(v)) 79 | return err 80 | }) 81 | case FmtText: 82 | return encoder(func(v *dto.MetricFamily) error { 83 | _, err := MetricFamilyToText(w, v) 84 | return err 85 | }) 86 | } 87 | panic("expfmt.NewEncoder: unknown format") 88 | } 89 | -------------------------------------------------------------------------------- /vendor/github.com/prometheus/client_golang/prometheus/labels.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Prometheus Authors 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | // You may obtain a copy of the License at 5 | // 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 prometheus 15 | 16 | import ( 17 | "errors" 18 | "fmt" 19 | "strings" 20 | "unicode/utf8" 21 | 22 | "github.com/prometheus/common/model" 23 | ) 24 | 25 | // Labels represents a collection of label name -> value mappings. This type is 26 | // commonly used with the With(Labels) and GetMetricWith(Labels) methods of 27 | // metric vector Collectors, e.g.: 28 | // myVec.With(Labels{"code": "404", "method": "GET"}).Add(42) 29 | // 30 | // The other use-case is the specification of constant label pairs in Opts or to 31 | // create a Desc. 32 | type Labels map[string]string 33 | 34 | // reservedLabelPrefix is a prefix which is not legal in user-supplied 35 | // label names. 36 | const reservedLabelPrefix = "__" 37 | 38 | var errInconsistentCardinality = errors.New("inconsistent label cardinality") 39 | 40 | func makeInconsistentCardinalityError(fqName string, labels, labelValues []string) error { 41 | return fmt.Errorf( 42 | "%s: %q has %d variable labels named %q but %d values %q were provided", 43 | errInconsistentCardinality, fqName, 44 | len(labels), labels, 45 | len(labelValues), labelValues, 46 | ) 47 | } 48 | 49 | func validateValuesInLabels(labels Labels, expectedNumberOfValues int) error { 50 | if len(labels) != expectedNumberOfValues { 51 | return fmt.Errorf( 52 | "%s: expected %d label values but got %d in %#v", 53 | errInconsistentCardinality, expectedNumberOfValues, 54 | len(labels), labels, 55 | ) 56 | } 57 | 58 | for name, val := range labels { 59 | if !utf8.ValidString(val) { 60 | return fmt.Errorf("label %s: value %q is not valid UTF-8", name, val) 61 | } 62 | } 63 | 64 | return nil 65 | } 66 | 67 | func validateLabelValues(vals []string, expectedNumberOfValues int) error { 68 | if len(vals) != expectedNumberOfValues { 69 | return fmt.Errorf( 70 | "%s: expected %d label values but got %d in %#v", 71 | errInconsistentCardinality, expectedNumberOfValues, 72 | len(vals), vals, 73 | ) 74 | } 75 | 76 | for _, val := range vals { 77 | if !utf8.ValidString(val) { 78 | return fmt.Errorf("label value %q is not valid UTF-8", val) 79 | } 80 | } 81 | 82 | return nil 83 | } 84 | 85 | func checkLabelName(l string) bool { 86 | return model.LabelName(l).IsValid() && !strings.HasPrefix(l, reservedLabelPrefix) 87 | } 88 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/aws/endpoints/doc.go: -------------------------------------------------------------------------------- 1 | // Package endpoints provides the types and functionality for defining regions 2 | // and endpoints, as well as querying those definitions. 3 | // 4 | // The SDK's Regions and Endpoints metadata is code generated into the endpoints 5 | // package, and is accessible via the DefaultResolver function. This function 6 | // returns a endpoint Resolver will search the metadata and build an associated 7 | // endpoint if one is found. The default resolver will search all partitions 8 | // known by the SDK. e.g AWS Standard (aws), AWS China (aws-cn), and 9 | // AWS GovCloud (US) (aws-us-gov). 10 | // . 11 | // 12 | // Enumerating Regions and Endpoint Metadata 13 | // 14 | // Casting the Resolver returned by DefaultResolver to a EnumPartitions interface 15 | // will allow you to get access to the list of underlying Partitions with the 16 | // Partitions method. This is helpful if you want to limit the SDK's endpoint 17 | // resolving to a single partition, or enumerate regions, services, and endpoints 18 | // in the partition. 19 | // 20 | // resolver := endpoints.DefaultResolver() 21 | // partitions := resolver.(endpoints.EnumPartitions).Partitions() 22 | // 23 | // for _, p := range partitions { 24 | // fmt.Println("Regions for", p.ID()) 25 | // for id, _ := range p.Regions() { 26 | // fmt.Println("*", id) 27 | // } 28 | // 29 | // fmt.Println("Services for", p.ID()) 30 | // for id, _ := range p.Services() { 31 | // fmt.Println("*", id) 32 | // } 33 | // } 34 | // 35 | // Using Custom Endpoints 36 | // 37 | // The endpoints package also gives you the ability to use your own logic how 38 | // endpoints are resolved. This is a great way to define a custom endpoint 39 | // for select services, without passing that logic down through your code. 40 | // 41 | // If a type implements the Resolver interface it can be used to resolve 42 | // endpoints. To use this with the SDK's Session and Config set the value 43 | // of the type to the EndpointsResolver field of aws.Config when initializing 44 | // the session, or service client. 45 | // 46 | // In addition the ResolverFunc is a wrapper for a func matching the signature 47 | // of Resolver.EndpointFor, converting it to a type that satisfies the 48 | // Resolver interface. 49 | // 50 | // 51 | // myCustomResolver := func(service, region string, optFns ...func(*endpoints.Options)) (endpoints.ResolvedEndpoint, error) { 52 | // if service == endpoints.S3ServiceID { 53 | // return endpoints.ResolvedEndpoint{ 54 | // URL: "s3.custom.endpoint.com", 55 | // SigningRegion: "custom-signing-region", 56 | // }, nil 57 | // } 58 | // 59 | // return endpoints.DefaultResolver().EndpointFor(service, region, optFns...) 60 | // } 61 | // 62 | // sess := session.Must(session.NewSession(&aws.Config{ 63 | // Region: aws.String("us-west-2"), 64 | // EndpointResolver: endpoints.ResolverFunc(myCustomResolver), 65 | // })) 66 | package endpoints 67 | -------------------------------------------------------------------------------- /vendor/github.com/prometheus/client_golang/prometheus/internal/metric.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Prometheus Authors 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | // You may obtain a copy of the License at 5 | // 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 internal 15 | 16 | import ( 17 | "sort" 18 | 19 | dto "github.com/prometheus/client_model/go" 20 | ) 21 | 22 | // metricSorter is a sortable slice of *dto.Metric. 23 | type metricSorter []*dto.Metric 24 | 25 | func (s metricSorter) Len() int { 26 | return len(s) 27 | } 28 | 29 | func (s metricSorter) Swap(i, j int) { 30 | s[i], s[j] = s[j], s[i] 31 | } 32 | 33 | func (s metricSorter) Less(i, j int) bool { 34 | if len(s[i].Label) != len(s[j].Label) { 35 | // This should not happen. The metrics are 36 | // inconsistent. However, we have to deal with the fact, as 37 | // people might use custom collectors or metric family injection 38 | // to create inconsistent metrics. So let's simply compare the 39 | // number of labels in this case. That will still yield 40 | // reproducible sorting. 41 | return len(s[i].Label) < len(s[j].Label) 42 | } 43 | for n, lp := range s[i].Label { 44 | vi := lp.GetValue() 45 | vj := s[j].Label[n].GetValue() 46 | if vi != vj { 47 | return vi < vj 48 | } 49 | } 50 | 51 | // We should never arrive here. Multiple metrics with the same 52 | // label set in the same scrape will lead to undefined ingestion 53 | // behavior. However, as above, we have to provide stable sorting 54 | // here, even for inconsistent metrics. So sort equal metrics 55 | // by their timestamp, with missing timestamps (implying "now") 56 | // coming last. 57 | if s[i].TimestampMs == nil { 58 | return false 59 | } 60 | if s[j].TimestampMs == nil { 61 | return true 62 | } 63 | return s[i].GetTimestampMs() < s[j].GetTimestampMs() 64 | } 65 | 66 | // NormalizeMetricFamilies returns a MetricFamily slice with empty 67 | // MetricFamilies pruned and the remaining MetricFamilies sorted by name within 68 | // the slice, with the contained Metrics sorted within each MetricFamily. 69 | func NormalizeMetricFamilies(metricFamiliesByName map[string]*dto.MetricFamily) []*dto.MetricFamily { 70 | for _, mf := range metricFamiliesByName { 71 | sort.Sort(metricSorter(mf.Metric)) 72 | } 73 | names := make([]string, 0, len(metricFamiliesByName)) 74 | for name, mf := range metricFamiliesByName { 75 | if len(mf.Metric) > 0 { 76 | names = append(names, name) 77 | } 78 | } 79 | sort.Strings(names) 80 | result := make([]*dto.MetricFamily, 0, len(names)) 81 | for _, name := range names { 82 | result = append(result, metricFamiliesByName[name]) 83 | } 84 | return result 85 | } 86 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/aws/awsutil/prettify.go: -------------------------------------------------------------------------------- 1 | package awsutil 2 | 3 | import ( 4 | "bytes" 5 | "fmt" 6 | "io" 7 | "reflect" 8 | "strings" 9 | ) 10 | 11 | // Prettify returns the string representation of a value. 12 | func Prettify(i interface{}) string { 13 | var buf bytes.Buffer 14 | prettify(reflect.ValueOf(i), 0, &buf) 15 | return buf.String() 16 | } 17 | 18 | // prettify will recursively walk value v to build a textual 19 | // representation of the value. 20 | func prettify(v reflect.Value, indent int, buf *bytes.Buffer) { 21 | for v.Kind() == reflect.Ptr { 22 | v = v.Elem() 23 | } 24 | 25 | switch v.Kind() { 26 | case reflect.Struct: 27 | strtype := v.Type().String() 28 | if strtype == "time.Time" { 29 | fmt.Fprintf(buf, "%s", v.Interface()) 30 | break 31 | } else if strings.HasPrefix(strtype, "io.") { 32 | buf.WriteString("") 33 | break 34 | } 35 | 36 | buf.WriteString("{\n") 37 | 38 | names := []string{} 39 | for i := 0; i < v.Type().NumField(); i++ { 40 | name := v.Type().Field(i).Name 41 | f := v.Field(i) 42 | if name[0:1] == strings.ToLower(name[0:1]) { 43 | continue // ignore unexported fields 44 | } 45 | if (f.Kind() == reflect.Ptr || f.Kind() == reflect.Slice || f.Kind() == reflect.Map) && f.IsNil() { 46 | continue // ignore unset fields 47 | } 48 | names = append(names, name) 49 | } 50 | 51 | for i, n := range names { 52 | val := v.FieldByName(n) 53 | buf.WriteString(strings.Repeat(" ", indent+2)) 54 | buf.WriteString(n + ": ") 55 | prettify(val, indent+2, buf) 56 | 57 | if i < len(names)-1 { 58 | buf.WriteString(",\n") 59 | } 60 | } 61 | 62 | buf.WriteString("\n" + strings.Repeat(" ", indent) + "}") 63 | case reflect.Slice: 64 | strtype := v.Type().String() 65 | if strtype == "[]uint8" { 66 | fmt.Fprintf(buf, " len %d", v.Len()) 67 | break 68 | } 69 | 70 | nl, id, id2 := "", "", "" 71 | if v.Len() > 3 { 72 | nl, id, id2 = "\n", strings.Repeat(" ", indent), strings.Repeat(" ", indent+2) 73 | } 74 | buf.WriteString("[" + nl) 75 | for i := 0; i < v.Len(); i++ { 76 | buf.WriteString(id2) 77 | prettify(v.Index(i), indent+2, buf) 78 | 79 | if i < v.Len()-1 { 80 | buf.WriteString("," + nl) 81 | } 82 | } 83 | 84 | buf.WriteString(nl + id + "]") 85 | case reflect.Map: 86 | buf.WriteString("{\n") 87 | 88 | for i, k := range v.MapKeys() { 89 | buf.WriteString(strings.Repeat(" ", indent+2)) 90 | buf.WriteString(k.String() + ": ") 91 | prettify(v.MapIndex(k), indent+2, buf) 92 | 93 | if i < v.Len()-1 { 94 | buf.WriteString(",\n") 95 | } 96 | } 97 | 98 | buf.WriteString("\n" + strings.Repeat(" ", indent) + "}") 99 | default: 100 | if !v.IsValid() { 101 | fmt.Fprint(buf, "") 102 | return 103 | } 104 | format := "%v" 105 | switch v.Interface().(type) { 106 | case string: 107 | format = "%q" 108 | case io.ReadSeeker, io.Reader: 109 | format = "buffer(%p)" 110 | } 111 | fmt.Fprintf(buf, format, v.Interface()) 112 | } 113 | } 114 | -------------------------------------------------------------------------------- /vendor/github.com/prometheus/common/model/fingerprinting.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Prometheus Authors 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | // You may obtain a copy of the License at 5 | // 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 model 15 | 16 | import ( 17 | "fmt" 18 | "strconv" 19 | ) 20 | 21 | // Fingerprint provides a hash-capable representation of a Metric. 22 | // For our purposes, FNV-1A 64-bit is used. 23 | type Fingerprint uint64 24 | 25 | // FingerprintFromString transforms a string representation into a Fingerprint. 26 | func FingerprintFromString(s string) (Fingerprint, error) { 27 | num, err := strconv.ParseUint(s, 16, 64) 28 | return Fingerprint(num), err 29 | } 30 | 31 | // ParseFingerprint parses the input string into a fingerprint. 32 | func ParseFingerprint(s string) (Fingerprint, error) { 33 | num, err := strconv.ParseUint(s, 16, 64) 34 | if err != nil { 35 | return 0, err 36 | } 37 | return Fingerprint(num), nil 38 | } 39 | 40 | func (f Fingerprint) String() string { 41 | return fmt.Sprintf("%016x", uint64(f)) 42 | } 43 | 44 | // Fingerprints represents a collection of Fingerprint subject to a given 45 | // natural sorting scheme. It implements sort.Interface. 46 | type Fingerprints []Fingerprint 47 | 48 | // Len implements sort.Interface. 49 | func (f Fingerprints) Len() int { 50 | return len(f) 51 | } 52 | 53 | // Less implements sort.Interface. 54 | func (f Fingerprints) Less(i, j int) bool { 55 | return f[i] < f[j] 56 | } 57 | 58 | // Swap implements sort.Interface. 59 | func (f Fingerprints) Swap(i, j int) { 60 | f[i], f[j] = f[j], f[i] 61 | } 62 | 63 | // FingerprintSet is a set of Fingerprints. 64 | type FingerprintSet map[Fingerprint]struct{} 65 | 66 | // Equal returns true if both sets contain the same elements (and not more). 67 | func (s FingerprintSet) Equal(o FingerprintSet) bool { 68 | if len(s) != len(o) { 69 | return false 70 | } 71 | 72 | for k := range s { 73 | if _, ok := o[k]; !ok { 74 | return false 75 | } 76 | } 77 | 78 | return true 79 | } 80 | 81 | // Intersection returns the elements contained in both sets. 82 | func (s FingerprintSet) Intersection(o FingerprintSet) FingerprintSet { 83 | myLength, otherLength := len(s), len(o) 84 | if myLength == 0 || otherLength == 0 { 85 | return FingerprintSet{} 86 | } 87 | 88 | subSet := s 89 | superSet := o 90 | 91 | if otherLength < myLength { 92 | subSet = o 93 | superSet = s 94 | } 95 | 96 | out := FingerprintSet{} 97 | 98 | for k := range subSet { 99 | if _, ok := superSet[k]; ok { 100 | out[k] = struct{}{} 101 | } 102 | } 103 | 104 | return out 105 | } 106 | -------------------------------------------------------------------------------- /vendor/github.com/matttproud/golang_protobuf_extensions/pbutil/decode.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 Matt T. Proud 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 | 15 | package pbutil 16 | 17 | import ( 18 | "encoding/binary" 19 | "errors" 20 | "io" 21 | 22 | "github.com/golang/protobuf/proto" 23 | ) 24 | 25 | var errInvalidVarint = errors.New("invalid varint32 encountered") 26 | 27 | // ReadDelimited decodes a message from the provided length-delimited stream, 28 | // where the length is encoded as 32-bit varint prefix to the message body. 29 | // It returns the total number of bytes read and any applicable error. This is 30 | // roughly equivalent to the companion Java API's 31 | // MessageLite#parseDelimitedFrom. As per the reader contract, this function 32 | // calls r.Read repeatedly as required until exactly one message including its 33 | // prefix is read and decoded (or an error has occurred). The function never 34 | // reads more bytes from the stream than required. The function never returns 35 | // an error if a message has been read and decoded correctly, even if the end 36 | // of the stream has been reached in doing so. In that case, any subsequent 37 | // calls return (0, io.EOF). 38 | func ReadDelimited(r io.Reader, m proto.Message) (n int, err error) { 39 | // Per AbstractParser#parsePartialDelimitedFrom with 40 | // CodedInputStream#readRawVarint32. 41 | var headerBuf [binary.MaxVarintLen32]byte 42 | var bytesRead, varIntBytes int 43 | var messageLength uint64 44 | for varIntBytes == 0 { // i.e. no varint has been decoded yet. 45 | if bytesRead >= len(headerBuf) { 46 | return bytesRead, errInvalidVarint 47 | } 48 | // We have to read byte by byte here to avoid reading more bytes 49 | // than required. Each read byte is appended to what we have 50 | // read before. 51 | newBytesRead, err := r.Read(headerBuf[bytesRead : bytesRead+1]) 52 | if newBytesRead == 0 { 53 | if err != nil { 54 | return bytesRead, err 55 | } 56 | // A Reader should not return (0, nil), but if it does, 57 | // it should be treated as no-op (according to the 58 | // Reader contract). So let's go on... 59 | continue 60 | } 61 | bytesRead += newBytesRead 62 | // Now present everything read so far to the varint decoder and 63 | // see if a varint can be decoded already. 64 | messageLength, varIntBytes = proto.DecodeVarint(headerBuf[:bytesRead]) 65 | } 66 | 67 | messageBuf := make([]byte, messageLength) 68 | newBytesRead, err := io.ReadFull(r, messageBuf) 69 | bytesRead += newBytesRead 70 | if err != nil { 71 | return bytesRead, err 72 | } 73 | 74 | return bytesRead, proto.Unmarshal(messageBuf, m) 75 | } 76 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/aws/client/default_retryer.go: -------------------------------------------------------------------------------- 1 | package client 2 | 3 | import ( 4 | "strconv" 5 | "time" 6 | 7 | "github.com/aws/aws-sdk-go/aws/request" 8 | "github.com/aws/aws-sdk-go/internal/sdkrand" 9 | ) 10 | 11 | // DefaultRetryer implements basic retry logic using exponential backoff for 12 | // most services. If you want to implement custom retry logic, implement the 13 | // request.Retryer interface or create a structure type that composes this 14 | // struct and override the specific methods. For example, to override only 15 | // the MaxRetries method: 16 | // 17 | // type retryer struct { 18 | // client.DefaultRetryer 19 | // } 20 | // 21 | // // This implementation always has 100 max retries 22 | // func (d retryer) MaxRetries() int { return 100 } 23 | type DefaultRetryer struct { 24 | NumMaxRetries int 25 | } 26 | 27 | // MaxRetries returns the number of maximum returns the service will use to make 28 | // an individual API request. 29 | func (d DefaultRetryer) MaxRetries() int { 30 | return d.NumMaxRetries 31 | } 32 | 33 | // RetryRules returns the delay duration before retrying this request again 34 | func (d DefaultRetryer) RetryRules(r *request.Request) time.Duration { 35 | // Set the upper limit of delay in retrying at ~five minutes 36 | minTime := 30 37 | isThrottle := r.IsErrorThrottle() 38 | if isThrottle { 39 | if delay, ok := getRetryDelay(r); ok { 40 | return delay 41 | } 42 | 43 | minTime = 500 44 | } 45 | 46 | retryCount := r.RetryCount 47 | if isThrottle && retryCount > 8 { 48 | retryCount = 8 49 | } else if retryCount > 13 { 50 | retryCount = 13 51 | } 52 | 53 | delay := (1 << uint(retryCount)) * (sdkrand.SeededRand.Intn(minTime) + minTime) 54 | return time.Duration(delay) * time.Millisecond 55 | } 56 | 57 | // ShouldRetry returns true if the request should be retried. 58 | func (d DefaultRetryer) ShouldRetry(r *request.Request) bool { 59 | // If one of the other handlers already set the retry state 60 | // we don't want to override it based on the service's state 61 | if r.Retryable != nil { 62 | return *r.Retryable 63 | } 64 | 65 | if r.HTTPResponse.StatusCode >= 500 && r.HTTPResponse.StatusCode != 501 { 66 | return true 67 | } 68 | 69 | return r.IsErrorRetryable() || r.IsErrorThrottle() 70 | } 71 | 72 | // This will look in the Retry-After header, RFC 7231, for how long 73 | // it will wait before attempting another request 74 | func getRetryDelay(r *request.Request) (time.Duration, bool) { 75 | if !canUseRetryAfterHeader(r) { 76 | return 0, false 77 | } 78 | 79 | delayStr := r.HTTPResponse.Header.Get("Retry-After") 80 | if len(delayStr) == 0 { 81 | return 0, false 82 | } 83 | 84 | delay, err := strconv.Atoi(delayStr) 85 | if err != nil { 86 | return 0, false 87 | } 88 | 89 | return time.Duration(delay) * time.Second, true 90 | } 91 | 92 | // Will look at the status code to see if the retry header pertains to 93 | // the status code. 94 | func canUseRetryAfterHeader(r *request.Request) bool { 95 | switch r.HTTPResponse.StatusCode { 96 | case 429: 97 | case 503: 98 | default: 99 | return false 100 | } 101 | 102 | return true 103 | } 104 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/internal/ini/ast.go: -------------------------------------------------------------------------------- 1 | package ini 2 | 3 | // ASTKind represents different states in the parse table 4 | // and the type of AST that is being constructed 5 | type ASTKind int 6 | 7 | // ASTKind* is used in the parse table to transition between 8 | // the different states 9 | const ( 10 | ASTKindNone = ASTKind(iota) 11 | ASTKindStart 12 | ASTKindExpr 13 | ASTKindEqualExpr 14 | ASTKindStatement 15 | ASTKindSkipStatement 16 | ASTKindExprStatement 17 | ASTKindSectionStatement 18 | ASTKindNestedSectionStatement 19 | ASTKindCompletedNestedSectionStatement 20 | ASTKindCommentStatement 21 | ASTKindCompletedSectionStatement 22 | ) 23 | 24 | func (k ASTKind) String() string { 25 | switch k { 26 | case ASTKindNone: 27 | return "none" 28 | case ASTKindStart: 29 | return "start" 30 | case ASTKindExpr: 31 | return "expr" 32 | case ASTKindStatement: 33 | return "stmt" 34 | case ASTKindSectionStatement: 35 | return "section_stmt" 36 | case ASTKindExprStatement: 37 | return "expr_stmt" 38 | case ASTKindCommentStatement: 39 | return "comment" 40 | case ASTKindNestedSectionStatement: 41 | return "nested_section_stmt" 42 | case ASTKindCompletedSectionStatement: 43 | return "completed_stmt" 44 | case ASTKindSkipStatement: 45 | return "skip" 46 | default: 47 | return "" 48 | } 49 | } 50 | 51 | // AST interface allows us to determine what kind of node we 52 | // are on and casting may not need to be necessary. 53 | // 54 | // The root is always the first node in Children 55 | type AST struct { 56 | Kind ASTKind 57 | Root Token 58 | RootToken bool 59 | Children []AST 60 | } 61 | 62 | func newAST(kind ASTKind, root AST, children ...AST) AST { 63 | return AST{ 64 | Kind: kind, 65 | Children: append([]AST{root}, children...), 66 | } 67 | } 68 | 69 | func newASTWithRootToken(kind ASTKind, root Token, children ...AST) AST { 70 | return AST{ 71 | Kind: kind, 72 | Root: root, 73 | RootToken: true, 74 | Children: children, 75 | } 76 | } 77 | 78 | // AppendChild will append to the list of children an AST has. 79 | func (a *AST) AppendChild(child AST) { 80 | a.Children = append(a.Children, child) 81 | } 82 | 83 | // GetRoot will return the root AST which can be the first entry 84 | // in the children list or a token. 85 | func (a *AST) GetRoot() AST { 86 | if a.RootToken { 87 | return *a 88 | } 89 | 90 | if len(a.Children) == 0 { 91 | return AST{} 92 | } 93 | 94 | return a.Children[0] 95 | } 96 | 97 | // GetChildren will return the current AST's list of children 98 | func (a *AST) GetChildren() []AST { 99 | if len(a.Children) == 0 { 100 | return []AST{} 101 | } 102 | 103 | if a.RootToken { 104 | return a.Children 105 | } 106 | 107 | return a.Children[1:] 108 | } 109 | 110 | // SetChildren will set and override all children of the AST. 111 | func (a *AST) SetChildren(children []AST) { 112 | if a.RootToken { 113 | a.Children = children 114 | } else { 115 | a.Children = append(a.Children[:1], children...) 116 | } 117 | } 118 | 119 | // Start is used to indicate the starting state of the parse table. 120 | var Start = newAST(ASTKindStart, AST{}) 121 | -------------------------------------------------------------------------------- /aws/sqs.go: -------------------------------------------------------------------------------- 1 | package aws 2 | 3 | import ( 4 | "log" 5 | "strconv" 6 | 7 | "github.com/aws/aws-sdk-go/aws/session" 8 | "github.com/aws/aws-sdk-go/service/sqs" 9 | ) 10 | 11 | const ( 12 | numberOfMessagesInQueueAttrName = "ApproximateNumberOfMessages" 13 | numberOfMessagesInFlightQueueAttrName = "ApproximateNumberOfMessagesNotVisible" 14 | msgsInQueueMetricName = "msgsInQueue" 15 | ) 16 | 17 | // SQSColector - SQSClient struct using pointer 18 | type SQSColector struct { 19 | cli *SQSClient 20 | } 21 | 22 | // SQSClient - AWS struct 23 | type SQSClient struct { 24 | *AWS 25 | } 26 | 27 | type SQSMetrics struct { 28 | Visible Metric 29 | InFlight Metric 30 | } 31 | 32 | type Metric struct { 33 | Name string 34 | Value int 35 | } 36 | 37 | func (m SQSMetrics) TotalMessages() int { 38 | return m.InFlight.Value + m.Visible.Value 39 | } 40 | 41 | // GetMetrics - Used to get metrics (number msgs in queue) in SQS 42 | func (s *SQSColector) GetMetrics(awsKey, awsSecret, awsRegion, queue string, logs bool) (SQSMetrics, error) { 43 | metrics, err := s.getNumberOfMsgsInQueue(awsKey, awsSecret, awsRegion, queue) 44 | if err != nil { 45 | return metrics, err 46 | } 47 | 48 | if logs { 49 | log.Printf("Messages in Queue (%s): Visible: %d In Flight: %d Total: %d\n", 50 | queue, metrics.Visible.Value, metrics.InFlight.Value, metrics.TotalMessages()) 51 | } 52 | 53 | return metrics, nil 54 | } 55 | 56 | func (s *SQSColector) getNumberOfMsgsInQueue(awsKey, awsSecret, awsRegion, queueURL string) (SQSMetrics, error) { 57 | c := newSQSClient(awsKey, awsSecret, awsRegion) 58 | metrics := SQSMetrics{} 59 | 60 | attrs, err := c.getQueueAttributes( 61 | queueURL, 62 | numberOfMessagesInQueueAttrName, 63 | numberOfMessagesInFlightQueueAttrName, 64 | ) 65 | if err != nil { 66 | return metrics, err 67 | } 68 | 69 | metrics.Visible.Value, err = readIntAttribute(attrs, numberOfMessagesInQueueAttrName) 70 | if err != nil { 71 | return metrics, err 72 | } 73 | 74 | metrics.InFlight.Value, err = readIntAttribute(attrs, numberOfMessagesInFlightQueueAttrName) 75 | if err != nil { 76 | return metrics, err 77 | } 78 | return metrics, nil 79 | } 80 | 81 | func readIntAttribute(attributes map[string]string, key string) (int, error) { 82 | m, err := strconv.Atoi(attributes[key]) 83 | if err != nil { 84 | return m, err 85 | } 86 | return m, nil 87 | } 88 | 89 | func (s *SQSClient) getQueueAttributes(queueURL string, attributes ...string) (map[string]string, error) { 90 | cli := sqs.New(session.New(), s.newConfig()) 91 | 92 | var attrList []*string 93 | for _, attr := range attributes { 94 | a := attr 95 | attrList = append(attrList, &a) 96 | } 97 | 98 | out, err := cli.GetQueueAttributes( 99 | &sqs.GetQueueAttributesInput{QueueUrl: &queueURL, AttributeNames: attrList}, 100 | ) 101 | 102 | if err != nil { 103 | return nil, err 104 | } 105 | result := make(map[string]string) 106 | for k, v := range out.Attributes { 107 | result[k] = *v 108 | } 109 | return result, nil 110 | } 111 | 112 | func newSQSClient(key, secret, region string) *SQSClient { 113 | return &SQSClient{ 114 | AWS: &AWS{key: key, secret: secret, region: region}, 115 | } 116 | } 117 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/aws/client/client.go: -------------------------------------------------------------------------------- 1 | package client 2 | 3 | import ( 4 | "fmt" 5 | 6 | "github.com/aws/aws-sdk-go/aws" 7 | "github.com/aws/aws-sdk-go/aws/client/metadata" 8 | "github.com/aws/aws-sdk-go/aws/request" 9 | ) 10 | 11 | // A Config provides configuration to a service client instance. 12 | type Config struct { 13 | Config *aws.Config 14 | Handlers request.Handlers 15 | Endpoint string 16 | SigningRegion string 17 | SigningName string 18 | 19 | // States that the signing name did not come from a modeled source but 20 | // was derived based on other data. Used by service client constructors 21 | // to determine if the signin name can be overridden based on metadata the 22 | // service has. 23 | SigningNameDerived bool 24 | } 25 | 26 | // ConfigProvider provides a generic way for a service client to receive 27 | // the ClientConfig without circular dependencies. 28 | type ConfigProvider interface { 29 | ClientConfig(serviceName string, cfgs ...*aws.Config) Config 30 | } 31 | 32 | // ConfigNoResolveEndpointProvider same as ConfigProvider except it will not 33 | // resolve the endpoint automatically. The service client's endpoint must be 34 | // provided via the aws.Config.Endpoint field. 35 | type ConfigNoResolveEndpointProvider interface { 36 | ClientConfigNoResolveEndpoint(cfgs ...*aws.Config) Config 37 | } 38 | 39 | // A Client implements the base client request and response handling 40 | // used by all service clients. 41 | type Client struct { 42 | request.Retryer 43 | metadata.ClientInfo 44 | 45 | Config aws.Config 46 | Handlers request.Handlers 47 | } 48 | 49 | // New will return a pointer to a new initialized service client. 50 | func New(cfg aws.Config, info metadata.ClientInfo, handlers request.Handlers, options ...func(*Client)) *Client { 51 | svc := &Client{ 52 | Config: cfg, 53 | ClientInfo: info, 54 | Handlers: handlers.Copy(), 55 | } 56 | 57 | switch retryer, ok := cfg.Retryer.(request.Retryer); { 58 | case ok: 59 | svc.Retryer = retryer 60 | case cfg.Retryer != nil && cfg.Logger != nil: 61 | s := fmt.Sprintf("WARNING: %T does not implement request.Retryer; using DefaultRetryer instead", cfg.Retryer) 62 | cfg.Logger.Log(s) 63 | fallthrough 64 | default: 65 | maxRetries := aws.IntValue(cfg.MaxRetries) 66 | if cfg.MaxRetries == nil || maxRetries == aws.UseServiceDefaultRetries { 67 | maxRetries = 3 68 | } 69 | svc.Retryer = DefaultRetryer{NumMaxRetries: maxRetries} 70 | } 71 | 72 | svc.AddDebugHandlers() 73 | 74 | for _, option := range options { 75 | option(svc) 76 | } 77 | 78 | return svc 79 | } 80 | 81 | // NewRequest returns a new Request pointer for the service API 82 | // operation and parameters. 83 | func (c *Client) NewRequest(operation *request.Operation, params interface{}, data interface{}) *request.Request { 84 | return request.New(c.Config, c.ClientInfo, c.Handlers, c.Retryer, operation, params, data) 85 | } 86 | 87 | // AddDebugHandlers injects debug logging handlers into the service to log request 88 | // debug information. 89 | func (c *Client) AddDebugHandlers() { 90 | if !c.Config.LogLevel.AtLeast(aws.LogDebug) { 91 | return 92 | } 93 | 94 | c.Handlers.Send.PushFrontNamed(LogHTTPRequestHandler) 95 | c.Handlers.Send.PushBackNamed(LogHTTPResponseHandler) 96 | } 97 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/aws/awsutil/copy.go: -------------------------------------------------------------------------------- 1 | package awsutil 2 | 3 | import ( 4 | "io" 5 | "reflect" 6 | "time" 7 | ) 8 | 9 | // Copy deeply copies a src structure to dst. Useful for copying request and 10 | // response structures. 11 | // 12 | // Can copy between structs of different type, but will only copy fields which 13 | // are assignable, and exist in both structs. Fields which are not assignable, 14 | // or do not exist in both structs are ignored. 15 | func Copy(dst, src interface{}) { 16 | dstval := reflect.ValueOf(dst) 17 | if !dstval.IsValid() { 18 | panic("Copy dst cannot be nil") 19 | } 20 | 21 | rcopy(dstval, reflect.ValueOf(src), true) 22 | } 23 | 24 | // CopyOf returns a copy of src while also allocating the memory for dst. 25 | // src must be a pointer type or this operation will fail. 26 | func CopyOf(src interface{}) (dst interface{}) { 27 | dsti := reflect.New(reflect.TypeOf(src).Elem()) 28 | dst = dsti.Interface() 29 | rcopy(dsti, reflect.ValueOf(src), true) 30 | return 31 | } 32 | 33 | // rcopy performs a recursive copy of values from the source to destination. 34 | // 35 | // root is used to skip certain aspects of the copy which are not valid 36 | // for the root node of a object. 37 | func rcopy(dst, src reflect.Value, root bool) { 38 | if !src.IsValid() { 39 | return 40 | } 41 | 42 | switch src.Kind() { 43 | case reflect.Ptr: 44 | if _, ok := src.Interface().(io.Reader); ok { 45 | if dst.Kind() == reflect.Ptr && dst.Elem().CanSet() { 46 | dst.Elem().Set(src) 47 | } else if dst.CanSet() { 48 | dst.Set(src) 49 | } 50 | } else { 51 | e := src.Type().Elem() 52 | if dst.CanSet() && !src.IsNil() { 53 | if _, ok := src.Interface().(*time.Time); !ok { 54 | dst.Set(reflect.New(e)) 55 | } else { 56 | tempValue := reflect.New(e) 57 | tempValue.Elem().Set(src.Elem()) 58 | // Sets time.Time's unexported values 59 | dst.Set(tempValue) 60 | } 61 | } 62 | if src.Elem().IsValid() { 63 | // Keep the current root state since the depth hasn't changed 64 | rcopy(dst.Elem(), src.Elem(), root) 65 | } 66 | } 67 | case reflect.Struct: 68 | t := dst.Type() 69 | for i := 0; i < t.NumField(); i++ { 70 | name := t.Field(i).Name 71 | srcVal := src.FieldByName(name) 72 | dstVal := dst.FieldByName(name) 73 | if srcVal.IsValid() && dstVal.CanSet() { 74 | rcopy(dstVal, srcVal, false) 75 | } 76 | } 77 | case reflect.Slice: 78 | if src.IsNil() { 79 | break 80 | } 81 | 82 | s := reflect.MakeSlice(src.Type(), src.Len(), src.Cap()) 83 | dst.Set(s) 84 | for i := 0; i < src.Len(); i++ { 85 | rcopy(dst.Index(i), src.Index(i), false) 86 | } 87 | case reflect.Map: 88 | if src.IsNil() { 89 | break 90 | } 91 | 92 | s := reflect.MakeMap(src.Type()) 93 | dst.Set(s) 94 | for _, k := range src.MapKeys() { 95 | v := src.MapIndex(k) 96 | v2 := reflect.New(v.Type()).Elem() 97 | rcopy(v2, v, false) 98 | dst.SetMapIndex(k, v2) 99 | } 100 | default: 101 | // Assign the value if possible. If its not assignable, the value would 102 | // need to be converted and the impact of that may be unexpected, or is 103 | // not compatible with the dst type. 104 | if src.Type().AssignableTo(dst.Type()) { 105 | dst.Set(src) 106 | } 107 | } 108 | } 109 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/service/sqs/service.go: -------------------------------------------------------------------------------- 1 | // Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. 2 | 3 | package sqs 4 | 5 | import ( 6 | "github.com/aws/aws-sdk-go/aws" 7 | "github.com/aws/aws-sdk-go/aws/client" 8 | "github.com/aws/aws-sdk-go/aws/client/metadata" 9 | "github.com/aws/aws-sdk-go/aws/request" 10 | "github.com/aws/aws-sdk-go/aws/signer/v4" 11 | "github.com/aws/aws-sdk-go/private/protocol/query" 12 | ) 13 | 14 | // SQS provides the API operation methods for making requests to 15 | // Amazon Simple Queue Service. See this package's package overview docs 16 | // for details on the service. 17 | // 18 | // SQS methods are safe to use concurrently. It is not safe to 19 | // modify mutate any of the struct's properties though. 20 | type SQS struct { 21 | *client.Client 22 | } 23 | 24 | // Used for custom client initialization logic 25 | var initClient func(*client.Client) 26 | 27 | // Used for custom request initialization logic 28 | var initRequest func(*request.Request) 29 | 30 | // Service information constants 31 | const ( 32 | ServiceName = "sqs" // Name of service. 33 | EndpointsID = ServiceName // ID to lookup a service endpoint with. 34 | ServiceID = "SQS" // ServiceID is a unique identifer of a specific service. 35 | ) 36 | 37 | // New creates a new instance of the SQS client with a session. 38 | // If additional configuration is needed for the client instance use the optional 39 | // aws.Config parameter to add your extra config. 40 | // 41 | // Example: 42 | // // Create a SQS client from just a session. 43 | // svc := sqs.New(mySession) 44 | // 45 | // // Create a SQS client with additional configuration 46 | // svc := sqs.New(mySession, aws.NewConfig().WithRegion("us-west-2")) 47 | func New(p client.ConfigProvider, cfgs ...*aws.Config) *SQS { 48 | c := p.ClientConfig(EndpointsID, cfgs...) 49 | return newClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName) 50 | } 51 | 52 | // newClient creates, initializes and returns a new service client instance. 53 | func newClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *SQS { 54 | svc := &SQS{ 55 | Client: client.New( 56 | cfg, 57 | metadata.ClientInfo{ 58 | ServiceName: ServiceName, 59 | ServiceID: ServiceID, 60 | SigningName: signingName, 61 | SigningRegion: signingRegion, 62 | Endpoint: endpoint, 63 | APIVersion: "2012-11-05", 64 | }, 65 | handlers, 66 | ), 67 | } 68 | 69 | // Handlers 70 | svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler) 71 | svc.Handlers.Build.PushBackNamed(query.BuildHandler) 72 | svc.Handlers.Unmarshal.PushBackNamed(query.UnmarshalHandler) 73 | svc.Handlers.UnmarshalMeta.PushBackNamed(query.UnmarshalMetaHandler) 74 | svc.Handlers.UnmarshalError.PushBackNamed(query.UnmarshalErrorHandler) 75 | 76 | // Run custom client initialization if present 77 | if initClient != nil { 78 | initClient(svc.Client) 79 | } 80 | 81 | return svc 82 | } 83 | 84 | // newRequest creates a new request for a SQS operation and runs any 85 | // custom request initialization. 86 | func (c *SQS) newRequest(op *request.Operation, params, data interface{}) *request.Request { 87 | req := c.NewRequest(op, params, data) 88 | 89 | // Run custom request initialization if present 90 | if initRequest != nil { 91 | initRequest(req) 92 | } 93 | 94 | return req 95 | } 96 | --------------------------------------------------------------------------------