Switch to using the dep tool and update all the dependencies
This commit is contained in:
parent
5135ff73cb
commit
98c2d2c41b
5321 changed files with 4483201 additions and 5922 deletions
29
vendor/github.com/aws/aws-sdk-go/private/model/cli/api-info/api-info.go
generated
vendored
Normal file
29
vendor/github.com/aws/aws-sdk-go/private/model/cli/api-info/api-info.go
generated
vendored
Normal file
|
@ -0,0 +1,29 @@
|
|||
// +build codegen
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"sort"
|
||||
|
||||
"github.com/aws/aws-sdk-go/private/model/api"
|
||||
)
|
||||
|
||||
func main() {
|
||||
dir, _ := os.Open(filepath.Join("models", "apis"))
|
||||
names, _ := dir.Readdirnames(0)
|
||||
for _, name := range names {
|
||||
m, _ := filepath.Glob(filepath.Join("models", "apis", name, "*", "api-2.json"))
|
||||
if len(m) == 0 {
|
||||
continue
|
||||
}
|
||||
|
||||
sort.Strings(m)
|
||||
f := m[len(m)-1]
|
||||
a := api.API{}
|
||||
a.Attach(f)
|
||||
fmt.Printf("%s\t%s\n", a.Metadata.ServiceFullName, a.Metadata.APIVersion)
|
||||
}
|
||||
}
|
292
vendor/github.com/aws/aws-sdk-go/private/model/cli/gen-api/main.go
generated
vendored
Normal file
292
vendor/github.com/aws/aws-sdk-go/private/model/cli/gen-api/main.go
generated
vendored
Normal file
|
@ -0,0 +1,292 @@
|
|||
// +build codegen
|
||||
|
||||
// Command aws-gen-gocli parses a JSON description of an AWS API and generates a
|
||||
// Go file containing a client for the API.
|
||||
//
|
||||
// aws-gen-gocli apis/s3/2006-03-03/api-2.json
|
||||
package main
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"runtime/debug"
|
||||
"sort"
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
"github.com/aws/aws-sdk-go/private/model/api"
|
||||
"github.com/aws/aws-sdk-go/private/util"
|
||||
)
|
||||
|
||||
type generateInfo struct {
|
||||
*api.API
|
||||
PackageDir string
|
||||
}
|
||||
|
||||
var excludeServices = map[string]struct{}{
|
||||
"importexport": {},
|
||||
}
|
||||
|
||||
// newGenerateInfo initializes the service API's folder structure for a specific service.
|
||||
// If the SERVICES environment variable is set, and this service is not apart of the list
|
||||
// this service will be skipped.
|
||||
func newGenerateInfo(modelFile, svcPath, svcImportPath string) *generateInfo {
|
||||
g := &generateInfo{API: &api.API{SvcClientImportPath: svcImportPath, BaseCrosslinkURL: "https://docs.aws.amazon.com"}}
|
||||
g.API.Attach(modelFile)
|
||||
|
||||
if _, ok := excludeServices[g.API.PackageName()]; ok {
|
||||
return nil
|
||||
}
|
||||
|
||||
paginatorsFile := strings.Replace(modelFile, "api-2.json", "paginators-1.json", -1)
|
||||
if _, err := os.Stat(paginatorsFile); err == nil {
|
||||
g.API.AttachPaginators(paginatorsFile)
|
||||
} else if !os.IsNotExist(err) {
|
||||
fmt.Println("api-2.json error:", err)
|
||||
}
|
||||
|
||||
docsFile := strings.Replace(modelFile, "api-2.json", "docs-2.json", -1)
|
||||
if _, err := os.Stat(docsFile); err == nil {
|
||||
g.API.AttachDocs(docsFile)
|
||||
} else {
|
||||
fmt.Println("docs-2.json error:", err)
|
||||
}
|
||||
|
||||
waitersFile := strings.Replace(modelFile, "api-2.json", "waiters-2.json", -1)
|
||||
if _, err := os.Stat(waitersFile); err == nil {
|
||||
g.API.AttachWaiters(waitersFile)
|
||||
} else if !os.IsNotExist(err) {
|
||||
fmt.Println("waiters-2.json error:", err)
|
||||
}
|
||||
|
||||
// pkgDocAddonsFile := strings.Replace(modelFile, "api-2.json", "go-pkg-doc.gotmpl", -1)
|
||||
// if _, err := os.Stat(pkgDocAddonsFile); err == nil {
|
||||
// g.API.AttachPackageDocAddons(pkgDocAddonsFile)
|
||||
// } else if !os.IsNotExist(err) {
|
||||
// fmt.Println("go-pkg-doc.gotmpl error:", err)
|
||||
// }
|
||||
|
||||
g.API.Setup()
|
||||
|
||||
if svc := os.Getenv("SERVICES"); svc != "" {
|
||||
svcs := strings.Split(svc, ",")
|
||||
|
||||
included := false
|
||||
for _, s := range svcs {
|
||||
if s == g.API.PackageName() {
|
||||
included = true
|
||||
break
|
||||
}
|
||||
}
|
||||
if !included {
|
||||
// skip this non-included service
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
// ensure the directory exists
|
||||
pkgDir := filepath.Join(svcPath, g.API.PackageName())
|
||||
os.MkdirAll(pkgDir, 0775)
|
||||
os.MkdirAll(filepath.Join(pkgDir, g.API.InterfacePackageName()), 0775)
|
||||
|
||||
g.PackageDir = pkgDir
|
||||
|
||||
return g
|
||||
}
|
||||
|
||||
// Generates service api, examples, and interface from api json definition files.
|
||||
//
|
||||
// Flags:
|
||||
// -path alternative service path to write generated files to for each service.
|
||||
//
|
||||
// Env:
|
||||
// SERVICES comma separated list of services to generate.
|
||||
func main() {
|
||||
var svcPath, sessionPath, svcImportPath string
|
||||
flag.StringVar(&svcPath, "path", "service", "directory to generate service clients in")
|
||||
flag.StringVar(&sessionPath, "sessionPath", filepath.Join("aws", "session"), "generate session service client factories")
|
||||
flag.StringVar(&svcImportPath, "svc-import-path", "github.com/aws/aws-sdk-go/service", "namespace to generate service client Go code import path under")
|
||||
flag.Parse()
|
||||
api.Bootstrap()
|
||||
|
||||
files := []string{}
|
||||
for i := 0; i < flag.NArg(); i++ {
|
||||
file := flag.Arg(i)
|
||||
if strings.Contains(file, "*") {
|
||||
paths, _ := filepath.Glob(file)
|
||||
files = append(files, paths...)
|
||||
} else {
|
||||
files = append(files, file)
|
||||
}
|
||||
}
|
||||
|
||||
for svcName := range excludeServices {
|
||||
if strings.Contains(os.Getenv("SERVICES"), svcName) {
|
||||
fmt.Printf("Service %s is not supported\n", svcName)
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
|
||||
sort.Strings(files)
|
||||
|
||||
// Remove old API versions from list
|
||||
m := map[string]bool{}
|
||||
for i := range files {
|
||||
idx := len(files) - 1 - i
|
||||
parts := strings.Split(files[idx], string(filepath.Separator))
|
||||
svc := parts[len(parts)-3] // service name is 2nd-to-last component
|
||||
|
||||
if m[svc] {
|
||||
files[idx] = "" // wipe this one out if we already saw the service
|
||||
}
|
||||
m[svc] = true
|
||||
}
|
||||
|
||||
wg := sync.WaitGroup{}
|
||||
for i := range files {
|
||||
filename := files[i]
|
||||
if filename == "" { // empty file
|
||||
continue
|
||||
}
|
||||
|
||||
genInfo := newGenerateInfo(filename, svcPath, svcImportPath)
|
||||
if genInfo == nil {
|
||||
continue
|
||||
}
|
||||
if _, ok := excludeServices[genInfo.API.PackageName()]; ok {
|
||||
// Skip services not yet supported.
|
||||
continue
|
||||
}
|
||||
|
||||
wg.Add(1)
|
||||
go func(g *generateInfo, filename string) {
|
||||
defer wg.Done()
|
||||
writeServiceFiles(g, filename)
|
||||
}(genInfo, filename)
|
||||
}
|
||||
|
||||
wg.Wait()
|
||||
}
|
||||
|
||||
func writeServiceFiles(g *generateInfo, filename string) {
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
fmt.Fprintf(os.Stderr, "Error generating %s\n%s\n%s\n",
|
||||
filename, r, debug.Stack())
|
||||
}
|
||||
}()
|
||||
|
||||
fmt.Printf("Generating %s (%s)...\n",
|
||||
g.API.PackageName(), g.API.Metadata.APIVersion)
|
||||
|
||||
// write files for service client and API
|
||||
Must(writeServiceDocFile(g))
|
||||
Must(writeAPIFile(g))
|
||||
Must(writeExamplesFile(g))
|
||||
Must(writeServiceFile(g))
|
||||
Must(writeInterfaceFile(g))
|
||||
Must(writeWaitersFile(g))
|
||||
Must(writeAPIErrorsFile(g))
|
||||
}
|
||||
|
||||
// Must will panic if the error passed in is not nil.
|
||||
func Must(err error) {
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
const codeLayout = `// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
|
||||
|
||||
%s
|
||||
package %s
|
||||
|
||||
%s
|
||||
`
|
||||
|
||||
func writeGoFile(file string, layout string, args ...interface{}) error {
|
||||
return ioutil.WriteFile(file, []byte(util.GoFmt(fmt.Sprintf(layout, args...))), 0664)
|
||||
}
|
||||
|
||||
// writeServiceDocFile generates the documentation for service package.
|
||||
func writeServiceDocFile(g *generateInfo) error {
|
||||
return writeGoFile(filepath.Join(g.PackageDir, "doc.go"),
|
||||
codeLayout,
|
||||
strings.TrimSpace(g.API.ServicePackageDoc()),
|
||||
g.API.PackageName(),
|
||||
"",
|
||||
)
|
||||
}
|
||||
|
||||
// writeExamplesFile writes out the service example file.
|
||||
func writeExamplesFile(g *generateInfo) error {
|
||||
return writeGoFile(filepath.Join(g.PackageDir, "examples_test.go"),
|
||||
codeLayout,
|
||||
"",
|
||||
g.API.PackageName()+"_test",
|
||||
g.API.ExampleGoCode(),
|
||||
)
|
||||
}
|
||||
|
||||
// writeServiceFile writes out the service initialization file.
|
||||
func writeServiceFile(g *generateInfo) error {
|
||||
return writeGoFile(filepath.Join(g.PackageDir, "service.go"),
|
||||
codeLayout,
|
||||
"",
|
||||
g.API.PackageName(),
|
||||
g.API.ServiceGoCode(),
|
||||
)
|
||||
}
|
||||
|
||||
// writeInterfaceFile writes out the service interface file.
|
||||
func writeInterfaceFile(g *generateInfo) error {
|
||||
const pkgDoc = `
|
||||
// Package %s provides an interface to enable mocking the %s service client
|
||||
// for testing your code.
|
||||
//
|
||||
// It is important to note that this interface will have breaking changes
|
||||
// when the service model is updated and adds new API operations, paginators,
|
||||
// and waiters.`
|
||||
return writeGoFile(filepath.Join(g.PackageDir, g.API.InterfacePackageName(), "interface.go"),
|
||||
codeLayout,
|
||||
fmt.Sprintf(pkgDoc, g.API.InterfacePackageName(), g.API.Metadata.ServiceFullName),
|
||||
g.API.InterfacePackageName(),
|
||||
g.API.InterfaceGoCode(),
|
||||
)
|
||||
}
|
||||
|
||||
func writeWaitersFile(g *generateInfo) error {
|
||||
if len(g.API.Waiters) == 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
return writeGoFile(filepath.Join(g.PackageDir, "waiters.go"),
|
||||
codeLayout,
|
||||
"",
|
||||
g.API.PackageName(),
|
||||
g.API.WaitersGoCode(),
|
||||
)
|
||||
}
|
||||
|
||||
// writeAPIFile writes out the service API file.
|
||||
func writeAPIFile(g *generateInfo) error {
|
||||
return writeGoFile(filepath.Join(g.PackageDir, "api.go"),
|
||||
codeLayout,
|
||||
"",
|
||||
g.API.PackageName(),
|
||||
g.API.APIGoCode(),
|
||||
)
|
||||
}
|
||||
|
||||
// writeAPIErrorsFile writes out the service API errors file.
|
||||
func writeAPIErrorsFile(g *generateInfo) error {
|
||||
return writeGoFile(filepath.Join(g.PackageDir, "errors.go"),
|
||||
codeLayout,
|
||||
"",
|
||||
g.API.PackageName(),
|
||||
g.API.APIErrorsGoCode(),
|
||||
)
|
||||
}
|
56
vendor/github.com/aws/aws-sdk-go/private/model/cli/gen-endpoints/main.go
generated
vendored
Normal file
56
vendor/github.com/aws/aws-sdk-go/private/model/cli/gen-endpoints/main.go
generated
vendored
Normal file
|
@ -0,0 +1,56 @@
|
|||
// +build codegen
|
||||
|
||||
// Command gen-endpoints parses a JSON description of the AWS endpoint
|
||||
// discovery logic and generates a Go file which returns an endpoint.
|
||||
//
|
||||
// aws-gen-goendpoints apis/_endpoints.json aws/endpoints_map.go
|
||||
package main
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"github.com/aws/aws-sdk-go/aws/endpoints"
|
||||
)
|
||||
|
||||
// Generates the endpoints from json description
|
||||
//
|
||||
// Args:
|
||||
// -model The definition file to use
|
||||
// -out The output file to generate
|
||||
func main() {
|
||||
var modelName, outName string
|
||||
flag.StringVar(&modelName, "model", "", "Endpoints definition model")
|
||||
flag.StringVar(&outName, "out", "", "File to write generated endpoints to.")
|
||||
flag.Parse()
|
||||
|
||||
if len(modelName) == 0 || len(outName) == 0 {
|
||||
exitErrorf("model and out both required.")
|
||||
}
|
||||
|
||||
modelFile, err := os.Open(modelName)
|
||||
if err != nil {
|
||||
exitErrorf("failed to open model definition, %v.", err)
|
||||
}
|
||||
defer modelFile.Close()
|
||||
|
||||
outFile, err := os.Create(outName)
|
||||
if err != nil {
|
||||
exitErrorf("failed to open out file, %v.", err)
|
||||
}
|
||||
defer func() {
|
||||
if err := outFile.Close(); err != nil {
|
||||
exitErrorf("failed to successfully write %q file, %v", outName, err)
|
||||
}
|
||||
}()
|
||||
|
||||
if err := endpoints.CodeGenModel(modelFile, outFile); err != nil {
|
||||
exitErrorf("failed to codegen model, %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func exitErrorf(msg string, args ...interface{}) {
|
||||
fmt.Fprintf(os.Stderr, msg+"\n", args...)
|
||||
os.Exit(1)
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue