diff --git a/Godeps/Godeps.json b/Godeps/Godeps.json index 491b447036..6f7b77098d 100644 --- a/Godeps/Godeps.json +++ b/Godeps/Godeps.json @@ -17,208 +17,238 @@ }, { "ImportPath": "github.com/aws/aws-sdk-go/aws", - "Comment": "v1.0.7-9-g4f9a300", - "Rev": "4f9a300f2af32035b3ae8bd0ce9b0fe8412df743" + "Comment": "v1.1.18-16-gb743ca2", + "Rev": "b743ca27e4b9237d7e2911d6dba2f039c4a3ad0f" }, { "ImportPath": "github.com/aws/aws-sdk-go/aws/awserr", - "Comment": "v1.0.7-9-g4f9a300", - "Rev": "4f9a300f2af32035b3ae8bd0ce9b0fe8412df743" + "Comment": "v1.1.18-16-gb743ca2", + "Rev": "b743ca27e4b9237d7e2911d6dba2f039c4a3ad0f" }, { "ImportPath": "github.com/aws/aws-sdk-go/aws/awsutil", - "Comment": "v1.0.7-9-g4f9a300", - "Rev": "4f9a300f2af32035b3ae8bd0ce9b0fe8412df743" + "Comment": "v1.1.18-16-gb743ca2", + "Rev": "b743ca27e4b9237d7e2911d6dba2f039c4a3ad0f" }, { "ImportPath": "github.com/aws/aws-sdk-go/aws/client", - "Comment": "v1.0.7-9-g4f9a300", - "Rev": "4f9a300f2af32035b3ae8bd0ce9b0fe8412df743" + "Comment": "v1.1.18-16-gb743ca2", + "Rev": "b743ca27e4b9237d7e2911d6dba2f039c4a3ad0f" }, { "ImportPath": "github.com/aws/aws-sdk-go/aws/client/metadata", - "Comment": "v1.0.7-9-g4f9a300", - "Rev": "4f9a300f2af32035b3ae8bd0ce9b0fe8412df743" + "Comment": "v1.1.18-16-gb743ca2", + "Rev": "b743ca27e4b9237d7e2911d6dba2f039c4a3ad0f" }, { "ImportPath": "github.com/aws/aws-sdk-go/aws/corehandlers", - "Comment": "v1.0.7-9-g4f9a300", - "Rev": "4f9a300f2af32035b3ae8bd0ce9b0fe8412df743" + "Comment": "v1.1.18-16-gb743ca2", + "Rev": "b743ca27e4b9237d7e2911d6dba2f039c4a3ad0f" }, { "ImportPath": "github.com/aws/aws-sdk-go/aws/credentials", - "Comment": "v1.0.7-9-g4f9a300", - "Rev": "4f9a300f2af32035b3ae8bd0ce9b0fe8412df743" + "Comment": "v1.1.18-16-gb743ca2", + "Rev": "b743ca27e4b9237d7e2911d6dba2f039c4a3ad0f" }, { "ImportPath": "github.com/aws/aws-sdk-go/aws/credentials/ec2rolecreds", - "Comment": "v1.0.7-9-g4f9a300", - "Rev": "4f9a300f2af32035b3ae8bd0ce9b0fe8412df743" + "Comment": "v1.1.18-16-gb743ca2", + "Rev": "b743ca27e4b9237d7e2911d6dba2f039c4a3ad0f" }, { "ImportPath": "github.com/aws/aws-sdk-go/aws/defaults", - "Comment": "v1.0.7-9-g4f9a300", - "Rev": "4f9a300f2af32035b3ae8bd0ce9b0fe8412df743" + "Comment": "v1.1.18-16-gb743ca2", + "Rev": "b743ca27e4b9237d7e2911d6dba2f039c4a3ad0f" }, { "ImportPath": "github.com/aws/aws-sdk-go/aws/ec2metadata", - "Comment": "v1.0.7-9-g4f9a300", - "Rev": "4f9a300f2af32035b3ae8bd0ce9b0fe8412df743" + "Comment": "v1.1.18-16-gb743ca2", + "Rev": "b743ca27e4b9237d7e2911d6dba2f039c4a3ad0f" }, { "ImportPath": "github.com/aws/aws-sdk-go/aws/request", - "Comment": "v1.0.7-9-g4f9a300", - "Rev": "4f9a300f2af32035b3ae8bd0ce9b0fe8412df743" + "Comment": "v1.1.18-16-gb743ca2", + "Rev": "b743ca27e4b9237d7e2911d6dba2f039c4a3ad0f" }, { "ImportPath": "github.com/aws/aws-sdk-go/aws/session", - "Comment": "v1.0.7-9-g4f9a300", - "Rev": "4f9a300f2af32035b3ae8bd0ce9b0fe8412df743" + "Comment": "v1.1.18-16-gb743ca2", + "Rev": "b743ca27e4b9237d7e2911d6dba2f039c4a3ad0f" + }, + { + "ImportPath": "github.com/aws/aws-sdk-go/awstesting", + "Comment": "v1.1.18-16-gb743ca2", + "Rev": "b743ca27e4b9237d7e2911d6dba2f039c4a3ad0f" }, { "ImportPath": "github.com/aws/aws-sdk-go/private/endpoints", - "Comment": "v1.0.7-9-g4f9a300", - "Rev": "4f9a300f2af32035b3ae8bd0ce9b0fe8412df743" + "Comment": "v1.1.18-16-gb743ca2", + "Rev": "b743ca27e4b9237d7e2911d6dba2f039c4a3ad0f" + }, + { + "ImportPath": "github.com/aws/aws-sdk-go/private/model/api", + "Comment": "v1.1.18-16-gb743ca2", + "Rev": "b743ca27e4b9237d7e2911d6dba2f039c4a3ad0f" + }, + { + "ImportPath": "github.com/aws/aws-sdk-go/private/protocol", + "Comment": "v1.1.18-16-gb743ca2", + "Rev": "b743ca27e4b9237d7e2911d6dba2f039c4a3ad0f" }, { "ImportPath": "github.com/aws/aws-sdk-go/private/protocol/ec2query", - "Comment": "v1.0.7-9-g4f9a300", - "Rev": "4f9a300f2af32035b3ae8bd0ce9b0fe8412df743" + "Comment": "v1.1.18-16-gb743ca2", + "Rev": "b743ca27e4b9237d7e2911d6dba2f039c4a3ad0f" }, { "ImportPath": "github.com/aws/aws-sdk-go/private/protocol/json/jsonutil", - "Comment": "v1.0.7-9-g4f9a300", - "Rev": "4f9a300f2af32035b3ae8bd0ce9b0fe8412df743" + "Comment": "v1.1.18-16-gb743ca2", + "Rev": "b743ca27e4b9237d7e2911d6dba2f039c4a3ad0f" }, { "ImportPath": "github.com/aws/aws-sdk-go/private/protocol/jsonrpc", - "Comment": "v1.0.7-9-g4f9a300", - "Rev": "4f9a300f2af32035b3ae8bd0ce9b0fe8412df743" + "Comment": "v1.1.18-16-gb743ca2", + "Rev": "b743ca27e4b9237d7e2911d6dba2f039c4a3ad0f" }, { "ImportPath": "github.com/aws/aws-sdk-go/private/protocol/query", - "Comment": "v1.0.7-9-g4f9a300", - "Rev": "4f9a300f2af32035b3ae8bd0ce9b0fe8412df743" + "Comment": "v1.1.18-16-gb743ca2", + "Rev": "b743ca27e4b9237d7e2911d6dba2f039c4a3ad0f" }, { "ImportPath": "github.com/aws/aws-sdk-go/private/protocol/query/queryutil", - "Comment": "v1.0.7-9-g4f9a300", - "Rev": "4f9a300f2af32035b3ae8bd0ce9b0fe8412df743" + "Comment": "v1.1.18-16-gb743ca2", + "Rev": "b743ca27e4b9237d7e2911d6dba2f039c4a3ad0f" }, { "ImportPath": "github.com/aws/aws-sdk-go/private/protocol/rest", - "Comment": "v1.0.7-9-g4f9a300", - "Rev": "4f9a300f2af32035b3ae8bd0ce9b0fe8412df743" + "Comment": "v1.1.18-16-gb743ca2", + "Rev": "b743ca27e4b9237d7e2911d6dba2f039c4a3ad0f" }, { "ImportPath": "github.com/aws/aws-sdk-go/private/protocol/restjson", - "Comment": "v1.0.7-9-g4f9a300", - "Rev": "4f9a300f2af32035b3ae8bd0ce9b0fe8412df743" + "Comment": "v1.1.18-16-gb743ca2", + "Rev": "b743ca27e4b9237d7e2911d6dba2f039c4a3ad0f" }, { "ImportPath": "github.com/aws/aws-sdk-go/private/protocol/restxml", - "Comment": "v1.0.7-9-g4f9a300", - "Rev": "4f9a300f2af32035b3ae8bd0ce9b0fe8412df743" + "Comment": "v1.1.18-16-gb743ca2", + "Rev": "b743ca27e4b9237d7e2911d6dba2f039c4a3ad0f" }, { "ImportPath": "github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil", - "Comment": "v1.0.7-9-g4f9a300", - "Rev": "4f9a300f2af32035b3ae8bd0ce9b0fe8412df743" + "Comment": "v1.1.18-16-gb743ca2", + "Rev": "b743ca27e4b9237d7e2911d6dba2f039c4a3ad0f" }, { "ImportPath": "github.com/aws/aws-sdk-go/private/signer/v4", - "Comment": "v1.0.7-9-g4f9a300", - "Rev": "4f9a300f2af32035b3ae8bd0ce9b0fe8412df743" + "Comment": "v1.1.18-16-gb743ca2", + "Rev": "b743ca27e4b9237d7e2911d6dba2f039c4a3ad0f" + }, + { + "ImportPath": "github.com/aws/aws-sdk-go/private/util", + "Comment": "v1.1.18-16-gb743ca2", + "Rev": "b743ca27e4b9237d7e2911d6dba2f039c4a3ad0f" }, { "ImportPath": "github.com/aws/aws-sdk-go/private/waiter", - "Comment": "v1.0.7-9-g4f9a300", - "Rev": "4f9a300f2af32035b3ae8bd0ce9b0fe8412df743" + "Comment": "v1.1.18-16-gb743ca2", + "Rev": "b743ca27e4b9237d7e2911d6dba2f039c4a3ad0f" + }, + { + "ImportPath": "github.com/aws/aws-sdk-go/service/acm", + "Comment": "v1.1.18-16-gb743ca2", + "Rev": "b743ca27e4b9237d7e2911d6dba2f039c4a3ad0f" }, { "ImportPath": "github.com/aws/aws-sdk-go/service/autoscaling", - "Comment": "v1.0.7-9-g4f9a300", - "Rev": "4f9a300f2af32035b3ae8bd0ce9b0fe8412df743" + "Comment": "v1.1.18-16-gb743ca2", + "Rev": "b743ca27e4b9237d7e2911d6dba2f039c4a3ad0f" }, { "ImportPath": "github.com/aws/aws-sdk-go/service/cloudformation", - "Comment": "v1.0.7-9-g4f9a300", - "Rev": "4f9a300f2af32035b3ae8bd0ce9b0fe8412df743" + "Comment": "v1.1.18-16-gb743ca2", + "Rev": "b743ca27e4b9237d7e2911d6dba2f039c4a3ad0f" }, { "ImportPath": "github.com/aws/aws-sdk-go/service/cloudwatch", - "Comment": "v1.0.7-9-g4f9a300", - "Rev": "4f9a300f2af32035b3ae8bd0ce9b0fe8412df743" + "Comment": "v1.1.18-16-gb743ca2", + "Rev": "b743ca27e4b9237d7e2911d6dba2f039c4a3ad0f" }, { "ImportPath": "github.com/aws/aws-sdk-go/service/cloudwatchlogs", - "Comment": "v1.0.7-9-g4f9a300", - "Rev": "4f9a300f2af32035b3ae8bd0ce9b0fe8412df743" + "Comment": "v1.1.18-16-gb743ca2", + "Rev": "b743ca27e4b9237d7e2911d6dba2f039c4a3ad0f" }, { "ImportPath": "github.com/aws/aws-sdk-go/service/dynamodb", - "Comment": "v1.0.7-9-g4f9a300", - "Rev": "4f9a300f2af32035b3ae8bd0ce9b0fe8412df743" + "Comment": "v1.1.18-16-gb743ca2", + "Rev": "b743ca27e4b9237d7e2911d6dba2f039c4a3ad0f" + }, + { + "ImportPath": "github.com/aws/aws-sdk-go/service/dynamodb/dynamodbattribute", + "Comment": "v1.1.18-16-gb743ca2", + "Rev": "b743ca27e4b9237d7e2911d6dba2f039c4a3ad0f" }, { "ImportPath": "github.com/aws/aws-sdk-go/service/ec2", - "Comment": "v1.0.7-9-g4f9a300", - "Rev": "4f9a300f2af32035b3ae8bd0ce9b0fe8412df743" + "Comment": "v1.1.18-16-gb743ca2", + "Rev": "b743ca27e4b9237d7e2911d6dba2f039c4a3ad0f" }, { "ImportPath": "github.com/aws/aws-sdk-go/service/ecr", - "Comment": "v1.0.7-9-g4f9a300", - "Rev": "4f9a300f2af32035b3ae8bd0ce9b0fe8412df743" + "Comment": "v1.1.18-16-gb743ca2", + "Rev": "b743ca27e4b9237d7e2911d6dba2f039c4a3ad0f" }, { "ImportPath": "github.com/aws/aws-sdk-go/service/ecs", - "Comment": "v1.0.7-9-g4f9a300", - "Rev": "4f9a300f2af32035b3ae8bd0ce9b0fe8412df743" + "Comment": "v1.1.18-16-gb743ca2", + "Rev": "b743ca27e4b9237d7e2911d6dba2f039c4a3ad0f" }, { "ImportPath": "github.com/aws/aws-sdk-go/service/elb", - "Comment": "v1.0.7-9-g4f9a300", - "Rev": "4f9a300f2af32035b3ae8bd0ce9b0fe8412df743" + "Comment": "v1.1.18-16-gb743ca2", + "Rev": "b743ca27e4b9237d7e2911d6dba2f039c4a3ad0f" }, { "ImportPath": "github.com/aws/aws-sdk-go/service/iam", - "Comment": "v1.0.7-9-g4f9a300", - "Rev": "4f9a300f2af32035b3ae8bd0ce9b0fe8412df743" + "Comment": "v1.1.18-16-gb743ca2", + "Rev": "b743ca27e4b9237d7e2911d6dba2f039c4a3ad0f" }, { "ImportPath": "github.com/aws/aws-sdk-go/service/kinesis", - "Comment": "v1.0.7-9-g4f9a300", - "Rev": "4f9a300f2af32035b3ae8bd0ce9b0fe8412df743" + "Comment": "v1.1.18-16-gb743ca2", + "Rev": "b743ca27e4b9237d7e2911d6dba2f039c4a3ad0f" }, { "ImportPath": "github.com/aws/aws-sdk-go/service/kms", - "Comment": "v1.0.7-9-g4f9a300", - "Rev": "4f9a300f2af32035b3ae8bd0ce9b0fe8412df743" + "Comment": "v1.1.18-16-gb743ca2", + "Rev": "b743ca27e4b9237d7e2911d6dba2f039c4a3ad0f" }, { "ImportPath": "github.com/aws/aws-sdk-go/service/lambda", - "Comment": "v1.0.7-9-g4f9a300", - "Rev": "4f9a300f2af32035b3ae8bd0ce9b0fe8412df743" + "Comment": "v1.1.18-16-gb743ca2", + "Rev": "b743ca27e4b9237d7e2911d6dba2f039c4a3ad0f" }, { "ImportPath": "github.com/aws/aws-sdk-go/service/rds", - "Comment": "v1.0.7-9-g4f9a300", - "Rev": "4f9a300f2af32035b3ae8bd0ce9b0fe8412df743" + "Comment": "v1.1.18-16-gb743ca2", + "Rev": "b743ca27e4b9237d7e2911d6dba2f039c4a3ad0f" }, { "ImportPath": "github.com/aws/aws-sdk-go/service/s3", - "Comment": "v1.0.7-9-g4f9a300", - "Rev": "4f9a300f2af32035b3ae8bd0ce9b0fe8412df743" + "Comment": "v1.1.18-16-gb743ca2", + "Rev": "b743ca27e4b9237d7e2911d6dba2f039c4a3ad0f" }, { "ImportPath": "github.com/aws/aws-sdk-go/service/sns", - "Comment": "v1.0.7-9-g4f9a300", - "Rev": "4f9a300f2af32035b3ae8bd0ce9b0fe8412df743" + "Comment": "v1.1.18-16-gb743ca2", + "Rev": "b743ca27e4b9237d7e2911d6dba2f039c4a3ad0f" }, { "ImportPath": "github.com/aws/aws-sdk-go/service/sqs", - "Comment": "v1.0.7-9-g4f9a300", - "Rev": "4f9a300f2af32035b3ae8bd0ce9b0fe8412df743" + "Comment": "v1.1.18-16-gb743ca2", + "Rev": "b743ca27e4b9237d7e2911d6dba2f039c4a3ad0f" }, { "ImportPath": "github.com/briandowns/spinner", diff --git a/api/controllers/builds.go b/api/controllers/builds.go index 2544c309c7..beef0f5428 100644 --- a/api/controllers/builds.go +++ b/api/controllers/builds.go @@ -165,6 +165,16 @@ func BuildUpdate(rw http.ResponseWriter, r *http.Request) *httperr.Error { return httperr.Server(err) } + if b.Status == "failed" { + provider.EventSend(&structs.Event{ + Action: "build:create", + Data: map[string]string{ + "app": b.App, + "id": b.Id, + }, + }, fmt.Errorf(b.Reason)) + } + return RenderJson(rw, b) } diff --git a/api/controllers/certificates.go b/api/controllers/certificates.go new file mode 100644 index 0000000000..0bbab36ccb --- /dev/null +++ b/api/controllers/certificates.go @@ -0,0 +1,61 @@ +package controllers + +import ( + "net/http" + "sort" + "strings" + + "github.com/convox/rack/api/httperr" + "github.com/convox/rack/api/provider" + "github.com/gorilla/mux" +) + +func CertificateCreate(rw http.ResponseWriter, r *http.Request) *httperr.Error { + pub := r.FormValue("public") + key := r.FormValue("private") + chain := r.FormValue("chain") + + cert, err := provider.CertificateCreate(pub, key, chain) + + if err != nil { + return httperr.Server(err) + } + + return RenderJson(rw, cert) +} + +func CertificateDelete(rw http.ResponseWriter, r *http.Request) *httperr.Error { + id := mux.Vars(r)["id"] + + err := provider.CertificateDelete(id) + + if err != nil { + return httperr.Server(err) + } + + return RenderSuccess(rw) +} + +func CertificateGenerate(rw http.ResponseWriter, r *http.Request) *httperr.Error { + domains := strings.Split(r.FormValue("domains"), ",") + + cert, err := provider.CertificateGenerate(domains) + + if err != nil { + return httperr.Server(err) + } + + return RenderJson(rw, cert) +} + +func CertificateList(rw http.ResponseWriter, r *http.Request) *httperr.Error { + certs, err := provider.CertificateList() + + if err != nil { + return httperr.Server(err) + } + + sort.Sort(certs) + + return RenderJson(rw, certs) +} diff --git a/api/controllers/routes.go b/api/controllers/routes.go index 41a172f777..8fd415fe11 100644 --- a/api/controllers/routes.go +++ b/api/controllers/routes.go @@ -41,6 +41,10 @@ func NewRouter() (router *mux.Router) { router.HandleFunc("/apps/{app}/ssl", api("ssl.list", SSLList)).Methods("GET") router.HandleFunc("/apps/{app}/ssl/{process}/{port}", api("ssl.update", SSLUpdate)).Methods("PUT") router.HandleFunc("/auth", api("auth", Auth)).Methods("GET") + router.HandleFunc("/certificates", api("certificate.list", CertificateList)).Methods("GET") + router.HandleFunc("/certificates", api("certificate.create", CertificateCreate)).Methods("POST") + router.HandleFunc("/certificates/generate", api("certificate.generate", CertificateGenerate)).Methods("POST") + router.HandleFunc("/certificates/{id}", api("certificate.delete", CertificateDelete)).Methods("DELETE") router.HandleFunc("/index/diff", api("index.diff", IndexDiff)).Methods("POST") router.HandleFunc("/index/file/{hash}", api("index.upload", IndexUpload)).Methods("POST") router.HandleFunc("/instances", api("instances.get", InstancesList)).Methods("GET") diff --git a/api/controllers/ssl.go b/api/controllers/ssl.go index 6f97582d44..c977a030d6 100644 --- a/api/controllers/ssl.go +++ b/api/controllers/ssl.go @@ -3,7 +3,6 @@ package controllers import ( "net/http" "strconv" - "strings" "github.com/convox/rack/api/httperr" "github.com/convox/rack/api/models" @@ -31,10 +30,7 @@ func SSLUpdate(rw http.ResponseWriter, r *http.Request) *httperr.Error { a := vars["app"] process := vars["process"] port := vars["port"] - arn := GetForm(r, "arn") - chain := GetForm(r, "chain") - body := GetForm(r, "body") - key := GetForm(r, "key") + id := GetForm(r, "id") if process == "" { return httperr.Errorf(403, "must specify a process") @@ -46,11 +42,7 @@ func SSLUpdate(rw http.ResponseWriter, r *http.Request) *httperr.Error { return httperr.Errorf(403, "port must be numeric") } - if (arn != "") && !validateARNFormat(arn) { - return httperr.Errorf(403, "arn must follow the AWS ARN format") - } - - ssl, err := models.UpdateSSL(a, process, portn, arn, body, key, chain) + ssl, err := models.UpdateSSL(a, process, portn, id) if awsError(err) == "ValidationError" { return httperr.Errorf(404, "%s", err) @@ -62,7 +54,3 @@ func SSLUpdate(rw http.ResponseWriter, r *http.Request) *httperr.Error { return RenderJson(rw, ssl) } - -func validateARNFormat(arn string) bool { - return strings.HasPrefix(strings.ToLower(arn), "arn:") -} diff --git a/api/dist/kernel.json b/api/dist/kernel.json index 3d222a4c45..720bd7d323 100644 --- a/api/dist/kernel.json +++ b/api/dist/kernel.json @@ -874,9 +874,10 @@ "service docker restart", "mkdir -p /etc/convox", { "Fn::Join": [ "", [ "echo \"", { "Ref": "AWS::Region" }, "\" > /etc/convox/region" ] ] }, + { "Fn::Join": [ "", [ "echo \"", { "Ref": "ClientId" }, "\" > /etc/convox/client_id" ] ] }, { "Fn::Join": [ "", [ "echo \"", { "Ref": "Kinesis" }, "\" > /etc/convox/kinesis" ] ] }, { "Fn::Join": [ "", [ "echo \"", { "Ref": "LogGroup" }, "\" > /etc/convox/log_group" ] ] }, - "curl -s https://convox.s3.amazonaws.com/agent/0.67/convox.conf > /etc/init/convox.conf", + "curl -s https://convox.s3.amazonaws.com/agent/0.68/convox.conf > /etc/init/convox.conf", "start convox", { "Ref": "InstanceBootCommand" }, { "Fn::Join": [ " ", [ "/opt/aws/bin/cfn-init", "-s", { "Ref": "AWS::StackName" }, "-r", "Instances", "--region", {"Ref":"AWS::Region"} ] ] }, diff --git a/api/manifest.yml b/api/manifest.yml index 4fa9f3a361..b3768fdc24 100644 --- a/api/manifest.yml +++ b/api/manifest.yml @@ -612,6 +612,79 @@ paths: description: invalid password schema: type: string + /certificates: + get: + description: List certificates + responses: + 200: + description: certificate list + schema: + type: array + items: + $ref: '#/definitions/certificate' + post: + description: Upload a certificate + parameters: + - name: public + description: public key + type: string + in: formData + required: true + - name: private + description: private key + type: string + in: formData + required: true + - name: chain + description: intermediate chain + type: string + in: formData + required: false + responses: + 200: + description: certificate + schema: + $ref: '#/definitions/certificate' + 403: + description: invalid certificate + schema: + $ref: '#/definitions/error' + /certificates/generate: + post: + description: Request a certificate + parameters: + - name: domains + description: public key + type: array + items: + type: string + responses: + 200: + description: certificate + schema: + $ref: '#/definitions/certificate' + 403: + description: invalid domains + schema: + $ref: '#/definitions/error' + /certificates/{id}: + delete: + description: Remove a certificate + parameters: + - name: id + description: certificate id + type: string + in: path + required: true + responses: + 200: + description: success + schema: + $ref: '#/definitions/success' + 404: + description: not found + schema: + $ref: '#/definitions/error' /instances: get: description: List instances. @@ -825,6 +898,13 @@ definitions: type: integer process-width: type: integer + certificate: + domain: + type: string + expiration: + type: date + id: + type: string error: properties: error: @@ -915,6 +995,8 @@ definitions: type: string ssl: properties: + certificate: + type: string domain: type: string expiration: diff --git a/api/models/models.go b/api/models/models.go index 16cabc17e8..73499cf27c 100644 --- a/api/models/models.go +++ b/api/models/models.go @@ -11,6 +11,7 @@ import ( "github.com/aws/aws-sdk-go/aws/awserr" "github.com/aws/aws-sdk-go/aws/credentials" "github.com/aws/aws-sdk-go/aws/session" + "github.com/aws/aws-sdk-go/service/acm" "github.com/aws/aws-sdk-go/service/autoscaling" "github.com/aws/aws-sdk-go/service/cloudformation" "github.com/aws/aws-sdk-go/service/cloudwatch" @@ -58,6 +59,10 @@ func awsConfig() *aws.Config { return config } +func ACM() *acm.ACM { + return acm.New(session.New(), awsConfig()) +} + func AutoScaling() *autoscaling.AutoScaling { return autoscaling.New(session.New(), awsConfig()) } diff --git a/api/models/notify.go b/api/models/notify.go index 6d31f010fa..796a3a15b5 100644 --- a/api/models/notify.go +++ b/api/models/notify.go @@ -2,6 +2,7 @@ package models import ( "encoding/json" + "fmt" "os" "time" @@ -43,6 +44,8 @@ func Notify(name, status string, data map[string]string) error { return err } + fmt.Printf("models EventSend msg=%q\n", message) + params := &sns.PublishInput{ Message: aws.String(string(message)), // Required Subject: aws.String(name), diff --git a/api/models/release.go b/api/models/release.go index 90502f33fa..273cc2e59e 100644 --- a/api/models/release.go +++ b/api/models/release.go @@ -213,8 +213,7 @@ func (r *Release) Promote() error { switch app.Parameters[protoParam] { case "https", "tls": if app.Parameters[certParam] == "" { - timestamp := time.Now().Format("20060102150405") - name := fmt.Sprintf("%s%s%s-%s", UpperName(app.StackName()), UpperName(entry.Name), mapping.Balancer, timestamp) + name := fmt.Sprintf("cert-%d", time.Now().Unix()) body, key, err := GenerateSelfSignedCertificate("*.*.elb.amazonaws.com") diff --git a/api/models/ssl.go b/api/models/ssl.go index f0db428649..12bc2c956d 100644 --- a/api/models/ssl.go +++ b/api/models/ssl.go @@ -15,16 +15,18 @@ import ( "time" "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/service/acm" "github.com/aws/aws-sdk-go/service/cloudformation" "github.com/aws/aws-sdk-go/service/iam" ) type SSL struct { - Expiration time.Time `json:"expiration"` - Domain string `json:"domain"` - Process string `json:"process"` - Port int `json:"port"` - Secure bool `json:"secure"` + Certificate string `json:"certificate"` + Expiration time.Time `json:"expiration"` + Domain string `json:"domain"` + Process string `json:"process"` + Port int `json:"port"` + Secure bool `json:"secure"` } type SSLs []SSL @@ -54,33 +56,64 @@ func ListSSLs(a string) (SSLs, error) { return nil, err } - resp, err := IAM().GetServerCertificate(&iam.GetServerCertificateInput{ - ServerCertificateName: aws.String(certName(app.StackName(), matches[1], port)), - }) - - if err != nil { - return nil, err - } - - pemBlock, _ := pem.Decode([]byte(*resp.ServerCertificate.CertificateBody)) - c, err := x509.ParseCertificate(pemBlock.Bytes) - secure := app.Parameters[fmt.Sprintf("%sPort%sSecure", matches[1], matches[2])] == "Yes" - ssls = append(ssls, SSL{ - Domain: c.Subject.CommonName, - Expiration: *resp.ServerCertificate.ServerCertificateMetadata.Expiration, - Port: port, - Process: DashName(matches[1]), - Secure: secure, - }) + switch prefix := v[8:11]; prefix { + case "acm": + res, err := ACM().DescribeCertificate(&acm.DescribeCertificateInput{ + CertificateArn: aws.String(v), + }) + + if err != nil { + return nil, err + } + + parts := strings.Split(v, "-") + id := fmt.Sprintf("acm-%s", parts[len(parts)-1]) + + ssls = append(ssls, SSL{ + Certificate: id, + Domain: *res.Certificate.DomainName, + Expiration: *res.Certificate.NotAfter, + Port: port, + Process: DashName(matches[1]), + Secure: secure, + }) + case "iam": + res, err := IAM().GetServerCertificate(&iam.GetServerCertificateInput{ + ServerCertificateName: aws.String(certName(app.StackName(), matches[1], port)), + }) + + if err != nil { + return nil, err + } + + pemBlock, _ := pem.Decode([]byte(*res.ServerCertificate.CertificateBody)) + + c, err := x509.ParseCertificate(pemBlock.Bytes) + + if err != nil { + return nil, err + } + + ssls = append(ssls, SSL{ + Certificate: *res.ServerCertificate.ServerCertificateMetadata.ServerCertificateName, + Domain: c.Subject.CommonName, + Expiration: *res.ServerCertificate.ServerCertificateMetadata.Expiration, + Port: port, + Process: DashName(matches[1]), + Secure: secure, + }) + default: + return nil, fmt.Errorf("unknown arn prefix: %s", prefix) + } } } return ssls, nil } -func UpdateSSL(app, process string, port int, arn, body, key, chain string) (*SSL, error) { +func UpdateSSL(app, process string, port int, id string) (*SSL, error) { a, err := GetApp(app) if err != nil { @@ -92,29 +125,54 @@ func UpdateSSL(app, process string, port int, arn, body, key, chain string) (*SS return nil, fmt.Errorf("can not update app with status: %s", a.Status) } - // store old cert name - oldCertName := certName(app, process, port) - - // validate process exists - if oldCertName == "" { - return nil, fmt.Errorf("no certificate configured for %s port %d", process, port) - } - outputs := a.Outputs - balancer := outputs[fmt.Sprintf("%sPort%dBalancerName", UpperName(process), port)] if balancer == "" { - return nil, fmt.Errorf("Balancer ouptut not found. Please redeploy your app and try again.") + return nil, fmt.Errorf("Process and port combination unknown") } - if arn == "" { - // upload new cert - arn, err = uploadCert(a, process, port, body, key, chain) + arn := "" + + if strings.HasPrefix(id, "acm-") { + uuid := id[4:] + + res, err := ACM().ListCertificates(nil) if err != nil { return nil, err } + + for _, cert := range res.CertificateSummaryList { + parts := strings.Split(*cert.CertificateArn, "-") + + if parts[len(parts)-1] == uuid { + res, err := ACM().DescribeCertificate(&acm.DescribeCertificateInput{ + CertificateArn: cert.CertificateArn, + }) + + if err != nil { + return nil, err + } + + if *res.Certificate.Status == "PENDING_VALIDATION" { + return nil, fmt.Errorf("%s is still pending validation", id) + } + + arn = *cert.CertificateArn + break + } + } + } else { + res, err := IAM().GetServerCertificate(&iam.GetServerCertificateInput{ + ServerCertificateName: aws.String(id), + }) + + if err != nil { + return nil, err + } + + arn = *res.ServerCertificate.ServerCertificateMetadata.Arn } // update cloudformation @@ -125,7 +183,6 @@ func UpdateSSL(app, process string, port int, arn, body, key, chain string) (*SS } params := a.Parameters - params[fmt.Sprintf("%sPort%dCertificate", UpperName(process), port)] = arn for key, val := range params { diff --git a/api/provider/aws/aws.go b/api/provider/aws/aws.go index db92678ca9..9e7db4eeaf 100644 --- a/api/provider/aws/aws.go +++ b/api/provider/aws/aws.go @@ -7,12 +7,14 @@ import ( "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/credentials" "github.com/aws/aws-sdk-go/aws/session" + "github.com/aws/aws-sdk-go/service/acm" "github.com/aws/aws-sdk-go/service/cloudformation" "github.com/aws/aws-sdk-go/service/cloudwatchlogs" "github.com/aws/aws-sdk-go/service/dynamodb" "github.com/aws/aws-sdk-go/service/ec2" "github.com/aws/aws-sdk-go/service/ecr" "github.com/aws/aws-sdk-go/service/ecs" + "github.com/aws/aws-sdk-go/service/iam" "github.com/aws/aws-sdk-go/service/kinesis" "github.com/aws/aws-sdk-go/service/s3" "github.com/aws/aws-sdk-go/service/sns" @@ -64,6 +66,10 @@ func (p *AWSProvider) config() *aws.Config { return config } +func (p *AWSProvider) acm() *acm.ACM { + return acm.New(session.New(), p.config()) +} + func (p *AWSProvider) cloudformation() *cloudformation.CloudFormation { return cloudformation.New(session.New(), p.config()) } @@ -88,6 +94,10 @@ func (p *AWSProvider) ecs() *ecs.ECS { return ecs.New(session.New(), p.config()) } +func (p *AWSProvider) iam() *iam.IAM { + return iam.New(session.New(), p.config()) +} + func (p *AWSProvider) kinesis() *kinesis.Kinesis { return kinesis.New(session.New(), p.config()) } diff --git a/api/provider/aws/certificates.go b/api/provider/aws/certificates.go new file mode 100644 index 0000000000..c1a569697a --- /dev/null +++ b/api/provider/aws/certificates.go @@ -0,0 +1,281 @@ +package aws + +import ( + "bytes" + "crypto/x509" + "encoding/json" + "encoding/pem" + "fmt" + "io/ioutil" + "os" + "os/exec" + "strings" + "time" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/service/acm" + "github.com/aws/aws-sdk-go/service/iam" + "github.com/convox/rack/api/structs" +) + +func (p *AWSProvider) CertificateCreate(pub, key, chain string) (*structs.Certificate, error) { + end, _ := pem.Decode([]byte(pub)) + pub = string(pem.EncodeToMemory(end)) + + if chain == "" { + ch, err := resolveCertificateChain(pub) + + if err != nil { + return nil, err + } + + chain = ch + } + + c, err := x509.ParseCertificate(end.Bytes) + + if err != nil { + return nil, err + } + + req := &iam.UploadServerCertificateInput{ + CertificateBody: aws.String(pub), + PrivateKey: aws.String(key), + ServerCertificateName: aws.String(fmt.Sprintf("cert-%d", time.Now().Unix())), + } + + if chain != "" { + req.CertificateChain = aws.String(chain) + } + + res, err := p.iam().UploadServerCertificate(req) + + if err != nil { + return nil, err + } + + parts := strings.Split(*res.ServerCertificateMetadata.Arn, "/") + id := parts[len(parts)-1] + + cert := structs.Certificate{ + Id: id, + Domain: c.Subject.CommonName, + Expiration: *res.ServerCertificateMetadata.Expiration, + } + + return &cert, nil +} + +func (p *AWSProvider) CertificateDelete(id string) error { + _, err := p.iam().DeleteServerCertificate(&iam.DeleteServerCertificateInput{ + ServerCertificateName: aws.String(id), + }) + + return err +} + +func (p *AWSProvider) CertificateGenerate(domains []string) (*structs.Certificate, error) { + if len(domains) < 1 { + return nil, fmt.Errorf("must specify at least one domain") + } + + alts := []*string{} + + for _, domain := range domains[1:] { + alts = append(alts, aws.String(domain)) + } + + req := &acm.RequestCertificateInput{ + DomainName: aws.String(domains[0]), + } + + if len(alts) > 0 { + req.SubjectAlternativeNames = alts + } + + res, err := p.acm().RequestCertificate(req) + + if err != nil { + return nil, err + } + + parts := strings.Split(*res.CertificateArn, "-") + id := fmt.Sprintf("acm-%s", parts[len(parts)-1]) + + cert := structs.Certificate{ + Id: id, + Domain: domains[0], + } + + return &cert, nil +} + +func (p *AWSProvider) CertificateList() (structs.Certificates, error) { + res, err := p.iam().ListServerCertificates(nil) + + if err != nil { + return nil, err + } + + certs := structs.Certificates{} + + for _, cert := range res.ServerCertificateMetadataList { + res, err := p.iam().GetServerCertificate(&iam.GetServerCertificateInput{ + ServerCertificateName: cert.ServerCertificateName, + }) + + if err != nil { + return nil, err + } + + pem, _ := pem.Decode([]byte(*res.ServerCertificate.CertificateBody)) + + if err != nil { + return nil, err + } + + c, err := x509.ParseCertificate(pem.Bytes) + + if err != nil { + return nil, err + } + + certs = append(certs, structs.Certificate{ + Id: *cert.ServerCertificateName, + Domain: c.Subject.CommonName, + Expiration: *cert.Expiration, + }) + } + + ares, err := p.acm().ListCertificates(nil) + + if err != nil { + return nil, err + } + + for _, cert := range ares.CertificateSummaryList { + parts := strings.Split(*cert.CertificateArn, "-") + id := fmt.Sprintf("acm-%s", parts[len(parts)-1]) + + c := structs.Certificate{ + Id: id, + Domain: *cert.DomainName, + } + + res, err := p.acm().DescribeCertificate(&acm.DescribeCertificateInput{ + CertificateArn: cert.CertificateArn, + }) + + if err != nil { + return nil, err + } + + if res.Certificate.NotAfter != nil { + c.Expiration = *res.Certificate.NotAfter + } + + certs = append(certs, c) + } + + return certs, nil +} + +type CfsslCertificateBundle struct { + Bundle string `json:"bundle"` +} + +// use cfssl bundle to generate the certificate chain +// return the whole list minus the first one +func resolveCertificateChain(body string) (string, error) { + bl, _ := pem.Decode([]byte(body)) + crt, err := x509.ParseCertificate(bl.Bytes) + + if err != nil { + return "", err + } + + // return if this is a self-signed cert + // a cert is self-signed if the issuer and subject are the same + if string(crt.RawIssuer) == string(crt.RawSubject) { + return "", nil + } + + cmd := exec.Command("cfssl", "bundle", "-cert", "-") + + cmd.Stderr = os.Stderr + + stdin, err := cmd.StdinPipe() + + if err != nil { + return "", err + } + + stdout, err := cmd.StdoutPipe() + + if err != nil { + return "", err + } + + err = cmd.Start() + + if err != nil { + return "", err + } + + stdin.Write([]byte(body)) + stdin.Close() + + data, err := ioutil.ReadAll(stdout) + + if err != nil { + return "", err + } + + var bundle CfsslCertificateBundle + + err = json.Unmarshal(data, &bundle) + + if err != nil { + return "", err + } + + err = cmd.Wait() + + if err != nil { + return "", err + } + + certs := []*x509.Certificate{} + + raw := []byte(bundle.Bundle) + + for { + block, rest := pem.Decode(raw) + + if block == nil { + break + } + + raw = rest + + cert, err := x509.ParseCertificate(block.Bytes) + + if err != nil { + return "", nil + } + + certs = append(certs, cert) + } + + var buf bytes.Buffer + + for i := 1; i < len(certs); i++ { + err := pem.Encode(&buf, &pem.Block{Type: "CERTIFICATE", Bytes: certs[i].Raw}) + + if err != nil { + return "", err + } + } + + return buf.String(), nil +} diff --git a/api/provider/aws/event.go b/api/provider/aws/event.go index 310fe41994..e0c52daf3f 100644 --- a/api/provider/aws/event.go +++ b/api/provider/aws/event.go @@ -2,7 +2,9 @@ package aws import ( "encoding/json" + "fmt" "os" + "time" "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/service/sns" @@ -26,6 +28,7 @@ func (p *AWSProvider) EventSend(e *structs.Event, err error) error { log := logger.New("ns=kernel") e.Status = "success" + e.Timestamp = time.Now().UTC() if err != nil { e.Data["message"] = err.Error() @@ -38,6 +41,8 @@ func (p *AWSProvider) EventSend(e *structs.Event, err error) error { return err } + fmt.Printf("aws EventSend msg=%q\n", msg) + // Publish Event to SNS resp, err := p.sns().Publish(&sns.PublishInput{ Message: aws.String(string(msg)), // Required diff --git a/api/provider/provider.go b/api/provider/provider.go index e151407a17..5c0fa8ae57 100644 --- a/api/provider/provider.go +++ b/api/provider/provider.go @@ -26,6 +26,11 @@ type Provider interface { CapacityGet() (*structs.Capacity, error) + CertificateCreate(pub, key, chain string) (*structs.Certificate, error) + CertificateDelete(id string) error + CertificateGenerate(domains []string) (*structs.Certificate, error) + CertificateList() (structs.Certificates, error) + EventSend(*structs.Event, error) error IndexDiff(*structs.Index) ([]string, error) @@ -115,6 +120,22 @@ func CapacityGet() (*structs.Capacity, error) { return CurrentProvider.CapacityGet() } +func CertificateCreate(pub, key, chain string) (*structs.Certificate, error) { + return CurrentProvider.CertificateCreate(pub, key, chain) +} + +func CertificateDelete(id string) error { + return CurrentProvider.CertificateDelete(id) +} + +func CertificateGenerate(domains []string) (*structs.Certificate, error) { + return CurrentProvider.CertificateGenerate(domains) +} + +func CertificateList() (structs.Certificates, error) { + return CurrentProvider.CertificateList() +} + func EventSend(e *structs.Event, err error) error { return CurrentProvider.EventSend(e, err) } diff --git a/api/provider/test.go b/api/provider/test.go index 59a71b6e31..cc1ff1d712 100644 --- a/api/provider/test.go +++ b/api/provider/test.go @@ -11,14 +11,16 @@ var TestProvider = &TestProviderRunner{} type TestProviderRunner struct { mock.Mock - App structs.App - Build structs.Build - Builds structs.Builds - Capacity structs.Capacity - Instances structs.Instances - Release structs.Release - Releases structs.Releases - Service structs.Service + App structs.App + Build structs.Build + Builds structs.Builds + Capacity structs.Capacity + Certificate structs.Certificate + Certificates structs.Certificates + Instances structs.Instances + Release structs.Release + Releases structs.Releases + Service structs.Service } func (p *TestProviderRunner) AppGet(name string) (*structs.App, error) { @@ -76,6 +78,26 @@ func (p *TestProviderRunner) CapacityGet() (*structs.Capacity, error) { return &p.Capacity, nil } +func (p *TestProviderRunner) CertificateCreate(pub, key, chain string) (*structs.Certificate, error) { + p.Called(pub, key, chain) + return &p.Certificate, nil +} + +func (p *TestProviderRunner) CertificateDelete(id string) error { + p.Called(id) + return nil +} + +func (p *TestProviderRunner) CertificateGenerate(domains []string) (*structs.Certificate, error) { + p.Called(domains) + return &p.Certificate, nil +} + +func (p *TestProviderRunner) CertificateList() (structs.Certificates, error) { + p.Called() + return p.Certificates, nil +} + func (p *TestProviderRunner) EventSend(e *structs.Event, err error) error { p.Called(e, err) return nil diff --git a/api/structs/certificate.go b/api/structs/certificate.go new file mode 100644 index 0000000000..a5d5aaa80d --- /dev/null +++ b/api/structs/certificate.go @@ -0,0 +1,18 @@ +package structs + +import ( + "strings" + "time" +) + +type Certificate struct { + Id string `json:"id"` + Domain string `json:"domain"` + Expiration time.Time `json:"expiration"` +} + +type Certificates []Certificate + +func (c Certificates) Len() int { return len(c) } +func (c Certificates) Less(i, j int) bool { return strings.ToUpper(c[i].Id) < strings.ToUpper(c[j].Id) } +func (c Certificates) Swap(i, j int) { c[i], c[j] = c[j], c[i] } diff --git a/client/certificates.go b/client/certificates.go new file mode 100644 index 0000000000..d99df64acf --- /dev/null +++ b/client/certificates.go @@ -0,0 +1,65 @@ +package client + +import ( + "fmt" + "strings" + "time" +) + +type Certificate struct { + Id string `json:"id"` + Domain string `json:"domain"` + Expiration time.Time `json:"expiration"` +} + +type Certificates []Certificate + +func (c *Client) CreateCertificate(pub, key, chain string) (*Certificate, error) { + var cert Certificate + + params := Params{ + "public": pub, + "private": key, + "chain": chain, + } + + err := c.Post("/certificates", params, &cert) + + if err != nil { + return nil, err + } + + return &cert, nil +} + +func (c *Client) DeleteCertificate(id string) error { + return c.Delete(fmt.Sprintf("/certificates/%s", id), nil) +} + +func (c *Client) GenerateCertificate(domains []string) (*Certificate, error) { + var cert Certificate + + params := Params{ + "domains": strings.Join(domains, ","), + } + + err := c.Post("/certificates/generate", params, &cert) + + if err != nil { + return nil, err + } + + return &cert, nil +} + +func (c *Client) ListCertificates() (Certificates, error) { + var certs Certificates + + err := c.Get("/certificates", &certs) + + if err != nil { + return nil, err + } + + return certs, nil +} diff --git a/client/client.go b/client/client.go index 56a10708c8..ae1150cbdf 100644 --- a/client/client.go +++ b/client/client.go @@ -266,16 +266,18 @@ func (c *Client) DeleteResponse(path string, out interface{}) (*http.Response, e return nil, err } - data, err := ioutil.ReadAll(res.Body) + if out != nil { + data, err := ioutil.ReadAll(res.Body) - if err != nil { - return nil, err - } + if err != nil { + return nil, err + } - err = json.Unmarshal(data, out) + err = json.Unmarshal(data, out) - if err != nil { - return nil, err + if err != nil { + return nil, err + } } return res, nil diff --git a/client/ssl.go b/client/ssl.go index e7d8bd6452..6b4f05ac7f 100644 --- a/client/ssl.go +++ b/client/ssl.go @@ -6,11 +6,12 @@ import ( ) type SSL struct { - Domain string `json:"domain"` - Expiration time.Time `json:"expiration"` - Port int `json:"port"` - Process string `json:"process"` - Secure bool `json:"secure"` + Certificate string `json:"certificate"` + Domain string `json:"domain"` + Expiration time.Time `json:"expiration"` + Port int `json:"port"` + Process string `json:"process"` + Secure bool `json:"secure"` } type SSLs []SSL @@ -27,12 +28,9 @@ func (c *Client) ListSSL(app string) (*SSLs, error) { return &ssls, nil } -func (c *Client) UpdateSSL(app, process, port, arn, body, key, chain string) (*SSL, error) { +func (c *Client) UpdateSSL(app, process, port, id string) (*SSL, error) { params := Params{ - "arn": arn, - "body": body, - "chain": chain, - "key": key, + "id": id, } var ssl SSL diff --git a/cmd/convox/certs.go b/cmd/convox/certs.go new file mode 100644 index 0000000000..615d26a09d --- /dev/null +++ b/cmd/convox/certs.go @@ -0,0 +1,141 @@ +package main + +import ( + "fmt" + "io/ioutil" + + "github.com/codegangsta/cli" + "github.com/convox/rack/cmd/convox/stdcli" +) + +func init() { + stdcli.RegisterCommand(cli.Command{ + Name: "certs", + Action: cmdCertsList, + Description: "list certificates", + Subcommands: []cli.Command{ + { + Name: "create", + Description: "upload a certificate", + Usage: " ", + Action: cmdCertsCreate, + Flags: []cli.Flag{ + cli.StringFlag{ + Name: "chain", + Usage: "intermediate certificate chain", + }, + }, + }, + { + Name: "delete", + Description: "delete a certificate", + Usage: "", + Action: cmdCertsDelete, + }, + { + Name: "generate", + Description: "generate a certificate", + Usage: " [domain...]", + Action: cmdCertsGenerate, + }, + }, + }) +} + +func cmdCertsList(c *cli.Context) { + certs, err := rackClient(c).ListCertificates() + + if err != nil { + stdcli.Error(err) + return + } + + t := stdcli.NewTable("ID", "DOMAIN", "EXPIRES") + + for _, cert := range certs { + t.AddRow(cert.Id, cert.Domain, humanizeTime(cert.Expiration)) + } + + t.Print() +} + +func cmdCertsCreate(c *cli.Context) { + if len(c.Args()) < 2 { + stdcli.Usage(c, "create") + return + } + + pub, err := ioutil.ReadFile(c.Args()[0]) + + if err != nil { + stdcli.Error(err) + return + } + + key, err := ioutil.ReadFile(c.Args()[1]) + + if err != nil { + stdcli.Error(err) + return + } + + chain := "" + + if chainFile := c.String("chain"); chainFile != "" { + data, err := ioutil.ReadFile(chainFile) + + if err != nil { + stdcli.Error(err) + return + } + + chain = string(data) + } + + fmt.Printf("Uploading certificate... ") + + cert, err := rackClient(c).CreateCertificate(string(pub), string(key), chain) + + if err != nil { + stdcli.Error(err) + return + } + + fmt.Printf("OK, %s\n", cert.Id) +} + +func cmdCertsDelete(c *cli.Context) { + if len(c.Args()) < 1 { + stdcli.Usage(c, "delete") + return + } + + fmt.Printf("Removing certificate... ") + + err := rackClient(c).DeleteCertificate(c.Args()[0]) + + if err != nil { + stdcli.Error(err) + return + } + + fmt.Println("OK") +} + +func cmdCertsGenerate(c *cli.Context) { + if len(c.Args()) < 1 { + stdcli.Usage(c, "generate") + return + } + + fmt.Printf("Requesting certificate... ") + + cert, err := rackClient(c).GenerateCertificate(c.Args()) + + if err != nil { + stdcli.Error(err) + return + } + + fmt.Printf("OK, %s\n", cert.Id) +} diff --git a/cmd/convox/ssl.go b/cmd/convox/ssl.go index 75501f1821..6a672a191a 100644 --- a/cmd/convox/ssl.go +++ b/cmd/convox/ssl.go @@ -1,16 +1,8 @@ package main import ( - "crypto/rand" - "crypto/rsa" - "crypto/x509" - "crypto/x509/pkix" - "encoding/pem" "fmt" - "io/ioutil" - "math/big" "strings" - "time" "github.com/codegangsta/cli" "github.com/convox/rack/cmd/convox/stdcli" @@ -28,7 +20,7 @@ func init() { { Name: "update", Description: "upload a replacement ssl certificate", - Usage: " [ |]", + Usage: " ", Action: cmdSSLUpdate, Flags: []cli.Flag{ appFlag, @@ -57,10 +49,10 @@ func cmdSSLList(c *cli.Context) { return } - t := stdcli.NewTable("TARGET", "EXPIRES", "DOMAIN") + t := stdcli.NewTable("TARGET", "CERTIFICATE", "DOMAIN", "EXPIRES") for _, ssl := range *ssls { - t.AddRow(fmt.Sprintf("%s:%d", ssl.Process, ssl.Port), humanizeTime(ssl.Expiration), ssl.Domain) + t.AddRow(fmt.Sprintf("%s:%d", ssl.Process, ssl.Port), ssl.Certificate, ssl.Domain, humanizeTime(ssl.Expiration)) } t.Print() @@ -74,8 +66,8 @@ func cmdSSLUpdate(c *cli.Context) { return } - if len(c.Args()) < 1 { - stdcli.Usage(c, "create") + if len(c.Args()) < 2 { + stdcli.Usage(c, "update") return } @@ -88,92 +80,14 @@ func cmdSSLUpdate(c *cli.Context) { return } - var pub []byte - var key []byte - var arn string - - switch len(c.Args()) { - case 2: - arn = c.Args()[1] - case 3: - pub, err = ioutil.ReadFile(c.Args()[1]) - - if err != nil { - stdcli.Error(err) - return - } - - key, err = ioutil.ReadFile(c.Args()[2]) - - if err != nil { - stdcli.Error(err) - return - } - default: - stdcli.Usage(c, "update") - return - } - - chain := "" - - if chainFile := c.String("chain"); chainFile != "" { - data, err := ioutil.ReadFile(chainFile) - - if err != nil { - stdcli.Error(err) - return - } - - chain = string(data) - } - - fmt.Printf("Updating SSL listener %s... ", target) + fmt.Printf("Updating certificate... ") - _, err = rackClient(c).UpdateSSL(app, parts[0], parts[1], arn, string(pub), string(key), chain) + _, err = rackClient(c).UpdateSSL(app, parts[0], parts[1], c.Args()[1]) if err != nil { stdcli.Error(err) return } - fmt.Println("Done.") -} - -func generateSelfSignedCertificate(app, host string) ([]byte, []byte, error) { - rkey, err := rsa.GenerateKey(rand.Reader, 2048) - - if err != nil { - return nil, nil, err - } - - serial, err := rand.Int(rand.Reader, new(big.Int).Lsh(big.NewInt(1), 128)) - - if err != nil { - return nil, nil, err - } - - template := x509.Certificate{ - SerialNumber: serial, - Subject: pkix.Name{ - CommonName: host, - Organization: []string{app}, - }, - NotBefore: time.Now(), - NotAfter: time.Now().Add(365 * 24 * time.Hour), - KeyUsage: x509.KeyUsageKeyEncipherment | x509.KeyUsageDigitalSignature, - ExtKeyUsage: []x509.ExtKeyUsage{x509.ExtKeyUsageServerAuth}, - BasicConstraintsValid: true, - DNSNames: []string{host}, - } - - data, err := x509.CreateCertificate(rand.Reader, &template, &template, &rkey.PublicKey, rkey) - - if err != nil { - return nil, nil, err - } - - pub := pem.EncodeToMemory(&pem.Block{Type: "CERTIFICATE", Bytes: data}) - key := pem.EncodeToMemory(&pem.Block{Type: "RSA PRIVATE KEY", Bytes: x509.MarshalPKCS1PrivateKey(rkey)}) - - return pub, key, nil + fmt.Println("OK") } diff --git a/vendor/github.com/aws/aws-sdk-go/aws/awserr/error.go b/vendor/github.com/aws/aws-sdk-go/aws/awserr/error.go index a52743bef1..e50771f803 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/awserr/error.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/awserr/error.go @@ -14,13 +14,13 @@ package awserr // if err != nil { // if awsErr, ok := err.(awserr.Error); ok { // // Get error details -// log.Println("Error:", err.Code(), err.Message()) +// log.Println("Error:", awsErr.Code(), awsErr.Message()) // // // Prints out full error message, including original error if there was one. -// log.Println("Error:", err.Error()) +// log.Println("Error:", awsErr.Error()) // // // Get original error -// if origErr := err.Err(); origErr != nil { +// if origErr := awsErr.OrigErr(); origErr != nil { // // operate on original error. // } // } else { @@ -42,15 +42,55 @@ type Error interface { OrigErr() error } +// BatchError is a batch of errors which also wraps lower level errors with +// code, message, and original errors. Calling Error() will include all errors +// that occured in the batch. +// +// Deprecated: Replaced with BatchedErrors. Only defined for backwards +// compatibility. +type BatchError interface { + // Satisfy the generic error interface. + error + + // Returns the short phrase depicting the classification of the error. + Code() string + + // Returns the error details message. + Message() string + + // Returns the original error if one was set. Nil is returned if not set. + OrigErrs() []error +} + +// BatchedErrors is a batch of errors which also wraps lower level errors with +// code, message, and original errors. Calling Error() will include all errors +// that occured in the batch. +// +// Replaces BatchError +type BatchedErrors interface { + // Satisfy the base Error interface. + Error + + // Returns the original error if one was set. Nil is returned if not set. + OrigErrs() []error +} + // New returns an Error object described by the code, message, and origErr. // // If origErr satisfies the Error interface it will not be wrapped within a new // Error object and will instead be returned. func New(code, message string, origErr error) Error { - if e, ok := origErr.(Error); ok && e != nil { - return e + var errs []error + if origErr != nil { + errs = append(errs, origErr) } - return newBaseError(code, message, origErr) + return newBaseError(code, message, errs) +} + +// NewBatchError returns an BatchedErrors with a collection of errors as an +// array of errors. +func NewBatchError(code, message string, errs []error) BatchedErrors { + return newBaseError(code, message, errs) } // A RequestFailure is an interface to extract request failure information from @@ -63,9 +103,9 @@ func New(code, message string, origErr error) Error { // output, err := s3manage.Upload(svc, input, opts) // if err != nil { // if reqerr, ok := err.(RequestFailure); ok { -// log.Printf("Request failed", reqerr.Code(), reqerr.Message(), reqerr.RequestID()) +// log.Println("Request failed", reqerr.Code(), reqerr.Message(), reqerr.RequestID()) // } else { -// log.Printf("Error:", err.Error() +// log.Println("Error:", err.Error()) // } // } // diff --git a/vendor/github.com/aws/aws-sdk-go/aws/awserr/types.go b/vendor/github.com/aws/aws-sdk-go/aws/awserr/types.go index 003a6e8067..e2d333b84b 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/awserr/types.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/awserr/types.go @@ -31,23 +31,27 @@ type baseError struct { // Optional original error this error is based off of. Allows building // chained errors. - origErr error + errs []error } -// newBaseError returns an error object for the code, message, and err. +// newBaseError returns an error object for the code, message, and errors. // // code is a short no whitespace phrase depicting the classification of // the error that is being created. // -// message is the free flow string containing detailed information about the error. +// message is the free flow string containing detailed information about the +// error. // -// origErr is the error object which will be nested under the new error to be returned. -func newBaseError(code, message string, origErr error) *baseError { - return &baseError{ +// origErrs is the error objects which will be nested under the new errors to +// be returned. +func newBaseError(code, message string, origErrs []error) *baseError { + b := &baseError{ code: code, message: message, - origErr: origErr, + errs: origErrs, } + + return b } // Error returns the string representation of the error. @@ -56,7 +60,12 @@ func newBaseError(code, message string, origErr error) *baseError { // // Satisfies the error interface. func (b baseError) Error() string { - return SprintError(b.code, b.message, "", b.origErr) + size := len(b.errs) + if size > 0 { + return SprintError(b.code, b.message, "", errorList(b.errs)) + } + + return SprintError(b.code, b.message, "", nil) } // String returns the string representation of the error. @@ -75,10 +84,28 @@ func (b baseError) Message() string { return b.message } -// OrigErr returns the original error if one was set. Nil is returned if no error -// was set. +// OrigErr returns the original error if one was set. Nil is returned if no +// error was set. This only returns the first element in the list. If the full +// list is needed, use BatchedErrors. func (b baseError) OrigErr() error { - return b.origErr + switch len(b.errs) { + case 0: + return nil + case 1: + return b.errs[0] + default: + if err, ok := b.errs[0].(Error); ok { + return NewBatchError(err.Code(), err.Message(), b.errs[1:]) + } + return NewBatchError("BatchedErrors", + "multiple errors occured", b.errs) + } +} + +// OrigErrs returns the original errors if one was set. An empty slice is +// returned if no error was set. +func (b baseError) OrigErrs() []error { + return b.errs } // So that the Error interface type can be included as an anonymous field @@ -94,8 +121,8 @@ type requestError struct { requestID string } -// newRequestError returns a wrapped error with additional information for request -// status code, and service requestID. +// newRequestError returns a wrapped error with additional information for +// request status code, and service requestID. // // Should be used to wrap all request which involve service requests. Even if // the request failed without a service response, but had an HTTP status code @@ -133,3 +160,35 @@ func (r requestError) StatusCode() int { func (r requestError) RequestID() string { return r.requestID } + +// OrigErrs returns the original errors if one was set. An empty slice is +// returned if no error was set. +func (r requestError) OrigErrs() []error { + if b, ok := r.awsError.(BatchedErrors); ok { + return b.OrigErrs() + } + return []error{r.OrigErr()} +} + +// An error list that satisfies the golang interface +type errorList []error + +// Error returns the string representation of the error. +// +// Satisfies the error interface. +func (e errorList) Error() string { + msg := "" + // How do we want to handle the array size being zero + if size := len(e); size > 0 { + for i := 0; i < size; i++ { + msg += fmt.Sprintf("%s", e[i].Error()) + // We check the next index to see if it is within the slice. + // If it is, then we append a newline. We do this, because unit tests + // could be broken with the additional '\n' + if i+1 < size { + msg += "\n" + } + } + } + return msg +} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/awsutil/prettify.go b/vendor/github.com/aws/aws-sdk-go/aws/awsutil/prettify.go index 0de3eaa0f6..fc38172fec 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/awsutil/prettify.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/awsutil/prettify.go @@ -91,6 +91,10 @@ func prettify(v reflect.Value, indent int, buf *bytes.Buffer) { buf.WriteString("\n" + strings.Repeat(" ", indent) + "}") default: + if !v.IsValid() { + fmt.Fprint(buf, "") + return + } format := "%v" switch v.Interface().(type) { case string: diff --git a/vendor/github.com/aws/aws-sdk-go/aws/client/default_retryer.go b/vendor/github.com/aws/aws-sdk-go/aws/client/default_retryer.go index 24d39ce564..f664caf094 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/client/default_retryer.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/client/default_retryer.go @@ -1,7 +1,6 @@ package client import ( - "math" "math/rand" "time" @@ -32,14 +31,38 @@ func (d DefaultRetryer) MaxRetries() int { // RetryRules returns the delay duration before retrying this request again func (d DefaultRetryer) RetryRules(r *request.Request) time.Duration { - delay := int(math.Pow(2, float64(r.RetryCount))) * (rand.Intn(30) + 30) + // Set the upper limit of delay in retrying at ~five minutes + minTime := 30 + throttle := d.shouldThrottle(r) + if throttle { + minTime = 1000 + } + + retryCount := r.RetryCount + if retryCount > 13 { + retryCount = 13 + } else if throttle && retryCount > 8 { + retryCount = 8 + } + + delay := (1 << uint(retryCount)) * (rand.Intn(30) + minTime) return time.Duration(delay) * time.Millisecond } -// ShouldRetry returns if the request should be retried. +// ShouldRetry returns true if the request should be retried. func (d DefaultRetryer) ShouldRetry(r *request.Request) bool { if r.HTTPResponse.StatusCode >= 500 { return true } - return r.IsErrorRetryable() + return r.IsErrorRetryable() || d.shouldThrottle(r) +} + +// ShouldThrottle returns true if the request should be throttled. +func (d DefaultRetryer) shouldThrottle(r *request.Request) bool { + if r.HTTPResponse.StatusCode == 502 || + r.HTTPResponse.StatusCode == 503 || + r.HTTPResponse.StatusCode == 504 { + return true + } + return r.IsErrorThrottle() } diff --git a/vendor/github.com/aws/aws-sdk-go/aws/config.go b/vendor/github.com/aws/aws-sdk-go/aws/config.go index 75fcc8284b..ade3ebfc0b 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/config.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/config.go @@ -18,6 +18,11 @@ type RequestRetryer interface{} // A Config provides service configuration for service clients. By default, // all clients will use the {defaults.DefaultConfig} structure. type Config struct { + // Enables verbose error printing of all credential chain errors. + // Should be used when wanting to see all errors while attempting to retreive + // credentials. + CredentialsChainVerboseErrors *bool + // The credentials object to use when signing requests. Defaults to // a chain of credential providers to search for credentials in environment // variables, shared credential file, and EC2 Instance Roles. @@ -95,6 +100,36 @@ type Config struct { // Amazon S3: Virtual Hosting of Buckets S3ForcePathStyle *bool + // Set this to `true` to disable the SDK adding the `Expect: 100-Continue` + // header to PUT requests over 2MB of content. 100-Continue instructs the + // HTTP client not to send the body until the service responds with a + // `continue` status. This is useful to prevent sending the request body + // until after the request is authenticated, and validated. + // + // http://docs.aws.amazon.com/AmazonS3/latest/API/RESTObjectPUT.html + // + // 100-Continue is only enabled for Go 1.6 and above. See `http.Transport`'s + // `ExpectContinueTimeout` for information on adjusting the continue wait timeout. + // https://golang.org/pkg/net/http/#Transport + // + // You should use this flag to disble 100-Continue if you experiance issues + // with proxies or thrid party S3 compatible services. + S3Disable100Continue *bool + + // Set this to `true` to disable the EC2Metadata client from overriding the + // default http.Client's Timeout. This is helpful if you do not want the EC2Metadata + // client to create a new http.Client. This options is only meaningful if you're not + // already using a custom HTTP client with the SDK. Enabled by default. + // + // Must be set and provided to the session.New() in order to disable the EC2Metadata + // overriding the timeout for default credentials chain. + // + // Example: + // sess := session.New(aws.NewConfig().WithEC2MetadataDiableTimeoutOverride(true)) + // svc := s3.New(sess) + // + EC2MetadataDisableTimeoutOverride *bool + SleepDelay func(time.Duration) } @@ -107,6 +142,13 @@ func NewConfig() *Config { return &Config{} } +// WithCredentialsChainVerboseErrors sets a config verbose errors boolean and returning +// a Config pointer. +func (c *Config) WithCredentialsChainVerboseErrors(verboseErrs bool) *Config { + c.CredentialsChainVerboseErrors = &verboseErrs + return c +} + // WithCredentials sets a config Credentials value returning a Config pointer // for chaining. func (c *Config) WithCredentials(creds *credentials.Credentials) *Config { @@ -184,6 +226,20 @@ func (c *Config) WithS3ForcePathStyle(force bool) *Config { return c } +// WithS3Disable100Continue sets a config S3Disable100Continue value returning +// a Config pointer for chaining. +func (c *Config) WithS3Disable100Continue(disable bool) *Config { + c.S3Disable100Continue = &disable + return c +} + +// WithEC2MetadataDisableTimeoutOverride sets a config EC2MetadataDisableTimeoutOverride value +// returning a Config pointer for chaining. +func (c *Config) WithEC2MetadataDisableTimeoutOverride(enable bool) *Config { + c.EC2MetadataDisableTimeoutOverride = &enable + return c +} + // WithSleepDelay overrides the function used to sleep while waiting for the // next retry. Defaults to time.Sleep. func (c *Config) WithSleepDelay(fn func(time.Duration)) *Config { @@ -203,6 +259,10 @@ func mergeInConfig(dst *Config, other *Config) { return } + if other.CredentialsChainVerboseErrors != nil { + dst.CredentialsChainVerboseErrors = other.CredentialsChainVerboseErrors + } + if other.Credentials != nil { dst.Credentials = other.Credentials } @@ -251,6 +311,14 @@ func mergeInConfig(dst *Config, other *Config) { dst.S3ForcePathStyle = other.S3ForcePathStyle } + if other.S3Disable100Continue != nil { + dst.S3Disable100Continue = other.S3Disable100Continue + } + + if other.EC2MetadataDisableTimeoutOverride != nil { + dst.EC2MetadataDisableTimeoutOverride = other.EC2MetadataDisableTimeoutOverride + } + if other.SleepDelay != nil { dst.SleepDelay = other.SleepDelay } diff --git a/vendor/github.com/aws/aws-sdk-go/aws/corehandlers/handlers.go b/vendor/github.com/aws/aws-sdk-go/aws/corehandlers/handlers.go index 1d3e656fd6..a054d39346 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/corehandlers/handlers.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/corehandlers/handlers.go @@ -64,6 +64,11 @@ var SendHandler = request.NamedHandler{Name: "core.SendHandler", Fn: func(r *req var err error r.HTTPResponse, err = r.Config.HTTPClient.Do(r.HTTPRequest) if err != nil { + // Prevent leaking if an HTTPResponse was returned. Clean up + // the body. + if r.HTTPResponse != nil { + r.HTTPResponse.Body.Close() + } // Capture the case where url.Error is returned for error processing // response. e.g. 301 without location header comes back as string // error and r.HTTPResponse is nil. Other url redirect errors will diff --git a/vendor/github.com/aws/aws-sdk-go/aws/corehandlers/param_validator.go b/vendor/github.com/aws/aws-sdk-go/aws/corehandlers/param_validator.go index 3b53f5e026..ea07580a9a 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/corehandlers/param_validator.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/corehandlers/param_validator.go @@ -30,6 +30,11 @@ type validator struct { errors []string } +// There's no validation to be done on the contents of []byte values. Prepare +// to check validateAny arguments against that type so we can quickly skip +// them. +var byteSliceType = reflect.TypeOf([]byte(nil)) + // validateAny will validate any struct, slice or map type. All validations // are also performed recursively for nested types. func (v *validator) validateAny(value reflect.Value, path string) { @@ -42,6 +47,10 @@ func (v *validator) validateAny(value reflect.Value, path string) { case reflect.Struct: v.validateStruct(value, path) case reflect.Slice: + if value.Type() == byteSliceType { + // We don't need to validate the contents of []byte. + return + } for i := 0; i < value.Len(); i++ { v.validateAny(value.Index(i), path+fmt.Sprintf("[%d]", i)) } diff --git a/vendor/github.com/aws/aws-sdk-go/aws/credentials/chain_provider.go b/vendor/github.com/aws/aws-sdk-go/aws/credentials/chain_provider.go index 115b40739a..857311f64c 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/credentials/chain_provider.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/credentials/chain_provider.go @@ -8,8 +8,14 @@ var ( // ErrNoValidProvidersFoundInChain Is returned when there are no valid // providers in the ChainProvider. // + // This has been deprecated. For verbose error messaging set + // aws.Config.CredentialsChainVerboseErrors to true + // // @readonly - ErrNoValidProvidersFoundInChain = awserr.New("NoCredentialProviders", "no valid providers in chain", nil) + ErrNoValidProvidersFoundInChain = awserr.New("NoCredentialProviders", + `no valid providers in chain. Deprecated. + For verbose messaging see aws.Config.CredentialsChainVerboseErrors`, + nil) ) // A ChainProvider will search for a provider which returns credentials @@ -45,8 +51,9 @@ var ( // svc := ec2.New(&aws.Config{Credentials: creds}) // type ChainProvider struct { - Providers []Provider - curr Provider + Providers []Provider + curr Provider + VerboseErrors bool } // NewChainCredentials returns a pointer to a new Credentials object @@ -63,17 +70,23 @@ func NewChainCredentials(providers []Provider) *Credentials { // If a provider is found it will be cached and any calls to IsExpired() // will return the expired state of the cached provider. func (c *ChainProvider) Retrieve() (Value, error) { + var errs []error for _, p := range c.Providers { - if creds, err := p.Retrieve(); err == nil { + creds, err := p.Retrieve() + if err == nil { c.curr = p return creds, nil } + errs = append(errs, err) } c.curr = nil - // TODO better error reporting. maybe report error for each failed retrieve? - - return Value{}, ErrNoValidProvidersFoundInChain + var err error + err = ErrNoValidProvidersFoundInChain + if c.VerboseErrors { + err = awserr.NewBatchError("NoCredentialProviders", "no valid providers in chain", errs) + } + return Value{}, err } // IsExpired will returned the expired state of the currently cached provider diff --git a/vendor/github.com/aws/aws-sdk-go/aws/credentials/credentials.go b/vendor/github.com/aws/aws-sdk-go/aws/credentials/credentials.go index 5dd71f02e8..7b8ebf5f9d 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/credentials/credentials.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/credentials/credentials.go @@ -76,6 +76,9 @@ type Value struct { // AWS Session Token SessionToken string + + // Provider used to get credentials + ProviderName string } // A Provider is the interface for any component which will provide credentials diff --git a/vendor/github.com/aws/aws-sdk-go/aws/credentials/ec2rolecreds/ec2_role_provider.go b/vendor/github.com/aws/aws-sdk-go/aws/credentials/ec2rolecreds/ec2_role_provider.go index 04c8921a0e..aa9d689a01 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/credentials/ec2rolecreds/ec2_role_provider.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/credentials/ec2rolecreds/ec2_role_provider.go @@ -14,6 +14,9 @@ import ( "github.com/aws/aws-sdk-go/aws/ec2metadata" ) +// ProviderName provides a name of EC2Role provider +const ProviderName = "EC2RoleProvider" + // A EC2RoleProvider retrieves credentials from the EC2 service, and keeps track if // those credentials are expired. // @@ -85,17 +88,17 @@ func NewCredentialsWithClient(client *ec2metadata.EC2Metadata, options ...func(* func (m *EC2RoleProvider) Retrieve() (credentials.Value, error) { credsList, err := requestCredList(m.Client) if err != nil { - return credentials.Value{}, err + return credentials.Value{ProviderName: ProviderName}, err } if len(credsList) == 0 { - return credentials.Value{}, awserr.New("EmptyEC2RoleList", "empty EC2 Role list", nil) + return credentials.Value{ProviderName: ProviderName}, awserr.New("EmptyEC2RoleList", "empty EC2 Role list", nil) } credsName := credsList[0] roleCreds, err := requestCred(m.Client, credsName) if err != nil { - return credentials.Value{}, err + return credentials.Value{ProviderName: ProviderName}, err } m.SetExpiration(roleCreds.Expiration, m.ExpiryWindow) @@ -104,6 +107,7 @@ func (m *EC2RoleProvider) Retrieve() (credentials.Value, error) { AccessKeyID: roleCreds.AccessKeyID, SecretAccessKey: roleCreds.SecretAccessKey, SessionToken: roleCreds.Token, + ProviderName: ProviderName, }, nil } @@ -128,7 +132,7 @@ const iamSecurityCredsPath = "/iam/security-credentials" func requestCredList(client *ec2metadata.EC2Metadata) ([]string, error) { resp, err := client.GetMetadata(iamSecurityCredsPath) if err != nil { - return nil, awserr.New("EC2RoleRequestError", "failed to list EC2 Roles", err) + return nil, awserr.New("EC2RoleRequestError", "no EC2 instance role found", err) } credsList := []string{} @@ -138,7 +142,7 @@ func requestCredList(client *ec2metadata.EC2Metadata) ([]string, error) { } if err := s.Err(); err != nil { - return nil, awserr.New("SerializationError", "failed to read list of EC2 Roles", err) + return nil, awserr.New("SerializationError", "failed to read EC2 instance role from metadata service", err) } return credsList, nil @@ -153,7 +157,7 @@ func requestCred(client *ec2metadata.EC2Metadata, credsName string) (ec2RoleCred if err != nil { return ec2RoleCredRespBody{}, awserr.New("EC2RoleRequestError", - fmt.Sprintf("failed to get %s EC2 Role credentials", credsName), + fmt.Sprintf("failed to get %s EC2 instance role credentials", credsName), err) } @@ -161,7 +165,7 @@ func requestCred(client *ec2metadata.EC2Metadata, credsName string) (ec2RoleCred if err := json.NewDecoder(strings.NewReader(resp)).Decode(&respCreds); err != nil { return ec2RoleCredRespBody{}, awserr.New("SerializationError", - fmt.Sprintf("failed to decode %s EC2 Role credentials", credsName), + fmt.Sprintf("failed to decode %s EC2 instance role credentials", credsName), err) } diff --git a/vendor/github.com/aws/aws-sdk-go/aws/credentials/env_provider.go b/vendor/github.com/aws/aws-sdk-go/aws/credentials/env_provider.go index 043e861d6f..96655bc46a 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/credentials/env_provider.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/credentials/env_provider.go @@ -6,6 +6,9 @@ import ( "github.com/aws/aws-sdk-go/aws/awserr" ) +// EnvProviderName provides a name of Env provider +const EnvProviderName = "EnvProvider" + var ( // ErrAccessKeyIDNotFound is returned when the AWS Access Key ID can't be // found in the process's environment. @@ -52,11 +55,11 @@ func (e *EnvProvider) Retrieve() (Value, error) { } if id == "" { - return Value{}, ErrAccessKeyIDNotFound + return Value{ProviderName: EnvProviderName}, ErrAccessKeyIDNotFound } if secret == "" { - return Value{}, ErrSecretAccessKeyNotFound + return Value{ProviderName: EnvProviderName}, ErrSecretAccessKeyNotFound } e.retrieved = true @@ -64,6 +67,7 @@ func (e *EnvProvider) Retrieve() (Value, error) { AccessKeyID: id, SecretAccessKey: secret, SessionToken: os.Getenv("AWS_SESSION_TOKEN"), + ProviderName: EnvProviderName, }, nil } diff --git a/vendor/github.com/aws/aws-sdk-go/aws/credentials/shared_credentials_provider.go b/vendor/github.com/aws/aws-sdk-go/aws/credentials/shared_credentials_provider.go index 09bd00a950..7fb7cbf0db 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/credentials/shared_credentials_provider.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/credentials/shared_credentials_provider.go @@ -10,6 +10,9 @@ import ( "github.com/aws/aws-sdk-go/aws/awserr" ) +// SharedCredsProviderName provides a name of SharedCreds provider +const SharedCredsProviderName = "SharedCredentialsProvider" + var ( // ErrSharedCredentialsHomeNotFound is emitted when the user directory cannot be found. // @@ -55,12 +58,12 @@ func (p *SharedCredentialsProvider) Retrieve() (Value, error) { filename, err := p.filename() if err != nil { - return Value{}, err + return Value{ProviderName: SharedCredsProviderName}, err } creds, err := loadProfile(filename, p.profile()) if err != nil { - return Value{}, err + return Value{ProviderName: SharedCredsProviderName}, err } p.retrieved = true @@ -78,23 +81,23 @@ func (p *SharedCredentialsProvider) IsExpired() bool { func loadProfile(filename, profile string) (Value, error) { config, err := ini.Load(filename) if err != nil { - return Value{}, awserr.New("SharedCredsLoad", "failed to load shared credentials file", err) + return Value{ProviderName: SharedCredsProviderName}, awserr.New("SharedCredsLoad", "failed to load shared credentials file", err) } iniProfile, err := config.GetSection(profile) if err != nil { - return Value{}, awserr.New("SharedCredsLoad", "failed to get profile", err) + return Value{ProviderName: SharedCredsProviderName}, awserr.New("SharedCredsLoad", "failed to get profile", err) } id, err := iniProfile.GetKey("aws_access_key_id") if err != nil { - return Value{}, awserr.New("SharedCredsAccessKey", + return Value{ProviderName: SharedCredsProviderName}, awserr.New("SharedCredsAccessKey", fmt.Sprintf("shared credentials %s in %s did not contain aws_access_key_id", profile, filename), err) } secret, err := iniProfile.GetKey("aws_secret_access_key") if err != nil { - return Value{}, awserr.New("SharedCredsSecret", + return Value{ProviderName: SharedCredsProviderName}, awserr.New("SharedCredsSecret", fmt.Sprintf("shared credentials %s in %s did not contain aws_secret_access_key", profile, filename), nil) } @@ -106,6 +109,7 @@ func loadProfile(filename, profile string) (Value, error) { AccessKeyID: id.String(), SecretAccessKey: secret.String(), SessionToken: token.String(), + ProviderName: SharedCredsProviderName, }, nil } diff --git a/vendor/github.com/aws/aws-sdk-go/aws/credentials/static_provider.go b/vendor/github.com/aws/aws-sdk-go/aws/credentials/static_provider.go index 530a9ac2f3..71189e733d 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/credentials/static_provider.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/credentials/static_provider.go @@ -4,6 +4,9 @@ import ( "github.com/aws/aws-sdk-go/aws/awserr" ) +// StaticProviderName provides a name of Static provider +const StaticProviderName = "StaticProvider" + var ( // ErrStaticCredentialsEmpty is emitted when static credentials are empty. // @@ -30,9 +33,10 @@ func NewStaticCredentials(id, secret, token string) *Credentials { // Retrieve returns the credentials or error if the credentials are invalid. func (s *StaticProvider) Retrieve() (Value, error) { if s.AccessKeyID == "" || s.SecretAccessKey == "" { - return Value{}, ErrStaticCredentialsEmpty + return Value{ProviderName: StaticProviderName}, ErrStaticCredentialsEmpty } + s.Value.ProviderName = StaticProviderName return s.Value, nil } diff --git a/vendor/github.com/aws/aws-sdk-go/aws/defaults/defaults.go b/vendor/github.com/aws/aws-sdk-go/aws/defaults/defaults.go index 50f831c8fc..043960d3fc 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/defaults/defaults.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/defaults/defaults.go @@ -67,6 +67,7 @@ func Handlers() request.Handlers { handlers.Validate.PushBackNamed(corehandlers.ValidateEndpointHandler) handlers.Build.PushBackNamed(corehandlers.SDKVersionUserAgentHandler) + handlers.Build.AfterEachFn = request.HandlerListStopOnError handlers.Sign.PushBackNamed(corehandlers.BuildContentLengthHandler) handlers.Send.PushBackNamed(corehandlers.SendHandler) handlers.AfterRetry.PushBackNamed(corehandlers.AfterRetryHandler) @@ -83,13 +84,14 @@ func Handlers() request.Handlers { func CredChain(cfg *aws.Config, handlers request.Handlers) *credentials.Credentials { endpoint, signingRegion := endpoints.EndpointForRegion(ec2metadata.ServiceName, *cfg.Region, true) - return credentials.NewChainCredentials( - []credentials.Provider{ + return credentials.NewCredentials(&credentials.ChainProvider{ + VerboseErrors: aws.BoolValue(cfg.CredentialsChainVerboseErrors), + Providers: []credentials.Provider{ &credentials.EnvProvider{}, &credentials.SharedCredentialsProvider{Filename: "", Profile: ""}, &ec2rolecreds.EC2RoleProvider{ Client: ec2metadata.NewClient(*cfg, handlers, endpoint, signingRegion), ExpiryWindow: 5 * time.Minute, }, - }) + }}) } diff --git a/vendor/github.com/aws/aws-sdk-go/aws/ec2metadata/api.go b/vendor/github.com/aws/aws-sdk-go/aws/ec2metadata/api.go index e5137ca17d..669c813a00 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/ec2metadata/api.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/ec2metadata/api.go @@ -1,12 +1,19 @@ package ec2metadata import ( + "encoding/json" + "fmt" "path" + "strings" + "time" + "github.com/aws/aws-sdk-go/aws/awserr" "github.com/aws/aws-sdk-go/aws/request" ) -// GetMetadata uses the path provided to request +// GetMetadata uses the path provided to request information from the EC2 +// instance metdata service. The content will be returned as a string, or +// error if the request failed. func (c *EC2Metadata) GetMetadata(p string) (string, error) { op := &request.Operation{ Name: "GetMetadata", @@ -20,6 +27,68 @@ func (c *EC2Metadata) GetMetadata(p string) (string, error) { return output.Content, req.Send() } +// GetDynamicData uses the path provided to request information from the EC2 +// instance metadata service for dynamic data. The content will be returned +// as a string, or error if the request failed. +func (c *EC2Metadata) GetDynamicData(p string) (string, error) { + op := &request.Operation{ + Name: "GetDynamicData", + HTTPMethod: "GET", + HTTPPath: path.Join("/", "dynamic", p), + } + + output := &metadataOutput{} + req := c.NewRequest(op, nil, output) + + return output.Content, req.Send() +} + +// GetInstanceIdentityDocument retrieves an identity document describing an +// instance. Error is returned if the request fails or is unable to parse +// the response. +func (c *EC2Metadata) GetInstanceIdentityDocument() (EC2InstanceIdentityDocument, error) { + resp, err := c.GetDynamicData("instance-identity/document") + if err != nil { + return EC2InstanceIdentityDocument{}, + awserr.New("EC2MetadataRequestError", + "failed to get EC2 instance identity document", err) + } + + doc := EC2InstanceIdentityDocument{} + if err := json.NewDecoder(strings.NewReader(resp)).Decode(&doc); err != nil { + return EC2InstanceIdentityDocument{}, + awserr.New("SerializationError", + "failed to decode EC2 instance identity document", err) + } + + return doc, nil +} + +// IAMInfo retrieves IAM info from the metadata API +func (c *EC2Metadata) IAMInfo() (EC2IAMInfo, error) { + resp, err := c.GetMetadata("iam/info") + if err != nil { + return EC2IAMInfo{}, + awserr.New("EC2MetadataRequestError", + "failed to get EC2 IAM info", err) + } + + info := EC2IAMInfo{} + if err := json.NewDecoder(strings.NewReader(resp)).Decode(&info); err != nil { + return EC2IAMInfo{}, + awserr.New("SerializationError", + "failed to decode EC2 IAM info", err) + } + + if info.Code != "Success" { + errMsg := fmt.Sprintf("failed to get EC2 IAM Info (%s)", info.Code) + return EC2IAMInfo{}, + awserr.New("EC2MetadataError", errMsg, nil) + } + + return info, nil +} + // Region returns the region the instance is running in. func (c *EC2Metadata) Region() (string, error) { resp, err := c.GetMetadata("placement/availability-zone") @@ -41,3 +110,31 @@ func (c *EC2Metadata) Available() bool { return true } + +// An EC2IAMInfo provides the shape for unmarshalling +// an IAM info from the metadata API +type EC2IAMInfo struct { + Code string + LastUpdated time.Time + InstanceProfileArn string + InstanceProfileID string +} + +// An EC2InstanceIdentityDocument provides the shape for unmarshalling +// an instance identity document +type EC2InstanceIdentityDocument struct { + DevpayProductCodes []string `json:"devpayProductCodes"` + AvailabilityZone string `json:"availabilityZone"` + PrivateIP string `json:"privateIp"` + Version string `json:"version"` + Region string `json:"region"` + InstanceID string `json:"instanceId"` + BillingProducts []string `json:"billingProducts"` + InstanceType string `json:"instanceType"` + AccountID string `json:"accountId"` + PendingTime time.Time `json:"pendingTime"` + ImageID string `json:"imageId"` + KernelID string `json:"kernelId"` + RamdiskID string `json:"ramdiskId"` + Architecture string `json:"architecture"` +} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/ec2metadata/service.go b/vendor/github.com/aws/aws-sdk-go/aws/ec2metadata/service.go index f0dc331e01..5b4379dbd8 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/ec2metadata/service.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/ec2metadata/service.go @@ -3,8 +3,9 @@ package ec2metadata import ( - "io/ioutil" - "net" + "bytes" + "errors" + "io" "net/http" "time" @@ -26,6 +27,7 @@ type EC2Metadata struct { // New creates a new instance of the EC2Metadata client with a session. // This client is safe to use across multiple goroutines. // +// // Example: // // Create a EC2Metadata client from just a session. // svc := ec2metadata.New(mySession) @@ -40,22 +42,19 @@ func New(p client.ConfigProvider, cfgs ...*aws.Config) *EC2Metadata { // NewClient returns a new EC2Metadata client. Should be used to create // a client when not using a session. Generally using just New with a session // is preferred. +// +// If an unmodified HTTP client is provided from the stdlib default, or no client +// the EC2RoleProvider's EC2Metadata HTTP client's timeout will be shortened. +// To disable this set Config.EC2MetadataDisableTimeoutOverride to false. Enabled by default. func NewClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string, opts ...func(*client.Client)) *EC2Metadata { - // If the default http client is provided, replace it with a custom - // client using default timeouts. - if cfg.HTTPClient == http.DefaultClient { + if !aws.BoolValue(cfg.EC2MetadataDisableTimeoutOverride) && httpClientZero(cfg.HTTPClient) { + // If the http client is unmodified and this feature is not disabled + // set custom timeouts for EC2Metadata requests. cfg.HTTPClient = &http.Client{ - Transport: &http.Transport{ - Proxy: http.ProxyFromEnvironment, - Dial: (&net.Dialer{ - // use a shorter timeout than default because the metadata - // service is local if it is running, and to fail faster - // if not running on an ec2 instance. - Timeout: 5 * time.Second, - KeepAlive: 30 * time.Second, - }).Dial, - TLSHandshakeTimeout: 10 * time.Second, - }, + // use a shorter timeout than default because the metadata + // service is local if it is running, and to fail faster + // if not running on an ec2 instance. + Timeout: 5 * time.Second, } } @@ -84,29 +83,38 @@ func NewClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegio return svc } +func httpClientZero(c *http.Client) bool { + return c == nil || (c.Transport == nil && c.CheckRedirect == nil && c.Jar == nil && c.Timeout == 0) +} + type metadataOutput struct { Content string } func unmarshalHandler(r *request.Request) { defer r.HTTPResponse.Body.Close() - b, err := ioutil.ReadAll(r.HTTPResponse.Body) - if err != nil { + b := &bytes.Buffer{} + if _, err := io.Copy(b, r.HTTPResponse.Body); err != nil { r.Error = awserr.New("SerializationError", "unable to unmarshal EC2 metadata respose", err) + return } - data := r.Data.(*metadataOutput) - data.Content = string(b) + if data, ok := r.Data.(*metadataOutput); ok { + data.Content = b.String() + } } func unmarshalError(r *request.Request) { defer r.HTTPResponse.Body.Close() - _, err := ioutil.ReadAll(r.HTTPResponse.Body) - if err != nil { + b := &bytes.Buffer{} + if _, err := io.Copy(b, r.HTTPResponse.Body); err != nil { r.Error = awserr.New("SerializationError", "unable to unmarshal EC2 metadata error respose", err) + return } - // TODO extract the error... + // Response body format is not consistent between metadata endpoints. + // Grab the error message as a string and include that as the source error + r.Error = awserr.New("EC2MetadataError", "failed to make EC2Metadata request", errors.New(b.String())) } func validateEndpointHandler(r *request.Request) { diff --git a/vendor/github.com/aws/aws-sdk-go/aws/logger.go b/vendor/github.com/aws/aws-sdk-go/aws/logger.go index f536948738..db87188e20 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/logger.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/logger.go @@ -79,6 +79,20 @@ type Logger interface { Log(...interface{}) } +// A LoggerFunc is a convenience type to convert a function taking a variadic +// list of arguments and wrap it so the Logger interface can be used. +// +// Example: +// s3.New(sess, &aws.Config{Logger: aws.LoggerFunc(func(args ...interface{}) { +// fmt.Fprintln(os.Stdout, args...) +// })}) +type LoggerFunc func(...interface{}) + +// Log calls the wrapped function with the arguments provided +func (f LoggerFunc) Log(args ...interface{}) { + f(args...) +} + // NewDefaultLogger returns a Logger which will write log messages to stdout, and // use same formatting runes as the stdlib log.Logger func NewDefaultLogger() Logger { diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/handlers.go b/vendor/github.com/aws/aws-sdk-go/aws/request/handlers.go index 3e90a7976a..5279c19c09 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/request/handlers.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/request/handlers.go @@ -50,9 +50,28 @@ func (h *Handlers) Clear() { h.AfterRetry.Clear() } +// A HandlerListRunItem represents an entry in the HandlerList which +// is being run. +type HandlerListRunItem struct { + Index int + Handler NamedHandler + Request *Request +} + // A HandlerList manages zero or more handlers in a list. type HandlerList struct { list []NamedHandler + + // Called after each request handler in the list is called. If set + // and the func returns true the HandlerList will continue to iterate + // over the request handlers. If false is returned the HandlerList + // will stop iterating. + // + // Should be used if extra logic to be performed between each handler + // in the list. This can be used to terminate a list's iteration + // based on a condition such as error like, HandlerListStopOnError. + // Or for logging like HandlerListLogItem. + AfterEachFn func(item HandlerListRunItem) bool } // A NamedHandler is a struct that contains a name and function callback. @@ -63,7 +82,9 @@ type NamedHandler struct { // copy creates a copy of the handler list. func (l *HandlerList) copy() HandlerList { - var n HandlerList + n := HandlerList{ + AfterEachFn: l.AfterEachFn, + } n.list = append([]NamedHandler{}, l.list...) return n } @@ -111,11 +132,37 @@ func (l *HandlerList) Remove(n NamedHandler) { // Run executes all handlers in the list with a given request object. func (l *HandlerList) Run(r *Request) { - for _, f := range l.list { - f.Fn(r) + for i, h := range l.list { + h.Fn(r) + item := HandlerListRunItem{ + Index: i, Handler: h, Request: r, + } + if l.AfterEachFn != nil && !l.AfterEachFn(item) { + return + } } } +// HandlerListLogItem logs the request handler and the state of the +// request's Error value. Always returns true to continue iterating +// request handlers in a HandlerList. +func HandlerListLogItem(item HandlerListRunItem) bool { + if item.Request.Config.Logger == nil { + return true + } + item.Request.Config.Logger.Log("DEBUG: RequestHandler", + item.Index, item.Handler.Name, item.Request.Error) + + return true +} + +// HandlerListStopOnError returns false to stop the HandlerList iterating +// over request handlers if Request.Error is not nil. True otherwise +// to continue iterating. +func HandlerListStopOnError(item HandlerListRunItem) bool { + return item.Request.Error == nil +} + // MakeAddToUserAgentHandler will add the name/version pair to the User-Agent request // header. If the extra parameters are provided they will be added as metadata to the // name/version pair resulting in the following format. diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/offset_reader.go b/vendor/github.com/aws/aws-sdk-go/aws/request/offset_reader.go new file mode 100644 index 0000000000..da6396d2d9 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/aws/request/offset_reader.go @@ -0,0 +1,49 @@ +package request + +import ( + "io" + "sync" +) + +// offsetReader is a thread-safe io.ReadCloser to prevent racing +// with retrying requests +type offsetReader struct { + buf io.ReadSeeker + lock sync.RWMutex + closed bool +} + +func newOffsetReader(buf io.ReadSeeker, offset int64) *offsetReader { + reader := &offsetReader{} + buf.Seek(offset, 0) + + reader.buf = buf + return reader +} + +// Close is a thread-safe close. Uses the write lock. +func (o *offsetReader) Close() error { + o.lock.Lock() + defer o.lock.Unlock() + o.closed = true + return nil +} + +// Read is a thread-safe read using a read lock. +func (o *offsetReader) Read(p []byte) (int, error) { + o.lock.RLock() + defer o.lock.RUnlock() + + if o.closed { + return 0, io.EOF + } + + return o.buf.Read(p) +} + +// CloseAndCopy will return a new offsetReader with a copy of the old buffer +// and close the old buffer. +func (o *offsetReader) CloseAndCopy(offset int64) *offsetReader { + o.Close() + return newOffsetReader(o.buf, offset) +} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/request.go b/vendor/github.com/aws/aws-sdk-go/aws/request/request.go index 3735d7fa53..13ce8fdd85 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/request/request.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/request/request.go @@ -22,20 +22,22 @@ type Request struct { Handlers Handlers Retryer - Time time.Time - ExpireTime time.Duration - Operation *Operation - HTTPRequest *http.Request - HTTPResponse *http.Response - Body io.ReadSeeker - BodyStart int64 // offset from beginning of Body that the request body starts - Params interface{} - Error error - Data interface{} - RequestID string - RetryCount int - Retryable *bool - RetryDelay time.Duration + Time time.Time + ExpireTime time.Duration + Operation *Operation + HTTPRequest *http.Request + HTTPResponse *http.Response + Body io.ReadSeeker + BodyStart int64 // offset from beginning of Body that the request body starts + Params interface{} + Error error + Data interface{} + RequestID string + RetryCount int + Retryable *bool + RetryDelay time.Duration + NotHoist bool + SignedHeaderVals http.Header built bool } @@ -129,7 +131,7 @@ func (r *Request) SetStringBody(s string) { // SetReaderBody will set the request's body reader. func (r *Request) SetReaderBody(reader io.ReadSeeker) { - r.HTTPRequest.Body = ioutil.NopCloser(reader) + r.HTTPRequest.Body = newOffsetReader(reader, 0) r.Body = reader } @@ -137,6 +139,7 @@ func (r *Request) SetReaderBody(reader io.ReadSeeker) { // if the signing fails. func (r *Request) Presign(expireTime time.Duration) (string, error) { r.ExpireTime = expireTime + r.NotHoist = false r.Sign() if r.Error != nil { return "", r.Error @@ -144,6 +147,18 @@ func (r *Request) Presign(expireTime time.Duration) (string, error) { return r.HTTPRequest.URL.String(), nil } +// PresignRequest behaves just like presign, but hoists all headers and signs them. +// Also returns the signed hash back to the user +func (r *Request) PresignRequest(expireTime time.Duration) (string, http.Header, error) { + r.ExpireTime = expireTime + r.NotHoist = true + r.Sign() + if r.Error != nil { + return "", nil, r.Error + } + return r.HTTPRequest.URL.String(), r.SignedHeaderVals, nil +} + func debugLogReqError(r *Request, stage string, retrying bool, err error) { if !r.Config.LogLevel.Matches(aws.LogDebugWithRequestErrors) { return @@ -177,6 +192,10 @@ func (r *Request) Build() error { return r.Error } r.Handlers.Build.Run(r) + if r.Error != nil { + debugLogReqError(r, "Build Request", false, r.Error) + return r.Error + } r.built = true } @@ -204,22 +223,48 @@ func (r *Request) Sign() error { // be executed in the order they were set. func (r *Request) Send() error { for { - r.Sign() - if r.Error != nil { - return r.Error - } - if aws.BoolValue(r.Retryable) { if r.Config.LogLevel.Matches(aws.LogDebugWithRequestRetries) { r.Config.Logger.Log(fmt.Sprintf("DEBUG: Retrying Request %s/%s, attempt %d", r.ClientInfo.ServiceName, r.Operation.Name, r.RetryCount)) } - // Re-seek the body back to the original point in for a retry so that - // send will send the body's contents again in the upcoming request. - r.Body.Seek(r.BodyStart, 0) - r.HTTPRequest.Body = ioutil.NopCloser(r.Body) + var body io.ReadCloser + if reader, ok := r.HTTPRequest.Body.(*offsetReader); ok { + body = reader.CloseAndCopy(r.BodyStart) + } else { + if r.Config.Logger != nil { + r.Config.Logger.Log("Request body type has been overwritten. May cause race conditions") + } + r.Body.Seek(r.BodyStart, 0) + body = ioutil.NopCloser(r.Body) + } + + r.HTTPRequest = &http.Request{ + URL: r.HTTPRequest.URL, + Header: r.HTTPRequest.Header, + Close: r.HTTPRequest.Close, + Form: r.HTTPRequest.Form, + PostForm: r.HTTPRequest.PostForm, + Body: body, + MultipartForm: r.HTTPRequest.MultipartForm, + Host: r.HTTPRequest.Host, + Method: r.HTTPRequest.Method, + Proto: r.HTTPRequest.Proto, + ContentLength: r.HTTPRequest.ContentLength, + } + if r.HTTPResponse.Body != nil { + // Closing response body. Since we are setting a new request to send off, this + // response will get squashed and leaked. + r.HTTPResponse.Body.Close() + } + } + + r.Sign() + if r.Error != nil { + return r.Error } + r.Retryable = nil r.Handlers.Send.Run(r) diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/retryer.go b/vendor/github.com/aws/aws-sdk-go/aws/request/retryer.go index ab6fff5ac8..8cc8b015ae 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/request/retryer.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/request/retryer.go @@ -26,8 +26,11 @@ func WithRetryer(cfg *aws.Config, retryer Retryer) *aws.Config { // retryableCodes is a collection of service response codes which are retry-able // without any further action. var retryableCodes = map[string]struct{}{ - "RequestError": {}, - "RequestTimeout": {}, + "RequestError": {}, + "RequestTimeout": {}, +} + +var throttleCodes = map[string]struct{}{ "ProvisionedThroughputExceededException": {}, "Throttling": {}, "ThrottlingException": {}, @@ -46,6 +49,11 @@ var credsExpiredCodes = map[string]struct{}{ "RequestExpired": {}, // EC2 Only } +func isCodeThrottle(code string) bool { + _, ok := throttleCodes[code] + return ok +} + func isCodeRetryable(code string) bool { if _, ok := retryableCodes[code]; ok { return true @@ -70,6 +78,17 @@ func (r *Request) IsErrorRetryable() bool { return false } +// IsErrorThrottle returns whether the error is to be throttled based on its code. +// Returns false if the request has no Error set +func (r *Request) IsErrorThrottle() bool { + if r.Error != nil { + if err, ok := r.Error.(awserr.Error); ok { + return isCodeThrottle(err.Code()) + } + } + return false +} + // IsErrorExpired returns whether the error code is a credential expiry error. // Returns false if the request has no Error set. func (r *Request) IsErrorExpired() bool { diff --git a/vendor/github.com/aws/aws-sdk-go/aws/session/session.go b/vendor/github.com/aws/aws-sdk-go/aws/session/session.go index 6a0f371a29..47e4536ff1 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/session/session.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/session/session.go @@ -51,12 +51,21 @@ type Session struct { // sess := session.New() // svc := s3.New(sess) func New(cfgs ...*aws.Config) *Session { - def := defaults.Get() + cfg := defaults.Config() + handlers := defaults.Handlers() + + // Apply the passed in configs so the configuration can be applied to the + // default credential chain + cfg.MergeIn(cfgs...) + cfg.Credentials = defaults.CredChain(cfg, handlers) + + // Reapply any passed in configs to override credentials if set + cfg.MergeIn(cfgs...) + s := &Session{ - Config: def.Config, - Handlers: def.Handlers, + Config: cfg, + Handlers: handlers, } - s.Config.MergeIn(cfgs...) initHandlers(s) diff --git a/vendor/github.com/aws/aws-sdk-go/aws/types.go b/vendor/github.com/aws/aws-sdk-go/aws/types.go index 0f067c57f4..fa014b49e1 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/types.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/types.go @@ -61,23 +61,41 @@ func (r ReaderSeekerCloser) Close() error { type WriteAtBuffer struct { buf []byte m sync.Mutex + + // GrowthCoeff defines the growth rate of the internal buffer. By + // default, the growth rate is 1, where expanding the internal + // buffer will allocate only enough capacity to fit the new expected + // length. + GrowthCoeff float64 +} + +// NewWriteAtBuffer creates a WriteAtBuffer with an internal buffer +// provided by buf. +func NewWriteAtBuffer(buf []byte) *WriteAtBuffer { + return &WriteAtBuffer{buf: buf} } // WriteAt writes a slice of bytes to a buffer starting at the position provided // The number of bytes written will be returned, or error. Can overwrite previous // written slices if the write ats overlap. func (b *WriteAtBuffer) WriteAt(p []byte, pos int64) (n int, err error) { + pLen := len(p) + expLen := pos + int64(pLen) b.m.Lock() defer b.m.Unlock() - - expLen := pos + int64(len(p)) if int64(len(b.buf)) < expLen { - newBuf := make([]byte, expLen) - copy(newBuf, b.buf) - b.buf = newBuf + if int64(cap(b.buf)) < expLen { + if b.GrowthCoeff < 1 { + b.GrowthCoeff = 1 + } + newBuf := make([]byte, expLen, int64(b.GrowthCoeff*float64(expLen))) + copy(newBuf, b.buf) + b.buf = newBuf + } + b.buf = b.buf[:expLen] } copy(b.buf[pos:], p) - return len(p), nil + return pLen, nil } // Bytes returns a slice of bytes written to the buffer. diff --git a/vendor/github.com/aws/aws-sdk-go/aws/version.go b/vendor/github.com/aws/aws-sdk-go/aws/version.go index 42227a114e..f38b549b9d 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/version.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/version.go @@ -5,4 +5,4 @@ package aws const SDKName = "aws-sdk-go" // SDKVersion is the version of this SDK -const SDKVersion = "1.0.7" +const SDKVersion = "1.1.18" diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/assert.go b/vendor/github.com/aws/aws-sdk-go/awstesting/assert.go new file mode 100644 index 0000000000..678a5823bf --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/awstesting/assert.go @@ -0,0 +1,192 @@ +package awstesting + +import ( + "encoding/json" + "encoding/xml" + "fmt" + "net/url" + "reflect" + "regexp" + "sort" + "strconv" + "strings" + "testing" + + "github.com/aws/aws-sdk-go/private/model/api" + "github.com/stretchr/testify/assert" +) + +// findMember searches the shape for the member with the matching key name. +func findMember(shape *api.Shape, key string) string { + for actualKey := range shape.MemberRefs { + if strings.ToLower(key) == strings.ToLower(actualKey) { + return actualKey + } + } + return "" +} + +// GenerateAssertions builds assertions for a shape based on its type. +// +// The shape's recursive values also will have assertions generated for them. +func GenerateAssertions(out interface{}, shape *api.Shape, prefix string) string { + switch t := out.(type) { + case map[string]interface{}: + keys := SortedKeys(t) + + code := "" + if shape.Type == "map" { + for _, k := range keys { + v := t[k] + s := shape.ValueRef.Shape + code += GenerateAssertions(v, s, prefix+"[\""+k+"\"]") + } + } else { + for _, k := range keys { + v := t[k] + m := findMember(shape, k) + s := shape.MemberRefs[m].Shape + code += GenerateAssertions(v, s, prefix+"."+m+"") + } + } + return code + case []interface{}: + code := "" + for i, v := range t { + s := shape.MemberRef.Shape + code += GenerateAssertions(v, s, prefix+"["+strconv.Itoa(i)+"]") + } + return code + default: + switch shape.Type { + case "timestamp": + return fmt.Sprintf("assert.Equal(t, time.Unix(%#v, 0).UTC().String(), %s.String())\n", out, prefix) + case "blob": + return fmt.Sprintf("assert.Equal(t, %#v, string(%s))\n", out, prefix) + case "integer", "long": + return fmt.Sprintf("assert.Equal(t, int64(%#v), *%s)\n", out, prefix) + default: + if !reflect.ValueOf(out).IsValid() { + return fmt.Sprintf("assert.Nil(t, %s)\n", prefix) + } + return fmt.Sprintf("assert.Equal(t, %#v, *%s)\n", out, prefix) + } + } +} + +// Match is a testing helper to test for testing error by comparing expected +// with a regular expression. +func Match(t *testing.T, regex, expected string) { + if !regexp.MustCompile(regex).Match([]byte(expected)) { + t.Errorf("%q\n\tdoes not match /%s/", expected, regex) + } +} + +// AssertURL verifies the expected URL is matches the actual. +func AssertURL(t *testing.T, expect, actual string, msgAndArgs ...interface{}) bool { + expectURL, err := url.Parse(expect) + if err != nil { + t.Errorf(errMsg("unable to parse expected URL", err, msgAndArgs)) + return false + } + actualURL, err := url.Parse(actual) + if err != nil { + t.Errorf(errMsg("unable to parse actual URL", err, msgAndArgs)) + return false + } + + assert.Equal(t, expectURL.Host, actualURL.Host, msgAndArgs...) + assert.Equal(t, expectURL.Scheme, actualURL.Scheme, msgAndArgs...) + assert.Equal(t, expectURL.Path, actualURL.Path, msgAndArgs...) + + return AssertQuery(t, expectURL.Query().Encode(), actualURL.Query().Encode(), msgAndArgs...) +} + +// AssertQuery verifies the expect HTTP query string matches the actual. +func AssertQuery(t *testing.T, expect, actual string, msgAndArgs ...interface{}) bool { + expectQ, err := url.ParseQuery(expect) + if err != nil { + t.Errorf(errMsg("unable to parse expected Query", err, msgAndArgs)) + return false + } + actualQ, err := url.ParseQuery(expect) + if err != nil { + t.Errorf(errMsg("unable to parse actual Query", err, msgAndArgs)) + return false + } + + // Make sure the keys are the same + if !assert.Equal(t, queryValueKeys(expectQ), queryValueKeys(actualQ), msgAndArgs...) { + return false + } + + for k, expectQVals := range expectQ { + sort.Strings(expectQVals) + actualQVals := actualQ[k] + sort.Strings(actualQVals) + assert.Equal(t, expectQVals, actualQVals, msgAndArgs...) + } + + return true +} + +// AssertJSON verifies that the expect json string matches the actual. +func AssertJSON(t *testing.T, expect, actual string, msgAndArgs ...interface{}) bool { + expectVal := map[string]interface{}{} + if err := json.Unmarshal([]byte(expect), &expectVal); err != nil { + t.Errorf(errMsg("unable to parse expected JSON", err, msgAndArgs...)) + return false + } + + actualVal := map[string]interface{}{} + if err := json.Unmarshal([]byte(actual), &actualVal); err != nil { + t.Errorf(errMsg("unable to parse actual JSON", err, msgAndArgs...)) + return false + } + + return assert.Equal(t, expectVal, actualVal, msgAndArgs...) +} + +// AssertXML verifies that the expect xml string matches the actual. +func AssertXML(t *testing.T, expect, actual string, container interface{}, msgAndArgs ...interface{}) bool { + expectVal := container + if err := xml.Unmarshal([]byte(expect), &expectVal); err != nil { + t.Errorf(errMsg("unable to parse expected XML", err, msgAndArgs...)) + } + + actualVal := container + if err := xml.Unmarshal([]byte(actual), &actualVal); err != nil { + t.Errorf(errMsg("unable to parse actual XML", err, msgAndArgs...)) + } + return assert.Equal(t, expectVal, actualVal, msgAndArgs...) +} + +func errMsg(baseMsg string, err error, msgAndArgs ...interface{}) string { + message := messageFromMsgAndArgs(msgAndArgs) + if message != "" { + message += ", " + } + return fmt.Sprintf("%s%s, %v", message, baseMsg, err) +} + +func messageFromMsgAndArgs(msgAndArgs []interface{}) string { + if len(msgAndArgs) == 0 || msgAndArgs == nil { + return "" + } + if len(msgAndArgs) == 1 { + return msgAndArgs[0].(string) + } + if len(msgAndArgs) > 1 { + return fmt.Sprintf(msgAndArgs[0].(string), msgAndArgs[1:]...) + } + return "" +} + +func queryValueKeys(v url.Values) []string { + keys := make([]string, 0, len(v)) + for k := range v { + keys = append(keys, k) + } + sort.Strings(keys) + return keys +} diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/client.go b/vendor/github.com/aws/aws-sdk-go/awstesting/client.go new file mode 100644 index 0000000000..ca64a44781 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/awstesting/client.go @@ -0,0 +1,20 @@ +package awstesting + +import ( + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/client" + "github.com/aws/aws-sdk-go/aws/client/metadata" + "github.com/aws/aws-sdk-go/aws/defaults" +) + +// NewClient creates and initializes a generic service client for testing. +func NewClient(cfgs ...*aws.Config) *client.Client { + info := metadata.ClientInfo{ + Endpoint: "http://endpoint", + SigningName: "", + } + def := defaults.Get() + def.Config.MergeIn(cfgs...) + + return client.New(*def.Config, info, def.Handlers) +} diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/param_filler.go b/vendor/github.com/aws/aws-sdk-go/awstesting/param_filler.go new file mode 100644 index 0000000000..0aa929186a --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/awstesting/param_filler.go @@ -0,0 +1,132 @@ +package awstesting + +import ( + "fmt" + "reflect" + "strings" + + "github.com/aws/aws-sdk-go/private/model/api" + "github.com/aws/aws-sdk-go/private/util" +) + +// A paramFiller provides string formatting for a shape and its types. +type paramFiller struct { + prefixPackageName bool +} + +// typeName returns the type name of a shape. +func (f paramFiller) typeName(shape *api.Shape) string { + if f.prefixPackageName && shape.Type == "structure" { + return "*" + shape.API.PackageName() + "." + shape.GoTypeElem() + } + return shape.GoType() +} + +// ParamsStructFromJSON returns a JSON string representation of a structure. +func ParamsStructFromJSON(value interface{}, shape *api.Shape, prefixPackageName bool) string { + f := paramFiller{prefixPackageName: prefixPackageName} + return util.GoFmt(f.paramsStructAny(value, shape)) +} + +// paramsStructAny returns the string representation of any value. +func (f paramFiller) paramsStructAny(value interface{}, shape *api.Shape) string { + if value == nil { + return "" + } + + switch shape.Type { + case "structure": + if value != nil { + vmap := value.(map[string]interface{}) + return f.paramsStructStruct(vmap, shape) + } + case "list": + vlist := value.([]interface{}) + return f.paramsStructList(vlist, shape) + case "map": + vmap := value.(map[string]interface{}) + return f.paramsStructMap(vmap, shape) + case "string", "character": + v := reflect.Indirect(reflect.ValueOf(value)) + if v.IsValid() { + return fmt.Sprintf("aws.String(%#v)", v.Interface()) + } + case "blob": + v := reflect.Indirect(reflect.ValueOf(value)) + if v.IsValid() && shape.Streaming { + return fmt.Sprintf("aws.ReadSeekCloser(bytes.NewBufferString(%#v))", v.Interface()) + } else if v.IsValid() { + return fmt.Sprintf("[]byte(%#v)", v.Interface()) + } + case "boolean": + v := reflect.Indirect(reflect.ValueOf(value)) + if v.IsValid() { + return fmt.Sprintf("aws.Bool(%#v)", v.Interface()) + } + case "integer", "long": + v := reflect.Indirect(reflect.ValueOf(value)) + if v.IsValid() { + return fmt.Sprintf("aws.Int64(%v)", v.Interface()) + } + case "float", "double": + v := reflect.Indirect(reflect.ValueOf(value)) + if v.IsValid() { + return fmt.Sprintf("aws.Float64(%v)", v.Interface()) + } + case "timestamp": + v := reflect.Indirect(reflect.ValueOf(value)) + if v.IsValid() { + return fmt.Sprintf("aws.Time(time.Unix(%d, 0))", int(v.Float())) + } + default: + panic("Unhandled type " + shape.Type) + } + return "" +} + +// paramsStructStruct returns the string representation of a structure +func (f paramFiller) paramsStructStruct(value map[string]interface{}, shape *api.Shape) string { + out := "&" + f.typeName(shape)[1:] + "{\n" + for _, n := range shape.MemberNames() { + ref := shape.MemberRefs[n] + name := findParamMember(value, n) + + if val := f.paramsStructAny(value[name], ref.Shape); val != "" { + out += fmt.Sprintf("%s: %s,\n", n, val) + } + } + out += "}" + return out +} + +// paramsStructMap returns the string representation of a map of values +func (f paramFiller) paramsStructMap(value map[string]interface{}, shape *api.Shape) string { + out := f.typeName(shape) + "{\n" + keys := SortedKeys(value) + for _, k := range keys { + v := value[k] + out += fmt.Sprintf("%q: %s,\n", k, f.paramsStructAny(v, shape.ValueRef.Shape)) + } + out += "}" + return out +} + +// paramsStructList returns the string representation of slice of values +func (f paramFiller) paramsStructList(value []interface{}, shape *api.Shape) string { + out := f.typeName(shape) + "{\n" + for _, v := range value { + out += fmt.Sprintf("%s,\n", f.paramsStructAny(v, shape.MemberRef.Shape)) + } + out += "}" + return out +} + +// findParamMember searches a map for a key ignoring case. Returns the map key if found. +func findParamMember(value map[string]interface{}, key string) string { + for actualKey := range value { + if strings.ToLower(key) == strings.ToLower(actualKey) { + return actualKey + } + } + return "" +} diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/sort_keys.go b/vendor/github.com/aws/aws-sdk-go/awstesting/sort_keys.go new file mode 100644 index 0000000000..c3ad6256be --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/awstesting/sort_keys.go @@ -0,0 +1,14 @@ +package awstesting + +import "sort" + +// SortedKeys returns a sorted slice of keys of a map. +func SortedKeys(m map[string]interface{}) []string { + i, sorted := 0, make([]string, len(m)) + for k := range m { + sorted[i] = k + i++ + } + sort.Strings(sorted) + return sorted +} diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/util.go b/vendor/github.com/aws/aws-sdk-go/awstesting/util.go new file mode 100644 index 0000000000..da43804ceb --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/awstesting/util.go @@ -0,0 +1,60 @@ +package awstesting + +import ( + "io" +) + +// ZeroReader is a io.Reader which will always write zeros to the byte slice provided. +type ZeroReader struct{} + +// Read fills the provided byte slice with zeros returning the number of bytes written. +func (r *ZeroReader) Read(b []byte) (int, error) { + for i := 0; i < len(b); i++ { + b[i] = 0 + } + return len(b), nil +} + +// ReadCloser is a io.ReadCloser for unit testing. +// Designed to test for leaks and whether a handle has +// been closed +type ReadCloser struct { + Size int + Closed bool + set bool + FillData func(bool, []byte, int, int) +} + +// Read will call FillData and fill it with whatever data needed. +// Decrements the size until zero, then return io.EOF. +func (r *ReadCloser) Read(b []byte) (int, error) { + if r.Closed { + return 0, io.EOF + } + + delta := len(b) + if delta > r.Size { + delta = r.Size + } + r.Size -= delta + + for i := 0; i < delta; i++ { + b[i] = 'a' + } + + if r.FillData != nil { + r.FillData(r.set, b, r.Size, delta) + } + r.set = true + + if r.Size > 0 { + return delta, nil + } + return delta, io.EOF +} + +// Close sets Closed to true and returns no error +func (r *ReadCloser) Close() error { + r.Closed = true + return nil +} diff --git a/vendor/github.com/aws/aws-sdk-go/private/endpoints/endpoints.json b/vendor/github.com/aws/aws-sdk-go/private/endpoints/endpoints.json index ea819b1ec3..5f4991c2bd 100644 --- a/vendor/github.com/aws/aws-sdk-go/private/endpoints/endpoints.json +++ b/vendor/github.com/aws/aws-sdk-go/private/endpoints/endpoints.json @@ -8,6 +8,9 @@ "endpoint": "{service}.{region}.amazonaws.com.cn", "signatureVersion": "v4" }, + "cn-north-1/ec2metadata": { + "endpoint": "http://169.254.169.254/latest" + }, "us-gov-west-1/iam": { "endpoint": "iam.us-gov.amazonaws.com" }, @@ -17,6 +20,9 @@ "us-gov-west-1/s3": { "endpoint": "s3-{region}.amazonaws.com" }, + "us-gov-west-1/ec2metadata": { + "endpoint": "http://169.254.169.254/latest" + }, "*/cloudfront": { "endpoint": "cloudfront.amazonaws.com", "signingRegion": "us-east-1" @@ -30,8 +36,7 @@ "signingRegion": "us-east-1" }, "*/ec2metadata": { - "endpoint": "http://169.254.169.254/latest", - "signingRegion": "us-east-1" + "endpoint": "http://169.254.169.254/latest" }, "*/iam": { "endpoint": "iam.amazonaws.com", @@ -57,33 +62,14 @@ "endpoint": "sdb.amazonaws.com", "signingRegion": "us-east-1" }, - "us-east-1/s3": { - "endpoint": "s3.amazonaws.com" - }, - "us-west-1/s3": { + "*/s3": { "endpoint": "s3-{region}.amazonaws.com" }, - "us-west-2/s3": { - "endpoint": "s3-{region}.amazonaws.com" - }, - "eu-west-1/s3": { - "endpoint": "s3-{region}.amazonaws.com" - }, - "ap-southeast-1/s3": { - "endpoint": "s3-{region}.amazonaws.com" - }, - "ap-southeast-2/s3": { - "endpoint": "s3-{region}.amazonaws.com" - }, - "ap-northeast-1/s3": { - "endpoint": "s3-{region}.amazonaws.com" - }, - "sa-east-1/s3": { - "endpoint": "s3-{region}.amazonaws.com" + "us-east-1/s3": { + "endpoint": "s3.amazonaws.com" }, "eu-central-1/s3": { - "endpoint": "{service}.{region}.amazonaws.com", - "signatureVersion": "v4" + "endpoint": "{service}.{region}.amazonaws.com" } } } diff --git a/vendor/github.com/aws/aws-sdk-go/private/endpoints/endpoints_map.go b/vendor/github.com/aws/aws-sdk-go/private/endpoints/endpoints_map.go index 3fab91c7f1..e995315ab8 100644 --- a/vendor/github.com/aws/aws-sdk-go/private/endpoints/endpoints_map.go +++ b/vendor/github.com/aws/aws-sdk-go/private/endpoints/endpoints_map.go @@ -31,8 +31,7 @@ var endpointsMap = endpointStruct{ SigningRegion: "us-east-1", }, "*/ec2metadata": { - Endpoint: "http://169.254.169.254/latest", - SigningRegion: "us-east-1", + Endpoint: "http://169.254.169.254/latest", }, "*/iam": { Endpoint: "iam.amazonaws.com", @@ -46,6 +45,9 @@ var endpointsMap = endpointStruct{ Endpoint: "route53.amazonaws.com", SigningRegion: "us-east-1", }, + "*/s3": { + Endpoint: "s3-{region}.amazonaws.com", + }, "*/sts": { Endpoint: "sts.amazonaws.com", SigningRegion: "us-east-1", @@ -54,27 +56,15 @@ var endpointsMap = endpointStruct{ Endpoint: "waf.amazonaws.com", SigningRegion: "us-east-1", }, - "ap-northeast-1/s3": { - Endpoint: "s3-{region}.amazonaws.com", - }, - "ap-southeast-1/s3": { - Endpoint: "s3-{region}.amazonaws.com", - }, - "ap-southeast-2/s3": { - Endpoint: "s3-{region}.amazonaws.com", - }, "cn-north-1/*": { Endpoint: "{service}.{region}.amazonaws.com.cn", }, + "cn-north-1/ec2metadata": { + Endpoint: "http://169.254.169.254/latest", + }, "eu-central-1/s3": { Endpoint: "{service}.{region}.amazonaws.com", }, - "eu-west-1/s3": { - Endpoint: "s3-{region}.amazonaws.com", - }, - "sa-east-1/s3": { - Endpoint: "s3-{region}.amazonaws.com", - }, "us-east-1/s3": { Endpoint: "s3.amazonaws.com", }, @@ -82,6 +72,9 @@ var endpointsMap = endpointStruct{ Endpoint: "sdb.amazonaws.com", SigningRegion: "us-east-1", }, + "us-gov-west-1/ec2metadata": { + Endpoint: "http://169.254.169.254/latest", + }, "us-gov-west-1/iam": { Endpoint: "iam.us-gov.amazonaws.com", }, @@ -91,11 +84,5 @@ var endpointsMap = endpointStruct{ "us-gov-west-1/sts": { Endpoint: "sts.us-gov-west-1.amazonaws.com", }, - "us-west-1/s3": { - Endpoint: "s3-{region}.amazonaws.com", - }, - "us-west-2/s3": { - Endpoint: "s3-{region}.amazonaws.com", - }, }, } diff --git a/vendor/github.com/aws/aws-sdk-go/private/model/api/api.go b/vendor/github.com/aws/aws-sdk-go/private/model/api/api.go new file mode 100644 index 0000000000..3748dd4929 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/private/model/api/api.go @@ -0,0 +1,410 @@ +// Package api represents API abstractions for rendering service generated files. +package api + +import ( + "bytes" + "fmt" + "path" + "regexp" + "sort" + "strings" + "text/template" +) + +// An API defines a service API's definition. and logic to serialize the definition. +type API struct { + Metadata Metadata + Operations map[string]*Operation + Shapes map[string]*Shape + Waiters []Waiter + Documentation string + + // Set to true to avoid removing unused shapes + NoRemoveUnusedShapes bool + + // Set to true to avoid renaming to 'Input/Output' postfixed shapes + NoRenameToplevelShapes bool + + // Set to true to ignore service/request init methods (for testing) + NoInitMethods bool + + // Set to true to ignore String() and GoString methods (for generated tests) + NoStringerMethods bool + + // Set to true to not generate API service name constants + NoConstServiceNames bool + + SvcClientImportPath string + + initialized bool + imports map[string]bool + name string + path string +} + +// A Metadata is the metadata about an API's definition. +type Metadata struct { + APIVersion string + EndpointPrefix string + SigningName string + ServiceAbbreviation string + ServiceFullName string + SignatureVersion string + JSONVersion string + TargetPrefix string + Protocol string +} + +// PackageName name of the API package +func (a *API) PackageName() string { + return strings.ToLower(a.StructName()) +} + +// InterfacePackageName returns the package name for the interface. +func (a *API) InterfacePackageName() string { + return a.PackageName() + "iface" +} + +var nameRegex = regexp.MustCompile(`^Amazon|AWS\s*|\(.*|\s+|\W+`) + +// StructName returns the struct name for a given API. +func (a *API) StructName() string { + if a.name == "" { + name := a.Metadata.ServiceAbbreviation + if name == "" { + name = a.Metadata.ServiceFullName + } + + name = nameRegex.ReplaceAllString(name, "") + switch name { + case "ElasticLoadBalancing": + a.name = "ELB" + case "Config": + a.name = "ConfigService" + default: + a.name = name + } + } + return a.name +} + +// UseInitMethods returns if the service's init method should be rendered. +func (a *API) UseInitMethods() bool { + return !a.NoInitMethods +} + +// NiceName returns the human friendly API name. +func (a *API) NiceName() string { + if a.Metadata.ServiceAbbreviation != "" { + return a.Metadata.ServiceAbbreviation + } + return a.Metadata.ServiceFullName +} + +// ProtocolPackage returns the package name of the protocol this API uses. +func (a *API) ProtocolPackage() string { + switch a.Metadata.Protocol { + case "json": + return "jsonrpc" + case "ec2": + return "ec2query" + default: + return strings.Replace(a.Metadata.Protocol, "-", "", -1) + } +} + +// OperationNames returns a slice of API operations supported. +func (a *API) OperationNames() []string { + i, names := 0, make([]string, len(a.Operations)) + for n := range a.Operations { + names[i] = n + i++ + } + sort.Strings(names) + return names +} + +// OperationList returns a slice of API operation pointers +func (a *API) OperationList() []*Operation { + list := make([]*Operation, len(a.Operations)) + for i, n := range a.OperationNames() { + list[i] = a.Operations[n] + } + return list +} + +// OperationHasOutputPlaceholder returns if any of the API operation input +// or output shapes are place holders. +func (a *API) OperationHasOutputPlaceholder() bool { + for _, op := range a.Operations { + if op.OutputRef.Shape.Placeholder { + return true + } + } + return false +} + +// ShapeNames returns a slice of names for each shape used by the API. +func (a *API) ShapeNames() []string { + i, names := 0, make([]string, len(a.Shapes)) + for n := range a.Shapes { + names[i] = n + i++ + } + sort.Strings(names) + return names +} + +// ShapeList returns a slice of shape pointers used by the API. +func (a *API) ShapeList() []*Shape { + list := make([]*Shape, len(a.Shapes)) + for i, n := range a.ShapeNames() { + list[i] = a.Shapes[n] + } + return list +} + +// resetImports resets the import map to default values. +func (a *API) resetImports() { + a.imports = map[string]bool{ + "github.com/aws/aws-sdk-go/aws": true, + } +} + +// importsGoCode returns the generated Go import code. +func (a *API) importsGoCode() string { + if len(a.imports) == 0 { + return "" + } + + corePkgs, extPkgs := []string{}, []string{} + for i := range a.imports { + if strings.Contains(i, ".") { + extPkgs = append(extPkgs, i) + } else { + corePkgs = append(corePkgs, i) + } + } + sort.Strings(corePkgs) + sort.Strings(extPkgs) + + code := "import (\n" + for _, i := range corePkgs { + code += fmt.Sprintf("\t%q\n", i) + } + if len(corePkgs) > 0 { + code += "\n" + } + for _, i := range extPkgs { + code += fmt.Sprintf("\t%q\n", i) + } + code += ")\n\n" + return code +} + +// A tplAPI is the top level template for the API +var tplAPI = template.Must(template.New("api").Parse(` +{{ range $_, $o := .OperationList }} +{{ $o.GoCode }} + +{{ end }} + +{{ range $_, $s := .ShapeList }} +{{ if and $s.IsInternal (eq $s.Type "structure") }}{{ $s.GoCode }}{{ end }} + +{{ end }} + +{{ range $_, $s := .ShapeList }} +{{ if $s.IsEnum }}{{ $s.GoCode }}{{ end }} + +{{ end }} +`)) + +// APIGoCode renders the API in Go code. Returning it as a string +func (a *API) APIGoCode() string { + a.resetImports() + delete(a.imports, "github.com/aws/aws-sdk-go/aws") + a.imports["github.com/aws/aws-sdk-go/aws/awsutil"] = true + a.imports["github.com/aws/aws-sdk-go/aws/request"] = true + if a.OperationHasOutputPlaceholder() { + a.imports["github.com/aws/aws-sdk-go/private/protocol/"+a.ProtocolPackage()] = true + a.imports["github.com/aws/aws-sdk-go/private/protocol"] = true + } + var buf bytes.Buffer + err := tplAPI.Execute(&buf, a) + if err != nil { + panic(err) + } + + code := a.importsGoCode() + strings.TrimSpace(buf.String()) + return code +} + +// A tplService defines the template for the service generated code. +var tplService = template.Must(template.New("service").Parse(` +{{ .Documentation }}//The service client's operations are safe to be used concurrently. +// It is not safe to mutate any of the client's properties though. +type {{ .StructName }} struct { + *client.Client +} + +{{ if .UseInitMethods }}// Used for custom client initialization logic +var initClient func(*client.Client) + +// Used for custom request initialization logic +var initRequest func(*request.Request) +{{ end }} + +{{ if not .NoConstServiceNames }} +// A ServiceName is the name of the service the client will make API calls to. +const ServiceName = "{{ .Metadata.EndpointPrefix }}" +{{ end }} + +// New creates a new instance of the {{ .StructName }} client with a session. +// If additional configuration is needed for the client instance use the optional +// aws.Config parameter to add your extra config. +// +// Example: +// // Create a {{ .StructName }} client from just a session. +// svc := {{ .PackageName }}.New(mySession) +// +// // Create a {{ .StructName }} client with additional configuration +// svc := {{ .PackageName }}.New(mySession, aws.NewConfig().WithRegion("us-west-2")) +func New(p client.ConfigProvider, cfgs ...*aws.Config) *{{ .StructName }} { + c := p.ClientConfig({{ if .NoConstServiceNames }}"{{ .Metadata.EndpointPrefix }}"{{ else }}ServiceName{{ end }}, cfgs...) + return newClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) +} + +// newClient creates, initializes and returns a new service client instance. +func newClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *{{ .StructName }} { + svc := &{{ .StructName }}{ + Client: client.New( + cfg, + metadata.ClientInfo{ + ServiceName: {{ if .NoConstServiceNames }}"{{ .Metadata.EndpointPrefix }}"{{ else }}ServiceName{{ end }}, {{ if ne .Metadata.SigningName "" }} + SigningName: "{{ .Metadata.SigningName }}",{{ end }} + SigningRegion: signingRegion, + Endpoint: endpoint, + APIVersion: "{{ .Metadata.APIVersion }}", +{{ if eq .Metadata.Protocol "json" }}JSONVersion: "{{ .Metadata.JSONVersion }}", + TargetPrefix: "{{ .Metadata.TargetPrefix }}", +{{ end }} + }, + handlers, + ), + } + + // Handlers + svc.Handlers.Sign.PushBack({{if eq .Metadata.SignatureVersion "v2"}}v2{{else}}v4{{end}}.Sign) + {{if eq .Metadata.SignatureVersion "v2"}}svc.Handlers.Sign.PushBackNamed(corehandlers.BuildContentLengthHandler) + {{end}}svc.Handlers.Build.PushBackNamed({{ .ProtocolPackage }}.BuildHandler) + svc.Handlers.Unmarshal.PushBackNamed({{ .ProtocolPackage }}.UnmarshalHandler) + svc.Handlers.UnmarshalMeta.PushBackNamed({{ .ProtocolPackage }}.UnmarshalMetaHandler) + svc.Handlers.UnmarshalError.PushBackNamed({{ .ProtocolPackage }}.UnmarshalErrorHandler) + + {{ if .UseInitMethods }}// Run custom client initialization if present + if initClient != nil { + initClient(svc.Client) + } + {{ end }} + + return svc +} + +// newRequest creates a new request for a {{ .StructName }} operation and runs any +// custom request initialization. +func (c *{{ .StructName }}) newRequest(op *request.Operation, params, data interface{}) *request.Request { + req := c.NewRequest(op, params, data) + + {{ if .UseInitMethods }}// Run custom request initialization if present + if initRequest != nil { + initRequest(req) + } + {{ end }} + + return req +} +`)) + +// ServiceGoCode renders service go code. Returning it as a string. +func (a *API) ServiceGoCode() string { + a.resetImports() + a.imports["github.com/aws/aws-sdk-go/aws/client"] = true + a.imports["github.com/aws/aws-sdk-go/aws/client/metadata"] = true + a.imports["github.com/aws/aws-sdk-go/aws/request"] = true + if a.Metadata.SignatureVersion == "v2" { + a.imports["github.com/aws/aws-sdk-go/private/signer/v2"] = true + a.imports["github.com/aws/aws-sdk-go/aws/corehandlers"] = true + } else { + a.imports["github.com/aws/aws-sdk-go/private/signer/v4"] = true + } + a.imports["github.com/aws/aws-sdk-go/private/protocol/"+a.ProtocolPackage()] = true + + var buf bytes.Buffer + err := tplService.Execute(&buf, a) + if err != nil { + panic(err) + } + + code := a.importsGoCode() + buf.String() + return code +} + +// ExampleGoCode renders service example code. Returning it as a string. +func (a *API) ExampleGoCode() string { + exs := []string{} + for _, o := range a.OperationList() { + exs = append(exs, o.Example()) + } + + code := fmt.Sprintf("import (\n%q\n%q\n%q\n\n%q\n%q\n%q\n)\n\n"+ + "var _ time.Duration\nvar _ bytes.Buffer\n\n%s", + "bytes", + "fmt", + "time", + "github.com/aws/aws-sdk-go/aws", + "github.com/aws/aws-sdk-go/aws/session", + path.Join(a.SvcClientImportPath, a.PackageName()), + strings.Join(exs, "\n\n"), + ) + return code +} + +// A tplInterface defines the template for the service interface type. +var tplInterface = template.Must(template.New("interface").Parse(` +// {{ .StructName }}API is the interface type for {{ .PackageName }}.{{ .StructName }}. +type {{ .StructName }}API interface { + {{ range $_, $o := .OperationList }} + {{ $o.InterfaceSignature }} + {{ end }} +} + +var _ {{ .StructName }}API = (*{{ .PackageName }}.{{ .StructName }})(nil) +`)) + +// InterfaceGoCode returns the go code for the service's API operations as an +// interface{}. Assumes that the interface is being created in a different +// package than the service API's package. +func (a *API) InterfaceGoCode() string { + a.resetImports() + a.imports = map[string]bool{ + "github.com/aws/aws-sdk-go/aws/request": true, + path.Join(a.SvcClientImportPath, a.PackageName()): true, + } + + var buf bytes.Buffer + err := tplInterface.Execute(&buf, a) + + if err != nil { + panic(err) + } + + code := a.importsGoCode() + strings.TrimSpace(buf.String()) + return code +} + +// NewAPIGoCodeWithPkgName returns a string of instantiating the API prefixed +// with its package name. Takes a string depicting the Config. +func (a *API) NewAPIGoCodeWithPkgName(cfg string) string { + return fmt.Sprintf("%s.New(%s)", a.PackageName(), cfg) +} diff --git a/vendor/github.com/aws/aws-sdk-go/private/model/api/customization_passes.go b/vendor/github.com/aws/aws-sdk-go/private/model/api/customization_passes.go new file mode 100644 index 0000000000..9027f05f44 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/private/model/api/customization_passes.go @@ -0,0 +1,104 @@ +package api + +import ( + "fmt" + "path/filepath" + "strings" +) + +// customizationPasses Executes customization logic for the API by package name. +func (a *API) customizationPasses() { + var svcCustomizations = map[string]func(*API){ + "s3": s3Customizations, + "cloudfront": cloudfrontCustomizations, + "dynamodbstreams": dynamodbstreamsCustomizations, + } + + if fn := svcCustomizations[a.PackageName()]; fn != nil { + fn(a) + } + + blobDocStringCustomizations(a) +} + +const base64MarshalDocStr = "// %s is automatically base64 encoded/decoded by the SDK.\n" + +func blobDocStringCustomizations(a *API) { + for _, s := range a.Shapes { + payloadMemberName := s.Payload + + for refName, ref := range s.MemberRefs { + if refName == payloadMemberName { + // Payload members have their own encoding and may + // be raw bytes or io.Reader + continue + } + if ref.Shape.Type == "blob" { + docStr := fmt.Sprintf(base64MarshalDocStr, refName) + if len(strings.TrimSpace(ref.Shape.Documentation)) != 0 { + ref.Shape.Documentation += "//\n" + docStr + } else if len(strings.TrimSpace(ref.Documentation)) != 0 { + ref.Documentation += "//\n" + docStr + } else { + ref.Documentation = docStr + } + } + } + } +} + +// s3Customizations customizes the API generation to replace values specific to S3. +func s3Customizations(a *API) { + var strExpires *Shape + + for name, s := range a.Shapes { + // Remove ContentMD5 members + if _, ok := s.MemberRefs["ContentMD5"]; ok { + delete(s.MemberRefs, "ContentMD5") + } + + // Expires should be a string not time.Time since the format is not + // enforced by S3, and any value can be set to this field outside of the SDK. + if strings.HasSuffix(name, "Output") { + if ref, ok := s.MemberRefs["Expires"]; ok { + if strExpires == nil { + newShape := *ref.Shape + strExpires = &newShape + strExpires.Type = "string" + strExpires.refs = []*ShapeRef{} + } + ref.Shape.removeRef(ref) + ref.Shape = strExpires + ref.Shape.refs = append(ref.Shape.refs, &s.MemberRef) + } + } + } +} + +// cloudfrontCustomizations customized the API generation to replace values +// specific to CloudFront. +func cloudfrontCustomizations(a *API) { + // MaxItems members should always be integers + for _, s := range a.Shapes { + if ref, ok := s.MemberRefs["MaxItems"]; ok { + ref.ShapeName = "Integer" + ref.Shape = a.Shapes["Integer"] + } + } +} + +// dynamodbstreamsCustomizations references any duplicate shapes from DynamoDB +func dynamodbstreamsCustomizations(a *API) { + p := strings.Replace(a.path, "streams.dynamodb", "dynamodb", -1) + file := filepath.Join(p, "api-2.json") + + dbAPI := API{} + dbAPI.Attach(file) + dbAPI.Setup() + + for n := range a.Shapes { + if _, ok := dbAPI.Shapes[n]; ok { + a.Shapes[n].resolvePkg = "github.com/aws/aws-sdk-go/service/dynamodb" + } + } +} diff --git a/vendor/github.com/aws/aws-sdk-go/private/model/api/docstring.go b/vendor/github.com/aws/aws-sdk-go/private/model/api/docstring.go new file mode 100644 index 0000000000..859aaa4f06 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/private/model/api/docstring.go @@ -0,0 +1,156 @@ +package api + +import ( + "bytes" + "encoding/json" + "fmt" + "html" + "os" + "regexp" + "strings" +) + +type apiDocumentation struct { + *API + Operations map[string]string + Service string + Shapes map[string]shapeDocumentation +} + +type shapeDocumentation struct { + Base string + Refs map[string]string +} + +// AttachDocs attaches documentation from a JSON filename. +func (a *API) AttachDocs(filename string) { + d := apiDocumentation{API: a} + + f, err := os.Open(filename) + defer f.Close() + if err != nil { + panic(err) + } + err = json.NewDecoder(f).Decode(&d) + if err != nil { + panic(err) + } + + d.setup() + +} + +func (d *apiDocumentation) setup() { + d.API.Documentation = docstring(d.Service) + if d.Service == "" { + d.API.Documentation = + fmt.Sprintf("// %s is a client for %s.\n", d.API.StructName(), d.API.NiceName()) + } + + for op, doc := range d.Operations { + d.API.Operations[op].Documentation = docstring(doc) + } + + for shape, info := range d.Shapes { + if sh := d.API.Shapes[shape]; sh != nil { + sh.Documentation = docstring(info.Base) + } + + for ref, doc := range info.Refs { + if doc == "" { + continue + } + + parts := strings.Split(ref, "$") + if sh := d.API.Shapes[parts[0]]; sh != nil { + if m := sh.MemberRefs[parts[1]]; m != nil { + m.Documentation = docstring(doc) + } + } + } + } +} + +var reNewline = regexp.MustCompile(`\r?\n`) +var reMultiSpace = regexp.MustCompile(`\s+`) +var reComments = regexp.MustCompile(``) +var reFullname = regexp.MustCompile(`\s*.+?<\/fullname?>\s*`) +var reExamples = regexp.MustCompile(`.+?<\/examples?>`) +var rePara = regexp.MustCompile(`<(?:p|h\d)>(.+?)`) +var reLink = regexp.MustCompile(`(.+?)`) +var reTag = regexp.MustCompile(`<.+?>`) +var reEndNL = regexp.MustCompile(`\n+$`) + +// docstring rewrites a string to insert godocs formatting. +func docstring(doc string) string { + doc = reNewline.ReplaceAllString(doc, "") + doc = reMultiSpace.ReplaceAllString(doc, " ") + doc = reComments.ReplaceAllString(doc, "") + doc = reFullname.ReplaceAllString(doc, "") + doc = reExamples.ReplaceAllString(doc, "") + doc = rePara.ReplaceAllString(doc, "$1\n\n") + doc = reLink.ReplaceAllString(doc, "$2 ($1)") + doc = reTag.ReplaceAllString(doc, "$1") + doc = reEndNL.ReplaceAllString(doc, "") + doc = strings.TrimSpace(doc) + if doc == "" { + return "\n" + } + + doc = html.UnescapeString(doc) + doc = wrap(doc, 72) + + return commentify(doc) +} + +// commentify converts a string to a Go comment +func commentify(doc string) string { + lines := strings.Split(doc, "\n") + out := []string{} + for i, line := range lines { + if i > 0 && line == "" && lines[i-1] == "" { + continue + } + out = append(out, "// "+line) + } + + return strings.Join(out, "\n") + "\n" +} + +// wrap returns a rewritten version of text to have line breaks +// at approximately length characters. Line breaks will only be +// inserted into whitespace. +func wrap(text string, length int) string { + var buf bytes.Buffer + var last rune + var lastNL bool + var col int + + for _, c := range text { + switch c { + case '\r': // ignore this + continue // and also don't track `last` + case '\n': // ignore this too, but reset col + if col >= length || last == '\n' { + buf.WriteString("\n\n") + } + col = 0 + case ' ', '\t': // opportunity to split + if col >= length { + buf.WriteByte('\n') + col = 0 + } else { + if !lastNL { + buf.WriteRune(c) + } + col++ // count column + } + default: + buf.WriteRune(c) + col++ + } + lastNL = c == '\n' + last = c + } + return buf.String() +} diff --git a/vendor/github.com/aws/aws-sdk-go/private/model/api/exportable_name.go b/vendor/github.com/aws/aws-sdk-go/private/model/api/exportable_name.go new file mode 100644 index 0000000000..efb1356d61 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/private/model/api/exportable_name.go @@ -0,0 +1,12 @@ +package api + +import "strings" + +// ExportableName a name which is exportable as a value or name in Go code +func (a *API) ExportableName(name string) string { + if name == "" { + return name + } + + return strings.ToUpper(name[0:1]) + name[1:] +} diff --git a/vendor/github.com/aws/aws-sdk-go/private/model/api/load.go b/vendor/github.com/aws/aws-sdk-go/private/model/api/load.go new file mode 100644 index 0000000000..2fdf11107b --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/private/model/api/load.go @@ -0,0 +1,64 @@ +package api + +import ( + "encoding/json" + "os" + "path/filepath" +) + +// Load takes a set of files for each filetype and returns an API pointer. +// The API will be initialized once all files have been loaded and parsed. +// +// Will panic if any failure opening the definition JSON files, or there +// are unrecognized exported names. +func Load(api, docs, paginators, waiters string) *API { + a := API{} + a.Attach(api) + a.Attach(docs) + a.Attach(paginators) + a.Attach(waiters) + a.Setup() + return &a +} + +// Attach opens a file by name, and unmarshal its JSON data. +// Will proceed to setup the API if not already done so. +func (a *API) Attach(filename string) { + a.path = filepath.Dir(filename) + f, err := os.Open(filename) + defer f.Close() + if err != nil { + panic(err) + } + json.NewDecoder(f).Decode(a) +} + +// AttachString will unmarshal a raw JSON string, and setup the +// API if not already done so. +func (a *API) AttachString(str string) { + json.Unmarshal([]byte(str), a) + + if !a.initialized { + a.Setup() + } +} + +// Setup initializes the API. +func (a *API) Setup() { + a.writeShapeNames() + a.resolveReferences() + a.fixStutterNames() + a.renameExportable() + if !a.NoRenameToplevelShapes { + a.renameToplevelShapes() + } + a.updateTopLevelShapeReferences() + a.createInputOutputShapes() + a.customizationPasses() + + if !a.NoRemoveUnusedShapes { + a.removeUnusedShapes() + } + + a.initialized = true +} diff --git a/vendor/github.com/aws/aws-sdk-go/private/model/api/operation.go b/vendor/github.com/aws/aws-sdk-go/private/model/api/operation.go new file mode 100644 index 0000000000..4a262cc509 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/private/model/api/operation.go @@ -0,0 +1,314 @@ +package api + +import ( + "bytes" + "fmt" + "regexp" + "sort" + "strings" + "text/template" +) + +// An Operation defines a specific API Operation. +type Operation struct { + API *API `json:"-"` + ExportedName string + Name string + Documentation string + HTTP HTTPInfo + InputRef ShapeRef `json:"input"` + OutputRef ShapeRef `json:"output"` + Paginator *Paginator + Deprecated bool `json:"deprecated"` +} + +// A HTTPInfo defines the method of HTTP request for the Operation. +type HTTPInfo struct { + Method string + RequestURI string + ResponseCode uint +} + +// HasInput returns if the Operation accepts an input paramater +func (o *Operation) HasInput() bool { + return o.InputRef.ShapeName != "" +} + +// HasOutput returns if the Operation accepts an output parameter +func (o *Operation) HasOutput() bool { + return o.OutputRef.ShapeName != "" +} + +// tplOperation defines a template for rendering an API Operation +var tplOperation = template.Must(template.New("operation").Parse(` +const op{{ .ExportedName }} = "{{ .Name }}" + +// {{ .ExportedName }}Request generates a request for the {{ .ExportedName }} operation. +func (c *{{ .API.StructName }}) {{ .ExportedName }}Request(` + + `input {{ .InputRef.GoType }}) (req *request.Request, output {{ .OutputRef.GoType }}) { + {{ if (or .Deprecated (or .InputRef.Deprecated .OutputRef.Deprecated)) }}if c.Client.Config.Logger != nil { + c.Client.Config.Logger.Log("This operation, {{ .ExportedName }}, has been deprecated") + } + op := &request.Operation{ {{ else }} op := &request.Operation{ {{ end }} + Name: op{{ .ExportedName }}, + {{ if ne .HTTP.Method "" }}HTTPMethod: "{{ .HTTP.Method }}", + {{ end }}{{ if ne .HTTP.RequestURI "" }}HTTPPath: "{{ .HTTP.RequestURI }}", + {{ end }}{{ if .Paginator }}Paginator: &request.Paginator{ + InputTokens: {{ .Paginator.InputTokensString }}, + OutputTokens: {{ .Paginator.OutputTokensString }}, + LimitToken: "{{ .Paginator.LimitKey }}", + TruncationToken: "{{ .Paginator.MoreResults }}", + }, + {{ end }} + } + + if input == nil { + input = &{{ .InputRef.GoTypeElem }}{} + } + + req = c.newRequest(op, input, output){{ if eq .OutputRef.Shape.Placeholder true }} + req.Handlers.Unmarshal.Remove({{ .API.ProtocolPackage }}.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler){{ end }} + output = &{{ .OutputRef.GoTypeElem }}{} + req.Data = output + return +} + +{{ .Documentation }}func (c *{{ .API.StructName }}) {{ .ExportedName }}(` + + `input {{ .InputRef.GoType }}) ({{ .OutputRef.GoType }}, error) { + req, out := c.{{ .ExportedName }}Request(input) + err := req.Send() + return out, err +} + +{{ if .Paginator }} +func (c *{{ .API.StructName }}) {{ .ExportedName }}Pages(` + + `input {{ .InputRef.GoType }}, fn func(p {{ .OutputRef.GoType }}, lastPage bool) (shouldContinue bool)) error { + page, _ := c.{{ .ExportedName }}Request(input) + page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) + return page.EachPage(func(p interface{}, lastPage bool) bool { + return fn(p.({{ .OutputRef.GoType }}), lastPage) + }) +} +{{ end }} +`)) + +// GoCode returns a string of rendered GoCode for this Operation +func (o *Operation) GoCode() string { + var buf bytes.Buffer + err := tplOperation.Execute(&buf, o) + if err != nil { + panic(err) + } + + return strings.TrimSpace(buf.String()) +} + +// tplInfSig defines the template for rendering an Operation's signature within an Interface definition. +var tplInfSig = template.Must(template.New("opsig").Parse(` +{{ .ExportedName }}Request({{ .InputRef.GoTypeWithPkgName }}) (*request.Request, {{ .OutputRef.GoTypeWithPkgName }}) + +{{ .ExportedName }}({{ .InputRef.GoTypeWithPkgName }}) ({{ .OutputRef.GoTypeWithPkgName }}, error) +{{ if .Paginator }} +{{ .ExportedName }}Pages({{ .InputRef.GoTypeWithPkgName }}, func({{ .OutputRef.GoTypeWithPkgName }}, bool) bool) error{{ end }} +`)) + +// InterfaceSignature returns a string representing the Operation's interface{} +// functional signature. +func (o *Operation) InterfaceSignature() string { + var buf bytes.Buffer + err := tplInfSig.Execute(&buf, o) + if err != nil { + panic(err) + } + + return strings.TrimSpace(buf.String()) +} + +// tplExample defines the template for rendering an Operation example +var tplExample = template.Must(template.New("operationExample").Parse(` +func Example{{ .API.StructName }}_{{ .ExportedName }}() { + svc := {{ .API.PackageName }}.New(session.New()) + + {{ .ExampleInput }} + resp, err := svc.{{ .ExportedName }}(params) + + if err != nil { + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return + } + + // Pretty-print the response data. + fmt.Println(resp) +} +`)) + +// Example returns a string of the rendered Go code for the Operation +func (o *Operation) Example() string { + var buf bytes.Buffer + err := tplExample.Execute(&buf, o) + if err != nil { + panic(err) + } + + return strings.TrimSpace(buf.String()) +} + +// ExampleInput return a string of the rendered Go code for an example's input parameters +func (o *Operation) ExampleInput() string { + if len(o.InputRef.Shape.MemberRefs) == 0 { + return fmt.Sprintf("var params *%s.%s", + o.API.PackageName(), o.InputRef.GoTypeElem()) + } + e := example{o, map[string]int{}} + return "params := " + e.traverseAny(o.InputRef.Shape, false, false) +} + +// A example provides +type example struct { + *Operation + visited map[string]int +} + +// traverseAny returns rendered Go code for the shape. +func (e *example) traverseAny(s *Shape, required, payload bool) string { + str := "" + e.visited[s.ShapeName]++ + + switch s.Type { + case "structure": + str = e.traverseStruct(s, required, payload) + case "list": + str = e.traverseList(s, required, payload) + case "map": + str = e.traverseMap(s, required, payload) + default: + str = e.traverseScalar(s, required, payload) + } + + e.visited[s.ShapeName]-- + + return str +} + +var reType = regexp.MustCompile(`\b([A-Z])`) + +// traverseStruct returns rendered Go code for a structure type shape. +func (e *example) traverseStruct(s *Shape, required, payload bool) string { + var buf bytes.Buffer + buf.WriteString("&" + s.API.PackageName() + "." + s.GoTypeElem() + "{") + if required { + buf.WriteString(" // Required") + } + buf.WriteString("\n") + + req := make([]string, len(s.Required)) + copy(req, s.Required) + sort.Strings(req) + + if e.visited[s.ShapeName] < 2 { + for _, n := range req { + m := s.MemberRefs[n].Shape + p := n == s.Payload && (s.MemberRefs[n].Streaming || m.Streaming) + buf.WriteString(n + ": " + e.traverseAny(m, true, p) + ",") + if m.Type != "list" && m.Type != "structure" && m.Type != "map" { + buf.WriteString(" // Required") + } + buf.WriteString("\n") + } + + for _, n := range s.MemberNames() { + if s.IsRequired(n) { + continue + } + m := s.MemberRefs[n].Shape + p := n == s.Payload && (s.MemberRefs[n].Streaming || m.Streaming) + buf.WriteString(n + ": " + e.traverseAny(m, false, p) + ",\n") + } + } else { + buf.WriteString("// Recursive values...\n") + } + + buf.WriteString("}") + return buf.String() +} + +// traverseMap returns rendered Go code for a map type shape. +func (e *example) traverseMap(s *Shape, required, payload bool) string { + var buf bytes.Buffer + t := reType.ReplaceAllString(s.GoTypeElem(), s.API.PackageName()+".$1") + buf.WriteString(t + "{") + if required { + buf.WriteString(" // Required") + } + buf.WriteString("\n") + + if e.visited[s.ShapeName] < 2 { + m := s.ValueRef.Shape + buf.WriteString("\"Key\": " + e.traverseAny(m, true, false) + ",") + if m.Type != "list" && m.Type != "structure" && m.Type != "map" { + buf.WriteString(" // Required") + } + buf.WriteString("\n// More values...\n") + } else { + buf.WriteString("// Recursive values...\n") + } + buf.WriteString("}") + + return buf.String() +} + +// traverseList returns rendered Go code for a list type shape. +func (e *example) traverseList(s *Shape, required, payload bool) string { + var buf bytes.Buffer + t := reType.ReplaceAllString(s.GoTypeElem(), s.API.PackageName()+".$1") + buf.WriteString(t + "{") + if required { + buf.WriteString(" // Required") + } + buf.WriteString("\n") + + if e.visited[s.ShapeName] < 2 { + m := s.MemberRef.Shape + buf.WriteString(e.traverseAny(m, true, false) + ",") + if m.Type != "list" && m.Type != "structure" && m.Type != "map" { + buf.WriteString(" // Required") + } + buf.WriteString("\n// More values...\n") + } else { + buf.WriteString("// Recursive values...\n") + } + buf.WriteString("}") + + return buf.String() +} + +// traverseScalar returns an AWS Type string representation initialized to a value. +// Will panic if s is an unsupported shape type. +func (e *example) traverseScalar(s *Shape, required, payload bool) string { + str := "" + switch s.Type { + case "integer", "long": + str = `aws.Int64(1)` + case "float", "double": + str = `aws.Float64(1.0)` + case "string", "character": + str = `aws.String("` + s.ShapeName + `")` + case "blob": + if payload { + str = `bytes.NewReader([]byte("PAYLOAD"))` + } else { + str = `[]byte("PAYLOAD")` + } + case "boolean": + str = `aws.Bool(true)` + case "timestamp": + str = `aws.Time(time.Now())` + default: + panic("unsupported shape " + s.Type) + } + + return str +} diff --git a/vendor/github.com/aws/aws-sdk-go/private/model/api/pagination.go b/vendor/github.com/aws/aws-sdk-go/private/model/api/pagination.go new file mode 100644 index 0000000000..c07820dd73 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/private/model/api/pagination.go @@ -0,0 +1,89 @@ +package api + +import ( + "encoding/json" + "fmt" + "os" +) + +// Paginator keeps track of pagination configuration for an API operation. +type Paginator struct { + InputTokens interface{} `json:"input_token"` + OutputTokens interface{} `json:"output_token"` + LimitKey string `json:"limit_key"` + MoreResults string `json:"more_results"` +} + +// InputTokensString returns output tokens formatted as a list +func (p *Paginator) InputTokensString() string { + str := p.InputTokens.([]string) + return fmt.Sprintf("%#v", str) +} + +// OutputTokensString returns output tokens formatted as a list +func (p *Paginator) OutputTokensString() string { + str := p.OutputTokens.([]string) + return fmt.Sprintf("%#v", str) +} + +// used for unmarshaling from the paginators JSON file +type paginationDefinitions struct { + *API + Pagination map[string]Paginator +} + +// AttachPaginators attaches pagination configuration from filename to the API. +func (a *API) AttachPaginators(filename string) { + p := paginationDefinitions{API: a} + + f, err := os.Open(filename) + defer f.Close() + if err != nil { + panic(err) + } + err = json.NewDecoder(f).Decode(&p) + if err != nil { + panic(err) + } + + p.setup() +} + +// setup runs post-processing on the paginator configuration. +func (p *paginationDefinitions) setup() { + for n, e := range p.Pagination { + if e.InputTokens == nil || e.OutputTokens == nil { + continue + } + paginator := e + + switch t := paginator.InputTokens.(type) { + case string: + paginator.InputTokens = []string{t} + case []interface{}: + toks := []string{} + for _, e := range t { + s := e.(string) + toks = append(toks, s) + } + paginator.InputTokens = toks + } + switch t := paginator.OutputTokens.(type) { + case string: + paginator.OutputTokens = []string{t} + case []interface{}: + toks := []string{} + for _, e := range t { + s := e.(string) + toks = append(toks, s) + } + paginator.OutputTokens = toks + } + + if o, ok := p.Operations[n]; ok { + o.Paginator = &paginator + } else { + panic("unknown operation for paginator " + n) + } + } +} diff --git a/vendor/github.com/aws/aws-sdk-go/private/model/api/passes.go b/vendor/github.com/aws/aws-sdk-go/private/model/api/passes.go new file mode 100644 index 0000000000..3492d58d19 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/private/model/api/passes.go @@ -0,0 +1,255 @@ +package api + +import ( + "fmt" + "regexp" + "strings" +) + +// updateTopLevelShapeReferences moves resultWrapper, locationName, and +// xmlNamespace traits from toplevel shape references to the toplevel +// shapes for easier code generation +func (a *API) updateTopLevelShapeReferences() { + for _, o := range a.Operations { + // these are for REST-XML services + if o.InputRef.LocationName != "" { + o.InputRef.Shape.LocationName = o.InputRef.LocationName + } + if o.InputRef.Location != "" { + o.InputRef.Shape.Location = o.InputRef.Location + } + if o.InputRef.Payload != "" { + o.InputRef.Shape.Payload = o.InputRef.Payload + } + if o.InputRef.XMLNamespace.Prefix != "" { + o.InputRef.Shape.XMLNamespace.Prefix = o.InputRef.XMLNamespace.Prefix + } + if o.InputRef.XMLNamespace.URI != "" { + o.InputRef.Shape.XMLNamespace.URI = o.InputRef.XMLNamespace.URI + } + } + +} + +// writeShapeNames sets each shape's API and shape name values. Binding the +// shape to its parent API. +func (a *API) writeShapeNames() { + for n, s := range a.Shapes { + s.API = a + s.ShapeName = n + } +} + +func (a *API) resolveReferences() { + resolver := referenceResolver{API: a, visited: map[*ShapeRef]bool{}} + + for _, s := range a.Shapes { + resolver.resolveShape(s) + } + + for _, o := range a.Operations { + o.API = a // resolve parent reference + + resolver.resolveReference(&o.InputRef) + resolver.resolveReference(&o.OutputRef) + } +} + +// A referenceResolver provides a way to resolve shape references to +// shape definitions. +type referenceResolver struct { + *API + visited map[*ShapeRef]bool +} + +// resolveReference updates a shape reference to reference the API and +// its shape definition. All other nested references are also resolved. +func (r *referenceResolver) resolveReference(ref *ShapeRef) { + if ref.ShapeName == "" { + return + } + + if shape, ok := r.API.Shapes[ref.ShapeName]; ok { + ref.API = r.API // resolve reference back to API + ref.Shape = shape // resolve shape reference + + if r.visited[ref] { + return + } + r.visited[ref] = true + + shape.refs = append(shape.refs, ref) // register the ref + + // resolve shape's references, if it has any + r.resolveShape(shape) + } +} + +// resolveShape resolves a shape's Member Key Value, and nested member +// shape references. +func (r *referenceResolver) resolveShape(shape *Shape) { + r.resolveReference(&shape.MemberRef) + r.resolveReference(&shape.KeyRef) + r.resolveReference(&shape.ValueRef) + for _, m := range shape.MemberRefs { + r.resolveReference(m) + } +} + +// renameToplevelShapes renames all top level shapes of an API to their +// exportable variant. The shapes are also updated to include notations +// if they are Input or Outputs. +func (a *API) renameToplevelShapes() { + for _, v := range a.Operations { + if v.HasInput() { + name := v.ExportedName + "Input" + switch n := len(v.InputRef.Shape.refs); { + case n == 1 && a.Shapes[name] == nil: + v.InputRef.Shape.Rename(name) + } + } + if v.HasOutput() { + name := v.ExportedName + "Output" + switch n := len(v.OutputRef.Shape.refs); { + case n == 1 && a.Shapes[name] == nil: + v.OutputRef.Shape.Rename(name) + } + } + v.InputRef.Payload = a.ExportableName(v.InputRef.Payload) + v.OutputRef.Payload = a.ExportableName(v.OutputRef.Payload) + } +} + +// fixStutterNames fixes all name struttering based on Go naming conventions. +// "Stuttering" is when the prefix of a structure or function matches the +// package name (case insensitive). +func (a *API) fixStutterNames() { + str, end := a.StructName(), "" + if len(str) > 1 { + l := len(str) - 1 + str, end = str[0:l], str[l:] + } + re := regexp.MustCompile(fmt.Sprintf(`\A(?i:%s)%s`, str, end)) + + for name, op := range a.Operations { + newName := re.ReplaceAllString(name, "") + if newName != name { + delete(a.Operations, name) + a.Operations[newName] = op + } + op.ExportedName = newName + } + + for k, s := range a.Shapes { + newName := re.ReplaceAllString(k, "") + if newName != s.ShapeName { + s.Rename(newName) + } + } +} + +// renameExportable renames all operation names to be exportable names. +// All nested Shape names are also updated to the exportable variant. +func (a *API) renameExportable() { + for name, op := range a.Operations { + newName := a.ExportableName(name) + if newName != name { + delete(a.Operations, name) + a.Operations[newName] = op + } + op.ExportedName = newName + } + + for k, s := range a.Shapes { + // FIXME SNS has lower and uppercased shape names with the same name, + // except the lowercased variant is used exclusively for string and + // other primitive types. Renaming both would cause a collision. + // We work around this by only renaming the structure shapes. + if s.Type == "string" { + continue + } + + for mName, member := range s.MemberRefs { + newName := a.ExportableName(mName) + if newName != mName { + delete(s.MemberRefs, mName) + s.MemberRefs[newName] = member + + // also apply locationName trait so we keep the old one + // but only if there's no locationName trait on ref or shape + if member.LocationName == "" && member.Shape.LocationName == "" { + member.LocationName = mName + } + } + + if newName == "_" { + panic("Shape " + s.ShapeName + " uses reserved member name '_'") + } + } + + newName := a.ExportableName(k) + if newName != s.ShapeName { + s.Rename(newName) + } + + s.Payload = a.ExportableName(s.Payload) + + // fix required trait names + for i, n := range s.Required { + s.Required[i] = a.ExportableName(n) + } + } + + for _, s := range a.Shapes { + // fix enum names + if s.IsEnum() { + s.EnumConsts = make([]string, len(s.Enum)) + for i := range s.Enum { + shape := s.ShapeName + shape = strings.ToUpper(shape[0:1]) + shape[1:] + s.EnumConsts[i] = shape + s.EnumName(i) + } + } + } +} + +// createInputOutputShapes creates toplevel input/output shapes if they +// have not been defined in the API. This normalizes all APIs to always +// have an input and output structure in the signature. +func (a *API) createInputOutputShapes() { + for _, op := range a.Operations { + if !op.HasInput() { + setAsPlacholderShape(&op.InputRef, op.ExportedName+"Input", a) + } + if !op.HasOutput() { + setAsPlacholderShape(&op.OutputRef, op.ExportedName+"Output", a) + } + } +} + +func setAsPlacholderShape(tgtShapeRef *ShapeRef, name string, a *API) { + shape := a.makeIOShape(name) + shape.Placeholder = true + *tgtShapeRef = ShapeRef{API: a, ShapeName: shape.ShapeName, Shape: shape} + shape.refs = append(shape.refs, tgtShapeRef) +} + +// makeIOShape returns a pointer to a new Shape initialized by the name provided. +func (a *API) makeIOShape(name string) *Shape { + shape := &Shape{ + API: a, ShapeName: name, Type: "structure", + MemberRefs: map[string]*ShapeRef{}, + } + a.Shapes[name] = shape + return shape +} + +// removeUnusedShapes removes shapes from the API which are not referenced by any +// other shape in the API. +func (a *API) removeUnusedShapes() { + for n, s := range a.Shapes { + if len(s.refs) == 0 { + delete(a.Shapes, n) + } + } +} diff --git a/vendor/github.com/aws/aws-sdk-go/private/model/api/shape.go b/vendor/github.com/aws/aws-sdk-go/private/model/api/shape.go new file mode 100644 index 0000000000..5b45103ed1 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/private/model/api/shape.go @@ -0,0 +1,448 @@ +package api + +import ( + "bytes" + "fmt" + "path" + "regexp" + "sort" + "strings" + "text/template" + + "github.com/aws/aws-sdk-go/private/util" +) + +// A ShapeRef defines the usage of a shape within the API. +type ShapeRef struct { + API *API `json:"-"` + Shape *Shape `json:"-"` + Documentation string + ShapeName string `json:"shape"` + Location string + LocationName string + QueryName string + Flattened bool + Streaming bool + XMLAttribute bool + XMLNamespace XMLInfo + Payload string + IdempotencyToken bool `json:"idempotencyToken"` + Deprecated bool `json:"deprecated"` +} + +// A XMLInfo defines URL and prefix for Shapes when rendered as XML +type XMLInfo struct { + Prefix string + URI string +} + +// A Shape defines the definition of a shape type +type Shape struct { + API *API `json:"-"` + ShapeName string + Documentation string + MemberRefs map[string]*ShapeRef `json:"members"` + MemberRef ShapeRef `json:"member"` + KeyRef ShapeRef `json:"key"` + ValueRef ShapeRef `json:"value"` + Required []string + Payload string + Type string + Exception bool + Enum []string + EnumConsts []string + Flattened bool + Streaming bool + Location string + LocationName string + IdempotencyToken bool `json:"idempotencyToken"` + XMLNamespace XMLInfo + Min int // optional Minimum length (string, list) or value (number) + Max int // optional Minimum length (string, list) or value (number) + + refs []*ShapeRef // References to this shape + resolvePkg string // use this package in the goType() if present + + // Defines if the shape is a placeholder and should not be used directly + Placeholder bool + + Deprecated bool `json:"deprecated"` +} + +// Rename changes the name of the Shape to newName. Also updates +// the associated API's reference to use newName. +func (s *Shape) Rename(newName string) { + for _, r := range s.refs { + r.ShapeName = newName + } + + delete(s.API.Shapes, s.ShapeName) + s.API.Shapes[newName] = s + s.ShapeName = newName +} + +// MemberNames returns a slice of struct member names. +func (s *Shape) MemberNames() []string { + i, names := 0, make([]string, len(s.MemberRefs)) + for n := range s.MemberRefs { + names[i] = n + i++ + } + sort.Strings(names) + return names +} + +// GoTypeWithPkgName returns a shape's type as a string with the package name in +// . format. Package naming only applies to structures. +func (s *Shape) GoTypeWithPkgName() string { + return goType(s, true) +} + +// GoType returns a shape's Go type +func (s *Shape) GoType() string { + return goType(s, false) +} + +// GoType returns a shape ref's Go type. +func (ref *ShapeRef) GoType() string { + if ref.Shape == nil { + panic(fmt.Errorf("missing shape definition on reference for %#v", ref)) + } + + return ref.Shape.GoType() +} + +// GoTypeWithPkgName returns a shape's type as a string with the package name in +// . format. Package naming only applies to structures. +func (ref *ShapeRef) GoTypeWithPkgName() string { + if ref.Shape == nil { + panic(fmt.Errorf("missing shape definition on reference for %#v", ref)) + } + + return ref.Shape.GoTypeWithPkgName() +} + +// Returns a string version of the Shape's type. +// If withPkgName is true, the package name will be added as a prefix +func goType(s *Shape, withPkgName bool) string { + switch s.Type { + case "structure": + if withPkgName || s.resolvePkg != "" { + pkg := s.resolvePkg + if pkg != "" { + s.API.imports[pkg] = true + pkg = path.Base(pkg) + } else { + pkg = s.API.PackageName() + } + return fmt.Sprintf("*%s.%s", pkg, s.ShapeName) + } + return "*" + s.ShapeName + case "map": + return "map[string]" + s.ValueRef.GoType() + case "list": + return "[]" + s.MemberRef.GoType() + case "boolean": + return "*bool" + case "string", "character": + return "*string" + case "blob": + return "[]byte" + case "integer", "long": + return "*int64" + case "float", "double": + return "*float64" + case "timestamp": + s.API.imports["time"] = true + return "*time.Time" + default: + panic("Unsupported shape type: " + s.Type) + } +} + +// GoTypeElem returns the Go type for the Shape. If the shape type is a pointer just +// the type will be returned minus the pointer *. +func (s *Shape) GoTypeElem() string { + t := s.GoType() + if strings.HasPrefix(t, "*") { + return t[1:] + } + return t +} + +// GoTypeElem returns the Go type for the Shape. If the shape type is a pointer just +// the type will be returned minus the pointer *. +func (ref *ShapeRef) GoTypeElem() string { + if ref.Shape == nil { + panic(fmt.Errorf("missing shape definition on reference for %#v", ref)) + } + + return ref.Shape.GoTypeElem() +} + +// ShapeTag is a struct tag that will be applied to a shape's generated code +type ShapeTag struct { + Key, Val string +} + +// String returns the string representation of the shape tag +func (s ShapeTag) String() string { + return fmt.Sprintf(`%s:"%s"`, s.Key, s.Val) +} + +// ShapeTags is a collection of shape tags and provides serialization of the +// tags in an ordered list. +type ShapeTags []ShapeTag + +// Join returns an ordered serialization of the shape tags with the provided +// seperator. +func (s ShapeTags) Join(sep string) string { + o := &bytes.Buffer{} + for i, t := range s { + o.WriteString(t.String()) + if i < len(s)-1 { + o.WriteString(sep) + } + } + + return o.String() +} + +// String is an alias for Join with the empty space seperator. +func (s ShapeTags) String() string { + return s.Join(" ") +} + +// GoTags returns the rendered tags string for the ShapeRef +func (ref *ShapeRef) GoTags(toplevel bool, isRequired bool) string { + tags := ShapeTags{} + + if ref.Location != "" { + tags = append(tags, ShapeTag{"location", ref.Location}) + } else if ref.Shape.Location != "" { + tags = append(tags, ShapeTag{"location", ref.Shape.Location}) + } + + if ref.LocationName != "" { + tags = append(tags, ShapeTag{"locationName", ref.LocationName}) + } else if ref.Shape.LocationName != "" { + tags = append(tags, ShapeTag{"locationName", ref.Shape.LocationName}) + } + + if ref.QueryName != "" { + tags = append(tags, ShapeTag{"queryName", ref.QueryName}) + } + if ref.Shape.MemberRef.LocationName != "" { + tags = append(tags, ShapeTag{"locationNameList", ref.Shape.MemberRef.LocationName}) + } + if ref.Shape.KeyRef.LocationName != "" { + tags = append(tags, ShapeTag{"locationNameKey", ref.Shape.KeyRef.LocationName}) + } + if ref.Shape.ValueRef.LocationName != "" { + tags = append(tags, ShapeTag{"locationNameValue", ref.Shape.ValueRef.LocationName}) + } + if ref.Shape.Min > 0 { + tags = append(tags, ShapeTag{"min", fmt.Sprintf("%d", ref.Shape.Min)}) + } + + if ref.Deprecated || ref.Shape.Deprecated { + tags = append(tags, ShapeTag{"deprecated", "true"}) + } + // All shapes have a type + tags = append(tags, ShapeTag{"type", ref.Shape.Type}) + + // embed the timestamp type for easier lookups + if ref.Shape.Type == "timestamp" { + t := ShapeTag{Key: "timestampFormat"} + if ref.Location == "header" { + t.Val = "rfc822" + } else { + switch ref.API.Metadata.Protocol { + case "json", "rest-json": + t.Val = "unix" + case "rest-xml", "ec2", "query": + t.Val = "iso8601" + } + } + tags = append(tags, t) + } + + if ref.Shape.Flattened || ref.Flattened { + tags = append(tags, ShapeTag{"flattened", "true"}) + } + if ref.XMLAttribute { + tags = append(tags, ShapeTag{"xmlAttribute", "true"}) + } + if isRequired { + tags = append(tags, ShapeTag{"required", "true"}) + } + if ref.Shape.IsEnum() { + tags = append(tags, ShapeTag{"enum", ref.ShapeName}) + } + + if toplevel { + if ref.Shape.Payload != "" { + tags = append(tags, ShapeTag{"payload", ref.Shape.Payload}) + } + if ref.XMLNamespace.Prefix != "" { + tags = append(tags, ShapeTag{"xmlPrefix", ref.XMLNamespace.Prefix}) + } else if ref.Shape.XMLNamespace.Prefix != "" { + tags = append(tags, ShapeTag{"xmlPrefix", ref.Shape.XMLNamespace.Prefix}) + } + if ref.XMLNamespace.URI != "" { + tags = append(tags, ShapeTag{"xmlURI", ref.XMLNamespace.URI}) + } else if ref.Shape.XMLNamespace.URI != "" { + tags = append(tags, ShapeTag{"xmlURI", ref.Shape.XMLNamespace.URI}) + } + } + + if ref.IdempotencyToken || ref.Shape.IdempotencyToken { + tags = append(tags, ShapeTag{"idempotencyToken", "true"}) + } + + return fmt.Sprintf("`%s`", tags) +} + +// Docstring returns the godocs formated documentation +func (ref *ShapeRef) Docstring() string { + if ref.Documentation != "" { + return ref.Documentation + } + return ref.Shape.Docstring() +} + +// Docstring returns the godocs formated documentation +func (s *Shape) Docstring() string { + return s.Documentation +} + +var goCodeStringerTmpl = template.Must(template.New("goCodeStringerTmpl").Parse(` +// String returns the string representation +func (s {{ .ShapeName }}) String() string { + return awsutil.Prettify(s) +} +// GoString returns the string representation +func (s {{ .ShapeName }}) GoString() string { + return s.String() +} +`)) + +func (s *Shape) goCodeStringers() string { + w := bytes.Buffer{} + if err := goCodeStringerTmpl.Execute(&w, s); err != nil { + panic(fmt.Sprintln("Unexpected error executing goCodeStringers template", err)) + } + + return w.String() +} + +var enumStrip = regexp.MustCompile(`[^a-zA-Z0-9_:\./-]`) +var enumDelims = regexp.MustCompile(`[-_:\./]+`) +var enumCamelCase = regexp.MustCompile(`([a-z])([A-Z])`) + +// EnumName returns the Nth enum in the shapes Enum list +func (s *Shape) EnumName(n int) string { + enum := s.Enum[n] + enum = enumStrip.ReplaceAllLiteralString(enum, "") + enum = enumCamelCase.ReplaceAllString(enum, "$1-$2") + parts := enumDelims.Split(enum, -1) + for i, v := range parts { + v = strings.ToLower(v) + parts[i] = "" + if len(v) > 0 { + parts[i] = strings.ToUpper(v[0:1]) + } + if len(v) > 1 { + parts[i] += v[1:] + } + } + enum = strings.Join(parts, "") + enum = strings.ToUpper(enum[0:1]) + enum[1:] + return enum +} + +// GoCode returns the rendered Go code for the Shape. +func (s *Shape) GoCode() string { + code := s.Docstring() + if !s.IsEnum() { + code += "type " + s.ShapeName + " " + } + + switch { + case s.Type == "structure": + ref := &ShapeRef{ShapeName: s.ShapeName, API: s.API, Shape: s} + + code += "struct {\n" + code += "_ struct{} " + ref.GoTags(true, false) + "\n\n" + for _, n := range s.MemberNames() { + m := s.MemberRefs[n] + code += m.Docstring() + if (m.Streaming || m.Shape.Streaming) && s.Payload == n { + rtype := "io.ReadSeeker" + if len(s.refs) > 1 { + rtype = "aws.ReaderSeekCloser" + } else if strings.HasSuffix(s.ShapeName, "Output") { + rtype = "io.ReadCloser" + } + + s.API.imports["io"] = true + code += n + " " + rtype + " " + m.GoTags(false, s.IsRequired(n)) + "\n\n" + } else { + code += n + " " + m.GoType() + " " + m.GoTags(false, s.IsRequired(n)) + "\n\n" + } + } + code += "}" + + if !s.API.NoStringerMethods { + code += s.goCodeStringers() + } + case s.IsEnum(): + code += "const (\n" + for n, e := range s.Enum { + code += fmt.Sprintf("\t// @enum %s\n\t%s = %q\n", + s.ShapeName, s.EnumConsts[n], e) + } + code += ")" + default: + panic("Cannot generate toplevel shape for " + s.Type) + } + + return util.GoFmt(code) +} + +// IsEnum returns whether this shape is an enum list +func (s *Shape) IsEnum() bool { + return s.Type == "string" && len(s.Enum) > 0 +} + +// IsRequired returns if member is a required field. +func (s *Shape) IsRequired(member string) bool { + for _, n := range s.Required { + if n == member { + return true + } + } + return false +} + +// IsInternal returns whether the shape was defined in this package +func (s *Shape) IsInternal() bool { + return s.resolvePkg == "" +} + +// removeRef removes a shape reference from the list of references this +// shape is used in. +func (s *Shape) removeRef(ref *ShapeRef) { + r := s.refs + for i := 0; i < len(r); i++ { + if r[i] == ref { + j := i + 1 + copy(r[i:], r[j:]) + for k, n := len(r)-j+i, len(r); k < n; k++ { + r[k] = nil // free up the end of the list + } // for k + s.refs = r[:len(r)-j+i] + break + } + } +} diff --git a/vendor/github.com/aws/aws-sdk-go/private/model/api/waiters.go b/vendor/github.com/aws/aws-sdk-go/private/model/api/waiters.go new file mode 100644 index 0000000000..ab33c92af2 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/private/model/api/waiters.go @@ -0,0 +1,133 @@ +package api + +import ( + "bytes" + "encoding/json" + "fmt" + "os" + "sort" + "text/template" +) + +// A Waiter is an individual waiter definition. +type Waiter struct { + Name string + Delay int + MaxAttempts int + OperationName string `json:"operation"` + Operation *Operation + Acceptors []WaitAcceptor +} + +// A WaitAcceptor is an individual wait acceptor definition. +type WaitAcceptor struct { + Expected interface{} + Matcher string + State string + Argument string +} + +// WaitersGoCode generates and returns Go code for each of the waiters of +// this API. +func (a *API) WaitersGoCode() string { + var buf bytes.Buffer + fmt.Fprintf(&buf, "import (\n\t%q\n)", + "github.com/aws/aws-sdk-go/private/waiter") + + for _, w := range a.Waiters { + buf.WriteString(w.GoCode()) + } + return buf.String() +} + +// used for unmarshaling from the waiter JSON file +type waiterDefinitions struct { + *API + Waiters map[string]Waiter +} + +// AttachWaiters reads a file of waiter definitions, and adds those to the API. +// Will panic if an error occurs. +func (a *API) AttachWaiters(filename string) { + p := waiterDefinitions{API: a} + + f, err := os.Open(filename) + defer f.Close() + if err != nil { + panic(err) + } + err = json.NewDecoder(f).Decode(&p) + if err != nil { + panic(err) + } + + p.setup() +} + +func (p *waiterDefinitions) setup() { + p.API.Waiters = []Waiter{} + i, keys := 0, make([]string, len(p.Waiters)) + for k := range p.Waiters { + keys[i] = k + i++ + } + sort.Strings(keys) + + for _, n := range keys { + e := p.Waiters[n] + n = p.ExportableName(n) + e.Name = n + e.OperationName = p.ExportableName(e.OperationName) + e.Operation = p.API.Operations[e.OperationName] + if e.Operation == nil { + panic("unknown operation " + e.OperationName + " for waiter " + n) + } + p.API.Waiters = append(p.API.Waiters, e) + } +} + +// ExpectedString returns the string that was expected by the WaitAcceptor +func (a *WaitAcceptor) ExpectedString() string { + switch a.Expected.(type) { + case string: + return fmt.Sprintf("%q", a.Expected) + default: + return fmt.Sprintf("%v", a.Expected) + } +} + +var tplWaiter = template.Must(template.New("waiter").Parse(` +func (c *{{ .Operation.API.StructName }}) WaitUntil{{ .Name }}(input {{ .Operation.InputRef.GoType }}) error { + waiterCfg := waiter.Config{ + Operation: "{{ .OperationName }}", + Delay: {{ .Delay }}, + MaxAttempts: {{ .MaxAttempts }}, + Acceptors: []waiter.WaitAcceptor{ + {{ range $_, $a := .Acceptors }}waiter.WaitAcceptor{ + State: "{{ .State }}", + Matcher: "{{ .Matcher }}", + Argument: "{{ .Argument }}", + Expected: {{ .ExpectedString }}, + }, + {{ end }} + }, + } + + w := waiter.Waiter{ + Client: c, + Input: input, + Config: waiterCfg, + } + return w.Wait() +} +`)) + +// GoCode returns the generated Go code for an individual waiter. +func (w *Waiter) GoCode() string { + var buf bytes.Buffer + if err := tplWaiter.Execute(&buf, w); err != nil { + panic(err) + } + + return buf.String() +} diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/ec2query/build.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/ec2query/build.go index 0ead0126ee..68e344d1fc 100644 --- a/vendor/github.com/aws/aws-sdk-go/private/protocol/ec2query/build.go +++ b/vendor/github.com/aws/aws-sdk-go/private/protocol/ec2query/build.go @@ -11,6 +11,9 @@ import ( "github.com/aws/aws-sdk-go/private/protocol/query/queryutil" ) +// BuildHandler is a named request handler for building ec2query protocol requests +var BuildHandler = request.NamedHandler{Name: "awssdk.ec2query.Build", Fn: Build} + // Build builds a request for the EC2 protocol. func Build(r *request.Request) { body := url.Values{ diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/ec2query/unmarshal.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/ec2query/unmarshal.go index 658190f705..631e63c0b5 100644 --- a/vendor/github.com/aws/aws-sdk-go/private/protocol/ec2query/unmarshal.go +++ b/vendor/github.com/aws/aws-sdk-go/private/protocol/ec2query/unmarshal.go @@ -11,6 +11,15 @@ import ( "github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil" ) +// UnmarshalHandler is a named request handler for unmarshaling ec2query protocol requests +var UnmarshalHandler = request.NamedHandler{Name: "awssdk.ec2query.Unmarshal", Fn: Unmarshal} + +// UnmarshalMetaHandler is a named request handler for unmarshaling ec2query protocol request metadata +var UnmarshalMetaHandler = request.NamedHandler{Name: "awssdk.ec2query.UnmarshalMeta", Fn: UnmarshalMeta} + +// UnmarshalErrorHandler is a named request handler for unmarshaling ec2query protocol request errors +var UnmarshalErrorHandler = request.NamedHandler{Name: "awssdk.ec2query.UnmarshalError", Fn: UnmarshalError} + // Unmarshal unmarshals a response body for the EC2 protocol. func Unmarshal(r *request.Request) { defer r.HTTPResponse.Body.Close() @@ -33,7 +42,7 @@ type xmlErrorResponse struct { XMLName xml.Name `xml:"Response"` Code string `xml:"Errors>Error>Code"` Message string `xml:"Errors>Error>Message"` - RequestID string `xml:"RequestId"` + RequestID string `xml:"RequestID"` } // UnmarshalError unmarshals a response error for the EC2 protocol. diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/idempotency.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/idempotency.go new file mode 100644 index 0000000000..53831dff98 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/private/protocol/idempotency.go @@ -0,0 +1,75 @@ +package protocol + +import ( + "crypto/rand" + "fmt" + "reflect" +) + +// RandReader is the random reader the protocol package will use to read +// random bytes from. This is exported for testing, and should not be used. +var RandReader = rand.Reader + +const idempotencyTokenFillTag = `idempotencyToken` + +// CanSetIdempotencyToken returns true if the struct field should be +// automatically populated with a Idempotency token. +// +// Only *string and string type fields that are tagged with idempotencyToken +// which are not already set can be auto filled. +func CanSetIdempotencyToken(v reflect.Value, f reflect.StructField) bool { + switch u := v.Interface().(type) { + // To auto fill an Idempotency token the field must be a string, + // tagged for auto fill, and have a zero value. + case *string: + return u == nil && len(f.Tag.Get(idempotencyTokenFillTag)) != 0 + case string: + return len(u) == 0 && len(f.Tag.Get(idempotencyTokenFillTag)) != 0 + } + + return false +} + +// GetIdempotencyToken returns a randomly generated idempotency token. +func GetIdempotencyToken() string { + b := make([]byte, 16) + RandReader.Read(b) + + return UUIDVersion4(b) +} + +// SetIdempotencyToken will set the value provided with a Idempotency Token. +// Given that the value can be set. Will panic if value is not setable. +func SetIdempotencyToken(v reflect.Value) { + if v.Kind() == reflect.Ptr { + if v.IsNil() && v.CanSet() { + v.Set(reflect.New(v.Type().Elem())) + } + v = v.Elem() + } + v = reflect.Indirect(v) + + if !v.CanSet() { + panic(fmt.Sprintf("unable to set idempotnecy token %v", v)) + } + + b := make([]byte, 16) + _, err := rand.Read(b) + if err != nil { + // TODO handle error + return + } + + v.Set(reflect.ValueOf(UUIDVersion4(b))) +} + +// UUIDVersion4 returns a Version 4 random UUID from the byte slice provided +func UUIDVersion4(u []byte) string { + // https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_4_.28random.29 + // 13th character is "4" + u[6] = (u[6] | 0x40) & 0x4F + // 17th character is "8", "9", "a", or "b" + u[8] = (u[8] | 0x80) & 0xBF + + return fmt.Sprintf(`%X-%X-%X-%X-%X`, u[0:4], u[4:6], u[6:8], u[8:10], u[10:]) +} diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/json/jsonutil/build.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/json/jsonutil/build.go index 870707c6a6..1d552afe45 100644 --- a/vendor/github.com/aws/aws-sdk-go/private/protocol/json/jsonutil/build.go +++ b/vendor/github.com/aws/aws-sdk-go/private/protocol/json/jsonutil/build.go @@ -9,6 +9,8 @@ import ( "sort" "strconv" "time" + + "github.com/aws/aws-sdk-go/private/protocol" ) var timeType = reflect.ValueOf(time.Time{}).Type() @@ -85,11 +87,8 @@ func buildStruct(value reflect.Value, buf *bytes.Buffer, tag reflect.StructTag) first := true for i := 0; i < t.NumField(); i++ { member := value.Field(i) - if (member.Kind() == reflect.Ptr || member.Kind() == reflect.Slice || member.Kind() == reflect.Map) && member.IsNil() { - continue // ignore unset fields - } - field := t.Field(i) + if field.PkgPath != "" { continue // ignore unexported fields } @@ -100,6 +99,15 @@ func buildStruct(value reflect.Value, buf *bytes.Buffer, tag reflect.StructTag) continue // ignore non-body elements } + if protocol.CanSetIdempotencyToken(member, field) { + token := protocol.GetIdempotencyToken() + member = reflect.ValueOf(&token) + } + + if (member.Kind() == reflect.Ptr || member.Kind() == reflect.Slice || member.Kind() == reflect.Map) && member.IsNil() { + continue // ignore unset fields + } + if first { first = false } else { diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/jsonrpc/jsonrpc.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/jsonrpc/jsonrpc.go index c4e71cf487..7aff0e0fa4 100644 --- a/vendor/github.com/aws/aws-sdk-go/private/protocol/jsonrpc/jsonrpc.go +++ b/vendor/github.com/aws/aws-sdk-go/private/protocol/jsonrpc/jsonrpc.go @@ -18,6 +18,18 @@ import ( var emptyJSON = []byte("{}") +// BuildHandler is a named request handler for building jsonrpc protocol requests +var BuildHandler = request.NamedHandler{Name: "awssdk.jsonrpc.Build", Fn: Build} + +// UnmarshalHandler is a named request handler for unmarshaling jsonrpc protocol requests +var UnmarshalHandler = request.NamedHandler{Name: "awssdk.jsonrpc.Unmarshal", Fn: Unmarshal} + +// UnmarshalMetaHandler is a named request handler for unmarshaling jsonrpc protocol request metadata +var UnmarshalMetaHandler = request.NamedHandler{Name: "awssdk.jsonrpc.UnmarshalMeta", Fn: UnmarshalMeta} + +// UnmarshalErrorHandler is a named request handler for unmarshaling jsonrpc protocol request errors +var UnmarshalErrorHandler = request.NamedHandler{Name: "awssdk.jsonrpc.UnmarshalError", Fn: UnmarshalError} + // Build builds a JSON payload for a JSON RPC request. func Build(req *request.Request) { var buf []byte diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/query/build.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/query/build.go index 2d78c35c24..56d69db05c 100644 --- a/vendor/github.com/aws/aws-sdk-go/private/protocol/query/build.go +++ b/vendor/github.com/aws/aws-sdk-go/private/protocol/query/build.go @@ -11,6 +11,9 @@ import ( "github.com/aws/aws-sdk-go/private/protocol/query/queryutil" ) +// BuildHandler is a named request handler for building query protocol requests +var BuildHandler = request.NamedHandler{Name: "awssdk.query.Build", Fn: Build} + // Build builds a request for an AWS Query service. func Build(r *request.Request) { body := url.Values{ diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/query/queryutil/queryutil.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/query/queryutil/queryutil.go index 4afa4cf0ee..60ea0bd1e5 100644 --- a/vendor/github.com/aws/aws-sdk-go/private/protocol/query/queryutil/queryutil.go +++ b/vendor/github.com/aws/aws-sdk-go/private/protocol/query/queryutil/queryutil.go @@ -9,6 +9,8 @@ import ( "strconv" "strings" "time" + + "github.com/aws/aws-sdk-go/private/protocol" ) // Parse parses an object i and fills a url.Values object. The isEC2 flag @@ -68,14 +70,19 @@ func (q *queryParser) parseStruct(v url.Values, value reflect.Value, prefix stri t := value.Type() for i := 0; i < value.NumField(); i++ { - if c := t.Field(i).Name[0:1]; strings.ToLower(c) == c { + elemValue := elemOf(value.Field(i)) + field := t.Field(i) + + if field.PkgPath != "" { continue // ignore unexported fields } - elemValue := elemOf(value.Field(i)) - field := t.Field(i) - var name string + if protocol.CanSetIdempotencyToken(value.Field(i), field) { + token := protocol.GetIdempotencyToken() + elemValue = reflect.ValueOf(token) + } + var name string if q.isEC2 { name = field.Tag.Get("queryName") } diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/query/unmarshal.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/query/unmarshal.go index 1fcab1d1a1..a3ea40955d 100644 --- a/vendor/github.com/aws/aws-sdk-go/private/protocol/query/unmarshal.go +++ b/vendor/github.com/aws/aws-sdk-go/private/protocol/query/unmarshal.go @@ -10,6 +10,12 @@ import ( "github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil" ) +// UnmarshalHandler is a named request handler for unmarshaling query protocol requests +var UnmarshalHandler = request.NamedHandler{Name: "awssdk.query.Unmarshal", Fn: Unmarshal} + +// UnmarshalMetaHandler is a named request handler for unmarshaling query protocol request metadata +var UnmarshalMetaHandler = request.NamedHandler{Name: "awssdk.query.UnmarshalMeta", Fn: UnmarshalMeta} + // Unmarshal unmarshals a response for an AWS Query service. func Unmarshal(r *request.Request) { defer r.HTTPResponse.Body.Close() @@ -25,5 +31,5 @@ func Unmarshal(r *request.Request) { // UnmarshalMeta unmarshals header response values for an AWS Query service. func UnmarshalMeta(r *request.Request) { - // TODO implement unmarshaling of request IDs + r.RequestID = r.HTTPResponse.Header.Get("X-Amzn-Requestid") } diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/query/unmarshal_error.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/query/unmarshal_error.go index 08609d9208..f214296171 100644 --- a/vendor/github.com/aws/aws-sdk-go/private/protocol/query/unmarshal_error.go +++ b/vendor/github.com/aws/aws-sdk-go/private/protocol/query/unmarshal_error.go @@ -2,7 +2,7 @@ package query import ( "encoding/xml" - "io" + "io/ioutil" "github.com/aws/aws-sdk-go/aws/awserr" "github.com/aws/aws-sdk-go/aws/request" @@ -15,19 +15,52 @@ type xmlErrorResponse struct { RequestID string `xml:"RequestId"` } +type xmlServiceUnavailableResponse struct { + XMLName xml.Name `xml:"ServiceUnavailableException"` +} + +// UnmarshalErrorHandler is a name request handler to unmarshal request errors +var UnmarshalErrorHandler = request.NamedHandler{Name: "awssdk.query.UnmarshalError", Fn: UnmarshalError} + // UnmarshalError unmarshals an error response for an AWS Query service. func UnmarshalError(r *request.Request) { defer r.HTTPResponse.Body.Close() - resp := &xmlErrorResponse{} - err := xml.NewDecoder(r.HTTPResponse.Body).Decode(resp) - if err != nil && err != io.EOF { - r.Error = awserr.New("SerializationError", "failed to decode query XML error response", err) - } else { + bodyBytes, err := ioutil.ReadAll(r.HTTPResponse.Body) + if err != nil { + r.Error = awserr.New("SerializationError", "failed to read from query HTTP response body", err) + return + } + + // First check for specific error + resp := xmlErrorResponse{} + decodeErr := xml.Unmarshal(bodyBytes, &resp) + if decodeErr == nil { + reqID := resp.RequestID + if reqID == "" { + reqID = r.RequestID + } r.Error = awserr.NewRequestFailure( awserr.New(resp.Code, resp.Message, nil), r.HTTPResponse.StatusCode, - resp.RequestID, + reqID, ) + return } + + // Check for unhandled error + servUnavailResp := xmlServiceUnavailableResponse{} + unavailErr := xml.Unmarshal(bodyBytes, &servUnavailResp) + if unavailErr == nil { + r.Error = awserr.NewRequestFailure( + awserr.New("ServiceUnavailableException", "service is unavailable", nil), + r.HTTPResponse.StatusCode, + r.RequestID, + ) + return + } + + // Failed to retrieve any error message from the response body + r.Error = awserr.New("SerializationError", + "failed to decode query XML error response", decodeErr) } diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/rest/build.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/rest/build.go index ed3c2e0395..5f412516dc 100644 --- a/vendor/github.com/aws/aws-sdk-go/private/protocol/rest/build.go +++ b/vendor/github.com/aws/aws-sdk-go/private/protocol/rest/build.go @@ -39,6 +39,9 @@ func init() { } } +// BuildHandler is a named request handler for building rest protocol requests +var BuildHandler = request.NamedHandler{Name: "awssdk.rest.Build", Fn: Build} + // Build builds the REST component of a service request. func Build(r *request.Request) { if r.ParamsFilled() { @@ -219,8 +222,7 @@ func EscapePath(path string, encodeSep bool) string { if noEscape[c] || (c == '/' && !encodeSep) { buf.WriteByte(c) } else { - buf.WriteByte('%') - buf.WriteString(strings.ToUpper(strconv.FormatUint(uint64(c), 16))) + fmt.Fprintf(&buf, "%%%02X", c) } } return buf.String() diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/rest/unmarshal.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/rest/unmarshal.go index 27f47b02c7..2cba1d9aa7 100644 --- a/vendor/github.com/aws/aws-sdk-go/private/protocol/rest/unmarshal.go +++ b/vendor/github.com/aws/aws-sdk-go/private/protocol/rest/unmarshal.go @@ -3,6 +3,7 @@ package rest import ( "encoding/base64" "fmt" + "io" "io/ioutil" "net/http" "reflect" @@ -15,6 +16,12 @@ import ( "github.com/aws/aws-sdk-go/aws/request" ) +// UnmarshalHandler is a named request handler for unmarshaling rest protocol requests +var UnmarshalHandler = request.NamedHandler{Name: "awssdk.rest.Unmarshal", Fn: Unmarshal} + +// UnmarshalMetaHandler is a named request handler for unmarshaling rest protocol request metadata +var UnmarshalMetaHandler = request.NamedHandler{Name: "awssdk.rest.UnmarshalMeta", Fn: UnmarshalMeta} + // Unmarshal unmarshals the REST component of a response in a REST service. func Unmarshal(r *request.Request) { if r.DataFilled() { @@ -26,6 +33,10 @@ func Unmarshal(r *request.Request) { // UnmarshalMeta unmarshals the REST metadata of a response in a REST service func UnmarshalMeta(r *request.Request) { r.RequestID = r.HTTPResponse.Header.Get("X-Amzn-Requestid") + if r.RequestID == "" { + // Alternative version of request id in the header + r.RequestID = r.HTTPResponse.Header.Get("X-Amz-Request-Id") + } if r.DataFilled() { v := reflect.Indirect(reflect.ValueOf(r.Data)) unmarshalLocationElements(r, v) @@ -41,6 +52,7 @@ func unmarshalBody(r *request.Request, v reflect.Value) { if payload.IsValid() { switch payload.Interface().(type) { case []byte: + defer r.HTTPResponse.Body.Close() b, err := ioutil.ReadAll(r.HTTPResponse.Body) if err != nil { r.Error = awserr.New("SerializationError", "failed to decode REST response", err) @@ -48,6 +60,7 @@ func unmarshalBody(r *request.Request, v reflect.Value) { payload.Set(reflect.ValueOf(b)) } case *string: + defer r.HTTPResponse.Body.Close() b, err := ioutil.ReadAll(r.HTTPResponse.Body) if err != nil { r.Error = awserr.New("SerializationError", "failed to decode REST response", err) @@ -62,6 +75,8 @@ func unmarshalBody(r *request.Request, v reflect.Value) { case "aws.ReadSeekCloser", "io.ReadCloser": payload.Set(reflect.ValueOf(r.HTTPResponse.Body)) default: + io.Copy(ioutil.Discard, r.HTTPResponse.Body) + defer r.HTTPResponse.Body.Close() r.Error = awserr.New("SerializationError", "failed to decode REST response", fmt.Errorf("unknown payload type %s", payload.Type())) diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/restjson/restjson.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/restjson/restjson.go index f0c85c0a30..2c95a98588 100644 --- a/vendor/github.com/aws/aws-sdk-go/private/protocol/restjson/restjson.go +++ b/vendor/github.com/aws/aws-sdk-go/private/protocol/restjson/restjson.go @@ -16,6 +16,18 @@ import ( "github.com/aws/aws-sdk-go/private/protocol/rest" ) +// BuildHandler is a named request handler for building restjson protocol requests +var BuildHandler = request.NamedHandler{Name: "awssdk.restjson.Build", Fn: Build} + +// UnmarshalHandler is a named request handler for unmarshaling restjson protocol requests +var UnmarshalHandler = request.NamedHandler{Name: "awssdk.restjson.Unmarshal", Fn: Unmarshal} + +// UnmarshalMetaHandler is a named request handler for unmarshaling restjson protocol request metadata +var UnmarshalMetaHandler = request.NamedHandler{Name: "awssdk.restjson.UnmarshalMeta", Fn: UnmarshalMeta} + +// UnmarshalErrorHandler is a named request handler for unmarshaling restjson protocol request errors +var UnmarshalErrorHandler = request.NamedHandler{Name: "awssdk.restjson.UnmarshalError", Fn: UnmarshalError} + // Build builds a request for the REST JSON protocol. func Build(r *request.Request) { rest.Build(r) @@ -41,6 +53,7 @@ func UnmarshalMeta(r *request.Request) { // UnmarshalError unmarshals a response error for the REST JSON protocol. func UnmarshalError(r *request.Request) { + defer r.HTTPResponse.Body.Close() code := r.HTTPResponse.Header.Get("X-Amzn-Errortype") bodyBytes, err := ioutil.ReadAll(r.HTTPResponse.Body) if err != nil { diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/restxml/restxml.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/restxml/restxml.go index a6bc0c74c8..c74088bfe8 100644 --- a/vendor/github.com/aws/aws-sdk-go/private/protocol/restxml/restxml.go +++ b/vendor/github.com/aws/aws-sdk-go/private/protocol/restxml/restxml.go @@ -16,6 +16,18 @@ import ( "github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil" ) +// BuildHandler is a named request handler for building restxml protocol requests +var BuildHandler = request.NamedHandler{Name: "awssdk.restxml.Build", Fn: Build} + +// UnmarshalHandler is a named request handler for unmarshaling restxml protocol requests +var UnmarshalHandler = request.NamedHandler{Name: "awssdk.restxml.Unmarshal", Fn: Unmarshal} + +// UnmarshalMetaHandler is a named request handler for unmarshaling restxml protocol request metadata +var UnmarshalMetaHandler = request.NamedHandler{Name: "awssdk.restxml.UnmarshalMeta", Fn: UnmarshalMeta} + +// UnmarshalErrorHandler is a named request handler for unmarshaling restxml protocol request errors +var UnmarshalErrorHandler = request.NamedHandler{Name: "awssdk.restxml.UnmarshalError", Fn: UnmarshalError} + // Build builds a request payload for the REST XML protocol. func Build(r *request.Request) { rest.Build(r) diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/unmarshal.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/unmarshal.go new file mode 100644 index 0000000000..da1a68111d --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/private/protocol/unmarshal.go @@ -0,0 +1,21 @@ +package protocol + +import ( + "io" + "io/ioutil" + + "github.com/aws/aws-sdk-go/aws/request" +) + +// UnmarshalDiscardBodyHandler is a named request handler to empty and close a response's body +var UnmarshalDiscardBodyHandler = request.NamedHandler{Name: "awssdk.shared.UnmarshalDiscardBody", Fn: UnmarshalDiscardBody} + +// UnmarshalDiscardBody is a request handler to empty a response's body and closing it. +func UnmarshalDiscardBody(r *request.Request) { + if r.HTTPResponse == nil || r.HTTPResponse.Body == nil { + return + } + + io.Copy(ioutil.Discard, r.HTTPResponse.Body) + r.HTTPResponse.Body.Close() +} diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil/build.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil/build.go index 0d76dffbd6..ceb4132c53 100644 --- a/vendor/github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil/build.go +++ b/vendor/github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil/build.go @@ -8,8 +8,9 @@ import ( "reflect" "sort" "strconv" - "strings" "time" + + "github.com/aws/aws-sdk-go/private/protocol" ) // BuildXML will serialize params into an xml.Encoder. @@ -120,18 +121,23 @@ func (b *xmlBuilder) buildStruct(value reflect.Value, current *XMLNode, tag refl t := value.Type() for i := 0; i < value.NumField(); i++ { - if c := t.Field(i).Name[0:1]; strings.ToLower(c) == c { + member := elemOf(value.Field(i)) + field := t.Field(i) + + if field.PkgPath != "" { continue // ignore unexported fields } - member := elemOf(value.Field(i)) - field := t.Field(i) mTag := field.Tag - if mTag.Get("location") != "" { // skip non-body members continue } + if protocol.CanSetIdempotencyToken(value.Field(i), field) { + token := protocol.GetIdempotencyToken() + member = reflect.ValueOf(token) + } + memberName := mTag.Get("locationName") if memberName == "" { memberName = field.Name diff --git a/vendor/github.com/aws/aws-sdk-go/private/signer/v4/header_rules.go b/vendor/github.com/aws/aws-sdk-go/private/signer/v4/header_rules.go new file mode 100644 index 0000000000..244c86da05 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/private/signer/v4/header_rules.go @@ -0,0 +1,82 @@ +package v4 + +import ( + "net/http" + "strings" +) + +// validator houses a set of rule needed for validation of a +// string value +type rules []rule + +// rule interface allows for more flexible rules and just simply +// checks whether or not a value adheres to that rule +type rule interface { + IsValid(value string) bool +} + +// IsValid will iterate through all rules and see if any rules +// apply to the value and supports nested rules +func (r rules) IsValid(value string) bool { + for _, rule := range r { + if rule.IsValid(value) { + return true + } + } + return false +} + +// mapRule generic rule for maps +type mapRule map[string]struct{} + +// IsValid for the map rule satisfies whether it exists in the map +func (m mapRule) IsValid(value string) bool { + _, ok := m[value] + return ok +} + +// whitelist is a generic rule for whitelisting +type whitelist struct { + rule +} + +// IsValid for whitelist checks if the value is within the whitelist +func (w whitelist) IsValid(value string) bool { + return w.rule.IsValid(value) +} + +// blacklist is a generic rule for blacklisting +type blacklist struct { + rule +} + +// IsValid for whitelist checks if the value is within the whitelist +func (b blacklist) IsValid(value string) bool { + return !b.rule.IsValid(value) +} + +type patterns []string + +// IsValid for patterns checks each pattern and returns if a match has +// been found +func (p patterns) IsValid(value string) bool { + for _, pattern := range p { + if strings.HasPrefix(http.CanonicalHeaderKey(value), pattern) { + return true + } + } + return false +} + +// inclusiveRules rules allow for rules to depend on one another +type inclusiveRules []rule + +// IsValid will return true if all rules are true +func (r inclusiveRules) IsValid(value string) bool { + for _, rule := range r { + if !rule.IsValid(value) { + return false + } + } + return true +} diff --git a/vendor/github.com/aws/aws-sdk-go/private/signer/v4/v4.go b/vendor/github.com/aws/aws-sdk-go/private/signer/v4/v4.go index dc176f312b..8bfe5d08d2 100644 --- a/vendor/github.com/aws/aws-sdk-go/private/signer/v4/v4.go +++ b/vendor/github.com/aws/aws-sdk-go/private/signer/v4/v4.go @@ -26,11 +26,67 @@ const ( shortTimeFormat = "20060102" ) -var ignoredHeaders = map[string]bool{ - "Authorization": true, - "Content-Type": true, - "Content-Length": true, - "User-Agent": true, +var ignoredHeaders = rules{ + blacklist{ + mapRule{ + "Authorization": struct{}{}, + "Content-Length": struct{}{}, + "User-Agent": struct{}{}, + }, + }, +} + +// requiredSignedHeaders is a whitelist for build canonical headers. +var requiredSignedHeaders = rules{ + whitelist{ + mapRule{ + "Cache-Control": struct{}{}, + "Content-Disposition": struct{}{}, + "Content-Encoding": struct{}{}, + "Content-Language": struct{}{}, + "Content-Md5": struct{}{}, + "Content-Type": struct{}{}, + "Expires": struct{}{}, + "If-Match": struct{}{}, + "If-Modified-Since": struct{}{}, + "If-None-Match": struct{}{}, + "If-Unmodified-Since": struct{}{}, + "Range": struct{}{}, + "X-Amz-Acl": struct{}{}, + "X-Amz-Copy-Source": struct{}{}, + "X-Amz-Copy-Source-If-Match": struct{}{}, + "X-Amz-Copy-Source-If-Modified-Since": struct{}{}, + "X-Amz-Copy-Source-If-None-Match": struct{}{}, + "X-Amz-Copy-Source-If-Unmodified-Since": struct{}{}, + "X-Amz-Copy-Source-Range": struct{}{}, + "X-Amz-Copy-Source-Server-Side-Encryption-Customer-Algorithm": struct{}{}, + "X-Amz-Copy-Source-Server-Side-Encryption-Customer-Key": struct{}{}, + "X-Amz-Copy-Source-Server-Side-Encryption-Customer-Key-Md5": struct{}{}, + "X-Amz-Grant-Full-control": struct{}{}, + "X-Amz-Grant-Read": struct{}{}, + "X-Amz-Grant-Read-Acp": struct{}{}, + "X-Amz-Grant-Write": struct{}{}, + "X-Amz-Grant-Write-Acp": struct{}{}, + "X-Amz-Metadata-Directive": struct{}{}, + "X-Amz-Mfa": struct{}{}, + "X-Amz-Request-Payer": struct{}{}, + "X-Amz-Server-Side-Encryption": struct{}{}, + "X-Amz-Server-Side-Encryption-Aws-Kms-Key-Id": struct{}{}, + "X-Amz-Server-Side-Encryption-Customer-Algorithm": struct{}{}, + "X-Amz-Server-Side-Encryption-Customer-Key": struct{}{}, + "X-Amz-Server-Side-Encryption-Customer-Key-Md5": struct{}{}, + "X-Amz-Storage-Class": struct{}{}, + "X-Amz-Website-Redirect-Location": struct{}{}, + }, + }, + patterns{"X-Amz-Meta-"}, +} + +// allowedHoisting is a whitelist for build query headers. The boolean value +// represents whether or not it is a pattern. +var allowedQueryHoisting = inclusiveRules{ + blacklist{requiredSignedHeaders}, + patterns{"X-Amz-"}, } type signer struct { @@ -57,6 +113,8 @@ type signer struct { stringToSign string signature string authorization string + notHoist bool + signedHeaderVals http.Header } // Sign requests with signature version 4. @@ -92,9 +150,11 @@ func Sign(req *request.Request) { Credentials: req.Config.Credentials, Debug: req.Config.LogLevel.Value(), Logger: req.Config.Logger, + notHoist: req.NotHoist, } req.Error = s.sign() + req.SignedHeaderVals = s.signedHeaderVals } func (v4 *signer) sign() error { @@ -165,15 +225,25 @@ func (v4 *signer) logSigningInfo() { } func (v4 *signer) build() { + v4.buildTime() // no depends v4.buildCredentialString() // no depends + + unsignedHeaders := v4.Request.Header if v4.isPresign { - v4.buildQuery() // no depends + if !v4.notHoist { + urlValues := url.Values{} + urlValues, unsignedHeaders = buildQuery(allowedQueryHoisting, unsignedHeaders) // no depends + for k := range urlValues { + v4.Query[k] = urlValues[k] + } + } } - v4.buildCanonicalHeaders() // depends on cred string - v4.buildCanonicalString() // depends on canon headers / signed headers - v4.buildStringToSign() // depends on canon string - v4.buildSignature() // depends on string to sign + + v4.buildCanonicalHeaders(ignoredHeaders, unsignedHeaders) + v4.buildCanonicalString() // depends on canon headers / signed headers + v4.buildStringToSign() // depends on canon string + v4.buildSignature() // depends on string to sign if v4.isPresign { v4.Request.URL.RawQuery += "&X-Amz-Signature=" + v4.signature @@ -213,31 +283,40 @@ func (v4 *signer) buildCredentialString() { } } -func (v4 *signer) buildQuery() { - for k, h := range v4.Request.Header { - if strings.HasPrefix(http.CanonicalHeaderKey(k), "X-Amz-") { - continue // never hoist x-amz-* headers, they must be signed - } - if _, ok := ignoredHeaders[http.CanonicalHeaderKey(k)]; ok { - continue // never hoist ignored headers - } - - v4.Request.Header.Del(k) - v4.Query.Del(k) - for _, v := range h { - v4.Query.Add(k, v) +func buildQuery(r rule, header http.Header) (url.Values, http.Header) { + query := url.Values{} + unsignedHeaders := http.Header{} + for k, h := range header { + if r.IsValid(k) { + query[k] = h + } else { + unsignedHeaders[k] = h } } -} -func (v4 *signer) buildCanonicalHeaders() { + return query, unsignedHeaders +} +func (v4 *signer) buildCanonicalHeaders(r rule, header http.Header) { var headers []string headers = append(headers, "host") - for k := range v4.Request.Header { - if _, ok := ignoredHeaders[http.CanonicalHeaderKey(k)]; ok { + for k, v := range header { + canonicalKey := http.CanonicalHeaderKey(k) + if !r.IsValid(canonicalKey) { continue // ignored header } - headers = append(headers, strings.ToLower(k)) + if v4.signedHeaderVals == nil { + v4.signedHeaderVals = make(http.Header) + } + + lowerCaseKey := strings.ToLower(k) + if _, ok := v4.signedHeaderVals[lowerCaseKey]; ok { + // include additional values + v4.signedHeaderVals[lowerCaseKey] = append(v4.signedHeaderVals[lowerCaseKey], v...) + continue + } + + headers = append(headers, lowerCaseKey) + v4.signedHeaderVals[lowerCaseKey] = v } sort.Strings(headers) @@ -253,7 +332,7 @@ func (v4 *signer) buildCanonicalHeaders() { headerValues[i] = "host:" + v4.Request.URL.Host } else { headerValues[i] = k + ":" + - strings.Join(v4.Request.Header[http.CanonicalHeaderKey(k)], ",") + strings.Join(v4.signedHeaderVals[k], ",") } } diff --git a/vendor/github.com/aws/aws-sdk-go/private/util/util.go b/vendor/github.com/aws/aws-sdk-go/private/util/util.go new file mode 100644 index 0000000000..5f2dab25e2 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/private/util/util.go @@ -0,0 +1,109 @@ +package util + +import ( + "bytes" + "encoding/xml" + "fmt" + "go/format" + "io" + "reflect" + "regexp" + "strings" + + "github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil" +) + +// GoFmt returns the Go formated string of the input. +// +// Panics if the format fails. +func GoFmt(buf string) string { + formatted, err := format.Source([]byte(buf)) + if err != nil { + panic(fmt.Errorf("%s\nOriginal code:\n%s", err.Error(), buf)) + } + return string(formatted) +} + +var reTrim = regexp.MustCompile(`\s{2,}`) + +// Trim removes all leading and trailing white space. +// +// All consecutive spaces will be reduced to a single space. +func Trim(s string) string { + return strings.TrimSpace(reTrim.ReplaceAllString(s, " ")) +} + +// Capitalize capitalizes the first character of the string. +func Capitalize(s string) string { + if len(s) == 1 { + return strings.ToUpper(s) + } + return strings.ToUpper(s[0:1]) + s[1:] +} + +// SortXML sorts the reader's XML elements +func SortXML(r io.Reader) string { + var buf bytes.Buffer + d := xml.NewDecoder(r) + root, _ := xmlutil.XMLToStruct(d, nil) + e := xml.NewEncoder(&buf) + xmlutil.StructToXML(e, root, true) + return buf.String() +} + +// PrettyPrint generates a human readable representation of the value v. +// All values of v are recursively found and pretty printed also. +func PrettyPrint(v interface{}) string { + value := reflect.ValueOf(v) + switch value.Kind() { + case reflect.Struct: + str := fullName(value.Type()) + "{\n" + for i := 0; i < value.NumField(); i++ { + l := string(value.Type().Field(i).Name[0]) + if strings.ToUpper(l) == l { + str += value.Type().Field(i).Name + ": " + str += PrettyPrint(value.Field(i).Interface()) + str += ",\n" + } + } + str += "}" + return str + case reflect.Map: + str := "map[" + fullName(value.Type().Key()) + "]" + fullName(value.Type().Elem()) + "{\n" + for _, k := range value.MapKeys() { + str += "\"" + k.String() + "\": " + str += PrettyPrint(value.MapIndex(k).Interface()) + str += ",\n" + } + str += "}" + return str + case reflect.Ptr: + if e := value.Elem(); e.IsValid() { + return "&" + PrettyPrint(e.Interface()) + } + return "nil" + case reflect.Slice: + str := "[]" + fullName(value.Type().Elem()) + "{\n" + for i := 0; i < value.Len(); i++ { + str += PrettyPrint(value.Index(i).Interface()) + str += ",\n" + } + str += "}" + return str + default: + return fmt.Sprintf("%#v", v) + } +} + +func pkgName(t reflect.Type) string { + pkg := t.PkgPath() + c := strings.Split(pkg, "/") + return c[len(c)-1] +} + +func fullName(t reflect.Type) string { + if pkg := pkgName(t); pkg != "" { + return pkg + "." + t.Name() + } + return t.Name() +} diff --git a/vendor/github.com/aws/aws-sdk-go/private/waiter/waiter.go b/vendor/github.com/aws/aws-sdk-go/private/waiter/waiter.go index e5fb13666a..b51e9449c1 100644 --- a/vendor/github.com/aws/aws-sdk-go/private/waiter/waiter.go +++ b/vendor/github.com/aws/aws-sdk-go/private/waiter/waiter.go @@ -51,17 +51,15 @@ func (w *Waiter) Wait() error { err := req.Send() for _, a := range w.Acceptors { - if err != nil && a.Matcher != "error" { - // Only matcher error is valid if there is a request error - continue - } - result := false var vals []interface{} switch a.Matcher { case "pathAll", "path": // Require all matches to be equal for result to match vals, _ = awsutil.ValuesAtPath(req.Data, a.Argument) + if len(vals) == 0 { + break + } result = true for _, val := range vals { if !awsutil.DeepEqual(val, a.Expected) { diff --git a/vendor/github.com/aws/aws-sdk-go/service/acm/api.go b/vendor/github.com/aws/aws-sdk-go/service/acm/api.go new file mode 100644 index 0000000000..c5232a1f66 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/service/acm/api.go @@ -0,0 +1,739 @@ +// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. + +// Package acm provides a client for AWS Certificate Manager. +package acm + +import ( + "time" + + "github.com/aws/aws-sdk-go/aws/awsutil" + "github.com/aws/aws-sdk-go/aws/request" + "github.com/aws/aws-sdk-go/private/protocol" + "github.com/aws/aws-sdk-go/private/protocol/jsonrpc" +) + +const opDeleteCertificate = "DeleteCertificate" + +// DeleteCertificateRequest generates a request for the DeleteCertificate operation. +func (c *ACM) DeleteCertificateRequest(input *DeleteCertificateInput) (req *request.Request, output *DeleteCertificateOutput) { + op := &request.Operation{ + Name: opDeleteCertificate, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &DeleteCertificateInput{} + } + + req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(jsonrpc.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) + output = &DeleteCertificateOutput{} + req.Data = output + return +} + +// Deletes an ACM Certificate and its associated private key. If this action +// succeeds, the certificate no longer appears in the list of ACM Certificates +// that can be displayed by calling the ListCertificates action or be retrieved +// by calling the GetCertificate action. The certificate will not be available +// for use by other AWS services. +// +// You cannot delete an ACM Certificate that is being used by another AWS service. +// To delete a certificate that is in use, the certificate association must +// first be removed. +func (c *ACM) DeleteCertificate(input *DeleteCertificateInput) (*DeleteCertificateOutput, error) { + req, out := c.DeleteCertificateRequest(input) + err := req.Send() + return out, err +} + +const opDescribeCertificate = "DescribeCertificate" + +// DescribeCertificateRequest generates a request for the DescribeCertificate operation. +func (c *ACM) DescribeCertificateRequest(input *DescribeCertificateInput) (req *request.Request, output *DescribeCertificateOutput) { + op := &request.Operation{ + Name: opDescribeCertificate, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &DescribeCertificateInput{} + } + + req = c.newRequest(op, input, output) + output = &DescribeCertificateOutput{} + req.Data = output + return +} + +// Returns a list of the fields contained in the specified ACM Certificate. +// For example, this action returns the certificate status, a flag that indicates +// whether the certificate is associated with any other AWS service, and the +// date at which the certificate request was created. The ACM Certificate is +// specified on input by its Amazon Resource Name (ARN). +func (c *ACM) DescribeCertificate(input *DescribeCertificateInput) (*DescribeCertificateOutput, error) { + req, out := c.DescribeCertificateRequest(input) + err := req.Send() + return out, err +} + +const opGetCertificate = "GetCertificate" + +// GetCertificateRequest generates a request for the GetCertificate operation. +func (c *ACM) GetCertificateRequest(input *GetCertificateInput) (req *request.Request, output *GetCertificateOutput) { + op := &request.Operation{ + Name: opGetCertificate, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &GetCertificateInput{} + } + + req = c.newRequest(op, input, output) + output = &GetCertificateOutput{} + req.Data = output + return +} + +// Retrieves an ACM Certificate and certificate chain for the certificate specified +// by an ARN. The chain is an ordered list of certificates that contains the +// root certificate, intermediate certificates of subordinate CAs, and the ACM +// Certificate. The certificate and certificate chain are base64 encoded. If +// you want to decode the certificate chain to see the individual certificate +// fields, you can use OpenSSL. +// +// Currently, ACM Certificates can be used only with Elastic Load Balancing +// and Amazon CloudFront. +func (c *ACM) GetCertificate(input *GetCertificateInput) (*GetCertificateOutput, error) { + req, out := c.GetCertificateRequest(input) + err := req.Send() + return out, err +} + +const opListCertificates = "ListCertificates" + +// ListCertificatesRequest generates a request for the ListCertificates operation. +func (c *ACM) ListCertificatesRequest(input *ListCertificatesInput) (req *request.Request, output *ListCertificatesOutput) { + op := &request.Operation{ + Name: opListCertificates, + HTTPMethod: "POST", + HTTPPath: "/", + Paginator: &request.Paginator{ + InputTokens: []string{"NextToken"}, + OutputTokens: []string{"NextToken"}, + LimitToken: "MaxItems", + TruncationToken: "", + }, + } + + if input == nil { + input = &ListCertificatesInput{} + } + + req = c.newRequest(op, input, output) + output = &ListCertificatesOutput{} + req.Data = output + return +} + +// Retrieves a list of the ACM Certificate ARNs, and the domain name for each +// ARN, owned by the calling account. You can filter the list based on the CertificateStatuses +// parameter, and you can display up to MaxItems certificates at one time. If +// you have more than MaxItems certificates, use the NextToken marker from the +// response object in your next call to the ListCertificates action to retrieve +// the next set of certificate ARNs. +func (c *ACM) ListCertificates(input *ListCertificatesInput) (*ListCertificatesOutput, error) { + req, out := c.ListCertificatesRequest(input) + err := req.Send() + return out, err +} + +func (c *ACM) ListCertificatesPages(input *ListCertificatesInput, fn func(p *ListCertificatesOutput, lastPage bool) (shouldContinue bool)) error { + page, _ := c.ListCertificatesRequest(input) + page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) + return page.EachPage(func(p interface{}, lastPage bool) bool { + return fn(p.(*ListCertificatesOutput), lastPage) + }) +} + +const opRequestCertificate = "RequestCertificate" + +// RequestCertificateRequest generates a request for the RequestCertificate operation. +func (c *ACM) RequestCertificateRequest(input *RequestCertificateInput) (req *request.Request, output *RequestCertificateOutput) { + op := &request.Operation{ + Name: opRequestCertificate, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &RequestCertificateInput{} + } + + req = c.newRequest(op, input, output) + output = &RequestCertificateOutput{} + req.Data = output + return +} + +// Requests an ACM Certificate for use with other AWS services. To request an +// ACM Certificate, you must specify the fully qualified domain name (FQDN) +// for your site. You can also specify additional FQDNs if users can reach your +// site by using other names. For each domain name you specify, email is sent +// to the domain owner to request approval to issue the certificate. After receiving +// approval from the domain owner, the ACM Certificate is issued. For more information, +// see the AWS Certificate Manager User Guide (http://docs.aws.amazon.com/acm/latest/userguide/overview.html). +func (c *ACM) RequestCertificate(input *RequestCertificateInput) (*RequestCertificateOutput, error) { + req, out := c.RequestCertificateRequest(input) + err := req.Send() + return out, err +} + +const opResendValidationEmail = "ResendValidationEmail" + +// ResendValidationEmailRequest generates a request for the ResendValidationEmail operation. +func (c *ACM) ResendValidationEmailRequest(input *ResendValidationEmailInput) (req *request.Request, output *ResendValidationEmailOutput) { + op := &request.Operation{ + Name: opResendValidationEmail, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &ResendValidationEmailInput{} + } + + req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(jsonrpc.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) + output = &ResendValidationEmailOutput{} + req.Data = output + return +} + +// Resends the email that requests domain ownership validation. The domain owner +// or an authorized representative must approve the ACM Certificate before it +// can be issued. The certificate can be approved by clicking a link in the +// mail to navigate to the Amazon certificate approval website and then clicking +// I Approve. However, the validation email can be blocked by spam filters. +// Therefore, if you do not receive the original mail, you can request that +// the mail be resent within 72 hours of requesting the ACM Certificate. If +// more than 72 hours have elapsed since your original request or since your +// last attempt to resend validation mail, you must request a new certificate. +func (c *ACM) ResendValidationEmail(input *ResendValidationEmailInput) (*ResendValidationEmailOutput, error) { + req, out := c.ResendValidationEmailRequest(input) + err := req.Send() + return out, err +} + +// This structure is returned in the response object of the DescribeCertificate +// action. +type CertificateDetail struct { + _ struct{} `type:"structure"` + + // Amazon Resource Name (ARN) of the certificate. This is of the form: + // + // arn:aws:acm:region:123456789012:certificate/12345678-1234-1234-1234-123456789012 + // + // For more information about ARNs, see Amazon Resource Names (ARNs) and AWS + // Service Namespaces (http://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html). + CertificateArn *string `min:"20" type:"string"` + + // Time at which the certificate was requested. + CreatedAt *time.Time `type:"timestamp" timestampFormat:"unix"` + + // Fully qualified domain name (FQDN), such as www.example.com or example.com, + // for the certificate. + DomainName *string `min:"1" type:"string"` + + // References a DomainValidation structure that contains the domain name in + // the certificate and the email address that can be used for validation. + DomainValidationOptions []*DomainValidation `min:"1" type:"list"` + + // List that identifies ARNs that are using the certificate. A single ACM Certificate + // can be used by multiple AWS resources. + InUseBy []*string `type:"list"` + + // Time at which the certificate was issued. + IssuedAt *time.Time `type:"timestamp" timestampFormat:"unix"` + + // The X.500 distinguished name of the CA that issued and signed the certificate. + Issuer *string `type:"string"` + + // Asymmetric algorithm used to generate the public and private key pair. Currently + // the only supported value is RSA_2048. + KeyAlgorithm *string `type:"string" enum:"KeyAlgorithm"` + + // Time after which the certificate is not valid. + NotAfter *time.Time `type:"timestamp" timestampFormat:"unix"` + + // Time before which the certificate is not valid. + NotBefore *time.Time `type:"timestamp" timestampFormat:"unix"` + + // A RevocationReason enumeration value that indicates why the certificate was + // revoked. This value exists only if the certificate has been revoked. This + // can be one of the following vales: UNSPECIFIED KEY_COMPROMISE CA_COMPROMISE + // AFFILIATION_CHANGED SUPERCEDED CESSATION_OF_OPERATION CERTIFICATE_HOLD REMOVE_FROM_CRL + // PRIVILEGE_WITHDRAWN A_A_COMPROMISE + RevocationReason *string `type:"string" enum:"RevocationReason"` + + // The time, if any, at which the certificate was revoked. This value exists + // only if the certificate has been revoked. + RevokedAt *time.Time `type:"timestamp" timestampFormat:"unix"` + + // String that contains the serial number of the certificate. + Serial *string `type:"string"` + + // Algorithm used to generate a signature. Currently the only supported value + // is SHA256WITHRSA. + SignatureAlgorithm *string `type:"string"` + + // A CertificateStatus enumeration value that can contain one of the following: + // PENDING_VALIDATION ISSUED INACTIVE EXPIRED REVOKED FAILED VALIDATION_TIMED_OUT + Status *string `type:"string" enum:"CertificateStatus"` + + // The X.500 distinguished name of the entity associated with the public key + // contained in the certificate. + Subject *string `type:"string"` + + // One or more domain names (subject alternative names) included in the certificate + // request. After the certificate is issued, this list includes the domain names + // bound to the public key contained in the certificate. The subject alternative + // names include the canonical domain name (CN) of the certificate and additional + // domain names that can be used to connect to the website. + SubjectAlternativeNames []*string `min:"1" type:"list"` +} + +// String returns the string representation +func (s CertificateDetail) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s CertificateDetail) GoString() string { + return s.String() +} + +// This structure is returned in the response object of ListCertificates action. +type CertificateSummary struct { + _ struct{} `type:"structure"` + + // Amazon Resource Name (ARN) of the certificate. This is of the form: + // + // arn:aws:acm:region:123456789012:certificate/12345678-1234-1234-1234-123456789012 + // + // For more information about ARNs, see Amazon Resource Names (ARNs) and AWS + // Service Namespaces (http://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html). + CertificateArn *string `min:"20" type:"string"` + + // Fully qualified domain name (FQDN), such as www.example.com or example.com, + // for the certificate. + DomainName *string `min:"1" type:"string"` +} + +// String returns the string representation +func (s CertificateSummary) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s CertificateSummary) GoString() string { + return s.String() +} + +type DeleteCertificateInput struct { + _ struct{} `type:"structure"` + + // String that contains the ARN of the ACM Certificate to be deleted. This must + // be of the form: + // + // arn:aws:acm:region:123456789012:certificate/12345678-1234-1234-1234-123456789012 + // + // For more information about ARNs, see Amazon Resource Names (ARNs) and AWS + // Service Namespaces (http://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html). + CertificateArn *string `min:"20" type:"string" required:"true"` +} + +// String returns the string representation +func (s DeleteCertificateInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DeleteCertificateInput) GoString() string { + return s.String() +} + +type DeleteCertificateOutput struct { + _ struct{} `type:"structure"` +} + +// String returns the string representation +func (s DeleteCertificateOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DeleteCertificateOutput) GoString() string { + return s.String() +} + +type DescribeCertificateInput struct { + _ struct{} `type:"structure"` + + // String that contains an ACM Certificate ARN. The ARN must be of the form: + // + // arn:aws:acm:region:123456789012:certificate/12345678-1234-1234-1234-123456789012 + // + // For more information about ARNs, see Amazon Resource Names (ARNs) and AWS + // Service Namespaces (http://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html). + CertificateArn *string `min:"20" type:"string" required:"true"` +} + +// String returns the string representation +func (s DescribeCertificateInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DescribeCertificateInput) GoString() string { + return s.String() +} + +type DescribeCertificateOutput struct { + _ struct{} `type:"structure"` + + // Contains a CertificateDetail structure that lists the fields of an ACM Certificate. + Certificate *CertificateDetail `type:"structure"` +} + +// String returns the string representation +func (s DescribeCertificateOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DescribeCertificateOutput) GoString() string { + return s.String() +} + +// Structure that contains the domain name, the base validation domain to which +// validation email is sent, and the email addresses used to validate the domain +// identity. +type DomainValidation struct { + _ struct{} `type:"structure"` + + // Fully Qualified Domain Name (FQDN) of the form www.example.com or example.com + DomainName *string `min:"1" type:"string" required:"true"` + + // The base validation domain that acts as the suffix of the email addresses + // that are used to send the emails. + ValidationDomain *string `min:"1" type:"string"` + + // A list of contact address for the domain registrant. + ValidationEmails []*string `type:"list"` +} + +// String returns the string representation +func (s DomainValidation) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DomainValidation) GoString() string { + return s.String() +} + +// This structure is used in the request object of the RequestCertificate action. +type DomainValidationOption struct { + _ struct{} `type:"structure"` + + // Fully Qualified Domain Name (FQDN) of the certificate being requested. + DomainName *string `min:"1" type:"string" required:"true"` + + // The domain to which validation email is sent. This is the base validation + // domain that will act as the suffix of the email addresses. This must be the + // same as the DomainName value or a superdomain of the DomainName value. For + // example, if you requested a certificate for site.subdomain.example.com and + // specify a ValidationDomain of subdomain.example.com, ACM sends email to the + // domain registrant, technical contact, and administrative contact in WHOIS + // for the base domain and the following five addresses: admin@subdomain.example.com + // administrator@subdomain.example.com hostmaster@subdomain.example.com postmaster@subdomain.example.com + // webmaster@subdomain.example.com + ValidationDomain *string `min:"1" type:"string" required:"true"` +} + +// String returns the string representation +func (s DomainValidationOption) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DomainValidationOption) GoString() string { + return s.String() +} + +type GetCertificateInput struct { + _ struct{} `type:"structure"` + + // String that contains a certificate ARN in the following format: + // + // arn:aws:acm:region:123456789012:certificate/12345678-1234-1234-1234-123456789012 + // + // For more information about ARNs, see Amazon Resource Names (ARNs) and AWS + // Service Namespaces (http://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html). + CertificateArn *string `min:"20" type:"string" required:"true"` +} + +// String returns the string representation +func (s GetCertificateInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s GetCertificateInput) GoString() string { + return s.String() +} + +type GetCertificateOutput struct { + _ struct{} `type:"structure"` + + // String that contains the ACM Certificate represented by the ARN specified + // at input. + Certificate *string `min:"1" type:"string"` + + // The certificate chain that contains the root certificate issued by the certificate + // authority (CA). + CertificateChain *string `min:"1" type:"string"` +} + +// String returns the string representation +func (s GetCertificateOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s GetCertificateOutput) GoString() string { + return s.String() +} + +type ListCertificatesInput struct { + _ struct{} `type:"structure"` + + // Identifies the statuses of the ACM Certificates for which you want to retrieve + // the ARNs. This can be one or more of the following values: PENDING_VALIDATION + // ISSUED INACTIVE EXPIRED VALIDATION_TIMED_OUT REVOKED FAILED + CertificateStatuses []*string `type:"list"` + + // Specify this parameter when paginating results to indicate the maximum number + // of ACM Certificates that you want to display for each response. If there + // are additional certificates beyond the maximum you specify, use the NextToken + // value in your next call to the ListCertificates action. + MaxItems *int64 `min:"1" type:"integer"` + + // String that contains an opaque marker of the next ACM Certificate ARN to + // be displayed. Use this parameter when paginating results, and only in a subsequent + // request after you've received a response where the results have been truncated. + // Set it to an empty string the first time you call this action, and set it + // to the value of the NextToken element you receive in the response object + // for subsequent calls. + NextToken *string `min:"1" type:"string"` +} + +// String returns the string representation +func (s ListCertificatesInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ListCertificatesInput) GoString() string { + return s.String() +} + +type ListCertificatesOutput struct { + _ struct{} `type:"structure"` + + // A list of the certificate ARNs. + CertificateSummaryList []*CertificateSummary `type:"list"` + + // If the list has been truncated, this value is present and should be used + // for the NextToken input parameter on your next call to ListCertificates. + NextToken *string `min:"1" type:"string"` +} + +// String returns the string representation +func (s ListCertificatesOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ListCertificatesOutput) GoString() string { + return s.String() +} + +type RequestCertificateInput struct { + _ struct{} `type:"structure"` + + // Fully qualified domain name (FQDN), such as www.example.com, of the site + // you want to secure with an ACM Certificate. Use an asterisk (*) to create + // a wildcard certificate that protects several sites in the same domain. For + // example, *.example.com protects www.example.com, site.example.com, and images.example.com. + DomainName *string `min:"1" type:"string" required:"true"` + + // The base validation domain that will act as the suffix of the email addresses + // that are used to send the emails. This must be the same as the Domain value + // or a superdomain of the Domain value. For example, if you requested a certificate + // for test.example.com and specify DomainValidationOptions of example.com, + // ACM sends email to the domain registrant, technical contact, and administrative + // contact in WHOIS and the following five addresses: admin@example.com administrator@example.com + // hostmaster@example.com postmaster@example.com webmaster@example.com + DomainValidationOptions []*DomainValidationOption `min:"1" type:"list"` + + // Customer chosen string that can be used to distinguish between calls to RequestCertificate. + // Idempotency tokens time out after one hour. Therefore, if you call RequestCertificate + // multiple times with the same idempotency token within one hour, ACM recognizes + // that you are requesting only one certificate and will issue only one. If + // you change the idempotency token for each call, ACM recognizes that you are + // requesting multiple certificates. + IdempotencyToken *string `min:"1" type:"string"` + + // Additional FQDNs to be included in the Subject Alternative Name extension + // of the ACM Certificate. For example, add the name www.example.net to a certificate + // for which the DomainName field is www.example.com if users can reach your + // site by using either name. + SubjectAlternativeNames []*string `min:"1" type:"list"` +} + +// String returns the string representation +func (s RequestCertificateInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s RequestCertificateInput) GoString() string { + return s.String() +} + +type RequestCertificateOutput struct { + _ struct{} `type:"structure"` + + // String that contains the ARN of the issued certificate. This must be of the + // form: + // + // arn:aws:acm:us-east-1:123456789012:certificate/12345678-1234-1234-1234-123456789012 + CertificateArn *string `min:"20" type:"string"` +} + +// String returns the string representation +func (s RequestCertificateOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s RequestCertificateOutput) GoString() string { + return s.String() +} + +type ResendValidationEmailInput struct { + _ struct{} `type:"structure"` + + // String that contains the ARN of the requested certificate. The certificate + // ARN is generated and returned by RequestCertificate as soon as the request + // is made. By default, using this parameter causes email to be sent to all + // top-level domains you specified in the certificate request. + // + // The ARN must be of the form: + // + // arn:aws:acm:us-east-1:123456789012:certificate/12345678-1234-1234-1234-123456789012 + CertificateArn *string `min:"20" type:"string" required:"true"` + + // The Fully Qualified Domain Name (FQDN) of the certificate that needs to be + // validated. + Domain *string `min:"1" type:"string" required:"true"` + + // The base validation domain that will act as the suffix of the email addresses + // that are used to send the emails. This must be the same as the Domain value + // or a superdomain of the Domain value. For example, if you requested a certificate + // for site.subdomain.example.com and specify a ValidationDomain of subdomain.example.com, + // ACM sends email to the domain registrant, technical contact, and administrative + // contact in WHOIS and the following five addresses: admin@subdomain.example.com + // administrator@subdomain.example.com hostmaster@subdomain.example.com postmaster@subdomain.example.com + // webmaster@subdomain.example.com + ValidationDomain *string `min:"1" type:"string" required:"true"` +} + +// String returns the string representation +func (s ResendValidationEmailInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ResendValidationEmailInput) GoString() string { + return s.String() +} + +type ResendValidationEmailOutput struct { + _ struct{} `type:"structure"` +} + +// String returns the string representation +func (s ResendValidationEmailOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ResendValidationEmailOutput) GoString() string { + return s.String() +} + +const ( + // @enum CertificateStatus + CertificateStatusPendingValidation = "PENDING_VALIDATION" + // @enum CertificateStatus + CertificateStatusIssued = "ISSUED" + // @enum CertificateStatus + CertificateStatusInactive = "INACTIVE" + // @enum CertificateStatus + CertificateStatusExpired = "EXPIRED" + // @enum CertificateStatus + CertificateStatusValidationTimedOut = "VALIDATION_TIMED_OUT" + // @enum CertificateStatus + CertificateStatusRevoked = "REVOKED" + // @enum CertificateStatus + CertificateStatusFailed = "FAILED" +) + +const ( + // @enum KeyAlgorithm + KeyAlgorithmRsa2048 = "RSA_2048" + // @enum KeyAlgorithm + KeyAlgorithmEcPrime256v1 = "EC_prime256v1" +) + +const ( + // @enum RevocationReason + RevocationReasonUnspecified = "UNSPECIFIED" + // @enum RevocationReason + RevocationReasonKeyCompromise = "KEY_COMPROMISE" + // @enum RevocationReason + RevocationReasonCaCompromise = "CA_COMPROMISE" + // @enum RevocationReason + RevocationReasonAffiliationChanged = "AFFILIATION_CHANGED" + // @enum RevocationReason + RevocationReasonSuperceded = "SUPERCEDED" + // @enum RevocationReason + RevocationReasonCessationOfOperation = "CESSATION_OF_OPERATION" + // @enum RevocationReason + RevocationReasonCertificateHold = "CERTIFICATE_HOLD" + // @enum RevocationReason + RevocationReasonRemoveFromCrl = "REMOVE_FROM_CRL" + // @enum RevocationReason + RevocationReasonPrivilegeWithdrawn = "PRIVILEGE_WITHDRAWN" + // @enum RevocationReason + RevocationReasonAACompromise = "A_A_COMPROMISE" +) diff --git a/vendor/github.com/aws/aws-sdk-go/service/acm/service.go b/vendor/github.com/aws/aws-sdk-go/service/acm/service.go new file mode 100644 index 0000000000..4659042627 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/service/acm/service.go @@ -0,0 +1,95 @@ +// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. + +package acm + +import ( + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/client" + "github.com/aws/aws-sdk-go/aws/client/metadata" + "github.com/aws/aws-sdk-go/aws/request" + "github.com/aws/aws-sdk-go/private/protocol/jsonrpc" + "github.com/aws/aws-sdk-go/private/signer/v4" +) + +// Welcome to the AWS Certificate Manager (ACM) Command Reference. This guide +// provides descriptions, syntax, and usage examples for each ACM command. You +// can use AWS Certificate Manager to request ACM Certificates for your AWS-based +// websites and applications. For general information about using ACM and for +// more information about using the console, see the AWS Certificate Manager +// User Guide (http://docs.aws.amazon.com/acm/latest/userguide/acm-overview.html). +// For more information about using the ACM API, see the AWS Certificate Manager +// API Reference (http://docs.aws.amazon.com/acm/latest/APIReference/Welcome.html). +//The service client's operations are safe to be used concurrently. +// It is not safe to mutate any of the client's properties though. +type ACM struct { + *client.Client +} + +// Used for custom client initialization logic +var initClient func(*client.Client) + +// Used for custom request initialization logic +var initRequest func(*request.Request) + +// A ServiceName is the name of the service the client will make API calls to. +const ServiceName = "acm" + +// New creates a new instance of the ACM client with a session. +// If additional configuration is needed for the client instance use the optional +// aws.Config parameter to add your extra config. +// +// Example: +// // Create a ACM client from just a session. +// svc := acm.New(mySession) +// +// // Create a ACM client with additional configuration +// svc := acm.New(mySession, aws.NewConfig().WithRegion("us-west-2")) +func New(p client.ConfigProvider, cfgs ...*aws.Config) *ACM { + c := p.ClientConfig(ServiceName, cfgs...) + return newClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) +} + +// newClient creates, initializes and returns a new service client instance. +func newClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *ACM { + svc := &ACM{ + Client: client.New( + cfg, + metadata.ClientInfo{ + ServiceName: ServiceName, + SigningRegion: signingRegion, + Endpoint: endpoint, + APIVersion: "2015-12-08", + JSONVersion: "1.1", + TargetPrefix: "CertificateManager", + }, + handlers, + ), + } + + // Handlers + svc.Handlers.Sign.PushBack(v4.Sign) + svc.Handlers.Build.PushBackNamed(jsonrpc.BuildHandler) + svc.Handlers.Unmarshal.PushBackNamed(jsonrpc.UnmarshalHandler) + svc.Handlers.UnmarshalMeta.PushBackNamed(jsonrpc.UnmarshalMetaHandler) + svc.Handlers.UnmarshalError.PushBackNamed(jsonrpc.UnmarshalErrorHandler) + + // Run custom client initialization if present + if initClient != nil { + initClient(svc.Client) + } + + return svc +} + +// newRequest creates a new request for a ACM operation and runs any +// custom request initialization. +func (c *ACM) newRequest(op *request.Operation, params, data interface{}) *request.Request { + req := c.NewRequest(op, params, data) + + // Run custom request initialization if present + if initRequest != nil { + initRequest(req) + } + + return req +} diff --git a/vendor/github.com/aws/aws-sdk-go/service/autoscaling/api.go b/vendor/github.com/aws/aws-sdk-go/service/autoscaling/api.go index da7fda939e..4958ba2a76 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/autoscaling/api.go +++ b/vendor/github.com/aws/aws-sdk-go/service/autoscaling/api.go @@ -8,6 +8,8 @@ import ( "github.com/aws/aws-sdk-go/aws/awsutil" "github.com/aws/aws-sdk-go/aws/request" + "github.com/aws/aws-sdk-go/private/protocol" + "github.com/aws/aws-sdk-go/private/protocol/query" ) const opAttachInstances = "AttachInstances" @@ -25,6 +27,8 @@ func (c *AutoScaling) AttachInstancesRequest(input *AttachInstancesInput) (req * } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &AttachInstancesOutput{} req.Data = output return @@ -100,20 +104,22 @@ func (c *AutoScaling) CompleteLifecycleActionRequest(input *CompleteLifecycleAct return } -// Completes the lifecycle action for the associated token initiated under the -// given lifecycle hook with the specified result. +// Completes the lifecycle action for the specified token or instance with the +// specified result. // -// This operation is a part of the basic sequence for adding a lifecycle hook -// to an Auto Scaling group: +// This step is a part of the procedure for adding a lifecycle hook to an Auto +// Scaling group: // -// Create a notification target. A target can be either an Amazon SQS queue -// or an Amazon SNS topic. Create an IAM role. This role allows Auto Scaling -// to publish lifecycle notifications to the designated SQS queue or SNS topic. -// Create the lifecycle hook. You can create a hook that acts when instances -// launch or when instances terminate. If necessary, record the lifecycle action -// heartbeat to keep the instance in a pending state. Complete the lifecycle -// action. For more information, see Auto Scaling Pending State (http://docs.aws.amazon.com/AutoScaling/latest/DeveloperGuide/AutoScalingPendingState.html) -// and Auto Scaling Terminating State (http://docs.aws.amazon.com/AutoScaling/latest/DeveloperGuide/AutoScalingTerminatingState.html) +// (Optional) Create a Lambda function and a rule that allows CloudWatch Events +// to invoke your Lambda function when Auto Scaling launches or terminates instances. +// (Optional) Create a notification target and an IAM role. The target can be +// either an Amazon SQS queue or an Amazon SNS topic. The role allows Auto Scaling +// to publish lifecycle notifications to the target. Create the lifecycle hook. +// Specify whether the hook is used when the instances launch or terminate. +// If you need more time, record the lifecycle action heartbeat to keep the +// instance in a pending state. If you finish before the timeout period ends, +// complete the lifecycle action. For more information, see Auto Scaling Lifecycle +// (http://docs.aws.amazon.com/AutoScaling/latest/DeveloperGuide/AutoScalingGroupLifecycle.html) // in the Auto Scaling Developer Guide. func (c *AutoScaling) CompleteLifecycleAction(input *CompleteLifecycleActionInput) (*CompleteLifecycleActionOutput, error) { req, out := c.CompleteLifecycleActionRequest(input) @@ -136,6 +142,8 @@ func (c *AutoScaling) CreateAutoScalingGroupRequest(input *CreateAutoScalingGrou } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &CreateAutoScalingGroupOutput{} req.Data = output return @@ -170,6 +178,8 @@ func (c *AutoScaling) CreateLaunchConfigurationRequest(input *CreateLaunchConfig } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &CreateLaunchConfigurationOutput{} req.Data = output return @@ -204,6 +214,8 @@ func (c *AutoScaling) CreateOrUpdateTagsRequest(input *CreateOrUpdateTagsInput) } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &CreateOrUpdateTagsOutput{} req.Data = output return @@ -211,13 +223,6 @@ func (c *AutoScaling) CreateOrUpdateTagsRequest(input *CreateOrUpdateTagsInput) // Creates or updates tags for the specified Auto Scaling group. // -// A tag is defined by its resource ID, resource type, key, value, and propagate -// flag. The value and the propagate flag are optional parameters. The only -// supported resource type is auto-scaling-group, and the resource ID must be -// the name of the group. The PropagateAtLaunch flag determines whether the -// tag is added to instances launched in the group. Valid values are true or -// false. -// // When you specify a tag with a key that already exists, the operation overwrites // the previous tag definition, and you do not get an error message. // @@ -244,6 +249,8 @@ func (c *AutoScaling) DeleteAutoScalingGroupRequest(input *DeleteAutoScalingGrou } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &DeleteAutoScalingGroupOutput{} req.Data = output return @@ -286,6 +293,8 @@ func (c *AutoScaling) DeleteLaunchConfigurationRequest(input *DeleteLaunchConfig } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &DeleteLaunchConfigurationOutput{} req.Data = output return @@ -347,6 +356,8 @@ func (c *AutoScaling) DeleteNotificationConfigurationRequest(input *DeleteNotifi } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &DeleteNotificationConfigurationOutput{} req.Data = output return @@ -374,6 +385,8 @@ func (c *AutoScaling) DeletePolicyRequest(input *DeletePolicyInput) (req *reques } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &DeletePolicyOutput{} req.Data = output return @@ -404,6 +417,8 @@ func (c *AutoScaling) DeleteScheduledActionRequest(input *DeleteScheduledActionI } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &DeleteScheduledActionOutput{} req.Data = output return @@ -431,6 +446,8 @@ func (c *AutoScaling) DeleteTagsRequest(input *DeleteTagsInput) (req *request.Re } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &DeleteTagsOutput{} req.Data = output return @@ -1122,6 +1139,8 @@ func (c *AutoScaling) DisableMetricsCollectionRequest(input *DisableMetricsColle } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &DisableMetricsCollectionOutput{} req.Data = output return @@ -1150,6 +1169,8 @@ func (c *AutoScaling) EnableMetricsCollectionRequest(input *EnableMetricsCollect } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &EnableMetricsCollectionOutput{} req.Data = output return @@ -1188,7 +1209,7 @@ func (c *AutoScaling) EnterStandbyRequest(input *EnterStandbyInput) (req *reques // Moves the specified instances into Standby mode. // -// For more information, see Auto Scaling InService State (http://docs.aws.amazon.com/AutoScaling/latest/DeveloperGuide/AutoScalingInServiceState.html) +// For more information, see Auto Scaling Lifecycle (http://docs.aws.amazon.com/AutoScaling/latest/DeveloperGuide/AutoScalingGroupLifecycle.html) // in the Auto Scaling Developer Guide. func (c *AutoScaling) EnterStandby(input *EnterStandbyInput) (*EnterStandbyOutput, error) { req, out := c.EnterStandbyRequest(input) @@ -1211,6 +1232,8 @@ func (c *AutoScaling) ExecutePolicyRequest(input *ExecutePolicyInput) (req *requ } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &ExecutePolicyOutput{} req.Data = output return @@ -1245,7 +1268,7 @@ func (c *AutoScaling) ExitStandbyRequest(input *ExitStandbyInput) (req *request. // Moves the specified instances out of Standby mode. // -// For more information, see Auto Scaling InService State (http://docs.aws.amazon.com/AutoScaling/latest/DeveloperGuide/AutoScalingInServiceState.html) +// For more information, see Auto Scaling Lifecycle (http://docs.aws.amazon.com/AutoScaling/latest/DeveloperGuide/AutoScalingGroupLifecycle.html) // in the Auto Scaling Developer Guide. func (c *AutoScaling) ExitStandby(input *ExitStandbyInput) (*ExitStandbyOutput, error) { req, out := c.ExitStandbyRequest(input) @@ -1279,17 +1302,19 @@ func (c *AutoScaling) PutLifecycleHookRequest(input *PutLifecycleHookInput) (req // an instance that is not actively in service; for example, either when the // instance launches or before the instance terminates. // -// This operation is a part of the basic sequence for adding a lifecycle hook -// to an Auto Scaling group: +// This step is a part of the procedure for adding a lifecycle hook to an Auto +// Scaling group: // -// Create a notification target. A target can be either an Amazon SQS queue -// or an Amazon SNS topic. Create an IAM role. This role allows Auto Scaling -// to publish lifecycle notifications to the designated SQS queue or SNS topic. -// Create the lifecycle hook. You can create a hook that acts when instances -// launch or when instances terminate. If necessary, record the lifecycle action -// heartbeat to keep the instance in a pending state. Complete the lifecycle -// action. For more information, see Auto Scaling Pending State (http://docs.aws.amazon.com/AutoScaling/latest/DeveloperGuide/AutoScalingPendingState.html) -// and Auto Scaling Terminating State (http://docs.aws.amazon.com/AutoScaling/latest/DeveloperGuide/AutoScalingTerminatingState.html) +// (Optional) Create a Lambda function and a rule that allows CloudWatch Events +// to invoke your Lambda function when Auto Scaling launches or terminates instances. +// (Optional) Create a notification target and an IAM role. The target can be +// either an Amazon SQS queue or an Amazon SNS topic. The role allows Auto Scaling +// to publish lifecycle notifications to the target. Create the lifecycle hook. +// Specify whether the hook is used when the instances launch or terminate. +// If you need more time, record the lifecycle action heartbeat to keep the +// instance in a pending state. If you finish before the timeout period ends, +// complete the lifecycle action. For more information, see Auto Scaling Lifecycle +// (http://docs.aws.amazon.com/AutoScaling/latest/DeveloperGuide/AutoScalingGroupLifecycle.html) // in the Auto Scaling Developer Guide. // // If you exceed your maximum limit of lifecycle hooks, which by default is @@ -1317,6 +1342,8 @@ func (c *AutoScaling) PutNotificationConfigurationRequest(input *PutNotification } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &PutNotificationConfigurationOutput{} req.Data = output return @@ -1387,6 +1414,8 @@ func (c *AutoScaling) PutScheduledUpdateGroupActionRequest(input *PutScheduledUp } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &PutScheduledUpdateGroupActionOutput{} req.Data = output return @@ -1424,21 +1453,23 @@ func (c *AutoScaling) RecordLifecycleActionHeartbeatRequest(input *RecordLifecyc return } -// Records a heartbeat for the lifecycle action associated with a specific token. -// This extends the timeout by the length of time defined by the HeartbeatTimeout -// parameter of PutLifecycleHook. +// Records a heartbeat for the lifecycle action associated with the specified +// token or instance. This extends the timeout by the length of time defined +// using PutLifecycleHook. // -// This operation is a part of the basic sequence for adding a lifecycle hook -// to an Auto Scaling group: +// This step is a part of the procedure for adding a lifecycle hook to an Auto +// Scaling group: // -// Create a notification target. A target can be either an Amazon SQS queue -// or an Amazon SNS topic. Create an IAM role. This role allows Auto Scaling -// to publish lifecycle notifications to the designated SQS queue or SNS topic. -// Create the lifecycle hook. You can create a hook that acts when instances -// launch or when instances terminate. If necessary, record the lifecycle action -// heartbeat to keep the instance in a pending state. Complete the lifecycle -// action. For more information, see Auto Scaling Pending State (http://docs.aws.amazon.com/AutoScaling/latest/DeveloperGuide/AutoScalingPendingState.html) -// and Auto Scaling Terminating State (http://docs.aws.amazon.com/AutoScaling/latest/DeveloperGuide/AutoScalingTerminatingState.html) +// (Optional) Create a Lambda function and a rule that allows CloudWatch Events +// to invoke your Lambda function when Auto Scaling launches or terminates instances. +// (Optional) Create a notification target and an IAM role. The target can be +// either an Amazon SQS queue or an Amazon SNS topic. The role allows Auto Scaling +// to publish lifecycle notifications to the target. Create the lifecycle hook. +// Specify whether the hook is used when the instances launch or terminate. +// If you need more time, record the lifecycle action heartbeat to keep the +// instance in a pending state. If you finish before the timeout period ends, +// complete the lifecycle action. For more information, see Auto Scaling Lifecycle +// (http://docs.aws.amazon.com/AutoScaling/latest/DeveloperGuide/AutoScalingGroupLifecycle.html) // in the Auto Scaling Developer Guide. func (c *AutoScaling) RecordLifecycleActionHeartbeat(input *RecordLifecycleActionHeartbeatInput) (*RecordLifecycleActionHeartbeatOutput, error) { req, out := c.RecordLifecycleActionHeartbeatRequest(input) @@ -1461,15 +1492,18 @@ func (c *AutoScaling) ResumeProcessesRequest(input *ScalingProcessQuery) (req *r } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &ResumeProcessesOutput{} req.Data = output return } -// Resumes the specified suspended Auto Scaling processes for the specified -// Auto Scaling group. To resume specific processes, use the ScalingProcesses -// parameter. To resume all processes, omit the ScalingProcesses parameter. -// For more information, see Suspend and Resume Auto Scaling Processes (http://docs.aws.amazon.com/AutoScaling/latest/DeveloperGuide/US_SuspendResume.html) +// Resumes the specified suspended Auto Scaling processes, or all suspended +// process, for the specified Auto Scaling group. +// +// For more information, see Suspending and Resuming Auto Scaling Processes +// (http://docs.aws.amazon.com/AutoScaling/latest/DeveloperGuide/US_SuspendResume.html) // in the Auto Scaling Developer Guide. func (c *AutoScaling) ResumeProcesses(input *ScalingProcessQuery) (*ResumeProcessesOutput, error) { req, out := c.ResumeProcessesRequest(input) @@ -1492,6 +1526,8 @@ func (c *AutoScaling) SetDesiredCapacityRequest(input *SetDesiredCapacityInput) } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &SetDesiredCapacityOutput{} req.Data = output return @@ -1522,6 +1558,8 @@ func (c *AutoScaling) SetInstanceHealthRequest(input *SetInstanceHealthInput) (r } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &SetInstanceHealthOutput{} req.Data = output return @@ -1582,21 +1620,23 @@ func (c *AutoScaling) SuspendProcessesRequest(input *ScalingProcessQuery) (req * } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &SuspendProcessesOutput{} req.Data = output return } -// Suspends the specified Auto Scaling processes for the specified Auto Scaling -// group. To suspend specific processes, use the ScalingProcesses parameter. -// To suspend all processes, omit the ScalingProcesses parameter. +// Suspends the specified Auto Scaling processes, or all processes, for the +// specified Auto Scaling group. // // Note that if you suspend either the Launch or Terminate process types, it // can prevent other process types from functioning properly. // // To resume processes that have been suspended, use ResumeProcesses. // -// For more information, see Suspend and Resume Auto Scaling Processes (http://docs.aws.amazon.com/AutoScaling/latest/DeveloperGuide/US_SuspendResume.html) +// For more information, see Suspending and Resuming Auto Scaling Processes +// (http://docs.aws.amazon.com/AutoScaling/latest/DeveloperGuide/US_SuspendResume.html) // in the Auto Scaling Developer Guide. func (c *AutoScaling) SuspendProcesses(input *ScalingProcessQuery) (*SuspendProcessesOutput, error) { req, out := c.SuspendProcessesRequest(input) @@ -1650,6 +1690,8 @@ func (c *AutoScaling) UpdateAutoScalingGroupRequest(input *UpdateAutoScalingGrou } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &UpdateAutoScalingGroupOutput{} req.Data = output return @@ -1781,7 +1823,7 @@ type AttachInstancesInput struct { // The name of the group. AutoScalingGroupName *string `min:"1" type:"string" required:"true"` - // One or more EC2 instance IDs. + // One or more instance IDs. InstanceIds []*string `type:"list"` } @@ -1880,6 +1922,9 @@ type CompleteLifecycleActionInput struct { // The name of the group for the lifecycle hook. AutoScalingGroupName *string `min:"1" type:"string" required:"true"` + // The ID of the instance. + InstanceId *string `min:"1" type:"string"` + // The action for the group to take. This parameter can be either CONTINUE or // ABANDON. LifecycleActionResult *string `type:"string" required:"true"` @@ -1887,7 +1932,7 @@ type CompleteLifecycleActionInput struct { // A universally unique identifier (UUID) that identifies a specific lifecycle // action associated with an instance. Auto Scaling sends this token to the // notification target you specified when you created the lifecycle hook. - LifecycleActionToken *string `min:"36" type:"string" required:"true"` + LifecycleActionToken *string `min:"36" type:"string"` // The name of the lifecycle hook. LifecycleHookName *string `min:"1" type:"string" required:"true"` @@ -1925,13 +1970,13 @@ type CreateAutoScalingGroupInput struct { AutoScalingGroupName *string `min:"1" type:"string" required:"true"` // One or more Availability Zones for the group. This parameter is optional - // if you specify subnets using the VPCZoneIdentifier parameter. + // if you specify one or more subnets. AvailabilityZones []*string `min:"1" type:"list"` // The amount of time, in seconds, after a scaling activity completes before // another scaling activity can start. The default is 300. // - // For more information, see Understanding Auto Scaling Cooldowns (http://docs.aws.amazon.com/AutoScaling/latest/DeveloperGuide/Cooldown.html) + // For more information, see Auto Scaling Cooldowns (http://docs.aws.amazon.com/AutoScaling/latest/DeveloperGuide/Cooldown.html) // in the Auto Scaling Developer Guide. DefaultCooldown *int64 `type:"integer"` @@ -1947,7 +1992,7 @@ type CreateAutoScalingGroupInput struct { // // This parameter is required if you are adding an ELB health check. // - // For more information, see Health Checks for Auto Scaling Instances (http://docs.aws.amazon.com/AutoScaling/latest/DeveloperGuide/healthcheck.html) + // For more information, see Health Checks (http://docs.aws.amazon.com/AutoScaling/latest/DeveloperGuide/healthcheck.html) // in the Auto Scaling Developer Guide. HealthCheckGracePeriod *int64 `type:"integer"` @@ -1958,27 +2003,27 @@ type CreateAutoScalingGroupInput struct { // in the Auto Scaling Developer Guide. HealthCheckType *string `min:"1" type:"string"` - // The ID of the EC2 instance used to create a launch configuration for the - // group. Alternatively, use the LaunchConfigurationName parameter to specify - // a launch configuration instead of an EC2 instance. + // The ID of the instance used to create a launch configuration for the group. + // Alternatively, specify a launch configuration instead of an EC2 instance. // // When you specify an ID of an instance, Auto Scaling creates a new launch // configuration and associates it with the group. This launch configuration // derives its attributes from the specified instance, with the exception of // the block device mapping. // - // For more information, see Create an Auto Scaling Group from an EC2 Instance + // For more information, see Create an Auto Scaling Group Using an EC2 Instance // (http://docs.aws.amazon.com/AutoScaling/latest/DeveloperGuide/create-asg-from-instance.html) // in the Auto Scaling Developer Guide. InstanceId *string `min:"1" type:"string"` - // The name of the launch configuration. Alternatively, use the InstanceId parameter - // to specify an EC2 instance instead of a launch configuration. + // The name of the launch configuration. Alternatively, specify an EC2 instance + // instead of a launch configuration. LaunchConfigurationName *string `min:"1" type:"string"` // One or more load balancers. // - // For more information, see Load Balance Your Auto Scaling Group (http://docs.aws.amazon.com/AutoScaling/latest/DeveloperGuide/US_SetUpASLBApp.html) + // For more information, see Using a Load Balancer With an Auto Scaling Group + // (http://docs.aws.amazon.com/AutoScaling/latest/DeveloperGuide/US_SetUpASLBApp.html) // in the Auto Scaling Developer Guide. LoadBalancerNames []*string `type:"list"` @@ -1997,9 +2042,7 @@ type CreateAutoScalingGroupInput struct { // in the Amazon Elastic Compute Cloud User Guide. PlacementGroup *string `min:"1" type:"string"` - // The tag to be created or updated. Each tag should be defined by its resource - // type, resource ID, key, value, and a propagate flag. Valid values: key=value, - // value=value, propagate=true or false. Value and propagate are optional parameters. + // One or more tags. // // For more information, see Tagging Auto Scaling Groups and Instances (http://docs.aws.amazon.com/AutoScaling/latest/DeveloperGuide/ASTagging.html) // in the Auto Scaling Developer Guide. @@ -2008,8 +2051,8 @@ type CreateAutoScalingGroupInput struct { // One or more termination policies used to select the instance to terminate. // These policies are executed in the order that they are listed. // - // For more information, see Choosing a Termination Policy for Your Auto Scaling - // Group (http://docs.aws.amazon.com/AutoScaling/latest/DeveloperGuide/us-termination-policy.html) + // For more information, see Controlling Which Instances Auto Scaling Terminates + // During Scale In (http://docs.aws.amazon.com/AutoScaling/latest/DeveloperGuide/AutoScalingBehavior.InstanceTermination.html) // in the Auto Scaling Developer Guide. TerminationPolicies []*string `type:"list"` @@ -2019,8 +2062,7 @@ type CreateAutoScalingGroupInput struct { // If you specify subnets and Availability Zones with this call, ensure that // the subnets' Availability Zones match the Availability Zones specified. // - // For more information, see Auto Scaling and Amazon Virtual Private Cloud - // (http://docs.aws.amazon.com/AutoScaling/latest/DeveloperGuide/autoscalingsubnets.html) + // For more information, see Launching Auto Scaling Instances in a VPC (http://docs.aws.amazon.com/AutoScaling/latest/DeveloperGuide/asg-in-vpc.html) // in the Auto Scaling Developer Guide. VPCZoneIdentifier *string `min:"1" type:"string"` } @@ -2054,11 +2096,11 @@ type CreateLaunchConfigurationInput struct { // Used for groups that launch instances into a virtual private cloud (VPC). // Specifies whether to assign a public IP address to each instance. For more - // information, see Auto Scaling and Amazon Virtual Private Cloud (http://docs.aws.amazon.com/AutoScaling/latest/DeveloperGuide/autoscalingsubnets.html) + // information, see Launching Auto Scaling Instances in a VPC (http://docs.aws.amazon.com/AutoScaling/latest/DeveloperGuide/asg-in-vpc.html) // in the Auto Scaling Developer Guide. // - // If you specify a value for this parameter, be sure to specify at least one - // subnet using the VPCZoneIdentifier parameter when you create your group. + // If you specify this parameter, be sure to specify at least one subnet when + // you create your group. // // Default: If the instance is launched into a default subnet, the default // is true. If the instance is launched into a nondefault subnet, the default @@ -2077,9 +2119,9 @@ type CreateLaunchConfigurationInput struct { // in the Amazon Elastic Compute Cloud User Guide. ClassicLinkVPCId *string `min:"1" type:"string"` - // The IDs of one or more security groups for the VPC specified in ClassicLinkVPCId. - // This parameter is required if ClassicLinkVPCId is specified, and is not supported - // otherwise. For more information, see ClassicLink (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/vpc-classiclink.html) + // The IDs of one or more security groups for the specified ClassicLink-enabled + // VPC. This parameter is required if you specify a ClassicLink-enabled VPC, + // and is not supported otherwise. For more information, see ClassicLink (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/vpc-classiclink.html) // in the Amazon Elastic Compute Cloud User Guide. ClassicLinkVPCSecurityGroups []*string `type:"list"` @@ -2108,7 +2150,7 @@ type CreateLaunchConfigurationInput struct { // in the Amazon Elastic Compute Cloud User Guide. ImageId *string `min:"1" type:"string"` - // The ID of the EC2 instance to use to create the launch configuration. + // The ID of the instance to use to create the launch configuration. // // The new launch configuration derives attributes from the instance, with // the exception of the block device mapping. @@ -2127,7 +2169,8 @@ type CreateLaunchConfigurationInput struct { // When detailed monitoring is enabled, Amazon CloudWatch generates metrics // every minute and your account is charged a fee. When you disable detailed // monitoring, by specifying False, CloudWatch generates metrics every 5 minutes. - // For more information, see Monitor Your Auto Scaling Instances (http://docs.aws.amazon.com/AutoScaling/latest/DeveloperGuide/as-instance-monitoring.html) + // For more information, see Monitoring Your Auto Scaling Instances and Groups + // (http://docs.aws.amazon.com/AutoScaling/latest/DeveloperGuide/as-instance-monitoring.html) // in the Auto Scaling Developer Guide. InstanceMonitoring *InstanceMonitoring `type:"structure"` @@ -2155,11 +2198,10 @@ type CreateLaunchConfigurationInput struct { // Dedicated Instances into a shared tenancy VPC (VPC with instance placement // tenancy attribute set to default). // - // If you specify a value for this parameter, be sure to specify at least one - // subnet using the VPCZoneIdentifier parameter when you create your group. + // If you specify this parameter, be sure to specify at least one subnet when + // you create your group. // - // For more information, see Auto Scaling and Amazon Virtual Private Cloud - // (http://docs.aws.amazon.com/AutoScaling/latest/DeveloperGuide/autoscalingsubnets.html) + // For more information, see Launching Auto Scaling Instances in a VPC (http://docs.aws.amazon.com/AutoScaling/latest/DeveloperGuide/asg-in-vpc.html) // in the Auto Scaling Developer Guide. // // Valid values: default | dedicated @@ -2182,7 +2224,7 @@ type CreateLaunchConfigurationInput struct { // The maximum hourly price to be paid for any Spot Instance launched to fulfill // the request. Spot Instances are launched when the price you specify exceeds - // the current Spot market price. For more information, see Launch Spot Instances + // the current Spot market price. For more information, see Launching Spot Instances // in Your Auto Scaling Group (http://docs.aws.amazon.com/AutoScaling/latest/DeveloperGuide/US-SpotInstances.html) // in the Auto Scaling Developer Guide. SpotPrice *string `min:"1" type:"string"` @@ -2190,9 +2232,6 @@ type CreateLaunchConfigurationInput struct { // The user data to make available to the launched EC2 instances. For more information, // see Instance Metadata and User Data (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-metadata.html) // in the Amazon Elastic Compute Cloud User Guide. - // - // At this time, launch configurations don't support compressed (zipped) user - // data files. UserData *string `type:"string"` } @@ -2458,10 +2497,7 @@ func (s DeleteScheduledActionOutput) GoString() string { type DeleteTagsInput struct { _ struct{} `type:"structure"` - // Each tag should be defined by its resource type, resource ID, key, value, - // and a propagate flag. Valid values are: Resource type = auto-scaling-group, - // Resource ID = AutoScalingGroupName, key=value, value=value, propagate=true - // or false. + // One or more tags. Tags []*Tag `type:"list" required:"true"` } @@ -2610,9 +2646,9 @@ func (s DescribeAutoScalingGroupsOutput) GoString() string { type DescribeAutoScalingInstancesInput struct { _ struct{} `type:"structure"` - // One or more Auto Scaling instances to describe, up to 50 instances. If you - // omit this parameter, all Auto Scaling instances are described. If you specify - // an ID that does not exist, it is ignored with no error. + // The instances to describe; up to 50 instance IDs. If you omit this parameter, + // all Auto Scaling instances are described. If you specify an ID that does + // not exist, it is ignored with no error. InstanceIds []*string `type:"list"` // The maximum number of items to return with this call. @@ -2994,10 +3030,10 @@ type DescribeScalingActivitiesInput struct { _ struct{} `type:"structure"` // The activity IDs of the desired scaling activities. If this list is omitted, - // all activities are described. If the AutoScalingGroupName parameter is provided, - // the results are limited to that group. The list of requested activities cannot - // contain more than 50 items. If unknown activities are requested, they are - // ignored with no error. + // all activities are described. If you specify an Auto Scaling group, the results + // are limited to that group. The list of requested activities cannot contain + // more than 50 items. If unknown activities are requested, they are ignored + // with no error. ActivityIds []*string `type:"list"` // The name of the group. @@ -3096,7 +3132,7 @@ type DescribeScheduledActionsInput struct { // // You can describe up to a maximum of 50 instances with a single call. If // there are more items to return, the call returns a token. To get the next - // set of items, repeat the call with the returned token in the NextToken parameter. + // set of items, repeat the call with the returned token. ScheduledActionNames []*string `type:"list"` // The earliest scheduled start time to return. If scheduled action names are @@ -3166,7 +3202,7 @@ type DescribeTagsOutput struct { // items to return, the string is empty. NextToken *string `type:"string"` - // The tags. + // One or more tags. Tags []*TagDescription `type:"list"` } @@ -3342,7 +3378,7 @@ func (s DisableMetricsCollectionOutput) GoString() string { type Ebs struct { _ struct{} `type:"structure"` - // Indicates whether to delete the volume on instance termination. + // Indicates whether the volume is deleted on instance termination. // // Default: true DeleteOnTermination *bool `type:"boolean"` @@ -3356,28 +3392,25 @@ type Ebs struct { // the Amazon Elastic Compute Cloud User Guide. Encrypted *bool `type:"boolean"` - // For Provisioned IOPS (SSD) volumes only. The number of I/O operations per - // second (IOPS) to provision for the volume. + // The number of I/O operations per second (IOPS) to provision for the volume. // - // Default: None + // Constraint: Required when the volume type is io1. Iops *int64 `min:"100" type:"integer"` // The ID of the snapshot. SnapshotId *string `min:"1" type:"string"` - // The volume size, in gigabytes. - // - // Valid values: If the volume type is io1, the minimum size of the volume - // is 10 GiB. If you specify SnapshotId and VolumeSize, VolumeSize must be equal - // to or larger than the size of the snapshot. + // The volume size, in GiB. For standard volumes, specify a value from 1 to + // 1,024. For io1 volumes, specify a value from 4 to 16,384. For gp2 volumes, + // specify a value from 1 to 16,384. If you specify a snapshot, the volume size + // must be equal to or larger than the snapshot size. // // Default: If you create a volume from a snapshot and you don't specify a - // volume size, the default is the size of the snapshot. - // - // Required: Required when the volume type is io1. + // volume size, the default is the snapshot size. VolumeSize *int64 `min:"1" type:"integer"` - // The volume type. + // The volume type. For more information, see Amazon EBS Volume Types (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSVolumeTypes.html) + // in the Amazon Elastic Compute Cloud User Guide. // // Valid values: standard | io1 | gp2 // @@ -3552,7 +3585,7 @@ type ExecutePolicyInput struct { // // This parameter is not supported if the policy type is StepScaling. // - // For more information, see Understanding Auto Scaling Cooldowns (http://docs.aws.amazon.com/AutoScaling/latest/DeveloperGuide/Cooldown.html) + // For more information, see Auto Scaling Cooldowns (http://docs.aws.amazon.com/AutoScaling/latest/DeveloperGuide/Cooldown.html) // in the Auto Scaling Developer Guide. HonorCooldown *bool `type:"boolean"` @@ -3749,7 +3782,9 @@ type Instance struct { // The Availability Zone in which the instance is running. AvailabilityZone *string `min:"1" type:"string" required:"true"` - // The health status of the instance. + // The health status of the instance. "Healthy" means that the instance is healthy + // and should remain in service. "Unhealthy" means that the instance is unhealthy + // and Auto Scaling should terminate and replace it. HealthStatus *string `min:"1" type:"string" required:"true"` // The ID of the instance. @@ -3799,7 +3834,7 @@ type InstanceDetails struct { LaunchConfigurationName *string `min:"1" type:"string" required:"true"` // The lifecycle state for the instance. For more information, see Auto Scaling - // Instance States (http://docs.aws.amazon.com/AutoScaling/latest/DeveloperGuide/AutoScalingGroupLifecycle.html#AutoScalingStates) + // Lifecycle (http://docs.aws.amazon.com/AutoScaling/latest/DeveloperGuide/AutoScalingGroupLifecycle.html) // in the Auto Scaling Developer Guide. LifecycleState *string `min:"1" type:"string" required:"true"` @@ -3853,8 +3888,8 @@ type LaunchConfiguration struct { ClassicLinkVPCId *string `min:"1" type:"string"` // The IDs of one or more security groups for the VPC specified in ClassicLinkVPCId. - // This parameter is required if ClassicLinkVPCId is specified, and cannot be - // used otherwise. For more information, see ClassicLink (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/vpc-classiclink.html) + // This parameter is required if you specify a ClassicLink-enabled VPC, and + // cannot be used otherwise. For more information, see ClassicLink (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/vpc-classiclink.html) // in the Amazon Elastic Compute Cloud User Guide. ClassicLinkVPCSecurityGroups []*string `type:"list"` @@ -3923,8 +3958,7 @@ func (s LaunchConfiguration) GoString() string { // // Pause the instance after it launches, but before it is put into service // Pause the instance as it terminates, but before it is fully terminated For -// more information, see Auto Scaling Pending State (http://docs.aws.amazon.com/AutoScaling/latest/DeveloperGuide/AutoScalingPendingState.html) -// and Auto Scaling Terminating State (http://docs.aws.amazon.com/AutoScaling/latest/DeveloperGuide/AutoScalingTerminatingState.html) +// more information, see Auto Scaling Lifecycle (http://docs.aws.amazon.com/AutoScaling/latest/DeveloperGuide/AutoScalingGroupLifecycle.html) // in the Auto Scaling Developer Guide. type LifecycleHook struct { _ struct{} `type:"structure"` @@ -3943,8 +3977,8 @@ type LifecycleHook struct { // The maximum time, in seconds, that can elapse before the lifecycle hook times // out. The default is 3600 seconds (1 hour). When the lifecycle hook times - // out, Auto Scaling performs the action defined in the DefaultResult parameter. - // You can prevent the lifecycle hook from timing out by calling RecordLifecycleActionHeartbeat. + // out, Auto Scaling performs the default action. You can prevent the lifecycle + // hook from timing out by calling RecordLifecycleActionHeartbeat. HeartbeatTimeout *int64 `type:"integer"` // The name of the lifecycle hook. @@ -4146,16 +4180,14 @@ type PutLifecycleHookInput struct { AutoScalingGroupName *string `min:"1" type:"string" required:"true"` // Defines the action the Auto Scaling group should take when the lifecycle - // hook timeout elapses or if an unexpected failure occurs. The value for this - // parameter can be either CONTINUE or ABANDON. The default value for this parameter - // is ABANDON. + // hook timeout elapses or if an unexpected failure occurs. This parameter can + // be either CONTINUE or ABANDON. The default value is ABANDON. DefaultResult *string `type:"string"` // The amount of time, in seconds, that can elapse before the lifecycle hook - // times out. When the lifecycle hook times out, Auto Scaling performs the action - // defined in the DefaultResult parameter. You can prevent the lifecycle hook - // from timing out by calling RecordLifecycleActionHeartbeat. The default is - // 3600 seconds (1 hour). + // times out. When the lifecycle hook times out, Auto Scaling performs the default + // action. You can prevent the lifecycle hook from timing out by calling RecordLifecycleActionHeartbeat. + // The default is 3600 seconds (1 hour). HeartbeatTimeout *int64 `type:"integer"` // The name of the lifecycle hook. @@ -4174,24 +4206,23 @@ type PutLifecycleHookInput struct { // The ARN of the notification target that Auto Scaling will use to notify you // when an instance is in the transition state for the lifecycle hook. This - // ARN target can be either an SQS queue or an SNS topic. - // - // This parameter is required for new lifecycle hooks, but optional when updating - // existing hooks. + // target can be either an SQS queue or an SNS topic. If you specify an empty + // string, this overrides the current ARN. // - // The notification message sent to the target will include: + // The notification messages sent to the target include the following information: // - // LifecycleActionToken. The Lifecycle action token. AccountId. The user account - // ID. AutoScalingGroupName. The name of the Auto Scaling group. LifecycleHookName. - // The lifecycle hook name. EC2InstanceId. The EC2 instance ID. LifecycleTransition. - // The lifecycle transition. NotificationMetadata. The notification metadata. + // AutoScalingGroupName. The name of the Auto Scaling group. AccountId. The + // AWS account ID. LifecycleTransition. The lifecycle hook type. LifecycleActionToken. + // The lifecycle action token. EC2InstanceId. The EC2 instance ID. LifecycleHookName. + // The name of the lifecycle hook. NotificationMetadata. User-defined information. // This operation uses the JSON format when sending notifications to an Amazon // SQS queue, and an email key/value pair format when sending notifications // to an Amazon SNS topic. // - // When you call this operation, a test message is sent to the notification - // target. This test message contains an additional key/value pair: Event:autoscaling:TEST_NOTIFICATION. - NotificationTargetARN *string `min:"1" type:"string"` + // When you specify a notification target, Auto Scaling sends it a test message. + // Test messages contains the following additional key/value pair: "Event": + // "autoscaling:TEST_NOTIFICATION". + NotificationTargetARN *string `type:"string"` // The ARN of the IAM role that allows the Auto Scaling group to publish to // the specified notification target. @@ -4283,7 +4314,7 @@ type PutScalingPolicyInput struct { // // This parameter is not supported unless the policy type is SimpleScaling. // - // For more information, see Understanding Auto Scaling Cooldowns (http://docs.aws.amazon.com/AutoScaling/latest/DeveloperGuide/Cooldown.html) + // For more information, see Auto Scaling Cooldowns (http://docs.aws.amazon.com/AutoScaling/latest/DeveloperGuide/Cooldown.html) // in the Auto Scaling Developer Guide. Cooldown *int64 `type:"integer"` @@ -4308,7 +4339,7 @@ type PutScalingPolicyInput struct { MinAdjustmentMagnitude *int64 `type:"integer"` // Available for backward compatibility. Use MinAdjustmentMagnitude instead. - MinAdjustmentStep *int64 `type:"integer"` + MinAdjustmentStep *int64 `deprecated:"true" type:"integer"` // The name of the policy. PolicyName *string `min:"1" type:"string" required:"true"` @@ -4399,10 +4430,7 @@ type PutScheduledUpdateGroupActionInput struct { // boundaries of when the recurring action starts and stops. StartTime *time.Time `type:"timestamp" timestampFormat:"iso8601"` - // This parameter is deprecated; use StartTime instead. - // - // The time for this action to start. If both Time and StartTime are specified, - // their values must be identical. + // This parameter is deprecated. Time *time.Time `type:"timestamp" timestampFormat:"iso8601"` } @@ -4436,10 +4464,13 @@ type RecordLifecycleActionHeartbeatInput struct { // The name of the Auto Scaling group for the hook. AutoScalingGroupName *string `min:"1" type:"string" required:"true"` + // The ID of the instance. + InstanceId *string `min:"1" type:"string"` + // A token that uniquely identifies a specific lifecycle action associated with // an instance. Auto Scaling sends this token to the notification target you // specified when you created the lifecycle hook. - LifecycleActionToken *string `min:"36" type:"string" required:"true"` + LifecycleActionToken *string `min:"36" type:"string"` // The name of the lifecycle hook. LifecycleHookName *string `min:"1" type:"string" required:"true"` @@ -4516,7 +4547,7 @@ type ScalingPolicy struct { MinAdjustmentMagnitude *int64 `type:"integer"` // Available for backward compatibility. Use MinAdjustmentMagnitude instead. - MinAdjustmentStep *int64 `type:"integer"` + MinAdjustmentStep *int64 `deprecated:"true" type:"integer"` // The Amazon Resource Name (ARN) of the policy. PolicyARN *string `min:"1" type:"string"` @@ -4619,7 +4650,7 @@ type ScheduledUpdateGroupAction struct { // boundaries of when the recurring action will start and stop. StartTime *time.Time `type:"timestamp" timestampFormat:"iso8601"` - // This parameter is deprecated; use StartTime instead. + // This parameter is deprecated. Time *time.Time `type:"timestamp" timestampFormat:"iso8601"` } @@ -4681,7 +4712,7 @@ type SetInstanceHealthInput struct { // of service. Auto Scaling will terminate and replace the unhealthy instance. HealthStatus *string `min:"1" type:"string" required:"true"` - // The ID of the EC2 instance. + // The ID of the instance. InstanceId *string `min:"1" type:"string" required:"true"` // If the Auto Scaling group of the specified instance has a HealthCheckGracePeriod @@ -4689,7 +4720,7 @@ type SetInstanceHealthInput struct { // Set this to False, if you do not want the call to respect the grace period // associated with the group. // - // For more information, see the HealthCheckGracePeriod parameter description + // For more information, see the description of the health check grace period // for CreateAutoScalingGroup. ShouldRespectGracePeriod *bool `type:"boolean"` } @@ -4921,7 +4952,7 @@ func (s TagDescription) GoString() string { type TerminateInstanceInAutoScalingGroupInput struct { _ struct{} `type:"structure"` - // The ID of the EC2 instance. + // The ID of the instance. InstanceId *string `min:"1" type:"string" required:"true"` // If true, terminating the instance also decrements the size of the Auto Scaling @@ -4968,7 +4999,7 @@ type UpdateAutoScalingGroupInput struct { // The amount of time, in seconds, after a scaling activity completes before // another scaling activity can start. The default is 300. // - // For more information, see Understanding Auto Scaling Cooldowns (http://docs.aws.amazon.com/AutoScaling/latest/DeveloperGuide/Cooldown.html) + // For more information, see Auto Scaling Cooldowns (http://docs.aws.amazon.com/AutoScaling/latest/DeveloperGuide/Cooldown.html) // in the Auto Scaling Developer Guide. DefaultCooldown *int64 `type:"integer"` @@ -4981,7 +5012,7 @@ type UpdateAutoScalingGroupInput struct { // health status of an EC2 instance that has come into service. The default // is 300. // - // For more information, see Health Checks For Auto Scaling Instances (http://docs.aws.amazon.com/AutoScaling/latest/DeveloperGuide/healthcheck.html) + // For more information, see Health Checks (http://docs.aws.amazon.com/AutoScaling/latest/DeveloperGuide/healthcheck.html) // in the Auto Scaling Developer Guide. HealthCheckGracePeriod *int64 `type:"integer"` @@ -5010,8 +5041,8 @@ type UpdateAutoScalingGroupInput struct { // select the instance to terminate. The policies are executed in the order // that they are listed. // - // For more information, see Choosing a Termination Policy for Your Auto Scaling - // Group (http://docs.aws.amazon.com/AutoScaling/latest/DeveloperGuide/us-termination-policy.html) + // For more information, see Controlling Which Instances Auto Scaling Terminates + // During Scale In (http://docs.aws.amazon.com/AutoScaling/latest/DeveloperGuide/AutoScalingBehavior.InstanceTermination.html) // in the Auto Scaling Developer Guide. TerminationPolicies []*string `type:"list"` @@ -5021,8 +5052,7 @@ type UpdateAutoScalingGroupInput struct { // When you specify VPCZoneIdentifier with AvailabilityZones, ensure that the // subnets' Availability Zones match the values you specify for AvailabilityZones. // - // For more information, see Auto Scaling and Amazon Virtual Private Cloud - // (http://docs.aws.amazon.com/AutoScaling/latest/DeveloperGuide/autoscalingsubnets.html) + // For more information, see Launching Auto Scaling Instances in a VPC (http://docs.aws.amazon.com/AutoScaling/latest/DeveloperGuide/asg-in-vpc.html) // in the Auto Scaling Developer Guide. VPCZoneIdentifier *string `min:"1" type:"string"` } diff --git a/vendor/github.com/aws/aws-sdk-go/service/autoscaling/service.go b/vendor/github.com/aws/aws-sdk-go/service/autoscaling/service.go index 8107b3e651..bb58f66ed4 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/autoscaling/service.go +++ b/vendor/github.com/aws/aws-sdk-go/service/autoscaling/service.go @@ -61,10 +61,10 @@ func newClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegio // Handlers svc.Handlers.Sign.PushBack(v4.Sign) - svc.Handlers.Build.PushBack(query.Build) - svc.Handlers.Unmarshal.PushBack(query.Unmarshal) - svc.Handlers.UnmarshalMeta.PushBack(query.UnmarshalMeta) - svc.Handlers.UnmarshalError.PushBack(query.UnmarshalError) + svc.Handlers.Build.PushBackNamed(query.BuildHandler) + svc.Handlers.Unmarshal.PushBackNamed(query.UnmarshalHandler) + svc.Handlers.UnmarshalMeta.PushBackNamed(query.UnmarshalMetaHandler) + svc.Handlers.UnmarshalError.PushBackNamed(query.UnmarshalErrorHandler) // Run custom client initialization if present if initClient != nil { diff --git a/vendor/github.com/aws/aws-sdk-go/service/autoscaling/waiters.go b/vendor/github.com/aws/aws-sdk-go/service/autoscaling/waiters.go new file mode 100644 index 0000000000..42595d2178 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/service/autoscaling/waiters.go @@ -0,0 +1,94 @@ +// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. + +package autoscaling + +import ( + "github.com/aws/aws-sdk-go/private/waiter" +) + +func (c *AutoScaling) WaitUntilGroupExists(input *DescribeAutoScalingGroupsInput) error { + waiterCfg := waiter.Config{ + Operation: "DescribeAutoScalingGroups", + Delay: 5, + MaxAttempts: 10, + Acceptors: []waiter.WaitAcceptor{ + { + State: "success", + Matcher: "path", + Argument: "length(AutoScalingGroups) > `0`", + Expected: true, + }, + { + State: "retry", + Matcher: "path", + Argument: "length(AutoScalingGroups) > `0`", + Expected: false, + }, + }, + } + + w := waiter.Waiter{ + Client: c, + Input: input, + Config: waiterCfg, + } + return w.Wait() +} + +func (c *AutoScaling) WaitUntilGroupInService(input *DescribeAutoScalingGroupsInput) error { + waiterCfg := waiter.Config{ + Operation: "DescribeAutoScalingGroups", + Delay: 15, + MaxAttempts: 40, + Acceptors: []waiter.WaitAcceptor{ + { + State: "success", + Matcher: "path", + Argument: "contains(AutoScalingGroups[].[length(Instances[?LifecycleState=='InService']) >= MinSize][], `false`)", + Expected: false, + }, + { + State: "retry", + Matcher: "path", + Argument: "contains(AutoScalingGroups[].[length(Instances[?LifecycleState=='InService']) >= MinSize][], `false`)", + Expected: true, + }, + }, + } + + w := waiter.Waiter{ + Client: c, + Input: input, + Config: waiterCfg, + } + return w.Wait() +} + +func (c *AutoScaling) WaitUntilGroupNotExists(input *DescribeAutoScalingGroupsInput) error { + waiterCfg := waiter.Config{ + Operation: "DescribeAutoScalingGroups", + Delay: 15, + MaxAttempts: 40, + Acceptors: []waiter.WaitAcceptor{ + { + State: "success", + Matcher: "path", + Argument: "length(AutoScalingGroups) > `0`", + Expected: false, + }, + { + State: "retry", + Matcher: "path", + Argument: "length(AutoScalingGroups) > `0`", + Expected: true, + }, + }, + } + + w := waiter.Waiter{ + Client: c, + Input: input, + Config: waiterCfg, + } + return w.Wait() +} diff --git a/vendor/github.com/aws/aws-sdk-go/service/cloudformation/api.go b/vendor/github.com/aws/aws-sdk-go/service/cloudformation/api.go index eb04e37eae..7ace19458c 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/cloudformation/api.go +++ b/vendor/github.com/aws/aws-sdk-go/service/cloudformation/api.go @@ -8,6 +8,8 @@ import ( "github.com/aws/aws-sdk-go/aws/awsutil" "github.com/aws/aws-sdk-go/aws/request" + "github.com/aws/aws-sdk-go/private/protocol" + "github.com/aws/aws-sdk-go/private/protocol/query" ) const opCancelUpdateStack = "CancelUpdateStack" @@ -25,6 +27,8 @@ func (c *CloudFormation) CancelUpdateStackRequest(input *CancelUpdateStackInput) } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &CancelUpdateStackOutput{} req.Data = output return @@ -40,6 +44,85 @@ func (c *CloudFormation) CancelUpdateStack(input *CancelUpdateStackInput) (*Canc return out, err } +const opContinueUpdateRollback = "ContinueUpdateRollback" + +// ContinueUpdateRollbackRequest generates a request for the ContinueUpdateRollback operation. +func (c *CloudFormation) ContinueUpdateRollbackRequest(input *ContinueUpdateRollbackInput) (req *request.Request, output *ContinueUpdateRollbackOutput) { + op := &request.Operation{ + Name: opContinueUpdateRollback, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &ContinueUpdateRollbackInput{} + } + + req = c.newRequest(op, input, output) + output = &ContinueUpdateRollbackOutput{} + req.Data = output + return +} + +// For a specified stack that is in the UPDATE_ROLLBACK_FAILED state, continues +// rolling it back to the UPDATE_ROLLBACK_COMPLETE state. Depending on the cause +// of the failure, you can manually fix the error (http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/troubleshooting.html#troubleshooting-errors-update-rollback-failed) +// and continue the rollback. By continuing the rollback, you can return your +// stack to a working state (the UPDATE_ROLLBACK_COMPLETE state), and then try +// to update the stack again. +// +// A stack goes into the UPDATE_ROLLBACK_FAILED state when AWS CloudFormation +// cannot roll back all changes after a failed stack update. For example, you +// might have a stack that is rolling back to an old database instance that +// was deleted outside of AWS CloudFormation. Because AWS CloudFormation doesn't +// know the database was deleted, it assumes that the database instance still +// exists and attempts to roll back to it, causing the update rollback to fail. +func (c *CloudFormation) ContinueUpdateRollback(input *ContinueUpdateRollbackInput) (*ContinueUpdateRollbackOutput, error) { + req, out := c.ContinueUpdateRollbackRequest(input) + err := req.Send() + return out, err +} + +const opCreateChangeSet = "CreateChangeSet" + +// CreateChangeSetRequest generates a request for the CreateChangeSet operation. +func (c *CloudFormation) CreateChangeSetRequest(input *CreateChangeSetInput) (req *request.Request, output *CreateChangeSetOutput) { + op := &request.Operation{ + Name: opCreateChangeSet, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &CreateChangeSetInput{} + } + + req = c.newRequest(op, input, output) + output = &CreateChangeSetOutput{} + req.Data = output + return +} + +// Creates a list of changes for a stack. AWS CloudFormation generates the change +// set by comparing the stack's information with the information that you submit. +// A change set can help you understand which resources AWS CloudFormation will +// change and how it will change them before you update your stack. Change sets +// allow you to check before you make a change so that you don't delete or replace +// critical resources. +// +// AWS CloudFormation doesn't make any changes to the stack when you create +// a change set. To make the specified changes, you must execute the change +// set by using the ExecuteChangeSet action. +// +// After the call successfully completes, AWS CloudFormation starts creating +// the change set. To check the status of the change set, use the DescribeChangeSet +// action. +func (c *CloudFormation) CreateChangeSet(input *CreateChangeSetInput) (*CreateChangeSetOutput, error) { + req, out := c.CreateChangeSetRequest(input) + err := req.Send() + return out, err +} + const opCreateStack = "CreateStack" // CreateStackRequest generates a request for the CreateStack operation. @@ -69,6 +152,37 @@ func (c *CloudFormation) CreateStack(input *CreateStackInput) (*CreateStackOutpu return out, err } +const opDeleteChangeSet = "DeleteChangeSet" + +// DeleteChangeSetRequest generates a request for the DeleteChangeSet operation. +func (c *CloudFormation) DeleteChangeSetRequest(input *DeleteChangeSetInput) (req *request.Request, output *DeleteChangeSetOutput) { + op := &request.Operation{ + Name: opDeleteChangeSet, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &DeleteChangeSetInput{} + } + + req = c.newRequest(op, input, output) + output = &DeleteChangeSetOutput{} + req.Data = output + return +} + +// Deletes the specified change set. Deleting change sets ensures that no one +// executes the wrong change set. +// +// If the call successfully completes, AWS CloudFormation successfully deleted +// the change set. +func (c *CloudFormation) DeleteChangeSet(input *DeleteChangeSetInput) (*DeleteChangeSetOutput, error) { + req, out := c.DeleteChangeSetRequest(input) + err := req.Send() + return out, err +} + const opDeleteStack = "DeleteStack" // DeleteStackRequest generates a request for the DeleteStack operation. @@ -84,6 +198,8 @@ func (c *CloudFormation) DeleteStackRequest(input *DeleteStackInput) (req *reque } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &DeleteStackOutput{} req.Data = output return @@ -126,6 +242,36 @@ func (c *CloudFormation) DescribeAccountLimits(input *DescribeAccountLimitsInput return out, err } +const opDescribeChangeSet = "DescribeChangeSet" + +// DescribeChangeSetRequest generates a request for the DescribeChangeSet operation. +func (c *CloudFormation) DescribeChangeSetRequest(input *DescribeChangeSetInput) (req *request.Request, output *DescribeChangeSetOutput) { + op := &request.Operation{ + Name: opDescribeChangeSet, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &DescribeChangeSetInput{} + } + + req = c.newRequest(op, input, output) + output = &DescribeChangeSetOutput{} + req.Data = output + return +} + +// Returns the inputs for the change set and a list of changes that AWS CloudFormation +// will make if you execute the change set. For more information, see Updating +// Stacks Using Change Sets (http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-changesets.html) +// in the AWS CloudFormation User Guide. +func (c *CloudFormation) DescribeChangeSet(input *DescribeChangeSetInput) (*DescribeChangeSetOutput, error) { + req, out := c.DescribeChangeSetRequest(input) + err := req.Send() + return out, err +} + const opDescribeStackEvents = "DescribeStackEvents" // DescribeStackEventsRequest generates a request for the DescribeStackEvents operation. @@ -235,7 +381,7 @@ func (c *CloudFormation) DescribeStackResourcesRequest(input *DescribeStackResou // You must specify either StackName or PhysicalResourceId, but not both. In // addition, you can specify LogicalResourceId to filter the returned result. // For more information about resources, the LogicalResourceId and PhysicalResourceId, -// go to the AWS CloudFormation User Guide (http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide). +// go to the AWS CloudFormation User Guide (http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/). // // A ValidationError is returned if you specify both StackName and PhysicalResourceId // in the same request. @@ -316,6 +462,44 @@ func (c *CloudFormation) EstimateTemplateCost(input *EstimateTemplateCostInput) return out, err } +const opExecuteChangeSet = "ExecuteChangeSet" + +// ExecuteChangeSetRequest generates a request for the ExecuteChangeSet operation. +func (c *CloudFormation) ExecuteChangeSetRequest(input *ExecuteChangeSetInput) (req *request.Request, output *ExecuteChangeSetOutput) { + op := &request.Operation{ + Name: opExecuteChangeSet, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &ExecuteChangeSetInput{} + } + + req = c.newRequest(op, input, output) + output = &ExecuteChangeSetOutput{} + req.Data = output + return +} + +// Updates a stack using the input information that was provided when the specified +// change set was created. After the call successfully completes, AWS CloudFormation +// starts updating the stack. Use the DescribeStacks action to view the status +// of the update. +// +// When you execute a change set, AWS CloudFormation deletes all other change +// sets associated with the stack because they aren't valid for the updated +// stack. +// +// If a stack policy is associated with the stack, AWS CloudFormation enforces +// the policy during the update. You can't specify a temporary stack policy +// that overrides the current policy. +func (c *CloudFormation) ExecuteChangeSet(input *ExecuteChangeSetInput) (*ExecuteChangeSetOutput, error) { + req, out := c.ExecuteChangeSetRequest(input) + err := req.Send() + return out, err +} + const opGetStackPolicy = "GetStackPolicy" // GetStackPolicyRequest generates a request for the GetStackPolicy operation. @@ -413,6 +597,35 @@ func (c *CloudFormation) GetTemplateSummary(input *GetTemplateSummaryInput) (*Ge return out, err } +const opListChangeSets = "ListChangeSets" + +// ListChangeSetsRequest generates a request for the ListChangeSets operation. +func (c *CloudFormation) ListChangeSetsRequest(input *ListChangeSetsInput) (req *request.Request, output *ListChangeSetsOutput) { + op := &request.Operation{ + Name: opListChangeSets, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &ListChangeSetsInput{} + } + + req = c.newRequest(op, input, output) + output = &ListChangeSetsOutput{} + req.Data = output + return +} + +// Returns the ID and status of each active change set for a stack. For example, +// AWS CloudFormation lists change sets that are in the CREATE_IN_PROGRESS or +// CREATE_PENDING state. +func (c *CloudFormation) ListChangeSets(input *ListChangeSetsInput) (*ListChangeSetsOutput, error) { + req, out := c.ListChangeSetsRequest(input) + err := req.Send() + return out, err +} + const opListStackResources = "ListStackResources" // ListStackResourcesRequest generates a request for the ListStackResources operation. @@ -517,6 +730,8 @@ func (c *CloudFormation) SetStackPolicyRequest(input *SetStackPolicyInput) (req } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &SetStackPolicyOutput{} req.Data = output return @@ -544,6 +759,8 @@ func (c *CloudFormation) SignalResourceRequest(input *SignalResourceInput) (req } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &SignalResourceOutput{} req.Data = output return @@ -588,9 +805,6 @@ func (c *CloudFormation) UpdateStackRequest(input *UpdateStackInput) (req *reque // To get a copy of the template for an existing stack, you can use the GetTemplate // action. // -// Tags that were associated with this stack during creation time will still -// be associated with the stack after an UpdateStack operation. -// // For more information about creating an update template, updating a stack, // and monitoring the progress of the update, see Updating a Stack (http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks.html). func (c *CloudFormation) UpdateStack(input *UpdateStackInput) (*UpdateStackOutput, error) { @@ -679,13 +893,237 @@ func (s CancelUpdateStackOutput) GoString() string { return s.String() } +// The Change structure describes the changes AWS CloudFormation will perform +// if you execute the change set. +type Change struct { + _ struct{} `type:"structure"` + + // A ResourceChange structure that describes the resource and action that AWS + // CloudFormation will perform. + ResourceChange *ResourceChange `type:"structure"` + + // The type of entity that AWS CloudFormation changes. Currently, the only entity + // type is Resource. + Type *string `type:"string" enum:"ChangeType"` +} + +// String returns the string representation +func (s Change) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s Change) GoString() string { + return s.String() +} + +// The ChangeSetSummary structure describes a change set, its status, and the +// stack with which it's associated. +type ChangeSetSummary struct { + _ struct{} `type:"structure"` + + // The ID of the change set. + ChangeSetId *string `min:"1" type:"string"` + + // The name of the change set. + ChangeSetName *string `min:"1" type:"string"` + + // The start time when the change set was created, in UTC. + CreationTime *time.Time `type:"timestamp" timestampFormat:"iso8601"` + + // Descriptive information about the change set. + Description *string `min:"1" type:"string"` + + // The ID of the stack with which the change set is associated. + StackId *string `type:"string"` + + // The name of the stack with which the change set is associated. + StackName *string `type:"string"` + + // The state of the change set, such as CREATE_IN_PROGRESS, CREATE_COMPLETE, + // or FAILED. + Status *string `type:"string" enum:"ChangeSetStatus"` + + // A description of the change set's status. For example, if your change set + // is in the FAILED state, AWS CloudFormation shows the error message. + StatusReason *string `type:"string"` +} + +// String returns the string representation +func (s ChangeSetSummary) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ChangeSetSummary) GoString() string { + return s.String() +} + +// The input for the ContinueUpdateRollback action. +type ContinueUpdateRollbackInput struct { + _ struct{} `type:"structure"` + + // The name or the unique ID of the stack that you want to continue rolling + // back. + StackName *string `min:"1" type:"string" required:"true"` +} + +// String returns the string representation +func (s ContinueUpdateRollbackInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ContinueUpdateRollbackInput) GoString() string { + return s.String() +} + +// The output for a ContinueUpdateRollback action. +type ContinueUpdateRollbackOutput struct { + _ struct{} `type:"structure"` +} + +// String returns the string representation +func (s ContinueUpdateRollbackOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ContinueUpdateRollbackOutput) GoString() string { + return s.String() +} + +// The input for the CreateChangeSet action. +type CreateChangeSetInput struct { + _ struct{} `type:"structure"` + + // A list of capabilities that you must specify before AWS CloudFormation can + // update certain stacks. Some stack templates might include resources that + // can affect permissions in your AWS account, for example, by creating new + // AWS Identity and Access Management (IAM) users. For those stacks, you must + // explicitly acknowledge their capabilities by specifying this parameter. + // + // Currently, the only valid value is CAPABILITY_IAM, which is required for + // the following resources: AWS::IAM::AccessKey (http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iam-accesskey.html), + // AWS::IAM::Group (http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iam-group.html), + // AWS::IAM::InstanceProfile (http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iam-instanceprofile.html), + // AWS::IAM::Policy (http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iam-policy.html), + // AWS::IAM::Role (http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iam-role.html), + // AWS::IAM::User (http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iam-user.html), + // and AWS::IAM::UserToGroupAddition (http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iam-addusertogroup.html). + // If your stack template contains these resources, we recommend that you review + // all permissions associated with them and edit their permissions if necessary. + // If your template contains any of the listed resources and you don't specify + // this parameter, this action returns an InsufficientCapabilities error. + Capabilities []*string `type:"list"` + + // The name of the change set. The name must be unique among all change sets + // that are associated with the specified stack. + // + // A change set name can contain only alphanumeric, case sensitive characters + // and hyphens. It must start with an alphabetic character and cannot exceed + // 128 characters. + ChangeSetName *string `min:"1" type:"string" required:"true"` + + // A unique identifier for this CreateChangeSet request. Specify this token + // if you plan to retry requests so that AWS CloudFormation knows that you're + // not attempting to create another change set with the same name. You might + // retry CreateChangeSet requests to ensure that AWS CloudFormation successfully + // received them. + ClientToken *string `min:"1" type:"string"` + + // A description to help you identify this change set. + Description *string `min:"1" type:"string"` + + // The Amazon Resource Names (ARNs) of Amazon Simple Notification Service (Amazon + // SNS) topics that AWS CloudFormation associates with the stack. To remove + // all associated notification topics, specify an empty list. + NotificationARNs []*string `type:"list"` + + // A list of Parameter structures that specify input parameters for the change + // set. For more information, see the Parameter (http://docs.aws.amazon.com/AWSCloudFormation/latest/APIReference/API_Parameter.html) + // data type. + Parameters []*Parameter `type:"list"` + + // The template resource types that you have permissions to work with if you + // execute this change set, such as AWS::EC2::Instance, AWS::EC2::*, or Custom::MyCustomInstance. + // + // If the list of resource types doesn't include a resource type that you're + // updating, the stack update fails. By default, AWS CloudFormation grants permissions + // to all resource types. AWS Identity and Access Management (IAM) uses this + // parameter for condition keys in IAM policies for AWS CloudFormation. For + // more information, see Controlling Access with AWS Identity and Access Management + // (http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-iam-template.html) + // in the AWS CloudFormation User Guide. + ResourceTypes []*string `type:"list"` + + // The name or the unique ID of the stack for which you are creating a change + // set. AWS CloudFormation generates the change set by comparing this stack's + // information with the information that you submit, such as a modified template + // or different parameter input values. + StackName *string `min:"1" type:"string" required:"true"` + + // Key-value pairs to associate with this stack. AWS CloudFormation also propagates + // these tags to resources in the stack. You can specify a maximum of 10 tags. + Tags []*Tag `type:"list"` + + // A structure that contains the body of the revised template, with a minimum + // length of 1 byte and a maximum length of 51,200 bytes. AWS CloudFormation + // generates the change set by comparing this template with the template of + // the stack that you specified. + // + // Conditional: You must specify only TemplateBody or TemplateURL. + TemplateBody *string `min:"1" type:"string"` + + // The location of the file that contains the revised template. The URL must + // point to a template (max size: 460,800 bytes) that is located in an S3 bucket. + // AWS CloudFormation generates the change set by comparing this template with + // the stack that you specified. + // + // Conditional: You must specify only TemplateBody or TemplateURL. + TemplateURL *string `min:"1" type:"string"` + + // Whether to reuse the template that is associated with the stack to create + // the change set. + UsePreviousTemplate *bool `type:"boolean"` +} + +// String returns the string representation +func (s CreateChangeSetInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s CreateChangeSetInput) GoString() string { + return s.String() +} + +// The output for the CreateChangeSet action. +type CreateChangeSetOutput struct { + _ struct{} `type:"structure"` + + // The Amazon Resource Name (ARN) of the change set. + Id *string `min:"1" type:"string"` +} + +// String returns the string representation +func (s CreateChangeSetOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s CreateChangeSetOutput) GoString() string { + return s.String() +} + // The input for CreateStack action. type CreateStackInput struct { _ struct{} `type:"structure"` // A list of capabilities that you must specify before AWS CloudFormation can - // create or update certain stacks. Some stack templates might include resources - // that can affect permissions in your AWS account. For those stacks, you must + // create certain stacks. Some stack templates might include resources that + // can affect permissions in your AWS account, for example, by creating new + // AWS Identity and Access Management (IAM) users. For those stacks, you must // explicitly acknowledge their capabilities by specifying this parameter. // // Currently, the only valid value is CAPABILITY_IAM, which is required for @@ -697,8 +1135,9 @@ type CreateStackInput struct { // AWS::IAM::User (http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iam-user.html), // and AWS::IAM::UserToGroupAddition (http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iam-addusertogroup.html). // If your stack template contains these resources, we recommend that you review - // any permissions associated with them. If you don't specify this parameter, - // this action returns an InsufficientCapabilities error. + // all permissions associated with them and edit their permissions if necessary. + // If your template contains any of the listed resources and you don't specify + // this parameter, this action returns an InsufficientCapabilities error. Capabilities []*string `type:"list"` // Set to true to disable rollback of the stack if stack creation failed. You @@ -720,6 +1159,8 @@ type CreateStackInput struct { OnFailure *string `type:"string" enum:"OnFailure"` // A list of Parameter structures that specify input parameters for the stack. + // For more information, see the Parameter (http://docs.aws.amazon.com/AWSCloudFormation/latest/APIReference/API_Parameter.html) + // data type. Parameters []*Parameter `type:"list"` // The template resource types that you have permissions to work with for this @@ -743,7 +1184,7 @@ type CreateStackInput struct { // // A stack name can contain only alphanumeric characters (case sensitive) and // hyphens. It must start with an alphabetic character and cannot be longer - // than 255 characters. + // than 128 characters. StackName *string `type:"string" required:"true"` // Structure containing the stack policy body. For more information, go to @@ -758,9 +1199,9 @@ type CreateStackInput struct { // but not both. StackPolicyURL *string `min:"1" type:"string"` - // A set of user-defined Tags to associate with this stack, represented by key/value - // pairs. Tags defined for the stack are propagated to EC2 resources that are - // created as part of the stack. A maximum number of 10 tags can be specified. + // Key-value pairs to associate with this stack. AWS CloudFormation also propagates + // these tags to the resources created in the stack. A maximum number of 10 + // tags can be specified. Tags []*Tag `type:"list"` // Structure containing the template body with a minimum length of 1 byte and @@ -815,10 +1256,56 @@ func (s CreateStackOutput) GoString() string { return s.String() } +// The input for the DeleteChangeSet action. +type DeleteChangeSetInput struct { + _ struct{} `type:"structure"` + + // The name or Amazon Resource Name (ARN) of the change set that you want to + // delete. + ChangeSetName *string `min:"1" type:"string" required:"true"` + + // If you specified the name of a change set to delete, specify the stack name + // or ID (ARN) that is associated with it. + StackName *string `min:"1" type:"string"` +} + +// String returns the string representation +func (s DeleteChangeSetInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DeleteChangeSetInput) GoString() string { + return s.String() +} + +// The output for the DeleteChangeSet action. +type DeleteChangeSetOutput struct { + _ struct{} `type:"structure"` +} + +// String returns the string representation +func (s DeleteChangeSetOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DeleteChangeSetOutput) GoString() string { + return s.String() +} + // The input for DeleteStack action. type DeleteStackInput struct { _ struct{} `type:"structure"` + // For stacks in the DELETE_FAILED state, a list of resource logical IDs that + // are associated with the resources you want to retain. During deletion, AWS + // CloudFormation deletes the stack but does not delete the retained resources. + // + // Retaining resources is useful when you cannot delete a resource, such as + // a non-empty S3 bucket, but you want to delete the stack. + RetainResources []*string `type:"list"` + // The name or the unique stack ID that is associated with the stack. StackName *string `type:"string" required:"true"` } @@ -873,8 +1360,8 @@ type DescribeAccountLimitsOutput struct { // limits and their values. AccountLimits []*AccountLimit `type:"list"` - // A string that identifies the next page of limits. If no additional page exists, - // this value is null. + // If the output exceeds 1 MB in size, a string that identifies the next page + // of limits. If no additional page exists, this value is null. NextToken *string `min:"1" type:"string"` } @@ -888,14 +1375,105 @@ func (s DescribeAccountLimitsOutput) GoString() string { return s.String() } +// The input for the DescribeChangeSet action. +type DescribeChangeSetInput struct { + _ struct{} `type:"structure"` + + // The name or Amazon Resource Name (ARN) of the change set that you want to + // describe. + ChangeSetName *string `min:"1" type:"string" required:"true"` + + // A string (provided by the DescribeChangeSet response output) that identifies + // the next page of information that you want to retrieve. + NextToken *string `min:"1" type:"string"` + + // If you specified the name of a change set, specify the stack name or ID (ARN) + // of the change set you want to describe. + StackName *string `min:"1" type:"string"` +} + +// String returns the string representation +func (s DescribeChangeSetInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DescribeChangeSetInput) GoString() string { + return s.String() +} + +// The output for the DescribeChangeSet action. +type DescribeChangeSetOutput struct { + _ struct{} `type:"structure"` + + // If you execute the change set, the list of capabilities that were explicitly + // acknowledged when the change set was created. + Capabilities []*string `type:"list"` + + // The ARN of the change set. + ChangeSetId *string `min:"1" type:"string"` + + // The name of the change set. + ChangeSetName *string `min:"1" type:"string"` + + // A list of Change structures that describes the resources AWS CloudFormation + // changes if you execute the change set. + Changes []*Change `type:"list"` + + // The start time when the change set was created, in UTC. + CreationTime *time.Time `type:"timestamp" timestampFormat:"iso8601"` + + // Information about the change set. + Description *string `min:"1" type:"string"` + + // If the output exceeds 1 MB, a string that identifies the next page of changes. + // If there is no additional page, this value is null. + NextToken *string `min:"1" type:"string"` + + // The ARNs of the Amazon Simple Notification Service (Amazon SNS) topics that + // will be associated with the stack if you execute the change set. + NotificationARNs []*string `type:"list"` + + // A list of Parameter structures that describes the input parameters and their + // values used to create the change set. For more information, see the Parameter + // (http://docs.aws.amazon.com/AWSCloudFormation/latest/APIReference/API_Parameter.html) + // data type. + Parameters []*Parameter `type:"list"` + + // The ARN of the stack that is associated with the change set. + StackId *string `type:"string"` + + // The name of the stack that is associated with the change set. + StackName *string `type:"string"` + + // The current status of the change set, such as CREATE_IN_PROGRESS, CREATE_COMPLETE, + // or FAILED. + Status *string `type:"string" enum:"ChangeSetStatus"` + + // A description of the change set's status. For example, if your attempt to + // create a change set failed, AWS CloudFormation shows the error message. + StatusReason *string `type:"string"` + + // If you execute the change set, the tags that will be associated with the + // stack. + Tags []*Tag `type:"list"` +} + +// String returns the string representation +func (s DescribeChangeSetOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DescribeChangeSetOutput) GoString() string { + return s.String() +} + // The input for DescribeStackEvents action. type DescribeStackEventsInput struct { _ struct{} `type:"structure"` - // String that identifies the start of the next list of events, if there is - // one. - // - // Default: There is no default value. + // A string that identifies the next page of events that you want to retrieve. NextToken *string `min:"1" type:"string"` // The name or the unique stack ID that is associated with the stack, which @@ -921,8 +1499,8 @@ func (s DescribeStackEventsInput) GoString() string { type DescribeStackEventsOutput struct { _ struct{} `type:"structure"` - // String that identifies the start of the next list of events, if there is - // one. + // If the output exceeds 1 MB in size, a string that identifies the next page + // of events. If no additional page exists, this value is null. NextToken *string `min:"1" type:"string"` // A list of StackEvents structures. @@ -1053,8 +1631,7 @@ func (s DescribeStackResourcesOutput) GoString() string { type DescribeStacksInput struct { _ struct{} `type:"structure"` - // String that identifies the start of the next list of stacks, if there is - // one. + // A string that identifies the next page of stacks that you want to retrieve. NextToken *string `min:"1" type:"string"` // The name or the unique stack ID that is associated with the stack, which @@ -1080,8 +1657,8 @@ func (s DescribeStacksInput) GoString() string { type DescribeStacksOutput struct { _ struct{} `type:"structure"` - // String that identifies the start of the next list of stacks, if there is - // one. + // If the output exceeds 1 MB in size, a string that identifies the next page + // of stacks. If no additional page exists, this value is null. NextToken *string `min:"1" type:"string"` // A list of stack structures. @@ -1152,6 +1729,44 @@ func (s EstimateTemplateCostOutput) GoString() string { return s.String() } +// The input for the ExecuteChangeSet action. +type ExecuteChangeSetInput struct { + _ struct{} `type:"structure"` + + // The name or ARN of the change set that you want use to update the specified + // stack. + ChangeSetName *string `min:"1" type:"string" required:"true"` + + // If you specified the name of a change set, specify the stack name or ID (ARN) + // that is associated with the change set you want to execute. + StackName *string `min:"1" type:"string"` +} + +// String returns the string representation +func (s ExecuteChangeSetInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ExecuteChangeSetInput) GoString() string { + return s.String() +} + +// The output for the ExecuteChangeSet action. +type ExecuteChangeSetOutput struct { + _ struct{} `type:"structure"` +} + +// String returns the string representation +func (s ExecuteChangeSetOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ExecuteChangeSetOutput) GoString() string { + return s.String() +} + // The input for the GetStackPolicy action. type GetStackPolicyInput struct { _ struct{} `type:"structure"` @@ -1292,7 +1907,7 @@ type GetTemplateSummaryOutput struct { CapabilitiesReason *string `type:"string"` // The value that is defined in the Description property of the template. - Description *string `type:"string"` + Description *string `min:"1" type:"string"` // The value that is defined for the Metadata property of the template. Metadata *string `type:"string"` @@ -1303,11 +1918,6 @@ type GetTemplateSummaryOutput struct { // A list of all the template resource types that are defined in the template, // such as AWS::EC2::Instance, AWS::Dynamo::Table, and Custom::MyCustomInstance. - // Use the following syntax to describe template resource types: AWS::* (for - // all AWS resources), Custom::* (for all custom resources), Custom::logical_ID - // (for a specific custom resource), AWS::service_name::* (for all resources - // of a particular AWS service), and AWS::service_name::resource_logical_ID - // (for a specific AWS resource). ResourceTypes []*string `type:"list"` // The AWS template format version, which identifies the capabilities of the @@ -1325,14 +1935,58 @@ func (s GetTemplateSummaryOutput) GoString() string { return s.String() } +// The input for the ListChangeSets action. +type ListChangeSetsInput struct { + _ struct{} `type:"structure"` + + // A string (provided by the ListChangeSets response output) that identifies + // the next page of change sets that you want to retrieve. + NextToken *string `min:"1" type:"string"` + + // The name or the Amazon Resource Name (ARN) of the stack for which you want + // to list change sets. + StackName *string `min:"1" type:"string" required:"true"` +} + +// String returns the string representation +func (s ListChangeSetsInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ListChangeSetsInput) GoString() string { + return s.String() +} + +// The output for the ListChangeSets action. +type ListChangeSetsOutput struct { + _ struct{} `type:"structure"` + + // If the output exceeds 1 MB, a string that identifies the next page of change + // sets. If there is no additional page, this value is null. + NextToken *string `min:"1" type:"string"` + + // A list of ChangeSetSummary structures that provides the ID and status of + // each change set for the specified stack. + Summaries []*ChangeSetSummary `type:"list"` +} + +// String returns the string representation +func (s ListChangeSetsOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ListChangeSetsOutput) GoString() string { + return s.String() +} + // The input for the ListStackResource action. type ListStackResourcesInput struct { _ struct{} `type:"structure"` - // String that identifies the start of the next list of stack resource summaries, - // if there is one. - // - // Default: There is no default value. + // A string that identifies the next page of stack resources that you want to + // retrieve. NextToken *string `min:"1" type:"string"` // The name or the unique stack ID that is associated with the stack, which @@ -1358,8 +2012,8 @@ func (s ListStackResourcesInput) GoString() string { type ListStackResourcesOutput struct { _ struct{} `type:"structure"` - // String that identifies the start of the next list of stack resources, if - // there is one. + // If the output exceeds 1 MB, a string that identifies the next page of stack + // resources. If no additional page exists, this value is null. NextToken *string `min:"1" type:"string"` // A list of StackResourceSummary structures. @@ -1380,10 +2034,7 @@ func (s ListStackResourcesOutput) GoString() string { type ListStacksInput struct { _ struct{} `type:"structure"` - // String that identifies the start of the next list of stacks, if there is - // one. - // - // Default: There is no default value. + // A string that identifies the next page of stacks that you want to retrieve. NextToken *string `min:"1" type:"string"` // Stack status to use as a filter. Specify one or more stack status codes to @@ -1406,8 +2057,8 @@ func (s ListStacksInput) GoString() string { type ListStacksOutput struct { _ struct{} `type:"structure"` - // String that identifies the start of the next list of stacks, if there is - // one. + // If the output exceeds 1 MB in size, a string that identifies the next page + // of stacks. If no additional page exists, this value is null. NextToken *string `min:"1" type:"string"` // A list of StackSummary structures containing information about the specified @@ -1430,7 +2081,7 @@ type Output struct { _ struct{} `type:"structure"` // User defined description associated with the output. - Description *string `type:"string"` + Description *string `min:"1" type:"string"` // The key associated with the output. OutputKey *string `type:"string"` @@ -1505,7 +2156,7 @@ type ParameterDeclaration struct { DefaultValue *string `type:"string"` // The description that is associate with the parameter. - Description *string `type:"string"` + Description *string `min:"1" type:"string"` // Flag that indicates whether the parameter value is shown as plain text in // logs and in the AWS Management Console. @@ -1531,6 +2182,152 @@ func (s ParameterDeclaration) GoString() string { return s.String() } +// The ResourceChange structure describes the resource and the action that AWS +// CloudFormation will perform on it if you execute this change set. +type ResourceChange struct { + _ struct{} `type:"structure"` + + // The action that AWS CloudFormation takes on the resource, such as Add (adds + // a new resource), Modify (changes a resource), or Remove (deletes a resource). + Action *string `type:"string" enum:"ChangeAction"` + + // For the Modify action, a list of ResourceChangeDetail structures that describes + // the changes that AWS CloudFormation will make to the resource. + Details []*ResourceChangeDetail `type:"list"` + + // The resource's logical ID, which is defined in the stack's template. + LogicalResourceId *string `type:"string"` + + // The resource's physical ID (resource name). Resources that you are adding + // don't have physical IDs because they haven't been created. + PhysicalResourceId *string `type:"string"` + + // For the Modify action, indicates whether AWS CloudFormation will replace + // the resource by creating a new one and deleting the old one. This value depends + // on the value of the RequiresRecreation property in the ResourceTargetDefinition + // structure. For example, if the RequiresRecreation field is Always and the + // Evaluation field is Static, Replacement is True. If the RequiresRecreation + // field is Always and the Evaluation field is Dynamic, Replacement is Conditionally. + // + // If you have multiple changes with different RequiresRecreation values, the + // Replacement value depends on the change with the most impact. A RequiresRecreation + // value of Always has the most impact, followed by Conditionally, and then + // Never. + Replacement *string `type:"string" enum:"Replacement"` + + // The type of AWS CloudFormation resource, such as AWS::S3::Bucket. + ResourceType *string `min:"1" type:"string"` + + // For the Modify action, indicates which resource attribute is triggering this + // update, such as a change in the resource attribute's Metadata, Properties, + // or Tags. + Scope []*string `type:"list"` +} + +// String returns the string representation +func (s ResourceChange) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ResourceChange) GoString() string { + return s.String() +} + +// For a resource with Modify as the action, the ResourceChange structure describes +// the changes AWS CloudFormation will make to that resource. +type ResourceChangeDetail struct { + _ struct{} `type:"structure"` + + // The identity of the entity that triggered this change. This entity is a member + // of the group that is specified by the ChangeSource field. For example, if + // you modified the value of the KeyPairName parameter, the CausingEntity is + // the name of the parameter (KeyPairName). + // + // If the ChangeSource value is DirectModification, no value is given for CausingEntity. + CausingEntity *string `type:"string"` + + // The group to which the CausingEntity value belongs. There are five entity + // groups: + // + // ResourceReference entities are Ref intrinsic functions that refer to resources + // in the template, such as { "Ref" : "MyEC2InstanceResource" }. ParameterReference + // entities are Ref intrinsic functions that get template parameter values, + // such as { "Ref" : "MyPasswordParameter" }. ResourceAttribute entities are + // Fn::GetAtt intrinsic functions that get resource attribute values, such as + // { "Fn::GetAtt" : [ "MyEC2InstanceResource", "PublicDnsName" ] }. DirectModification + // entities are changes that are made directly to the template. Automatic entities + // are AWS::CloudFormation::Stack resource types, which are also known as nested + // stacks. If you made no changes to the AWS::CloudFormation::Stack resource, + // AWS CloudFormation sets the ChangeSource to Automatic because the nested + // stack's template might have changed. Changes to a nested stack's template + // aren't visible to AWS CloudFormation until you run an update on the parent + // stack. + ChangeSource *string `type:"string" enum:"ChangeSource"` + + // Indicates whether AWS CloudFormation can determine the target value, and + // whether the target value will change before you execute a change set. + // + // For Static evaluations, AWS CloudFormation can determine that the target + // value will change, and its value. For example, if you directly modify the + // InstanceType property of an EC2 instance, AWS CloudFormation knows that this + // property value will change, and its value, so this is a Static evaluation. + // + // For Dynamic evaluations, cannot determine the target value because it depends + // on the result of an intrinsic function, such as a Ref or Fn::GetAtt intrinsic + // function, when the stack is updated. For example, if your template includes + // a reference to a resource that is conditionally recreated, the value of the + // reference (the physical ID of the resource) might change, depending on if + // the resource is recreated. If the resource is recreated, it will have a new + // physical ID, so all references to that resource will also be updated. + Evaluation *string `type:"string" enum:"EvaluationType"` + + // A ResourceTargetDefinition structure that describes the field that AWS CloudFormation + // will change and whether the resource will be recreated. + Target *ResourceTargetDefinition `type:"structure"` +} + +// String returns the string representation +func (s ResourceChangeDetail) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ResourceChangeDetail) GoString() string { + return s.String() +} + +// The field that AWS CloudFormation will change, such as the name of a resource's +// property, and whether the resource will be recreated. +type ResourceTargetDefinition struct { + _ struct{} `type:"structure"` + + // Indicates which resource attribute is triggering this update, such as a change + // in the resource attribute's Metadata, Properties, or Tags. + Attribute *string `type:"string" enum:"ResourceAttribute"` + + // If the Attribute value is Properties, the name of the property. For all other + // attributes, the value is null. + Name *string `type:"string"` + + // If the Attribute value is Properties, indicates whether a change to this + // property causes the resource to be recreated. The value can be Never, Always, + // or Conditionally. To determine the conditions for a Conditionally recreation, + // see the update behavior for that property (http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-template-resource-type-ref.html) + // in the AWS CloudFormation User Guide. + RequiresRecreation *string `type:"string" enum:"RequiresRecreation"` +} + +// String returns the string representation +func (s ResourceTargetDefinition) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ResourceTargetDefinition) GoString() string { + return s.String() +} + // The input for the SetStackPolicy action. type SetStackPolicyInput struct { _ struct{} `type:"structure"` @@ -1545,7 +2342,7 @@ type SetStackPolicyInput struct { StackPolicyBody *string `min:"1" type:"string"` // Location of a file containing the stack policy. The URL must point to a policy - // (max size: 16KB) located in an S3 bucket in the same region as the stack. + // (maximum size: 16 KB) located in an S3 bucket in the same region as the stack. // You can specify either the StackPolicyBody or the StackPolicyURL parameter, // but not both. StackPolicyURL *string `min:"1" type:"string"` @@ -1633,11 +2430,11 @@ type Stack struct { CreationTime *time.Time `type:"timestamp" timestampFormat:"iso8601" required:"true"` // A user-defined description associated with the stack. - Description *string `type:"string"` + Description *string `min:"1" type:"string"` // Boolean to enable or disable rollback on stack creation failures: // - // true: disable rollback false: enable rollback + // true: disable rollback false: enable rollback DisableRollback *bool `type:"boolean"` // The time the stack was last updated. This field will only be returned if @@ -1665,7 +2462,7 @@ type Stack struct { // Success/failure message associated with the stack status. StackStatusReason *string `type:"string"` - // A list of Tags that specify cost allocation information for the stack. + // A list of Tags that specify information about the stack. Tags []*Tag `type:"list"` // The amount of time within which stack creation should complete. @@ -1708,7 +2505,7 @@ type StackEvent struct { // Type of resource. (For more information, go to AWS Resource Types Reference // (http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-template-resource-type-ref.html) // in the AWS CloudFormation User Guide.) - ResourceType *string `type:"string"` + ResourceType *string `min:"1" type:"string"` // The unique ID name of the instance of the stack. StackId *string `type:"string" required:"true"` @@ -1735,7 +2532,7 @@ type StackResource struct { _ struct{} `type:"structure"` // User defined description associated with the resource. - Description *string `type:"string"` + Description *string `min:"1" type:"string"` // The logical name of the resource specified in the template. LogicalResourceId *string `type:"string" required:"true"` @@ -1753,7 +2550,7 @@ type StackResource struct { // Type of resource. (For more information, go to AWS Resource Types Reference // (http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-template-resource-type-ref.html) // in the AWS CloudFormation User Guide.) - ResourceType *string `type:"string" required:"true"` + ResourceType *string `min:"1" type:"string" required:"true"` // Unique identifier of the stack. StackId *string `type:"string"` @@ -1780,7 +2577,7 @@ type StackResourceDetail struct { _ struct{} `type:"structure"` // User defined description associated with the resource. - Description *string `type:"string"` + Description *string `min:"1" type:"string"` // Time the status was updated. LastUpdatedTimestamp *time.Time `type:"timestamp" timestampFormat:"iso8601" required:"true"` @@ -1806,7 +2603,7 @@ type StackResourceDetail struct { // Type of resource. ((For more information, go to AWS Resource Types Reference // (http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-template-resource-type-ref.html) // in the AWS CloudFormation User Guide.) - ResourceType *string `type:"string" required:"true"` + ResourceType *string `min:"1" type:"string" required:"true"` // Unique identifier of the stack. StackId *string `type:"string"` @@ -1848,7 +2645,7 @@ type StackResourceSummary struct { // Type of resource. (For more information, go to AWS Resource Types Reference // (http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-template-resource-type-ref.html) // in the AWS CloudFormation User Guide.) - ResourceType *string `type:"string" required:"true"` + ResourceType *string `min:"1" type:"string" required:"true"` } // String returns the string representation @@ -1901,9 +2698,8 @@ func (s StackSummary) GoString() string { return s.String() } -// The Tag type is used by CreateStack in the Tags parameter. It allows you -// to specify a key/value pair that can be used to store information related -// to cost allocation for an AWS CloudFormation stack. +// The Tag type enables you to specify a key-value pair that can be used to +// store information about an AWS CloudFormation stack. type Tag struct { _ struct{} `type:"structure"` @@ -1935,7 +2731,7 @@ type TemplateParameter struct { DefaultValue *string `type:"string"` // User defined description associated with the parameter. - Description *string `type:"string"` + Description *string `min:"1" type:"string"` // Flag indicating whether the parameter should be displayed as plain text in // logs and UIs. @@ -1960,11 +2756,13 @@ type UpdateStackInput struct { _ struct{} `type:"structure"` // A list of capabilities that you must specify before AWS CloudFormation can - // create or update certain stacks. Some stack templates might include resources - // that can affect permissions in your AWS account. For those stacks, you must - // explicitly acknowledge their capabilities by specifying this parameter. Currently, - // the only valid value is CAPABILITY_IAM, which is required for the following - // resources: AWS::IAM::AccessKey (http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iam-accesskey.html), + // update certain stacks. Some stack templates might include resources that + // can affect permissions in your AWS account, for example, by creating new + // AWS Identity and Access Management (IAM) users. For those stacks, you must + // explicitly acknowledge their capabilities by specifying this parameter. + // + // Currently, the only valid value is CAPABILITY_IAM, which is required for + // the following resources: AWS::IAM::AccessKey (http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iam-accesskey.html), // AWS::IAM::Group (http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iam-group.html), // AWS::IAM::InstanceProfile (http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iam-instanceprofile.html), // AWS::IAM::Policy (http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iam-policy.html), @@ -1972,11 +2770,14 @@ type UpdateStackInput struct { // AWS::IAM::User (http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iam-user.html), // and AWS::IAM::UserToGroupAddition (http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iam-addusertogroup.html). // If your stack template contains these resources, we recommend that you review - // any permissions associated with them. If you don't specify this parameter, - // this action returns an InsufficientCapabilities error. + // all permissions associated with them and edit their permissions if necessary. + // If your template contains any of the listed resources and you don't specify + // this parameter, this action returns an InsufficientCapabilities error. Capabilities []*string `type:"list"` - // Update the ARNs for the Amazon SNS topics that are associated with the stack. + // Amazon Simple Notification Service topic Amazon Resource Names (ARNs) that + // AWS CloudFormation associates with the stack. Specify an empty list to remove + // all notification topics. NotificationARNs []*string `type:"list"` // A list of Parameter structures that specify input parameters for the stack. @@ -1992,7 +2793,7 @@ type UpdateStackInput struct { // to all resource types. AWS Identity and Access Management (IAM) uses this // parameter for AWS CloudFormation-specific condition keys in IAM policies. // For more information, see Controlling Access with AWS Identity and Access - // Management (http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-iam-template.html) + // Management (http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-iam-template.html). ResourceTypes []*string `type:"list"` // The name or unique stack ID of the stack to update. @@ -2035,6 +2836,15 @@ type UpdateStackInput struct { // stack policy, the current policy that is associated with the stack is unchanged. StackPolicyURL *string `min:"1" type:"string"` + // Key-value pairs to associate with this stack. AWS CloudFormation also propagates + // these tags to supported resources in the stack. You can specify a maximum + // number of 10 tags. + // + // If you don't specify this parameter, AWS CloudFormation doesn't modify the + // stack's tags. If you specify an empty value, AWS CloudFormation removes all + // associated tags. + Tags []*Tag `type:"list"` + // Structure containing the template body with a minimum length of 1 byte and // a maximum length of 51,200 bytes. (For more information, go to Template Anatomy // (http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/template-anatomy.html) @@ -2135,7 +2945,7 @@ type ValidateTemplateOutput struct { CapabilitiesReason *string `type:"string"` // The description found within the template. - Description *string `type:"string"` + Description *string `min:"1" type:"string"` // A list of TemplateParameter structures. Parameters []*TemplateParameter `type:"list"` @@ -2156,6 +2966,53 @@ const ( CapabilityCapabilityIam = "CAPABILITY_IAM" ) +const ( + // @enum ChangeAction + ChangeActionAdd = "Add" + // @enum ChangeAction + ChangeActionModify = "Modify" + // @enum ChangeAction + ChangeActionRemove = "Remove" +) + +const ( + // @enum ChangeSetStatus + ChangeSetStatusCreatePending = "CREATE_PENDING" + // @enum ChangeSetStatus + ChangeSetStatusCreateInProgress = "CREATE_IN_PROGRESS" + // @enum ChangeSetStatus + ChangeSetStatusCreateComplete = "CREATE_COMPLETE" + // @enum ChangeSetStatus + ChangeSetStatusDeleteComplete = "DELETE_COMPLETE" + // @enum ChangeSetStatus + ChangeSetStatusFailed = "FAILED" +) + +const ( + // @enum ChangeSource + ChangeSourceResourceReference = "ResourceReference" + // @enum ChangeSource + ChangeSourceParameterReference = "ParameterReference" + // @enum ChangeSource + ChangeSourceResourceAttribute = "ResourceAttribute" + // @enum ChangeSource + ChangeSourceDirectModification = "DirectModification" + // @enum ChangeSource + ChangeSourceAutomatic = "Automatic" +) + +const ( + // @enum ChangeType + ChangeTypeResource = "Resource" +) + +const ( + // @enum EvaluationType + EvaluationTypeStatic = "Static" + // @enum EvaluationType + EvaluationTypeDynamic = "Dynamic" +) + const ( // @enum OnFailure OnFailureDoNothing = "DO_NOTHING" @@ -2165,6 +3022,39 @@ const ( OnFailureDelete = "DELETE" ) +const ( + // @enum Replacement + ReplacementTrue = "True" + // @enum Replacement + ReplacementFalse = "False" + // @enum Replacement + ReplacementConditional = "Conditional" +) + +const ( + // @enum RequiresRecreation + RequiresRecreationNever = "Never" + // @enum RequiresRecreation + RequiresRecreationConditionally = "Conditionally" + // @enum RequiresRecreation + RequiresRecreationAlways = "Always" +) + +const ( + // @enum ResourceAttribute + ResourceAttributeProperties = "Properties" + // @enum ResourceAttribute + ResourceAttributeMetadata = "Metadata" + // @enum ResourceAttribute + ResourceAttributeCreationPolicy = "CreationPolicy" + // @enum ResourceAttribute + ResourceAttributeUpdatePolicy = "UpdatePolicy" + // @enum ResourceAttribute + ResourceAttributeDeletionPolicy = "DeletionPolicy" + // @enum ResourceAttribute + ResourceAttributeTags = "Tags" +) + const ( // @enum ResourceSignalStatus ResourceSignalStatusSuccess = "SUCCESS" diff --git a/vendor/github.com/aws/aws-sdk-go/service/cloudformation/service.go b/vendor/github.com/aws/aws-sdk-go/service/cloudformation/service.go index c420a66b7f..503142b243 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/cloudformation/service.go +++ b/vendor/github.com/aws/aws-sdk-go/service/cloudformation/service.go @@ -28,7 +28,7 @@ import ( // // Amazon CloudFormation makes use of other AWS products. If you need additional // technical information about a specific AWS product, you can find the product's -// technical documentation at http://aws.amazon.com/documentation/ (http://aws.amazon.com/documentation/). +// technical documentation at http://docs.aws.amazon.com/documentation/ (http://docs.aws.amazon.com/documentation/). //The service client's operations are safe to be used concurrently. // It is not safe to mutate any of the client's properties though. type CloudFormation struct { @@ -76,10 +76,10 @@ func newClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegio // Handlers svc.Handlers.Sign.PushBack(v4.Sign) - svc.Handlers.Build.PushBack(query.Build) - svc.Handlers.Unmarshal.PushBack(query.Unmarshal) - svc.Handlers.UnmarshalMeta.PushBack(query.UnmarshalMeta) - svc.Handlers.UnmarshalError.PushBack(query.UnmarshalError) + svc.Handlers.Build.PushBackNamed(query.BuildHandler) + svc.Handlers.Unmarshal.PushBackNamed(query.UnmarshalHandler) + svc.Handlers.UnmarshalMeta.PushBackNamed(query.UnmarshalMetaHandler) + svc.Handlers.UnmarshalError.PushBackNamed(query.UnmarshalErrorHandler) // Run custom client initialization if present if initClient != nil { diff --git a/vendor/github.com/aws/aws-sdk-go/service/cloudformation/waiters.go b/vendor/github.com/aws/aws-sdk-go/service/cloudformation/waiters.go index cd90e41d7a..f8ca675144 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/cloudformation/waiters.go +++ b/vendor/github.com/aws/aws-sdk-go/service/cloudformation/waiters.go @@ -10,7 +10,7 @@ func (c *CloudFormation) WaitUntilStackCreateComplete(input *DescribeStacksInput waiterCfg := waiter.Config{ Operation: "DescribeStacks", Delay: 30, - MaxAttempts: 50, + MaxAttempts: 120, Acceptors: []waiter.WaitAcceptor{ { State: "success", @@ -24,6 +24,48 @@ func (c *CloudFormation) WaitUntilStackCreateComplete(input *DescribeStacksInput Argument: "Stacks[].StackStatus", Expected: "CREATE_FAILED", }, + { + State: "failure", + Matcher: "pathAny", + Argument: "Stacks[].StackStatus", + Expected: "DELETE_COMPLETE", + }, + { + State: "failure", + Matcher: "pathAny", + Argument: "Stacks[].StackStatus", + Expected: "DELETE_IN_PROGRESS", + }, + { + State: "failure", + Matcher: "pathAny", + Argument: "Stacks[].StackStatus", + Expected: "DELETE_FAILED", + }, + { + State: "failure", + Matcher: "pathAny", + Argument: "Stacks[].StackStatus", + Expected: "ROLLBACK_COMPLETE", + }, + { + State: "failure", + Matcher: "pathAny", + Argument: "Stacks[].StackStatus", + Expected: "ROLLBACK_FAILED", + }, + { + State: "failure", + Matcher: "pathAny", + Argument: "Stacks[].StackStatus", + Expected: "ROLLBACK_IN_PROGRESS", + }, + { + State: "failure", + Matcher: "error", + Argument: "", + Expected: "ValidationError", + }, }, } @@ -39,7 +81,7 @@ func (c *CloudFormation) WaitUntilStackDeleteComplete(input *DescribeStacksInput waiterCfg := waiter.Config{ Operation: "DescribeStacks", Delay: 30, - MaxAttempts: 25, + MaxAttempts: 120, Acceptors: []waiter.WaitAcceptor{ { State: "success", @@ -59,6 +101,113 @@ func (c *CloudFormation) WaitUntilStackDeleteComplete(input *DescribeStacksInput Argument: "Stacks[].StackStatus", Expected: "DELETE_FAILED", }, + { + State: "failure", + Matcher: "pathAny", + Argument: "Stacks[].StackStatus", + Expected: "CREATE_COMPLETE", + }, + { + State: "failure", + Matcher: "pathAny", + Argument: "Stacks[].StackStatus", + Expected: "CREATE_FAILED", + }, + { + State: "failure", + Matcher: "pathAny", + Argument: "Stacks[].StackStatus", + Expected: "CREATE_IN_PROGRESS", + }, + { + State: "failure", + Matcher: "pathAny", + Argument: "Stacks[].StackStatus", + Expected: "ROLLBACK_COMPLETE", + }, + { + State: "failure", + Matcher: "pathAny", + Argument: "Stacks[].StackStatus", + Expected: "ROLLBACK_FAILED", + }, + { + State: "failure", + Matcher: "pathAny", + Argument: "Stacks[].StackStatus", + Expected: "ROLLBACK_IN_PROGRESS", + }, + { + State: "failure", + Matcher: "pathAny", + Argument: "Stacks[].StackStatus", + Expected: "UPDATE_COMPLETE", + }, + { + State: "failure", + Matcher: "pathAny", + Argument: "Stacks[].StackStatus", + Expected: "UPDATE_COMPLETE_CLEANUP_IN_PROGRESS", + }, + { + State: "failure", + Matcher: "pathAny", + Argument: "Stacks[].StackStatus", + Expected: "UPDATE_IN_PROGRESS", + }, + { + State: "failure", + Matcher: "pathAny", + Argument: "Stacks[].StackStatus", + Expected: "UPDATE_ROLLBACK_COMPLETE", + }, + { + State: "failure", + Matcher: "pathAny", + Argument: "Stacks[].StackStatus", + Expected: "UPDATE_ROLLBACK_COMPLETE_CLEANUP_IN_PROGRESS", + }, + { + State: "failure", + Matcher: "pathAny", + Argument: "Stacks[].StackStatus", + Expected: "UPDATE_ROLLBACK_FAILED", + }, + { + State: "failure", + Matcher: "pathAny", + Argument: "Stacks[].StackStatus", + Expected: "UPDATE_ROLLBACK_IN_PROGRESS", + }, + }, + } + + w := waiter.Waiter{ + Client: c, + Input: input, + Config: waiterCfg, + } + return w.Wait() +} + +func (c *CloudFormation) WaitUntilStackExists(input *DescribeStacksInput) error { + waiterCfg := waiter.Config{ + Operation: "DescribeStacks", + Delay: 5, + MaxAttempts: 20, + Acceptors: []waiter.WaitAcceptor{ + { + State: "success", + Matcher: "status", + Argument: "", + Expected: 200, + }, + { + State: "retry", + Matcher: "error", + Argument: "", + Expected: "ValidationError", + }, }, } @@ -74,7 +223,7 @@ func (c *CloudFormation) WaitUntilStackUpdateComplete(input *DescribeStacksInput waiterCfg := waiter.Config{ Operation: "DescribeStacks", Delay: 30, - MaxAttempts: 5, + MaxAttempts: 120, Acceptors: []waiter.WaitAcceptor{ { State: "success", @@ -88,6 +237,36 @@ func (c *CloudFormation) WaitUntilStackUpdateComplete(input *DescribeStacksInput Argument: "Stacks[].StackStatus", Expected: "UPDATE_FAILED", }, + { + State: "failure", + Matcher: "pathAny", + Argument: "Stacks[].StackStatus", + Expected: "UPDATE_ROLLBACK_COMPLETE", + }, + { + State: "failure", + Matcher: "pathAny", + Argument: "Stacks[].StackStatus", + Expected: "UPDATE_ROLLBACK_FAILED", + }, + { + State: "failure", + Matcher: "pathAny", + Argument: "Stacks[].StackStatus", + Expected: "UPDATE_ROLLBACK_COMPLETE_CLEANUP_IN_PROGRESS", + }, + { + State: "failure", + Matcher: "pathAny", + Argument: "Stacks[].StackStatus", + Expected: "UPDATE_ROLLBACK_IN_PROGRESS", + }, + { + State: "failure", + Matcher: "error", + Argument: "", + Expected: "ValidationError", + }, }, } diff --git a/vendor/github.com/aws/aws-sdk-go/service/cloudwatch/api.go b/vendor/github.com/aws/aws-sdk-go/service/cloudwatch/api.go index 64164a0a5f..8115cfc7a6 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/cloudwatch/api.go +++ b/vendor/github.com/aws/aws-sdk-go/service/cloudwatch/api.go @@ -8,6 +8,8 @@ import ( "github.com/aws/aws-sdk-go/aws/awsutil" "github.com/aws/aws-sdk-go/aws/request" + "github.com/aws/aws-sdk-go/private/protocol" + "github.com/aws/aws-sdk-go/private/protocol/query" ) const opDeleteAlarms = "DeleteAlarms" @@ -25,6 +27,8 @@ func (c *CloudWatch) DeleteAlarmsRequest(input *DeleteAlarmsInput) (req *request } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &DeleteAlarmsOutput{} req.Data = output return @@ -66,6 +70,9 @@ func (c *CloudWatch) DescribeAlarmHistoryRequest(input *DescribeAlarmHistoryInpu // Retrieves history for the specified alarm. Filter alarms by date range or // item type. If an alarm name is not specified, Amazon CloudWatch returns histories // for all of the owner's alarms. +// +// Amazon CloudWatch retains the history of an alarm for two weeks, whether +// or not you delete the alarm. func (c *CloudWatch) DescribeAlarmHistory(input *DescribeAlarmHistoryInput) (*DescribeAlarmHistoryOutput, error) { req, out := c.DescribeAlarmHistoryRequest(input) err := req.Send() @@ -166,6 +173,8 @@ func (c *CloudWatch) DisableAlarmActionsRequest(input *DisableAlarmActionsInput) } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &DisableAlarmActionsOutput{} req.Data = output return @@ -194,6 +203,8 @@ func (c *CloudWatch) EnableAlarmActionsRequest(input *EnableAlarmActionsInput) ( } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &EnableAlarmActionsOutput{} req.Data = output return @@ -228,12 +239,13 @@ func (c *CloudWatch) GetMetricStatisticsRequest(input *GetMetricStatisticsInput) // Gets statistics for the specified metric. // -// The maximum number of data points returned from a single GetMetricStatistics -// request is 1,440, wereas the maximum number of data points that can be queried -// is 50,850. If you make a request that generates more than 1,440 data points, -// Amazon CloudWatch returns an error. In such a case, you can alter the request -// by narrowing the specified time range or increasing the specified period. -// Alternatively, you can make multiple requests across adjacent time ranges. +// The maximum number of data points that can be queried is 50,850, whereas +// the maximum number of data points returned from a single GetMetricStatistics +// request is 1,440. If you make a request that generates more than 1,440 data +// points, Amazon CloudWatch returns an error. In such a case, you can alter +// the request by narrowing the specified time range or increasing the specified +// period. Alternatively, you can make multiple requests across adjacent time +// ranges. GetMetricStatistics does not return the data in chronological order. // // Amazon CloudWatch aggregates data points based on the length of the period // that you specify. For example, if you request statistics with a one-minute @@ -249,7 +261,7 @@ func (c *CloudWatch) GetMetricStatisticsRequest(input *GetMetricStatisticsInput) // up to 35 instances over a span of 24 hours Statistics for up to 2 instances // over a span of 2 weeks For information about the namespace, metric names, // and dimensions that other Amazon Web Services products use to send metrics -// to Cloudwatch, go to Amazon CloudWatch Metrics, Namespaces, and Dimensions +// to CloudWatch, go to Amazon CloudWatch Metrics, Namespaces, and Dimensions // Reference (http://docs.aws.amazon.com/AmazonCloudWatch/latest/DeveloperGuide/CW_Support_For_AWS.html) // in the Amazon CloudWatch Developer Guide. func (c *CloudWatch) GetMetricStatistics(input *GetMetricStatisticsInput) (*GetMetricStatisticsOutput, error) { @@ -287,6 +299,12 @@ func (c *CloudWatch) ListMetricsRequest(input *ListMetricsInput) (req *request.R // Returns a list of valid metrics stored for the AWS account owner. Returned // metrics can be used with GetMetricStatistics to obtain statistical data for // a given metric. +// +// Up to 500 results are returned for any one call. To retrieve further results, +// use returned NextToken values with subsequent ListMetrics operations. If +// you create a metric with the PutMetricData action, allow up to fifteen minutes +// for the metric to appear in calls to the ListMetrics action. Statistics about +// the metric, however, are available sooner using GetMetricStatistics. func (c *CloudWatch) ListMetrics(input *ListMetricsInput) (*ListMetricsOutput, error) { req, out := c.ListMetricsRequest(input) err := req.Send() @@ -316,6 +334,8 @@ func (c *CloudWatch) PutMetricAlarmRequest(input *PutMetricAlarmInput) (req *req } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &PutMetricAlarmOutput{} req.Data = output return @@ -328,6 +348,30 @@ func (c *CloudWatch) PutMetricAlarmRequest(input *PutMetricAlarmInput) (req *req // When this operation creates an alarm, the alarm state is immediately set // to INSUFFICIENT_DATA. The alarm is evaluated and its StateValue is set appropriately. // Any actions associated with the StateValue is then executed. +// +// When updating an existing alarm, its StateValue is left unchanged. If +// you are using an AWS Identity and Access Management (IAM) account to create +// or modify an alarm, you must have the following Amazon EC2 permissions: +// ec2:DescribeInstanceStatus and ec2:DescribeInstances for all alarms on Amazon +// EC2 instance status metrics. ec2:StopInstances for alarms with stop actions. +// ec2:TerminateInstances for alarms with terminate actions. ec2:DescribeInstanceRecoveryAttribute, +// and ec2:RecoverInstances for alarms with recover actions. If you have read/write +// permissions for Amazon CloudWatch but not for Amazon EC2, you can still create +// an alarm but the stop or terminate actions won't be performed on the Amazon +// EC2 instance. However, if you are later granted permission to use the associated +// Amazon EC2 APIs, the alarm actions you created earlier will be performed. +// For more information about IAM permissions, see Permissions and Policies +// (http://docs.aws.amazon.com//IAM/latest/UserGuide/PermissionsAndPolicies.html) +// in Using IAM. +// +// If you are using an IAM role (e.g., an Amazon EC2 instance profile), you +// cannot stop or terminate the instance using alarm actions. However, you can +// still see the alarm state and perform any other actions such as Amazon SNS +// notifications or Auto Scaling policies. +// +// If you are using temporary security credentials granted using the AWS Security +// Token Service (AWS STS), you cannot stop or terminate an Amazon EC2 instance +// using alarm actions. func (c *CloudWatch) PutMetricAlarm(input *PutMetricAlarmInput) (*PutMetricAlarmOutput, error) { req, out := c.PutMetricAlarmRequest(input) err := req.Send() @@ -349,25 +393,29 @@ func (c *CloudWatch) PutMetricDataRequest(input *PutMetricDataInput) (req *reque } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &PutMetricDataOutput{} req.Data = output return } -// Publishes metric data points to Amazon CloudWatch. Amazon Cloudwatch associates +// Publishes metric data points to Amazon CloudWatch. Amazon CloudWatch associates // the data points with the specified metric. If the specified metric does not -// exist, Amazon CloudWatch creates the metric. It can take up to fifteen minutes -// for a new metric to appear in calls to the ListMetrics action. +// exist, Amazon CloudWatch creates the metric. When Amazon CloudWatch creates +// a metric, it can take up to fifteen minutes for the metric to appear in calls +// to the ListMetrics action. // -// The size of a PutMetricData request is limited to 8 KB for HTTP GET requests -// and 40 KB for HTTP POST requests. +// Each PutMetricData request is limited to 8 KB in size for HTTP GET requests +// and is limited to 40 KB in size for HTTP POST requests. // -// Although the Value parameter accepts numbers of type Double, Amazon CloudWatch -// truncates values with very large exponents. Values with base-10 exponents -// greater than 126 (1 x 10^126) are truncated. Likewise, values with base-10 -// exponents less than -130 (1 x 10^-130) are also truncated. Data that is -// timestamped 24 hours or more in the past may take in excess of 48 hours to -// become available from submission time using GetMetricStatistics. +// Although the Value parameter accepts numbers of type Double, Amazon CloudWatch +// rejects values that are either too small or too large. Values must be in +// the range of 8.515920e-109 to 1.174271e+108 (Base 10) or 2e-360 to 2e360 +// (Base 2). In addition, special values (e.g., NaN, +Infinity, -Infinity) are +// not supported. Data that is timestamped 24 hours or more in the past may +// take in excess of 48 hours to become available from submission time using +// GetMetricStatistics. func (c *CloudWatch) PutMetricData(input *PutMetricDataInput) (*PutMetricDataOutput, error) { req, out := c.PutMetricDataRequest(input) err := req.Send() @@ -389,6 +437,8 @@ func (c *CloudWatch) SetAlarmStateRequest(input *SetAlarmStateInput) (req *reque } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &SetAlarmStateOutput{} req.Data = output return @@ -396,8 +446,13 @@ func (c *CloudWatch) SetAlarmStateRequest(input *SetAlarmStateInput) (req *reque // Temporarily sets the state of an alarm. When the updated StateValue differs // from the previous value, the action configured for the appropriate state -// is invoked. This is not a permanent change. The next periodic alarm check -// (in about a minute) will set the alarm to its actual state. +// is invoked. For example, if your alarm is configured to send an Amazon SNS +// message when an alarm is triggered, temporarily changing the alarm's state +// to ALARM will send an Amazon SNS message. This is not a permanent change. +// The next periodic alarm check (in about a minute) will set the alarm to its +// actual state. Because the alarm state change happens very quickly, it is +// typically only visibile in the alarm's History tab in the Amazon CloudWatch +// console or through DescribeAlarmHistory. func (c *CloudWatch) SetAlarmState(input *SetAlarmStateInput) (*SetAlarmStateOutput, error) { req, out := c.SetAlarmStateRequest(input) err := req.Send() @@ -422,11 +477,7 @@ type AlarmHistoryItem struct { // A human-readable summary of the alarm history. HistorySummary *string `min:"1" type:"string"` - // The time stamp for the alarm history item. Amazon CloudWatch uses Coordinated - // Universal Time (UTC) when returning time stamps, which do not accommodate - // seasonal adjustments such as daylight savings time. For more information, - // see Time stamps (http://docs.aws.amazon.com/AmazonCloudWatch/latest/DeveloperGuide/cloudwatch_concepts.html#about_timestamp) - // in the Amazon CloudWatch Developer Guide. + // The time stamp for the alarm history item. Timestamp *time.Time `type:"timestamp" timestampFormat:"iso8601"` } @@ -461,11 +512,7 @@ type Datapoint struct { // The sum of metric values used for the datapoint. Sum *float64 `type:"double"` - // The time stamp used for the datapoint. Amazon CloudWatch uses Coordinated - // Universal Time (UTC) when returning time stamps, which do not accommodate - // seasonal adjustments such as daylight savings time. For more information, - // see Time stamps (http://docs.aws.amazon.com/AmazonCloudWatch/latest/DeveloperGuide/cloudwatch_concepts.html#about_timestamp) - // in the Amazon CloudWatch Developer Guide. + // The time stamp used for the datapoint. Timestamp *time.Time `type:"timestamp" timestampFormat:"iso8601"` // The standard unit used for the datapoint. @@ -570,7 +617,9 @@ func (s DescribeAlarmHistoryOutput) GoString() string { type DescribeAlarmsForMetricInput struct { _ struct{} `type:"structure"` - // The list of dimensions associated with the metric. + // The list of dimensions associated with the metric. If the metric has any + // associated dimensions, you must specify them in order for the DescribeAlarmsForMetric + // to succeed. Dimensions []*Dimension `type:"list"` // The name of the metric. @@ -704,6 +753,9 @@ type DimensionFilter struct { Name *string `min:"1" type:"string" required:"true"` // The value of the dimension to be matched. + // + // Specifying a Name without specifying a Value returns all values associated + // with that Name. Value *string `min:"1" type:"string"` } @@ -787,7 +839,7 @@ type GetMetricStatisticsInput struct { // The time stamp to use for determining the last datapoint to return. The value // specified is exclusive; results will include datapoints up to the time stamp - // specified. + // specified. The time stamp must be in ISO 8601 UTC format (e.g., 2014-09-03T23:00:00Z). EndTime *time.Time `type:"timestamp" timestampFormat:"iso8601" required:"true"` // The name of the metric, with or without spaces. @@ -802,14 +854,19 @@ type GetMetricStatisticsInput struct { // The time stamp to use for determining the first datapoint to return. The // value specified is inclusive; results include datapoints with the time stamp - // specified. + // specified. The time stamp must be in ISO 8601 UTC format (e.g., 2014-09-03T23:00:00Z). + // + // The specified start time is rounded down to the nearest value. Datapoints + // are returned for start times up to two weeks in the past. Specified start + // times that are more than two weeks in the past will not return datapoints + // for metrics that are older than two weeks. Data that is timestamped 24 hours + // or more in the past may take in excess of 48 hours to become available from + // submission time using GetMetricStatistics. StartTime *time.Time `type:"timestamp" timestampFormat:"iso8601" required:"true"` // The metric statistics to return. For information about specific statistics - // returned by GetMetricStatistics, go to Statistics (http://docs.aws.amazon.com/AmazonCloudWatch/latest/DeveloperGuide/index.html?CHAP_TerminologyandKeyConcepts.html#Statistic) + // returned by GetMetricStatistics, see Statistics (http://docs.aws.amazon.com/AmazonCloudWatch/latest/DeveloperGuide/cloudwatch_concepts.html#Statistic) // in the Amazon CloudWatch Developer Guide. - // - // Valid Values: Average | Sum | SampleCount | Maximum | Minimum Statistics []*string `min:"1" type:"list" required:"true"` // The unit for the metric. @@ -936,18 +993,13 @@ type MetricAlarm struct { // The list of actions to execute when this alarm transitions into an ALARM // state from any other state. Each action is specified as an Amazon Resource - // Number (ARN). Currently the only actions supported are publishing to an Amazon - // SNS topic and triggering an Auto Scaling policy. + // Name (ARN). AlarmActions []*string `type:"list"` // The Amazon Resource Name (ARN) of the alarm. AlarmArn *string `min:"1" type:"string"` - // The time stamp of the last update to the alarm configuration. Amazon CloudWatch - // uses Coordinated Universal Time (UTC) when returning time stamps, which do - // not accommodate seasonal adjustments such as daylight savings time. For more - // information, see Time stamps (http://docs.aws.amazon.com/AmazonCloudWatch/latest/DeveloperGuide/cloudwatch_concepts.html#about_timestamp) - // in the Amazon CloudWatch Developer Guide. + // The time stamp of the last update to the alarm configuration. AlarmConfigurationUpdatedTimestamp *time.Time `type:"timestamp" timestampFormat:"iso8601"` // The description for the alarm. @@ -968,8 +1020,7 @@ type MetricAlarm struct { // The list of actions to execute when this alarm transitions into an INSUFFICIENT_DATA // state from any other state. Each action is specified as an Amazon Resource - // Number (ARN). Currently the only actions supported are publishing to an Amazon - // SNS topic or triggering an Auto Scaling policy. + // Name (ARN). // // The current WSDL lists this attribute as UnknownActions. InsufficientDataActions []*string `type:"list"` @@ -981,9 +1032,8 @@ type MetricAlarm struct { Namespace *string `min:"1" type:"string"` // The list of actions to execute when this alarm transitions into an OK state - // from any other state. Each action is specified as an Amazon Resource Number - // (ARN). Currently the only actions supported are publishing to an Amazon SNS - // topic and triggering an Auto Scaling policy. + // from any other state. Each action is specified as an Amazon Resource Name + // (ARN). OKActions []*string `type:"list"` // The period in seconds over which the statistic is applied. @@ -995,11 +1045,7 @@ type MetricAlarm struct { // An explanation for the alarm's state in machine-readable JSON format StateReasonData *string `type:"string"` - // The time stamp of the last update to the alarm's state. Amazon CloudWatch - // uses Coordinated Universal Time (UTC) when returning time stamps, which do - // not accommodate seasonal adjustments such as daylight savings time. For more - // information, see Time stamps (http://docs.aws.amazon.com/AmazonCloudWatch/latest/DeveloperGuide/cloudwatch_concepts.html#about_timestamp) - // in the Amazon CloudWatch Developer Guide. + // The time stamp of the last update to the alarm's state. StateUpdatedTimestamp *time.Time `type:"timestamp" timestampFormat:"iso8601"` // The state value for the alarm. @@ -1041,12 +1087,9 @@ type MetricDatum struct { // A set of statistical values describing the metric. StatisticValues *StatisticSet `type:"structure"` - // The time stamp used for the metric. If not specified, the default value is - // set to the time the metric data was received. Amazon CloudWatch uses Coordinated - // Universal Time (UTC) when returning time stamps, which do not accommodate - // seasonal adjustments such as daylight savings time. For more information, - // see Time stamps (http://docs.aws.amazon.com/AmazonCloudWatch/latest/DeveloperGuide/cloudwatch_concepts.html#about_timestamp) - // in the Amazon CloudWatch Developer Guide. + // The time stamp used for the metric in ISO 8601 Universal Coordinated Time + // (UTC) format. If not specified, the default value is set to the time the + // metric data was received. Timestamp *time.Time `type:"timestamp" timestampFormat:"iso8601"` // The unit of the metric. @@ -1055,9 +1098,10 @@ type MetricDatum struct { // The value for the metric. // // Although the Value parameter accepts numbers of type Double, Amazon CloudWatch - // truncates values with very large exponents. Values with base-10 exponents - // greater than 126 (1 x 10^126) are truncated. Likewise, values with base-10 - // exponents less than -130 (1 x 10^-130) are also truncated. + // rejects values that are either too small or too large. Values must be in + // the range of 8.515920e-109 to 1.174271e+108 (Base 10) or 2e-360 to 2e360 + // (Base 2). In addition, special values (e.g., NaN, +Infinity, -Infinity) are + // not supported. Value *float64 `type:"double"` } @@ -1080,8 +1124,19 @@ type PutMetricAlarmInput struct { // The list of actions to execute when this alarm transitions into an ALARM // state from any other state. Each action is specified as an Amazon Resource - // Number (ARN). Currently the only action supported is publishing to an Amazon - // SNS topic or an Amazon Auto Scaling policy. + // Name (ARN). + // + // Valid Values: arn:aws:automate:region (e.g., us-east-1):ec2:stop | arn:aws:automate:region + // (e.g., us-east-1):ec2:terminate | arn:aws:automate:region (e.g., us-east-1):ec2:recover + // + // Valid Values (for use with IAM roles): arn:aws:swf:us-east-1:{customer-account}:action/actions/AWS_EC2.InstanceId.Stop/1.0 + // | arn:aws:swf:us-east-1:{customer-account}:action/actions/AWS_EC2.InstanceId.Terminate/1.0 + // | arn:aws:swf:us-east-1:{customer-account}:action/actions/AWS_EC2.InstanceId.Reboot/1.0 + // + // Note: You must create at least one stop, terminate, or reboot alarm using + // the Amazon EC2 or CloudWatch console to create the EC2ActionsAccess IAM role + // for the first time. After this IAM role is created, you can create stop, + // terminate, or reboot alarms using the CLI. AlarmActions []*string `type:"list"` // The description for the alarm. @@ -1103,8 +1158,19 @@ type PutMetricAlarmInput struct { // The list of actions to execute when this alarm transitions into an INSUFFICIENT_DATA // state from any other state. Each action is specified as an Amazon Resource - // Number (ARN). Currently the only action supported is publishing to an Amazon - // SNS topic or an Amazon Auto Scaling policy. + // Name (ARN). + // + // Valid Values: arn:aws:automate:region (e.g., us-east-1):ec2:stop | arn:aws:automate:region + // (e.g., us-east-1):ec2:terminate | arn:aws:automate:region (e.g., us-east-1):ec2:recover + // + // Valid Values (for use with IAM roles): arn:aws:swf:us-east-1:{customer-account}:action/actions/AWS_EC2.InstanceId.Stop/1.0 + // | arn:aws:swf:us-east-1:{customer-account}:action/actions/AWS_EC2.InstanceId.Terminate/1.0 + // | arn:aws:swf:us-east-1:{customer-account}:action/actions/AWS_EC2.InstanceId.Reboot/1.0 + // + // Note: You must create at least one stop, terminate, or reboot alarm using + // the Amazon EC2 or CloudWatch console to create the EC2ActionsAccess IAM role + // for the first time. After this IAM role is created, you can create stop, + // terminate, or reboot alarms using the CLI. InsufficientDataActions []*string `type:"list"` // The name for the alarm's associated metric. @@ -1114,9 +1180,20 @@ type PutMetricAlarmInput struct { Namespace *string `min:"1" type:"string" required:"true"` // The list of actions to execute when this alarm transitions into an OK state - // from any other state. Each action is specified as an Amazon Resource Number - // (ARN). Currently the only action supported is publishing to an Amazon SNS - // topic or an Amazon Auto Scaling policy. + // from any other state. Each action is specified as an Amazon Resource Name + // (ARN). + // + // Valid Values: arn:aws:automate:region (e.g., us-east-1):ec2:stop | arn:aws:automate:region + // (e.g., us-east-1):ec2:terminate | arn:aws:automate:region (e.g., us-east-1):ec2:recover + // + // Valid Values (for use with IAM roles): arn:aws:swf:us-east-1:{customer-account}:action/actions/AWS_EC2.InstanceId.Stop/1.0 + // | arn:aws:swf:us-east-1:{customer-account}:action/actions/AWS_EC2.InstanceId.Terminate/1.0 + // | arn:aws:swf:us-east-1:{customer-account}:action/actions/AWS_EC2.InstanceId.Reboot/1.0 + // + // Note: You must create at least one stop, terminate, or reboot alarm using + // the Amazon EC2 or CloudWatch console to create the EC2ActionsAccess IAM role + // for the first time. After this IAM role is created, you can create stop, + // terminate, or reboot alarms using the CLI. OKActions []*string `type:"list"` // The period in seconds over which the specified statistic is applied. @@ -1128,7 +1205,16 @@ type PutMetricAlarmInput struct { // The value against which the specified statistic is compared. Threshold *float64 `type:"double" required:"true"` - // The unit for the alarm's associated metric. + // The statistic's unit of measure. For example, the units for the Amazon EC2 + // NetworkIn metric are Bytes because NetworkIn tracks the number of bytes that + // an instance receives on all network interfaces. You can also specify a unit + // when you create a custom metric. Units help provide conceptual meaning to + // your data. Metric data points that specify a unit of measure, such as Percent, + // are aggregated separately. + // + // Note: If you specify a unit, you must use a unit that is appropriate for + // the metric. Otherwise, this can cause an Amazon CloudWatch alarm to get stuck + // in the INSUFFICIENT DATA state. Unit *string `type:"string" enum:"StandardUnit"` } @@ -1163,6 +1249,10 @@ type PutMetricDataInput struct { MetricData []*MetricDatum `type:"list" required:"true"` // The namespace for the metric data. + // + // You cannot specify a namespace that begins with "AWS/". Namespaces that + // begin with "AWS/" are reserved for other Amazon Web Services products that + // send metrics to Amazon CloudWatch. Namespace *string `min:"1" type:"string" required:"true"` } diff --git a/vendor/github.com/aws/aws-sdk-go/service/cloudwatch/service.go b/vendor/github.com/aws/aws-sdk-go/service/cloudwatch/service.go index e6f8506846..342498f0ec 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/cloudwatch/service.go +++ b/vendor/github.com/aws/aws-sdk-go/service/cloudwatch/service.go @@ -11,46 +11,21 @@ import ( "github.com/aws/aws-sdk-go/private/signer/v4" ) -// This is the Amazon CloudWatch API Reference. This guide provides detailed -// information about Amazon CloudWatch actions, data types, parameters, and -// errors. For detailed information about Amazon CloudWatch features and their -// associated API calls, go to the Amazon CloudWatch Developer Guide (http://docs.aws.amazon.com/AmazonCloudWatch/latest/DeveloperGuide). +// Amazon CloudWatch monitors your Amazon Web Services (AWS) resources and the +// applications you run on AWS in real-time. You can use CloudWatch to collect +// and track metrics, which are the variables you want to measure for your resources +// and applications. // -// Amazon CloudWatch is a web service that enables you to publish, monitor, -// and manage various metrics, as well as configure alarm actions based on data -// from metrics. For more information about this product go to http://aws.amazon.com/cloudwatch -// (http://aws.amazon.com/cloudwatch). +// CloudWatch alarms send notifications or automatically make changes to the +// resources you are monitoring based on rules that you define. For example, +// you can monitor the CPU usage and disk reads and writes of your Amazon Elastic +// Compute Cloud (Amazon EC2) instances and then use this data to determine +// whether you should launch additional instances to handle increased load. +// You can also use this data to stop under-used instances to save money. // -// For information about the namespace, metric names, and dimensions that -// other Amazon Web Services products use to send metrics to Cloudwatch, go -// to Amazon CloudWatch Metrics, Namespaces, and Dimensions Reference (http://docs.aws.amazon.com/AmazonCloudWatch/latest/DeveloperGuide/CW_Support_For_AWS.html) -// in the Amazon CloudWatch Developer Guide. -// -// Use the following links to get started using the Amazon CloudWatch API Reference: -// -// Actions (http://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/API_Operations.html): -// An alphabetical list of all Amazon CloudWatch actions. Data Types (http://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/API_Types.html): -// An alphabetical list of all Amazon CloudWatch data types. Common Parameters -// (http://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/CommonParameters.html): -// Parameters that all Query actions can use. Common Errors (http://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/CommonErrors.html): -// Client and server errors that all actions can return. Regions and Endpoints -// (http://docs.aws.amazon.com/general/latest/gr/index.html?rande.html): Itemized -// regions and endpoints for all AWS products. WSDL Location (http://monitoring.amazonaws.com/doc/2010-08-01/CloudWatch.wsdl): -// http://monitoring.amazonaws.com/doc/2010-08-01/CloudWatch.wsdl In addition -// to using the Amazon CloudWatch API, you can also use the following SDKs and -// third-party libraries to access Amazon CloudWatch programmatically. -// -// AWS SDK for Java Documentation (http://aws.amazon.com/documentation/sdkforjava/) -// AWS SDK for .NET Documentation (http://aws.amazon.com/documentation/sdkfornet/) -// AWS SDK for PHP Documentation (http://aws.amazon.com/documentation/sdkforphp/) -// AWS SDK for Ruby Documentation (http://aws.amazon.com/documentation/sdkforruby/) -// Developers in the AWS developer community also provide their own libraries, -// which you can find at the following AWS developer centers: -// -// AWS Java Developer Center (http://aws.amazon.com/java/) AWS PHP Developer -// Center (http://aws.amazon.com/php/) AWS Python Developer Center (http://aws.amazon.com/python/) -// AWS Ruby Developer Center (http://aws.amazon.com/ruby/) AWS Windows and .NET -// Developer Center (http://aws.amazon.com/net/) +// In addition to monitoring the built-in metrics that come with AWS, you can +// monitor your own custom metrics. With CloudWatch, you gain system-wide visibility +// into resource utilization, application performance, and operational health. //The service client's operations are safe to be used concurrently. // It is not safe to mutate any of the client's properties though. type CloudWatch struct { @@ -98,10 +73,10 @@ func newClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegio // Handlers svc.Handlers.Sign.PushBack(v4.Sign) - svc.Handlers.Build.PushBack(query.Build) - svc.Handlers.Unmarshal.PushBack(query.Unmarshal) - svc.Handlers.UnmarshalMeta.PushBack(query.UnmarshalMeta) - svc.Handlers.UnmarshalError.PushBack(query.UnmarshalError) + svc.Handlers.Build.PushBackNamed(query.BuildHandler) + svc.Handlers.Unmarshal.PushBackNamed(query.UnmarshalHandler) + svc.Handlers.UnmarshalMeta.PushBackNamed(query.UnmarshalMetaHandler) + svc.Handlers.UnmarshalError.PushBackNamed(query.UnmarshalErrorHandler) // Run custom client initialization if present if initClient != nil { diff --git a/vendor/github.com/aws/aws-sdk-go/service/cloudwatchlogs/api.go b/vendor/github.com/aws/aws-sdk-go/service/cloudwatchlogs/api.go index 8d3b649370..6a5f99ceeb 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/cloudwatchlogs/api.go +++ b/vendor/github.com/aws/aws-sdk-go/service/cloudwatchlogs/api.go @@ -6,6 +6,8 @@ package cloudwatchlogs import ( "github.com/aws/aws-sdk-go/aws/awsutil" "github.com/aws/aws-sdk-go/aws/request" + "github.com/aws/aws-sdk-go/private/protocol" + "github.com/aws/aws-sdk-go/private/protocol/jsonrpc" ) const opCancelExportTask = "CancelExportTask" @@ -23,6 +25,8 @@ func (c *CloudWatchLogs) CancelExportTaskRequest(input *CancelExportTaskInput) ( } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(jsonrpc.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &CancelExportTaskOutput{} req.Data = output return @@ -61,6 +65,8 @@ func (c *CloudWatchLogs) CreateExportTaskRequest(input *CreateExportTaskInput) ( // This is an asynchronous call. If all the required information is provided, // this API will initiate an export task and respond with the task Id. Once // started, DescribeExportTasks can be used to get the status of an export task. +// You can only have one active (RUNNING or PENDING) export task at a time, +// per account. // // You can export logs from multiple log groups or multiple time ranges to // the same Amazon S3 bucket. To separate out log data for each export task, @@ -87,6 +93,8 @@ func (c *CloudWatchLogs) CreateLogGroupRequest(input *CreateLogGroupInput) (req } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(jsonrpc.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &CreateLogGroupOutput{} req.Data = output return @@ -120,6 +128,8 @@ func (c *CloudWatchLogs) CreateLogStreamRequest(input *CreateLogStreamInput) (re } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(jsonrpc.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &CreateLogStreamOutput{} req.Data = output return @@ -153,6 +163,8 @@ func (c *CloudWatchLogs) DeleteDestinationRequest(input *DeleteDestinationInput) } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(jsonrpc.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &DeleteDestinationOutput{} req.Data = output return @@ -182,6 +194,8 @@ func (c *CloudWatchLogs) DeleteLogGroupRequest(input *DeleteLogGroupInput) (req } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(jsonrpc.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &DeleteLogGroupOutput{} req.Data = output return @@ -210,6 +224,8 @@ func (c *CloudWatchLogs) DeleteLogStreamRequest(input *DeleteLogStreamInput) (re } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(jsonrpc.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &DeleteLogStreamOutput{} req.Data = output return @@ -238,6 +254,8 @@ func (c *CloudWatchLogs) DeleteMetricFilterRequest(input *DeleteMetricFilterInpu } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(jsonrpc.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &DeleteMetricFilterOutput{} req.Data = output return @@ -265,6 +283,8 @@ func (c *CloudWatchLogs) DeleteRetentionPolicyRequest(input *DeleteRetentionPoli } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(jsonrpc.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &DeleteRetentionPolicyOutput{} req.Data = output return @@ -293,6 +313,8 @@ func (c *CloudWatchLogs) DeleteSubscriptionFilterRequest(input *DeleteSubscripti } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(jsonrpc.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &DeleteSubscriptionFilterOutput{} req.Data = output return @@ -735,6 +757,8 @@ func (c *CloudWatchLogs) PutDestinationPolicyRequest(input *PutDestinationPolicy } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(jsonrpc.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &PutDestinationPolicyOutput{} req.Data = output return @@ -783,6 +807,8 @@ func (c *CloudWatchLogs) PutLogEventsRequest(input *PutLogEventsInput) (req *req // log events in the batch can be older than 14 days or the retention period // of the log group. The log events in the batch must be in chronological ordered // by their timestamp. The maximum number of log events in a batch is 10,000. +// A batch of log events in a single PutLogEvents request cannot span more than +// 24 hours. Otherwise, the PutLogEvents operation will fail. func (c *CloudWatchLogs) PutLogEvents(input *PutLogEventsInput) (*PutLogEventsOutput, error) { req, out := c.PutLogEventsRequest(input) err := req.Send() @@ -804,6 +830,8 @@ func (c *CloudWatchLogs) PutMetricFilterRequest(input *PutMetricFilterInput) (re } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(jsonrpc.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &PutMetricFilterOutput{} req.Data = output return @@ -836,6 +864,8 @@ func (c *CloudWatchLogs) PutRetentionPolicyRequest(input *PutRetentionPolicyInpu } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(jsonrpc.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &PutRetentionPolicyOutput{} req.Data = output return @@ -865,6 +895,8 @@ func (c *CloudWatchLogs) PutSubscriptionFilterRequest(input *PutSubscriptionFilt } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(jsonrpc.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &PutSubscriptionFilterOutput{} req.Data = output return @@ -873,10 +905,14 @@ func (c *CloudWatchLogs) PutSubscriptionFilterRequest(input *PutSubscriptionFilt // Creates or updates a subscription filter and associates it with the specified // log group. Subscription filters allow you to subscribe to a real-time stream // of log events ingested through PutLogEvents requests and have them delivered -// to a specific destination. Currently, the supported destinations are: A +// to a specific destination. Currently, the supported destinations are: An // Amazon Kinesis stream belonging to the same account as the subscription filter, // for same-account delivery. A logical destination (used via an ARN of Destination) -// belonging to a different account, for cross-account delivery. +// belonging to a different account, for cross-account delivery. An Amazon +// Kinesis Firehose stream belonging to the same account as the subscription +// filter, for same-account delivery. An AWS Lambda function belonging to +// the same account as the subscription filter, for same-account delivery. +// // // Currently there can only be one subscription filter associated with a log // group. @@ -951,7 +987,7 @@ type CreateExportTaskInput struct { // Name of Amazon S3 bucket to which the log data will be exported. // - // NOTE: Only buckets in the same AWS region are supported + // Note: Only buckets in the same AWS region are supported. Destination *string `locationName:"destination" min:"1" type:"string" required:"true"` // Prefix that will be used as the start of Amazon S3 key for every object exported. @@ -1881,9 +1917,9 @@ func (s GetLogEventsOutput) GoString() string { } // A log event is a record of some activity that was recorded by the application -// or resource being monitored. The log event record that Amazon CloudWatch -// Logs understands contains two properties: the timestamp of when the event -// occurred, and the raw event message. +// or resource being monitored. The log event record that CloudWatch Logs understands +// contains two properties: the timestamp of when the event occurred, and the +// raw event message. type InputLogEvent struct { _ struct{} `type:"structure"` @@ -1978,9 +2014,9 @@ func (s LogStream) GoString() string { return s.String() } -// Metric filters can be used to express how Amazon CloudWatch Logs would extract -// metric observations from ingested log events and transform them to metric -// data in a CloudWatch metric. +// Metric filters can be used to express how CloudWatch Logs would extract metric +// observations from ingested log events and transform them to metric data in +// a CloudWatch metric. type MetricFilter struct { _ struct{} `type:"structure"` @@ -1991,10 +2027,10 @@ type MetricFilter struct { // A name for a metric or subscription filter. FilterName *string `locationName:"filterName" min:"1" type:"string"` - // A symbolic description of how Amazon CloudWatch Logs should interpret the - // data in each log event. For example, a log event may contain timestamps, - // IP addresses, strings, and so on. You use the filter pattern to specify what - // to look for in the log event message. + // A symbolic description of how CloudWatch Logs should interpret the data in + // each log event. For example, a log event may contain timestamps, IP addresses, + // strings, and so on. You use the filter pattern to specify what to look for + // in the log event message. FilterPattern *string `locationName:"filterPattern" type:"string"` MetricTransformations []*MetricTransformation `locationName:"metricTransformations" min:"1" type:"list"` @@ -2087,8 +2123,8 @@ type PutDestinationInput struct { // A name for the destination. DestinationName *string `locationName:"destinationName" min:"1" type:"string" required:"true"` - // The ARN of an IAM role that grants Amazon CloudWatch Logs permissions to - // do Amazon Kinesis PutRecord requests on the desitnation stream. + // The ARN of an IAM role that grants CloudWatch Logs permissions to do Amazon + // Kinesis PutRecord requests on the desitnation stream. RoleArn *string `locationName:"roleArn" min:"1" type:"string" required:"true"` // The ARN of an Amazon Kinesis stream to deliver matching log events to. @@ -2286,10 +2322,13 @@ type PutSubscriptionFilterInput struct { _ struct{} `type:"structure"` // The ARN of the destination to deliver matching log events to. Currently, - // the supported destinations are: A Amazon Kinesis stream belonging to the + // the supported destinations are: An Amazon Kinesis stream belonging to the // same account as the subscription filter, for same-account delivery. A logical // destination (used via an ARN of Destination) belonging to a different account, - // for cross-account delivery. + // for cross-account delivery. An Amazon Kinesis Firehose stream belonging + // to the same account as the subscription filter, for same-account delivery. + // An AWS Lambda function belonging to the same account as the subscription + // filter, for same-account delivery. DestinationArn *string `locationName:"destinationArn" min:"1" type:"string" required:"true"` // A name for the subscription filter. @@ -2302,10 +2341,10 @@ type PutSubscriptionFilterInput struct { // The name of the log group to associate the subscription filter with. LogGroupName *string `locationName:"logGroupName" min:"1" type:"string" required:"true"` - // The ARN of an IAM role that grants Amazon CloudWatch Logs permissions to - // deliver ingested log events to the destination stream. You don't need to - // provide the ARN when you are working with a logical destination (used via - // an ARN of Destination) for cross-account delivery. + // The ARN of an IAM role that grants CloudWatch Logs permissions to deliver + // ingested log events to the destination stream. You don't need to provide + // the ARN when you are working with a logical destination (used via an ARN + // of Destination) for cross-account delivery. RoleArn *string `locationName:"roleArn" min:"1" type:"string"` } @@ -2388,10 +2427,10 @@ type SubscriptionFilter struct { // A name for a metric or subscription filter. FilterName *string `locationName:"filterName" min:"1" type:"string"` - // A symbolic description of how Amazon CloudWatch Logs should interpret the - // data in each log event. For example, a log event may contain timestamps, - // IP addresses, strings, and so on. You use the filter pattern to specify what - // to look for in the log event message. + // A symbolic description of how CloudWatch Logs should interpret the data in + // each log event. For example, a log event may contain timestamps, IP addresses, + // strings, and so on. You use the filter pattern to specify what to look for + // in the log event message. FilterPattern *string `locationName:"filterPattern" type:"string"` LogGroupName *string `locationName:"logGroupName" min:"1" type:"string"` @@ -2412,10 +2451,10 @@ func (s SubscriptionFilter) GoString() string { type TestMetricFilterInput struct { _ struct{} `type:"structure"` - // A symbolic description of how Amazon CloudWatch Logs should interpret the - // data in each log event. For example, a log event may contain timestamps, - // IP addresses, strings, and so on. You use the filter pattern to specify what - // to look for in the log event message. + // A symbolic description of how CloudWatch Logs should interpret the data in + // each log event. For example, a log event may contain timestamps, IP addresses, + // strings, and so on. You use the filter pattern to specify what to look for + // in the log event message. FilterPattern *string `locationName:"filterPattern" type:"string" required:"true"` // A list of log event messages to test. diff --git a/vendor/github.com/aws/aws-sdk-go/service/cloudwatchlogs/service.go b/vendor/github.com/aws/aws-sdk-go/service/cloudwatchlogs/service.go index 7a5d472cd7..e5a47270c5 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/cloudwatchlogs/service.go +++ b/vendor/github.com/aws/aws-sdk-go/service/cloudwatchlogs/service.go @@ -11,38 +11,35 @@ import ( "github.com/aws/aws-sdk-go/private/signer/v4" ) -// This is the Amazon CloudWatch Logs API Reference. Amazon CloudWatch Logs -// enables you to monitor, store, and access your system, application, and custom -// log files. This guide provides detailed information about Amazon CloudWatch -// Logs actions, data types, parameters, and errors. For detailed information -// about Amazon CloudWatch Logs features and their associated API calls, go -// to the Amazon CloudWatch Developer Guide (http://docs.aws.amazon.com/AmazonCloudWatch/latest/DeveloperGuide). +// You can use Amazon CloudWatch Logs to monitor, store, and access your log +// files from Amazon Elastic Compute Cloud (Amazon EC2) instances, Amazon CloudTrail, +// or other sources. You can then retrieve the associated log data from CloudWatch +// Logs using the Amazon CloudWatch console, the CloudWatch Logs commands in +// the AWS CLI, the CloudWatch Logs API, or the CloudWatch Logs SDK. // -// Use the following links to get started using the Amazon CloudWatch Logs -// API Reference: +// You can use CloudWatch Logs to: // -// Actions (http://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_Operations.html): -// An alphabetical list of all Amazon CloudWatch Logs actions. Data Types (http://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_Types.html): -// An alphabetical list of all Amazon CloudWatch Logs data types. Common Parameters -// (http://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/CommonParameters.html): -// Parameters that all Query actions can use. Common Errors (http://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/CommonErrors.html): -// Client and server errors that all actions can return. Regions and Endpoints -// (http://docs.aws.amazon.com/general/latest/gr/index.html?rande.html): Itemized -// regions and endpoints for all AWS products. In addition to using the Amazon -// CloudWatch Logs API, you can also use the following SDKs and third-party -// libraries to access Amazon CloudWatch Logs programmatically. +// Monitor Logs from Amazon EC2 Instances in Real-time: You can use CloudWatch +// Logs to monitor applications and systems using log data. For example, CloudWatch +// Logs can track the number of errors that occur in your application logs and +// send you a notification whenever the rate of errors exceeds a threshold you +// specify. CloudWatch Logs uses your log data for monitoring; so, no code changes +// are required. For example, you can monitor application logs for specific +// literal terms (such as "NullReferenceException") or count the number of occurrences +// of a literal term at a particular position in log data (such as "404" status +// codes in an Apache access log). When the term you are searching for is found, +// CloudWatch Logs reports the data to a Amazon CloudWatch metric that you specify. // -// AWS SDK for Java Documentation (http://aws.amazon.com/documentation/sdkforjava/) -// AWS SDK for .NET Documentation (http://aws.amazon.com/documentation/sdkfornet/) -// AWS SDK for PHP Documentation (http://aws.amazon.com/documentation/sdkforphp/) -// AWS SDK for Ruby Documentation (http://aws.amazon.com/documentation/sdkforruby/) -// Developers in the AWS developer community also provide their own libraries, -// which you can find at the following AWS developer centers: +// Monitor Amazon CloudTrail Logged Events: You can create alarms in Amazon +// CloudWatch and receive notifications of particular API activity as captured +// by CloudTrail and use the notification to perform troubleshooting. // -// AWS Java Developer Center (http://aws.amazon.com/java/) AWS PHP Developer -// Center (http://aws.amazon.com/php/) AWS Python Developer Center (http://aws.amazon.com/python/) -// AWS Ruby Developer Center (http://aws.amazon.com/ruby/) AWS Windows and .NET -// Developer Center (http://aws.amazon.com/net/) +// Archive Log Data: You can use CloudWatch Logs to store your log data in +// highly durable storage. You can change the log retention setting so that +// any log events older than this setting are automatically deleted. The CloudWatch +// Logs agent makes it easy to quickly send both rotated and non-rotated log +// data off of a host and into the log service. You can then access the raw +// log data when you need it. //The service client's operations are safe to be used concurrently. // It is not safe to mutate any of the client's properties though. type CloudWatchLogs struct { @@ -92,10 +89,10 @@ func newClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegio // Handlers svc.Handlers.Sign.PushBack(v4.Sign) - svc.Handlers.Build.PushBack(jsonrpc.Build) - svc.Handlers.Unmarshal.PushBack(jsonrpc.Unmarshal) - svc.Handlers.UnmarshalMeta.PushBack(jsonrpc.UnmarshalMeta) - svc.Handlers.UnmarshalError.PushBack(jsonrpc.UnmarshalError) + svc.Handlers.Build.PushBackNamed(jsonrpc.BuildHandler) + svc.Handlers.Unmarshal.PushBackNamed(jsonrpc.UnmarshalHandler) + svc.Handlers.UnmarshalMeta.PushBackNamed(jsonrpc.UnmarshalMetaHandler) + svc.Handlers.UnmarshalError.PushBackNamed(jsonrpc.UnmarshalErrorHandler) // Run custom client initialization if present if initClient != nil { diff --git a/vendor/github.com/aws/aws-sdk-go/service/dynamodb/api.go b/vendor/github.com/aws/aws-sdk-go/service/dynamodb/api.go index 25922a5d5e..531781e20b 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/dynamodb/api.go +++ b/vendor/github.com/aws/aws-sdk-go/service/dynamodb/api.go @@ -185,9 +185,9 @@ func (c *DynamoDB) BatchWriteItemRequest(input *BatchWriteItemInput) (req *reque // // There are more than 25 requests in the batch. // -// Any individual item in a batch exceeds 400 KB. +// Any individual item in a batch exceeds 400 KB. // -// The total request size exceeds 16 MB. +// The total request size exceeds 16 MB. func (c *DynamoDB) BatchWriteItem(input *BatchWriteItemInput) (*BatchWriteItemOutput, error) { req, out := c.BatchWriteItemRequest(input) err := req.Send() @@ -319,6 +319,80 @@ func (c *DynamoDB) DeleteTable(input *DeleteTableInput) (*DeleteTableOutput, err return out, err } +const opDescribeLimits = "DescribeLimits" + +// DescribeLimitsRequest generates a request for the DescribeLimits operation. +func (c *DynamoDB) DescribeLimitsRequest(input *DescribeLimitsInput) (req *request.Request, output *DescribeLimitsOutput) { + op := &request.Operation{ + Name: opDescribeLimits, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &DescribeLimitsInput{} + } + + req = c.newRequest(op, input, output) + output = &DescribeLimitsOutput{} + req.Data = output + return +} + +// Returns the current provisioned-capacity limits for your AWS account in a +// region, both for the region as a whole and for any one DynamoDB table that +// you create there. +// +// When you establish an AWS account, the account has initial limits on the +// maximum read capacity units and write capacity units that you can provision +// across all of your DynamoDB tables in a given region. Also, there are per-table +// limits that apply when you create a table there. For more information, see +// Limits (http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Limits.html) +// page in the Amazon DynamoDB Developer Guide. +// +// Although you can increase these limits by filing a case at AWS Support Center +// (https://console.aws.amazon.com/support/home#/), obtaining the increase is +// not instantaneous. The DescribeLimits API lets you write code to compare +// the capacity you are currently using to those limits imposed by your account +// so that you have enough time to apply for an increase before you hit a limit. +// +// For example, you could use one of the AWS SDKs to do the following: +// +// Call DescribeLimits for a particular region to obtain your current account +// limits on provisioned capacity there. Create a variable to hold the aggregate +// read capacity units provisioned for all your tables in that region, and one +// to hold the aggregate write capacity units. Zero them both. Call ListTables +// to obtain a list of all your DynamoDB tables. For each table name listed +// by ListTables, do the following: +// +// Call DescribeTable with the table name. Use the data returned by DescribeTable +// to add the read capacity units and write capacity units provisioned for the +// table itself to your variables. If the table has one or more global secondary +// indexes (GSIs), loop over these GSIs and add their provisioned capacity values +// to your variables as well. Report the account limits for that region returned +// by DescribeLimits, along with the total current provisioned capacity levels +// you have calculated. This will let you see whether you are getting close +// to your account-level limits. +// +// The per-table limits apply only when you are creating a new table. They +// restrict the sum of the provisioned capacity of the new table itself and +// all its global secondary indexes. +// +// For existing tables and their GSIs, DynamoDB will not let you increase provisioned +// capacity extremely rapidly, but the only upper limit that applies is that +// the aggregate provisioned capacity over all your tables and GSIs cannot exceed +// either of the per-account limits. +// +// DescribeLimits should only be called periodically. You can expect throttling +// errors if you call it more than once in a minute. +// +// The DescribeLimits Request element has no content. +func (c *DynamoDB) DescribeLimits(input *DescribeLimitsInput) (*DescribeLimitsOutput, error) { + req, out := c.DescribeLimitsRequest(input) + err := req.Send() + return out, err +} + const opDescribeTable = "DescribeTable" // DescribeTableRequest generates a request for the DescribeTable operation. @@ -470,8 +544,10 @@ func (c *DynamoDB) PutItemRequest(input *PutItemInput) (req *request.Request, ou // see the ReturnValues description below. // // To prevent a new item from replacing an existing item, use a conditional -// put operation with ComparisonOperator set to NULL for the primary key attribute, -// or attributes. +// expression that contains the attribute_not_exists function with the name +// of the attribute being used as the partition key for the table. Since every +// record must contain that attribute, the attribute_not_exists function will +// only succeed if no matching item exists. // // For more information about using this API, see Working with Items (http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/WorkingWithItems.html) // in the Amazon DynamoDB Developer Guide. @@ -510,12 +586,12 @@ func (c *DynamoDB) QueryRequest(input *QueryInput) (req *request.Request, output // A Query operation uses the primary key of a table or a secondary index to // directly access items from that table or index. // -// Use the KeyConditionExpression parameter to provide a specific hash key -// value. The Query operation will return all of the items from the table or -// index with that hash key value. You can optionally narrow the scope of the -// Query operation by specifying a range key value and a comparison operator -// in KeyConditionExpression. You can use the ScanIndexForward parameter to -// get results in forward or reverse order, by range key or by index key. +// Use the KeyConditionExpression parameter to provide a specific value for +// the partition key. The Query operation will return all of the items from +// the table or index with that partition key value. You can optionally narrow +// the scope of the Query operation by specifying a sort key value and a comparison +// operator in KeyConditionExpression. You can use the ScanIndexForward parameter +// to get results in forward or reverse order, by sort key. // // Queries that do not return results consume the minimum number of read capacity // units for that type of read operation. @@ -588,9 +664,11 @@ func (c *DynamoDB) ScanRequest(input *ScanInput) (req *request.Request, output * // more information, see Parallel Scan (http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/QueryAndScan.html#QueryAndScanParallelScan) // in the Amazon DynamoDB Developer Guide. // -// By default, Scan uses eventually consistent reads when acessing the data -// in the table or local secondary index. However, you can use strongly consistent -// reads instead by setting the ConsistentRead parameter to true. +// By default, Scan uses eventually consistent reads when accessing the data +// in a table; therefore, the result set might not include the changes to data +// in the table immediately before the operation began. If you need a consistent +// copy of the data, as of the time that the Scan begins, you can set the ConsistentRead +// parameter to true. func (c *DynamoDB) Scan(input *ScanInput) (*ScanOutput, error) { req, out := c.ScanRequest(input) err := req.Send() @@ -629,9 +707,7 @@ func (c *DynamoDB) UpdateItemRequest(input *UpdateItemInput) (req *request.Reque // does not already exist. You can put, delete, or add attribute values. You // can also perform a conditional update on an existing item (insert a new attribute // name-value pair if it doesn't exist, or replace an existing name-value pair -// if it has certain expected attribute values). If conditions are specified -// and the item does not exist, then the operation fails and a new item is not -// created. +// if it has certain expected attribute values). // // You can also return the item's attribute values in the same UpdateItem operation // using the ReturnValues parameter. @@ -675,7 +751,7 @@ func (c *DynamoDB) UpdateTableRequest(input *UpdateTableInput) (req *request.Req // Create a new global secondary index on the table. Once the index begins // backfilling, you can use UpdateTable to perform other operations. // -// UpdateTable is an asynchronous operation; while it is executing, the table +// UpdateTable is an asynchronous operation; while it is executing, the table // status changes from ACTIVE to UPDATING. While it is UPDATING, you cannot // issue another UpdateTable request. When the table returns to the ACTIVE state, // the UpdateTable operation is complete. @@ -692,7 +768,10 @@ type AttributeDefinition struct { // A name for the attribute. AttributeName *string `min:"1" type:"string" required:"true"` - // The data type for the attribute. + // The data type for the attribute, where: + // + // S - the attribute is of type String N - the attribute is of type Number + // B - the attribute is of type Binary AttributeType *string `type:"string" required:"true" enum:"ScalarAttributeType"` } @@ -717,6 +796,8 @@ type AttributeValue struct { _ struct{} `type:"structure"` // A Binary data type. + // + // B is automatically base64 encoded/decoded by the SDK. B []byte `type:"blob"` // A Boolean data type. @@ -905,9 +986,9 @@ type BatchGetItemInput struct { // // Keys - An array of primary key attribute values that define specific items // in the table. For each primary key, you must provide all of the key attributes. - // For example, with a hash type primary key, you only need to provide the hash - // attribute. For a hash-and-range type primary key, you must provide both the - // hash attribute and the range attribute. + // For example, with a simple primary key, you only need to provide the partition + // key value. For a composite key, you must provide both the partition key value + // and the sort key value. // // ProjectionExpression - A string that identifies one or more attributes // to retrieve from the table. These attributes can include scalars, sets, or @@ -943,7 +1024,7 @@ type BatchGetItemInput struct { // Determines the level of detail about provisioned throughput consumption that // is returned in the response: // - // INDEXES - The response includes the aggregate ConsumedCapacity for the + // INDEXES - The response includes the aggregate ConsumedCapacity for the // operation, together with ConsumedCapacity for each table and secondary index // that was accessed. // @@ -951,7 +1032,7 @@ type BatchGetItemInput struct { // any indexes at all. In these cases, specifying INDEXES will only return ConsumedCapacity // information for table(s). // - // TOTAL - The response includes only the aggregate ConsumedCapacity for the + // TOTAL - The response includes only the aggregate ConsumedCapacity for the // operation. // // NONE - No ConsumedCapacity details are included in the response. @@ -1033,9 +1114,9 @@ type BatchWriteItemInput struct { // Key - A map of primary key attribute values that uniquely identify the // ! item. Each entry in this map consists of an attribute name and an attribute // value. For each primary key, you must provide all of the key attributes. - // For example, with a hash type primary key, you only need to provide the hash - // attribute. For a hash-and-range type primary key, you must provide both the - // hash attribute and the range attribute. + // For example, with a simple primary key, you only need to provide a value + // for the partition key. For a composite primary key, you must provide values + // for both the partition key and the sort key. // // PutRequest - Perform a PutItem operation on the specified item. The // item to be put is identified by an Item subelement: @@ -1054,7 +1135,7 @@ type BatchWriteItemInput struct { // Determines the level of detail about provisioned throughput consumption that // is returned in the response: // - // INDEXES - The response includes the aggregate ConsumedCapacity for the + // INDEXES - The response includes the aggregate ConsumedCapacity for the // operation, together with ConsumedCapacity for each table and secondary index // that was accessed. // @@ -1062,7 +1143,7 @@ type BatchWriteItemInput struct { // any indexes at all. In these cases, specifying INDEXES will only return ConsumedCapacity // information for table(s). // - // TOTAL - The response includes only the aggregate ConsumedCapacity for the + // TOTAL - The response includes only the aggregate ConsumedCapacity for the // operation. // // NONE - No ConsumedCapacity details are included in the response. @@ -1104,8 +1185,8 @@ type BatchWriteItemOutput struct { // // Each entry consists of the following subelements: // - // ItemCollectionKey - The hash key value of the item collection. This is - // the same as the hash key of the item. + // ItemCollectionKey - The partition key value of the item collection. This + // is the same as the partition key value of the item. // // SizeEstimateRange - An estimate of item collection size, expressed in // GB. This is a two-element array containing a lower bound and an upper bound @@ -1471,12 +1552,25 @@ type CreateTableInput struct { // // AttributeName - The name of this key attribute. // - // KeyType - Determines whether the key attribute is HASH or RANGE. + // KeyType - The role that the key attribute will assume: // - // For a primary key that consists of a hash attribute, you must provide - // exactly one element with a KeyType of HASH. + // HASH - partition key // - // For a primary key that consists of hash and range attributes, you must provide + // RANGE - sort key + // + // The partition key of an item is also known as its hash attribute. The + // term "hash attribute" derives from DynamoDB' usage of an internal hash function + // to evenly distribute data items across partitions, based on their partition + // key values. + // + // The sort key of an item is also known as its range attribute. The term "range + // attribute" derives from the way DynamoDB stores items with the same partition + // key physically close together, in sorted order by the sort key value. + // + // For a simple primary key (partition key), you must provide exactly one element + // with a KeyType of HASH. + // + // For a composite primary key (partition key and sort key), you must provide // exactly two elements, in this order: The first element must have a KeyType // of HASH, and the second element must have a KeyType of RANGE. // @@ -1485,9 +1579,9 @@ type CreateTableInput struct { KeySchema []*KeySchemaElement `min:"1" type:"list" required:"true"` // One or more local secondary indexes (the maximum is five) to be created on - // the table. Each index is scoped to a given hash key value. There is a 10 - // GB size limit per hash key; otherwise, the size of a local secondary index - // is unconstrained. + // the table. Each index is scoped to a given partition key value. There is + // a 10 GB size limit per partition key value; otherwise, the size of a local + // secondary index is unconstrained. // // Each local secondary index in the array includes the following: // @@ -1495,7 +1589,7 @@ type CreateTableInput struct { // for this table. // // KeySchema - Specifies the key schema for the local secondary index. The - // key schema must begin with the same hash key attribute as the table. + // key schema must begin with the same partition key as the table. // // Projection - Specifies attributes that are copied (projected) from the // table into the index. These are in addition to the primary key attributes @@ -1612,7 +1706,7 @@ type DeleteItemInput struct { // // These function names are case-sensitive. // - // Comparison operators: = | <> | < | > | <= | >= | BETWEEN | IN + // Comparison operators: = | | | | = | = | BETWEEN | IN // // Logical operators: AND | OR | NOT // @@ -1901,15 +1995,15 @@ type DeleteItemInput struct { // key of the item to delete. // // For the primary key, you must provide all of the attributes. For example, - // with a hash type primary key, you only need to provide the hash attribute. - // For a hash-and-range type primary key, you must provide both the hash attribute - // and the range attribute. + // with a simple primary key, you only need to provide a value for the partition + // key. For a composite primary key, you must provide values for both the partition + // key and the sort key. Key map[string]*AttributeValue `type:"map" required:"true"` // Determines the level of detail about provisioned throughput consumption that // is returned in the response: // - // INDEXES - The response includes the aggregate ConsumedCapacity for the + // INDEXES - The response includes the aggregate ConsumedCapacity for the // operation, together with ConsumedCapacity for each table and secondary index // that was accessed. // @@ -1917,7 +2011,7 @@ type DeleteItemInput struct { // any indexes at all. In these cases, specifying INDEXES will only return ConsumedCapacity // information for table(s). // - // TOTAL - The response includes only the aggregate ConsumedCapacity for the + // TOTAL - The response includes only the aggregate ConsumedCapacity for the // operation. // // NONE - No ConsumedCapacity details are included in the response. @@ -1976,8 +2070,8 @@ type DeleteItemOutput struct { // // Each ItemCollectionMetrics element consists of: // - // ItemCollectionKey - The hash key value of the item collection. This is - // the same as the hash key of the item. + // ItemCollectionKey - The partition key value of the item collection. This + // is the same as the partition key value of the item itself. // // SizeEstimateRange - An estimate of item collection size, in gigabytes. This // value is a two-element array containing a lower bound and an upper bound @@ -2057,6 +2151,54 @@ func (s DeleteTableOutput) GoString() string { return s.String() } +// Represents the input of a DescribeLimits operation. Has no content. +type DescribeLimitsInput struct { + _ struct{} `type:"structure"` +} + +// String returns the string representation +func (s DescribeLimitsInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DescribeLimitsInput) GoString() string { + return s.String() +} + +// Represents the output of a DescribeLimits operation. +type DescribeLimitsOutput struct { + _ struct{} `type:"structure"` + + // The maximum total read capacity units that your account allows you to provision + // across all of your tables in this region. + AccountMaxReadCapacityUnits *int64 `min:"1" type:"long"` + + // The maximum total write capacity units that your account allows you to provision + // across all of your tables in this region. + AccountMaxWriteCapacityUnits *int64 `min:"1" type:"long"` + + // The maximum read capacity units that your account allows you to provision + // for a new table that you are creating in this region, including the read + // capacity units provisioned for its global secondary indexes (GSIs). + TableMaxReadCapacityUnits *int64 `min:"1" type:"long"` + + // The maximum write capacity units that your account allows you to provision + // for a new table that you are creating in this region, including the write + // capacity units provisioned for its global secondary indexes (GSIs). + TableMaxWriteCapacityUnits *int64 `min:"1" type:"long"` +} + +// String returns the string representation +func (s DescribeLimitsOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DescribeLimitsOutput) GoString() string { + return s.String() +} + // Represents the input of a DescribeTable operation. type DescribeTableInput struct { _ struct{} `type:"structure"` @@ -2372,9 +2514,9 @@ type GetItemInput struct { // key of the item to retrieve. // // For the primary key, you must provide all of the attributes. For example, - // with a hash type primary key, you only need to provide the hash attribute. - // For a hash-and-range type primary key, you must provide both the hash attribute - // and the range attribute. + // with a simple primary key, you only need to provide a value for the partition + // key. For a composite primary key, you must provide values for both the partition + // key and the sort key. Key map[string]*AttributeValue `type:"map" required:"true"` // A string that identifies one or more attributes to retrieve from the table. @@ -2394,7 +2536,7 @@ type GetItemInput struct { // Determines the level of detail about provisioned throughput consumption that // is returned in the response: // - // INDEXES - The response includes the aggregate ConsumedCapacity for the + // INDEXES - The response includes the aggregate ConsumedCapacity for the // operation, together with ConsumedCapacity for each table and secondary index // that was accessed. // @@ -2402,7 +2544,7 @@ type GetItemInput struct { // any indexes at all. In these cases, specifying INDEXES will only return ConsumedCapacity // information for table(s). // - // TOTAL - The response includes only the aggregate ConsumedCapacity for the + // TOTAL - The response includes only the aggregate ConsumedCapacity for the // operation. // // NONE - No ConsumedCapacity details are included in the response. @@ -2457,7 +2599,20 @@ type GlobalSecondaryIndex struct { IndexName *string `min:"3" type:"string" required:"true"` // The complete key schema for a global secondary index, which consists of one - // or more pairs of attribute names and key types (HASH or RANGE). + // or more pairs of attribute names and key types: + // + // HASH - partition key + // + // RANGE - sort key + // + // The partition key of an item is also known as its hash attribute. The + // term "hash attribute" derives from DynamoDB' usage of an internal hash function + // to evenly distribute data items across partitions, based on their partition + // key values. + // + // The sort key of an item is also known as its range attribute. The term "range + // attribute" derives from the way DynamoDB stores items with the same partition + // key physically close together, in sorted order by the sort key value. KeySchema []*KeySchemaElement `min:"1" type:"list" required:"true"` // Represents attributes that are copied (projected) from the table into an @@ -2490,8 +2645,8 @@ type GlobalSecondaryIndexDescription struct { // Indicates whether the index is currently backfilling. Backfilling is the // process of reading items from the table and determining whether they can - // be added to the index. (Not all items will qualify: For example, a hash key - // attribute cannot have any duplicates.) If an item can be added to the index, + // be added to the index. (Not all items will qualify: For example, a partition + // key cannot have any duplicate values.) If an item can be added to the index, // DynamoDB will do so. After all items have been processed, the backfilling // operation is complete and Backfilling is false. // @@ -2525,8 +2680,21 @@ type GlobalSecondaryIndexDescription struct { // every six hours. Recent changes might not be reflected in this value. ItemCount *int64 `type:"long"` - // The complete key schema for the global secondary index, consisting of one - // or more pairs of attribute names and key types (HASH or RANGE). + // The complete key schema for a global secondary index, which consists of one + // or more pairs of attribute names and key types: + // + // HASH - partition key + // + // RANGE - sort key + // + // The partition key of an item is also known as its hash attribute. The + // term "hash attribute" derives from DynamoDB' usage of an internal hash function + // to evenly distribute data items across partitions, based on their partition + // key values. + // + // The sort key of an item is also known as its range attribute. The term "range + // attribute" derives from the way DynamoDB stores items with the same partition + // key physically close together, in sorted order by the sort key value. KeySchema []*KeySchemaElement `min:"1" type:"list"` // Represents attributes that are copied (projected) from the table into an @@ -2598,8 +2766,8 @@ func (s GlobalSecondaryIndexUpdate) GoString() string { type ItemCollectionMetrics struct { _ struct{} `type:"structure"` - // The hash key value of the item collection. This value is the same as the - // hash key of the item. + // The partition key value of the item collection. This value is the same as + // the partition key value of the item. ItemCollectionKey map[string]*AttributeValue `type:"map"` // An estimate of item collection size, in gigabytes. This value is a two-element @@ -2628,16 +2796,33 @@ func (s ItemCollectionMetrics) GoString() string { // that make up the primary key of a table, or the key attributes of an index. // // A KeySchemaElement represents exactly one attribute of the primary key. -// For example, a hash type primary key would be represented by one KeySchemaElement. -// A hash-and-range type primary key would require one KeySchemaElement for -// the hash attribute, and another KeySchemaElement for the range attribute. +// For example, a simple primary key would be represented by one KeySchemaElement +// (for the partition key). A composite primary key would require one KeySchemaElement +// for the partition key, and another KeySchemaElement for the sort key. +// +// A KeySchemaElement must be a scalar, top-level attribute (not a nested attribute). +// The data type must be one of String, Number, or Binary. The attribute cannot +// be nested within a List or a Map. type KeySchemaElement struct { _ struct{} `type:"structure"` // The name of a key attribute. AttributeName *string `min:"1" type:"string" required:"true"` - // The attribute data, consisting of the data type and the attribute value itself. + // The role that this key attribute will assume: + // + // HASH - partition key + // + // RANGE - sort key + // + // The partition key of an item is also known as its hash attribute. The + // term "hash attribute" derives from DynamoDB' usage of an internal hash function + // to evenly distribute data items across partitions, based on their partition + // key values. + // + // The sort key of an item is also known as its range attribute. The term "range + // attribute" derives from the way DynamoDB stores items with the same partition + // key physically close together, in sorted order by the sort key value. KeyType *string `type:"string" required:"true" enum:"KeyType"` } @@ -2655,9 +2840,9 @@ func (s KeySchemaElement) GoString() string { // from the table. // // For each primary key, you must provide all of the key attributes. For example, -// with a hash type primary key, you only need to provide the hash attribute. -// For a hash-and-range type primary key, you must provide both the hash attribute -// and the range attribute. +// with a simple primary key, you only need to provide the partition key. For +// a composite primary key, you must provide both the partition key and the +// sort key. type KeysAndAttributes struct { _ struct{} `type:"structure"` @@ -2799,7 +2984,20 @@ type LocalSecondaryIndex struct { IndexName *string `min:"3" type:"string" required:"true"` // The complete key schema for the local secondary index, consisting of one - // or more pairs of attribute names and key types (HASH or RANGE). + // or more pairs of attribute names and key types: + // + // HASH - partition key + // + // RANGE - sort key + // + // The partition key of an item is also known as its hash attribute. The + // term "hash attribute" derives from DynamoDB' usage of an internal hash function + // to evenly distribute data items across partitions, based on their partition + // key values. + // + // The sort key of an item is also known as its range attribute. The term "range + // attribute" derives from the way DynamoDB stores items with the same partition + // key physically close together, in sorted order by the sort key value. KeySchema []*KeySchemaElement `min:"1" type:"list" required:"true"` // Represents attributes that are copied (projected) from the table into an @@ -2837,8 +3035,21 @@ type LocalSecondaryIndexDescription struct { // every six hours. Recent changes might not be reflected in this value. ItemCount *int64 `type:"long"` - // The complete index key schema, which consists of one or more pairs of attribute - // names and key types (HASH or RANGE). + // The complete key schema for the local secondary index, consisting of one + // or more pairs of attribute names and key types: + // + // HASH - partition key + // + // RANGE - sort key + // + // The partition key of an item is also known as its hash attribute. The + // term "hash attribute" derives from DynamoDB' usage of an internal hash function + // to evenly distribute data items across partitions, based on their partition + // key values. + // + // The sort key of an item is also known as its range attribute. The term "range + // attribute" derives from the way DynamoDB stores items with the same partition + // key physically close together, in sorted order by the sort key value. KeySchema []*KeySchemaElement `min:"1" type:"list"` // Represents attributes that are copied (projected) from the table into an @@ -2976,7 +3187,7 @@ type PutItemInput struct { // // These function names are case-sensitive. // - // Comparison operators: = | <> | < | > | <= | >= | BETWEEN | IN + // Comparison operators: = | | | | = | = | BETWEEN | IN // // Logical operators: AND | OR | NOT // @@ -3266,9 +3477,9 @@ type PutItemInput struct { // pairs for the item. // // You must provide all of the attributes for the primary key. For example, - // with a hash type primary key, you only need to provide the hash attribute. - // For a hash-and-range type primary key, you must provide both the hash attribute - // and the range attribute. + // with a simple primary key, you only need to provide a value for the partition + // key. For a composite primary key, you must provide both values for both the + // partition key and the sort key. // // If you specify any attributes that are part of an index key, then the data // types for those attributes must match those of the schema in the table's @@ -3283,7 +3494,7 @@ type PutItemInput struct { // Determines the level of detail about provisioned throughput consumption that // is returned in the response: // - // INDEXES - The response includes the aggregate ConsumedCapacity for the + // INDEXES - The response includes the aggregate ConsumedCapacity for the // operation, together with ConsumedCapacity for each table and secondary index // that was accessed. // @@ -3291,7 +3502,7 @@ type PutItemInput struct { // any indexes at all. In these cases, specifying INDEXES will only return ConsumedCapacity // information for table(s). // - // TOTAL - The response includes only the aggregate ConsumedCapacity for the + // TOTAL - The response includes only the aggregate ConsumedCapacity for the // operation. // // NONE - No ConsumedCapacity details are included in the response. @@ -3312,8 +3523,6 @@ type PutItemInput struct { // // ALL_OLD - If PutItem overwrote an attribute name-value pair, then the // content of the old item is returned. - // - // Other "Valid Values" are not relevant to PutItem. ReturnValues *string `type:"string" enum:"ReturnValue"` // The name of the table to contain the item. @@ -3354,8 +3563,8 @@ type PutItemOutput struct { // // Each ItemCollectionMetrics element consists of: // - // ItemCollectionKey - The hash key value of the item collection. This is - // the same as the hash key of the item. + // ItemCollectionKey - The partition key value of the item collection. This + // is the same as the partition key value of the item itself. // // SizeEstimateRange - An estimate of item collection size, in gigabytes. This // value is a two-element array containing a lower bound and an upper bound @@ -3553,50 +3762,51 @@ type QueryInput struct { // The condition that specifies the key value(s) for items to be retrieved by // the Query action. // - // The condition must perform an equality test on a single hash key value. + // The condition must perform an equality test on a single partition key value. // The condition can also perform one of several comparison tests on a single - // range key value. Query can use KeyConditionExpression to retrieve one item - // with a given hash and range key value, or several items that have the same - // hash key value but different range key values. + // sort key value. Query can use KeyConditionExpression to retrieve one item + // with a given partition key value and sort key value, or several items that + // have the same partition key value but different sort key values. // - // The hash key equality test is required, and must be specified in the following - // format: + // The partition key equality test is required, and must be specified in the + // following format: // - // hashAttributeName = :hashval + // partitionKeyName = :partitionkeyval // - // If you also want to provide a range key condition, it must be combined using - // AND with the hash key condition. Following is an example, using the = comparison - // operator for the range key: + // If you also want to provide a condition for the sort key, it must be combined + // using AND with the condition for the sort key. Following is an example, using + // the = comparison operator for the sort key: // - // hashAttributeName = :hashval AND rangeAttributeName = :rangeval + // partitionKeyName = :partitionkeyval AND sortKeyName = :sortkeyval // - // Valid comparisons for the range key condition are as follows: + // Valid comparisons for the sort key condition are as follows: // - // rangeAttributeName = :rangeval - true if the range key is equal to :rangeval. + // sortKeyName = :sortkeyval - true if the sort key value is equal to :sortkeyval. // - // rangeAttributeName < :rangeval - true if the range key is less than :rangeval. + // sortKeyName :sortkeyval - true if the sort key value is less than :sortkeyval. // - // rangeAttributeName <= :rangeval - true if the range key is less than or - // equal to :rangeval. + // sortKeyName = :sortkeyval - true if the sort key value is less than or + // equal to :sortkeyval. // - // rangeAttributeName > :rangeval - true if the range key is greater than - // :rangeval. + // sortKeyName :sortkeyval - true if the sort key value is greater than + // :sortkeyval. // - // rangeAttributeName >= :rangeval - true if the range key is greater than - // or equal to :rangeval. + // sortKeyName = :sortkeyval - true if the sort key value is greater than + // or equal to :sortkeyval. // - // rangeAttributeName BETWEEN :rangeval1 AND :rangeval2 - true if the range - // key is greater than or equal to :rangeval1, and less than or equal to :rangeval2. + // sortKeyName BETWEEN :sortkeyval1 AND :sortkeyval2 - true if the sort key + // value is greater than or equal to :sortkeyval1, and less than or equal to + // :sortkeyval2. // - // begins_with (rangeAttributeName, :rangeval) - true if the range key begins - // with a particular operand. (You cannot use this function with a range key + // begins_with (sortKeyName, :sortkeyval) - true if the sort key value begins + // with a particular operand. (You cannot use this function with a sort key // that is of type Number.) Note that the function name begins_with is case-sensitive. // // Use the ExpressionAttributeValues parameter to replace tokens such as - // :hashval and :rangeval with actual values at runtime. + // :partitionval and :sortval with actual values at runtime. // // You can optionally use the ExpressionAttributeNames parameter to replace - // the names of the hash and range attributes with placeholder tokens. This + // the names of the partition key and sort key with placeholder tokens. This // option might be necessary if an attribute name conflicts with a DynamoDB // reserved word. For example, the following KeyConditionExpression parameter // causes an error because Size is a reserved word: @@ -3621,17 +3831,17 @@ type QueryInput struct { // // The selection criteria for the query. For a query on a table, you can have // conditions only on the table primary key attributes. You must provide the - // hash key attribute name and value as an EQ condition. You can optionally - // provide a second condition, referring to the range key attribute. + // partition key name and value as an EQ condition. You can optionally provide + // a second condition, referring to the sort key. // - // If you don't provide a range key condition, all of the items that match - // the hash key will be retrieved. If a FilterExpression or QueryFilter is present, - // it will be applied after the items are retrieved. + // If you don't provide a sort key condition, all of the items that match + // the partition key will be retrieved. If a FilterExpression or QueryFilter + // is present, it will be applied after the items are retrieved. // // For a query on an index, you can have conditions only on the index key attributes. - // You must provide the index hash attribute name and value as an EQ condition. - // You can optionally provide a second condition, referring to the index key - // range attribute. + // You must provide the index partition key name and value as an EQ condition. + // You can optionally provide a second condition, referring to the index sort + // key. // // Each KeyConditions element consists of an attribute name to compare, along // with the following: @@ -3766,7 +3976,7 @@ type QueryInput struct { // must evaluate to true, rather than all of them.) // // Note that QueryFilter does not allow key attributes. You cannot define a - // filter condition on a hash key or range key. + // filter condition on a partition key or a sort key. // // Each QueryFilter element consists of an attribute name to compare, along // with the following: @@ -3788,7 +3998,7 @@ type QueryInput struct { // For information on specifying data types in JSON, see JSON Data Format (http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/DataFormat.html) // in the Amazon DynamoDB Developer Guide. // - // ComparisonOperator - A comparator for evaluating attributes. For example, + // ComparisonOperator - A comparator for evaluating attributes. For example, // equals, greater than, less than, etc. // // The following comparison operators are available: @@ -3804,7 +4014,7 @@ type QueryInput struct { // Determines the level of detail about provisioned throughput consumption that // is returned in the response: // - // INDEXES - The response includes the aggregate ConsumedCapacity for the + // INDEXES - The response includes the aggregate ConsumedCapacity for the // operation, together with ConsumedCapacity for each table and secondary index // that was accessed. // @@ -3812,26 +4022,26 @@ type QueryInput struct { // any indexes at all. In these cases, specifying INDEXES will only return ConsumedCapacity // information for table(s). // - // TOTAL - The response includes only the aggregate ConsumedCapacity for the + // TOTAL - The response includes only the aggregate ConsumedCapacity for the // operation. // // NONE - No ConsumedCapacity details are included in the response. ReturnConsumedCapacity *string `type:"string" enum:"ReturnConsumedCapacity"` - // Specifies the order in which to return the query results - either ascending - // (true) or descending (false). - // - // Items with the same hash key are stored in sorted order by range key .If - // the range key data type is Number, the results are stored in numeric order. - // For type String, the results are returned in order of ASCII character code - // values. For type Binary, DynamoDB treats each byte of the binary data as - // unsigned. + // Specifies the order for index traversal: If true (default), the traversal + // is performed in ascending order; if false, the traversal is performed in + // descending order. // - // If ScanIndexForward is true, DynamoDB returns the results in order, by range - // key. This is the default behavior. + // Items with the same partition key value are stored in sorted order by sort + // key. If the sort key data type is Number, the results are stored in numeric + // order. For type String, the results are stored in order of ASCII character + // code values. For type Binary, DynamoDB treats each byte of the binary data + // as unsigned. // - // If ScanIndexForward is false, DynamoDB sorts the results in descending order - // by range key, and then returns the results to the client. + // If ScanIndexForward is true, DynamoDB returns the results in the order in + // which they are stored (by sort key value). This is the default behavior. + // If ScanIndexForward is false, DynamoDB reads the results in reverse order + // by sort key value, and then returns the results to the client. ScanIndexForward *bool `type:"boolean"` // The attributes to be returned in the result. You can retrieve all item attributes, @@ -3909,7 +4119,7 @@ type QueryOutput struct { // // If you used a QueryFilter in the request, then Count is the number of items // returned after the filter was applied, and ScannedCount is the number of - // matching items before> the filter was applied. + // matching items before the filter was applied. // // If you did not use a filter in the request, then Count and ScannedCount // are the same. @@ -3994,19 +4204,16 @@ type ScanInput struct { // A Boolean value that determines the read consistency model during the scan: // - // If ConsistentRead is false, then Scan will use eventually consistent reads. - // The data returned from Scan might not contain the results of other recently - // completed write operations (PutItem, UpdateItem or DeleteItem). The Scan - // response might include some stale data. + // If ConsistentRead is false, then the data returned from Scan might not + // contain the results from other recently completed write operations (PutItem, + // UpdateItem or DeleteItem). // - // If ConsistentRead is true, then Scan will use strongly consistent reads. - // All of the write operations that completed before the Scan began are guaranteed - // to be contained in the Scan response. + // If ConsistentRead is true, then all of the write operations that completed + // before the Scan began are guaranteed to be contained in the Scan response. // - // The default setting for ConsistentRead is false, meaning that eventually - // consistent reads will be used. + // The default setting for ConsistentRead is false. // - // Strongly consistent reads are not supported on global secondary indexes. + // The ConsistentRead parameter is not supported on global secondary indexes. // If you scan a global secondary index with ConsistentRead set to true, you // will receive a ValidationException. ConsistentRead *bool `type:"boolean"` @@ -4127,7 +4334,7 @@ type ScanInput struct { // Determines the level of detail about provisioned throughput consumption that // is returned in the response: // - // INDEXES - The response includes the aggregate ConsumedCapacity for the + // INDEXES - The response includes the aggregate ConsumedCapacity for the // operation, together with ConsumedCapacity for each table and secondary index // that was accessed. // @@ -4135,7 +4342,7 @@ type ScanInput struct { // any indexes at all. In these cases, specifying INDEXES will only return ConsumedCapacity // information for table(s). // - // TOTAL - The response includes only the aggregate ConsumedCapacity for the + // TOTAL - The response includes only the aggregate ConsumedCapacity for the // operation. // // NONE - No ConsumedCapacity details are included in the response. @@ -4177,7 +4384,7 @@ type ScanInput struct { // For information on specifying data types in JSON, see JSON Data Format (http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/DataFormat.html) // in the Amazon DynamoDB Developer Guide. // - // ComparisonOperator - A comparator for evaluating attributes. For example, + // ComparisonOperator - A comparator for evaluating attributes. For example, // equals, greater than, less than, etc. // // The following comparison operators are available: @@ -4370,7 +4577,7 @@ type TableDescription struct { CreationDateTime *time.Time `type:"timestamp" timestampFormat:"unix"` // The global secondary indexes, if any, on the table. Each index is scoped - // to a given hash key value. Each element is composed of: + // to a given partition key value. Each element is composed of: // // Backfilling - If true, then the index is currently in the backfilling // phase. Backfilling occurs only when a new global secondary index is added @@ -4400,7 +4607,7 @@ type TableDescription struct { // // KeySchema - Specifies the complete index key schema. The attribute names // in the key schema must be between 1 and 255 characters (inclusive). The key - // schema must begin with the same hash key attribute as the table. + // schema must begin with the same partition key as the table. // // Projection - Specifies attributes that are copied (projected) from the // table into the index. These are in addition to the primary key attributes @@ -4438,7 +4645,20 @@ type TableDescription struct { // // AttributeName - The name of the attribute. // - // KeyType - The key type for the attribute. Can be either HASH or RANGE. + // KeyType - The role of the attribute: + // + // . HASH - partition key + // + // RANGE - sort key + // + // The partition key of an item is also known as its hash attribute. The + // term "hash attribute" derives from DynamoDB' usage of an internal hash function + // to evenly distribute data items across partitions, based on their partition + // key values. + // + // The sort key of an item is also known as its range attribute. The term "range + // attribute" derives from the way DynamoDB stores items with the same partition + // key physically close together, in sorted order by the sort key value. // // For more information about primary keys, see Primary Key (http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/DataModel.html#DataModelPrimaryKey) // in the Amazon DynamoDB Developer Guide. @@ -4463,7 +4683,7 @@ type TableDescription struct { LatestStreamLabel *string `type:"string"` // Represents one or more local secondary indexes on the table. Each index is - // scoped to a given hash key value. Tables with one or more local secondary + // scoped to a given partition key value. Tables with one or more local secondary // indexes are subject to an item collection size limit, where the amount of // data within a given item collection cannot exceed 10 GB. Each element is // composed of: @@ -4472,7 +4692,7 @@ type TableDescription struct { // // KeySchema - Specifies the complete index key schema. The attribute names // in the key schema must be between 1 and 255 characters (inclusive). The key - // schema must begin with the same hash key attribute as the table. + // schema must begin with the same partition key as the table. // // Projection - Specifies attributes that are copied (projected) from the // table into the index. These are in addition to the primary key attributes @@ -4589,7 +4809,7 @@ type UpdateItemInput struct { // and the new value for each. If you are updating an attribute that is an index // key attribute for any indexes on that table, the attribute type must match // the index key type defined in the AttributesDefinition of the table description. - // You can use UpdateItem to update any nonkey attributes. + // You can use UpdateItem to update any non-key attributes. // // Attribute values cannot be null. String and Binary type attributes must // have lengths greater than zero. Set type attributes must not be empty. Requests @@ -4676,7 +4896,7 @@ type UpdateItemInput struct { // // These function names are case-sensitive. // - // Comparison operators: = | <> | < | > | <= | >= | BETWEEN | IN + // Comparison operators: = | | | | = | = | BETWEEN | IN // // Logical operators: AND | OR | NOT // @@ -4965,15 +5185,15 @@ type UpdateItemInput struct { // name and a value for that attribute. // // For the primary key, you must provide all of the attributes. For example, - // with a hash type primary key, you only need to provide the hash attribute. - // For a hash-and-range type primary key, you must provide both the hash attribute - // and the range attribute. + // with a simple primary key, you only need to provide a value for the partition + // key. For a composite primary key, you must provide values for both the partition + // key and the sort key. Key map[string]*AttributeValue `type:"map" required:"true"` // Determines the level of detail about provisioned throughput consumption that // is returned in the response: // - // INDEXES - The response includes the aggregate ConsumedCapacity for the + // INDEXES - The response includes the aggregate ConsumedCapacity for the // operation, together with ConsumedCapacity for each table and secondary index // that was accessed. // @@ -4981,7 +5201,7 @@ type UpdateItemInput struct { // any indexes at all. In these cases, specifying INDEXES will only return ConsumedCapacity // information for table(s). // - // TOTAL - The response includes only the aggregate ConsumedCapacity for the + // TOTAL - The response includes only the aggregate ConsumedCapacity for the // operation. // // NONE - No ConsumedCapacity details are included in the response. @@ -5008,6 +5228,12 @@ type UpdateItemInput struct { // ALL_NEW - All of the attributes of the new version of the item are returned. // // UPDATED_NEW - The new versions of only the updated attributes are returned. + // + // There is no additional cost associated with requesting a return value + // aside from the small network and processing overhead of receiving a larger + // response. No Read Capacity Units are consumed. + // + // Values returned are strongly consistent ReturnValues *string `type:"string" enum:"ReturnValue"` // The name of the table containing the item to update. @@ -5303,7 +5529,7 @@ const ( // Determines the level of detail about provisioned throughput consumption that // is returned in the response: // -// INDEXES - The response includes the aggregate ConsumedCapacity for the +// INDEXES - The response includes the aggregate ConsumedCapacity for the // operation, together with ConsumedCapacity for each table and secondary index // that was accessed. // @@ -5311,7 +5537,7 @@ const ( // any indexes at all. In these cases, specifying INDEXES will only return ConsumedCapacity // information for table(s). // -// TOTAL - The response includes only the aggregate ConsumedCapacity for the +// TOTAL - The response includes only the aggregate ConsumedCapacity for the // operation. // // NONE - No ConsumedCapacity details are included in the response. diff --git a/vendor/github.com/aws/aws-sdk-go/service/dynamodb/dynamodbattribute/converter.go b/vendor/github.com/aws/aws-sdk-go/service/dynamodb/dynamodbattribute/converter.go new file mode 100644 index 0000000000..e38e41dafd --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/service/dynamodb/dynamodbattribute/converter.go @@ -0,0 +1,443 @@ +package dynamodbattribute + +import ( + "bytes" + "encoding/json" + "fmt" + "reflect" + "runtime" + "strconv" + + "github.com/aws/aws-sdk-go/aws/awserr" + "github.com/aws/aws-sdk-go/service/dynamodb" +) + +// ConvertToMap accepts a map[string]interface{} or struct and converts it to a +// map[string]*dynamodb.AttributeValue. +// +// If in contains any structs, it is first JSON encoded/decoded it to convert it +// to a map[string]interface{}, so `json` struct tags are respected. +// +// Deprecated: Use MarshalMap instead +func ConvertToMap(in interface{}) (item map[string]*dynamodb.AttributeValue, err error) { + defer func() { + if r := recover(); r != nil { + if e, ok := r.(runtime.Error); ok { + err = e + } else if s, ok := r.(string); ok { + err = fmt.Errorf(s) + } else { + err = r.(error) + } + item = nil + } + }() + + if in == nil { + return nil, awserr.New("SerializationError", + "in must be a map[string]interface{} or struct, got ", nil) + } + + v := reflect.ValueOf(in) + if v.Kind() != reflect.Struct && !(v.Kind() == reflect.Map && v.Type().Key().Kind() == reflect.String) { + return nil, awserr.New("SerializationError", + fmt.Sprintf("in must be a map[string]interface{} or struct, got %s", + v.Type().String()), + nil) + } + + if isTyped(reflect.TypeOf(in)) { + var out map[string]interface{} + in = convertToUntyped(in, out) + } + + item = make(map[string]*dynamodb.AttributeValue) + for k, v := range in.(map[string]interface{}) { + item[k] = convertTo(v) + } + + return item, nil +} + +// ConvertFromMap accepts a map[string]*dynamodb.AttributeValue and converts it to a +// map[string]interface{} or struct. +// +// If v points to a struct, the result is first converted it to a +// map[string]interface{}, then JSON encoded/decoded it to convert to a struct, +// so `json` struct tags are respected. +// +// Deprecated: Use UnmarshalMap instead +func ConvertFromMap(item map[string]*dynamodb.AttributeValue, v interface{}) (err error) { + defer func() { + if r := recover(); r != nil { + if e, ok := r.(runtime.Error); ok { + err = e + } else if s, ok := r.(string); ok { + err = fmt.Errorf(s) + } else { + err = r.(error) + } + item = nil + } + }() + + rv := reflect.ValueOf(v) + if rv.Kind() != reflect.Ptr || rv.IsNil() { + return awserr.New("SerializationError", + fmt.Sprintf("v must be a non-nil pointer to a map[string]interface{} or struct, got %s", + rv.Type()), + nil) + } + if rv.Elem().Kind() != reflect.Struct && !(rv.Elem().Kind() == reflect.Map && rv.Elem().Type().Key().Kind() == reflect.String) { + return awserr.New("SerializationError", + fmt.Sprintf("v must be a non-nil pointer to a map[string]interface{} or struct, got %s", + rv.Type()), + nil) + } + + m := make(map[string]interface{}) + for k, v := range item { + m[k] = convertFrom(v) + } + + if isTyped(reflect.TypeOf(v)) { + err = convertToTyped(m, v) + } else { + rv.Elem().Set(reflect.ValueOf(m)) + } + + return err +} + +// ConvertToList accepts an array or slice and converts it to a +// []*dynamodb.AttributeValue. +// +// Converting []byte fields to dynamodb.AttributeValue are only currently supported +// if the input is a map[string]interface{} type. []byte within typed structs are not +// converted correctly and are converted into base64 strings. This is a known bug, +// and will be fixed in a later release. +// +// If in contains any structs, it is first JSON encoded/decoded it to convert it +// to a []interface{}, so `json` struct tags are respected. +// +// Deprecated: Use MarshalList instead +func ConvertToList(in interface{}) (item []*dynamodb.AttributeValue, err error) { + defer func() { + if r := recover(); r != nil { + if e, ok := r.(runtime.Error); ok { + err = e + } else if s, ok := r.(string); ok { + err = fmt.Errorf(s) + } else { + err = r.(error) + } + item = nil + } + }() + + if in == nil { + return nil, awserr.New("SerializationError", + "in must be an array or slice, got ", + nil) + } + + v := reflect.ValueOf(in) + if v.Kind() != reflect.Array && v.Kind() != reflect.Slice { + return nil, awserr.New("SerializationError", + fmt.Sprintf("in must be an array or slice, got %s", + v.Type().String()), + nil) + } + + if isTyped(reflect.TypeOf(in)) { + var out []interface{} + in = convertToUntyped(in, out) + } + + item = make([]*dynamodb.AttributeValue, 0, len(in.([]interface{}))) + for _, v := range in.([]interface{}) { + item = append(item, convertTo(v)) + } + + return item, nil +} + +// ConvertFromList accepts a []*dynamodb.AttributeValue and converts it to an array or +// slice. +// +// If v contains any structs, the result is first converted it to a +// []interface{}, then JSON encoded/decoded it to convert to a typed array or +// slice, so `json` struct tags are respected. +// +// Deprecated: Use UnmarshalList instead +func ConvertFromList(item []*dynamodb.AttributeValue, v interface{}) (err error) { + defer func() { + if r := recover(); r != nil { + if e, ok := r.(runtime.Error); ok { + err = e + } else if s, ok := r.(string); ok { + err = fmt.Errorf(s) + } else { + err = r.(error) + } + item = nil + } + }() + + rv := reflect.ValueOf(v) + if rv.Kind() != reflect.Ptr || rv.IsNil() { + return awserr.New("SerializationError", + fmt.Sprintf("v must be a non-nil pointer to an array or slice, got %s", + rv.Type()), + nil) + } + if rv.Elem().Kind() != reflect.Array && rv.Elem().Kind() != reflect.Slice { + return awserr.New("SerializationError", + fmt.Sprintf("v must be a non-nil pointer to an array or slice, got %s", + rv.Type()), + nil) + } + + l := make([]interface{}, 0, len(item)) + for _, v := range item { + l = append(l, convertFrom(v)) + } + + if isTyped(reflect.TypeOf(v)) { + err = convertToTyped(l, v) + } else { + rv.Elem().Set(reflect.ValueOf(l)) + } + + return err +} + +// ConvertTo accepts any interface{} and converts it to a *dynamodb.AttributeValue. +// +// If in contains any structs, it is first JSON encoded/decoded it to convert it +// to a interface{}, so `json` struct tags are respected. +// +// Deprecated: Use Marshal instead +func ConvertTo(in interface{}) (item *dynamodb.AttributeValue, err error) { + defer func() { + if r := recover(); r != nil { + if e, ok := r.(runtime.Error); ok { + err = e + } else if s, ok := r.(string); ok { + err = fmt.Errorf(s) + } else { + err = r.(error) + } + item = nil + } + }() + + if in != nil && isTyped(reflect.TypeOf(in)) { + var out interface{} + in = convertToUntyped(in, out) + } + + item = convertTo(in) + return item, nil +} + +// ConvertFrom accepts a *dynamodb.AttributeValue and converts it to any interface{}. +// +// If v contains any structs, the result is first converted it to a interface{}, +// then JSON encoded/decoded it to convert to a struct, so `json` struct tags +// are respected. +// +// Deprecated: Use Unmarshal instead +func ConvertFrom(item *dynamodb.AttributeValue, v interface{}) (err error) { + defer func() { + if r := recover(); r != nil { + if e, ok := r.(runtime.Error); ok { + err = e + } else if s, ok := r.(string); ok { + err = fmt.Errorf(s) + } else { + err = r.(error) + } + item = nil + } + }() + + rv := reflect.ValueOf(v) + if rv.Kind() != reflect.Ptr || rv.IsNil() { + return awserr.New("SerializationError", + fmt.Sprintf("v must be a non-nil pointer to an interface{} or struct, got %s", + rv.Type()), + nil) + } + if rv.Elem().Kind() != reflect.Interface && rv.Elem().Kind() != reflect.Struct { + return awserr.New("SerializationError", + fmt.Sprintf("v must be a non-nil pointer to an interface{} or struct, got %s", + rv.Type()), + nil) + } + + res := convertFrom(item) + + if isTyped(reflect.TypeOf(v)) { + err = convertToTyped(res, v) + } else if res != nil { + rv.Elem().Set(reflect.ValueOf(res)) + } + + return err +} + +func isTyped(v reflect.Type) bool { + switch v.Kind() { + case reflect.Struct: + return true + case reflect.Array, reflect.Slice: + if isTyped(v.Elem()) { + return true + } + case reflect.Map: + if isTyped(v.Key()) { + return true + } + if isTyped(v.Elem()) { + return true + } + case reflect.Ptr: + return isTyped(v.Elem()) + } + return false +} + +func convertToUntyped(in, out interface{}) interface{} { + b, err := json.Marshal(in) + if err != nil { + panic(err) + } + + decoder := json.NewDecoder(bytes.NewReader(b)) + decoder.UseNumber() + err = decoder.Decode(&out) + if err != nil { + panic(err) + } + + return out +} + +func convertToTyped(in, out interface{}) error { + b, err := json.Marshal(in) + if err != nil { + return err + } + + decoder := json.NewDecoder(bytes.NewReader(b)) + return decoder.Decode(&out) +} + +func convertTo(in interface{}) *dynamodb.AttributeValue { + a := &dynamodb.AttributeValue{} + + if in == nil { + a.NULL = new(bool) + *a.NULL = true + return a + } + + if m, ok := in.(map[string]interface{}); ok { + a.M = make(map[string]*dynamodb.AttributeValue) + for k, v := range m { + a.M[k] = convertTo(v) + } + return a + } + + v := reflect.ValueOf(in) + switch v.Kind() { + case reflect.Bool: + a.BOOL = new(bool) + *a.BOOL = v.Bool() + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + a.N = new(string) + *a.N = strconv.FormatInt(v.Int(), 10) + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: + a.N = new(string) + *a.N = strconv.FormatUint(v.Uint(), 10) + case reflect.Float32, reflect.Float64: + a.N = new(string) + *a.N = strconv.FormatFloat(v.Float(), 'f', -1, 64) + case reflect.String: + if n, ok := in.(json.Number); ok { + a.N = new(string) + *a.N = n.String() + } else { + a.S = new(string) + *a.S = v.String() + } + case reflect.Slice: + switch v.Type() { + case reflect.TypeOf(([]byte)(nil)): + a.B = v.Bytes() + default: + a.L = make([]*dynamodb.AttributeValue, v.Len()) + for i := 0; i < v.Len(); i++ { + a.L[i] = convertTo(v.Index(i).Interface()) + } + } + default: + panic(fmt.Sprintf("the type %s is not supported", v.Type().String())) + } + + return a +} + +func convertFrom(a *dynamodb.AttributeValue) interface{} { + if a.S != nil { + return *a.S + } + + if a.N != nil { + // Number is tricky b/c we don't know which numeric type to use. Here we + // simply try the different types from most to least restrictive. + if n, err := strconv.ParseInt(*a.N, 10, 64); err == nil { + return int(n) + } + if n, err := strconv.ParseUint(*a.N, 10, 64); err == nil { + return uint(n) + } + n, err := strconv.ParseFloat(*a.N, 64) + if err != nil { + panic(err) + } + return n + } + + if a.BOOL != nil { + return *a.BOOL + } + + if a.NULL != nil { + return nil + } + + if a.M != nil { + m := make(map[string]interface{}) + for k, v := range a.M { + m[k] = convertFrom(v) + } + return m + } + + if a.L != nil { + l := make([]interface{}, len(a.L)) + for index, v := range a.L { + l[index] = convertFrom(v) + } + return l + } + + if a.B != nil { + return a.B + } + + panic(fmt.Sprintf("%#v is not a supported dynamodb.AttributeValue", a)) +} diff --git a/vendor/github.com/aws/aws-sdk-go/service/dynamodb/dynamodbattribute/decode.go b/vendor/github.com/aws/aws-sdk-go/service/dynamodb/dynamodbattribute/decode.go new file mode 100644 index 0000000000..497ff7dc71 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/service/dynamodb/dynamodbattribute/decode.go @@ -0,0 +1,628 @@ +package dynamodbattribute + +import ( + "fmt" + "reflect" + "strconv" + + "github.com/aws/aws-sdk-go/service/dynamodb" +) + +// An Unmarshaler is an interface to provide custom unmarshaling of +// AttributeValues. Use this to provide custom logic determining +// how AttributeValues should be unmarshaled. +// type ExampleUnmarshaler struct { +// Value int +// } +// +// type (u *exampleUnmarshaler) UnmarshalDynamoDBAttributeValue(av *dynamodb.AttributeValue) error { +// if av.N == nil { +// return nil +// } +// +// n, err := strconv.ParseInt(*av.N, 10, 0) +// if err != nil { +// return err +// } +// +// u.Value = n +// return nil +// } +type Unmarshaler interface { + UnmarshalDynamoDBAttributeValue(*dynamodb.AttributeValue) error +} + +// Unmarshal will unmarshal DynamoDB AttributeValues to Go value types. +// Both generic interface{} and concrete types are valid unmarshal +// destination types. +// +// Unmarshal will allocate maps, slices, and pointers as needed to +// unmarshal the AttributeValue into the provided type value. +// +// When unmarshaling AttributeValues into structs Unmarshal matches +// the field names of the struct to the AttributeValue Map keys. +// Initially it will look for exact field name matching, but will +// fall back to case insensitive if not exact match is found. +// +// With the exception of omitempty, omitemptyelem, binaryset, numberset +// and stringset all struct tags used by Marshal are also used by +// Unmarshal. +// +// When decoding AttributeValues to interfaces Unmarshal will use the +// following types. +// +// []byte, AV Binary (B) +// [][]byte, AV Binary Set (BS) +// bool, AV Boolean (BOOL) +// []interface{}, AV List (L) +// map[string]interface{}, AV Map (M) +// float64, AV Number (N) +// Number, AV Number (N) with UseNumber set +// []float64, AV Number Set (NS) +// []Number, AV Number Set (NS) with UseNumber set +// string, AV String (S) +// []string, AV String Set (SS) +// +// If the Decoder option, UseNumber is set numbers will be unmarshaled +// as Number values instead of float64. Use this to maintain the original +// string formating of the number as it was represented in the AttributeValue. +// In addition provides additional opportunities to parse the number +// string based on individual use cases. +// +// When unmarshaling any error that occurs will halt the unmarshal +// and return the error. +// +// The output value provided must be a non-nil pointer +func Unmarshal(av *dynamodb.AttributeValue, out interface{}) error { + return NewDecoder().Decode(av, out) +} + +// UnmarshalMap is an alias for Unmarshal which unmarshals from +// a map of AttributeValues. +// +// The output value provided must be a non-nil pointer +func UnmarshalMap(m map[string]*dynamodb.AttributeValue, out interface{}) error { + return NewDecoder().Decode(&dynamodb.AttributeValue{M: m}, out) +} + +// UnmarshalList is an alias for Unmarshal func which unmarshals +// a slice of AttributeValues. +// +// The output value provided must be a non-nil pointer +func UnmarshalList(l []*dynamodb.AttributeValue, out interface{}) error { + return NewDecoder().Decode(&dynamodb.AttributeValue{L: l}, out) +} + +// A Decoder provides unmarshaling AttributeValues to Go value types. +type Decoder struct { + MarshalOptions + + // Instructs the decoder to decode AttributeValue Numbers as + // Number type instead of float64 when the destination type + // is interface{}. Similar to encoding/json.Number + UseNumber bool +} + +// NewDecoder creates a new Decoder with default configuration. Use +// the `opts` functional options to override the default configuration. +func NewDecoder(opts ...func(*Decoder)) *Decoder { + d := &Decoder{ + MarshalOptions: MarshalOptions{ + SupportJSONTags: true, + }, + } + for _, o := range opts { + o(d) + } + + return d +} + +// Decode will unmarshal an AttributeValue into a Go value type. An error +// will be return if the decoder is unable to unmarshal the AttributeValue +// to the provide Go value type. +// +// The output value provided must be a non-nil pointer +func (d *Decoder) Decode(av *dynamodb.AttributeValue, out interface{}, opts ...func(*Decoder)) error { + v := reflect.ValueOf(out) + if v.Kind() != reflect.Ptr || v.IsNil() || !v.IsValid() { + return &InvalidUnmarshalError{Type: reflect.TypeOf(out)} + } + + return d.decode(av, v, tag{}) +} + +var stringInterfaceMapType = reflect.TypeOf(map[string]interface{}(nil)) +var byteSliceType = reflect.TypeOf([]byte(nil)) +var byteSliceSlicetype = reflect.TypeOf([][]byte(nil)) +var numberType = reflect.TypeOf(Number("")) + +func (d *Decoder) decode(av *dynamodb.AttributeValue, v reflect.Value, fieldTag tag) error { + var u Unmarshaler + if av == nil || av.NULL != nil { + u, v = indirect(v, true) + if u != nil { + return u.UnmarshalDynamoDBAttributeValue(av) + } + return d.decodeNull(v) + } + + u, v = indirect(v, false) + if u != nil { + return u.UnmarshalDynamoDBAttributeValue(av) + } + + switch { + case len(av.B) != 0: + return d.decodeBinary(av.B, v) + case av.BOOL != nil: + return d.decodeBool(av.BOOL, v) + case len(av.BS) != 0: + return d.decodeBinarySet(av.BS, v) + case len(av.L) != 0: + return d.decodeList(av.L, v) + case len(av.M) != 0: + return d.decodeMap(av.M, v) + case av.N != nil: + return d.decodeNumber(av.N, v) + case len(av.NS) != 0: + return d.decodeNumberSet(av.NS, v) + case av.S != nil: + return d.decodeString(av.S, v, fieldTag) + case len(av.SS) != 0: + return d.decodeStringSet(av.SS, v) + } + + return nil +} + +func (d *Decoder) decodeBinary(b []byte, v reflect.Value) error { + if v.Kind() == reflect.Interface { + buf := make([]byte, len(b)) + copy(buf, b) + v.Set(reflect.ValueOf(buf)) + return nil + } + + switch v.Interface().(type) { + case []byte: + if v.IsNil() || v.Cap() < len(b) { + v.Set(reflect.MakeSlice(byteSliceType, len(b), len(b))) + } else if v.Len() != len(b) { + v.SetLen(len(b)) + } + copy(v.Interface().([]byte), b) + default: + if v.Kind() == reflect.Array && v.Type().Elem().Kind() == reflect.Uint8 { + reflect.Copy(v, reflect.ValueOf(b)) + break + } + return &UnmarshalTypeError{Value: "binary", Type: v.Type()} + } + + return nil +} + +func (d *Decoder) decodeBool(b *bool, v reflect.Value) error { + switch v.Kind() { + case reflect.Bool, reflect.Interface: + v.Set(reflect.ValueOf(*b)) + default: + return &UnmarshalTypeError{Value: "bool", Type: v.Type()} + } + + return nil +} + +func (d *Decoder) decodeBinarySet(bs [][]byte, v reflect.Value) error { + switch v.Kind() { + case reflect.Slice: + // Make room for the slice elements if needed + if v.IsNil() || v.Cap() < len(bs) { + // What about if ignoring nil/empty values? + v.Set(reflect.MakeSlice(v.Type(), 0, len(bs))) + } + case reflect.Array: + // Limited to capacity of existing array. + case reflect.Interface: + set := make([][]byte, len(bs)) + for i, b := range bs { + if err := d.decodeBinary(b, reflect.ValueOf(&set[i]).Elem()); err != nil { + return err + } + } + v.Set(reflect.ValueOf(set)) + return nil + default: + return &UnmarshalTypeError{Value: "binary set", Type: v.Type()} + } + + for i := 0; i < v.Cap() && i < len(bs); i++ { + v.SetLen(i + 1) + u, elem := indirect(v.Index(i), false) + if u != nil { + return u.UnmarshalDynamoDBAttributeValue(&dynamodb.AttributeValue{BS: bs}) + } + if err := d.decodeBinary(bs[i], elem); err != nil { + return err + } + } + + return nil +} + +func (d *Decoder) decodeNumber(n *string, v reflect.Value) error { + switch v.Kind() { + case reflect.Interface: + i, err := d.decodeNumberToInterface(n) + if err != nil { + return err + } + v.Set(reflect.ValueOf(i)) + return nil + case reflect.String: + if v.Type() == numberType { // Support Number value type + v.Set(reflect.ValueOf(Number(*n))) + return nil + } + v.Set(reflect.ValueOf(*n)) + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + i, err := strconv.ParseInt(*n, 10, 64) + if err != nil { + return err + } + if v.OverflowInt(i) { + return &UnmarshalTypeError{ + Value: fmt.Sprintf("number overflow, %s", *n), + Type: v.Type(), + } + } + v.SetInt(i) + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: + i, err := strconv.ParseUint(*n, 10, 64) + if err != nil { + return err + } + if v.OverflowUint(i) { + return &UnmarshalTypeError{ + Value: fmt.Sprintf("number overflow, %s", *n), + Type: v.Type(), + } + } + v.SetUint(i) + case reflect.Float32, reflect.Float64: + i, err := strconv.ParseFloat(*n, 64) + if err != nil { + return err + } + if v.OverflowFloat(i) { + return &UnmarshalTypeError{ + Value: fmt.Sprintf("number overflow, %s", *n), + Type: v.Type(), + } + } + v.SetFloat(i) + default: + return &UnmarshalTypeError{Value: "number", Type: v.Type()} + } + + return nil +} + +func (d *Decoder) decodeNumberToInterface(n *string) (interface{}, error) { + if d.UseNumber { + return Number(*n), nil + } + + // Default to float64 for all numbers + return strconv.ParseFloat(*n, 64) +} + +func (d *Decoder) decodeNumberSet(ns []*string, v reflect.Value) error { + switch v.Kind() { + case reflect.Slice: + // Make room for the slice elements if needed + if v.IsNil() || v.Cap() < len(ns) { + // What about if ignoring nil/empty values? + v.Set(reflect.MakeSlice(v.Type(), 0, len(ns))) + } + case reflect.Array: + // Limited to capacity of existing array. + case reflect.Interface: + if d.UseNumber { + set := make([]Number, len(ns)) + for i, n := range ns { + if err := d.decodeNumber(n, reflect.ValueOf(&set[i]).Elem()); err != nil { + return err + } + } + v.Set(reflect.ValueOf(set)) + } else { + set := make([]float64, len(ns)) + for i, n := range ns { + if err := d.decodeNumber(n, reflect.ValueOf(&set[i]).Elem()); err != nil { + return err + } + } + v.Set(reflect.ValueOf(set)) + } + return nil + default: + return &UnmarshalTypeError{Value: "number set", Type: v.Type()} + } + + for i := 0; i < v.Cap() && i < len(ns); i++ { + v.SetLen(i + 1) + u, elem := indirect(v.Index(i), false) + if u != nil { + return u.UnmarshalDynamoDBAttributeValue(&dynamodb.AttributeValue{NS: ns}) + } + if err := d.decodeNumber(ns[i], elem); err != nil { + return err + } + } + + return nil +} + +func (d *Decoder) decodeList(avList []*dynamodb.AttributeValue, v reflect.Value) error { + switch v.Kind() { + case reflect.Slice: + // Make room for the slice elements if needed + if v.IsNil() || v.Cap() < len(avList) { + // What about if ignoring nil/empty values? + v.Set(reflect.MakeSlice(v.Type(), 0, len(avList))) + } + case reflect.Array: + // Limited to capacity of existing array. + case reflect.Interface: + s := make([]interface{}, len(avList)) + for i, av := range avList { + if err := d.decode(av, reflect.ValueOf(&s[i]).Elem(), tag{}); err != nil { + return err + } + } + v.Set(reflect.ValueOf(s)) + return nil + default: + return &UnmarshalTypeError{Value: "list", Type: v.Type()} + } + + // If v is not a slice, array + for i := 0; i < v.Cap() && i < len(avList); i++ { + v.SetLen(i + 1) + if err := d.decode(avList[i], v.Index(i), tag{}); err != nil { + return err + } + } + + return nil +} + +func (d *Decoder) decodeMap(avMap map[string]*dynamodb.AttributeValue, v reflect.Value) error { + switch v.Kind() { + case reflect.Map: + t := v.Type() + if t.Key().Kind() != reflect.String { + return &UnmarshalTypeError{Value: "map string key", Type: t.Key()} + } + if v.IsNil() { + v.Set(reflect.MakeMap(t)) + } + case reflect.Struct: + case reflect.Interface: + v.Set(reflect.MakeMap(stringInterfaceMapType)) + v = v.Elem() + default: + return &UnmarshalTypeError{Value: "map", Type: v.Type()} + } + + if v.Kind() == reflect.Map { + for k, av := range avMap { + key := reflect.ValueOf(k) + elem := reflect.New(v.Type().Elem()).Elem() + if err := d.decode(av, elem, tag{}); err != nil { + return err + } + v.SetMapIndex(key, elem) + } + } else if v.Kind() == reflect.Struct { + fields := unionStructFields(v.Type(), d.MarshalOptions) + for k, av := range avMap { + if f, ok := fieldByName(fields, k); ok { + fv := v.FieldByIndex(f.Index) + if err := d.decode(av, fv, f.tag); err != nil { + return err + } + } + } + } + + return nil +} + +func (d *Decoder) decodeNull(v reflect.Value) error { + if v.IsValid() && v.CanSet() { + v.Set(reflect.Zero(v.Type())) + } + + return nil +} + +func (d *Decoder) decodeString(s *string, v reflect.Value, fieldTag tag) error { + if fieldTag.AsString { + return d.decodeNumber(s, v) + } + + switch v.Kind() { + case reflect.String, reflect.Interface: + v.Set(reflect.ValueOf(*s)) + default: + return &UnmarshalTypeError{Value: "string", Type: v.Type()} + } + + return nil +} + +func (d *Decoder) decodeStringSet(ss []*string, v reflect.Value) error { + switch v.Kind() { + case reflect.Slice: + // Make room for the slice elements if needed + if v.IsNil() || v.Cap() < len(ss) { + v.Set(reflect.MakeSlice(v.Type(), 0, len(ss))) + } + case reflect.Array: + // Limited to capacity of existing array. + case reflect.Interface: + set := make([]string, len(ss)) + for i, s := range ss { + if err := d.decodeString(s, reflect.ValueOf(&set[i]).Elem(), tag{}); err != nil { + return err + } + } + v.Set(reflect.ValueOf(set)) + return nil + default: + return &UnmarshalTypeError{Value: "string set", Type: v.Type()} + } + + for i := 0; i < v.Cap() && i < len(ss); i++ { + v.SetLen(i + 1) + u, elem := indirect(v.Index(i), false) + if u != nil { + return u.UnmarshalDynamoDBAttributeValue(&dynamodb.AttributeValue{SS: ss}) + } + if err := d.decodeString(ss[i], elem, tag{}); err != nil { + return err + } + } + + return nil +} + +// indirect will walk a value's interface or pointer value types. Returning +// the final value or the value a unmarshaler is defined on. +// +// Based on the enoding/json type reflect value type indirection in Go Stdlib +// https://golang.org/src/encoding/json/decode.go indirect func. +func indirect(v reflect.Value, decodingNull bool) (Unmarshaler, reflect.Value) { + if v.Kind() != reflect.Ptr && v.Type().Name() != "" && v.CanAddr() { + v = v.Addr() + } + for { + if v.Kind() == reflect.Interface && !v.IsNil() { + e := v.Elem() + if e.Kind() == reflect.Ptr && !e.IsNil() && (!decodingNull || e.Elem().Kind() == reflect.Ptr) { + v = e + continue + } + } + if v.Kind() != reflect.Ptr { + break + } + if v.Elem().Kind() != reflect.Ptr && decodingNull && v.CanSet() { + break + } + if v.IsNil() { + v.Set(reflect.New(v.Type().Elem())) + } + if v.Type().NumMethod() > 0 { + if u, ok := v.Interface().(Unmarshaler); ok { + return u, reflect.Value{} + } + } + v = v.Elem() + } + + return nil, v +} + +// A Number represents a Attributevalue number literal. +type Number string + +// Float64 attempts to cast the number ot a float64, returning +// the result of the case or error if the case failed. +func (n Number) Float64() (float64, error) { + return strconv.ParseFloat(string(n), 64) +} + +// Int64 attempts to cast the number ot a int64, returning +// the result of the case or error if the case failed. +func (n Number) Int64() (int64, error) { + return strconv.ParseInt(string(n), 10, 64) +} + +// Uint64 attempts to cast the number ot a uint64, returning +// the result of the case or error if the case failed. +func (n Number) Uint64() (uint64, error) { + return strconv.ParseUint(string(n), 10, 64) +} + +// String returns the raw number represented as a string +func (n Number) String() string { + return string(n) +} + +type emptyOrigError struct{} + +func (e emptyOrigError) OrigErr() error { + return nil +} + +// An UnmarshalTypeError is an error type representing a error +// unmarshaling the AttributeValue's element to a Go value type. +// Includes details about the AttributeValue type and Go value type. +type UnmarshalTypeError struct { + emptyOrigError + Value string + Type reflect.Type +} + +// Error returns the string representation of the error. +// satisfying the error interface +func (e *UnmarshalTypeError) Error() string { + return fmt.Sprintf("%s: %s", e.Code(), e.Message()) +} + +// Code returns the code of the error, satisfying the awserr.Error +// interface. +func (e *UnmarshalTypeError) Code() string { + return "UnmarshalTypeError" +} + +// Message returns the detailed message of the error, satisfying +// the awserr.Error interface. +func (e *UnmarshalTypeError) Message() string { + return "cannot unmarshal " + e.Value + " into Go value of type " + e.Type.String() +} + +// An InvalidUnmarshalError is an error type representing an invalid type +// encountered while unmarshaling a AttributeValue to a Go value type. +type InvalidUnmarshalError struct { + emptyOrigError + Type reflect.Type +} + +// Error returns the string representation of the error. +// satisfying the error interface +func (e *InvalidUnmarshalError) Error() string { + return fmt.Sprintf("%s: %s", e.Code(), e.Message()) +} + +// Code returns the code of the error, satisfying the awserr.Error +// interface. +func (e *InvalidUnmarshalError) Code() string { + return "InvalidUnmarshalError" +} + +// Message returns the detailed message of the error, satisfying +// the awserr.Error interface. +func (e *InvalidUnmarshalError) Message() string { + if e.Type == nil { + return "cannot unmarshal to nil value" + } + if e.Type.Kind() != reflect.Ptr { + return "cannot unmasrhal to non-pointer value, got " + e.Type.String() + } + return "cannot unmarshal to nil value, " + e.Type.String() +} diff --git a/vendor/github.com/aws/aws-sdk-go/service/dynamodb/dynamodbattribute/doc.go b/vendor/github.com/aws/aws-sdk-go/service/dynamodb/dynamodbattribute/doc.go new file mode 100644 index 0000000000..3d46f736b1 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/service/dynamodb/dynamodbattribute/doc.go @@ -0,0 +1,60 @@ +// Package dynamodbattribute provides marshaling utilities for marshaling to +// dynamodb.AttributeValue types and unmarshaling to Go value types. These +// utilities allow you to marshal slices, maps, structs, and scalar values +// to and from dynamodb.AttributeValue. These are useful when marshaling +// Go value tyes to dynamodb.AttributeValue for DynamoDB requests, or +// unmarshaling the dynamodb.AttributeValue back into a Go value type. +// +// Marshal Go value types to dynamodb.AttributeValue: See (ExampleMarshal) +// +// type Record struct { +// MyField string +// Letters []string +// A2Num map[string]int +// } +// +// ... +// +// r := Record{ +// MyField: "dynamodbattribute.Marshal example", +// Letters: []string{"a", "b", "c", "d"}, +// A2Num: map[string]int{"a": 1, "b": 2, "c": 3}, +// } +// av, err := dynamodbattribute.Marshal(r) +// fmt.Println(av, err) +// +// Unmarshal dynamodb.AttributeValue to Go value type: See (ExampleUnmarshal) +// +// r2 := Record{} +// err = dynamodbattribute.Unmarshal(av, &r2) +// fmt.Println(err, reflect.DeepEqual(r, r2)) +// +// Marshal Go value type for DynamoDB.PutItem: +// +// sess := session.New() +// svc := dynamodb.New(sess) +// item, err := dynamodbattribute.MarshalMap(r) +// if err != nil { +// fmt.Println("Failed to convert", err) +// return +// } +// result, err := svc.PutItem(&dynamodb.PutItemInput{ +// Item: item, +// TableName: aws.String("exampleTable"), +// }) +// +// +// +// The ConvertTo, ConvertToList, ConvertToMap, ConvertFrom, ConvertFromMap +// and ConvertFromList methods have been deprecated. The Marshal and Unmarshal +// functions should be used instead. The ConvertTo|From marshallers do not +// support BinarySet, NumberSet, nor StringSets, and will incorrect marshal +// binary data fields in structs as base64 strings. +// +// The Marshal and Unmarshal functions correct this behavior, and removes +// the reliance on encoding.json. `json` struct tags are still supported. In +// addition support for a new struct tag `dynamodbav` was added. Support for +// the json.Marshaler and json.Unmarshaler interfaces have been removed and +// replaced with have been replaced with dynamodbattribute.Marshaler and +// dynamodbattribute.Unmarshaler interfaces. +package dynamodbattribute diff --git a/vendor/github.com/aws/aws-sdk-go/service/dynamodb/dynamodbattribute/encode.go b/vendor/github.com/aws/aws-sdk-go/service/dynamodb/dynamodbattribute/encode.go new file mode 100644 index 0000000000..fe11a37c25 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/service/dynamodb/dynamodbattribute/encode.go @@ -0,0 +1,560 @@ +package dynamodbattribute + +import ( + "fmt" + "reflect" + "strconv" + + "github.com/aws/aws-sdk-go/service/dynamodb" +) + +// A Marshaler is an interface to provide custom marshalling of Go value types +// to AttributeValues. Use this to provide custom logic determining how a +// Go Value type should be marshaled. +// +// type ExampleMarshaler struct { +// Value int +// } +// type (m *ExampleMarshaler) MarshalDynamoDBAttributeValue(av *dynamodb.AttributeValue) error { +// n := fmt.Sprintf("%v", m.Value) +// av.N = &n +// +// return nil +// } +// +type Marshaler interface { + MarshalDynamoDBAttributeValue(*dynamodb.AttributeValue) error +} + +// Marshal will serialize the passed in Go value type into a DynamoDB AttributeValue +// type. This value can be used in DynamoDB API operations to simplify marshaling +// your Go value types into AttributeValues. +// +// Marshal will recursively transverse the passed in value marshaling its +// contents into a AttributeValue. Marshal supports basic scalars +// (int,uint,float,bool,string), maps, slices, and structs. Anonymous +// nested types are flattened based on Go anonymous type visibility. +// +// Marshaling slices to AttributeValue will default to a List for all +// types except for []byte and [][]byte. []byte will be marshaled as +// Binary data (B), and [][]byte will be marshaled as binary data set +// (BS). +// +// `dynamodbav` struct tag can be used to control how the value will be +// marshaled into a AttributeValue. +// +// // Field is ignored +// Field int `dynamodbav:"-"` +// +// // Field AttributeValue map key "myName" +// Field int `dynamodbav:"myName"` +// +// // Field AttributeValue map key "myName", and +// // Field is omitted if it is empty +// Field int `dynamodbav:"myName,omitempty"` +// +// // Field AttributeValue map key "Field", and +// // Field is omitted if it is empty +// Field int `dynamodbav:",omitempty"` +// +// // Field's elems will be omitted if empty +// // only valid for slices, and maps. +// Field []string `dynamodbav:",omitemptyelem"` +// +// // Field will be marshaled as a AttributeValue string +// // only value for number types, (int,uint,float) +// Field int `dynamodbav:",string"` +// +// // Field will be marshaled as a binary set +// Field [][]byte `dynamodbav:",binaryset"` +// +// // Field will be marshaled as a number set +// Field []int `dynamodbav:",numberset"` +// +// // Field will be marshaled as a string set +// Field []string `dynamodbav:",stringset"` +// +// The omitempty tag is only used during Marshaling and is ignored for +// Unmarshal. Any zero value or a value when marshaled results in a +// AttributeValue NULL will be added to AttributeValue Maps during struct +// marshal. The omitemptyelem tag works the same as omitempty except it +// applies to maps and slices instead of struct fields, and will not be +// included in the marshaled AttributeValue Map, List, or Set. +// +// For convenience and backwards compatibility with ConvertTo functions +// json struct tags are supported by the Marshal and Unmarshal. If +// both json and dynamodbav struct tags are provided the json tag will +// be ignored in favor of dynamodbav. +// +// All struct fields and with anonymous fields, are marshaled unless the +// any of the following conditions are meet. +// +// - the field is not exported +// - json or dynamodbav field tag is "-" +// - json or dynamodbav field tag specifies "omitempty", and is empty. +// +// Pointer and interfaces values encode as the value pointed to or contained +// in the interface. A nil value encodes as the AttributeValue NULL value. +// +// Channel, complex, and function values are not encoded and will be skipped +// when walking the value to be marshaled. +// +// When marshaling any error that occurs will halt the marshal and return +// the error. +// +// Marshal cannot represent cyclic data structures and will not handle them. +// Passing cyclic structures to Marshal will result in an infinite recursion. +func Marshal(in interface{}) (*dynamodb.AttributeValue, error) { + return NewEncoder().Encode(in) +} + +// MarshalMap is an alias for Marshal func which marshals Go value +// type to a map of AttributeValues. +func MarshalMap(in interface{}) (map[string]*dynamodb.AttributeValue, error) { + av, err := NewEncoder().Encode(in) + if err != nil || av == nil || av.M == nil { + return map[string]*dynamodb.AttributeValue{}, err + } + + return av.M, nil +} + +// MarshalList is an alias for Marshal func which marshals Go value +// type to a slice of AttributeValues. +func MarshalList(in interface{}) ([]*dynamodb.AttributeValue, error) { + av, err := NewEncoder().Encode(in) + if err != nil || av == nil || av.L == nil { + return []*dynamodb.AttributeValue{}, err + } + + return av.L, nil +} + +// A MarshalOptions is a collection of options shared between marshaling +// and unmarshaling +type MarshalOptions struct { + // States that the encoding/json struct tags should be supported. + // if a `dynamodbav` struct tag is also provided the encoding/json + // tag will be ignored. + // + // Enabled by default. + SupportJSONTags bool +} + +// An Encoder provides marshaling Go value types to AttributeValues. +type Encoder struct { + MarshalOptions + + // Empty strings, "", will be marked as NULL AttributeValue types. + // Empty strings are not valid values for DynamoDB. Will not apply + // to lists, sets, or maps. Use the struct tag `omitemptyelem` + // to skip empty (zero) values in lists, sets and maps. + // + // Enabled by default. + NullEmptyString bool +} + +// NewEncoder creates a new Encoder with default configuration. Use +// the `opts` functional options to override the default configuration. +func NewEncoder(opts ...func(*Encoder)) *Encoder { + e := &Encoder{ + MarshalOptions: MarshalOptions{ + SupportJSONTags: true, + }, + NullEmptyString: true, + } + for _, o := range opts { + o(e) + } + + return e +} + +// Encode will marshal a Go value type to an AttributeValue. Returning +// the AttributeValue constructed or error. +func (e *Encoder) Encode(in interface{}) (*dynamodb.AttributeValue, error) { + av := &dynamodb.AttributeValue{} + if err := e.encode(av, reflect.ValueOf(in), tag{}); err != nil { + return nil, err + } + + return av, nil +} + +func (e *Encoder) encode(av *dynamodb.AttributeValue, v reflect.Value, fieldTag tag) error { + // Handle both pointers and interface conversion into types + v = valueElem(v) + + if v.Kind() != reflect.Invalid { + if used, err := tryMarshaler(av, v); used { + return err + } + } + + if fieldTag.OmitEmpty && emptyValue(v) { + encodeNull(av) + return nil + } + + switch v.Kind() { + case reflect.Invalid: + encodeNull(av) + case reflect.Struct: + return e.encodeStruct(av, v) + case reflect.Map: + return e.encodeMap(av, v, fieldTag) + case reflect.Slice, reflect.Array: + return e.encodeSlice(av, v, fieldTag) + case reflect.Chan, reflect.Func, reflect.UnsafePointer: + // do nothing for unsupported types + default: + return e.encodeScalar(av, v, fieldTag) + } + + return nil +} + +func (e *Encoder) encodeStruct(av *dynamodb.AttributeValue, v reflect.Value) error { + av.M = map[string]*dynamodb.AttributeValue{} + fields := unionStructFields(v.Type(), e.MarshalOptions) + for _, f := range fields { + if f.Name == "" { + return &InvalidMarshalError{msg: "map key cannot be empty"} + } + + fv := v.FieldByIndex(f.Index) + elem := &dynamodb.AttributeValue{} + err := e.encode(elem, fv, f.tag) + skip, err := keepOrOmitEmpty(f.OmitEmpty, elem, err) + if err != nil { + return err + } else if skip { + continue + } + + av.M[f.Name] = elem + } + if len(av.M) == 0 { + encodeNull(av) + } + + return nil +} + +func (e *Encoder) encodeMap(av *dynamodb.AttributeValue, v reflect.Value, fieldTag tag) error { + av.M = map[string]*dynamodb.AttributeValue{} + for _, key := range v.MapKeys() { + keyName := fmt.Sprint(key.Interface()) + if keyName == "" { + return &InvalidMarshalError{msg: "map key cannot be empty"} + } + + elemVal := v.MapIndex(key) + elem := &dynamodb.AttributeValue{} + err := e.encode(elem, elemVal, tag{}) + skip, err := keepOrOmitEmpty(fieldTag.OmitEmptyElem, elem, err) + if err != nil { + return err + } else if skip { + continue + } + + av.M[keyName] = elem + } + if len(av.M) == 0 { + encodeNull(av) + } + + return nil +} + +func (e *Encoder) encodeSlice(av *dynamodb.AttributeValue, v reflect.Value, fieldTag tag) error { + switch typed := v.Interface().(type) { + case []byte: + if len(typed) == 0 { + encodeNull(av) + return nil + } + av.B = append([]byte{}, typed...) + default: + var elemFn func(dynamodb.AttributeValue) error + + if fieldTag.AsBinSet || v.Type() == byteSliceSlicetype { // Binary Set + av.BS = make([][]byte, 0, v.Len()) + elemFn = func(elem dynamodb.AttributeValue) error { + if elem.B == nil { + return &InvalidMarshalError{msg: "binary set must only contain non-nil byte slices"} + } + av.BS = append(av.BS, elem.B) + return nil + } + } else if fieldTag.AsNumSet { // Number Set + av.NS = make([]*string, 0, v.Len()) + elemFn = func(elem dynamodb.AttributeValue) error { + if elem.N == nil { + return &InvalidMarshalError{msg: "number set must only contain non-nil string numbers"} + } + av.NS = append(av.NS, elem.N) + return nil + } + } else if fieldTag.AsStrSet { // String Set + av.SS = make([]*string, 0, v.Len()) + elemFn = func(elem dynamodb.AttributeValue) error { + if elem.S == nil { + return &InvalidMarshalError{msg: "string set must only contain non-nil strings"} + } + av.SS = append(av.SS, elem.S) + return nil + } + } else { // List + av.L = make([]*dynamodb.AttributeValue, 0, v.Len()) + elemFn = func(elem dynamodb.AttributeValue) error { + av.L = append(av.L, &elem) + return nil + } + } + + if n, err := e.encodeList(v, fieldTag, elemFn); err != nil { + return err + } else if n == 0 { + encodeNull(av) + } + } + + return nil +} + +func (e *Encoder) encodeList(v reflect.Value, fieldTag tag, elemFn func(dynamodb.AttributeValue) error) (int, error) { + count := 0 + for i := 0; i < v.Len(); i++ { + elem := dynamodb.AttributeValue{} + err := e.encode(&elem, v.Index(i), tag{OmitEmpty: fieldTag.OmitEmptyElem}) + skip, err := keepOrOmitEmpty(fieldTag.OmitEmptyElem, &elem, err) + if err != nil { + return 0, err + } else if skip { + continue + } + + if err := elemFn(elem); err != nil { + return 0, err + } + count++ + } + + return count, nil +} + +func (e *Encoder) encodeScalar(av *dynamodb.AttributeValue, v reflect.Value, fieldTag tag) error { + switch typed := v.Interface().(type) { + case bool: + av.BOOL = new(bool) + *av.BOOL = typed + case string: + if err := e.encodeString(av, v); err != nil { + return err + } + case Number: + s := string(typed) + if fieldTag.AsString { + av.S = &s + } else { + av.N = &s + } + default: + // Fallback to encoding numbers, will return invalid type if not supported + if err := e.encodeNumber(av, v); err != nil { + return err + } + if fieldTag.AsString && av.NULL == nil && av.N != nil { + av.S = av.N + av.N = nil + } + } + + return nil +} + +func (e *Encoder) encodeNumber(av *dynamodb.AttributeValue, v reflect.Value) error { + if used, err := tryMarshaler(av, v); used { + return err + } + + var out string + switch typed := v.Interface().(type) { + case int: + out = encodeInt(int64(typed)) + case int8: + out = encodeInt(int64(typed)) + case int16: + out = encodeInt(int64(typed)) + case int32: + out = encodeInt(int64(typed)) + case int64: + out = encodeInt(typed) + case uint: + out = encodeUint(uint64(typed)) + case uint8: + out = encodeUint(uint64(typed)) + case uint16: + out = encodeUint(uint64(typed)) + case uint32: + out = encodeUint(uint64(typed)) + case uint64: + out = encodeUint(typed) + case float32: + out = encodeFloat(float64(typed)) + case float64: + out = encodeFloat(typed) + default: + return &unsupportedMarshalTypeError{Type: v.Type()} + } + + av.N = &out + + return nil +} + +func (e *Encoder) encodeString(av *dynamodb.AttributeValue, v reflect.Value) error { + if used, err := tryMarshaler(av, v); used { + return err + } + + switch typed := v.Interface().(type) { + case string: + if len(typed) == 0 && e.NullEmptyString { + encodeNull(av) + } else { + av.S = &typed + } + default: + return &unsupportedMarshalTypeError{Type: v.Type()} + } + + return nil +} + +func encodeInt(i int64) string { + return strconv.FormatInt(i, 10) +} +func encodeUint(u uint64) string { + return strconv.FormatUint(u, 10) +} +func encodeFloat(f float64) string { + return strconv.FormatFloat(f, 'f', -1, 64) +} +func encodeNull(av *dynamodb.AttributeValue) { + t := true + *av = dynamodb.AttributeValue{NULL: &t} +} + +func valueElem(v reflect.Value) reflect.Value { + switch v.Kind() { + case reflect.Interface, reflect.Ptr: + for v.Kind() == reflect.Interface || v.Kind() == reflect.Ptr { + v = v.Elem() + } + } + + return v +} + +func emptyValue(v reflect.Value) bool { + switch v.Kind() { + case reflect.Array, reflect.Map, reflect.Slice, reflect.String: + return v.Len() == 0 + case reflect.Bool: + return !v.Bool() + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + return v.Int() == 0 + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: + return v.Uint() == 0 + case reflect.Float32, reflect.Float64: + return v.Float() == 0 + case reflect.Interface, reflect.Ptr: + return v.IsNil() + } + return false +} + +func tryMarshaler(av *dynamodb.AttributeValue, v reflect.Value) (bool, error) { + if v.Kind() != reflect.Ptr && v.Type().Name() != "" && v.CanAddr() { + v = v.Addr() + } + + if v.Type().NumMethod() == 0 { + return false, nil + } + + if m, ok := v.Interface().(Marshaler); ok { + return true, m.MarshalDynamoDBAttributeValue(av) + } + + return false, nil +} + +func keepOrOmitEmpty(omitEmpty bool, av *dynamodb.AttributeValue, err error) (bool, error) { + if err != nil { + if _, ok := err.(*unsupportedMarshalTypeError); ok { + return true, nil + } + return false, err + } + + if av.NULL != nil && omitEmpty { + return true, nil + } + + return false, nil +} + +// An InvalidMarshalError is an error type representing an error +// occurring when marshaling a Go value type to an AttributeValue. +type InvalidMarshalError struct { + emptyOrigError + msg string +} + +// Error returns the string representation of the error. +// satisfying the error interface +func (e *InvalidMarshalError) Error() string { + return fmt.Sprintf("%s: %s", e.Code(), e.Message()) +} + +// Code returns the code of the error, satisfying the awserr.Error +// interface. +func (e *InvalidMarshalError) Code() string { + return "InvalidMarshalError" +} + +// Message returns the detailed message of the error, satisfying +// the awserr.Error interface. +func (e *InvalidMarshalError) Message() string { + return e.msg +} + +// An unsupportedMarshalTypeError represents a Go value type +// which cannot be marshaled into an AttributeValue and should +// be skipped by the marshaler. +type unsupportedMarshalTypeError struct { + emptyOrigError + Type reflect.Type +} + +// Error returns the string representation of the error. +// satisfying the error interface +func (e *unsupportedMarshalTypeError) Error() string { + return fmt.Sprintf("%s: %s", e.Code(), e.Message()) +} + +// Code returns the code of the error, satisfying the awserr.Error +// interface. +func (e *unsupportedMarshalTypeError) Code() string { + return "unsupportedMarshalTypeError" +} + +// Message returns the detailed message of the error, satisfying +// the awserr.Error interface. +func (e *unsupportedMarshalTypeError) Message() string { + return "Go value type " + e.Type.String() + " is not supported" +} diff --git a/vendor/github.com/aws/aws-sdk-go/service/dynamodb/dynamodbattribute/field.go b/vendor/github.com/aws/aws-sdk-go/service/dynamodb/dynamodbattribute/field.go new file mode 100644 index 0000000000..1fe0d35002 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/service/dynamodb/dynamodbattribute/field.go @@ -0,0 +1,269 @@ +package dynamodbattribute + +import ( + "reflect" + "sort" + "strings" +) + +type field struct { + tag + + Name string + NameFromTag bool + + Index []int + Type reflect.Type +} + +func fieldByName(fields []field, name string) (field, bool) { + foldExists := false + foldField := field{} + + for _, f := range fields { + if f.Name == name { + return f, true + } + if !foldExists && strings.EqualFold(f.Name, name) { + foldField = f + foldExists = true + } + } + + return foldField, foldExists +} + +func buildField(pIdx []int, i int, sf reflect.StructField, fieldTag tag) field { + f := field{ + Name: sf.Name, + Type: sf.Type, + tag: fieldTag, + } + if len(fieldTag.Name) != 0 { + f.NameFromTag = true + f.Name = fieldTag.Name + } + + f.Index = make([]int, len(pIdx)+1) + copy(f.Index, pIdx) + f.Index[len(pIdx)] = i + + return f +} + +func unionStructFields(t reflect.Type, opts MarshalOptions) []field { + fields := enumFields(t, opts) + + sort.Sort(fieldsByName(fields)) + + fields = visibleFields(fields) + + return fields +} + +// enumFields will recursively iterate through a structure and its nested +// anonymous fields. +// +// Based on the enoding/json struct field enumeration of the Go Stdlib +// https://golang.org/src/encoding/json/encode.go typeField func. +func enumFields(t reflect.Type, opts MarshalOptions) []field { + // Fields to explore + current := []field{} + next := []field{{Type: t}} + + // count of queued names + count := map[reflect.Type]int{} + nextCount := map[reflect.Type]int{} + + visited := map[reflect.Type]struct{}{} + fields := []field{} + + for len(next) > 0 { + current, next = next, current[:0] + count, nextCount = nextCount, map[reflect.Type]int{} + + for _, f := range current { + if _, ok := visited[f.Type]; ok { + continue + } + visited[f.Type] = struct{}{} + + for i := 0; i < f.Type.NumField(); i++ { + sf := f.Type.Field(i) + if sf.PkgPath != "" && !sf.Anonymous { + // Ignore unexported and non-anonymous fields + // unexported but anonymous field may still be used if + // the type has exported nested fields + continue + } + + fieldTag := tag{} + fieldTag.parseAVTag(sf.Tag) + if opts.SupportJSONTags && fieldTag == (tag{}) { + fieldTag.parseJSONTag(sf.Tag) + } + + if fieldTag.Ignore { + continue + } + + ft := sf.Type + if ft.Name() == "" && ft.Kind() == reflect.Ptr { + ft = ft.Elem() + } + + structField := buildField(f.Index, i, sf, fieldTag) + structField.Type = ft + + if !sf.Anonymous || ft.Kind() != reflect.Struct { + fields = append(fields, structField) + if count[f.Type] > 1 { + // If there were multiple instances, add a second, + // so that the annihilation code will see a duplicate. + // It only cares about the distinction between 1 or 2, + // so don't bother generating any more copies. + fields = append(fields, structField) + } + continue + } + + // Record new anon struct to explore next round + nextCount[ft]++ + if nextCount[ft] == 1 { + next = append(next, structField) + } + } + } + } + + return fields +} + +// visibleFields will return a slice of fields which are visible based on +// Go's standard visiblity rules with the exception of ties being broken +// by depth and struct tag naming. +// +// Based on the enoding/json field filtering of the Go Stdlib +// https://golang.org/src/encoding/json/encode.go typeField func. +func visibleFields(fields []field) []field { + // Delete all fields that are hidden by the Go rules for embedded fields, + // except that fields with JSON tags are promoted. + + // The fields are sorted in primary order of name, secondary order + // of field index length. Loop over names; for each name, delete + // hidden fields by choosing the one dominant field that survives. + out := fields[:0] + for advance, i := 0, 0; i < len(fields); i += advance { + // One iteration per name. + // Find the sequence of fields with the name of this first field. + fi := fields[i] + name := fi.Name + for advance = 1; i+advance < len(fields); advance++ { + fj := fields[i+advance] + if fj.Name != name { + break + } + } + if advance == 1 { // Only one field with this name + out = append(out, fi) + continue + } + dominant, ok := dominantField(fields[i : i+advance]) + if ok { + out = append(out, dominant) + } + } + + fields = out + sort.Sort(fieldsByIndex(fields)) + + return fields +} + +// dominantField looks through the fields, all of which are known to +// have the same name, to find the single field that dominates the +// others using Go's embedding rules, modified by the presence of +// JSON tags. If there are multiple top-level fields, the boolean +// will be false: This condition is an error in Go and we skip all +// the fields. +// +// Based on the enoding/json field filtering of the Go Stdlib +// https://golang.org/src/encoding/json/encode.go dominantField func. +func dominantField(fields []field) (field, bool) { + // The fields are sorted in increasing index-length order. The winner + // must therefore be one with the shortest index length. Drop all + // longer entries, which is easy: just truncate the slice. + length := len(fields[0].Index) + tagged := -1 // Index of first tagged field. + for i, f := range fields { + if len(f.Index) > length { + fields = fields[:i] + break + } + if f.NameFromTag { + if tagged >= 0 { + // Multiple tagged fields at the same level: conflict. + // Return no field. + return field{}, false + } + tagged = i + } + } + if tagged >= 0 { + return fields[tagged], true + } + // All remaining fields have the same length. If there's more than one, + // we have a conflict (two fields named "X" at the same level) and we + // return no field. + if len(fields) > 1 { + return field{}, false + } + return fields[0], true +} + +// fieldsByName sorts field by name, breaking ties with depth, +// then breaking ties with "name came from json tag", then +// breaking ties with index sequence. +// +// Based on the enoding/json field filtering of the Go Stdlib +// https://golang.org/src/encoding/json/encode.go fieldsByName type. +type fieldsByName []field + +func (x fieldsByName) Len() int { return len(x) } + +func (x fieldsByName) Swap(i, j int) { x[i], x[j] = x[j], x[i] } + +func (x fieldsByName) Less(i, j int) bool { + if x[i].Name != x[j].Name { + return x[i].Name < x[j].Name + } + if len(x[i].Index) != len(x[j].Index) { + return len(x[i].Index) < len(x[j].Index) + } + if x[i].NameFromTag != x[j].NameFromTag { + return x[i].NameFromTag + } + return fieldsByIndex(x).Less(i, j) +} + +// fieldsByIndex sorts field by index sequence. +// +// Based on the enoding/json field filtering of the Go Stdlib +// https://golang.org/src/encoding/json/encode.go fieldsByIndex type. +type fieldsByIndex []field + +func (x fieldsByIndex) Len() int { return len(x) } + +func (x fieldsByIndex) Swap(i, j int) { x[i], x[j] = x[j], x[i] } + +func (x fieldsByIndex) Less(i, j int) bool { + for k, xik := range x[i].Index { + if k >= len(x[j].Index) { + return false + } + if xik != x[j].Index[k] { + return xik < x[j].Index[k] + } + } + return len(x[i].Index) < len(x[j].Index) +} diff --git a/vendor/github.com/aws/aws-sdk-go/service/dynamodb/dynamodbattribute/tag.go b/vendor/github.com/aws/aws-sdk-go/service/dynamodb/dynamodbattribute/tag.go new file mode 100644 index 0000000000..0b63eb7d1a --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/service/dynamodb/dynamodbattribute/tag.go @@ -0,0 +1,65 @@ +package dynamodbattribute + +import ( + "reflect" + "strings" +) + +type tag struct { + Name string + Ignore bool + OmitEmpty bool + OmitEmptyElem bool + AsString bool + AsBinSet, AsNumSet, AsStrSet bool +} + +func (t *tag) parseAVTag(structTag reflect.StructTag) { + tagStr := structTag.Get("dynamodbav") + if len(tagStr) == 0 { + return + } + + t.parseTagStr(tagStr) +} + +func (t *tag) parseJSONTag(structTag reflect.StructTag) { + tagStr := structTag.Get("json") + if len(tagStr) == 0 { + return + } + + t.parseTagStr(tagStr) +} + +func (t *tag) parseTagStr(tagStr string) { + parts := strings.SplitN(tagStr, ",", 2) + if len(parts) == 0 { + return + } + + if name := parts[0]; name == "-" { + t.Name = "" + t.Ignore = true + } else { + t.Name = name + t.Ignore = false + } + + for _, opt := range parts[1:] { + switch opt { + case "omitempty": + t.OmitEmpty = true + case "omitemptyelem": + t.OmitEmptyElem = true + case "string": + t.AsString = true + case "binaryset": + t.AsBinSet = true + case "numberset": + t.AsNumSet = true + case "stringset": + t.AsStrSet = true + } + } +} diff --git a/vendor/github.com/aws/aws-sdk-go/service/dynamodb/service.go b/vendor/github.com/aws/aws-sdk-go/service/dynamodb/service.go index 12fc1d81f0..c7accb2cbc 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/dynamodb/service.go +++ b/vendor/github.com/aws/aws-sdk-go/service/dynamodb/service.go @@ -11,14 +11,27 @@ import ( "github.com/aws/aws-sdk-go/private/signer/v4" ) -// Overview -// // This is the Amazon DynamoDB API Reference. This guide provides descriptions -// and samples of the low-level DynamoDB API. For information about DynamoDB -// application development, see the Amazon DynamoDB Developer Guide (http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/). +// of the low-level DynamoDB API. +// +// This guide is intended for use with the following DynamoDB documentation: +// +// Amazon DynamoDB Getting Started Guide (http://docs.aws.amazon.com/amazondynamodb/latest/gettingstartedguide/) +// - provides hands-on exercises that help you learn the basics of working with +// DynamoDB. If you are new to DynamoDB, we recommend that you begin with the +// Getting Started Guide. +// +// Amazon DynamoDB Developer Guide (http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/) +// - contains detailed information about DynamoDB concepts, usage, and best +// practices. +// +// Amazon DynamoDB Streams API Reference (http://docs.aws.amazon.com/dynamodbstreams/latest/APIReference/) +// - provides descriptions and samples of the DynamoDB Streams API. (For more +// information, see Capturing Table Activity with DynamoDB Streams (http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Streams.html) +// in the Amazon DynamoDB Developer Guide.) // -// Instead of making the requests to the low-level DynamoDB API directly from -// your application, we recommend that you use the AWS Software Development +// Instead of making the requests to the low-level DynamoDB API directly +// from your application, we recommend that you use the AWS Software Development // Kits (SDKs). The easy-to-use libraries in the AWS SDKs make it unnecessary // to call the low-level DynamoDB API directly from your application. The libraries // take care of request authentication, serialization, and connection management. @@ -36,9 +49,8 @@ import ( // Managing Tables // // CreateTable - Creates a table with user-specified provisioned throughput -// settings. You must designate one attribute as the hash primary key for the -// table; you can optionally designate a second attribute as the range primary -// key. DynamoDB creates indexes on these key attributes for fast data access. +// settings. You must define a primary key for the table - either a simple primary +// key (partition key), or a composite primary key (partition key and sort key). // Optionally, you can create one or more secondary indexes, which provide fast // data access using non-key attributes. // @@ -70,10 +82,10 @@ import ( // Both eventually consistent and strongly consistent reads can be used. // // Query - Returns one or more items from a table or a secondary index. You -// must provide a specific hash key value. You can narrow the scope of the query -// using comparison operators against a range key value, or on the index key. -// Query supports either eventual or strong consistency. A single response has -// a size limit of 1 MB. +// must provide a specific value for the partition key. You can narrow the scope +// of the query using comparison operators against a sort key value, or on the +// index key. Query supports either eventual or strong consistency. A single +// response has a size limit of 1 MB. // // Scan - Reads every item in a table; the result set is eventually consistent. // You can limit the number of items returned by filtering the data attributes, @@ -163,10 +175,10 @@ func newClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegio // Handlers svc.Handlers.Sign.PushBack(v4.Sign) - svc.Handlers.Build.PushBack(jsonrpc.Build) - svc.Handlers.Unmarshal.PushBack(jsonrpc.Unmarshal) - svc.Handlers.UnmarshalMeta.PushBack(jsonrpc.UnmarshalMeta) - svc.Handlers.UnmarshalError.PushBack(jsonrpc.UnmarshalError) + svc.Handlers.Build.PushBackNamed(jsonrpc.BuildHandler) + svc.Handlers.Unmarshal.PushBackNamed(jsonrpc.UnmarshalHandler) + svc.Handlers.UnmarshalMeta.PushBackNamed(jsonrpc.UnmarshalMetaHandler) + svc.Handlers.UnmarshalError.PushBackNamed(jsonrpc.UnmarshalErrorHandler) // Run custom client initialization if present if initClient != nil { diff --git a/vendor/github.com/aws/aws-sdk-go/service/ec2/api.go b/vendor/github.com/aws/aws-sdk-go/service/ec2/api.go index 4eab480717..e6ca6fba55 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/ec2/api.go +++ b/vendor/github.com/aws/aws-sdk-go/service/ec2/api.go @@ -8,6 +8,8 @@ import ( "github.com/aws/aws-sdk-go/aws/awsutil" "github.com/aws/aws-sdk-go/aws/request" + "github.com/aws/aws-sdk-go/private/protocol" + "github.com/aws/aws-sdk-go/private/protocol/ec2query" ) const opAcceptVpcPeeringConnection = "AcceptVpcPeeringConnection" @@ -115,6 +117,8 @@ func (c *EC2) AssignPrivateIpAddressesRequest(input *AssignPrivateIpAddressesInp } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(ec2query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &AssignPrivateIpAddressesOutput{} req.Data = output return @@ -195,6 +199,8 @@ func (c *EC2) AssociateDhcpOptionsRequest(input *AssociateDhcpOptionsInput) (req } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(ec2query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &AssociateDhcpOptionsOutput{} req.Data = output return @@ -305,6 +311,8 @@ func (c *EC2) AttachInternetGatewayRequest(input *AttachInternetGatewayInput) (r } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(ec2query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &AttachInternetGatewayOutput{} req.Data = output return @@ -441,6 +449,8 @@ func (c *EC2) AuthorizeSecurityGroupEgressRequest(input *AuthorizeSecurityGroupE } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(ec2query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &AuthorizeSecurityGroupEgressOutput{} req.Data = output return @@ -486,6 +496,8 @@ func (c *EC2) AuthorizeSecurityGroupIngressRequest(input *AuthorizeSecurityGroup } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(ec2query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &AuthorizeSecurityGroupIngressOutput{} req.Data = output return @@ -594,6 +606,8 @@ func (c *EC2) CancelConversionTaskRequest(input *CancelConversionTaskInput) (req } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(ec2query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &CancelConversionTaskOutput{} req.Data = output return @@ -629,6 +643,8 @@ func (c *EC2) CancelExportTaskRequest(input *CancelExportTaskInput) (req *reques } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(ec2query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &CancelExportTaskOutput{} req.Data = output return @@ -691,7 +707,7 @@ func (c *EC2) CancelReservedInstancesListingRequest(input *CancelReservedInstanc return } -// Cancels the specified Reserved instance listing in the Reserved Instance +// Cancels the specified Reserved Instance listing in the Reserved Instance // Marketplace. // // For more information, see Reserved Instance Marketplace (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ri-market-general.html) @@ -1230,6 +1246,8 @@ func (c *EC2) CreateNetworkAclEntryRequest(input *CreateNetworkAclEntryInput) (r } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(ec2query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &CreateNetworkAclEntryOutput{} req.Data = output return @@ -1304,6 +1322,8 @@ func (c *EC2) CreatePlacementGroupRequest(input *CreatePlacementGroupInput) (req } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(ec2query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &CreatePlacementGroupOutput{} req.Data = output return @@ -1341,22 +1361,22 @@ func (c *EC2) CreateReservedInstancesListingRequest(input *CreateReservedInstanc return } -// Creates a listing for Amazon EC2 Reserved instances to be sold in the Reserved -// Instance Marketplace. You can submit one Reserved instance listing at a time. -// To get a list of your Reserved instances, you can use the DescribeReservedInstances +// Creates a listing for Amazon EC2 Reserved Instances to be sold in the Reserved +// Instance Marketplace. You can submit one Reserved Instance listing at a time. +// To get a list of your Reserved Instances, you can use the DescribeReservedInstances // operation. // // The Reserved Instance Marketplace matches sellers who want to resell Reserved -// instance capacity that they no longer need with buyers who want to purchase -// additional capacity. Reserved instances bought and sold through the Reserved -// Instance Marketplace work like any other Reserved instances. +// Instance capacity that they no longer need with buyers who want to purchase +// additional capacity. Reserved Instances bought and sold through the Reserved +// Instance Marketplace work like any other Reserved Instances. // -// To sell your Reserved instances, you must first register as a seller in +// To sell your Reserved Instances, you must first register as a seller in // the Reserved Instance Marketplace. After completing the registration process, // you can create a Reserved Instance Marketplace listing of some or all of -// your Reserved instances, and specify the upfront price to receive for them. -// Your Reserved instance listings then become available for purchase. To view -// the details of your Reserved instance listing, you can use the DescribeReservedInstancesListings +// your Reserved Instances, and specify the upfront price to receive for them. +// Your Reserved Instance listings then become available for purchase. To view +// the details of your Reserved Instance listing, you can use the DescribeReservedInstancesListings // operation. // // For more information, see Reserved Instance Marketplace (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ri-market-general.html) @@ -1475,7 +1495,7 @@ func (c *EC2) CreateSecurityGroupRequest(input *CreateSecurityGroupInput) (req * // // EC2-Classic: You can have up to 500 security groups. // -// EC2-VPC: You can create up to 100 security groups per VPC. +// EC2-VPC: You can create up to 500 security groups per VPC. // // When you create a security group, you specify a friendly name of your choice. // You can have a security group for use in EC2-Classic with the same name as @@ -1647,6 +1667,8 @@ func (c *EC2) CreateTagsRequest(input *CreateTagsInput) (req *request.Request, o } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(ec2query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &CreateTagsOutput{} req.Data = output return @@ -1874,6 +1896,8 @@ func (c *EC2) CreateVpnConnectionRouteRequest(input *CreateVpnConnectionRouteInp } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(ec2query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &CreateVpnConnectionRouteOutput{} req.Data = output return @@ -1941,6 +1965,8 @@ func (c *EC2) DeleteCustomerGatewayRequest(input *DeleteCustomerGatewayInput) (r } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(ec2query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &DeleteCustomerGatewayOutput{} req.Data = output return @@ -1969,6 +1995,8 @@ func (c *EC2) DeleteDhcpOptionsRequest(input *DeleteDhcpOptionsInput) (req *requ } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(ec2query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &DeleteDhcpOptionsOutput{} req.Data = output return @@ -2026,6 +2054,8 @@ func (c *EC2) DeleteInternetGatewayRequest(input *DeleteInternetGatewayInput) (r } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(ec2query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &DeleteInternetGatewayOutput{} req.Data = output return @@ -2054,6 +2084,8 @@ func (c *EC2) DeleteKeyPairRequest(input *DeleteKeyPairInput) (req *request.Requ } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(ec2query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &DeleteKeyPairOutput{} req.Data = output return @@ -2110,6 +2142,8 @@ func (c *EC2) DeleteNetworkAclRequest(input *DeleteNetworkAclInput) (req *reques } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(ec2query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &DeleteNetworkAclOutput{} req.Data = output return @@ -2138,6 +2172,8 @@ func (c *EC2) DeleteNetworkAclEntryRequest(input *DeleteNetworkAclEntryInput) (r } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(ec2query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &DeleteNetworkAclEntryOutput{} req.Data = output return @@ -2166,6 +2202,8 @@ func (c *EC2) DeleteNetworkInterfaceRequest(input *DeleteNetworkInterfaceInput) } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(ec2query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &DeleteNetworkInterfaceOutput{} req.Data = output return @@ -2194,6 +2232,8 @@ func (c *EC2) DeletePlacementGroupRequest(input *DeletePlacementGroupInput) (req } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(ec2query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &DeletePlacementGroupOutput{} req.Data = output return @@ -2224,6 +2264,8 @@ func (c *EC2) DeleteRouteRequest(input *DeleteRouteInput) (req *request.Request, } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(ec2query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &DeleteRouteOutput{} req.Data = output return @@ -2251,6 +2293,8 @@ func (c *EC2) DeleteRouteTableRequest(input *DeleteRouteTableInput) (req *reques } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(ec2query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &DeleteRouteTableOutput{} req.Data = output return @@ -2280,6 +2324,8 @@ func (c *EC2) DeleteSecurityGroupRequest(input *DeleteSecurityGroupInput) (req * } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(ec2query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &DeleteSecurityGroupOutput{} req.Data = output return @@ -2311,6 +2357,8 @@ func (c *EC2) DeleteSnapshotRequest(input *DeleteSnapshotInput) (req *request.Re } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(ec2query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &DeleteSnapshotOutput{} req.Data = output return @@ -2352,6 +2400,8 @@ func (c *EC2) DeleteSpotDatafeedSubscriptionRequest(input *DeleteSpotDatafeedSub } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(ec2query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &DeleteSpotDatafeedSubscriptionOutput{} req.Data = output return @@ -2379,6 +2429,8 @@ func (c *EC2) DeleteSubnetRequest(input *DeleteSubnetInput) (req *request.Reques } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(ec2query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &DeleteSubnetOutput{} req.Data = output return @@ -2407,6 +2459,8 @@ func (c *EC2) DeleteTagsRequest(input *DeleteTagsInput) (req *request.Request, o } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(ec2query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &DeleteTagsOutput{} req.Data = output return @@ -2438,6 +2492,8 @@ func (c *EC2) DeleteVolumeRequest(input *DeleteVolumeInput) (req *request.Reques } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(ec2query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &DeleteVolumeOutput{} req.Data = output return @@ -2471,6 +2527,8 @@ func (c *EC2) DeleteVpcRequest(input *DeleteVpcInput) (req *request.Request, out } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(ec2query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &DeleteVpcOutput{} req.Data = output return @@ -2560,6 +2618,8 @@ func (c *EC2) DeleteVpnConnectionRequest(input *DeleteVpnConnectionInput) (req * } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(ec2query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &DeleteVpnConnectionOutput{} req.Data = output return @@ -2596,6 +2656,8 @@ func (c *EC2) DeleteVpnConnectionRouteRequest(input *DeleteVpnConnectionRouteInp } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(ec2query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &DeleteVpnConnectionRouteOutput{} req.Data = output return @@ -2626,6 +2688,8 @@ func (c *EC2) DeleteVpnGatewayRequest(input *DeleteVpnGatewayInput) (req *reques } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(ec2query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &DeleteVpnGatewayOutput{} req.Data = output return @@ -2657,6 +2721,8 @@ func (c *EC2) DeregisterImageRequest(input *DeregisterImageInput) (req *request. } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(ec2query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &DeregisterImageOutput{} req.Data = output return @@ -2867,6 +2933,9 @@ func (c *EC2) DescribeConversionTasksRequest(input *DescribeConversionTasksInput // Using the Command Line Tools to Import Your Virtual Machine to Amazon EC2 // (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/UploadingYourInstancesandVolumes.html) // in the Amazon Elastic Compute Cloud User Guide. +// +// For information about the import manifest referenced by this API action, +// see VM Import Manifest (http://docs.aws.amazon.com/AWSEC2/latest/APIReference/manifest.html). func (c *EC2) DescribeConversionTasks(input *DescribeConversionTasksInput) (*DescribeConversionTasksOutput, error) { req, out := c.DescribeConversionTasksRequest(input) err := req.Send() @@ -3041,21 +3110,20 @@ func (c *EC2) DescribeIdFormatRequest(input *DescribeIdFormatInput) (req *reques return } -// Important: This command is reserved for future use, and is currently not -// available for you to use. -// -// Describes the ID format settings for your resources, for example, to view -// which resource types are enabled for longer IDs. This request only returns -// information about resource types whose ID formats can be modified; it does -// not return information about other resource types. +// Describes the ID format settings for your resources on a per-region basis, +// for example, to view which resource types are enabled for longer IDs. This +// request only returns information about resource types whose ID formats can +// be modified; it does not return information about other resource types. // // The following resource types support longer IDs: instance | reservation. // // These settings apply to the IAM user who makes the request; they do not // apply to the entire AWS account. By default, an IAM user defaults to the // same settings as the root user, unless they explicitly override the settings -// by running the ModifyIdFormat command. These settings are applied on a per-region -// basis. +// by running the ModifyIdFormat command. Resources created with longer IDs +// are visible to all IAM users, regardless of these settings and provided that +// they have permission to use the relevant Describe command for the resource +// type. func (c *EC2) DescribeIdFormat(input *DescribeIdFormatInput) (*DescribeIdFormatOutput, error) { req, out := c.DescribeIdFormatRequest(input) err := req.Send() @@ -3627,9 +3695,9 @@ func (c *EC2) DescribeReservedInstancesRequest(input *DescribeReservedInstancesI return } -// Describes one or more of the Reserved instances that you purchased. +// Describes one or more of the Reserved Instances that you purchased. // -// For more information about Reserved instances, see Reserved Instances (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/concepts-on-demand-reserved-instances.html) +// For more information about Reserved Instances, see Reserved Instances (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/concepts-on-demand-reserved-instances.html) // in the Amazon Elastic Compute Cloud User Guide. func (c *EC2) DescribeReservedInstances(input *DescribeReservedInstancesInput) (*DescribeReservedInstancesOutput, error) { req, out := c.DescribeReservedInstancesRequest(input) @@ -3657,22 +3725,22 @@ func (c *EC2) DescribeReservedInstancesListingsRequest(input *DescribeReservedIn return } -// Describes your account's Reserved instance listings in the Reserved Instance +// Describes your account's Reserved Instance listings in the Reserved Instance // Marketplace. // // The Reserved Instance Marketplace matches sellers who want to resell Reserved -// instance capacity that they no longer need with buyers who want to purchase -// additional capacity. Reserved instances bought and sold through the Reserved +// Instance capacity that they no longer need with buyers who want to purchase +// additional capacity. Reserved Instances bought and sold through the Reserved // Instance Marketplace work like any other Reserved Instances. // -// As a seller, you choose to list some or all of your Reserved instances, -// and you specify the upfront price to receive for them. Your Reserved instances +// As a seller, you choose to list some or all of your Reserved Instances, +// and you specify the upfront price to receive for them. Your Reserved Instances // are then listed in the Reserved Instance Marketplace and are available for // purchase. // -// As a buyer, you specify the configuration of the Reserved instance to purchase, +// As a buyer, you specify the configuration of the Reserved Instance to purchase, // and the Marketplace matches what you're searching for with what's available. -// The Marketplace first sells the lowest priced Reserved instances to you, +// The Marketplace first sells the lowest priced Reserved Instances to you, // and continues to sell available Reserved Instance listings to you until your // demand is met. You are charged based on the total price of all of the listings // that you purchase. @@ -3711,8 +3779,8 @@ func (c *EC2) DescribeReservedInstancesModificationsRequest(input *DescribeReser return } -// Describes the modifications made to your Reserved instances. If no parameter -// is specified, information about all your Reserved instances modification +// Describes the modifications made to your Reserved Instances. If no parameter +// is specified, information about all your Reserved Instances modification // requests is returned. If a modification ID is specified, only information // about the specific modification is returned. // @@ -3758,15 +3826,15 @@ func (c *EC2) DescribeReservedInstancesOfferingsRequest(input *DescribeReservedI return } -// Describes Reserved instance offerings that are available for purchase. With -// Reserved instances, you purchase the right to launch instances for a period +// Describes Reserved Instance offerings that are available for purchase. With +// Reserved Instances, you purchase the right to launch instances for a period // of time. During that time period, you do not receive insufficient capacity // errors, and you pay a lower usage rate than the rate charged for On-Demand // instances for the actual time used. // -// If you have listed your own Reserved instances for sale in the Reserved +// If you have listed your own Reserved Instances for sale in the Reserved // Instance Marketplace, they will be excluded from these results. This is to -// ensure that you do not purchase your own Reserved instances. +// ensure that you do not purchase your own Reserved Instances. // // For more information, see Reserved Instance Marketplace (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ri-market-general.html) // in the Amazon Elastic Compute Cloud User Guide. @@ -3819,6 +3887,68 @@ func (c *EC2) DescribeRouteTables(input *DescribeRouteTablesInput) (*DescribeRou return out, err } +const opDescribeScheduledInstanceAvailability = "DescribeScheduledInstanceAvailability" + +// DescribeScheduledInstanceAvailabilityRequest generates a request for the DescribeScheduledInstanceAvailability operation. +func (c *EC2) DescribeScheduledInstanceAvailabilityRequest(input *DescribeScheduledInstanceAvailabilityInput) (req *request.Request, output *DescribeScheduledInstanceAvailabilityOutput) { + op := &request.Operation{ + Name: opDescribeScheduledInstanceAvailability, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &DescribeScheduledInstanceAvailabilityInput{} + } + + req = c.newRequest(op, input, output) + output = &DescribeScheduledInstanceAvailabilityOutput{} + req.Data = output + return +} + +// Finds available schedules that meet the specified criteria. +// +// You can search for an available schedule no more than 3 months in advance. +// You must meet the minimum required duration of 1,200 hours per year. For +// example, the minimum daily schedule is 4 hours, the minimum weekly schedule +// is 24 hours, and the minimum monthly schedule is 100 hours. +// +// After you find a schedule that meets your needs, call PurchaseScheduledInstances +// to purchase Scheduled Instances with that schedule. +func (c *EC2) DescribeScheduledInstanceAvailability(input *DescribeScheduledInstanceAvailabilityInput) (*DescribeScheduledInstanceAvailabilityOutput, error) { + req, out := c.DescribeScheduledInstanceAvailabilityRequest(input) + err := req.Send() + return out, err +} + +const opDescribeScheduledInstances = "DescribeScheduledInstances" + +// DescribeScheduledInstancesRequest generates a request for the DescribeScheduledInstances operation. +func (c *EC2) DescribeScheduledInstancesRequest(input *DescribeScheduledInstancesInput) (req *request.Request, output *DescribeScheduledInstancesOutput) { + op := &request.Operation{ + Name: opDescribeScheduledInstances, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &DescribeScheduledInstancesInput{} + } + + req = c.newRequest(op, input, output) + output = &DescribeScheduledInstancesOutput{} + req.Data = output + return +} + +// Describes one or more of your Scheduled Instances. +func (c *EC2) DescribeScheduledInstances(input *DescribeScheduledInstancesInput) (*DescribeScheduledInstancesOutput, error) { + req, out := c.DescribeScheduledInstancesRequest(input) + err := req.Send() + return out, err +} + const opDescribeSecurityGroups = "DescribeSecurityGroups" // DescribeSecurityGroupsRequest generates a request for the DescribeSecurityGroups operation. @@ -4452,6 +4582,39 @@ func (c *EC2) DescribeVpcClassicLink(input *DescribeVpcClassicLinkInput) (*Descr return out, err } +const opDescribeVpcClassicLinkDnsSupport = "DescribeVpcClassicLinkDnsSupport" + +// DescribeVpcClassicLinkDnsSupportRequest generates a request for the DescribeVpcClassicLinkDnsSupport operation. +func (c *EC2) DescribeVpcClassicLinkDnsSupportRequest(input *DescribeVpcClassicLinkDnsSupportInput) (req *request.Request, output *DescribeVpcClassicLinkDnsSupportOutput) { + op := &request.Operation{ + Name: opDescribeVpcClassicLinkDnsSupport, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &DescribeVpcClassicLinkDnsSupportInput{} + } + + req = c.newRequest(op, input, output) + output = &DescribeVpcClassicLinkDnsSupportOutput{} + req.Data = output + return +} + +// Describes the ClassicLink DNS support status of one or more VPCs. If enabled, +// the DNS hostname of a linked EC2-Classic instance resolves to its private +// IP address when addressed from an instance in the VPC to which it's linked. +// Similarly, the DNS hostname of an instance in a VPC resolves to its private +// IP address when addressed from a linked EC2-Classic instance. For more information +// about ClassicLink, see ClassicLink (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/vpc-classiclink.html) +// in the Amazon Elastic Compute Cloud User Guide. +func (c *EC2) DescribeVpcClassicLinkDnsSupport(input *DescribeVpcClassicLinkDnsSupportInput) (*DescribeVpcClassicLinkDnsSupportOutput, error) { + req, out := c.DescribeVpcClassicLinkDnsSupportRequest(input) + err := req.Send() + return out, err +} + const opDescribeVpcEndpointServices = "DescribeVpcEndpointServices" // DescribeVpcEndpointServicesRequest generates a request for the DescribeVpcEndpointServices operation. @@ -4667,6 +4830,8 @@ func (c *EC2) DetachInternetGatewayRequest(input *DetachInternetGatewayInput) (r } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(ec2query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &DetachInternetGatewayOutput{} req.Data = output return @@ -4696,6 +4861,8 @@ func (c *EC2) DetachNetworkInterfaceRequest(input *DetachNetworkInterfaceInput) } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(ec2query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &DetachNetworkInterfaceOutput{} req.Data = output return @@ -4762,6 +4929,8 @@ func (c *EC2) DetachVpnGatewayRequest(input *DetachVpnGatewayInput) (req *reques } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(ec2query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &DetachVpnGatewayOutput{} req.Data = output return @@ -4796,6 +4965,8 @@ func (c *EC2) DisableVgwRoutePropagationRequest(input *DisableVgwRoutePropagatio } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(ec2query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &DisableVgwRoutePropagationOutput{} req.Data = output return @@ -4837,6 +5008,37 @@ func (c *EC2) DisableVpcClassicLink(input *DisableVpcClassicLinkInput) (*Disable return out, err } +const opDisableVpcClassicLinkDnsSupport = "DisableVpcClassicLinkDnsSupport" + +// DisableVpcClassicLinkDnsSupportRequest generates a request for the DisableVpcClassicLinkDnsSupport operation. +func (c *EC2) DisableVpcClassicLinkDnsSupportRequest(input *DisableVpcClassicLinkDnsSupportInput) (req *request.Request, output *DisableVpcClassicLinkDnsSupportOutput) { + op := &request.Operation{ + Name: opDisableVpcClassicLinkDnsSupport, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &DisableVpcClassicLinkDnsSupportInput{} + } + + req = c.newRequest(op, input, output) + output = &DisableVpcClassicLinkDnsSupportOutput{} + req.Data = output + return +} + +// Disables ClassicLink DNS support for a VPC. If disabled, DNS hostnames resolve +// to public IP addresses when addressed between a linked EC2-Classic instance +// and instances in the VPC to which it's linked. For more information about +// ClassicLink, see ClassicLink (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/vpc-classiclink.html) +// in the Amazon Elastic Compute Cloud User Guide. +func (c *EC2) DisableVpcClassicLinkDnsSupport(input *DisableVpcClassicLinkDnsSupportInput) (*DisableVpcClassicLinkDnsSupportOutput, error) { + req, out := c.DisableVpcClassicLinkDnsSupportRequest(input) + err := req.Send() + return out, err +} + const opDisassociateAddress = "DisassociateAddress" // DisassociateAddressRequest generates a request for the DisassociateAddress operation. @@ -4852,6 +5054,8 @@ func (c *EC2) DisassociateAddressRequest(input *DisassociateAddressInput) (req * } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(ec2query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &DisassociateAddressOutput{} req.Data = output return @@ -4887,6 +5091,8 @@ func (c *EC2) DisassociateRouteTableRequest(input *DisassociateRouteTableInput) } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(ec2query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &DisassociateRouteTableOutput{} req.Data = output return @@ -4919,6 +5125,8 @@ func (c *EC2) EnableVgwRoutePropagationRequest(input *EnableVgwRoutePropagationI } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(ec2query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &EnableVgwRoutePropagationOutput{} req.Data = output return @@ -4947,6 +5155,8 @@ func (c *EC2) EnableVolumeIORequest(input *EnableVolumeIOInput) (req *request.Re } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(ec2query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &EnableVolumeIOOutput{} req.Data = output return @@ -4993,6 +5203,39 @@ func (c *EC2) EnableVpcClassicLink(input *EnableVpcClassicLinkInput) (*EnableVpc return out, err } +const opEnableVpcClassicLinkDnsSupport = "EnableVpcClassicLinkDnsSupport" + +// EnableVpcClassicLinkDnsSupportRequest generates a request for the EnableVpcClassicLinkDnsSupport operation. +func (c *EC2) EnableVpcClassicLinkDnsSupportRequest(input *EnableVpcClassicLinkDnsSupportInput) (req *request.Request, output *EnableVpcClassicLinkDnsSupportOutput) { + op := &request.Operation{ + Name: opEnableVpcClassicLinkDnsSupport, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &EnableVpcClassicLinkDnsSupportInput{} + } + + req = c.newRequest(op, input, output) + output = &EnableVpcClassicLinkDnsSupportOutput{} + req.Data = output + return +} + +// Enables a VPC to support DNS hostname resolution for ClassicLink. If enabled, +// the DNS hostname of a linked EC2-Classic instance resolves to its private +// IP address when addressed from an instance in the VPC to which it's linked. +// Similarly, the DNS hostname of an instance in a VPC resolves to its private +// IP address when addressed from a linked EC2-Classic instance. For more information +// about ClassicLink, see ClassicLink (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/vpc-classiclink.html) +// in the Amazon Elastic Compute Cloud User Guide. +func (c *EC2) EnableVpcClassicLinkDnsSupport(input *EnableVpcClassicLinkDnsSupportInput) (*EnableVpcClassicLinkDnsSupportOutput, error) { + req, out := c.EnableVpcClassicLinkDnsSupportRequest(input) + err := req.Send() + return out, err +} + const opGetConsoleOutput = "GetConsoleOutput" // GetConsoleOutputRequest generates a request for the GetConsoleOutput operation. @@ -5132,6 +5375,9 @@ func (c *EC2) ImportInstanceRequest(input *ImportInstanceInput) (req *request.Re // see Using the Command Line Tools to Import Your Virtual Machine to Amazon // EC2 (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/UploadingYourInstancesandVolumes.html) // in the Amazon Elastic Compute Cloud User Guide. +// +// For information about the import manifest referenced by this API action, +// see VM Import Manifest (http://docs.aws.amazon.com/AWSEC2/latest/APIReference/manifest.html). func (c *EC2) ImportInstance(input *ImportInstanceInput) (*ImportInstanceOutput, error) { req, out := c.ImportInstanceRequest(input) err := req.Send() @@ -5225,6 +5471,9 @@ func (c *EC2) ImportVolumeRequest(input *ImportVolumeInput) (req *request.Reques // see Using the Command Line Tools to Import Your Virtual Machine to Amazon // EC2 (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/UploadingYourInstancesandVolumes.html) // in the Amazon Elastic Compute Cloud User Guide. +// +// For information about the import manifest referenced by this API action, +// see VM Import Manifest (http://docs.aws.amazon.com/AWSEC2/latest/APIReference/manifest.html). func (c *EC2) ImportVolume(input *ImportVolumeInput) (*ImportVolumeOutput, error) { req, out := c.ImportVolumeRequest(input) err := req.Send() @@ -5279,22 +5528,30 @@ func (c *EC2) ModifyIdFormatRequest(input *ModifyIdFormatInput) (req *request.Re } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(ec2query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &ModifyIdFormatOutput{} req.Data = output return } -// Important: This command is reserved for future use, and is currently not -// available for you to use. -// -// Modifies the ID format for the specified resource. You can specify that -// resources should receive longer IDs (17-character IDs) when they are created. -// The following resource types support longer IDs: instance | reservation. +// Modifies the ID format for the specified resource on a per-region basis. +// You can specify that resources should receive longer IDs (17-character IDs) +// when they are created. The following resource types support longer IDs: instance +// | reservation. // // This setting applies to the IAM user who makes the request; it does not // apply to the entire AWS account. By default, an IAM user defaults to the -// same settings as the root user, unless they explicitly override the settings -// by running this request. These settings are applied on a per-region basis. +// same settings as the root user. If you're using this action as the root user +// or as an IAM role that has permission to use this action, then these settings +// apply to the entire account, unless an IAM user explicitly overrides these +// settings for themselves. For more information, see Controlling Access to +// Longer ID Settings (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/resource-ids.html#resource-ids-access) +// in the Amazon Elastic Compute Cloud User Guide. +// +// Resources created with longer IDs are visible to all IAM users, regardless +// of these settings and provided that they have permission to use the relevant +// Describe command for the resource type. func (c *EC2) ModifyIdFormat(input *ModifyIdFormatInput) (*ModifyIdFormatOutput, error) { req, out := c.ModifyIdFormatRequest(input) err := req.Send() @@ -5316,6 +5573,8 @@ func (c *EC2) ModifyImageAttributeRequest(input *ModifyImageAttributeInput) (req } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(ec2query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &ModifyImageAttributeOutput{} req.Data = output return @@ -5347,6 +5606,8 @@ func (c *EC2) ModifyInstanceAttributeRequest(input *ModifyInstanceAttributeInput } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(ec2query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &ModifyInstanceAttributeOutput{} req.Data = output return @@ -5424,6 +5685,8 @@ func (c *EC2) ModifyNetworkInterfaceAttributeRequest(input *ModifyNetworkInterfa } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(ec2query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &ModifyNetworkInterfaceAttributeOutput{} req.Data = output return @@ -5458,8 +5721,8 @@ func (c *EC2) ModifyReservedInstancesRequest(input *ModifyReservedInstancesInput } // Modifies the Availability Zone, instance count, instance type, or network -// platform (EC2-Classic or EC2-VPC) of your Reserved instances. The Reserved -// instances to be modified must be identical, except for Availability Zone, +// platform (EC2-Classic or EC2-VPC) of your Reserved Instances. The Reserved +// Instances to be modified must be identical, except for Availability Zone, // network platform, and instance type. // // For more information, see Modifying Reserved Instances (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ri-modifying.html) @@ -5485,6 +5748,8 @@ func (c *EC2) ModifySnapshotAttributeRequest(input *ModifySnapshotAttributeInput } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(ec2query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &ModifySnapshotAttributeOutput{} req.Data = output return @@ -5568,6 +5833,8 @@ func (c *EC2) ModifySubnetAttributeRequest(input *ModifySubnetAttributeInput) (r } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(ec2query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &ModifySubnetAttributeOutput{} req.Data = output return @@ -5595,6 +5862,8 @@ func (c *EC2) ModifyVolumeAttributeRequest(input *ModifyVolumeAttributeInput) (r } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(ec2query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &ModifyVolumeAttributeOutput{} req.Data = output return @@ -5631,6 +5900,8 @@ func (c *EC2) ModifyVpcAttributeRequest(input *ModifyVpcAttributeInput) (req *re } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(ec2query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &ModifyVpcAttributeOutput{} req.Data = output return @@ -5722,12 +5993,14 @@ func (c *EC2) MoveAddressToVpcRequest(input *MoveAddressToVpcInput) (req *reques } // Moves an Elastic IP address from the EC2-Classic platform to the EC2-VPC -// platform. The Elastic IP address must be allocated to your account, and it -// must not be associated with an instance. After the Elastic IP address is -// moved, it is no longer available for use in the EC2-Classic platform, unless -// you move it back using the RestoreAddressToClassic request. You cannot move -// an Elastic IP address that's allocated for use in the EC2-VPC platform to -// the EC2-Classic platform. +// platform. The Elastic IP address must be allocated to your account for more +// than 24 hours, and it must not be associated with an instance. After the +// Elastic IP address is moved, it is no longer available for use in the EC2-Classic +// platform, unless you move it back using the RestoreAddressToClassic request. +// You cannot move an Elastic IP address that's allocated for use in the EC2-VPC +// platform to the EC2-Classic platform. You cannot migrate an Elastic IP address +// that's associated with a reverse DNS record. Contact AWS account and billing +// support to remove the reverse DNS record. func (c *EC2) MoveAddressToVpc(input *MoveAddressToVpcInput) (*MoveAddressToVpcOutput, error) { req, out := c.MoveAddressToVpcRequest(input) err := req.Send() @@ -5754,14 +6027,14 @@ func (c *EC2) PurchaseReservedInstancesOfferingRequest(input *PurchaseReservedIn return } -// Purchases a Reserved instance for use with your account. With Amazon EC2 -// Reserved instances, you obtain a capacity reservation for a certain instance -// configuration over a specified period of time and pay a lower hourly rate -// compared to On-Demand Instance pricing. +// Purchases a Reserved Instance for use with your account. With Reserved Instances, +// you obtain a capacity reservation for a certain instance configuration over +// a specified period of time and pay a lower hourly rate compared to On-Demand +// instance pricing. // -// Use DescribeReservedInstancesOfferings to get a list of Reserved instance +// Use DescribeReservedInstancesOfferings to get a list of Reserved Instance // offerings that match your specifications. After you've purchased a Reserved -// instance, you can check for your new Reserved instance with DescribeReservedInstances. +// Instance, you can check for your new Reserved Instance with DescribeReservedInstances. // // For more information, see Reserved Instances (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/concepts-on-demand-reserved-instances.html) // and Reserved Instance Marketplace (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ri-market-general.html) @@ -5772,6 +6045,38 @@ func (c *EC2) PurchaseReservedInstancesOffering(input *PurchaseReservedInstances return out, err } +const opPurchaseScheduledInstances = "PurchaseScheduledInstances" + +// PurchaseScheduledInstancesRequest generates a request for the PurchaseScheduledInstances operation. +func (c *EC2) PurchaseScheduledInstancesRequest(input *PurchaseScheduledInstancesInput) (req *request.Request, output *PurchaseScheduledInstancesOutput) { + op := &request.Operation{ + Name: opPurchaseScheduledInstances, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &PurchaseScheduledInstancesInput{} + } + + req = c.newRequest(op, input, output) + output = &PurchaseScheduledInstancesOutput{} + req.Data = output + return +} + +// Purchases one or more Scheduled Instances with the specified schedule. +// +// Scheduled Instances enable you to purchase Amazon EC2 compute capacity by +// the hour for a one-year term. Before you can purchase a Scheduled Instance, +// you must call DescribeScheduledInstanceAvailability to check for available +// schedules and obtain a purchase token. +func (c *EC2) PurchaseScheduledInstances(input *PurchaseScheduledInstancesInput) (*PurchaseScheduledInstancesOutput, error) { + req, out := c.PurchaseScheduledInstancesRequest(input) + err := req.Send() + return out, err +} + const opRebootInstances = "RebootInstances" // RebootInstancesRequest generates a request for the RebootInstances operation. @@ -5787,6 +6092,8 @@ func (c *EC2) RebootInstancesRequest(input *RebootInstancesInput) (req *request. } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(ec2query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &RebootInstancesOutput{} req.Data = output return @@ -5914,6 +6221,8 @@ func (c *EC2) ReleaseAddressRequest(input *ReleaseAddressInput) (req *request.Re } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(ec2query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &ReleaseAddressOutput{} req.Data = output return @@ -6023,6 +6332,8 @@ func (c *EC2) ReplaceNetworkAclEntryRequest(input *ReplaceNetworkAclEntryInput) } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(ec2query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &ReplaceNetworkAclEntryOutput{} req.Data = output return @@ -6052,6 +6363,8 @@ func (c *EC2) ReplaceRouteRequest(input *ReplaceRouteInput) (req *request.Reques } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(ec2query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &ReplaceRouteOutput{} req.Data = output return @@ -6119,6 +6432,8 @@ func (c *EC2) ReportInstanceStatusRequest(input *ReportInstanceStatusInput) (req } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(ec2query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &ReportInstanceStatusOutput{} req.Data = output return @@ -6227,6 +6542,8 @@ func (c *EC2) ResetImageAttributeRequest(input *ResetImageAttributeInput) (req * } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(ec2query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &ResetImageAttributeOutput{} req.Data = output return @@ -6256,6 +6573,8 @@ func (c *EC2) ResetInstanceAttributeRequest(input *ResetInstanceAttributeInput) } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(ec2query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &ResetInstanceAttributeOutput{} req.Data = output return @@ -6291,6 +6610,8 @@ func (c *EC2) ResetNetworkInterfaceAttributeRequest(input *ResetNetworkInterface } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(ec2query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &ResetNetworkInterfaceAttributeOutput{} req.Data = output return @@ -6319,6 +6640,8 @@ func (c *EC2) ResetSnapshotAttributeRequest(input *ResetSnapshotAttributeInput) } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(ec2query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &ResetSnapshotAttributeOutput{} req.Data = output return @@ -6358,7 +6681,9 @@ func (c *EC2) RestoreAddressToClassicRequest(input *RestoreAddressToClassicInput // Restores an Elastic IP address that was previously moved to the EC2-VPC platform // back to the EC2-Classic platform. You cannot move an Elastic IP address that // was originally allocated for use in EC2-VPC. The Elastic IP address must -// not be associated with an instance or network interface. +// not be associated with an instance or network interface. You cannot restore +// an Elastic IP address that's associated with a reverse DNS record. Contact +// AWS account and billing support to remove the reverse DNS record. func (c *EC2) RestoreAddressToClassic(input *RestoreAddressToClassicInput) (*RestoreAddressToClassicOutput, error) { req, out := c.RestoreAddressToClassicRequest(input) err := req.Send() @@ -6380,6 +6705,8 @@ func (c *EC2) RevokeSecurityGroupEgressRequest(input *RevokeSecurityGroupEgressI } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(ec2query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &RevokeSecurityGroupEgressOutput{} req.Data = output return @@ -6418,6 +6745,8 @@ func (c *EC2) RevokeSecurityGroupIngressRequest(input *RevokeSecurityGroupIngres } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(ec2query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &RevokeSecurityGroupIngressOutput{} req.Data = output return @@ -6467,6 +6796,10 @@ func (c *EC2) RunInstancesRequest(input *RunInstancesInput) (req *request.Reques // is ready for you, it enters the running state. To check the state of your // instance, call DescribeInstances. // +// To ensure faster instance launches, break up large requests into smaller +// batches. For example, create five separate launch requests for 100 instances +// each instead of one launch request for 500 instances. +// // If you don't specify a security group when launching an instance, Amazon // EC2 uses the default security group. For more information, see Security Groups // (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-network-security.html) @@ -6491,9 +6824,9 @@ func (c *EC2) RunInstancesRequest(input *RunInstancesInput) (req *request.Reques // If any of the AMIs have a product code attached for which the user has not // subscribed, RunInstances fails. // -// T2 instance types can only be launched into a VPC. If you do not have a -// default VPC, or if you do not specify a subnet ID in the request, RunInstances -// fails. +// Some instance types can only be launched into a VPC. If you do not have +// a default VPC, or if you do not specify a subnet ID in the request, RunInstances +// fails. For more information, see Instance Types Available Only in a VPC (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-vpc.html#vpc-only-instance-types). // // For more information about troubleshooting, see What To Do If An Instance // Immediately Terminates (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Using_InstanceStraightToTerminated.html), @@ -6505,6 +6838,41 @@ func (c *EC2) RunInstances(input *RunInstancesInput) (*Reservation, error) { return out, err } +const opRunScheduledInstances = "RunScheduledInstances" + +// RunScheduledInstancesRequest generates a request for the RunScheduledInstances operation. +func (c *EC2) RunScheduledInstancesRequest(input *RunScheduledInstancesInput) (req *request.Request, output *RunScheduledInstancesOutput) { + op := &request.Operation{ + Name: opRunScheduledInstances, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &RunScheduledInstancesInput{} + } + + req = c.newRequest(op, input, output) + output = &RunScheduledInstancesOutput{} + req.Data = output + return +} + +// Launches the specified Scheduled Instances. +// +// Before you can launch a Scheduled Instance, you must purchase it and obtain +// an identifier using PurchaseScheduledInstances. +// +// You must launch a Scheduled Instance during its scheduled time period. You +// can't stop or reboot a Scheduled Instance, but you can terminate it as needed. +// If you terminate a Scheduled Instance before the current scheduled time period +// ends, you can launch it again after a few minutes. +func (c *EC2) RunScheduledInstances(input *RunScheduledInstancesInput) (*RunScheduledInstancesOutput, error) { + req, out := c.RunScheduledInstancesRequest(input) + err := req.Send() + return out, err +} + const opStartInstances = "StartInstances" // StartInstancesRequest generates a request for the StartInstances operation. @@ -6670,6 +7038,8 @@ func (c *EC2) UnassignPrivateIpAddressesRequest(input *UnassignPrivateIpAddresse } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(ec2query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &UnassignPrivateIpAddressesOutput{} req.Data = output return @@ -7613,6 +7983,7 @@ func (s AvailableCapacity) GoString() string { type BlobAttributeValue struct { _ struct{} `type:"structure"` + // Value is automatically base64 encoded/decoded by the SDK. Value []byte `locationName:"value" type:"blob"` } @@ -7938,7 +8309,7 @@ func (s CancelImportTaskOutput) GoString() string { type CancelReservedInstancesListingInput struct { _ struct{} `type:"structure"` - // The ID of the Reserved instance listing. + // The ID of the Reserved Instance listing. ReservedInstancesListingId *string `locationName:"reservedInstancesListingId" type:"string" required:"true"` } @@ -7955,7 +8326,7 @@ func (s CancelReservedInstancesListingInput) GoString() string { type CancelReservedInstancesListingOutput struct { _ struct{} `type:"structure"` - // The Reserved instance listing. + // The Reserved Instance listing. ReservedInstancesListings []*ReservedInstancesListing `locationName:"reservedInstancesListingsSet" locationNameList:"item" type:"list"` } @@ -8147,6 +8518,27 @@ func (s CancelledSpotInstanceRequest) GoString() string { return s.String() } +// Describes the ClassicLink DNS support status of a VPC. +type ClassicLinkDnsSupport struct { + _ struct{} `type:"structure"` + + // Indicates whether ClassicLink DNS support is enabled for the VPC. + ClassicLinkDnsSupported *bool `locationName:"classicLinkDnsSupported" type:"boolean"` + + // The ID of the VPC. + VpcId *string `locationName:"vpcId" type:"string"` +} + +// String returns the string representation +func (s ClassicLinkDnsSupport) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ClassicLinkDnsSupport) GoString() string { + return s.String() +} + // Describes a linked EC2-Classic instance. type ClassicLinkInstance struct { _ struct{} `type:"structure"` @@ -9053,17 +9445,17 @@ type CreateReservedInstancesListingInput struct { // Ensuring Idempotency (http://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html). ClientToken *string `locationName:"clientToken" type:"string" required:"true"` - // The number of instances that are a part of a Reserved instance account to + // The number of instances that are a part of a Reserved Instance account to // be listed in the Reserved Instance Marketplace. This number should be less - // than or equal to the instance count associated with the Reserved instance + // than or equal to the instance count associated with the Reserved Instance // ID specified in this call. InstanceCount *int64 `locationName:"instanceCount" type:"integer" required:"true"` - // A list specifying the price of the Reserved instance for each month remaining - // in the Reserved instance term. + // A list specifying the price of the Reserved Instance for each month remaining + // in the Reserved Instance term. PriceSchedules []*PriceScheduleSpecification `locationName:"priceSchedules" locationNameList:"item" type:"list" required:"true"` - // The ID of the active Reserved instance. + // The ID of the active Reserved Instance. ReservedInstancesId *string `locationName:"reservedInstancesId" type:"string" required:"true"` } @@ -9080,7 +9472,7 @@ func (s CreateReservedInstancesListingInput) GoString() string { type CreateReservedInstancesListingOutput struct { _ struct{} `type:"structure"` - // Information about the Reserved instance listing. + // Information about the Reserved Instance listing. ReservedInstancesListings []*ReservedInstancesListing `locationName:"reservedInstancesListingsSet" locationNameList:"item" type:"list"` } @@ -12020,7 +12412,8 @@ type DescribeInstancesInput struct { // // instance-id - The ID of the instance. // - // instance-lifecycle - Indicates whether this is a Spot Instance (spot). + // instance-lifecycle - Indicates whether this is a Spot Instance or a Scheduled + // Instance (spot | scheduled). // // instance-state-code - The state of the instance, as a 16-bit unsigned // integer. The high byte is an opaque internal value and should be ignored. @@ -12146,7 +12539,7 @@ type DescribeInstancesInput struct { // // network-interface.mac-address - The MAC address of the network interface. // - // network-interface-private-dns-name - The private DNS name of the network + // network-interface.private-dns-name - The private DNS name of the network // interface. // // network-interface.source-dest-check - Whether the network interface performs @@ -12952,20 +13345,20 @@ type DescribeReservedInstancesInput struct { // One or more filters. // - // availability-zone - The Availability Zone where the Reserved instance + // availability-zone - The Availability Zone where the Reserved Instance // can be used. // - // duration - The duration of the Reserved instance (one year or three years), + // duration - The duration of the Reserved Instance (one year or three years), // in seconds (31536000 | 94608000). // - // end - The time when the Reserved instance expires (for example, 2015-08-07T11:54:42.000Z). + // end - The time when the Reserved Instance expires (for example, 2015-08-07T11:54:42.000Z). // - // fixed-price - The purchase price of the Reserved instance (for example, + // fixed-price - The purchase price of the Reserved Instance (for example, // 9800.0). // // instance-type - The instance type that is covered by the reservation. // - // product-description - The Reserved instance product platform description. + // product-description - The Reserved Instance product platform description. // Instances that include (Amazon VPC) in the product platform description will // only be displayed to EC2-Classic account holders and are for use with Amazon // VPC (Linux/UNIX | Linux/UNIX (Amazon VPC) | SUSE Linux | SUSE Linux (Amazon @@ -12975,12 +13368,12 @@ type DescribeReservedInstancesInput struct { // with SQL Server Web (Amazon VPC) | Windows with SQL Server Enterprise | Windows // with SQL Server Enterprise (Amazon VPC)). // - // reserved-instances-id - The ID of the Reserved instance. + // reserved-instances-id - The ID of the Reserved Instance. // - // start - The time at which the Reserved instance purchase request was placed + // start - The time at which the Reserved Instance purchase request was placed // (for example, 2014-08-07T11:54:42.000Z). // - // state - The state of the Reserved instance (payment-pending | active | + // state - The state of the Reserved Instance (payment-pending | active | // payment-failed | retired). // // tag:key=value - The key/value combination of a tag assigned to the resource. @@ -12995,18 +13388,18 @@ type DescribeReservedInstancesInput struct { // tag-value - The value of a tag assigned to the resource. This filter is // independent of the tag-key filter. // - // usage-price - The usage price of the Reserved instance, per hour (for + // usage-price - The usage price of the Reserved Instance, per hour (for // example, 0.84). Filters []*Filter `locationName:"Filter" locationNameList:"Filter" type:"list"` - // The Reserved instance offering type. If you are using tools that predate + // The Reserved Instance offering type. If you are using tools that predate // the 2011-11-01 API version, you only have access to the Medium Utilization - // Reserved instance offering type. + // Reserved Instance offering type. OfferingType *string `locationName:"offeringType" type:"string" enum:"OfferingTypeValues"` - // One or more Reserved instance IDs. + // One or more Reserved Instance IDs. // - // Default: Describes all your Reserved instances, or only those otherwise + // Default: Describes all your Reserved Instances, or only those otherwise // specified. ReservedInstancesIds []*string `locationName:"ReservedInstancesId" locationNameList:"ReservedInstancesId" type:"list"` } @@ -13026,20 +13419,20 @@ type DescribeReservedInstancesListingsInput struct { // One or more filters. // - // reserved-instances-id - The ID of the Reserved instances. + // reserved-instances-id - The ID of the Reserved Instances. // - // reserved-instances-listing-id - The ID of the Reserved instances listing. + // reserved-instances-listing-id - The ID of the Reserved Instances listing. // - // status - The status of the Reserved instance listing (pending | active + // status - The status of the Reserved Instance listing (pending | active // | cancelled | closed). // // status-message - The reason for the status. Filters []*Filter `locationName:"filters" locationNameList:"Filter" type:"list"` - // One or more Reserved instance IDs. + // One or more Reserved Instance IDs. ReservedInstancesId *string `locationName:"reservedInstancesId" type:"string"` - // One or more Reserved instance Listing IDs. + // One or more Reserved Instance listing IDs. ReservedInstancesListingId *string `locationName:"reservedInstancesListingId" type:"string"` } @@ -13056,7 +13449,7 @@ func (s DescribeReservedInstancesListingsInput) GoString() string { type DescribeReservedInstancesListingsOutput struct { _ struct{} `type:"structure"` - // Information about the Reserved instance listing. + // Information about the Reserved Instance listing. ReservedInstancesListings []*ReservedInstancesListing `locationName:"reservedInstancesListingsSet" locationNameList:"item" type:"list"` } @@ -13081,27 +13474,27 @@ type DescribeReservedInstancesModificationsInput struct { // // effective-date - The time when the modification becomes effective. // - // modification-result.reserved-instances-id - The ID for the Reserved instances + // modification-result.reserved-instances-id - The ID for the Reserved Instances // created as part of the modification request. This ID is only available when // the status of the modification is fulfilled. // // modification-result.target-configuration.availability-zone - The Availability - // Zone for the new Reserved instances. + // Zone for the new Reserved Instances. // // modification-result.target-configuration.instance-count - The number - // of new Reserved instances. + // of new Reserved Instances. // // modification-result.target-configuration.instance-type - The instance - // type of the new Reserved instances. + // type of the new Reserved Instances. // // modification-result.target-configuration.platform - The network platform - // of the new Reserved instances (EC2-Classic | EC2-VPC). + // of the new Reserved Instances (EC2-Classic | EC2-VPC). // - // reserved-instances-id - The ID of the Reserved instances modified. + // reserved-instances-id - The ID of the Reserved Instances modified. // // reserved-instances-modification-id - The ID of the modification request. // - // status - The status of the Reserved instances modification request (processing + // status - The status of the Reserved Instances modification request (processing // | fulfilled | failed). // // status-message - The reason for the status. @@ -13133,7 +13526,7 @@ type DescribeReservedInstancesModificationsOutput struct { // when there are no more results to return. NextToken *string `locationName:"nextToken" type:"string"` - // The Reserved instance modification information. + // The Reserved Instance modification information. ReservedInstancesModifications []*ReservedInstancesModification `locationName:"reservedInstancesModificationsSet" locationNameList:"item" type:"list"` } @@ -13150,7 +13543,7 @@ func (s DescribeReservedInstancesModificationsOutput) GoString() string { type DescribeReservedInstancesOfferingsInput struct { _ struct{} `type:"structure"` - // The Availability Zone in which the Reserved instance can be used. + // The Availability Zone in which the Reserved Instance can be used. AvailabilityZone *string `type:"string"` // Checks whether you have the required permissions for the action, without @@ -13161,13 +13554,13 @@ type DescribeReservedInstancesOfferingsInput struct { // One or more filters. // - // availability-zone - The Availability Zone where the Reserved instance + // availability-zone - The Availability Zone where the Reserved Instance // can be used. // - // duration - The duration of the Reserved instance (for example, one year + // duration - The duration of the Reserved Instance (for example, one year // or three years), in seconds (31536000 | 94608000). // - // fixed-price - The purchase price of the Reserved instance (for example, + // fixed-price - The purchase price of the Reserved Instance (for example, // 9800.0). // // instance-type - The instance type that is covered by the reservation. @@ -13176,7 +13569,7 @@ type DescribeReservedInstancesOfferingsInput struct { // When this filter is not used, which is the default behavior, all offerings // from both AWS and the Reserved Instance Marketplace are listed. // - // product-description - The Reserved instance product platform description. + // product-description - The Reserved Instance product platform description. // Instances that include (Amazon VPC) in the product platform description will // only be displayed to EC2-Classic account holders and are for use with Amazon // VPC. (Linux/UNIX | Linux/UNIX (Amazon VPC) | SUSE Linux | SUSE Linux (Amazon @@ -13186,18 +13579,18 @@ type DescribeReservedInstancesOfferingsInput struct { // with SQL Server Web (Amazon VPC) | Windows with SQL Server Enterprise | Windows // with SQL Server Enterprise (Amazon VPC)) // - // reserved-instances-offering-id - The Reserved instances' offering ID. + // reserved-instances-offering-id - The Reserved Instances offering ID. // - // usage-price - The usage price of the Reserved instance, per hour (for + // usage-price - The usage price of the Reserved Instance, per hour (for // example, 0.84). Filters []*Filter `locationName:"Filter" locationNameList:"Filter" type:"list"` // Include Reserved Instance Marketplace offerings in the response. IncludeMarketplace *bool `type:"boolean"` - // The tenancy of the instances covered by the reservation. A Reserved instance + // The tenancy of the instances covered by the reservation. A Reserved Instance // with a tenancy of dedicated is applied to instances that run in a VPC on - // single-tenant hardware (i.e., Dedicated instances). + // single-tenant hardware (i.e., Dedicated Instances). // // Default: default InstanceTenancy *string `locationName:"instanceTenancy" type:"string" enum:"Tenancy"` @@ -13232,16 +13625,16 @@ type DescribeReservedInstancesOfferingsInput struct { // The token to retrieve the next page of results. NextToken *string `locationName:"nextToken" type:"string"` - // The Reserved instance offering type. If you are using tools that predate + // The Reserved Instance offering type. If you are using tools that predate // the 2011-11-01 API version, you only have access to the Medium Utilization - // Reserved instance offering type. + // Reserved Instance offering type. OfferingType *string `locationName:"offeringType" type:"string" enum:"OfferingTypeValues"` - // The Reserved instance product platform description. Instances that include + // The Reserved Instance product platform description. Instances that include // (Amazon VPC) in the description are for use with Amazon VPC. ProductDescription *string `type:"string" enum:"RIProductDescription"` - // One or more Reserved instances offering IDs. + // One or more Reserved Instances offering IDs. ReservedInstancesOfferingIds []*string `locationName:"ReservedInstancesOfferingId" type:"list"` } @@ -13262,7 +13655,7 @@ type DescribeReservedInstancesOfferingsOutput struct { // when there are no more results to return. NextToken *string `locationName:"nextToken" type:"string"` - // A list of Reserved instances offerings. + // A list of Reserved Instances offerings. ReservedInstancesOfferings []*ReservedInstancesOffering `locationName:"reservedInstancesOfferingsSet" locationNameList:"item" type:"list"` } @@ -13279,7 +13672,7 @@ func (s DescribeReservedInstancesOfferingsOutput) GoString() string { type DescribeReservedInstancesOutput struct { _ struct{} `type:"structure"` - // A list of Reserved instances. + // A list of Reserved Instances. ReservedInstances []*ReservedInstances `locationName:"reservedInstancesSet" locationNameList:"item" type:"list"` } @@ -13392,126 +13785,272 @@ func (s DescribeRouteTablesOutput) GoString() string { return s.String() } -type DescribeSecurityGroupsInput struct { +// Contains the parameters for DescribeScheduledInstanceAvailability. +type DescribeScheduledInstanceAvailabilityInput struct { _ struct{} `type:"structure"` // Checks whether you have the required permissions for the action, without // actually making the request, and provides an error response. If you have // the required permissions, the error response is DryRunOperation. Otherwise, // it is UnauthorizedOperation. - DryRun *bool `locationName:"dryRun" type:"boolean"` + DryRun *bool `type:"boolean"` - // One or more filters. If using multiple filters for rules, the results include - // security groups for which any combination of rules - not necessarily a single - // rule - match all filters. - // - // description - The description of the security group. - // - // egress.ip-permission.prefix-list-id - The ID (prefix) of the AWS service - // to which the security group allows access. - // - // group-id - The ID of the security group. - // - // group-name - The name of the security group. - // - // ip-permission.cidr - A CIDR range that has been granted permission. - // - // ip-permission.from-port - The start of port range for the TCP and UDP - // protocols, or an ICMP type number. - // - // ip-permission.group-id - The ID of a security group that has been granted - // permission. - // - // ip-permission.group-name - The name of a security group that has been - // granted permission. - // - // ip-permission.protocol - The IP protocol for the permission (tcp | udp - // | icmp or a protocol number). - // - // ip-permission.to-port - The end of port range for the TCP and UDP protocols, - // or an ICMP code. - // - // ip-permission.user-id - The ID of an AWS account that has been granted - // permission. + // One or more filters. // - // owner-id - The AWS account ID of the owner of the security group. + // availability-zone - The Availability Zone (for example, us-west-2a). // - // tag-key - The key of a tag assigned to the security group. + // instance-type - The instance type (for example, c4.large). // - // tag-value - The value of a tag assigned to the security group. + // network-platform - The network platform (EC2-Classic or EC2-VPC). // - // vpc-id - The ID of the VPC specified when the security group was created. + // platform - The platform (Linux/UNIX or Windows). Filters []*Filter `locationName:"Filter" locationNameList:"Filter" type:"list"` - // One or more security group IDs. Required for security groups in a nondefault - // VPC. - // - // Default: Describes all your security groups. - GroupIds []*string `locationName:"GroupId" locationNameList:"groupId" type:"list"` + // The time period for the first schedule to start. + FirstSlotStartTimeRange *SlotDateTimeRangeRequest `type:"structure" required:"true"` - // [EC2-Classic and default VPC only] One or more security group names. You - // can specify either the security group name or the security group ID. For - // security groups in a nondefault VPC, use the group-name filter to describe - // security groups by name. - // - // Default: Describes all your security groups. - GroupNames []*string `locationName:"GroupName" locationNameList:"GroupName" type:"list"` + // The maximum number of results to return in a single call. This value can + // be between 5 and 300. The default value is 300. To retrieve the remaining + // results, make another call with the returned NextToken value. + MaxResults *int64 `type:"integer"` + + // The maximum available duration, in hours. This value must be greater than + // MinSlotDurationInHours and less than 1,720. + MaxSlotDurationInHours *int64 `type:"integer"` + + // The minimum available duration, in hours. The minimum required duration is + // 1,200 hours per year. For example, the minimum daily schedule is 4 hours, + // the minimum weekly schedule is 24 hours, and the minimum monthly schedule + // is 100 hours. + MinSlotDurationInHours *int64 `type:"integer"` + + // The token for the next set of results. + NextToken *string `type:"string"` + + // The schedule recurrence. + Recurrence *ScheduledInstanceRecurrenceRequest `type:"structure" required:"true"` } // String returns the string representation -func (s DescribeSecurityGroupsInput) String() string { +func (s DescribeScheduledInstanceAvailabilityInput) String() string { return awsutil.Prettify(s) } // GoString returns the string representation -func (s DescribeSecurityGroupsInput) GoString() string { +func (s DescribeScheduledInstanceAvailabilityInput) GoString() string { return s.String() } -type DescribeSecurityGroupsOutput struct { +// Contains the output of DescribeScheduledInstanceAvailability. +type DescribeScheduledInstanceAvailabilityOutput struct { _ struct{} `type:"structure"` - // Information about one or more security groups. - SecurityGroups []*SecurityGroup `locationName:"securityGroupInfo" locationNameList:"item" type:"list"` + // The token required to retrieve the next set of results. This value is null + // when there are no more results to return. + NextToken *string `locationName:"nextToken" type:"string"` + + // Information about the available Scheduled Instances. + ScheduledInstanceAvailabilitySet []*ScheduledInstanceAvailability `locationName:"scheduledInstanceAvailabilitySet" locationNameList:"item" type:"list"` } // String returns the string representation -func (s DescribeSecurityGroupsOutput) String() string { +func (s DescribeScheduledInstanceAvailabilityOutput) String() string { return awsutil.Prettify(s) } // GoString returns the string representation -func (s DescribeSecurityGroupsOutput) GoString() string { +func (s DescribeScheduledInstanceAvailabilityOutput) GoString() string { return s.String() } -type DescribeSnapshotAttributeInput struct { +// Contains the parameters for DescribeScheduledInstances. +type DescribeScheduledInstancesInput struct { _ struct{} `type:"structure"` - // The snapshot attribute you would like to view. - Attribute *string `type:"string" required:"true" enum:"SnapshotAttributeName"` - // Checks whether you have the required permissions for the action, without // actually making the request, and provides an error response. If you have // the required permissions, the error response is DryRunOperation. Otherwise, // it is UnauthorizedOperation. - DryRun *bool `locationName:"dryRun" type:"boolean"` + DryRun *bool `type:"boolean"` - // The ID of the EBS snapshot. - SnapshotId *string `type:"string" required:"true"` + // One or more filters. + // + // availability-zone - The Availability Zone (for example, us-west-2a). + // + // instance-type - The instance type (for example, c4.large). + // + // network-platform - The network platform (EC2-Classic or EC2-VPC). + // + // platform - The platform (Linux/UNIX or Windows). + Filters []*Filter `locationName:"Filter" locationNameList:"Filter" type:"list"` + + // The maximum number of results to return in a single call. This value can + // be between 5 and 300. The default value is 100. To retrieve the remaining + // results, make another call with the returned NextToken value. + MaxResults *int64 `type:"integer"` + + // The token for the next set of results. + NextToken *string `type:"string"` + + // One or more Scheduled Instance IDs. + ScheduledInstanceIds []*string `locationName:"ScheduledInstanceId" locationNameList:"ScheduledInstanceId" type:"list"` + + // The time period for the first schedule to start. + SlotStartTimeRange *SlotStartTimeRangeRequest `type:"structure"` } // String returns the string representation -func (s DescribeSnapshotAttributeInput) String() string { +func (s DescribeScheduledInstancesInput) String() string { return awsutil.Prettify(s) } // GoString returns the string representation -func (s DescribeSnapshotAttributeInput) GoString() string { +func (s DescribeScheduledInstancesInput) GoString() string { return s.String() } -type DescribeSnapshotAttributeOutput struct { +// Contains the output of DescribeScheduledInstances. +type DescribeScheduledInstancesOutput struct { + _ struct{} `type:"structure"` + + // The token required to retrieve the next set of results. This value is null + // when there are no more results to return. + NextToken *string `locationName:"nextToken" type:"string"` + + // Information about the Scheduled Instances. + ScheduledInstanceSet []*ScheduledInstance `locationName:"scheduledInstanceSet" locationNameList:"item" type:"list"` +} + +// String returns the string representation +func (s DescribeScheduledInstancesOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DescribeScheduledInstancesOutput) GoString() string { + return s.String() +} + +type DescribeSecurityGroupsInput struct { + _ struct{} `type:"structure"` + + // Checks whether you have the required permissions for the action, without + // actually making the request, and provides an error response. If you have + // the required permissions, the error response is DryRunOperation. Otherwise, + // it is UnauthorizedOperation. + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // One or more filters. If using multiple filters for rules, the results include + // security groups for which any combination of rules - not necessarily a single + // rule - match all filters. + // + // description - The description of the security group. + // + // egress.ip-permission.prefix-list-id - The ID (prefix) of the AWS service + // to which the security group allows access. + // + // group-id - The ID of the security group. + // + // group-name - The name of the security group. + // + // ip-permission.cidr - A CIDR range that has been granted permission. + // + // ip-permission.from-port - The start of port range for the TCP and UDP + // protocols, or an ICMP type number. + // + // ip-permission.group-id - The ID of a security group that has been granted + // permission. + // + // ip-permission.group-name - The name of a security group that has been + // granted permission. + // + // ip-permission.protocol - The IP protocol for the permission (tcp | udp + // | icmp or a protocol number). + // + // ip-permission.to-port - The end of port range for the TCP and UDP protocols, + // or an ICMP code. + // + // ip-permission.user-id - The ID of an AWS account that has been granted + // permission. + // + // owner-id - The AWS account ID of the owner of the security group. + // + // tag-key - The key of a tag assigned to the security group. + // + // tag-value - The value of a tag assigned to the security group. + // + // vpc-id - The ID of the VPC specified when the security group was created. + Filters []*Filter `locationName:"Filter" locationNameList:"Filter" type:"list"` + + // One or more security group IDs. Required for security groups in a nondefault + // VPC. + // + // Default: Describes all your security groups. + GroupIds []*string `locationName:"GroupId" locationNameList:"groupId" type:"list"` + + // [EC2-Classic and default VPC only] One or more security group names. You + // can specify either the security group name or the security group ID. For + // security groups in a nondefault VPC, use the group-name filter to describe + // security groups by name. + // + // Default: Describes all your security groups. + GroupNames []*string `locationName:"GroupName" locationNameList:"GroupName" type:"list"` +} + +// String returns the string representation +func (s DescribeSecurityGroupsInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DescribeSecurityGroupsInput) GoString() string { + return s.String() +} + +type DescribeSecurityGroupsOutput struct { + _ struct{} `type:"structure"` + + // Information about one or more security groups. + SecurityGroups []*SecurityGroup `locationName:"securityGroupInfo" locationNameList:"item" type:"list"` +} + +// String returns the string representation +func (s DescribeSecurityGroupsOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DescribeSecurityGroupsOutput) GoString() string { + return s.String() +} + +type DescribeSnapshotAttributeInput struct { + _ struct{} `type:"structure"` + + // The snapshot attribute you would like to view. + Attribute *string `type:"string" required:"true" enum:"SnapshotAttributeName"` + + // Checks whether you have the required permissions for the action, without + // actually making the request, and provides an error response. If you have + // the required permissions, the error response is DryRunOperation. Otherwise, + // it is UnauthorizedOperation. + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // The ID of the EBS snapshot. + SnapshotId *string `type:"string" required:"true"` +} + +// String returns the string representation +func (s DescribeSnapshotAttributeInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DescribeSnapshotAttributeInput) GoString() string { + return s.String() +} + +type DescribeSnapshotAttributeOutput struct { _ struct{} `type:"structure"` // A list of permissions for creating volumes from the snapshot. @@ -14552,6 +15091,52 @@ func (s DescribeVpcAttributeOutput) GoString() string { return s.String() } +type DescribeVpcClassicLinkDnsSupportInput struct { + _ struct{} `type:"structure"` + + // The maximum number of items to return for this request. The request returns + // a token that you can specify in a subsequent call to get the next set of + // results. + MaxResults *int64 `locationName:"maxResults" min:"5" type:"integer"` + + // The token for the next set of items to return. (You received this token from + // a prior call.) + NextToken *string `locationName:"nextToken" min:"1" type:"string"` + + // One or more VPC IDs. + VpcIds []*string `locationNameList:"VpcId" type:"list"` +} + +// String returns the string representation +func (s DescribeVpcClassicLinkDnsSupportInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DescribeVpcClassicLinkDnsSupportInput) GoString() string { + return s.String() +} + +type DescribeVpcClassicLinkDnsSupportOutput struct { + _ struct{} `type:"structure"` + + // The token to use when requesting the next set of items. + NextToken *string `locationName:"nextToken" min:"1" type:"string"` + + // Information about the ClassicLink DNS support status of the VPCs. + Vpcs []*ClassicLinkDnsSupport `locationName:"vpcs" locationNameList:"item" type:"list"` +} + +// String returns the string representation +func (s DescribeVpcClassicLinkDnsSupportOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DescribeVpcClassicLinkDnsSupportOutput) GoString() string { + return s.String() +} + type DescribeVpcClassicLinkInput struct { _ struct{} `type:"structure"` @@ -14979,7 +15564,8 @@ type DescribeVpnGatewaysInput struct { // // attachment.vpc-id - The ID of an attached VPC. // - // availability-zone - The Availability Zone for the virtual private gateway. + // availability-zone - The Availability Zone for the virtual private gateway + // (if applicable). // // state - The state of the virtual private gateway (pending | available // | deleting | deleted). @@ -15315,6 +15901,40 @@ func (s DisableVgwRoutePropagationOutput) GoString() string { return s.String() } +type DisableVpcClassicLinkDnsSupportInput struct { + _ struct{} `type:"structure"` + + // The ID of the VPC. + VpcId *string `type:"string"` +} + +// String returns the string representation +func (s DisableVpcClassicLinkDnsSupportInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DisableVpcClassicLinkDnsSupportInput) GoString() string { + return s.String() +} + +type DisableVpcClassicLinkDnsSupportOutput struct { + _ struct{} `type:"structure"` + + // Returns true if the request succeeds; otherwise, it returns an error. + Return *bool `locationName:"return" type:"boolean"` +} + +// String returns the string representation +func (s DisableVpcClassicLinkDnsSupportOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DisableVpcClassicLinkDnsSupportOutput) GoString() string { + return s.String() +} + type DisableVpcClassicLinkInput struct { _ struct{} `type:"structure"` @@ -15472,6 +16092,9 @@ type DiskImageDescription struct { // Request Authentication Alternative" section of the Authenticating REST Requests // (http://docs.aws.amazon.com/AmazonS3/latest/dev/RESTAuthentication.html) // topic in the Amazon Simple Storage Service Developer Guide. + // + // For information about the import manifest referenced by this API action, + // see VM Import Manifest (http://docs.aws.amazon.com/AWSEC2/latest/APIReference/manifest.html). ImportManifestUrl *string `locationName:"importManifestUrl" type:"string" required:"true"` // The size of the disk image, in GiB. @@ -15503,6 +16126,9 @@ type DiskImageDetail struct { // URL for an Amazon S3 object, read the "Query String Request Authentication // Alternative" section of the Authenticating REST Requests (http://docs.aws.amazon.com/AmazonS3/latest/dev/RESTAuthentication.html) // topic in the Amazon Simple Storage Service Developer Guide. + // + // For information about the import manifest referenced by this API action, + // see VM Import Manifest (http://docs.aws.amazon.com/AWSEC2/latest/APIReference/manifest.html). ImportManifestUrl *string `locationName:"importManifestUrl" type:"string" required:"true"` } @@ -15711,6 +16337,40 @@ func (s EnableVolumeIOOutput) GoString() string { return s.String() } +type EnableVpcClassicLinkDnsSupportInput struct { + _ struct{} `type:"structure"` + + // The ID of the VPC. + VpcId *string `type:"string"` +} + +// String returns the string representation +func (s EnableVpcClassicLinkDnsSupportInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s EnableVpcClassicLinkDnsSupportInput) GoString() string { + return s.String() +} + +type EnableVpcClassicLinkDnsSupportOutput struct { + _ struct{} `type:"structure"` + + // Returns true if the request succeeds; otherwise, it returns an error. + Return *bool `locationName:"return" type:"boolean"` +} + +// String returns the string representation +func (s EnableVpcClassicLinkDnsSupportOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s EnableVpcClassicLinkDnsSupportOutput) GoString() string { + return s.String() +} + type EnableVpcClassicLinkInput struct { _ struct{} `type:"structure"` @@ -16018,7 +16678,8 @@ type GetConsoleOutputOutput struct { // The ID of the instance. InstanceId *string `locationName:"instanceId" type:"string"` - // The console output, Base64 encoded. + // The console output, Base64 encoded. If using a command line tool, the tools + // decode the output for you. Output *string `locationName:"output" type:"string"` // The time the output was last updated. @@ -16292,7 +16953,8 @@ type IdFormat struct { _ struct{} `type:"structure"` // The date in UTC at which you are permanently switched over to using longer - // IDs. + // IDs. If a deadline is not yet available for this resource type, this field + // is not returned. Deadline *time.Time `locationName:"deadline" type:"timestamp" timestampFormat:"iso8601"` // The type of resource. @@ -16775,6 +17437,8 @@ type ImportKeyPairInput struct { // The public key. You must base64 encode the public key material before sending // it to AWS. + // + // PublicKeyMaterial is automatically base64 encoded/decoded by the SDK. PublicKeyMaterial []byte `locationName:"publicKeyMaterial" type:"blob" required:"true"` } @@ -17005,7 +17669,7 @@ type Instance struct { // The ID of the instance. InstanceId *string `locationName:"instanceId" type:"string"` - // Indicates whether this is a Spot instance. + // Indicates whether this is a Spot instance or a Scheduled Instance. InstanceLifecycle *string `locationName:"instanceLifecycle" type:"string" enum:"InstanceLifecycleType"` // The instance type. @@ -17186,14 +17850,14 @@ func (s InstanceCapacity) GoString() string { return s.String() } -// Describes a Reserved instance listing state. +// Describes a Reserved Instance listing state. type InstanceCount struct { _ struct{} `type:"structure"` - // The number of listed Reserved instances in the state specified by the state. + // The number of listed Reserved Instances in the state specified by the state. InstanceCount *int64 `locationName:"instanceCount" type:"integer"` - // The states of the listed Reserved instances. + // The states of the listed Reserved Instances. State *string `locationName:"state" type:"string" enum:"ListingState"` } @@ -18216,10 +18880,10 @@ type ModifyReservedInstancesInput struct { // modification request. For more information, see Ensuring Idempotency (http://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html). ClientToken *string `locationName:"clientToken" type:"string"` - // The IDs of the Reserved instances to modify. + // The IDs of the Reserved Instances to modify. ReservedInstancesIds []*string `locationName:"ReservedInstancesId" locationNameList:"ReservedInstancesId" type:"list" required:"true"` - // The configuration settings for the Reserved instances to modify. + // The configuration settings for the Reserved Instances to modify. TargetConfigurations []*ReservedInstancesConfiguration `locationName:"ReservedInstancesConfigurationSetItemType" locationNameList:"item" type:"list" required:"true"` } @@ -18661,7 +19325,7 @@ type NatGateway struct { // If the NAT gateway could not be created, specifies the error code for the // failure. (InsufficientFreeAddressesInSubnet | Gateway.NotAttached | InvalidAllocationID.NotFound - // | Resource.AlreadyAssociated | InternalError) + // | Resource.AlreadyAssociated | InternalError | InvalidSubnetID.NotFound) FailureCode *string `locationName:"failureCode" type:"string"` // If the NAT gateway could not be created, specifies the error message for @@ -18674,6 +19338,8 @@ type NatGateway struct { // For Resource.AlreadyAssociated: Elastic IP address eipalloc-xxxxxxxx is already // associated For InternalError: Network interface eni-xxxxxxxx, created and // used internally by this NAT gateway is in an invalid state. Please try again. + // For InvalidSubnetID.NotFound: The specified subnet subnet-xxxxxxxx does not + // exist or could not be found. FailureMessage *string `locationName:"failureMessage" type:"string"` // Information about the IP addresses and network interface associated with @@ -19155,15 +19821,15 @@ func (s PrefixListId) GoString() string { return s.String() } -// Describes the price for a Reserved instance. +// Describes the price for a Reserved Instance. type PriceSchedule struct { _ struct{} `type:"structure"` // The current price schedule, as determined by the term remaining for the Reserved - // instance in the listing. + // Instance in the listing. // // A specific price schedule is always in effect, but only one price schedule - // can be active at any time. Take, for example, a Reserved instance listing + // can be active at any time. Take, for example, a Reserved Instance listing // that has five months remaining in its term. When you specify price schedules // for five months and two months, this means that schedule 1, covering the // first three months of the remaining term, will be active during months 5, @@ -19171,7 +19837,7 @@ type PriceSchedule struct { // be active for months 2 and 1. Active *bool `locationName:"active" type:"boolean"` - // The currency for transacting the Reserved instance resale. At this time, + // The currency for transacting the Reserved Instance resale. At this time, // the only supported currency is USD. CurrencyCode *string `locationName:"currencyCode" type:"string" enum:"CurrencyCodeValues"` @@ -19193,11 +19859,11 @@ func (s PriceSchedule) GoString() string { return s.String() } -// Describes the price for a Reserved instance. +// Describes the price for a Reserved Instance. type PriceScheduleSpecification struct { _ struct{} `type:"structure"` - // The currency for transacting the Reserved instance resale. At this time, + // The currency for transacting the Reserved Instance resale. At this time, // the only supported currency is USD. CurrencyCode *string `locationName:"currencyCode" type:"string" enum:"CurrencyCodeValues"` @@ -19219,7 +19885,7 @@ func (s PriceScheduleSpecification) GoString() string { return s.String() } -// Describes a Reserved instance offering. +// Describes a Reserved Instance offering. type PricingDetail struct { _ struct{} `type:"structure"` @@ -19301,6 +19967,27 @@ func (s PropagatingVgw) GoString() string { return s.String() } +// Describes a request to purchase Scheduled Instances. +type PurchaseRequest struct { + _ struct{} `type:"structure"` + + // The number of instances. + InstanceCount *int64 `type:"integer" required:"true"` + + // The purchase token. + PurchaseToken *string `type:"string" required:"true"` +} + +// String returns the string representation +func (s PurchaseRequest) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s PurchaseRequest) GoString() string { + return s.String() +} + type PurchaseReservedInstancesOfferingInput struct { _ struct{} `type:"structure"` @@ -19310,15 +19997,15 @@ type PurchaseReservedInstancesOfferingInput struct { // it is UnauthorizedOperation. DryRun *bool `locationName:"dryRun" type:"boolean"` - // The number of Reserved instances to purchase. + // The number of Reserved Instances to purchase. InstanceCount *int64 `type:"integer" required:"true"` // Specified for Reserved Instance Marketplace offerings to limit the total - // order and ensure that the Reserved instances are not purchased at unexpected + // order and ensure that the Reserved Instances are not purchased at unexpected // prices. LimitPrice *ReservedInstanceLimitPrice `locationName:"limitPrice" type:"structure"` - // The ID of the Reserved instance offering to purchase. + // The ID of the Reserved Instance offering to purchase. ReservedInstancesOfferingId *string `type:"string" required:"true"` } @@ -19335,7 +20022,7 @@ func (s PurchaseReservedInstancesOfferingInput) GoString() string { type PurchaseReservedInstancesOfferingOutput struct { _ struct{} `type:"structure"` - // The IDs of the purchased Reserved instances. + // The IDs of the purchased Reserved Instances. ReservedInstancesId *string `locationName:"reservedInstancesId" type:"string"` } @@ -19349,45 +20036,91 @@ func (s PurchaseReservedInstancesOfferingOutput) GoString() string { return s.String() } -type RebootInstancesInput struct { +// Contains the parameters for PurchaseScheduledInstances. +type PurchaseScheduledInstancesInput struct { _ struct{} `type:"structure"` + // Unique, case-sensitive identifier that ensures the idempotency of the request. + // For more information, see Ensuring Idempotency (http://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html). + ClientToken *string `type:"string" idempotencyToken:"true"` + // Checks whether you have the required permissions for the action, without // actually making the request, and provides an error response. If you have // the required permissions, the error response is DryRunOperation. Otherwise, // it is UnauthorizedOperation. - DryRun *bool `locationName:"dryRun" type:"boolean"` + DryRun *bool `type:"boolean"` - // One or more instance IDs. - InstanceIds []*string `locationName:"InstanceId" locationNameList:"InstanceId" type:"list" required:"true"` + // One or more purchase requests. + PurchaseRequests []*PurchaseRequest `locationName:"PurchaseRequest" locationNameList:"PurchaseRequest" min:"1" type:"list" required:"true"` } // String returns the string representation -func (s RebootInstancesInput) String() string { +func (s PurchaseScheduledInstancesInput) String() string { return awsutil.Prettify(s) } // GoString returns the string representation -func (s RebootInstancesInput) GoString() string { +func (s PurchaseScheduledInstancesInput) GoString() string { return s.String() } -type RebootInstancesOutput struct { +// Contains the output of PurchaseScheduledInstances. +type PurchaseScheduledInstancesOutput struct { _ struct{} `type:"structure"` + + // Information about the Scheduled Instances. + ScheduledInstanceSet []*ScheduledInstance `locationName:"scheduledInstanceSet" locationNameList:"item" type:"list"` } // String returns the string representation -func (s RebootInstancesOutput) String() string { +func (s PurchaseScheduledInstancesOutput) String() string { return awsutil.Prettify(s) } // GoString returns the string representation -func (s RebootInstancesOutput) GoString() string { +func (s PurchaseScheduledInstancesOutput) GoString() string { return s.String() } -// Describes a recurring charge. -type RecurringCharge struct { +type RebootInstancesInput struct { + _ struct{} `type:"structure"` + + // Checks whether you have the required permissions for the action, without + // actually making the request, and provides an error response. If you have + // the required permissions, the error response is DryRunOperation. Otherwise, + // it is UnauthorizedOperation. + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // One or more instance IDs. + InstanceIds []*string `locationName:"InstanceId" locationNameList:"InstanceId" type:"list" required:"true"` +} + +// String returns the string representation +func (s RebootInstancesInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s RebootInstancesInput) GoString() string { + return s.String() +} + +type RebootInstancesOutput struct { + _ struct{} `type:"structure"` +} + +// String returns the string representation +func (s RebootInstancesOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s RebootInstancesOutput) GoString() string { + return s.String() +} + +// Describes a recurring charge. +type RecurringCharge struct { _ struct{} `type:"structure"` // The amount of the recurring charge. @@ -19973,8 +20706,9 @@ type RequestSpotInstancesInput struct { // Default: Instances are launched in any available Availability Zone. AvailabilityZoneGroup *string `locationName:"availabilityZoneGroup" type:"string"` - // The required duration for the Spot instances, in minutes. This value must - // be a multiple of 60 (60, 120, 180, 240, 300, or 360). + // The required duration for the Spot instances (also known as Spot blocks), + // in minutes. This value must be a multiple of 60 (60, 120, 180, 240, 300, + // or 360). // // The duration period starts as soon as your Spot instance receives its instance // ID. At the end of the duration period, Amazon EC2 marks the Spot instance @@ -20136,7 +20870,7 @@ func (s RequestSpotLaunchSpecification) GoString() string { type Reservation struct { _ struct{} `type:"structure"` - // One or more security groups. + // [EC2-Classic only] One or more security groups. Groups []*GroupIdentifier `locationName:"groupSet" locationNameList:"item" type:"list"` // One or more instances. @@ -20163,7 +20897,7 @@ func (s Reservation) GoString() string { return s.String() } -// Describes the limit price of a Reserved instance offering. +// Describes the limit price of a Reserved Instance offering. type ReservedInstanceLimitPrice struct { _ struct{} `type:"structure"` @@ -20186,57 +20920,57 @@ func (s ReservedInstanceLimitPrice) GoString() string { return s.String() } -// Describes a Reserved instance. +// Describes a Reserved Instance. type ReservedInstances struct { _ struct{} `type:"structure"` - // The Availability Zone in which the Reserved instance can be used. + // The Availability Zone in which the Reserved Instance can be used. AvailabilityZone *string `locationName:"availabilityZone" type:"string"` - // The currency of the Reserved instance. It's specified using ISO 4217 standard + // The currency of the Reserved Instance. It's specified using ISO 4217 standard // currency codes. At this time, the only supported currency is USD. CurrencyCode *string `locationName:"currencyCode" type:"string" enum:"CurrencyCodeValues"` - // The duration of the Reserved instance, in seconds. + // The duration of the Reserved Instance, in seconds. Duration *int64 `locationName:"duration" type:"long"` - // The time when the Reserved instance expires. + // The time when the Reserved Instance expires. End *time.Time `locationName:"end" type:"timestamp" timestampFormat:"iso8601"` - // The purchase price of the Reserved instance. + // The purchase price of the Reserved Instance. FixedPrice *float64 `locationName:"fixedPrice" type:"float"` // The number of reservations purchased. InstanceCount *int64 `locationName:"instanceCount" type:"integer"` - // The tenancy of the reserved instance. + // The tenancy of the instance. InstanceTenancy *string `locationName:"instanceTenancy" type:"string" enum:"Tenancy"` - // The instance type on which the Reserved instance can be used. + // The instance type on which the Reserved Instance can be used. InstanceType *string `locationName:"instanceType" type:"string" enum:"InstanceType"` - // The Reserved instance offering type. + // The Reserved Instance offering type. OfferingType *string `locationName:"offeringType" type:"string" enum:"OfferingTypeValues"` - // The Reserved instance product platform description. + // The Reserved Instance product platform description. ProductDescription *string `locationName:"productDescription" type:"string" enum:"RIProductDescription"` // The recurring charge tag assigned to the resource. RecurringCharges []*RecurringCharge `locationName:"recurringCharges" locationNameList:"item" type:"list"` - // The ID of the Reserved instance. + // The ID of the Reserved Instance. ReservedInstancesId *string `locationName:"reservedInstancesId" type:"string"` - // The date and time the Reserved instance started. + // The date and time the Reserved Instance started. Start *time.Time `locationName:"start" type:"timestamp" timestampFormat:"iso8601"` - // The state of the Reserved instance purchase. + // The state of the Reserved Instance purchase. State *string `locationName:"state" type:"string" enum:"ReservedInstanceState"` // Any tags assigned to the resource. Tags []*Tag `locationName:"tagSet" locationNameList:"item" type:"list"` - // The usage price of the Reserved instance, per hour. + // The usage price of the Reserved Instance, per hour. UsagePrice *float64 `locationName:"usagePrice" type:"float"` } @@ -20250,20 +20984,20 @@ func (s ReservedInstances) GoString() string { return s.String() } -// Describes the configuration settings for the modified Reserved instances. +// Describes the configuration settings for the modified Reserved Instances. type ReservedInstancesConfiguration struct { _ struct{} `type:"structure"` - // The Availability Zone for the modified Reserved instances. + // The Availability Zone for the modified Reserved Instances. AvailabilityZone *string `locationName:"availabilityZone" type:"string"` - // The number of modified Reserved instances. + // The number of modified Reserved Instances. InstanceCount *int64 `locationName:"instanceCount" type:"integer"` - // The instance type for the modified Reserved instances. + // The instance type for the modified Reserved Instances. InstanceType *string `locationName:"instanceType" type:"string" enum:"InstanceType"` - // The network platform of the modified Reserved instances, which is either + // The network platform of the modified Reserved Instances, which is either // EC2-Classic or EC2-VPC. Platform *string `locationName:"platform" type:"string"` } @@ -20278,11 +21012,11 @@ func (s ReservedInstancesConfiguration) GoString() string { return s.String() } -// Describes the ID of a Reserved instance. +// Describes the ID of a Reserved Instance. type ReservedInstancesId struct { _ struct{} `type:"structure"` - // The ID of the Reserved instance. + // The ID of the Reserved Instance. ReservedInstancesId *string `locationName:"reservedInstancesId" type:"string"` } @@ -20296,7 +21030,7 @@ func (s ReservedInstancesId) GoString() string { return s.String() } -// Describes a Reserved instance listing. +// Describes a Reserved Instance listing. type ReservedInstancesListing struct { _ struct{} `type:"structure"` @@ -20310,19 +21044,19 @@ type ReservedInstancesListing struct { // The number of instances in this state. InstanceCounts []*InstanceCount `locationName:"instanceCounts" locationNameList:"item" type:"list"` - // The price of the Reserved instance listing. + // The price of the Reserved Instance listing. PriceSchedules []*PriceSchedule `locationName:"priceSchedules" locationNameList:"item" type:"list"` - // The ID of the Reserved instance. + // The ID of the Reserved Instance. ReservedInstancesId *string `locationName:"reservedInstancesId" type:"string"` - // The ID of the Reserved instance listing. + // The ID of the Reserved Instance listing. ReservedInstancesListingId *string `locationName:"reservedInstancesListingId" type:"string"` - // The status of the Reserved instance listing. + // The status of the Reserved Instance listing. Status *string `locationName:"status" type:"string" enum:"ListingStatus"` - // The reason for the current status of the Reserved instance listing. The response + // The reason for the current status of the Reserved Instance listing. The response // can be blank. StatusMessage *string `locationName:"statusMessage" type:"string"` @@ -20343,7 +21077,7 @@ func (s ReservedInstancesListing) GoString() string { return s.String() } -// Describes a Reserved instance modification. +// Describes a Reserved Instance modification. type ReservedInstancesModification struct { _ struct{} `type:"structure"` @@ -20358,16 +21092,16 @@ type ReservedInstancesModification struct { EffectiveDate *time.Time `locationName:"effectiveDate" type:"timestamp" timestampFormat:"iso8601"` // Contains target configurations along with their corresponding new Reserved - // instance IDs. + // Instance IDs. ModificationResults []*ReservedInstancesModificationResult `locationName:"modificationResultSet" locationNameList:"item" type:"list"` - // The IDs of one or more Reserved instances. + // The IDs of one or more Reserved Instances. ReservedInstancesIds []*ReservedInstancesId `locationName:"reservedInstancesSet" locationNameList:"item" type:"list"` - // A unique ID for the Reserved instance modification. + // A unique ID for the Reserved Instance modification. ReservedInstancesModificationId *string `locationName:"reservedInstancesModificationId" type:"string"` - // The status of the Reserved instances modification request. + // The status of the Reserved Instances modification request. Status *string `locationName:"status" type:"string"` // The reason for the status. @@ -20390,11 +21124,11 @@ func (s ReservedInstancesModification) GoString() string { type ReservedInstancesModificationResult struct { _ struct{} `type:"structure"` - // The ID for the Reserved instances that were created as part of the modification + // The ID for the Reserved Instances that were created as part of the modification // request. This field is only available when the modification is fulfilled. ReservedInstancesId *string `locationName:"reservedInstancesId" type:"string"` - // The target Reserved instances configurations supplied as part of the modification + // The target Reserved Instances configurations supplied as part of the modification // request. TargetConfiguration *ReservedInstancesConfiguration `locationName:"targetConfiguration" type:"structure"` } @@ -20409,28 +21143,28 @@ func (s ReservedInstancesModificationResult) GoString() string { return s.String() } -// Describes a Reserved instance offering. +// Describes a Reserved Instance offering. type ReservedInstancesOffering struct { _ struct{} `type:"structure"` - // The Availability Zone in which the Reserved instance can be used. + // The Availability Zone in which the Reserved Instance can be used. AvailabilityZone *string `locationName:"availabilityZone" type:"string"` - // The currency of the Reserved instance offering you are purchasing. It's specified + // The currency of the Reserved Instance offering you are purchasing. It's specified // using ISO 4217 standard currency codes. At this time, the only supported // currency is USD. CurrencyCode *string `locationName:"currencyCode" type:"string" enum:"CurrencyCodeValues"` - // The duration of the Reserved instance, in seconds. + // The duration of the Reserved Instance, in seconds. Duration *int64 `locationName:"duration" type:"long"` - // The purchase price of the Reserved instance. + // The purchase price of the Reserved Instance. FixedPrice *float64 `locationName:"fixedPrice" type:"float"` - // The tenancy of the reserved instance. + // The tenancy of the instance. InstanceTenancy *string `locationName:"instanceTenancy" type:"string" enum:"Tenancy"` - // The instance type on which the Reserved instance can be used. + // The instance type on which the Reserved Instance can be used. InstanceType *string `locationName:"instanceType" type:"string" enum:"InstanceType"` // Indicates whether the offering is available through the Reserved Instance @@ -20438,22 +21172,22 @@ type ReservedInstancesOffering struct { // this is true. Marketplace *bool `locationName:"marketplace" type:"boolean"` - // The Reserved instance offering type. + // The Reserved Instance offering type. OfferingType *string `locationName:"offeringType" type:"string" enum:"OfferingTypeValues"` - // The pricing details of the Reserved instance offering. + // The pricing details of the Reserved Instance offering. PricingDetails []*PricingDetail `locationName:"pricingDetailsSet" locationNameList:"item" type:"list"` - // The Reserved instance product platform description. + // The Reserved Instance product platform description. ProductDescription *string `locationName:"productDescription" type:"string" enum:"RIProductDescription"` // The recurring charge tag assigned to the resource. RecurringCharges []*RecurringCharge `locationName:"recurringCharges" locationNameList:"item" type:"list"` - // The ID of the Reserved instance offering. + // The ID of the Reserved Instance offering. ReservedInstancesOfferingId *string `locationName:"reservedInstancesOfferingId" type:"string"` - // The usage price of the Reserved instance, per hour. + // The usage price of the Reserved Instance, per hour. UsagePrice *float64 `locationName:"usagePrice" type:"float"` } @@ -21007,7 +21741,7 @@ type RunInstancesInput struct { // Constraints: Between 1 and the maximum number you're allowed for the specified // instance type. For more information about the default limits, and how to // request an increase, see How many instances can I run in Amazon EC2 (http://aws.amazon.com/ec2/faqs/#How_many_instances_can_I_run_in_Amazon_EC2) - // in the Amazon EC2 General FAQ. + // in the Amazon EC2 FAQ. MaxCount *int64 `type:"integer" required:"true"` // The minimum number of instances to launch. If you specify a minimum that @@ -21060,7 +21794,13 @@ type RunInstancesInput struct { // [EC2-VPC] The ID of the subnet to launch the instance into. SubnetId *string `type:"string"` - // The Base64-encoded MIME user data for the instances. + // Data to configure the instance, or a script to run during instance launch. + // For more information, see Running Commands on Your Linux Instance at Launch + // (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/user-data.html) (Linux) + // and Adding User Data (http://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/ec2-instance-metadata.html#instancedata-add-user-data) + // (Windows). For API calls, the text must be base64-encoded. For command line + // tools, the encoding is performed for you, and you can load the text from + // a file. UserData *string `type:"string"` } @@ -21092,6 +21832,60 @@ func (s RunInstancesMonitoringEnabled) GoString() string { return s.String() } +// Contains the parameters for RunScheduledInstances. +type RunScheduledInstancesInput struct { + _ struct{} `type:"structure"` + + // Unique, case-sensitive identifier that ensures the idempotency of the request. + // For more information, see Ensuring Idempotency (http://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html). + ClientToken *string `type:"string" idempotencyToken:"true"` + + // Checks whether you have the required permissions for the action, without + // actually making the request, and provides an error response. If you have + // the required permissions, the error response is DryRunOperation. Otherwise, + // it is UnauthorizedOperation. + DryRun *bool `type:"boolean"` + + // The number of instances. + // + // Default: 1 + InstanceCount *int64 `type:"integer"` + + // The launch specification. + LaunchSpecification *ScheduledInstancesLaunchSpecification `type:"structure" required:"true"` + + // The Scheduled Instance ID. + ScheduledInstanceId *string `type:"string" required:"true"` +} + +// String returns the string representation +func (s RunScheduledInstancesInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s RunScheduledInstancesInput) GoString() string { + return s.String() +} + +// Contains the output of RunScheduledInstances. +type RunScheduledInstancesOutput struct { + _ struct{} `type:"structure"` + + // The IDs of the newly launched instances. + InstanceIdSet []*string `locationName:"instanceIdSet" locationNameList:"item" type:"list"` +} + +// String returns the string representation +func (s RunScheduledInstancesOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s RunScheduledInstancesOutput) GoString() string { + return s.String() +} + // Describes the storage parameters for S3 and S3 buckets for an instance store-backed // AMI. type S3Storage struct { @@ -21112,6 +21906,8 @@ type S3Storage struct { // A Base64-encoded Amazon S3 upload policy that gives Amazon EC2 permission // to upload items into Amazon S3 on your behalf. + // + // UploadPolicy is automatically base64 encoded/decoded by the SDK. UploadPolicy []byte `locationName:"uploadPolicy" type:"blob"` // The signature of the Base64 encoded JSON document. @@ -21128,6 +21924,481 @@ func (s S3Storage) GoString() string { return s.String() } +// Describes a Scheduled Instance. +type ScheduledInstance struct { + _ struct{} `type:"structure"` + + // The Availability Zone. + AvailabilityZone *string `locationName:"availabilityZone" type:"string"` + + // The date when the Scheduled Instance was purchased. + CreateDate *time.Time `locationName:"createDate" type:"timestamp" timestampFormat:"iso8601"` + + // The hourly price for a single instance. + HourlyPrice *string `locationName:"hourlyPrice" type:"string"` + + // The number of instances. + InstanceCount *int64 `locationName:"instanceCount" type:"integer"` + + // The instance type. + InstanceType *string `locationName:"instanceType" type:"string"` + + // The network platform (EC2-Classic or EC2-VPC). + NetworkPlatform *string `locationName:"networkPlatform" type:"string"` + + // The time for the next schedule to start. + NextSlotStartTime *time.Time `locationName:"nextSlotStartTime" type:"timestamp" timestampFormat:"iso8601"` + + // The platform (Linux/UNIX or Windows). + Platform *string `locationName:"platform" type:"string"` + + // The time that the previous schedule ended or will end. + PreviousSlotEndTime *time.Time `locationName:"previousSlotEndTime" type:"timestamp" timestampFormat:"iso8601"` + + // The schedule recurrence. + Recurrence *ScheduledInstanceRecurrence `locationName:"recurrence" type:"structure"` + + // The Scheduled Instance ID. + ScheduledInstanceId *string `locationName:"scheduledInstanceId" type:"string"` + + // The number of hours in the schedule. + SlotDurationInHours *int64 `locationName:"slotDurationInHours" type:"integer"` + + // The end date for the Scheduled Instance. + TermEndDate *time.Time `locationName:"termEndDate" type:"timestamp" timestampFormat:"iso8601"` + + // The start date for the Scheduled Instance. + TermStartDate *time.Time `locationName:"termStartDate" type:"timestamp" timestampFormat:"iso8601"` + + // The total number of hours for a single instance for the entire term. + TotalScheduledInstanceHours *int64 `locationName:"totalScheduledInstanceHours" type:"integer"` +} + +// String returns the string representation +func (s ScheduledInstance) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ScheduledInstance) GoString() string { + return s.String() +} + +// Describes a schedule that is available for your Scheduled Instances. +type ScheduledInstanceAvailability struct { + _ struct{} `type:"structure"` + + // The Availability Zone. + AvailabilityZone *string `locationName:"availabilityZone" type:"string"` + + // The number of available instances. + AvailableInstanceCount *int64 `locationName:"availableInstanceCount" type:"integer"` + + // The time period for the first schedule to start. + FirstSlotStartTime *time.Time `locationName:"firstSlotStartTime" type:"timestamp" timestampFormat:"iso8601"` + + // The hourly price for a single instance. + HourlyPrice *string `locationName:"hourlyPrice" type:"string"` + + // The instance type. You can specify one of the C3, C4, M4, or R3 instance + // types. + InstanceType *string `locationName:"instanceType" type:"string"` + + // The maximum term. The only possible value is 365 days. + MaxTermDurationInDays *int64 `locationName:"maxTermDurationInDays" type:"integer"` + + // The minimum term. The only possible value is 365 days. + MinTermDurationInDays *int64 `locationName:"minTermDurationInDays" type:"integer"` + + // The network platform (EC2-Classic or EC2-VPC). + NetworkPlatform *string `locationName:"networkPlatform" type:"string"` + + // The platform (Linux/UNIX or Windows). + Platform *string `locationName:"platform" type:"string"` + + // The purchase token. This token expires in two hours. + PurchaseToken *string `locationName:"purchaseToken" type:"string"` + + // The schedule recurrence. + Recurrence *ScheduledInstanceRecurrence `locationName:"recurrence" type:"structure"` + + // The number of hours in the schedule. + SlotDurationInHours *int64 `locationName:"slotDurationInHours" type:"integer"` + + // The total number of hours for a single instance for the entire term. + TotalScheduledInstanceHours *int64 `locationName:"totalScheduledInstanceHours" type:"integer"` +} + +// String returns the string representation +func (s ScheduledInstanceAvailability) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ScheduledInstanceAvailability) GoString() string { + return s.String() +} + +// Describes the recurring schedule for a Scheduled Instance. +type ScheduledInstanceRecurrence struct { + _ struct{} `type:"structure"` + + // The frequency (Daily, Weekly, or Monthly). + Frequency *string `locationName:"frequency" type:"string"` + + // The interval quantity. The interval unit depends on the value of frequency. + // For example, every 2 weeks or every 2 months. + Interval *int64 `locationName:"interval" type:"integer"` + + // The days. For a monthly schedule, this is one or more days of the month (1-31). + // For a weekly schedule, this is one or more days of the week (1-7, where 1 + // is Sunday). + OccurrenceDaySet []*int64 `locationName:"occurrenceDaySet" locationNameList:"item" type:"list"` + + // Indicates whether the occurrence is relative to the end of the specified + // week or month. + OccurrenceRelativeToEnd *bool `locationName:"occurrenceRelativeToEnd" type:"boolean"` + + // The unit for occurrenceDaySet (DayOfWeek or DayOfMonth). + OccurrenceUnit *string `locationName:"occurrenceUnit" type:"string"` +} + +// String returns the string representation +func (s ScheduledInstanceRecurrence) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ScheduledInstanceRecurrence) GoString() string { + return s.String() +} + +// Describes the recurring schedule for a Scheduled Instance. +type ScheduledInstanceRecurrenceRequest struct { + _ struct{} `type:"structure"` + + // The frequency (Daily, Weekly, or Monthly). + Frequency *string `type:"string"` + + // The interval quantity. The interval unit depends on the value of Frequency. + // For example, every 2 weeks or every 2 months. + Interval *int64 `type:"integer"` + + // The days. For a monthly schedule, this is one or more days of the month (1-31). + // For a weekly schedule, this is one or more days of the week (1-7, where 1 + // is Sunday). You can't specify this value with a daily schedule. If the occurrence + // is relative to the end of the month, you can specify only a single day. + OccurrenceDays []*int64 `locationName:"OccurrenceDay" locationNameList:"OccurenceDay" type:"list"` + + // Indicates whether the occurrence is relative to the end of the specified + // week or month. You can't specify this value with a daily schedule. + OccurrenceRelativeToEnd *bool `type:"boolean"` + + // The unit for OccurrenceDays (DayOfWeek or DayOfMonth). This value is required + // for a monthly schedule. You can't specify DayOfWeek with a weekly schedule. + // You can't specify this value with a daily schedule. + OccurrenceUnit *string `type:"string"` +} + +// String returns the string representation +func (s ScheduledInstanceRecurrenceRequest) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ScheduledInstanceRecurrenceRequest) GoString() string { + return s.String() +} + +// Describes a block device mapping for a Scheduled Instance. +type ScheduledInstancesBlockDeviceMapping struct { + _ struct{} `type:"structure"` + + // The device name exposed to the instance (for example, /dev/sdh or xvdh). + DeviceName *string `type:"string"` + + // Parameters used to set up EBS volumes automatically when the instance is + // launched. + Ebs *ScheduledInstancesEbs `type:"structure"` + + // Suppresses the specified device included in the block device mapping of the + // AMI. + NoDevice *string `type:"string"` + + // The virtual device name (ephemeralN). Instance store volumes are numbered + // starting from 0. An instance type with two available instance store volumes + // can specify mappings for ephemeral0 and ephemeral1.The number of available + // instance store volumes depends on the instance type. After you connect to + // the instance, you must mount the volume. + // + // Constraints: For M3 instances, you must specify instance store volumes in + // the block device mapping for the instance. When you launch an M3 instance, + // we ignore any instance store volumes specified in the block device mapping + // for the AMI. + VirtualName *string `type:"string"` +} + +// String returns the string representation +func (s ScheduledInstancesBlockDeviceMapping) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ScheduledInstancesBlockDeviceMapping) GoString() string { + return s.String() +} + +// Describes an EBS volume for a Scheduled Instance. +type ScheduledInstancesEbs struct { + _ struct{} `type:"structure"` + + // Indicates whether the volume is deleted on instance termination. + DeleteOnTermination *bool `type:"boolean"` + + // Indicates whether the volume is encrypted. You can attached encrypted volumes + // only to instances that support them. + Encrypted *bool `type:"boolean"` + + // The number of I/O operations per second (IOPS) that the volume supports. + // For Provisioned IOPS (SSD) volumes, this represents the number of IOPS that + // are provisioned for the volume. For General Purpose (SSD) volumes, this represents + // the baseline performance of the volume and the rate at which the volume accumulates + // I/O credits for bursting. For more information about General Purpose (SSD) + // baseline performance, I/O credits, and bursting, see Amazon EBS Volume Types + // (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSVolumeTypes.html) + // in the Amazon Elastic Compute Cloud User Guide. + // + // Constraint: Range is 100 to 20000 for Provisioned IOPS (SSD) volumes and + // 3 to 10000 for General Purpose (SSD) volumes. + // + // Condition: This parameter is required for requests to create io1 volumes; + // it is not used in requests to create standard or gp2 volumes. + Iops *int64 `type:"integer"` + + // The ID of the snapshot. + SnapshotId *string `type:"string"` + + // The size of the volume, in GiB. + // + // Default: If you're creating the volume from a snapshot and don't specify + // a volume size, the default is the snapshot size. + VolumeSize *int64 `type:"integer"` + + // The volume type. gp2 for General Purpose (SSD) volumes, io1 for Provisioned + // IOPS (SSD) volumes, and standard for Magnetic volumes. + // + // Default: standard + VolumeType *string `type:"string"` +} + +// String returns the string representation +func (s ScheduledInstancesEbs) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ScheduledInstancesEbs) GoString() string { + return s.String() +} + +// Describes an IAM instance profile for a Scheduled Instance. +type ScheduledInstancesIamInstanceProfile struct { + _ struct{} `type:"structure"` + + // The Amazon Resource Name (ARN). + Arn *string `type:"string"` + + // The name. + Name *string `type:"string"` +} + +// String returns the string representation +func (s ScheduledInstancesIamInstanceProfile) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ScheduledInstancesIamInstanceProfile) GoString() string { + return s.String() +} + +// Describes the launch specification for a Scheduled Instance. +// +// If you are launching the Scheduled Instance in EC2-VPC, you must specify +// the ID of the subnet. You can specify the subnet using either SubnetId or +// NetworkInterface. +type ScheduledInstancesLaunchSpecification struct { + _ struct{} `type:"structure"` + + // One or more block device mapping entries. + BlockDeviceMappings []*ScheduledInstancesBlockDeviceMapping `locationName:"BlockDeviceMapping" locationNameList:"BlockDeviceMapping" type:"list"` + + // Indicates whether the instances are optimized for EBS I/O. This optimization + // provides dedicated throughput to Amazon EBS and an optimized configuration + // stack to provide optimal EBS I/O performance. This optimization isn't available + // with all instance types. Additional usage charges apply when using an EBS-optimized + // instance. + // + // Default: false + EbsOptimized *bool `type:"boolean"` + + // The IAM instance profile. + IamInstanceProfile *ScheduledInstancesIamInstanceProfile `type:"structure"` + + // The ID of the Amazon Machine Image (AMI). + ImageId *string `type:"string" required:"true"` + + // The instance type. + InstanceType *string `type:"string"` + + // The ID of the kernel. + KernelId *string `type:"string"` + + // The name of the key pair. + KeyName *string `type:"string"` + + // Enable or disable monitoring for the instances. + Monitoring *ScheduledInstancesMonitoring `type:"structure"` + + // One or more network interfaces. + NetworkInterfaces []*ScheduledInstancesNetworkInterface `locationName:"NetworkInterface" locationNameList:"NetworkInterface" type:"list"` + + // The placement information. + Placement *ScheduledInstancesPlacement `type:"structure"` + + // The ID of the RAM disk. + RamdiskId *string `type:"string"` + + // The IDs of one or more security groups. + SecurityGroupIds []*string `locationName:"SecurityGroupId" locationNameList:"SecurityGroupId" type:"list"` + + // The ID of the subnet in which to launch the instances. + SubnetId *string `type:"string"` + + // The base64-encoded MIME user data. + UserData *string `type:"string"` +} + +// String returns the string representation +func (s ScheduledInstancesLaunchSpecification) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ScheduledInstancesLaunchSpecification) GoString() string { + return s.String() +} + +// Describes whether monitoring is enabled for a Scheduled Instance. +type ScheduledInstancesMonitoring struct { + _ struct{} `type:"structure"` + + // Indicates whether monitoring is enabled. + Enabled *bool `type:"boolean"` +} + +// String returns the string representation +func (s ScheduledInstancesMonitoring) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ScheduledInstancesMonitoring) GoString() string { + return s.String() +} + +// Describes a network interface for a Scheduled Instance. +type ScheduledInstancesNetworkInterface struct { + _ struct{} `type:"structure"` + + // Indicates whether to assign a public IP address to instances launched in + // a VPC. The public IP address can only be assigned to a network interface + // for eth0, and can only be assigned to a new network interface, not an existing + // one. You cannot specify more than one network interface in the request. If + // launching into a default subnet, the default value is true. + AssociatePublicIpAddress *bool `type:"boolean"` + + // Indicates whether to delete the interface when the instance is terminated. + DeleteOnTermination *bool `type:"boolean"` + + // The description. + Description *string `type:"string"` + + // The index of the device for the network interface attachment. + DeviceIndex *int64 `type:"integer"` + + // The IDs of one or more security groups. + Groups []*string `locationName:"Group" locationNameList:"SecurityGroupId" type:"list"` + + // The ID of the network interface. + NetworkInterfaceId *string `type:"string"` + + // The IP address of the network interface within the subnet. + PrivateIpAddress *string `type:"string"` + + // The private IP addresses. + PrivateIpAddressConfigs []*ScheduledInstancesPrivateIpAddressConfig `locationName:"PrivateIpAddressConfig" locationNameList:"PrivateIpAddressConfigSet" type:"list"` + + // The number of secondary private IP addresses. + SecondaryPrivateIpAddressCount *int64 `type:"integer"` + + // The ID of the subnet. + SubnetId *string `type:"string"` +} + +// String returns the string representation +func (s ScheduledInstancesNetworkInterface) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ScheduledInstancesNetworkInterface) GoString() string { + return s.String() +} + +// Describes the placement for a Scheduled Instance. +type ScheduledInstancesPlacement struct { + _ struct{} `type:"structure"` + + // The Availability Zone. + AvailabilityZone *string `type:"string"` + + // The name of the placement group. + GroupName *string `type:"string"` +} + +// String returns the string representation +func (s ScheduledInstancesPlacement) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ScheduledInstancesPlacement) GoString() string { + return s.String() +} + +// Describes a private IP address for a Scheduled Instance. +type ScheduledInstancesPrivateIpAddressConfig struct { + _ struct{} `type:"structure"` + + // Indicates whether this is a primary IP address. Otherwise, this is a secondary + // IP address. + Primary *bool `type:"boolean"` + + // The IP address. + PrivateIpAddress *string `type:"string"` +} + +// String returns the string representation +func (s ScheduledInstancesPrivateIpAddressConfig) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ScheduledInstancesPrivateIpAddressConfig) GoString() string { + return s.String() +} + // Describes a security group type SecurityGroup struct { _ struct{} `type:"structure"` @@ -21167,6 +22438,51 @@ func (s SecurityGroup) GoString() string { return s.String() } +// Describes the time period for a Scheduled Instance to start its first schedule. +// The time period must span less than one day. +type SlotDateTimeRangeRequest struct { + _ struct{} `type:"structure"` + + // The earliest date and time, in UTC, for the Scheduled Instance to start. + EarliestTime *time.Time `type:"timestamp" timestampFormat:"iso8601" required:"true"` + + // The latest date and time, in UTC, for the Scheduled Instance to start. This + // value must be later than or equal to the earliest date and at most three + // months in the future. + LatestTime *time.Time `type:"timestamp" timestampFormat:"iso8601" required:"true"` +} + +// String returns the string representation +func (s SlotDateTimeRangeRequest) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s SlotDateTimeRangeRequest) GoString() string { + return s.String() +} + +// Describes the time period for a Scheduled Instance to start its first schedule. +type SlotStartTimeRangeRequest struct { + _ struct{} `type:"structure"` + + // The earliest date and time, in UTC, for the Scheduled Instance to start. + EarliestTime *time.Time `type:"timestamp" timestampFormat:"iso8601"` + + // The latest date and time, in UTC, for the Scheduled Instance to start. + LatestTime *time.Time `type:"timestamp" timestampFormat:"iso8601"` +} + +// String returns the string representation +func (s SlotStartTimeRangeRequest) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s SlotStartTimeRangeRequest) GoString() string { + return s.String() +} + // Describes a snapshot. type Snapshot struct { _ struct{} `type:"structure"` @@ -21707,8 +23023,10 @@ func (s SpotInstanceStatus) GoString() string { type SpotPlacement struct { _ struct{} `type:"structure"` - // The Availability Zones. To specify multiple Availability Zones, separate - // them using commas; for example, "us-west-2a, us-west-2b". + // The Availability Zone. + // + // [Spot fleet only] To specify multiple Availability Zones, separate them + // using commas; for example, "us-west-2a, us-west-2b". AvailabilityZone *string `locationName:"availabilityZone" type:"string"` // The name of the placement group (for cluster instances). @@ -21826,7 +23144,8 @@ type StateReason struct { // Client.UserInitiatedShutdown: The instance was shut down using the Amazon // EC2 API. // - // Client.VolumeLimitExceeded: The volume limit was exceeded. + // Client.VolumeLimitExceeded: The limit on the number of EBS volumes or total + // storage was exceeded. Decrease usage or request an increase in your limits. // // Client.InvalidSnapshot.NotFound: The specified snapshot was not found. Message *string `locationName:"message" type:"string"` @@ -22170,7 +23489,7 @@ type UserBucket struct { // The name of the S3 bucket where the disk image is located. S3Bucket *string `type:"string"` - // The key for the disk image. + // The file name of the disk image. S3Key *string `type:"string"` } @@ -22191,7 +23510,7 @@ type UserBucketDetails struct { // The S3 bucket from which the disk image was created. S3Bucket *string `locationName:"s3Bucket" type:"string"` - // The key from which the disk image was created. + // The file name of the disk image. S3Key *string `locationName:"s3Key" type:"string"` } @@ -22235,8 +23554,17 @@ type UserIdGroupPair struct { // VPC, use GroupId. GroupName *string `locationName:"groupName" type:"string"` - // The ID of an AWS account. EC2-Classic only. + // The status of a VPC peering connection, if applicable. + PeeringStatus *string `locationName:"peeringStatus" type:"string"` + + // The ID of an AWS account. UserId *string `locationName:"userId" type:"string"` + + // The ID of the VPC for the referenced security group, if applicable. + VpcId *string `locationName:"vpcId" type:"string"` + + // The ID of the VPC peering connection, if applicable. + VpcPeeringConnectionId *string `locationName:"vpcPeeringConnectionId" type:"string"` } // String returns the string representation @@ -22811,7 +24139,8 @@ func (s VpnConnectionOptionsSpecification) GoString() string { type VpnGateway struct { _ struct{} `type:"structure"` - // The Availability Zone where the virtual private gateway was created. + // The Availability Zone where the virtual private gateway was created, if applicable. + // This field may be empty or not returned. AvailabilityZone *string `locationName:"availabilityZone" type:"string"` // The current state of the virtual private gateway. @@ -23195,6 +24524,8 @@ const ( const ( // @enum InstanceLifecycleType InstanceLifecycleTypeSpot = "spot" + // @enum InstanceLifecycleType + InstanceLifecycleTypeScheduled = "scheduled" ) const ( @@ -23242,6 +24573,8 @@ const ( // @enum InstanceType InstanceTypeM410xlarge = "m4.10xlarge" // @enum InstanceType + InstanceTypeT2Nano = "t2.nano" + // @enum InstanceType InstanceTypeT2Micro = "t2.micro" // @enum InstanceType InstanceTypeT2Small = "t2.small" @@ -23300,6 +24633,8 @@ const ( // @enum InstanceType InstanceTypeG22xlarge = "g2.2xlarge" // @enum InstanceType + InstanceTypeG28xlarge = "g2.8xlarge" + // @enum InstanceType InstanceTypeCg14xlarge = "cg1.4xlarge" // @enum InstanceType InstanceTypeR3Large = "r3.large" diff --git a/vendor/github.com/aws/aws-sdk-go/service/ec2/service.go b/vendor/github.com/aws/aws-sdk-go/service/ec2/service.go index 2ff4220f7d..9d5fa81608 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/ec2/service.go +++ b/vendor/github.com/aws/aws-sdk-go/service/ec2/service.go @@ -62,10 +62,10 @@ func newClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegio // Handlers svc.Handlers.Sign.PushBack(v4.Sign) - svc.Handlers.Build.PushBack(ec2query.Build) - svc.Handlers.Unmarshal.PushBack(ec2query.Unmarshal) - svc.Handlers.UnmarshalMeta.PushBack(ec2query.UnmarshalMeta) - svc.Handlers.UnmarshalError.PushBack(ec2query.UnmarshalError) + svc.Handlers.Build.PushBackNamed(ec2query.BuildHandler) + svc.Handlers.Unmarshal.PushBackNamed(ec2query.UnmarshalHandler) + svc.Handlers.UnmarshalMeta.PushBackNamed(ec2query.UnmarshalMetaHandler) + svc.Handlers.UnmarshalError.PushBackNamed(ec2query.UnmarshalErrorHandler) // Run custom client initialization if present if initClient != nil { diff --git a/vendor/github.com/aws/aws-sdk-go/service/ec2/waiters.go b/vendor/github.com/aws/aws-sdk-go/service/ec2/waiters.go index 1b28317a18..e263b0cef6 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/ec2/waiters.go +++ b/vendor/github.com/aws/aws-sdk-go/service/ec2/waiters.go @@ -226,6 +226,35 @@ func (c *EC2) WaitUntilImageAvailable(input *DescribeImagesInput) error { return w.Wait() } +func (c *EC2) WaitUntilImageExists(input *DescribeImagesInput) error { + waiterCfg := waiter.Config{ + Operation: "DescribeImages", + Delay: 15, + MaxAttempts: 40, + Acceptors: []waiter.WaitAcceptor{ + { + State: "success", + Matcher: "path", + Argument: "length(Images[]) > `0`", + Expected: true, + }, + { + State: "retry", + Matcher: "error", + Argument: "", + Expected: "InvalidAMIID.NotFound", + }, + }, + } + + w := waiter.Waiter{ + Client: c, + Input: input, + Config: waiterCfg, + } + return w.Wait() +} + func (c *EC2) WaitUntilInstanceExists(input *DescribeInstancesInput) error { waiterCfg := waiter.Config{ Operation: "DescribeInstances", @@ -234,15 +263,15 @@ func (c *EC2) WaitUntilInstanceExists(input *DescribeInstancesInput) error { Acceptors: []waiter.WaitAcceptor{ { State: "success", - Matcher: "status", - Argument: "", - Expected: 200, + Matcher: "path", + Argument: "length(Reservations[]) > `0`", + Expected: true, }, { State: "retry", Matcher: "error", Argument: "", - Expected: "InvalidInstanceIDNotFound", + Expected: "InvalidInstanceID.NotFound", }, }, } @@ -285,6 +314,12 @@ func (c *EC2) WaitUntilInstanceRunning(input *DescribeInstancesInput) error { Argument: "Reservations[].Instances[].State.Name", Expected: "stopping", }, + { + State: "retry", + Matcher: "error", + Argument: "", + Expected: "InvalidInstanceID.NotFound", + }, }, } @@ -308,6 +343,12 @@ func (c *EC2) WaitUntilInstanceStatusOk(input *DescribeInstanceStatusInput) erro Argument: "InstanceStatuses[].InstanceStatus.Status", Expected: "ok", }, + { + State: "retry", + Matcher: "error", + Argument: "", + Expected: "InvalidInstanceID.NotFound", + }, }, } @@ -405,7 +446,54 @@ func (c *EC2) WaitUntilKeyPairExists(input *DescribeKeyPairsInput) error { State: "retry", Matcher: "error", Argument: "", - Expected: "InvalidKeyPairNotFound", + Expected: "InvalidKeyPair.NotFound", + }, + }, + } + + w := waiter.Waiter{ + Client: c, + Input: input, + Config: waiterCfg, + } + return w.Wait() +} + +func (c *EC2) WaitUntilNatGatewayAvailable(input *DescribeNatGatewaysInput) error { + waiterCfg := waiter.Config{ + Operation: "DescribeNatGateways", + Delay: 15, + MaxAttempts: 40, + Acceptors: []waiter.WaitAcceptor{ + { + State: "success", + Matcher: "pathAll", + Argument: "NatGateways[].State", + Expected: "available", + }, + { + State: "failure", + Matcher: "pathAny", + Argument: "NatGateways[].State", + Expected: "failed", + }, + { + State: "failure", + Matcher: "pathAny", + Argument: "NatGateways[].State", + Expected: "deleting", + }, + { + State: "failure", + Matcher: "pathAny", + Argument: "NatGateways[].State", + Expected: "deleted", + }, + { + State: "retry", + Matcher: "error", + Argument: "", + Expected: "NatGatewayNotFound", }, }, } @@ -434,7 +522,7 @@ func (c *EC2) WaitUntilNetworkInterfaceAvailable(input *DescribeNetworkInterface State: "failure", Matcher: "error", Argument: "", - Expected: "InvalidNetworkInterfaceIDNotFound", + Expected: "InvalidNetworkInterfaceID.NotFound", }, }, } @@ -631,7 +719,7 @@ func (c *EC2) WaitUntilVolumeDeleted(input *DescribeVolumesInput) error { State: "success", Matcher: "error", Argument: "", - Expected: "InvalidVolumeNotFound", + Expected: "InvalidVolume.NotFound", }, }, } @@ -696,6 +784,35 @@ func (c *EC2) WaitUntilVpcAvailable(input *DescribeVpcsInput) error { return w.Wait() } +func (c *EC2) WaitUntilVpcPeeringConnectionExists(input *DescribeVpcPeeringConnectionsInput) error { + waiterCfg := waiter.Config{ + Operation: "DescribeVpcPeeringConnections", + Delay: 15, + MaxAttempts: 40, + Acceptors: []waiter.WaitAcceptor{ + { + State: "success", + Matcher: "status", + Argument: "", + Expected: 200, + }, + { + State: "retry", + Matcher: "error", + Argument: "", + Expected: "InvalidVpcPeeringConnectionID.NotFound", + }, + }, + } + + w := waiter.Waiter{ + Client: c, + Input: input, + Config: waiterCfg, + } + return w.Wait() +} + func (c *EC2) WaitUntilVpnConnectionAvailable(input *DescribeVpnConnectionsInput) error { waiterCfg := waiter.Config{ Operation: "DescribeVpnConnections", diff --git a/vendor/github.com/aws/aws-sdk-go/service/ecr/api.go b/vendor/github.com/aws/aws-sdk-go/service/ecr/api.go index 73bd81f8dd..bf1445949f 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/ecr/api.go +++ b/vendor/github.com/aws/aws-sdk-go/service/ecr/api.go @@ -1349,6 +1349,8 @@ type UploadLayerPartInput struct { _ struct{} `type:"structure"` // The base64-encoded layer part payload. + // + // LayerPartBlob is automatically base64 encoded/decoded by the SDK. LayerPartBlob []byte `locationName:"layerPartBlob" type:"blob" required:"true"` // The integer value of the first byte of the layer part. diff --git a/vendor/github.com/aws/aws-sdk-go/service/ecr/service.go b/vendor/github.com/aws/aws-sdk-go/service/ecr/service.go index f6ca31c2a0..0f6c6760e2 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/ecr/service.go +++ b/vendor/github.com/aws/aws-sdk-go/service/ecr/service.go @@ -66,10 +66,10 @@ func newClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegio // Handlers svc.Handlers.Sign.PushBack(v4.Sign) - svc.Handlers.Build.PushBack(jsonrpc.Build) - svc.Handlers.Unmarshal.PushBack(jsonrpc.Unmarshal) - svc.Handlers.UnmarshalMeta.PushBack(jsonrpc.UnmarshalMeta) - svc.Handlers.UnmarshalError.PushBack(jsonrpc.UnmarshalError) + svc.Handlers.Build.PushBackNamed(jsonrpc.BuildHandler) + svc.Handlers.Unmarshal.PushBackNamed(jsonrpc.UnmarshalHandler) + svc.Handlers.UnmarshalMeta.PushBackNamed(jsonrpc.UnmarshalMetaHandler) + svc.Handlers.UnmarshalError.PushBackNamed(jsonrpc.UnmarshalErrorHandler) // Run custom client initialization if present if initClient != nil { diff --git a/vendor/github.com/aws/aws-sdk-go/service/ecs/service.go b/vendor/github.com/aws/aws-sdk-go/service/ecs/service.go index 04b9f71804..260b39edc3 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/ecs/service.go +++ b/vendor/github.com/aws/aws-sdk-go/service/ecs/service.go @@ -72,10 +72,10 @@ func newClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegio // Handlers svc.Handlers.Sign.PushBack(v4.Sign) - svc.Handlers.Build.PushBack(jsonrpc.Build) - svc.Handlers.Unmarshal.PushBack(jsonrpc.Unmarshal) - svc.Handlers.UnmarshalMeta.PushBack(jsonrpc.UnmarshalMeta) - svc.Handlers.UnmarshalError.PushBack(jsonrpc.UnmarshalError) + svc.Handlers.Build.PushBackNamed(jsonrpc.BuildHandler) + svc.Handlers.Unmarshal.PushBackNamed(jsonrpc.UnmarshalHandler) + svc.Handlers.UnmarshalMeta.PushBackNamed(jsonrpc.UnmarshalMetaHandler) + svc.Handlers.UnmarshalError.PushBackNamed(jsonrpc.UnmarshalErrorHandler) // Run custom client initialization if present if initClient != nil { diff --git a/vendor/github.com/aws/aws-sdk-go/service/elb/service.go b/vendor/github.com/aws/aws-sdk-go/service/elb/service.go index 428fea0aca..867254809a 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/elb/service.go +++ b/vendor/github.com/aws/aws-sdk-go/service/elb/service.go @@ -71,10 +71,10 @@ func newClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegio // Handlers svc.Handlers.Sign.PushBack(v4.Sign) - svc.Handlers.Build.PushBack(query.Build) - svc.Handlers.Unmarshal.PushBack(query.Unmarshal) - svc.Handlers.UnmarshalMeta.PushBack(query.UnmarshalMeta) - svc.Handlers.UnmarshalError.PushBack(query.UnmarshalError) + svc.Handlers.Build.PushBackNamed(query.BuildHandler) + svc.Handlers.Unmarshal.PushBackNamed(query.UnmarshalHandler) + svc.Handlers.UnmarshalMeta.PushBackNamed(query.UnmarshalMetaHandler) + svc.Handlers.UnmarshalError.PushBackNamed(query.UnmarshalErrorHandler) // Run custom client initialization if present if initClient != nil { diff --git a/vendor/github.com/aws/aws-sdk-go/service/elb/waiters.go b/vendor/github.com/aws/aws-sdk-go/service/elb/waiters.go index 5d5755d049..b1c9a526aa 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/elb/waiters.go +++ b/vendor/github.com/aws/aws-sdk-go/service/elb/waiters.go @@ -29,6 +29,35 @@ func (c *ELB) WaitUntilAnyInstanceInService(input *DescribeInstanceHealthInput) return w.Wait() } +func (c *ELB) WaitUntilInstanceDeregistered(input *DescribeInstanceHealthInput) error { + waiterCfg := waiter.Config{ + Operation: "DescribeInstanceHealth", + Delay: 15, + MaxAttempts: 40, + Acceptors: []waiter.WaitAcceptor{ + { + State: "success", + Matcher: "pathAll", + Argument: "InstanceStates[].State", + Expected: "OutOfService", + }, + { + State: "success", + Matcher: "error", + Argument: "", + Expected: "InvalidInstance", + }, + }, + } + + w := waiter.Waiter{ + Client: c, + Input: input, + Config: waiterCfg, + } + return w.Wait() +} + func (c *ELB) WaitUntilInstanceInService(input *DescribeInstanceHealthInput) error { waiterCfg := waiter.Config{ Operation: "DescribeInstanceHealth", diff --git a/vendor/github.com/aws/aws-sdk-go/service/iam/api.go b/vendor/github.com/aws/aws-sdk-go/service/iam/api.go index 89b862c273..8243615313 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/iam/api.go +++ b/vendor/github.com/aws/aws-sdk-go/service/iam/api.go @@ -8,6 +8,8 @@ import ( "github.com/aws/aws-sdk-go/aws/awsutil" "github.com/aws/aws-sdk-go/aws/request" + "github.com/aws/aws-sdk-go/private/protocol" + "github.com/aws/aws-sdk-go/private/protocol/query" ) const opAddClientIDToOpenIDConnectProvider = "AddClientIDToOpenIDConnectProvider" @@ -25,6 +27,8 @@ func (c *IAM) AddClientIDToOpenIDConnectProviderRequest(input *AddClientIDToOpen } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &AddClientIDToOpenIDConnectProviderOutput{} req.Data = output return @@ -56,6 +60,8 @@ func (c *IAM) AddRoleToInstanceProfileRequest(input *AddRoleToInstanceProfileInp } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &AddRoleToInstanceProfileOutput{} req.Data = output return @@ -86,6 +92,8 @@ func (c *IAM) AddUserToGroupRequest(input *AddUserToGroupInput) (req *request.Re } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &AddUserToGroupOutput{} req.Data = output return @@ -113,6 +121,8 @@ func (c *IAM) AttachGroupPolicyRequest(input *AttachGroupPolicyInput) (req *requ } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &AttachGroupPolicyOutput{} req.Data = output return @@ -147,6 +157,8 @@ func (c *IAM) AttachRolePolicyRequest(input *AttachRolePolicyInput) (req *reques } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &AttachRolePolicyOutput{} req.Data = output return @@ -185,6 +197,8 @@ func (c *IAM) AttachUserPolicyRequest(input *AttachUserPolicyInput) (req *reques } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &AttachUserPolicyOutput{} req.Data = output return @@ -219,6 +233,8 @@ func (c *IAM) ChangePasswordRequest(input *ChangePasswordInput) (req *request.Re } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &ChangePasswordOutput{} req.Data = output return @@ -294,6 +310,8 @@ func (c *IAM) CreateAccountAliasRequest(input *CreateAccountAliasInput) (req *re } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &CreateAccountAliasOutput{} req.Data = output return @@ -683,6 +701,8 @@ func (c *IAM) DeactivateMFADeviceRequest(input *DeactivateMFADeviceInput) (req * } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &DeactivateMFADeviceOutput{} req.Data = output return @@ -715,6 +735,8 @@ func (c *IAM) DeleteAccessKeyRequest(input *DeleteAccessKeyInput) (req *request. } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &DeleteAccessKeyOutput{} req.Data = output return @@ -747,6 +769,8 @@ func (c *IAM) DeleteAccountAliasRequest(input *DeleteAccountAliasInput) (req *re } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &DeleteAccountAliasOutput{} req.Data = output return @@ -776,6 +800,8 @@ func (c *IAM) DeleteAccountPasswordPolicyRequest(input *DeleteAccountPasswordPol } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &DeleteAccountPasswordPolicyOutput{} req.Data = output return @@ -803,6 +829,8 @@ func (c *IAM) DeleteGroupRequest(input *DeleteGroupInput) (req *request.Request, } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &DeleteGroupOutput{} req.Data = output return @@ -831,6 +859,8 @@ func (c *IAM) DeleteGroupPolicyRequest(input *DeleteGroupPolicyInput) (req *requ } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &DeleteGroupPolicyOutput{} req.Data = output return @@ -863,6 +893,8 @@ func (c *IAM) DeleteInstanceProfileRequest(input *DeleteInstanceProfileInput) (r } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &DeleteInstanceProfileOutput{} req.Data = output return @@ -897,6 +929,8 @@ func (c *IAM) DeleteLoginProfileRequest(input *DeleteLoginProfileInput) (req *re } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &DeleteLoginProfileOutput{} req.Data = output return @@ -930,6 +964,8 @@ func (c *IAM) DeleteOpenIDConnectProviderRequest(input *DeleteOpenIDConnectProvi } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &DeleteOpenIDConnectProviderOutput{} req.Data = output return @@ -964,6 +1000,8 @@ func (c *IAM) DeletePolicyRequest(input *DeletePolicyInput) (req *request.Reques } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &DeletePolicyOutput{} req.Data = output return @@ -1008,6 +1046,8 @@ func (c *IAM) DeletePolicyVersionRequest(input *DeletePolicyVersionInput) (req * } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &DeletePolicyVersionOutput{} req.Data = output return @@ -1043,6 +1083,8 @@ func (c *IAM) DeleteRoleRequest(input *DeleteRoleInput) (req *request.Request, o } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &DeleteRoleOutput{} req.Data = output return @@ -1075,6 +1117,8 @@ func (c *IAM) DeleteRolePolicyRequest(input *DeleteRolePolicyInput) (req *reques } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &DeleteRolePolicyOutput{} req.Data = output return @@ -1107,6 +1151,8 @@ func (c *IAM) DeleteSAMLProviderRequest(input *DeleteSAMLProviderInput) (req *re } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &DeleteSAMLProviderOutput{} req.Data = output return @@ -1140,6 +1186,8 @@ func (c *IAM) DeleteSSHPublicKeyRequest(input *DeleteSSHPublicKeyInput) (req *re } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &DeleteSSHPublicKeyOutput{} req.Data = output return @@ -1173,6 +1221,8 @@ func (c *IAM) DeleteServerCertificateRequest(input *DeleteServerCertificateInput } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &DeleteServerCertificateOutput{} req.Data = output return @@ -1215,6 +1265,8 @@ func (c *IAM) DeleteSigningCertificateRequest(input *DeleteSigningCertificateInp } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &DeleteSigningCertificateOutput{} req.Data = output return @@ -1247,6 +1299,8 @@ func (c *IAM) DeleteUserRequest(input *DeleteUserInput) (req *request.Request, o } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &DeleteUserOutput{} req.Data = output return @@ -1275,6 +1329,8 @@ func (c *IAM) DeleteUserPolicyRequest(input *DeleteUserPolicyInput) (req *reques } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &DeleteUserPolicyOutput{} req.Data = output return @@ -1307,6 +1363,8 @@ func (c *IAM) DeleteVirtualMFADeviceRequest(input *DeleteVirtualMFADeviceInput) } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &DeleteVirtualMFADeviceOutput{} req.Data = output return @@ -1337,6 +1395,8 @@ func (c *IAM) DetachGroupPolicyRequest(input *DetachGroupPolicyInput) (req *requ } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &DetachGroupPolicyOutput{} req.Data = output return @@ -1369,6 +1429,8 @@ func (c *IAM) DetachRolePolicyRequest(input *DetachRolePolicyInput) (req *reques } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &DetachRolePolicyOutput{} req.Data = output return @@ -1401,6 +1463,8 @@ func (c *IAM) DetachUserPolicyRequest(input *DetachUserPolicyInput) (req *reques } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &DetachUserPolicyOutput{} req.Data = output return @@ -1433,6 +1497,8 @@ func (c *IAM) EnableMFADeviceRequest(input *EnableMFADeviceInput) (req *request. } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &EnableMFADeviceOutput{} req.Data = output return @@ -2862,6 +2928,12 @@ func (c *IAM) ListPolicyVersionsRequest(input *ListPolicyVersionsInput) (req *re Name: opListPolicyVersions, HTTPMethod: "POST", HTTPPath: "/", + Paginator: &request.Paginator{ + InputTokens: []string{"Marker"}, + OutputTokens: []string{"Marker"}, + LimitToken: "MaxItems", + TruncationToken: "IsTruncated", + }, } if input == nil { @@ -2886,6 +2958,14 @@ func (c *IAM) ListPolicyVersions(input *ListPolicyVersionsInput) (*ListPolicyVer return out, err } +func (c *IAM) ListPolicyVersionsPages(input *ListPolicyVersionsInput, fn func(p *ListPolicyVersionsOutput, lastPage bool) (shouldContinue bool)) error { + page, _ := c.ListPolicyVersionsRequest(input) + page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) + return page.EachPage(func(p interface{}, lastPage bool) bool { + return fn(p.(*ListPolicyVersionsOutput), lastPage) + }) +} + const opListRolePolicies = "ListRolePolicies" // ListRolePoliciesRequest generates a request for the ListRolePolicies operation. @@ -3305,6 +3385,8 @@ func (c *IAM) PutGroupPolicyRequest(input *PutGroupPolicyInput) (req *request.Re } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &PutGroupPolicyOutput{} req.Data = output return @@ -3348,6 +3430,8 @@ func (c *IAM) PutRolePolicyRequest(input *PutRolePolicyInput) (req *request.Requ } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &PutRolePolicyOutput{} req.Data = output return @@ -3397,6 +3481,8 @@ func (c *IAM) PutUserPolicyRequest(input *PutUserPolicyInput) (req *request.Requ } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &PutUserPolicyOutput{} req.Data = output return @@ -3440,6 +3526,8 @@ func (c *IAM) RemoveClientIDFromOpenIDConnectProviderRequest(input *RemoveClient } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &RemoveClientIDFromOpenIDConnectProviderOutput{} req.Data = output return @@ -3471,6 +3559,8 @@ func (c *IAM) RemoveRoleFromInstanceProfileRequest(input *RemoveRoleFromInstance } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &RemoveRoleFromInstanceProfileOutput{} req.Data = output return @@ -3506,6 +3596,8 @@ func (c *IAM) RemoveUserFromGroupRequest(input *RemoveUserFromGroupInput) (req * } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &RemoveUserFromGroupOutput{} req.Data = output return @@ -3533,6 +3625,8 @@ func (c *IAM) ResyncMFADeviceRequest(input *ResyncMFADeviceInput) (req *request. } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &ResyncMFADeviceOutput{} req.Data = output return @@ -3564,6 +3658,8 @@ func (c *IAM) SetDefaultPolicyVersionRequest(input *SetDefaultPolicyVersionInput } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &SetDefaultPolicyVersionOutput{} req.Data = output return @@ -3696,6 +3792,8 @@ func (c *IAM) UpdateAccessKeyRequest(input *UpdateAccessKeyInput) (req *request. } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &UpdateAccessKeyOutput{} req.Data = output return @@ -3734,6 +3832,8 @@ func (c *IAM) UpdateAccountPasswordPolicyRequest(input *UpdateAccountPasswordPol } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &UpdateAccountPasswordPolicyOutput{} req.Data = output return @@ -3770,6 +3870,8 @@ func (c *IAM) UpdateAssumeRolePolicyRequest(input *UpdateAssumeRolePolicyInput) } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &UpdateAssumeRolePolicyOutput{} req.Data = output return @@ -3799,6 +3901,8 @@ func (c *IAM) UpdateGroupRequest(input *UpdateGroupInput) (req *request.Request, } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &UpdateGroupOutput{} req.Data = output return @@ -3835,6 +3939,8 @@ func (c *IAM) UpdateLoginProfileRequest(input *UpdateLoginProfileInput) (req *re } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &UpdateLoginProfileOutput{} req.Data = output return @@ -3866,6 +3972,8 @@ func (c *IAM) UpdateOpenIDConnectProviderThumbprintRequest(input *UpdateOpenIDCo } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &UpdateOpenIDConnectProviderThumbprintOutput{} req.Data = output return @@ -3935,6 +4043,8 @@ func (c *IAM) UpdateSSHPublicKeyRequest(input *UpdateSSHPublicKeyInput) (req *re } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &UpdateSSHPublicKeyOutput{} req.Data = output return @@ -3971,6 +4081,8 @@ func (c *IAM) UpdateServerCertificateRequest(input *UpdateServerCertificateInput } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &UpdateServerCertificateOutput{} req.Data = output return @@ -4013,6 +4125,8 @@ func (c *IAM) UpdateSigningCertificateRequest(input *UpdateSigningCertificateInp } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &UpdateSigningCertificateOutput{} req.Data = output return @@ -4047,6 +4161,8 @@ func (c *IAM) UpdateUserRequest(input *UpdateUserInput) (req *request.Request, o } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &UpdateUserOutput{} req.Data = output return @@ -4055,7 +4171,8 @@ func (c *IAM) UpdateUserRequest(input *UpdateUserInput) (req *request.Request, o // Updates the name and/or the path of the specified user. // // You should understand the implications of changing a user's path or name. -// For more information, see Renaming Users and Groups (http://docs.aws.amazon.com/IAM/latest/UserGuide/Using_WorkingWithGroupsAndUsers.html) +// For more information, see Renaming an IAM User (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_users_manage.html#id_users_renaming) +// and Renaming an IAM Group (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_groups_manage_rename.html) // in the IAM User Guide. To change a user name the requester must have appropriate // permissions on both the source object and the target object. For example, // to change Bob to Robert, the entity making the request must have permission @@ -6039,9 +6156,12 @@ type EvaluationResult struct { MatchedStatements []*Statement `type:"list"` // A list of context keys that are required by the included input policies but - // that were not provided by one of the input parameters. To discover the context - // keys used by a set of policies, you can call GetContextKeysForCustomPolicy - // or GetContextKeysForPrincipalPolicy. + // that were not provided by one of the input parameters. This list is used + // when the resource in a simulation is "*", either explicitly, or when the + // ResourceArns parameter blank. If you include a list of resources, then any + // missing context values are instead included under the ResourceSpecificResults + // section. To discover the context keys used by a set of policies, you can + // call GetContextKeysForCustomPolicy or GetContextKeysForPrincipalPolicy. // // If the response includes any keys in this list, then the reported results // might be untrustworthy because the simulation could not completely evaluate @@ -6507,6 +6627,8 @@ type GetCredentialReportOutput struct { _ struct{} `type:"structure"` // Contains the credential report. The report is Base64-encoded. + // + // Content is automatically base64 encoded/decoded by the SDK. Content []byte `type:"blob"` // The date and time when the credential report was created, in ISO 8601 date-time @@ -9133,6 +9255,11 @@ func (s PolicyDetail) GoString() string { type PolicyGroup struct { _ struct{} `type:"structure"` + // The stable and unique string identifying the group. For more information + // about IDs, see IAM Identifiers (http://docs.aws.amazon.com/IAM/latest/UserGuide/reference_identifiers.html) + // in the IAM User Guide. + GroupId *string `min:"16" type:"string"` + // The name (friendly name, not ARN) identifying the group. GroupName *string `min:"1" type:"string"` } @@ -9158,6 +9285,11 @@ func (s PolicyGroup) GoString() string { type PolicyRole struct { _ struct{} `type:"structure"` + // The stable and unique string identifying the role. For more information about + // IDs, see IAM Identifiers (http://docs.aws.amazon.com/IAM/latest/UserGuide/reference_identifiers.html) + // in the IAM User Guide. + RoleId *string `min:"16" type:"string"` + // The name (friendly name, not ARN) identifying the role. RoleName *string `min:"1" type:"string"` } @@ -9183,6 +9315,11 @@ func (s PolicyRole) GoString() string { type PolicyUser struct { _ struct{} `type:"structure"` + // The stable and unique string identifying the user. For more information about + // IDs, see IAM Identifiers (http://docs.aws.amazon.com/IAM/latest/UserGuide/reference_identifiers.html) + // in the IAM User Guide. + UserId *string `min:"16" type:"string"` + // The name (friendly name, not ARN) identifying the user. UserName *string `min:"1" type:"string"` } @@ -9509,8 +9646,12 @@ type ResourceSpecificResult struct { MatchedStatements []*Statement `type:"list"` // A list of context keys that are required by the included input policies but - // that were not provided by one of the input parameters. To discover the context - // keys used by a set of policies, you can call GetContextKeysForCustomPolicy + // that were not provided by one of the input parameters. This list is used + // when a list of ARNs is included in the ResourceArns parameter instead of + // "*". If you do not specify individual resources, by setting ResourceArns + // to "*" or by not including the ResourceArns parameter, then any missing context + // values are instead included under the EvaluationResults section. To discover + // the context keys used by a set of policies, you can call GetContextKeysForCustomPolicy // or GetContextKeysForPrincipalPolicy. MissingContextValues []*string `type:"list"` } @@ -10966,6 +11107,8 @@ type VirtualMFADevice struct { // The Base32 seed defined as specified in RFC3548 (http://www.ietf.org/rfc/rfc3548.txt). // The Base32StringSeed is Base64-encoded. + // + // Base32StringSeed is automatically base64 encoded/decoded by the SDK. Base32StringSeed []byte `type:"blob"` // The date and time on which the virtual MFA device was enabled. @@ -10975,6 +11118,8 @@ type VirtualMFADevice struct { // where $virtualMFADeviceName is one of the create call arguments, AccountName // is the user name if set (otherwise, the account ID otherwise), and Base32String // is the seed in Base32 format. The Base32String value is Base64-encoded. + // + // QRCodePNG is automatically base64 encoded/decoded by the SDK. QRCodePNG []byte `type:"blob"` // The serial number associated with VirtualMFADevice. diff --git a/vendor/github.com/aws/aws-sdk-go/service/iam/service.go b/vendor/github.com/aws/aws-sdk-go/service/iam/service.go index e8cfb9c6fd..e4416226b9 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/iam/service.go +++ b/vendor/github.com/aws/aws-sdk-go/service/iam/service.go @@ -106,10 +106,10 @@ func newClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegio // Handlers svc.Handlers.Sign.PushBack(v4.Sign) - svc.Handlers.Build.PushBack(query.Build) - svc.Handlers.Unmarshal.PushBack(query.Unmarshal) - svc.Handlers.UnmarshalMeta.PushBack(query.UnmarshalMeta) - svc.Handlers.UnmarshalError.PushBack(query.UnmarshalError) + svc.Handlers.Build.PushBackNamed(query.BuildHandler) + svc.Handlers.Unmarshal.PushBackNamed(query.UnmarshalHandler) + svc.Handlers.UnmarshalMeta.PushBackNamed(query.UnmarshalMetaHandler) + svc.Handlers.UnmarshalError.PushBackNamed(query.UnmarshalErrorHandler) // Run custom client initialization if present if initClient != nil { diff --git a/vendor/github.com/aws/aws-sdk-go/service/kinesis/api.go b/vendor/github.com/aws/aws-sdk-go/service/kinesis/api.go index a40f4481e5..87b12e5080 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/kinesis/api.go +++ b/vendor/github.com/aws/aws-sdk-go/service/kinesis/api.go @@ -8,6 +8,8 @@ import ( "github.com/aws/aws-sdk-go/aws/awsutil" "github.com/aws/aws-sdk-go/aws/request" + "github.com/aws/aws-sdk-go/private/protocol" + "github.com/aws/aws-sdk-go/private/protocol/jsonrpc" ) const opAddTagsToStream = "AddTagsToStream" @@ -25,6 +27,8 @@ func (c *Kinesis) AddTagsToStreamRequest(input *AddTagsToStreamInput) (req *requ } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(jsonrpc.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &AddTagsToStreamOutput{} req.Data = output return @@ -56,6 +60,8 @@ func (c *Kinesis) CreateStreamRequest(input *CreateStreamInput) (req *request.Re } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(jsonrpc.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &CreateStreamOutput{} req.Data = output return @@ -118,6 +124,8 @@ func (c *Kinesis) DecreaseStreamRetentionPeriodRequest(input *DecreaseStreamRete } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(jsonrpc.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &DecreaseStreamRetentionPeriodOutput{} req.Data = output return @@ -151,6 +159,8 @@ func (c *Kinesis) DeleteStreamRequest(input *DeleteStreamInput) (req *request.Re } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(jsonrpc.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &DeleteStreamOutput{} req.Data = output return @@ -397,6 +407,8 @@ func (c *Kinesis) IncreaseStreamRetentionPeriodRequest(input *IncreaseStreamRete } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(jsonrpc.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &IncreaseStreamRetentionPeriodOutput{} req.Data = output return @@ -517,6 +529,8 @@ func (c *Kinesis) MergeShardsRequest(input *MergeShardsInput) (req *request.Requ } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(jsonrpc.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &MergeShardsOutput{} req.Data = output return @@ -731,6 +745,8 @@ func (c *Kinesis) RemoveTagsFromStreamRequest(input *RemoveTagsFromStreamInput) } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(jsonrpc.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &RemoveTagsFromStreamOutput{} req.Data = output return @@ -760,6 +776,8 @@ func (c *Kinesis) SplitShardRequest(input *SplitShardInput) (req *request.Reques } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(jsonrpc.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &SplitShardOutput{} req.Data = output return @@ -1315,6 +1333,8 @@ type PutRecordInput struct { // is serialized. When the data blob (the payload before base64-encoding) is // added to the partition key size, the total size must not exceed the maximum // record size (1 MB). + // + // Data is automatically base64 encoded/decoded by the SDK. Data []byte `type:"blob" required:"true"` // The hash value used to explicitly determine the shard the data record is @@ -1430,6 +1450,8 @@ type PutRecordsRequestEntry struct { // is serialized. When the data blob (the payload before base64-encoding) is // added to the partition key size, the total size must not exceed the maximum // record size (1 MB). + // + // Data is automatically base64 encoded/decoded by the SDK. Data []byte `type:"blob" required:"true"` // The hash value used to determine explicitly the shard that the data record @@ -1505,6 +1527,8 @@ type Record struct { // the blob in any way. When the data blob (the payload before base64-encoding) // is added to the partition key size, the total size must not exceed the maximum // record size (1 MB). + // + // Data is automatically base64 encoded/decoded by the SDK. Data []byte `type:"blob" required:"true"` // Identifies which shard in the stream the data record is assigned to. diff --git a/vendor/github.com/aws/aws-sdk-go/service/kinesis/service.go b/vendor/github.com/aws/aws-sdk-go/service/kinesis/service.go index da32f75560..ca728dc2f9 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/kinesis/service.go +++ b/vendor/github.com/aws/aws-sdk-go/service/kinesis/service.go @@ -62,10 +62,10 @@ func newClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegio // Handlers svc.Handlers.Sign.PushBack(v4.Sign) - svc.Handlers.Build.PushBack(jsonrpc.Build) - svc.Handlers.Unmarshal.PushBack(jsonrpc.Unmarshal) - svc.Handlers.UnmarshalMeta.PushBack(jsonrpc.UnmarshalMeta) - svc.Handlers.UnmarshalError.PushBack(jsonrpc.UnmarshalError) + svc.Handlers.Build.PushBackNamed(jsonrpc.BuildHandler) + svc.Handlers.Unmarshal.PushBackNamed(jsonrpc.UnmarshalHandler) + svc.Handlers.UnmarshalMeta.PushBackNamed(jsonrpc.UnmarshalMetaHandler) + svc.Handlers.UnmarshalError.PushBackNamed(jsonrpc.UnmarshalErrorHandler) // Run custom client initialization if present if initClient != nil { diff --git a/vendor/github.com/aws/aws-sdk-go/service/kms/api.go b/vendor/github.com/aws/aws-sdk-go/service/kms/api.go index 27bc06e17b..5d40a89f61 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/kms/api.go +++ b/vendor/github.com/aws/aws-sdk-go/service/kms/api.go @@ -8,6 +8,8 @@ import ( "github.com/aws/aws-sdk-go/aws/awsutil" "github.com/aws/aws-sdk-go/aws/request" + "github.com/aws/aws-sdk-go/private/protocol" + "github.com/aws/aws-sdk-go/private/protocol/jsonrpc" ) const opCancelKeyDeletion = "CancelKeyDeletion" @@ -58,6 +60,8 @@ func (c *KMS) CreateAliasRequest(input *CreateAliasInput) (req *request.Request, } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(jsonrpc.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &CreateAliasOutput{} req.Data = output return @@ -195,6 +199,8 @@ func (c *KMS) DeleteAliasRequest(input *DeleteAliasInput) (req *request.Request, } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(jsonrpc.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &DeleteAliasOutput{} req.Data = output return @@ -249,6 +255,8 @@ func (c *KMS) DisableKeyRequest(input *DisableKeyInput) (req *request.Request, o } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(jsonrpc.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &DisableKeyOutput{} req.Data = output return @@ -280,6 +288,8 @@ func (c *KMS) DisableKeyRotationRequest(input *DisableKeyRotationInput) (req *re } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(jsonrpc.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &DisableKeyRotationOutput{} req.Data = output return @@ -307,6 +317,8 @@ func (c *KMS) EnableKeyRequest(input *EnableKeyInput) (req *request.Request, out } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(jsonrpc.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &EnableKeyOutput{} req.Data = output return @@ -334,6 +346,8 @@ func (c *KMS) EnableKeyRotationRequest(input *EnableKeyRotationInput) (req *requ } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(jsonrpc.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &EnableKeyRotationOutput{} req.Data = output return @@ -768,6 +782,8 @@ func (c *KMS) PutKeyPolicyRequest(input *PutKeyPolicyInput) (req *request.Reques } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(jsonrpc.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &PutKeyPolicyOutput{} req.Data = output return @@ -833,6 +849,8 @@ func (c *KMS) RetireGrantRequest(input *RetireGrantInput) (req *request.Request, } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(jsonrpc.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &RetireGrantOutput{} req.Data = output return @@ -868,6 +886,8 @@ func (c *KMS) RevokeGrantRequest(input *RevokeGrantInput) (req *request.Request, } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(jsonrpc.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &RevokeGrantOutput{} req.Data = output return @@ -938,6 +958,8 @@ func (c *KMS) UpdateAliasRequest(input *UpdateAliasInput) (req *request.Request, } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(jsonrpc.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &UpdateAliasOutput{} req.Data = output return @@ -977,6 +999,8 @@ func (c *KMS) UpdateKeyDescriptionRequest(input *UpdateKeyDescriptionInput) (req } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(jsonrpc.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &UpdateKeyDescriptionOutput{} req.Data = output return @@ -1244,6 +1268,8 @@ type DecryptInput struct { _ struct{} `type:"structure"` // Ciphertext to be decrypted. The blob includes metadata. + // + // CiphertextBlob is automatically base64 encoded/decoded by the SDK. CiphertextBlob []byte `min:"1" type:"blob" required:"true"` // The encryption context. If this was specified in the Encrypt function, it @@ -1277,6 +1303,8 @@ type DecryptOutput struct { // Decrypted plaintext data. This value may not be returned if the customer // master key is not available or if you didn't have permission to use it. + // + // Plaintext is automatically base64 encoded/decoded by the SDK. Plaintext []byte `min:"1" type:"blob"` } @@ -1527,6 +1555,8 @@ type EncryptInput struct { KeyId *string `min:"1" type:"string" required:"true"` // Data to be encrypted. + // + // Plaintext is automatically base64 encoded/decoded by the SDK. Plaintext []byte `min:"1" type:"blob" required:"true"` } @@ -1545,6 +1575,8 @@ type EncryptOutput struct { // The encrypted plaintext. If you are using the CLI, the value is Base64 encoded. // Otherwise, it is not encoded. + // + // CiphertextBlob is automatically base64 encoded/decoded by the SDK. CiphertextBlob []byte `min:"1" type:"blob"` // The ID of the key used during encryption. @@ -1614,6 +1646,8 @@ type GenerateDataKeyOutput struct { // // If you are using the CLI, the value is Base64 encoded. Otherwise, it is // not encoded. + // + // CiphertextBlob is automatically base64 encoded/decoded by the SDK. CiphertextBlob []byte `min:"1" type:"blob"` // System generated unique identifier of the key to be used to decrypt the encrypted @@ -1622,6 +1656,8 @@ type GenerateDataKeyOutput struct { // Plaintext that contains the data key. Use this for encryption and decryption // and then remove it from memory as soon as possible. + // + // Plaintext is automatically base64 encoded/decoded by the SDK. Plaintext []byte `min:"1" type:"blob"` } @@ -1684,6 +1720,8 @@ type GenerateDataKeyWithoutPlaintextOutput struct { // // If you are using the CLI, the value is Base64 encoded. Otherwise, it is // not encoded. + // + // CiphertextBlob is automatically base64 encoded/decoded by the SDK. CiphertextBlob []byte `min:"1" type:"blob"` // System generated unique identifier of the key to be used to decrypt the encrypted @@ -1723,6 +1761,8 @@ type GenerateRandomOutput struct { _ struct{} `type:"structure"` // Plaintext that contains the unpredictable byte string. + // + // Plaintext is automatically base64 encoded/decoded by the SDK. Plaintext []byte `min:"1" type:"blob"` } @@ -2283,6 +2323,8 @@ type ReEncryptInput struct { _ struct{} `type:"structure"` // Ciphertext of the data to re-encrypt. + // + // CiphertextBlob is automatically base64 encoded/decoded by the SDK. CiphertextBlob []byte `min:"1" type:"blob" required:"true"` // Encryption context to be used when the data is re-encrypted. @@ -2323,6 +2365,8 @@ type ReEncryptOutput struct { // The re-encrypted data. If you are using the CLI, the value is Base64 encoded. // Otherwise, it is not encoded. + // + // CiphertextBlob is automatically base64 encoded/decoded by the SDK. CiphertextBlob []byte `min:"1" type:"blob"` // Unique identifier of the key used to re-encrypt the data. diff --git a/vendor/github.com/aws/aws-sdk-go/service/kms/service.go b/vendor/github.com/aws/aws-sdk-go/service/kms/service.go index 46d6cd2c05..3dc53b4297 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/kms/service.go +++ b/vendor/github.com/aws/aws-sdk-go/service/kms/service.go @@ -119,10 +119,10 @@ func newClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegio // Handlers svc.Handlers.Sign.PushBack(v4.Sign) - svc.Handlers.Build.PushBack(jsonrpc.Build) - svc.Handlers.Unmarshal.PushBack(jsonrpc.Unmarshal) - svc.Handlers.UnmarshalMeta.PushBack(jsonrpc.UnmarshalMeta) - svc.Handlers.UnmarshalError.PushBack(jsonrpc.UnmarshalError) + svc.Handlers.Build.PushBackNamed(jsonrpc.BuildHandler) + svc.Handlers.Unmarshal.PushBackNamed(jsonrpc.UnmarshalHandler) + svc.Handlers.UnmarshalMeta.PushBackNamed(jsonrpc.UnmarshalMetaHandler) + svc.Handlers.UnmarshalError.PushBackNamed(jsonrpc.UnmarshalErrorHandler) // Run custom client initialization if present if initClient != nil { diff --git a/vendor/github.com/aws/aws-sdk-go/service/lambda/api.go b/vendor/github.com/aws/aws-sdk-go/service/lambda/api.go index fb3b9be059..a135bbe5ec 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/lambda/api.go +++ b/vendor/github.com/aws/aws-sdk-go/service/lambda/api.go @@ -9,6 +9,8 @@ import ( "github.com/aws/aws-sdk-go/aws/awsutil" "github.com/aws/aws-sdk-go/aws/request" + "github.com/aws/aws-sdk-go/private/protocol" + "github.com/aws/aws-sdk-go/private/protocol/restjson" ) const opAddPermission = "AddPermission" @@ -33,18 +35,17 @@ func (c *Lambda) AddPermissionRequest(input *AddPermissionInput) (req *request.R // Adds a permission to the resource policy associated with the specified AWS // Lambda function. You use resource policies to grant permissions to event -// sources that use "push" model. In "push" model, event sources (such as Amazon +// sources that use push model. In a push model, event sources (such as Amazon // S3 and custom applications) invoke your Lambda function. Each permission // you add to the resource policy allows an event source, permission to invoke // the Lambda function. // // For information about the push model, see AWS Lambda: How it Works (http://docs.aws.amazon.com/lambda/latest/dg/lambda-introduction.html). // -// If you are using versioning feature (see AWS Lambda Function Versioning -// and Aliases (http://docs.aws.amazon.com/lambda/latest/dg/versioning-aliases-v2.html)), -// a Lambda function can have multiple ARNs that can be used to invoke the function. -// Note that, each permission you add to resource policy using this API is specific -// to an ARN, specified using the Qualifier parameter +// If you are using versioning, the permissions you add are specific to the +// Lambda function version or alias you specify in the AddPermission request +// via the Qualifier parameter. For more information about versioning, see AWS +// Lambda Function Versioning and Aliases (http://docs.aws.amazon.com/lambda/latest/dg/versioning-aliases.html). // // This operation requires permission for the lambda:AddPermission action. func (c *Lambda) AddPermission(input *AddPermissionInput) (*AddPermissionOutput, error) { @@ -73,10 +74,11 @@ func (c *Lambda) CreateAliasRequest(input *CreateAliasInput) (req *request.Reque return } -// Creates an alias to the specified Lambda function version. For more information, -// see Introduction to AWS Lambda Aliases (http://docs.aws.amazon.com/lambda/latest/dg/versioning-v2-intro-aliases.html) +// Creates an alias that points to the specified Lambda function version. For +// more information, see Introduction to AWS Lambda Aliases (http://docs.aws.amazon.com/lambda/latest/dg/aliases-intro.html). // -// This requires permission for the lambda:CreateAlias action. +// Alias names are unique for a given function. This requires permission for +// the lambda:CreateAlias action. func (c *Lambda) CreateAlias(input *CreateAliasInput) (*AliasConfiguration, error) { req, out := c.CreateAliasRequest(input) err := req.Send() @@ -107,20 +109,25 @@ func (c *Lambda) CreateEventSourceMappingRequest(input *CreateEventSourceMapping // an Amazon Kinesis stream or an Amazon DynamoDB stream. AWS Lambda invokes // the specified function when records are posted to the stream. // -// This is the pull model, where AWS Lambda invokes the function. For more -// information, go to AWS Lambda: How it Works (http://docs.aws.amazon.com/lambda/latest/dg/lambda-introduction.html) -// in the AWS Lambda Developer Guide. +// This association between a stream source and a Lambda function is called +// the event source mapping. // -// This association between an Amazon Kinesis stream and a Lambda function -// is called the event source mapping. You provide the configuration information -// (for example, which stream to read from and which Lambda function to invoke) -// for the event source mapping in the request body. +// This event source mapping is relevant only in the AWS Lambda pull model, +// where AWS Lambda invokes the function. For more information, go to AWS Lambda: +// How it Works (http://docs.aws.amazon.com/lambda/latest/dg/lambda-introduction.html) +// in the AWS Lambda Developer Guide. You provide mapping information (for +// example, which stream to read from and which Lambda function to invoke) in +// the request body. // // Each event source, such as an Amazon Kinesis or a DynamoDB stream, can // be associated with multiple AWS Lambda function. A given Lambda function // can be associated with multiple AWS event sources. // -// This operation requires permission for the lambda:CreateEventSourceMapping +// If you are using versioning, you can specify a specific function version +// or an alias via the function name parameter. For more information about versioning, +// see AWS Lambda Function Versioning and Aliases (http://docs.aws.amazon.com/lambda/latest/dg/versioning-aliases.html). +// +// This operation requires permission for the lambda:CreateEventSourceMapping // action. func (c *Lambda) CreateEventSourceMapping(input *CreateEventSourceMappingInput) (*EventSourceMappingConfiguration, error) { req, out := c.CreateEventSourceMappingRequest(input) @@ -153,6 +160,10 @@ func (c *Lambda) CreateFunctionRequest(input *CreateFunctionInput) (req *request // in the request body. If the function name already exists, the operation will // fail. Note that the function name is case-sensitive. // +// If you are using versioning, you can also publish a version of the Lambda +// function you are creating using the Publish parameter. For more information +// about versioning, see AWS Lambda Function Versioning and Aliases (http://docs.aws.amazon.com/lambda/latest/dg/versioning-aliases.html). +// // This operation requires permission for the lambda:CreateFunction action. func (c *Lambda) CreateFunction(input *CreateFunctionInput) (*FunctionConfiguration, error) { req, out := c.CreateFunctionRequest(input) @@ -175,13 +186,15 @@ func (c *Lambda) DeleteAliasRequest(input *DeleteAliasInput) (req *request.Reque } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(restjson.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &DeleteAliasOutput{} req.Data = output return } -// Deletes specified Lambda function alias. For more information, see Introduction -// to AWS Lambda Aliases (http://docs.aws.amazon.com/lambda/latest/dg/versioning-v2-intro-aliases.html) +// Deletes the specified Lambda function alias. For more information, see Introduction +// to AWS Lambda Aliases (http://docs.aws.amazon.com/lambda/latest/dg/aliases-intro.html). // // This requires permission for the lambda:DeleteAlias action. func (c *Lambda) DeleteAlias(input *DeleteAliasInput) (*DeleteAliasOutput, error) { @@ -236,6 +249,8 @@ func (c *Lambda) DeleteFunctionRequest(input *DeleteFunctionInput) (req *request } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(restjson.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &DeleteFunctionOutput{} req.Data = output return @@ -243,15 +258,16 @@ func (c *Lambda) DeleteFunctionRequest(input *DeleteFunctionInput) (req *request // Deletes the specified Lambda function code and configuration. // -// If you don't specify a function version, AWS Lambda will delete the function, +// If you are using the versioning feature and you don't specify a function +// version in your DeleteFunction request, AWS Lambda will delete the function, // including all its versions, and any aliases pointing to the function versions. +// To delete a specific function version, you must provide the function version +// via the Qualifier parameter. For information about function versioning, see +// AWS Lambda Function Versioning and Aliases (http://docs.aws.amazon.com/lambda/latest/dg/versioning-aliases.html). // // When you delete a function the associated resource policy is also deleted. // You will need to delete the event source mappings explicitly. // -// For information about function versioning, see AWS Lambda Function Versioning -// and Aliases (http://docs.aws.amazon.com/lambda/latest/dg/versioning-aliases-v2.html). -// // This operation requires permission for the lambda:DeleteFunction action. func (c *Lambda) DeleteFunction(input *DeleteFunctionInput) (*DeleteFunctionOutput, error) { req, out := c.DeleteFunctionRequest(input) @@ -281,7 +297,7 @@ func (c *Lambda) GetAliasRequest(input *GetAliasInput) (req *request.Request, ou // Returns the specified alias information such as the alias ARN, description, // and function version it is pointing to. For more information, see Introduction -// to AWS Lambda Aliases (http://docs.aws.amazon.com/lambda/latest/dg/versioning-v2-intro-aliases.html) +// to AWS Lambda Aliases (http://docs.aws.amazon.com/lambda/latest/dg/aliases-intro.html). // // This requires permission for the lambda:GetAlias action. func (c *Lambda) GetAlias(input *GetAliasInput) (*AliasConfiguration, error) { @@ -351,7 +367,7 @@ func (c *Lambda) GetFunctionRequest(input *GetFunctionInput) (req *request.Reque // version for which you want this information. If you don't specify this parameter, // the API uses unqualified function ARN which return information about the // $LATEST version of the Lambda function. For more information, see AWS Lambda -// Function Versioning and Aliases (http://docs.aws.amazon.com/lambda/latest/dg/versioning-aliases-v2.html). +// Function Versioning and Aliases (http://docs.aws.amazon.com/lambda/latest/dg/versioning-aliases.html). // // This operation requires permission for the lambda:GetFunction action. func (c *Lambda) GetFunction(input *GetFunctionInput) (*GetFunctionOutput, error) { @@ -384,10 +400,12 @@ func (c *Lambda) GetFunctionConfigurationRequest(input *GetFunctionConfiguration // information you provided as parameters when uploading the function by using // CreateFunction. // -// You can use the optional Qualifier parameter to retrieve configuration information -// for a specific Lambda function version. If you don't provide it, the API -// returns information about the $LATEST version of the function. For more information -// about versioning, see AWS Lambda Function Versioning and Aliases (http://docs.aws.amazon.com/lambda/latest/dg/versioning-aliases-v2.html). +// If you are using the versioning feature, you can retrieve this information +// for a specific function version by using the optional Qualifier parameter +// and specifying the function version or alias that points to it. If you don't +// provide it, the API returns information about the $LATEST version of the +// function. For more information about versioning, see AWS Lambda Function +// Versioning and Aliases (http://docs.aws.amazon.com/lambda/latest/dg/versioning-aliases.html). // // This operation requires permission for the lambda:GetFunctionConfiguration // operation. @@ -417,10 +435,14 @@ func (c *Lambda) GetPolicyRequest(input *GetPolicyInput) (req *request.Request, return } -// Returns the resource policy, containing a list of permissions that apply -// to a specific to an ARN that you specify via the Qualifier paramter. +// Returns the resource policy associated with the specified Lambda function. // -// For informration about adding permissions, see AddPermission. +// If you are using the versioning feature, you can get the resource policy +// associated with the specific Lambda function version or alias by specifying +// the version or alias name using the Qualifier parameter. For more information +// about versioning, see AWS Lambda Function Versioning and Aliases (http://docs.aws.amazon.com/lambda/latest/dg/versioning-aliases.html). +// +// For information about adding permissions, see AddPermission. // // You need permission for the lambda:GetPolicy action. func (c *Lambda) GetPolicy(input *GetPolicyInput) (*GetPolicyOutput, error) { @@ -449,20 +471,14 @@ func (c *Lambda) InvokeRequest(input *InvokeInput) (req *request.Request, output return } -// Invokes a specific Lambda function version. +// Invokes a specific Lambda function. // -// If you don't provide the Qualifier parameter, it uses the unqualified function -// ARN which results in invocation of the $LATEST version of the Lambda function -// (when you create a Lambda function, the $LATEST is the version). The AWS -// Lambda versioning and aliases feature allows you to publish multiple versions -// of a Lambda function and also create aliases for each function version. So -// each your Lambda function version can be invoked using multiple ARNs. For -// more information, see AWS Lambda Function Versioning and Aliases (http://docs.aws.amazon.com/lambda/latest/dg/versioning-aliases-v2.html). -// Using the Qualifier parameter, you can specify a function version or alias -// name to invoke specific function version. If you specify function version, -// the API uses the qualified function ARN to invoke a specific function version. -// If you specify alias name, the API uses the alias ARN to invoke the function -// version to which the alias points. +// If you are using the versioning feature, you can invoke the specific function +// version by providing function version or alias name that is pointing to the +// function version using the Qualifier parameter in the request. If you don't +// provide the Qualifier parameter, the $LATEST version of the Lambda function +// is invoked. For information about the versioning feature, see AWS Lambda +// Function Versioning and Aliases (http://docs.aws.amazon.com/lambda/latest/dg/versioning-aliases.html). // // This operation requires permission for the lambda:InvokeFunction action. func (c *Lambda) Invoke(input *InvokeInput) (*InvokeOutput, error) { @@ -475,6 +491,9 @@ const opInvokeAsync = "InvokeAsync" // InvokeAsyncRequest generates a request for the InvokeAsync operation. func (c *Lambda) InvokeAsyncRequest(input *InvokeAsyncInput) (req *request.Request, output *InvokeAsyncOutput) { + if c.Client.Config.Logger != nil { + c.Client.Config.Logger.Log("This operation, InvokeAsync, has been deprecated") + } op := &request.Operation{ Name: opInvokeAsync, HTTPMethod: "POST", @@ -494,7 +513,7 @@ func (c *Lambda) InvokeAsyncRequest(input *InvokeAsyncInput) (req *request.Reque // This API is deprecated. We recommend you use Invoke API (see Invoke). Submits // an invocation request to AWS Lambda. Upon receiving the request, Lambda executes // the specified function asynchronously. To see the logs generated by the Lambda -// function execution, see the CloudWatch logs console. +// function execution, see the CloudWatch Logs console. // // This operation requires permission for the lambda:InvokeFunction action. func (c *Lambda) InvokeAsync(input *InvokeAsyncInput) (*InvokeAsyncOutput, error) { @@ -526,7 +545,7 @@ func (c *Lambda) ListAliasesRequest(input *ListAliasesInput) (req *request.Reque // Returns list of aliases created for a Lambda function. For each alias, the // response includes information such as the alias ARN, description, alias name, // and the function version to which it points. For more information, see Introduction -// to AWS Lambda Aliases (http://docs.aws.amazon.com/lambda/latest/dg/versioning-v2-intro-aliases.html) +// to AWS Lambda Aliases (http://docs.aws.amazon.com/lambda/latest/dg/aliases-intro.html). // // This requires permission for the lambda:ListAliases action. func (c *Lambda) ListAliases(input *ListAliasesInput) (*ListAliasesOutput, error) { @@ -562,12 +581,16 @@ func (c *Lambda) ListEventSourceMappingsRequest(input *ListEventSourceMappingsIn } // Returns a list of event source mappings you created using the CreateEventSourceMapping -// (see CreateEventSourceMapping), where you identify a stream as an event source. -// This list does not include Amazon S3 event sources. +// (see CreateEventSourceMapping). // // For each mapping, the API returns configuration information. You can optionally // specify filters to retrieve specific event source mappings. // +// If you are using the versioning feature, you can get list of event source +// mappings for a specific Lambda function version or an alias as described +// in the FunctionName parameter. For information about the versioning feature, +// see AWS Lambda Function Versioning and Aliases (http://docs.aws.amazon.com/lambda/latest/dg/versioning-aliases.html). +// // This operation requires permission for the lambda:ListEventSourceMappings // action. func (c *Lambda) ListEventSourceMappings(input *ListEventSourceMappingsInput) (*ListEventSourceMappingsOutput, error) { @@ -615,6 +638,10 @@ func (c *Lambda) ListFunctionsRequest(input *ListFunctionsInput) (req *request.R // to retrieve the code for your function. // // This operation requires permission for the lambda:ListFunctions action. +// +// If you are using versioning feature, the response returns list of $LATEST +// versions of your functions. For information about the versioning feature, +// see AWS Lambda Function Versioning and Aliases (http://docs.aws.amazon.com/lambda/latest/dg/versioning-aliases.html). func (c *Lambda) ListFunctions(input *ListFunctionsInput) (*ListFunctionsOutput, error) { req, out := c.ListFunctionsRequest(input) err := req.Send() @@ -649,7 +676,8 @@ func (c *Lambda) ListVersionsByFunctionRequest(input *ListVersionsByFunctionInpu return } -// List all versions of a function. +// List all versions of a function. For information about the versioning feature, +// see AWS Lambda Function Versioning and Aliases (http://docs.aws.amazon.com/lambda/latest/dg/versioning-aliases.html). func (c *Lambda) ListVersionsByFunction(input *ListVersionsByFunctionInput) (*ListVersionsByFunctionOutput, error) { req, out := c.ListVersionsByFunctionRequest(input) err := req.Send() @@ -676,11 +704,11 @@ func (c *Lambda) PublishVersionRequest(input *PublishVersionInput) (req *request return } -// Publishes a version of your function from the current snapshot of HEAD. That -// is, AWS Lambda takes a snapshot of the function code and configuration information -// from HEAD and publishes a new version. The code and handler of this specific -// Lambda function version cannot be modified after publication, but you can -// modify the configuration information. +// Publishes a version of your function from the current snapshot of $LATEST. +// That is, AWS Lambda takes a snapshot of the function code and configuration +// information from $LATEST and publishes a new version. The code and configuration +// cannot be modified after publication. For information about the versioning +// feature, see AWS Lambda Function Versioning and Aliases (http://docs.aws.amazon.com/lambda/latest/dg/versioning-aliases.html). func (c *Lambda) PublishVersion(input *PublishVersionInput) (*FunctionConfiguration, error) { req, out := c.PublishVersionRequest(input) err := req.Send() @@ -702,6 +730,8 @@ func (c *Lambda) RemovePermissionRequest(input *RemovePermissionInput) (req *req } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(restjson.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &RemovePermissionOutput{} req.Data = output return @@ -709,8 +739,12 @@ func (c *Lambda) RemovePermissionRequest(input *RemovePermissionInput) (req *req // You can remove individual permissions from an resource policy associated // with a Lambda function by providing a statement ID that you provided when -// you addded the permission. The API removes corresponding permission that -// is associated with the specific ARN identified by the Qualifier parameter. +// you added the permission. +// +// If you are using versioning, the permissions you remove are specific to +// the Lambda function version or alias you specify in the AddPermission request +// via the Qualifier parameter. For more information about versioning, see AWS +// Lambda Function Versioning and Aliases (http://docs.aws.amazon.com/lambda/latest/dg/versioning-aliases.html). // // Note that removal of a permission will cause an active event source to lose // permission to the function. @@ -742,9 +776,9 @@ func (c *Lambda) UpdateAliasRequest(input *UpdateAliasInput) (req *request.Reque return } -// Using this API you can update function version to which the alias points -// to and alias description. For more information, see Introduction to AWS Lambda -// Aliases (http://docs.aws.amazon.com/lambda/latest/dg/versioning-v2-intro-aliases.html) +// Using this API you can update the function version to which the alias points +// and the alias description. For more information, see Introduction to AWS +// Lambda Aliases (http://docs.aws.amazon.com/lambda/latest/dg/aliases-intro.html). // // This requires permission for the lambda:UpdateAlias action. func (c *Lambda) UpdateAlias(input *UpdateAliasInput) (*AliasConfiguration, error) { @@ -778,6 +812,16 @@ func (c *Lambda) UpdateEventSourceMappingRequest(input *UpdateEventSourceMapping // stream. You can change which function will receive the stream records, but // to change the stream itself, you must create a new mapping. // +// If you are using the versioning feature, you can update the event source +// mapping to map to a specific Lambda function version or alias as described +// in the FunctionName parameter. For information about the versioning feature, +// see AWS Lambda Function Versioning and Aliases (http://docs.aws.amazon.com/lambda/latest/dg/versioning-aliases.html). +// +// If you disable the event source mapping, AWS Lambda stops polling. If you +// enable again, it will resume polling from the time it had stopped polling, +// so you don't lose processing of any records. However, if you delete event +// source mapping and create it again, it will reset. +// // This operation requires permission for the lambda:UpdateEventSourceMapping // action. func (c *Lambda) UpdateEventSourceMapping(input *UpdateEventSourceMappingInput) (*EventSourceMappingConfiguration, error) { @@ -810,6 +854,10 @@ func (c *Lambda) UpdateFunctionCodeRequest(input *UpdateFunctionCodeInput) (req // be used on an existing Lambda function and cannot be used to update the function // configuration. // +// If you are using the versioning feature, note this API will always update +// the $LATEST version of your Lambda function. For information about the versioning +// feature, see AWS Lambda Function Versioning and Aliases (http://docs.aws.amazon.com/lambda/latest/dg/versioning-aliases.html). +// // This operation requires permission for the lambda:UpdateFunctionCode action. func (c *Lambda) UpdateFunctionCode(input *UpdateFunctionCodeInput) (*FunctionConfiguration, error) { req, out := c.UpdateFunctionCodeRequest(input) @@ -842,6 +890,10 @@ func (c *Lambda) UpdateFunctionConfigurationRequest(input *UpdateFunctionConfigu // you want to change. This operation must only be used on an existing Lambda // function and cannot be used to update the function's code. // +// If you are using the versioning feature, note this API will always update +// the $LATEST version of your Lambda function. For information about the versioning +// feature, see AWS Lambda Function Versioning and Aliases (http://docs.aws.amazon.com/lambda/latest/dg/versioning-aliases.html). +// // This operation requires permission for the lambda:UpdateFunctionConfiguration // action. func (c *Lambda) UpdateFunctionConfiguration(input *UpdateFunctionConfigurationInput) (*FunctionConfiguration, error) { @@ -854,38 +906,40 @@ type AddPermissionInput struct { _ struct{} `type:"structure"` // The AWS Lambda action you want to allow in this statement. Each Lambda action - // is a string starting with "lambda:" followed by the API name (see Operations). - // For example, "lambda:CreateFunction". You can use wildcard ("lambda:*") to - // grant permission for all AWS Lambda actions. + // is a string starting with lambda: followed by the API name (see Operations). + // For example, lambda:CreateFunction. You can use wildcard (lambda:*) to grant + // permission for all AWS Lambda actions. Action *string `type:"string" required:"true"` + EventSourceToken *string `type:"string"` + // Name of the Lambda function whose resource policy you are updating by adding // a new permission. // - // You can specify an unqualified function name (for example, "Thumbnail") - // or you can specify Amazon Resource Name (ARN) of the function (for example, - // "arn:aws:lambda:us-west-2:account-id:function:ThumbNail"). AWS Lambda also - // allows you to specify only the account ID qualifier (for example, "account-id:Thumbnail"). + // You can specify a function name (for example, Thumbnail) or you can specify + // Amazon Resource Name (ARN) of the function (for example, arn:aws:lambda:us-west-2:account-id:function:ThumbNail). + // AWS Lambda also allows you to specify partial ARN (for example, account-id:Thumbnail). // Note that the length constraint applies only to the ARN. If you specify only // the function name, it is limited to 64 character in length. FunctionName *string `location:"uri" locationName:"FunctionName" min:"1" type:"string" required:"true"` // The principal who is getting this permission. It can be Amazon S3 service - // Principal ("s3.amazonaws.com") if you want Amazon S3 to invoke the function, + // Principal (s3.amazonaws.com) if you want Amazon S3 to invoke the function, // an AWS account ID if you are granting cross-account permission, or any valid - // AWS service principal such as "sns.amazonaws.com". For example, you might - // want to allow a custom application in another AWS account to push events - // to AWS Lambda by invoking your function. + // AWS service principal such as sns.amazonaws.com. For example, you might want + // to allow a custom application in another AWS account to push events to AWS + // Lambda by invoking your function. Principal *string `type:"string" required:"true"` - // You can specify this optional query parameter to specify function version - // or alias name. The permission will then apply to the specific qualified ARN. - // For example, if you specify function version 2 as the qualifier, then permission - // applies only when request is made using qualified function ARN: + // You can use this optional query parameter to describe a qualified ARN using + // a function version or an alias name. The permission will then apply to the + // specific qualified ARN. For example, if you specify function version 2 as + // the qualifier, then permission applies only when request is made using qualified + // function ARN: // // arn:aws:lambda:aws-region:acct-id:function:function-name:2 // - // If you specify alias name, for example "PROD", then the permission is valid + // If you specify an alias name, for example PROD, then the permission is valid // only for requests made using the alias ARN: // // arn:aws:lambda:aws-region:acct-id:function:function-name:PROD @@ -933,7 +987,8 @@ type AddPermissionOutput struct { _ struct{} `type:"structure"` // The permission statement you specified in the request. The response returns - // the same as a string using "\" as an escape character in the JSON. + // the same as a string using a backslash ("\") as an escape character in the + // JSON. Statement *string `type:"string"` } @@ -951,9 +1006,9 @@ func (s AddPermissionOutput) GoString() string { type AliasConfiguration struct { _ struct{} `type:"structure"` - // Lambda function ARN that is qualified using alias name as the suffix. For - // example, if you create an alias "BETA" pointing to a helloworld function - // version, the ARN is arn:aws:lambda:aws-regions:acct-id:function:helloworld:BETA. + // Lambda function ARN that is qualified using the alias name as the suffix. + // For example, if you create an alias called BETA that points to a helloworld + // function version, the ARN is arn:aws:lambda:aws-regions:acct-id:function:helloworld:BETA. AliasArn *string `type:"string"` // Alias description. @@ -988,7 +1043,7 @@ type CreateAliasInput struct { // Lambda function version for which you are creating the alias. FunctionVersion *string `min:"1" type:"string" required:"true"` - // Name for the alias your creating. + // Name for the alias you are creating. Name *string `min:"1" type:"string" required:"true"` } @@ -1023,12 +1078,19 @@ type CreateEventSourceMappingInput struct { // The Lambda function to invoke when AWS Lambda detects an event on the stream. // - // You can specify an unqualified function name (for example, "Thumbnail") - // or you can specify Amazon Resource Name (ARN) of the function (for example, - // "arn:aws:lambda:us-west-2:account-id:function:ThumbNail"). AWS Lambda also - // allows you to specify only the account ID qualifier (for example, "account-id:Thumbnail"). - // Note that the length constraint applies only to the ARN. If you specify only - // the function name, it is limited to 64 character in length. + // You can specify the function name (for example, Thumbnail) or you can specify + // Amazon Resource Name (ARN) of the function (for example, arn:aws:lambda:us-west-2:account-id:function:ThumbNail). + // + // If you are using versioning, you can also provide a qualified function + // ARN (ARN that is qualified with function version or alias name as suffix). + // For more information about versioning, see AWS Lambda Function Versioning + // and Aliases (http://docs.aws.amazon.com/lambda/latest/dg/versioning-aliases.html) + // + // AWS Lambda also allows you to specify only the function name with the account + // ID qualifier (for example, account-id:Thumbnail). + // + // Note that the length constraint applies only to the ARN. If you specify + // only the function name, it is limited to 64 character in length. FunctionName *string `min:"1" type:"string" required:"true"` // The position in the stream where AWS Lambda should start reading. For more @@ -1057,15 +1119,9 @@ type CreateFunctionInput struct { // Assign a meaningful description as you see fit. Description *string `type:"string"` - // The name you want to assign to the function you are uploading. You can specify - // an unqualified function name (for example, "Thumbnail") or you can specify - // Amazon Resource Name (ARN) of the function (for example, "arn:aws:lambda:us-west-2:account-id:function:ThumbNail"). - // AWS Lambda also allows you to specify only the account ID qualifier (for - // example, "account-id:Thumbnail"). Note that the length constraint applies - // only to the ARN. If you specify only the function name, it is limited to - // 64 character in length. The function names appear in the console and are - // returned in the ListFunctions API. Function names are used to specify functions - // to other AWS Lambda APIs, such as Invoke. + // The name you want to assign to the function you are uploading. The function + // names appear in the console and are returned in the ListFunctions API. Function + // names are used to specify functions to other AWS Lambda APIs, such as Invoke. FunctionName *string `min:"1" type:"string" required:"true"` // The function within your code that Lambda calls to begin execution. For Node.js, @@ -1088,17 +1144,22 @@ type CreateFunctionInput struct { // The Amazon Resource Name (ARN) of the IAM role that Lambda assumes when it // executes your function to access any other Amazon Web Services (AWS) resources. - // For more information, see AWS Lambda: How it Works (http://docs.aws.amazon.com/lambda/latest/dg/lambda-introduction.html) + // For more information, see AWS Lambda: How it Works (http://docs.aws.amazon.com/lambda/latest/dg/lambda-introduction.html). Role *string `type:"string" required:"true"` - // The runtime environment for the Lambda function you are uploading. Currently, - // Lambda supports "java" and "nodejs" as the runtime. + // The runtime environment for the Lambda function you are uploading. Runtime *string `type:"string" required:"true" enum:"Runtime"` // The function execution time at which Lambda should terminate the function. // Because the execution time has cost implications, we recommend you set this // value based on your expected execution time. The default is 3 seconds. Timeout *int64 `min:"1" type:"integer"` + + // If your Lambda function accesses resources in a VPC, you provide this parameter + // identifying the list of security group IDs and subnet IDs. These must belong + // to the same VPC. You must provide at least one security group and one subnet + // ID. + VpcConfig *VpcConfig `type:"structure"` } // String returns the string representation @@ -1114,7 +1175,8 @@ func (s CreateFunctionInput) GoString() string { type DeleteAliasInput struct { _ struct{} `type:"structure"` - // The Lambda function name for which the alias is created. + // The Lambda function name for which the alias is created. Deleting an alias + // does not delete the function version to which it is pointing. FunctionName *string `location:"uri" locationName:"FunctionName" min:"1" type:"string" required:"true"` // Name of the alias to delete. @@ -1167,12 +1229,14 @@ type DeleteFunctionInput struct { // The Lambda function to delete. // - // You can specify an unqualified function name (for example, "Thumbnail") - // or you can specify Amazon Resource Name (ARN) of the function (for example, - // "arn:aws:lambda:us-west-2:account-id:function:ThumbNail"). AWS Lambda also - // allows you to specify only the account ID qualifier (for example, "account-id:Thumbnail"). - // Note that the length constraint applies only to the ARN. If you specify only - // the function name, it is limited to 64 character in length. + // You can specify the function name (for example, Thumbnail) or you can specify + // Amazon Resource Name (ARN) of the function (for example, arn:aws:lambda:us-west-2:account-id:function:ThumbNail). + // If you are using versioning, you can also provide a qualified function ARN + // (ARN that is qualified with function version or alias name as suffix). AWS + // Lambda also allows you to specify only the function name with the account + // ID qualifier (for example, account-id:Thumbnail). Note that the length constraint + // applies only to the ARN. If you specify only the function name, it is limited + // to 64 character in length. FunctionName *string `location:"uri" locationName:"FunctionName" min:"1" type:"string" required:"true"` // Using this optional parameter you can specify a function version (but not @@ -1183,11 +1247,11 @@ type DeleteFunctionInput struct { // as the value of this parameter. The $LATEST version can be deleted only when // you want to delete all the function versions and aliases. // - // You can only specify a function version and not alias name using this parameter. + // You can only specify a function version, not an alias name, using this parameter. // You cannot delete a function version using its alias. // // If you don't specify this parameter, AWS Lambda will delete the function, - // including all its versions and aliases. + // including all of its versions and aliases. Qualifier *string `location:"querystring" locationName:"Qualifier" min:"1" type:"string"` } @@ -1237,8 +1301,8 @@ type EventSourceMappingConfiguration struct { // The result of the last AWS Lambda invocation of your Lambda function. LastProcessingResult *string `type:"string"` - // The state of the event source mapping. It can be "Creating", "Enabled", "Disabled", - // "Enabling", "Disabling", "Updating", or "Deleting". + // The state of the event source mapping. It can be Creating, Enabled, Disabled, + // Enabling, Disabling, Updating, or Deleting. State *string `type:"string"` // The reason the event source mapping is in its current state. It is either @@ -1274,9 +1338,13 @@ type FunctionCode struct { // The Amazon S3 object (the deployment package) version you want to upload. S3ObjectVersion *string `min:"1" type:"string"` - // A base64-encoded .zip file containing your deployment package. For more information + // A zip file containing your deployment package. If you are using the API directly, + // the zip file must be base64-encoded (if you are using the AWS SDKs or the + // AWS CLI, the SDKs or CLI will do the encoding for you). For more information // about creating a .zip file, go to Execution Permissions (http://docs.aws.amazon.com/lambda/latest/dg/intro-permission-model.html#lambda-intro-execution-role.html) // in the AWS Lambda Developer Guide. + // + // ZipFile is automatically base64 encoded/decoded by the SDK. ZipFile []byte `type:"blob"` } @@ -1334,7 +1402,7 @@ type FunctionConfiguration struct { // The function Lambda calls to begin executing your function. Handler *string `type:"string"` - // The timestamp of the last time you updated the function. + // The time stamp of the last time you updated the function. LastModified *string `type:"string"` // The memory size, in MB, you configured for the function. Must be a multiple @@ -1355,6 +1423,9 @@ type FunctionConfiguration struct { // The version of the Lambda function. Version *string `min:"1" type:"string"` + + // VPC configuration associated with your Lambda function. + VpcConfig *VpcConfigResponse `type:"structure"` } // String returns the string representation @@ -1371,7 +1442,7 @@ type GetAliasInput struct { _ struct{} `type:"structure"` // Function name for which the alias is created. An alias is a subresource that - // exists only in the context of an existing Lambda function. So you must specify + // exists only in the context of an existing Lambda function so you must specify // the function name. FunctionName *string `location:"uri" locationName:"FunctionName" min:"1" type:"string" required:"true"` @@ -1412,19 +1483,18 @@ type GetFunctionConfigurationInput struct { // The name of the Lambda function for which you want to retrieve the configuration // information. // - // You can specify an unqualified function name (for example, "Thumbnail") - // or you can specify Amazon Resource Name (ARN) of the function (for example, - // "arn:aws:lambda:us-west-2:account-id:function:ThumbNail"). AWS Lambda also - // allows you to specify only the account ID qualifier (for example, "account-id:Thumbnail"). + // You can specify a function name (for example, Thumbnail) or you can specify + // Amazon Resource Name (ARN) of the function (for example, arn:aws:lambda:us-west-2:account-id:function:ThumbNail). + // AWS Lambda also allows you to specify a partial ARN (for example, account-id:Thumbnail). // Note that the length constraint applies only to the ARN. If you specify only // the function name, it is limited to 64 character in length. FunctionName *string `location:"uri" locationName:"FunctionName" min:"1" type:"string" required:"true"` - // Using this optional parameter you can specify function version or alias name. - // If you specify function version, the API uses qualified function ARN and - // returns information about the specific function version. if you specify alias - // name, the API uses alias ARN and returns information about the function version - // to which the alias points. + // Using this optional parameter you can specify a function version or an alias + // name. If you specify function version, the API uses qualified function ARN + // and returns information about the specific function version. If you specify + // an alias name, the API uses the alias ARN and returns information about the + // function version to which the alias points. // // If you don't specify this parameter, the API uses unqualified function ARN, // and returns information about the $LATEST function version. @@ -1446,18 +1516,17 @@ type GetFunctionInput struct { // The Lambda function name. // - // You can specify an unqualified function name (for example, "Thumbnail") - // or you can specify Amazon Resource Name (ARN) of the function (for example, - // "arn:aws:lambda:us-west-2:account-id:function:ThumbNail"). AWS Lambda also - // allows you to specify only the account ID qualifier (for example, "account-id:Thumbnail"). + // You can specify a function name (for example, Thumbnail) or you can specify + // Amazon Resource Name (ARN) of the function (for example, arn:aws:lambda:us-west-2:account-id:function:ThumbNail). + // AWS Lambda also allows you to specify a partial ARN (for example, account-id:Thumbnail). // Note that the length constraint applies only to the ARN. If you specify only // the function name, it is limited to 64 character in length. FunctionName *string `location:"uri" locationName:"FunctionName" min:"1" type:"string" required:"true"` - // Using this optional parameter to specify a function version or alias name. + // Using this optional parameter to specify a function version or an alias name. // If you specify function version, the API uses qualified function ARN for // the request and returns information about the specific Lambda function version. - // If you specify alias name, the API uses alias ARN and returns information + // If you specify an alias name, the API uses the alias ARN and returns information // about the function version to which the alias points. If you don't provide // this parameter, the API uses unqualified function ARN and returns information // about the $LATEST version of the Lambda function. @@ -1474,7 +1543,7 @@ func (s GetFunctionInput) GoString() string { return s.String() } -// This response contains the object for the Lambda function location (see API_FunctionCodeLocation +// This response contains the object for the Lambda function location (see API_FunctionCodeLocation. type GetFunctionOutput struct { _ struct{} `type:"structure"` @@ -1500,19 +1569,21 @@ type GetPolicyInput struct { // Function name whose resource policy you want to retrieve. // - // You can specify an unqualified function name (for example, "Thumbnail") - // or you can specify Amazon Resource Name (ARN) of the function (for example, - // "arn:aws:lambda:us-west-2:account-id:function:ThumbNail"). AWS Lambda also - // allows you to specify only the account ID qualifier (for example, "account-id:Thumbnail"). - // Note that the length constraint applies only to the ARN. If you specify only - // the function name, it is limited to 64 character in length. + // You can specify the function name (for example, Thumbnail) or you can specify + // Amazon Resource Name (ARN) of the function (for example, arn:aws:lambda:us-west-2:account-id:function:ThumbNail). + // If you are using versioning, you can also provide a qualified function ARN + // (ARN that is qualified with function version or alias name as suffix). AWS + // Lambda also allows you to specify only the function name with the account + // ID qualifier (for example, account-id:Thumbnail). Note that the length constraint + // applies only to the ARN. If you specify only the function name, it is limited + // to 64 character in length. FunctionName *string `location:"uri" locationName:"FunctionName" min:"1" type:"string" required:"true"` - // You can specify this optional query parameter to specify function version - // or alias name in which case this API will return all permissions associated - // with the specific ARN. If you don't provide this parameter, the API will - // return permissions that apply to the unqualified function ARN. - Qualifier *string `min:"1" type:"string"` + // You can specify this optional query parameter to specify a function version + // or an alias name in which case this API will return all permissions associated + // with the specific qualified ARN. If you don't provide this parameter, the + // API will return permissions that apply to the unqualified function ARN. + Qualifier *string `location:"querystring" locationName:"Qualifier" min:"1" type:"string"` } // String returns the string representation @@ -1529,7 +1600,8 @@ type GetPolicyOutput struct { _ struct{} `type:"structure"` // The resource policy associated with the specified function. The response - // returns the same as a string using "\" as an escape character in the JSON. + // returns the same as a string using a backslash ("\") as an escape character + // in the JSON. Policy *string `type:"string"` } @@ -1544,7 +1616,7 @@ func (s GetPolicyOutput) GoString() string { } type InvokeAsyncInput struct { - _ struct{} `type:"structure" payload:"InvokeArgs"` + _ struct{} `deprecated:"true" type:"structure" payload:"InvokeArgs"` // The Lambda function name. FunctionName *string `location:"uri" locationName:"FunctionName" min:"1" type:"string" required:"true"` @@ -1565,7 +1637,7 @@ func (s InvokeAsyncInput) GoString() string { // Upon success, it returns empty response. Otherwise, throws an exception. type InvokeAsyncOutput struct { - _ struct{} `type:"structure"` + _ struct{} `deprecated:"true" type:"structure"` // It will be 202 upon success. Status *int64 `location:"statusCode" type:"integer"` @@ -1587,7 +1659,7 @@ type InvokeInput struct { // Using the ClientContext you can pass client-specific information to the Lambda // function you are invoking. You can then process the client information in // your Lambda function as you choose through the context variable. For an example - // of a ClientContext JSON, go to PutEvents (http://docs.aws.amazon.com/mobileanalytics/latest/ug/PutEvents.html) + // of a ClientContext JSON, see PutEvents (http://docs.aws.amazon.com/mobileanalytics/latest/ug/PutEvents.html) // in the Amazon Mobile Analytics API Reference and User Guide. // // The ClientContext JSON must be base64-encoded. @@ -1595,37 +1667,36 @@ type InvokeInput struct { // The Lambda function name. // - // You can specify an unqualified function name (for example, "Thumbnail") - // or you can specify Amazon Resource Name (ARN) of the function (for example, - // "arn:aws:lambda:us-west-2:account-id:function:ThumbNail"). AWS Lambda also - // allows you to specify only the account ID qualifier (for example, "account-id:Thumbnail"). + // You can specify a function name (for example, Thumbnail) or you can specify + // Amazon Resource Name (ARN) of the function (for example, arn:aws:lambda:us-west-2:account-id:function:ThumbNail). + // AWS Lambda also allows you to specify a partial ARN (for example, account-id:Thumbnail). // Note that the length constraint applies only to the ARN. If you specify only // the function name, it is limited to 64 character in length. FunctionName *string `location:"uri" locationName:"FunctionName" min:"1" type:"string" required:"true"` - // By default, the Invoke API assumes "RequestResponse" invocation type. You - // can optionally request asynchronous execution by specifying "Event" as the - // InvocationType. You can also use this parameter to request AWS Lambda to - // not execute the function but do some verification, such as if the caller - // is authorized to invoke the function and if the inputs are valid. You request - // this by specifying "DryRun" as the InvocationType. This is useful in a cross-account - // scenario when you want to verify access to a function without running it. + // By default, the Invoke API assumes RequestResponse invocation type. You can + // optionally request asynchronous execution by specifying Event as the InvocationType. + // You can also use this parameter to request AWS Lambda to not execute the + // function but do some verification, such as if the caller is authorized to + // invoke the function and if the inputs are valid. You request this by specifying + // DryRun as the InvocationType. This is useful in a cross-account scenario + // when you want to verify access to a function without running it. InvocationType *string `location:"header" locationName:"X-Amz-Invocation-Type" type:"string" enum:"InvocationType"` - // You can set this optional parameter to "Tail" in the request only if you - // specify the InvocationType parameter with value "RequestResponse". In this - // case, AWS Lambda returns the base64-encoded last 4 KB of log data produced - // by your Lambda function in the x-amz-log-results header. + // You can set this optional parameter to Tail in the request only if you specify + // the InvocationType parameter with value RequestResponse. In this case, AWS + // Lambda returns the base64-encoded last 4 KB of log data produced by your + // Lambda function in the x-amz-log-results header. LogType *string `location:"header" locationName:"X-Amz-Log-Type" type:"string" enum:"LogType"` // JSON that you want to provide to your Lambda function as input. Payload []byte `type:"blob"` - // You can use this optional paramter to specify a Lambda function version or - // alias name. If you specify function version, the API uses qualified function - // ARN to invoke a specific Lambda function. If you specify alias name, the - // API uses the alias ARN to invoke the Lambda function version to which the - // alias points. + // You can use this optional parameter to specify a Lambda function version + // or alias name. If you specify a function version, the API uses the qualified + // function ARN to invoke a specific Lambda function. If you specify an alias + // name, the API uses the alias ARN to invoke the Lambda function version to + // which the alias points. // // If you don't provide this parameter, then the API uses unqualified function // ARN which results in invocation of the $LATEST version. @@ -1655,12 +1726,12 @@ type InvokeOutput struct { FunctionError *string `location:"header" locationName:"X-Amz-Function-Error" type:"string"` // It is the base64-encoded logs for the Lambda function invocation. This is - // present only if the invocation type is "RequestResponse" and the logs were + // present only if the invocation type is RequestResponse and the logs were // requested. LogResult *string `location:"header" locationName:"X-Amz-Log-Result" type:"string"` // It is the JSON representation of the object returned by the Lambda function. - // In This is present only if the invocation type is "RequestResponse". + // In This is present only if the invocation type is RequestResponse. // // In the event of a function error this field contains a message describing // the error. For the Handled errors the Lambda function will report this message. @@ -1668,8 +1739,8 @@ type InvokeOutput struct { Payload []byte `type:"blob"` // The HTTP status code will be in the 200 range for successful request. For - // the "RequestResonse" invocation type this status code will be 200. For the - // "Event" invocation type this status code will be 202. For the "DryRun" invocation + // the RequestResonse invocation type this status code will be 200. For the + // Event invocation type this status code will be 202. For the DryRun invocation // type the status code will be 204. StatusCode *int64 `location:"statusCode" type:"integer"` } @@ -1691,8 +1762,8 @@ type ListAliasesInput struct { FunctionName *string `location:"uri" locationName:"FunctionName" min:"1" type:"string" required:"true"` // If you specify this optional parameter, the API returns only the aliases - // pointing to the specific Lambda function version, otherwise returns all aliases - // created for the Lambda function. + // that are pointing to the specific Lambda function version, otherwise the + // API returns all of the aliases created for the Lambda function. FunctionVersion *string `location:"querystring" locationName:"FunctionVersion" min:"1" type:"string"` // Optional string. An opaque pagination token returned from a previous ListAliases @@ -1717,7 +1788,7 @@ func (s ListAliasesInput) GoString() string { type ListAliasesOutput struct { _ struct{} `type:"structure"` - // An list of alises. + // A list of aliases. Aliases []*AliasConfiguration `type:"list"` // A string, present if there are more aliases. @@ -1742,12 +1813,14 @@ type ListEventSourceMappingsInput struct { // The name of the Lambda function. // - // You can specify an unqualified function name (for example, "Thumbnail") - // or you can specify Amazon Resource Name (ARN) of the function (for example, - // "arn:aws:lambda:us-west-2:account-id:function:ThumbNail"). AWS Lambda also - // allows you to specify only the account ID qualifier (for example, "account-id:Thumbnail"). - // Note that the length constraint applies only to the ARN. If you specify only - // the function name, it is limited to 64 character in length. + // You can specify the function name (for example, Thumbnail) or you can specify + // Amazon Resource Name (ARN) of the function (for example, arn:aws:lambda:us-west-2:account-id:function:ThumbNail). + // If you are using versioning, you can also provide a qualified function ARN + // (ARN that is qualified with function version or alias name as suffix). AWS + // Lambda also allows you to specify only the function name with the account + // ID qualifier (for example, account-id:Thumbnail). Note that the length constraint + // applies only to the ARN. If you specify only the function name, it is limited + // to 64 character in length. FunctionName *string `location:"querystring" locationName:"FunctionName" min:"1" type:"string"` // Optional string. An opaque pagination token returned from a previous ListEventSourceMappings @@ -1837,13 +1910,12 @@ func (s ListFunctionsOutput) GoString() string { type ListVersionsByFunctionInput struct { _ struct{} `type:"structure"` - // Function name whose versions to list. You can specify an unqualified function - // name (for example, "Thumbnail") or you can specify Amazon Resource Name (ARN) - // of the function (for example, "arn:aws:lambda:us-west-2:account-id:function:ThumbNail"). - // AWS Lambda also allows you to specify only the account ID qualifier (for - // example, "account-id:Thumbnail"). Note that the length constraint applies - // only to the ARN. If you specify only the function name, it is limited to - // 64 character in length. + // Function name whose versions to list. You can specify a function name (for + // example, Thumbnail) or you can specify Amazon Resource Name (ARN) of the + // function (for example, arn:aws:lambda:us-west-2:account-id:function:ThumbNail). + // AWS Lambda also allows you to specify a partial ARN (for example, account-id:Thumbnail). + // Note that the length constraint applies only to the ARN. If you specify only + // the function name, it is limited to 64 character in length. FunctionName *string `location:"uri" locationName:"FunctionName" min:"1" type:"string" required:"true"` // Optional string. An opaque pagination token returned from a previous ListVersionsByFunction @@ -1890,20 +1962,20 @@ type PublishVersionInput struct { // The SHA256 hash of the deployment package you want to publish. This provides // validation on the code you are publishing. If you provide this parameter - // value must match the SHA256 of the HEAD version for the publication to succeed. + // value must match the SHA256 of the $LATEST version for the publication to + // succeed. CodeSha256 *string `type:"string"` // The description for the version you are publishing. If not provided, AWS - // Lambda copies the description from the HEAD version. + // Lambda copies the description from the $LATEST version. Description *string `type:"string"` - // The Lambda function name. You can specify an unqualified function name (for - // example, "Thumbnail") or you can specify Amazon Resource Name (ARN) of the - // function (for example, "arn:aws:lambda:us-west-2:account-id:function:ThumbNail"). - // AWS Lambda also allows you to specify only the account ID qualifier (for - // example, "account-id:Thumbnail"). Note that the length constraint applies - // only to the ARN. If you specify only the function name, it is limited to - // 64 character in length. + // The Lambda function name. You can specify a function name (for example, Thumbnail) + // or you can specify Amazon Resource Name (ARN) of the function (for example, + // arn:aws:lambda:us-west-2:account-id:function:ThumbNail). AWS Lambda also + // allows you to specify a partial ARN (for example, account-id:Thumbnail). + // Note that the length constraint applies only to the ARN. If you specify only + // the function name, it is limited to 64 character in length. FunctionName *string `location:"uri" locationName:"FunctionName" min:"1" type:"string" required:"true"` } @@ -1922,18 +1994,17 @@ type RemovePermissionInput struct { // Lambda function whose resource policy you want to remove a permission from. // - // You can specify an unqualified function name (for example, "Thumbnail") - // or you can specify Amazon Resource Name (ARN) of the function (for example, - // "arn:aws:lambda:us-west-2:account-id:function:ThumbNail"). AWS Lambda also - // allows you to specify only the account ID qualifier (for example, "account-id:Thumbnail"). + // You can specify a function name (for example, Thumbnail) or you can specify + // Amazon Resource Name (ARN) of the function (for example, arn:aws:lambda:us-west-2:account-id:function:ThumbNail). + // AWS Lambda also allows you to specify a partial ARN (for example, account-id:Thumbnail). // Note that the length constraint applies only to the ARN. If you specify only // the function name, it is limited to 64 character in length. FunctionName *string `location:"uri" locationName:"FunctionName" min:"1" type:"string" required:"true"` // You can specify this optional parameter to remove permission associated with - // a specific function version or function alias. The value of this paramter - // is the function version or alias name. If you don't specify this parameter, - // the API removes permission associated with the unqualified function ARN. + // a specific function version or function alias. If you don't specify this + // parameter, the API removes permission associated with the unqualified function + // ARN. Qualifier *string `location:"querystring" locationName:"Qualifier" min:"1" type:"string"` // Statement ID of the permission to remove. @@ -1967,14 +2038,14 @@ func (s RemovePermissionOutput) GoString() string { type UpdateAliasInput struct { _ struct{} `type:"structure"` - // You can optionally change the description of the alias using this parameter. + // You can change the description of the alias using this parameter. Description *string `type:"string"` // The function name for which the alias is created. FunctionName *string `location:"uri" locationName:"FunctionName" min:"1" type:"string" required:"true"` - // Using this parameter you can optionally change the Lambda function version - // to which the alias to points to. + // Using this parameter you can change the Lambda function version to which + // the alias points. FunctionVersion *string `min:"1" type:"string"` // The alias name. @@ -2004,12 +2075,17 @@ type UpdateEventSourceMappingInput struct { // The Lambda function to which you want the stream records sent. // - // You can specify an unqualified function name (for example, "Thumbnail") - // or you can specify Amazon Resource Name (ARN) of the function (for example, - // "arn:aws:lambda:us-west-2:account-id:function:ThumbNail"). AWS Lambda also - // allows you to specify only the account ID qualifier (for example, "account-id:Thumbnail"). - // Note that the length constraint applies only to the ARN. If you specify only - // the function name, it is limited to 64 character in length. + // You can specify a function name (for example, Thumbnail) or you can specify + // Amazon Resource Name (ARN) of the function (for example, arn:aws:lambda:us-west-2:account-id:function:ThumbNail). + // AWS Lambda also allows you to specify a partial ARN (for example, account-id:Thumbnail). + // + // If you are using versioning, you can also provide a qualified function ARN + // (ARN that is qualified with function version or alias name as suffix). For + // more information about versioning, see AWS Lambda Function Versioning and + // Aliases (http://docs.aws.amazon.com/lambda/latest/dg/versioning-aliases.html) + // + // Note that the length constraint applies only to the ARN. If you specify + // only the function name, it is limited to 64 character in length. FunctionName *string `min:"1" type:"string"` // The event source mapping identifier. @@ -2031,10 +2107,9 @@ type UpdateFunctionCodeInput struct { // The existing Lambda function name whose code you want to replace. // - // You can specify an unqualified function name (for example, "Thumbnail") - // or you can specify Amazon Resource Name (ARN) of the function (for example, - // "arn:aws:lambda:us-west-2:account-id:function:ThumbNail"). AWS Lambda also - // allows you to specify only the account ID qualifier (for example, "account-id:Thumbnail"). + // You can specify a function name (for example, Thumbnail) or you can specify + // Amazon Resource Name (ARN) of the function (for example, arn:aws:lambda:us-west-2:account-id:function:ThumbNail). + // AWS Lambda also allows you to specify a partial ARN (for example, account-id:Thumbnail). // Note that the length constraint applies only to the ARN. If you specify only // the function name, it is limited to 64 character in length. FunctionName *string `location:"uri" locationName:"FunctionName" min:"1" type:"string" required:"true"` @@ -2055,6 +2130,8 @@ type UpdateFunctionCodeInput struct { S3ObjectVersion *string `min:"1" type:"string"` // Based64-encoded .zip file containing your packaged source code. + // + // ZipFile is automatically base64 encoded/decoded by the SDK. ZipFile []byte `type:"blob"` } @@ -2077,10 +2154,9 @@ type UpdateFunctionConfigurationInput struct { // The name of the Lambda function. // - // You can specify an unqualified function name (for example, "Thumbnail") - // or you can specify Amazon Resource Name (ARN) of the function (for example, - // "arn:aws:lambda:us-west-2:account-id:function:ThumbNail"). AWS Lambda also - // allows you to specify only the account ID qualifier (for example, "account-id:Thumbnail"). + // You can specify a function name (for example, Thumbnail) or you can specify + // Amazon Resource Name (ARN) of the function (for example, arn:aws:lambda:us-west-2:account-id:function:ThumbNail). + // AWS Lambda also allows you to specify a partial ARN (for example, account-id:Thumbnail). // Note that the length constraint applies only to the ARN. If you specify only // the function name, it is limited to 64 character in length. FunctionName *string `location:"uri" locationName:"FunctionName" min:"1" type:"string" required:"true"` @@ -2101,10 +2177,18 @@ type UpdateFunctionConfigurationInput struct { // it executes your function. Role *string `type:"string"` + Runtime *string `type:"string" enum:"Runtime"` + // The function execution time at which AWS Lambda should terminate the function. // Because the execution time has cost implications, we recommend you set this // value based on your expected execution time. The default is 3 seconds. Timeout *int64 `min:"1" type:"integer"` + + // If your Lambda function accesses resources in a VPC, you provide this parameter + // identifying the list of security group IDs and subnet IDs. These must belong + // to the same VPC. You must provide at least one security group and one subnet + // ID. + VpcConfig *VpcConfig `type:"structure"` } // String returns the string representation @@ -2117,6 +2201,54 @@ func (s UpdateFunctionConfigurationInput) GoString() string { return s.String() } +// If your Lambda function accesses resources in a VPC, you provide this parameter +// identifying the list of security group IDs and subnet IDs. These must belong +// to the same VPC. You must provide at least one security group and one subnet +// ID. +type VpcConfig struct { + _ struct{} `type:"structure"` + + // A list of one or more security groups IDs in your VPC. + SecurityGroupIds []*string `type:"list"` + + // A list of one or more subnet IDs in your VPC. + SubnetIds []*string `type:"list"` +} + +// String returns the string representation +func (s VpcConfig) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s VpcConfig) GoString() string { + return s.String() +} + +// VPC configuration associated with your Lambda function. +type VpcConfigResponse struct { + _ struct{} `type:"structure"` + + // A list of security group IDs associated with the Lambda function. + SecurityGroupIds []*string `type:"list"` + + // A list of subnet IDs associated with the Lambda function. + SubnetIds []*string `type:"list"` + + // The VPC ID associated with you Lambda function. + VpcId *string `type:"string"` +} + +// String returns the string representation +func (s VpcConfigResponse) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s VpcConfigResponse) GoString() string { + return s.String() +} + const ( // @enum EventSourcePosition EventSourcePositionTrimHorizon = "TRIM_HORIZON" @@ -2144,6 +2276,8 @@ const ( // @enum Runtime RuntimeNodejs = "nodejs" // @enum Runtime + RuntimeNodejs43 = "nodejs4.3" + // @enum Runtime RuntimeJava8 = "java8" // @enum Runtime RuntimePython27 = "python2.7" diff --git a/vendor/github.com/aws/aws-sdk-go/service/lambda/service.go b/vendor/github.com/aws/aws-sdk-go/service/lambda/service.go index bac7c3af75..0ccde6c02a 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/lambda/service.go +++ b/vendor/github.com/aws/aws-sdk-go/service/lambda/service.go @@ -65,10 +65,10 @@ func newClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegio // Handlers svc.Handlers.Sign.PushBack(v4.Sign) - svc.Handlers.Build.PushBack(restjson.Build) - svc.Handlers.Unmarshal.PushBack(restjson.Unmarshal) - svc.Handlers.UnmarshalMeta.PushBack(restjson.UnmarshalMeta) - svc.Handlers.UnmarshalError.PushBack(restjson.UnmarshalError) + svc.Handlers.Build.PushBackNamed(restjson.BuildHandler) + svc.Handlers.Unmarshal.PushBackNamed(restjson.UnmarshalHandler) + svc.Handlers.UnmarshalMeta.PushBackNamed(restjson.UnmarshalMetaHandler) + svc.Handlers.UnmarshalError.PushBackNamed(restjson.UnmarshalErrorHandler) // Run custom client initialization if present if initClient != nil { diff --git a/vendor/github.com/aws/aws-sdk-go/service/rds/api.go b/vendor/github.com/aws/aws-sdk-go/service/rds/api.go index 66b2f2c346..422b5f5476 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/rds/api.go +++ b/vendor/github.com/aws/aws-sdk-go/service/rds/api.go @@ -8,6 +8,8 @@ import ( "github.com/aws/aws-sdk-go/aws/awsutil" "github.com/aws/aws-sdk-go/aws/request" + "github.com/aws/aws-sdk-go/private/protocol" + "github.com/aws/aws-sdk-go/private/protocol/query" ) const opAddSourceIdentifierToSubscription = "AddSourceIdentifierToSubscription" @@ -52,6 +54,8 @@ func (c *RDS) AddTagsToResourceRequest(input *AddTagsToResourceInput) (req *requ } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &AddTagsToResourceOutput{} req.Data = output return @@ -127,8 +131,9 @@ func (c *RDS) AuthorizeDBSecurityGroupIngressRequest(input *AuthorizeDBSecurityG // // You cannot authorize ingress from an EC2 security group in one region to // an Amazon RDS DB instance in another. You cannot authorize ingress from a -// VPC security group in one VPC to an Amazon RDS DB instance in another. For -// an overview of CIDR ranges, go to the Wikipedia Tutorial (http://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing). +// VPC security group in one VPC to an Amazon RDS DB instance in another. +// +// For an overview of CIDR ranges, go to the Wikipedia Tutorial (http://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing). func (c *RDS) AuthorizeDBSecurityGroupIngress(input *AuthorizeDBSecurityGroupIngressInput) (*AuthorizeDBSecurityGroupIngressOutput, error) { req, out := c.AuthorizeDBSecurityGroupIngressRequest(input) err := req.Send() @@ -211,7 +216,7 @@ func (c *RDS) CopyDBSnapshotRequest(input *CopyDBSnapshotInput) (req *request.Re return } -// Copies the specified DBSnapshot. The source DB snapshot must be in the "available" +// Copies the specified DB snapshot. The source DB snapshot must be in the "available" // state. // // If you are copying from a shared manual DB snapshot, the SourceDBSnapshotIdentifier @@ -674,6 +679,8 @@ func (c *RDS) DeleteDBClusterParameterGroupRequest(input *DeleteDBClusterParamet } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &DeleteDBClusterParameterGroupOutput{} req.Data = output return @@ -777,6 +784,8 @@ func (c *RDS) DeleteDBParameterGroupRequest(input *DeleteDBParameterGroupInput) } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &DeleteDBParameterGroupOutput{} req.Data = output return @@ -805,6 +814,8 @@ func (c *RDS) DeleteDBSecurityGroupRequest(input *DeleteDBSecurityGroupInput) (r } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &DeleteDBSecurityGroupOutput{} req.Data = output return @@ -864,6 +875,8 @@ func (c *RDS) DeleteDBSubnetGroupRequest(input *DeleteDBSubnetGroupInput) (req * } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &DeleteDBSubnetGroupOutput{} req.Data = output return @@ -920,6 +933,8 @@ func (c *RDS) DeleteOptionGroupRequest(input *DeleteOptionGroupInput) (req *requ } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &DeleteOptionGroupOutput{} req.Data = output return @@ -2203,7 +2218,7 @@ func (c *RDS) ModifyDBSnapshotAttributeRequest(input *ModifyDBSnapshotAttributeI // // To share a manual DB snapshot with other AWS accounts, specify restore as // the AttributeName and use the ValuesToAdd parameter to add a list of the -// AWS account ids that are authorized to retore the manual DB snapshot. Uses +// AWS account ids that are authorized to restore the manual DB snapshot. Uses // the value all to make the manual DB snapshot public and can by copied or // restored by all AWS accounts. Do not add the all value for any manual DB // snapshots that contain private information that you do not want to be available @@ -2454,6 +2469,8 @@ func (c *RDS) RemoveTagsFromResourceRequest(input *RemoveTagsFromResourceInput) } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &RemoveTagsFromResourceOutput{} req.Data = output return @@ -2629,9 +2646,8 @@ func (c *RDS) RestoreDBInstanceFromDBSnapshotRequest(input *RestoreDBInstanceFro } // Creates a new DB instance from a DB snapshot. The target database is created -// from the source database restore point with the most of original configuration, -// but in a system chosen availability zone with the default security group, -// the default subnet group, and the default DB parameter group. By default, +// from the source database restore point with the most of original configuration +// with the default security group and the default DB parameter group. By default, // the new DB instance is created as a single-AZ deployment except when the // instance is a SQL Server instance that has an option group that is associated // with mirroring; in this case, the instance becomes a mirrored AZ deployment @@ -2674,10 +2690,13 @@ func (c *RDS) RestoreDBInstanceToPointInTimeRequest(input *RestoreDBInstanceToPo return } -// Restores a DB instance to an arbitrary point-in-time. Users can restore to -// any point in time before the LatestRestorableTime for up to BackupRetentionPeriod -// days. The target database is created with the most of original configuration, -// but in a system chosen availability zone with the default security group, +// Restores a DB instance to an arbitrary point in time. You can restore to +// any point in time before the time identified by the LatestRestorableTime +// property. You can restore to a point up to the number of days specified by +// the BackupRetentionPeriod property. +// +// The target database is created with most of the original configuration, +// but in a system-selected availability zone, with the default security group, // the default subnet group, and the default DB parameter group. By default, // the new DB instance is created as a single-AZ deployment except when the // instance is a SQL Server instance that has an option group that is associated @@ -2833,6 +2852,8 @@ type ApplyPendingMaintenanceActionInput struct { _ struct{} `type:"structure"` // The pending maintenance action to apply to this resource. + // + // Valid values: system-update, db-upgrade ApplyAction *string `type:"string" required:"true"` // A value that specifies the type of opt-in request, or undoes an opt-in request. @@ -3134,6 +3155,23 @@ type CopyDBSnapshotInput struct { // otherwise false. The default is false. CopyTags *bool `type:"boolean"` + // The AWS Key Management Service (AWS KMS) key identifier for an encrypted + // DB snapshot. The KMS key identifier is the Amazon Resource Name (ARN) or + // the KMS key alias for the KMS encryption key. + // + // If you copy an unencrypted DB snapshot and specify a value for the KmsKeyId + // parameter, Amazon RDS encrypts the target DB snapshot using the specified + // KMS encryption key. + // + // If you copy an encrypted DB snapshot from your AWS account, you can specify + // a value for KmsKeyId to encrypt the copy with a new KMS encryption key. If + // you don't specify a value for KmsKeyId then the copy of the DB snapshot is + // encrypted with the same KMS key as the source DB snapshot. + // + // If you copy an encrypted DB snapshot that is shared from another AWS account, + // then you must specify a value for KmsKeyId. + KmsKeyId *string `type:"string"` + // The identifier for the source DB snapshot. // // If you are copying from a shared manual DB snapshot, this must be the ARN @@ -3292,6 +3330,11 @@ type CreateDBClusterInput struct { DBClusterParameterGroupName *string `type:"string"` // A DB subnet group to associate with this DB cluster. + // + // Constraints: Must contain no more than 255 alphanumeric characters, periods, + // underscores, spaces, or hyphens. Must not be default. + // + // Example: mySubnetgroup DBSubnetGroupName *string `type:"string"` // The name for your database of up to 8 alpha-numeric characters. If you do @@ -3705,6 +3748,13 @@ type CreateDBInstanceInput struct { // If there is no DB subnet group, then it is a non-VPC DB instance. DBSubnetGroupName *string `type:"string"` + // Specify the Active Directory Domain to create the instance in. + Domain *string `type:"string"` + + // Specify the name of the IAM role to be used when making API calls to the + // Directory Service. + DomainIAMRoleName *string `type:"string"` + // The name of the database engine to be used for this instance. // // Valid Values: MySQL | mariadb | oracle-se1 | oracle-se | oracle-ee | sqlserver-ee @@ -3727,7 +3777,7 @@ type CreateDBInstanceInput struct { // ap-southeast-2, eu-west-1, sa-east-1, us-west-1, us-west-2): 5.5.40 | 5.5.40a // Version 5.5 (Available in all regions): 5.5.40b | 5.5.41 | 5.5.42 Version // 5.6 (Available in all regions): 5.6.19a | 5.6.19b | 5.6.21 | 5.6.21b | 5.6.22 - // | 5.6.23 MariaDB + // | 5.6.23 | 5.6.27 Version 5.7 (Available in all regions): 5.7.10 MariaDB // // Version 10.0 (Available in all regions except AWS GovCloud (US) Region // (us-gov-west-1)): 10.0.17 Oracle Database Enterprise Edition (oracle-ee) @@ -3786,7 +3836,10 @@ type CreateDBInstanceInput struct { // The amount of Provisioned IOPS (input/output operations per second) to be // initially allocated for the DB instance. // - // Constraints: To use PIOPS, this value must be an integer greater than 1000. + // Constraints: Must be a multiple between 3 and 10 of the storage amount for + // the DB instance. Must also be an integer multiple of 1000. For example, if + // the size of your DB instance is 500 GB, then your Iops value can be 2000, + // 3000, 4000, or 5000. Iops *int64 `type:"integer"` // The KMS key identifier for an encrypted DB instance. @@ -3982,6 +4035,15 @@ type CreateDBInstanceInput struct { // Constraints: Minimum 30-minute window. PreferredMaintenanceWindow *string `type:"string"` + // A value that specifies the order in which an Aurora Replica is promoted to + // the primary instance after a failure of the existing primary instance. For + // more information, see Fault Tolerance for an Aurora DB Cluster (http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Aurora.Managing.html#Aurora.Managing.FaultTolerance). + // + // Default: 1 + // + // Valid Values: 0 - 15 + PromotionTier *int64 `type:"integer"` + // Specifies the accessibility options for the DB instance. A value of true // specifies an Internet-facing instance with a publicly resolvable DNS name, // which resolves to a public IP address. A value of false specifies an internal @@ -4106,7 +4168,11 @@ type CreateDBInstanceReadReplicaInput struct { // region that are created from the same source DB instance must either: Specify // DB subnet groups from the same VPC. All these Read Replicas will be created // in the same VPC.Not specify a DB subnet group. All these Read Replicas will - // be created outside of any VPC. + // be created outside of any VPC. Constraints: Must contain no more than 255 + // alphanumeric characters, periods, underscores, spaces, or hyphens. Must not + // be default. + // + // Example: mySubnetgroup DBSubnetGroupName *string `type:"string"` // The amount of Provisioned IOPS (input/output operations per second) to be @@ -4387,7 +4453,7 @@ type CreateDBSubnetGroupInput struct { // The name for the DB subnet group. This value is stored as a lowercase string. // // Constraints: Must contain no more than 255 alphanumeric characters, periods, - // underscores, or hyphens. Must not be default. + // underscores, spaces, or hyphens. Must not be default. // // Example: mySubnetgroup DBSubnetGroupName *string `type:"string" required:"true"` @@ -4606,9 +4672,9 @@ type DBCluster struct { // same name is returned for the life of the DB cluster. DatabaseName *string `type:"string"` - // If StorageEncrypted is true, the region-unique, immutable identifier for - // the encrypted DB cluster. This identifier is found in AWS CloudTrail log - // entries whenever the KMS key for the DB cluster is accessed. + // The region-unique, immutable identifier for the DB cluster. This identifier + // is found in AWS CloudTrail log entries whenever the KMS key for the DB cluster + // is accessed. DbClusterResourceId *string `type:"string"` // Specifies the earliest time to which a database can be restored with point-in-time @@ -4686,6 +4752,11 @@ type DBClusterMember struct { // Value that is true if the cluster member is the primary instance for the // DB cluster and false otherwise. IsClusterWriter *bool `type:"boolean"` + + // A value that specifies the order in which an Aurora Replica is promoted to + // the primary instance after a failure of the existing primary instance. For + // more information, see Fault Tolerance for an Aurora DB Cluster (http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Aurora.Managing.html#Aurora.Managing.FaultTolerance). + PromotionTier *int64 `type:"integer"` } // String returns the string representation @@ -4968,11 +5039,14 @@ type DBInstance struct { // part of a DB cluster, this can be a different port than the DB cluster port. DbInstancePort *int64 `type:"integer"` - // If StorageEncrypted is true, the region-unique, immutable identifier for - // the encrypted DB instance. This identifier is found in AWS CloudTrail log - // entries whenever the KMS key for the DB instance is accessed. + // The region-unique, immutable identifier for the DB instance. This identifier + // is found in AWS CloudTrail log entries whenever the KMS key for the DB instance + // is accessed. DbiResourceId *string `type:"string"` + // The Active Directory Domain membership records associated with the DB instance. + DomainMemberships []*DomainMembership `locationNameList:"DomainMembership" type:"list"` + // Specifies the connection endpoint. Endpoint *Endpoint `type:"structure"` @@ -5032,6 +5106,11 @@ type DBInstance struct { // in Universal Coordinated Time (UTC). PreferredMaintenanceWindow *string `type:"string"` + // A value that specifies the order in which an Aurora Replica is promoted to + // the primary instance after a failure of the existing primary instance. For + // more information, see Fault Tolerance for an Aurora DB Cluster (http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Aurora.Managing.html#Aurora.Managing.FaultTolerance). + PromotionTier *int64 `type:"integer"` + // Specifies the accessibility options for the DB instance. A value of true // specifies an Internet-facing instance with a publicly resolvable DNS name, // which resolves to a public IP address. A value of false specifies an internal @@ -5417,7 +5496,7 @@ type DBSubnetGroup struct { // Provides the description of the DB subnet group. DBSubnetGroupDescription *string `type:"string"` - // Specifies the name of the DB subnet group. + // The name of the DB subnet group. DBSubnetGroupName *string `type:"string"` // Provides the status of the DB subnet group. @@ -5767,8 +5846,10 @@ type DeleteDBSubnetGroupInput struct { // // You cannot delete the default subnet group. Constraints: // - // Must be 1 to 255 alphanumeric characters First character must be a letter - // Cannot end with a hyphen or contain two consecutive hyphens + // Constraints: Must contain no more than 255 alphanumeric characters, periods, + // underscores, spaces, or hyphens. Must not be default. + // + // Example: mySubnetgroup DBSubnetGroupName *string `type:"string" required:"true"` } @@ -7605,6 +7686,35 @@ func (s DescribeReservedDBInstancesOutput) GoString() string { return s.String() } +// An Active Directory Domain membership record associated with the DB instance. +type DomainMembership struct { + _ struct{} `type:"structure"` + + // The identifier of the Active Directory Domain. + Domain *string `type:"string"` + + // The fully qualified domain name of the Active Directory Domain. + FQDN *string `type:"string"` + + // The name of the IAM role to be used when making API calls to the Directory + // Service. + IAMRoleName *string `type:"string"` + + // The status of the DB instance's Active Directory Domain membership, such + // as joined, pending-join, failed etc). + Status *string `type:"string"` +} + +// String returns the string representation +func (s DomainMembership) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DomainMembership) GoString() string { + return s.String() +} + type DownloadDBLogFilePortionInput struct { _ struct{} `type:"structure"` @@ -7631,7 +7741,8 @@ type DownloadDBLogFilePortionInput struct { // If the NumberOfLines parameter is specified, then the block of lines returned // can be from the beginning or the end of the log file, depending on the value // of the Marker parameter. If neither Marker or NumberOfLines are specified, - // the entire log file is returned. + // the entire log file is returned up to a maximum of 10000 lines, starting + // with the most recent log entries first. // // If NumberOfLines is specified and Marker is not specified, then the most // recent lines from the end of the log file are returned. @@ -8002,10 +8113,16 @@ type ModifyDBClusterInput struct { // A value that specifies whether the modifications in this request and any // pending modifications are asynchronously applied as soon as possible, regardless - // of the PreferredMaintenanceWindow setting for the DB cluster. + // of the PreferredMaintenanceWindow setting for the DB cluster. If this parameter + // is set to false, changes to the DB cluster are applied during the next maintenance + // window. // - // If this parameter is set to false, changes to the DB cluster are applied - // during the next maintenance window. + // The ApplyImmediately parameter only affects the NewDBClusterIdentifier and + // MasterUserPassword values. If you set the ApplyImmediately parameter value + // to false, then changes to the NewDBClusterIdentifier and MasterUserPassword + // values are applied during the next maintenance window. All other changes + // are applied immediately, regardless of the value of the ApplyImmediately + // parameter. // // Default: false ApplyImmediately *bool `type:"boolean"` @@ -8351,6 +8468,8 @@ type ModifyDBInstanceInput struct { // // Valid Values: 1150-65535 // + // Type: Integer + // // Oracle // // Default: 1521 @@ -8381,6 +8500,17 @@ type ModifyDBInstanceInput struct { // Cannot end with a hyphen or contain two consecutive hyphens DBSecurityGroups []*string `locationNameList:"DBSecurityGroupName" type:"list"` + // Specify the Active Directory Domain to move the instance to. + // + // The specified Active Directory Domain must be created prior to this operation. + // Currently only a SQL Server instance can be created in a Active Directory + // Domain. + Domain *string `type:"string"` + + // Specify the name of the IAM role to be used when making API calls to the + // Directory Service. + DomainIAMRoleName *string `type:"string"` + // The version number of the database engine to upgrade to. Changing this parameter // results in an outage and the change is applied during the next maintenance // window unless the ApplyImmediately parameter is set to true for this request. @@ -8531,9 +8661,20 @@ type ModifyDBInstanceInput struct { // Constraints: Must be at least 30 minutes PreferredMaintenanceWindow *string `type:"string"` - // True to make the DB instance Internet-facing with a publicly resolvable DNS - // name, which resolves to a public IP address. False to make the DB instance - // internal with a DNS name that resolves to a private IP address. + // A value that specifies the order in which an Aurora Replica is promoted to + // the primary instance after a failure of the existing primary instance. For + // more information, see Fault Tolerance for an Aurora DB Cluster (http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Aurora.Managing.html#Aurora.Managing.FaultTolerance). + // + // Default: 1 + // + // Valid Values: 0 - 15 + PromotionTier *int64 `type:"integer"` + + // Boolean value that indicates if the DB instance has a publicly resolvable + // DNS name. Set to True to make the DB instance Internet-facing with a publicly + // resolvable DNS name, which resolves to a public IP address. Set to False + // to make the DB instance internal with a DNS name that resolves to a private + // IP address. // // PubliclyAccessible only applies to DB instances in a VPC. The DB instance // must be part of a public subnet and PubliclyAccessible must be true in order @@ -8708,8 +8849,8 @@ type ModifyDBSubnetGroupInput struct { // The name for the DB subnet group. This value is stored as a lowercase string. // - // Constraints: Must contain no more than 255 alphanumeric characters or hyphens. - // Must not be "Default". + // Constraints: Must contain no more than 255 alphanumeric characters, periods, + // underscores, spaces, or hyphens. Must not be default. // // Example: mySubnetgroup DBSubnetGroupName *string `type:"string" required:"true"` @@ -8974,8 +9115,9 @@ type OptionGroupMembership struct { // The name of the option group that the instance belongs to. OptionGroupName *string `type:"string"` - // The status of the DB instance's option group membership (e.g. in-sync, pending, - // pending-maintenance, applying). + // The status of the DB instance's option group membership. Valid values are: + // in-sync, pending-apply, pending-removal, pending-maintenance-apply, pending-maintenance-removal, + // applying, removing, and failed. Status *string `type:"string"` } @@ -9818,6 +9960,11 @@ type RestoreDBClusterFromSnapshotInput struct { DBClusterIdentifier *string `type:"string" required:"true"` // The name of the DB subnet group to use for the new DB cluster. + // + // Constraints: Must contain no more than 255 alphanumeric characters, periods, + // underscores, spaces, or hyphens. Must not be default. + // + // Example: mySubnetgroup DBSubnetGroupName *string `type:"string"` // The database name for the restored DB cluster. @@ -9920,6 +10067,11 @@ type RestoreDBClusterToPointInTimeInput struct { DBClusterIdentifier *string `type:"string" required:"true"` // The DB subnet group name to use for the new DB cluster. + // + // Constraints: Must contain no more than 255 alphanumeric characters, periods, + // underscores, spaces, or hyphens. Must not be default. + // + // Example: mySubnetgroup DBSubnetGroupName *string `type:"string"` // The KMS key identifier to use when restoring an encrypted DB cluster from @@ -10076,8 +10228,20 @@ type RestoreDBInstanceFromDBSnapshotInput struct { DBSnapshotIdentifier *string `type:"string" required:"true"` // The DB subnet group name to use for the new instance. + // + // Constraints: Must contain no more than 255 alphanumeric characters, periods, + // underscores, spaces, or hyphens. Must not be default. + // + // Example: mySubnetgroup DBSubnetGroupName *string `type:"string"` + // Specify the Active Directory Domain to restore the instance in. + Domain *string `type:"string"` + + // Specify the name of the IAM role to be used when making API calls to the + // Directory Service. + DomainIAMRoleName *string `type:"string"` + // The database engine to use for the new instance. // // Default: The same as source @@ -10232,8 +10396,20 @@ type RestoreDBInstanceToPointInTimeInput struct { DBName *string `type:"string"` // The DB subnet group name to use for the new instance. + // + // Constraints: Must contain no more than 255 alphanumeric characters, periods, + // underscores, spaces, or hyphens. Must not be default. + // + // Example: mySubnetgroup DBSubnetGroupName *string `type:"string"` + // Specify the Active Directory Domain to restore the instance in. + Domain *string `type:"string"` + + // Specify the name of the IAM role to be used when making API calls to the + // Directory Service. + DomainIAMRoleName *string `type:"string"` + // The database engine to use for the new instance. // // Default: The same as source @@ -10241,7 +10417,7 @@ type RestoreDBInstanceToPointInTimeInput struct { // Constraint: Must be compatible with the engine of the source // // Valid Values: MySQL | mariadb | oracle-se1 | oracle-se | oracle-ee | sqlserver-ee - // | sqlserver-se | sqlserver-ex | sqlserver-web | postgres| aurora + // | sqlserver-se | sqlserver-ex | sqlserver-web | postgres | aurora Engine *string `type:"string"` // The amount of Provisioned IOPS (input/output operations per second) to be diff --git a/vendor/github.com/aws/aws-sdk-go/service/rds/service.go b/vendor/github.com/aws/aws-sdk-go/service/rds/service.go index 906277204d..e07795efa2 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/rds/service.go +++ b/vendor/github.com/aws/aws-sdk-go/service/rds/service.go @@ -18,23 +18,41 @@ import ( // up developers to focus on what makes their applications and businesses unique. // // Amazon RDS gives you access to the capabilities of a MySQL, MariaDB, PostgreSQL, -// Microsoft SQL Server, Oracle, or Aurora database server. This means the code, -// applications, and tools you already use today with your existing databases -// work with Amazon RDS without modification. Amazon RDS automatically backs -// up your database and maintains the database software that powers your DB -// instance. Amazon RDS is flexible: you can scale your database instance's -// compute resources and storage capacity to meet your application's demand. -// As with all Amazon Web Services, there are no up-front investments, and you -// pay only for the resources you use. +// Microsoft SQL Server, Oracle, or Amazon Aurora database server. These capabilities +// mean that the code, applications, and tools you already use today with your +// existing databases work with Amazon RDS without modification. Amazon RDS +// automatically backs up your database and maintains the database software +// that powers your DB instance. Amazon RDS is flexible: you can scale your +// database instance's compute resources and storage capacity to meet your application's +// demand. As with all Amazon Web Services, there are no up-front investments, +// and you pay only for the resources you use. // -// This is an interface reference for Amazon RDS. It contains documentation -// for a programming or command line interface you can use to manage Amazon -// RDS. Note that Amazon RDS is asynchronous, which means that some interfaces -// might require techniques such as polling or callback functions to determine -// when a command has been applied. In this reference, the parameter descriptions -// indicate whether a command is applied immediately, on the next instance reboot, -// or during the maintenance window. For a summary of the Amazon RDS interfaces, -// go to Available RDS Interfaces (http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Welcome.html#Welcome.Interfaces). +// This interface reference for Amazon RDS contains documentation for a programming +// or command line interface you can use to manage Amazon RDS. Note that Amazon +// RDS is asynchronous, which means that some interfaces might require techniques +// such as polling or callback functions to determine when a command has been +// applied. In this reference, the parameter descriptions indicate whether a +// command is applied immediately, on the next instance reboot, or during the +// maintenance window. The reference structure is as follows, and we list following +// some related topics from the user guide. +// +// Amazon RDS API Reference +// +// For the alphabetical list of API actions, see API Actions (http://docs.aws.amazon.com/AmazonRDS/latest/APIReference/API_Operations.html). +// +// For the alphabetical list of data types, see Data Types (http://docs.aws.amazon.com/AmazonRDS/latest/APIReference/API_Types.html). +// +// For a list of common query parameters, see Common Parameters (http://docs.aws.amazon.com/AmazonRDS/latest/APIReference/CommonParameters.html). +// +// For descriptions of the error codes, see Common Errors (http://docs.aws.amazon.com/AmazonRDS/latest/APIReference/CommonErrors.html). +// +// Amazon RDS User Guide +// +// For a summary of the Amazon RDS interfaces, see Available RDS Interfaces +// (http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Welcome.html#Welcome.Interfaces). +// +// For more information about how to use the Query API, see Using the Query +// API (http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Using_the_Query_API.html). //The service client's operations are safe to be used concurrently. // It is not safe to mutate any of the client's properties though. type RDS struct { @@ -82,10 +100,10 @@ func newClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegio // Handlers svc.Handlers.Sign.PushBack(v4.Sign) - svc.Handlers.Build.PushBack(query.Build) - svc.Handlers.Unmarshal.PushBack(query.Unmarshal) - svc.Handlers.UnmarshalMeta.PushBack(query.UnmarshalMeta) - svc.Handlers.UnmarshalError.PushBack(query.UnmarshalError) + svc.Handlers.Build.PushBackNamed(query.BuildHandler) + svc.Handlers.Unmarshal.PushBackNamed(query.UnmarshalHandler) + svc.Handlers.UnmarshalMeta.PushBackNamed(query.UnmarshalMetaHandler) + svc.Handlers.UnmarshalError.PushBackNamed(query.UnmarshalErrorHandler) // Run custom client initialization if present if initClient != nil { diff --git a/vendor/github.com/aws/aws-sdk-go/service/rds/waiters.go b/vendor/github.com/aws/aws-sdk-go/service/rds/waiters.go index 3c24ea392c..b73b51bdaf 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/rds/waiters.go +++ b/vendor/github.com/aws/aws-sdk-go/service/rds/waiters.go @@ -48,6 +48,12 @@ func (c *RDS) WaitUntilDBInstanceAvailable(input *DescribeDBInstancesInput) erro Argument: "DBInstances[].DBInstanceStatus", Expected: "incompatible-parameters", }, + { + State: "failure", + Matcher: "pathAny", + Argument: "DBInstances[].DBInstanceStatus", + Expected: "incompatible-parameters", + }, { State: "failure", Matcher: "pathAny", diff --git a/vendor/github.com/aws/aws-sdk-go/service/s3/api.go b/vendor/github.com/aws/aws-sdk-go/service/s3/api.go index 1d63122073..4f170986b9 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/s3/api.go +++ b/vendor/github.com/aws/aws-sdk-go/service/s3/api.go @@ -9,6 +9,8 @@ import ( "github.com/aws/aws-sdk-go/aws/awsutil" "github.com/aws/aws-sdk-go/aws/request" + "github.com/aws/aws-sdk-go/private/protocol" + "github.com/aws/aws-sdk-go/private/protocol/restxml" ) const opAbortMultipartUpload = "AbortMultipartUpload" @@ -171,6 +173,8 @@ func (c *S3) DeleteBucketRequest(input *DeleteBucketInput) (req *request.Request } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(restxml.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &DeleteBucketOutput{} req.Data = output return @@ -199,6 +203,8 @@ func (c *S3) DeleteBucketCorsRequest(input *DeleteBucketCorsInput) (req *request } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(restxml.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &DeleteBucketCorsOutput{} req.Data = output return @@ -226,6 +232,8 @@ func (c *S3) DeleteBucketLifecycleRequest(input *DeleteBucketLifecycleInput) (re } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(restxml.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &DeleteBucketLifecycleOutput{} req.Data = output return @@ -253,6 +261,8 @@ func (c *S3) DeleteBucketPolicyRequest(input *DeleteBucketPolicyInput) (req *req } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(restxml.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &DeleteBucketPolicyOutput{} req.Data = output return @@ -280,11 +290,14 @@ func (c *S3) DeleteBucketReplicationRequest(input *DeleteBucketReplicationInput) } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(restxml.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &DeleteBucketReplicationOutput{} req.Data = output return } +// Deletes the replication configuration from the bucket. func (c *S3) DeleteBucketReplication(input *DeleteBucketReplicationInput) (*DeleteBucketReplicationOutput, error) { req, out := c.DeleteBucketReplicationRequest(input) err := req.Send() @@ -306,6 +319,8 @@ func (c *S3) DeleteBucketTaggingRequest(input *DeleteBucketTaggingInput) (req *r } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(restxml.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &DeleteBucketTaggingOutput{} req.Data = output return @@ -333,6 +348,8 @@ func (c *S3) DeleteBucketWebsiteRequest(input *DeleteBucketWebsiteInput) (req *r } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(restxml.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &DeleteBucketWebsiteOutput{} req.Data = output return @@ -460,6 +477,9 @@ const opGetBucketLifecycle = "GetBucketLifecycle" // GetBucketLifecycleRequest generates a request for the GetBucketLifecycle operation. func (c *S3) GetBucketLifecycleRequest(input *GetBucketLifecycleInput) (req *request.Request, output *GetBucketLifecycleOutput) { + if c.Client.Config.Logger != nil { + c.Client.Config.Logger.Log("This operation, GetBucketLifecycle, has been deprecated") + } op := &request.Operation{ Name: opGetBucketLifecycle, HTTPMethod: "GET", @@ -569,6 +589,9 @@ const opGetBucketNotification = "GetBucketNotification" // GetBucketNotificationRequest generates a request for the GetBucketNotification operation. func (c *S3) GetBucketNotificationRequest(input *GetBucketNotificationConfigurationRequest) (req *request.Request, output *NotificationConfigurationDeprecated) { + if c.Client.Config.Logger != nil { + c.Client.Config.Logger.Log("This operation, GetBucketNotification, has been deprecated") + } op := &request.Operation{ Name: opGetBucketNotification, HTTPMethod: "GET", @@ -666,6 +689,7 @@ func (c *S3) GetBucketReplicationRequest(input *GetBucketReplicationInput) (req return } +// Deprecated, see the GetBucketReplicationConfiguration operation. func (c *S3) GetBucketReplication(input *GetBucketReplicationInput) (*GetBucketReplicationOutput, error) { req, out := c.GetBucketReplicationRequest(input) err := req.Send() @@ -876,6 +900,8 @@ func (c *S3) HeadBucketRequest(input *HeadBucketInput) (req *request.Request, ou } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(restxml.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &HeadBucketOutput{} req.Data = output return @@ -1126,6 +1152,8 @@ func (c *S3) PutBucketAclRequest(input *PutBucketAclInput) (req *request.Request } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(restxml.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &PutBucketAclOutput{} req.Data = output return @@ -1153,6 +1181,8 @@ func (c *S3) PutBucketCorsRequest(input *PutBucketCorsInput) (req *request.Reque } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(restxml.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &PutBucketCorsOutput{} req.Data = output return @@ -1169,6 +1199,9 @@ const opPutBucketLifecycle = "PutBucketLifecycle" // PutBucketLifecycleRequest generates a request for the PutBucketLifecycle operation. func (c *S3) PutBucketLifecycleRequest(input *PutBucketLifecycleInput) (req *request.Request, output *PutBucketLifecycleOutput) { + if c.Client.Config.Logger != nil { + c.Client.Config.Logger.Log("This operation, PutBucketLifecycle, has been deprecated") + } op := &request.Operation{ Name: opPutBucketLifecycle, HTTPMethod: "PUT", @@ -1180,6 +1213,8 @@ func (c *S3) PutBucketLifecycleRequest(input *PutBucketLifecycleInput) (req *req } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(restxml.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &PutBucketLifecycleOutput{} req.Data = output return @@ -1207,6 +1242,8 @@ func (c *S3) PutBucketLifecycleConfigurationRequest(input *PutBucketLifecycleCon } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(restxml.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &PutBucketLifecycleConfigurationOutput{} req.Data = output return @@ -1235,6 +1272,8 @@ func (c *S3) PutBucketLoggingRequest(input *PutBucketLoggingInput) (req *request } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(restxml.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &PutBucketLoggingOutput{} req.Data = output return @@ -1253,6 +1292,9 @@ const opPutBucketNotification = "PutBucketNotification" // PutBucketNotificationRequest generates a request for the PutBucketNotification operation. func (c *S3) PutBucketNotificationRequest(input *PutBucketNotificationInput) (req *request.Request, output *PutBucketNotificationOutput) { + if c.Client.Config.Logger != nil { + c.Client.Config.Logger.Log("This operation, PutBucketNotification, has been deprecated") + } op := &request.Operation{ Name: opPutBucketNotification, HTTPMethod: "PUT", @@ -1264,6 +1306,8 @@ func (c *S3) PutBucketNotificationRequest(input *PutBucketNotificationInput) (re } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(restxml.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &PutBucketNotificationOutput{} req.Data = output return @@ -1291,6 +1335,8 @@ func (c *S3) PutBucketNotificationConfigurationRequest(input *PutBucketNotificat } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(restxml.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &PutBucketNotificationConfigurationOutput{} req.Data = output return @@ -1318,6 +1364,8 @@ func (c *S3) PutBucketPolicyRequest(input *PutBucketPolicyInput) (req *request.R } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(restxml.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &PutBucketPolicyOutput{} req.Data = output return @@ -1346,6 +1394,8 @@ func (c *S3) PutBucketReplicationRequest(input *PutBucketReplicationInput) (req } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(restxml.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &PutBucketReplicationOutput{} req.Data = output return @@ -1374,6 +1424,8 @@ func (c *S3) PutBucketRequestPaymentRequest(input *PutBucketRequestPaymentInput) } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(restxml.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &PutBucketRequestPaymentOutput{} req.Data = output return @@ -1405,6 +1457,8 @@ func (c *S3) PutBucketTaggingRequest(input *PutBucketTaggingInput) (req *request } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(restxml.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &PutBucketTaggingOutput{} req.Data = output return @@ -1432,6 +1486,8 @@ func (c *S3) PutBucketVersioningRequest(input *PutBucketVersioningInput) (req *r } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(restxml.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &PutBucketVersioningOutput{} req.Data = output return @@ -1460,6 +1516,8 @@ func (c *S3) PutBucketWebsiteRequest(input *PutBucketWebsiteInput) (req *request } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(restxml.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &PutBucketWebsiteOutput{} req.Data = output return @@ -1614,6 +1672,26 @@ func (c *S3) UploadPartCopy(input *UploadPartCopyInput) (*UploadPartCopyOutput, return out, err } +// Specifies the days since the initiation of an Incomplete Multipart Upload +// that Lifecycle will wait before permanently removing all parts of the upload. +type AbortIncompleteMultipartUpload struct { + _ struct{} `type:"structure"` + + // Indicates the number of days that must pass since initiation for Lifecycle + // to abort an Incomplete Multipart Upload. + DaysAfterInitiation *int64 `type:"integer"` +} + +// String returns the string representation +func (s AbortIncompleteMultipartUpload) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s AbortIncompleteMultipartUpload) GoString() string { + return s.String() +} + type AbortMultipartUploadInput struct { _ struct{} `type:"structure"` @@ -1784,7 +1862,7 @@ type CloudFunctionConfiguration struct { CloudFunction *string `type:"string"` // Bucket event for which to send notifications. - Event *string `type:"string" enum:"Event"` + Event *string `deprecated:"true" type:"string" enum:"Event"` Events []*string `locationName:"Event" type:"list" flattened:"true"` @@ -2340,6 +2418,13 @@ func (s CreateMultipartUploadInput) GoString() string { type CreateMultipartUploadOutput struct { _ struct{} `type:"structure"` + // Date when multipart upload will become eligible for abort operation by lifecycle. + AbortDate *time.Time `location:"header" locationName:"x-amz-abort-date" type:"timestamp" timestampFormat:"rfc822"` + + // Id of the lifecycle rule that makes a multipart upload eligible for abort + // operation. + AbortRuleId *string `location:"header" locationName:"x-amz-abort-rule-id" type:"string"` + // Name of the bucket to which the multipart upload was initiated. Bucket *string `locationName:"Bucket" type:"string"` @@ -3052,7 +3137,7 @@ func (s GetBucketLoggingOutput) GoString() string { type GetBucketNotificationConfigurationRequest struct { _ struct{} `type:"structure"` - // Name of the buket to get the notification configuration for. + // Name of the bucket to get the notification configuration for. Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` } @@ -3916,6 +4001,12 @@ type LifecycleExpiration struct { // Indicates the lifetime, in days, of the objects that are subject to the rule. // The value must be a non-zero positive integer. Days *int64 `type:"integer"` + + // Indicates whether Amazon S3 will remove a delete marker with no noncurrent + // versions. If set to true, the delete marker will be expired; if set to false + // the policy takes no action. This cannot be specified with Days or Date in + // a Lifecycle Expiration Policy. + ExpiredObjectDeleteMarker *bool `type:"boolean"` } // String returns the string representation @@ -3931,6 +4022,10 @@ func (s LifecycleExpiration) GoString() string { type LifecycleRule struct { _ struct{} `type:"structure"` + // Specifies the days since the initiation of an Incomplete Multipart Upload + // that Lifecycle will wait before permanently removing all parts of the upload. + AbortIncompleteMultipartUpload *AbortIncompleteMultipartUpload `type:"structure"` + Expiration *LifecycleExpiration `type:"structure"` // Unique identifier for the rule. The value cannot be longer than 255 characters. @@ -4303,6 +4398,13 @@ func (s ListPartsInput) GoString() string { type ListPartsOutput struct { _ struct{} `type:"structure"` + // Date when multipart upload will become eligible for abort operation by lifecycle. + AbortDate *time.Time `location:"header" locationName:"x-amz-abort-date" type:"timestamp" timestampFormat:"rfc822"` + + // Id of the lifecycle rule that makes a multipart upload eligible for abort + // operation. + AbortRuleId *string `location:"header" locationName:"x-amz-abort-rule-id" type:"string"` + // Name of the bucket to which the multipart upload was initiated. Bucket *string `type:"string"` @@ -5172,6 +5274,7 @@ type PutObjectInput struct { // Object data. Body io.ReadSeeker `type:"blob"` + // Name of the bucket to which the PUT operation was initiated. Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` // Specifies caching behavior along the request/reply chain. @@ -5210,6 +5313,7 @@ type PutObjectInput struct { // Allows grantee to write the ACL for the applicable object. GrantWriteACP *string `location:"header" locationName:"x-amz-grant-write-acp" type:"string"` + // Object key for which the PUT operation was initiated. Key *string `location:"uri" locationName:"Key" min:"1" type:"string" required:"true"` // A map of metadata to store with the object in S3. @@ -5346,7 +5450,7 @@ type QueueConfigurationDeprecated struct { _ struct{} `type:"structure"` // Bucket event for which to send notifications. - Event *string `type:"string" enum:"Event"` + Event *string `deprecated:"true" type:"string" enum:"Event"` Events []*string `locationName:"Event" type:"list" flattened:"true"` @@ -5585,6 +5689,10 @@ func (s RoutingRule) GoString() string { type Rule struct { _ struct{} `type:"structure"` + // Specifies the days since the initiation of an Incomplete Multipart Upload + // that Lifecycle will wait before permanently removing all parts of the upload. + AbortIncompleteMultipartUpload *AbortIncompleteMultipartUpload `type:"structure"` + Expiration *LifecycleExpiration `type:"structure"` // Unique identifier for the rule. The value cannot be longer than 255 characters. @@ -5714,7 +5822,7 @@ type TopicConfigurationDeprecated struct { _ struct{} `type:"structure"` // Bucket event for which to send notifications. - Event *string `type:"string" enum:"Event"` + Event *string `deprecated:"true" type:"string" enum:"Event"` Events []*string `locationName:"Event" type:"list" flattened:"true"` @@ -5891,14 +5999,17 @@ func (s UploadPartCopyOutput) GoString() string { type UploadPartInput struct { _ struct{} `type:"structure" payload:"Body"` + // Object data. Body io.ReadSeeker `type:"blob"` + // Name of the bucket to which the multipart upload was initiated. Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` // Size of the body in bytes. This parameter is useful when the size of the // body cannot be determined automatically. ContentLength *int64 `location:"header" locationName:"Content-Length" type:"integer"` + // Object key for which the multipart upload was initiated. Key *string `location:"uri" locationName:"Key" min:"1" type:"string" required:"true"` // Part number of part being uploaded. This is a positive integer between 1 diff --git a/vendor/github.com/aws/aws-sdk-go/service/s3/customizations.go b/vendor/github.com/aws/aws-sdk-go/service/s3/customizations.go index c227f242c1..9323107a65 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/s3/customizations.go +++ b/vendor/github.com/aws/aws-sdk-go/service/s3/customizations.go @@ -20,8 +20,12 @@ func init() { } initRequest = func(r *request.Request) { + // Add reuest handlers for specific platforms. + // e.g. 100-continue support for PUT requests using Go 1.6 + platformRequestHandlers(r) + switch r.Operation.Name { - case opPutBucketCors, opPutBucketLifecycle, opPutBucketPolicy, opPutBucketTagging, opDeleteObjects, opPutBucketLifecycleConfiguration: + case opPutBucketCors, opPutBucketLifecycle, opPutBucketPolicy, opPutBucketTagging, opDeleteObjects, opPutBucketLifecycleConfiguration, opPutBucketReplication: // These S3 operations require Content-MD5 to be set r.Handlers.Build.PushBack(contentMD5) case opGetBucketLocation: diff --git a/vendor/github.com/aws/aws-sdk-go/service/s3/platform_handlers.go b/vendor/github.com/aws/aws-sdk-go/service/s3/platform_handlers.go new file mode 100644 index 0000000000..8e6f3307d4 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/service/s3/platform_handlers.go @@ -0,0 +1,8 @@ +// +build !go1.6 + +package s3 + +import "github.com/aws/aws-sdk-go/aws/request" + +func platformRequestHandlers(r *request.Request) { +} diff --git a/vendor/github.com/aws/aws-sdk-go/service/s3/platform_handlers_go1.6.go b/vendor/github.com/aws/aws-sdk-go/service/s3/platform_handlers_go1.6.go new file mode 100644 index 0000000000..14d05f7b75 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/service/s3/platform_handlers_go1.6.go @@ -0,0 +1,28 @@ +// +build go1.6 + +package s3 + +import ( + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/request" +) + +func platformRequestHandlers(r *request.Request) { + if r.Operation.HTTPMethod == "PUT" { + // 100-Continue should only be used on put requests. + r.Handlers.Sign.PushBack(add100Continue) + } +} + +func add100Continue(r *request.Request) { + if aws.BoolValue(r.Config.S3Disable100Continue) { + return + } + if r.HTTPRequest.ContentLength < 1024*1024*2 { + // Ignore requests smaller than 2MB. This helps prevent delaying + // requests unnecessarily. + return + } + + r.HTTPRequest.Header.Set("Expect", "100-Continue") +} diff --git a/vendor/github.com/aws/aws-sdk-go/service/s3/service.go b/vendor/github.com/aws/aws-sdk-go/service/s3/service.go index e80d95429a..cf01da5350 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/s3/service.go +++ b/vendor/github.com/aws/aws-sdk-go/service/s3/service.go @@ -59,10 +59,10 @@ func newClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegio // Handlers svc.Handlers.Sign.PushBack(v4.Sign) - svc.Handlers.Build.PushBack(restxml.Build) - svc.Handlers.Unmarshal.PushBack(restxml.Unmarshal) - svc.Handlers.UnmarshalMeta.PushBack(restxml.UnmarshalMeta) - svc.Handlers.UnmarshalError.PushBack(restxml.UnmarshalError) + svc.Handlers.Build.PushBackNamed(restxml.BuildHandler) + svc.Handlers.Unmarshal.PushBackNamed(restxml.UnmarshalHandler) + svc.Handlers.UnmarshalMeta.PushBackNamed(restxml.UnmarshalMetaHandler) + svc.Handlers.UnmarshalError.PushBackNamed(restxml.UnmarshalErrorHandler) // Run custom client initialization if present if initClient != nil { diff --git a/vendor/github.com/aws/aws-sdk-go/service/s3/unmarshal_error.go b/vendor/github.com/aws/aws-sdk-go/service/s3/unmarshal_error.go index 30470ac117..59e4950b80 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/s3/unmarshal_error.go +++ b/vendor/github.com/aws/aws-sdk-go/service/s3/unmarshal_error.go @@ -4,6 +4,7 @@ import ( "encoding/xml" "fmt" "io" + "io/ioutil" "net/http" "strings" @@ -20,19 +21,26 @@ type xmlErrorResponse struct { func unmarshalError(r *request.Request) { defer r.HTTPResponse.Body.Close() + defer io.Copy(ioutil.Discard, r.HTTPResponse.Body) if r.HTTPResponse.StatusCode == http.StatusMovedPermanently { - r.Error = awserr.New("BucketRegionError", - fmt.Sprintf("incorrect region, the bucket is not in '%s' region", aws.StringValue(r.Config.Region)), nil) + r.Error = awserr.NewRequestFailure( + awserr.New("BucketRegionError", + fmt.Sprintf("incorrect region, the bucket is not in '%s' region", + aws.StringValue(r.Config.Region)), + nil), + r.HTTPResponse.StatusCode, + r.RequestID, + ) return } - if r.HTTPResponse.ContentLength == int64(0) { + if r.HTTPResponse.ContentLength == 0 { // No body, use status code to generate an awserr.Error r.Error = awserr.NewRequestFailure( awserr.New(strings.Replace(r.HTTPResponse.Status, " ", "", -1), r.HTTPResponse.Status, nil), r.HTTPResponse.StatusCode, - "", + r.RequestID, ) return } @@ -45,7 +53,7 @@ func unmarshalError(r *request.Request) { r.Error = awserr.NewRequestFailure( awserr.New(resp.Code, resp.Message, nil), r.HTTPResponse.StatusCode, - "", + r.RequestID, ) } } diff --git a/vendor/github.com/aws/aws-sdk-go/service/s3/waiters.go b/vendor/github.com/aws/aws-sdk-go/service/s3/waiters.go index 4879fca8a0..cbd3d31166 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/s3/waiters.go +++ b/vendor/github.com/aws/aws-sdk-go/service/s3/waiters.go @@ -18,6 +18,12 @@ func (c *S3) WaitUntilBucketExists(input *HeadBucketInput) error { Argument: "", Expected: 200, }, + { + State: "success", + Matcher: "status", + Argument: "", + Expected: 301, + }, { State: "success", Matcher: "status", diff --git a/vendor/github.com/aws/aws-sdk-go/service/sns/api.go b/vendor/github.com/aws/aws-sdk-go/service/sns/api.go index 8b2c05831a..d664338bb3 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/sns/api.go +++ b/vendor/github.com/aws/aws-sdk-go/service/sns/api.go @@ -6,6 +6,8 @@ package sns import ( "github.com/aws/aws-sdk-go/aws/awsutil" "github.com/aws/aws-sdk-go/aws/request" + "github.com/aws/aws-sdk-go/private/protocol" + "github.com/aws/aws-sdk-go/private/protocol/query" ) const opAddPermission = "AddPermission" @@ -23,6 +25,8 @@ func (c *SNS) AddPermissionRequest(input *AddPermissionInput) (req *request.Requ } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &AddPermissionOutput{} req.Data = output return @@ -192,6 +196,8 @@ func (c *SNS) DeleteEndpointRequest(input *DeleteEndpointInput) (req *request.Re } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &DeleteEndpointOutput{} req.Data = output return @@ -220,6 +226,8 @@ func (c *SNS) DeletePlatformApplicationRequest(input *DeletePlatformApplicationI } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &DeletePlatformApplicationOutput{} req.Data = output return @@ -249,6 +257,8 @@ func (c *SNS) DeleteTopicRequest(input *DeleteTopicInput) (req *request.Request, } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &DeleteTopicOutput{} req.Data = output return @@ -655,6 +665,8 @@ func (c *SNS) RemovePermissionRequest(input *RemovePermissionInput) (req *reques } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &RemovePermissionOutput{} req.Data = output return @@ -682,6 +694,8 @@ func (c *SNS) SetEndpointAttributesRequest(input *SetEndpointAttributesInput) (r } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &SetEndpointAttributesOutput{} req.Data = output return @@ -711,6 +725,8 @@ func (c *SNS) SetPlatformApplicationAttributesRequest(input *SetPlatformApplicat } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &SetPlatformApplicationAttributesOutput{} req.Data = output return @@ -740,6 +756,8 @@ func (c *SNS) SetSubscriptionAttributesRequest(input *SetSubscriptionAttributesI } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &SetSubscriptionAttributesOutput{} req.Data = output return @@ -767,6 +785,8 @@ func (c *SNS) SetTopicAttributesRequest(input *SetTopicAttributesInput) (req *re } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &SetTopicAttributesOutput{} req.Data = output return @@ -824,6 +844,8 @@ func (c *SNS) UnsubscribeRequest(input *UnsubscribeInput) (req *request.Request, } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &UnsubscribeOutput{} req.Data = output return @@ -1586,6 +1608,8 @@ type MessageAttributeValue struct { // Binary type attributes can store any binary data, for example, compressed // data, encrypted data, or images. + // + // BinaryValue is automatically base64 encoded/decoded by the SDK. BinaryValue []byte `type:"blob"` // Amazon SNS supports the following logical data types: String, Number, and diff --git a/vendor/github.com/aws/aws-sdk-go/service/sns/service.go b/vendor/github.com/aws/aws-sdk-go/service/sns/service.go index eb8121874d..7d87839b32 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/sns/service.go +++ b/vendor/github.com/aws/aws-sdk-go/service/sns/service.go @@ -71,10 +71,10 @@ func newClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegio // Handlers svc.Handlers.Sign.PushBack(v4.Sign) - svc.Handlers.Build.PushBack(query.Build) - svc.Handlers.Unmarshal.PushBack(query.Unmarshal) - svc.Handlers.UnmarshalMeta.PushBack(query.UnmarshalMeta) - svc.Handlers.UnmarshalError.PushBack(query.UnmarshalError) + svc.Handlers.Build.PushBackNamed(query.BuildHandler) + svc.Handlers.Unmarshal.PushBackNamed(query.UnmarshalHandler) + svc.Handlers.UnmarshalMeta.PushBackNamed(query.UnmarshalMetaHandler) + svc.Handlers.UnmarshalError.PushBackNamed(query.UnmarshalErrorHandler) // Run custom client initialization if present if initClient != nil { diff --git a/vendor/github.com/aws/aws-sdk-go/service/sqs/api.go b/vendor/github.com/aws/aws-sdk-go/service/sqs/api.go index eb9350545a..103abb3c80 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/sqs/api.go +++ b/vendor/github.com/aws/aws-sdk-go/service/sqs/api.go @@ -6,6 +6,8 @@ package sqs import ( "github.com/aws/aws-sdk-go/aws/awsutil" "github.com/aws/aws-sdk-go/aws/request" + "github.com/aws/aws-sdk-go/private/protocol" + "github.com/aws/aws-sdk-go/private/protocol/query" ) const opAddPermission = "AddPermission" @@ -23,6 +25,8 @@ func (c *SQS) AddPermissionRequest(input *AddPermissionInput) (req *request.Requ } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &AddPermissionOutput{} req.Data = output return @@ -43,9 +47,7 @@ func (c *SQS) AddPermissionRequest(input *AddPermissionInput) (req *request.Requ // // Some API actions take lists of parameters. These lists are specified using // the param.n notation. Values of n are integers starting from 1. For example, -// a parameter list with two elements looks like this: &Attribute.1=this -// -// &Attribute.2=that +// a parameter list with two elements looks like this: func (c *SQS) AddPermission(input *AddPermissionInput) (*AddPermissionOutput, error) { req, out := c.AddPermissionRequest(input) err := req.Send() @@ -67,6 +69,8 @@ func (c *SQS) ChangeMessageVisibilityRequest(input *ChangeMessageVisibilityInput } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &ChangeMessageVisibilityOutput{} req.Data = output return @@ -139,9 +143,7 @@ func (c *SQS) ChangeMessageVisibilityBatchRequest(input *ChangeMessageVisibility // returns an HTTP status code of 200. Some API actions take lists of parameters. // These lists are specified using the param.n notation. Values of n are integers // starting from 1. For example, a parameter list with two elements looks like -// this: &Attribute.1=this -// -// &Attribute.2=that +// this: func (c *SQS) ChangeMessageVisibilityBatch(input *ChangeMessageVisibilityBatchInput) (*ChangeMessageVisibilityBatchOutput, error) { req, out := c.ChangeMessageVisibilityBatchRequest(input) err := req.Send() @@ -190,9 +192,7 @@ func (c *SQS) CreateQueueRequest(input *CreateQueueInput) (req *request.Request, // // Some API actions take lists of parameters. These lists are specified using // the param.n notation. Values of n are integers starting from 1. For example, -// a parameter list with two elements looks like this: &Attribute.1=this -// -// &Attribute.2=that +// a parameter list with two elements looks like this: func (c *SQS) CreateQueue(input *CreateQueueInput) (*CreateQueueOutput, error) { req, out := c.CreateQueueRequest(input) err := req.Send() @@ -214,6 +214,8 @@ func (c *SQS) DeleteMessageRequest(input *DeleteMessageInput) (req *request.Requ } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &DeleteMessageOutput{} req.Data = output return @@ -275,9 +277,7 @@ func (c *SQS) DeleteMessageBatchRequest(input *DeleteMessageBatchInput) (req *re // // Some API actions take lists of parameters. These lists are specified using // the param.n notation. Values of n are integers starting from 1. For example, -// a parameter list with two elements looks like this: &Attribute.1=this -// -// &Attribute.2=that +// a parameter list with two elements looks like this: func (c *SQS) DeleteMessageBatch(input *DeleteMessageBatchInput) (*DeleteMessageBatchOutput, error) { req, out := c.DeleteMessageBatchRequest(input) err := req.Send() @@ -299,6 +299,8 @@ func (c *SQS) DeleteQueueRequest(input *DeleteQueueInput) (req *request.Request, } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &DeleteQueueOutput{} req.Data = output return @@ -348,27 +350,27 @@ func (c *SQS) GetQueueAttributesRequest(input *GetQueueAttributesInput) (req *re } // Gets attributes for the specified queue. The following attributes are supported: -// All - returns all values. ApproximateNumberOfMessages - returns the approximate +// All - returns all values. ApproximateNumberOfMessages - returns the approximate // number of visible messages in a queue. For more information, see Resources // Required to Process Messages (http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/ApproximateNumber.html) -// in the Amazon SQS Developer Guide. ApproximateNumberOfMessagesNotVisible +// in the Amazon SQS Developer Guide. ApproximateNumberOfMessagesNotVisible // - returns the approximate number of messages that are not timed-out and not // deleted. For more information, see Resources Required to Process Messages // (http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/ApproximateNumber.html) -// in the Amazon SQS Developer Guide. VisibilityTimeout - returns the visibility +// in the Amazon SQS Developer Guide. VisibilityTimeout - returns the visibility // timeout for the queue. For more information about visibility timeout, see // Visibility Timeout (http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/AboutVT.html) -// in the Amazon SQS Developer Guide. CreatedTimestamp - returns the time when -// the queue was created (epoch time in seconds). LastModifiedTimestamp - returns -// the time when the queue was last changed (epoch time in seconds). Policy -// - returns the queue's policy. MaximumMessageSize - returns the limit of -// how many bytes a message can contain before Amazon SQS rejects it. MessageRetentionPeriod -// - returns the number of seconds Amazon SQS retains a message. QueueArn - -// returns the queue's Amazon resource name (ARN). ApproximateNumberOfMessagesDelayed +// in the Amazon SQS Developer Guide. CreatedTimestamp - returns the time when +// the queue was created (epoch time in seconds). LastModifiedTimestamp - returns +// the time when the queue was last changed (epoch time in seconds). Policy +// - returns the queue's policy. MaximumMessageSize - returns the limit of how +// many bytes a message can contain before Amazon SQS rejects it. MessageRetentionPeriod +// - returns the number of seconds Amazon SQS retains a message. QueueArn - +// returns the queue's Amazon resource name (ARN). ApproximateNumberOfMessagesDelayed // - returns the approximate number of messages that are pending to be added -// to the queue. DelaySeconds - returns the default delay on the queue in seconds. -// ReceiveMessageWaitTimeSeconds - returns the time for which a ReceiveMessage -// call will wait for a message to arrive. RedrivePolicy - returns the parameters +// to the queue. DelaySeconds - returns the default delay on the queue in seconds. +// ReceiveMessageWaitTimeSeconds - returns the time for which a ReceiveMessage +// call will wait for a message to arrive. RedrivePolicy - returns the parameters // for dead letter queue functionality of the source queue. For more information // about RedrivePolicy and dead letter queues, see Using Amazon SQS Dead Letter // Queues (http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/SQSDeadLetterQueue.html) @@ -379,9 +381,7 @@ func (c *SQS) GetQueueAttributesRequest(input *GetQueueAttributesInput) (req *re // handle new attributes gracefully. Some API actions take lists of parameters. // These lists are specified using the param.n notation. Values of n are integers // starting from 1. For example, a parameter list with two elements looks like -// this: &Attribute.1=this -// -// &Attribute.2=that +// this: func (c *SQS) GetQueueAttributes(input *GetQueueAttributesInput) (*GetQueueAttributesOutput, error) { req, out := c.GetQueueAttributesRequest(input) err := req.Send() @@ -497,6 +497,8 @@ func (c *SQS) PurgeQueueRequest(input *PurgeQueueInput) (req *request.Request, o } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &PurgeQueueOutput{} req.Data = output return @@ -600,6 +602,8 @@ func (c *SQS) RemovePermissionRequest(input *RemovePermissionInput) (req *reques } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &RemovePermissionOutput{} req.Data = output return @@ -694,9 +698,7 @@ func (c *SQS) SendMessageBatchRequest(input *SendMessageBatchInput) (req *reques // returns an HTTP status code of 200. Some API actions take lists of parameters. // These lists are specified using the param.n notation. Values of n are integers // starting from 1. For example, a parameter list with two elements looks like -// this: &Attribute.1=this -// -// &Attribute.2=that +// this: func (c *SQS) SendMessageBatch(input *SendMessageBatchInput) (*SendMessageBatchOutput, error) { req, out := c.SendMessageBatchRequest(input) err := req.Send() @@ -718,6 +720,8 @@ func (c *SQS) SetQueueAttributesRequest(input *SetQueueAttributesInput) (req *re } req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) output = &SetQueueAttributesOutput{} req.Data = output return @@ -870,11 +874,9 @@ func (s ChangeMessageVisibilityBatchOutput) GoString() string { // starting with 1. For example, a parameter list for this action might look // like this: // -// &ChangeMessageVisibilityBatchRequestEntry.1.Id=change_visibility_msg_2 // -// &ChangeMessageVisibilityBatchRequestEntry.1.ReceiptHandle=Your_Receipt_Handle // -// &ChangeMessageVisibilityBatchRequestEntry.1.VisibilityTimeout=45 +// Your_Receipt_Handle]]> type ChangeMessageVisibilityBatchRequestEntry struct { _ struct{} `type:"structure"` @@ -965,19 +967,19 @@ type CreateQueueInput struct { // The following lists the names, descriptions, and values of the special request // parameters the CreateQueue action uses: // - // DelaySeconds - The time in seconds that the delivery of all messages - // in the queue will be delayed. An integer from 0 to 900 (15 minutes). The - // default for this attribute is 0 (zero). MaximumMessageSize - The limit of - // how many bytes a message can contain before Amazon SQS rejects it. An integer - // from 1024 bytes (1 KiB) up to 262144 bytes (256 KiB). The default for this - // attribute is 262144 (256 KiB). MessageRetentionPeriod - The number of seconds - // Amazon SQS retains a message. Integer representing seconds, from 60 (1 minute) - // to 1209600 (14 days). The default for this attribute is 345600 (4 days). - // Policy - The queue's policy. A valid AWS policy. For more information about - // policy structure, see Overview of AWS IAM Policies (http://docs.aws.amazon.com/IAM/latest/UserGuide/PoliciesOverview.html) - // in the Amazon IAM User Guide. ReceiveMessageWaitTimeSeconds - The time for + // DelaySeconds - The time in seconds that the delivery of all messages in + // the queue will be delayed. An integer from 0 to 900 (15 minutes). The default + // for this attribute is 0 (zero). MaximumMessageSize - The limit of how many + // bytes a message can contain before Amazon SQS rejects it. An integer from + // 1024 bytes (1 KiB) up to 262144 bytes (256 KiB). The default for this attribute + // is 262144 (256 KiB). MessageRetentionPeriod - The number of seconds Amazon + // SQS retains a message. Integer representing seconds, from 60 (1 minute) to + // 1209600 (14 days). The default for this attribute is 345600 (4 days). Policy + // - The queue's policy. A valid AWS policy. For more information about policy + // structure, see Overview of AWS IAM Policies (http://docs.aws.amazon.com/IAM/latest/UserGuide/PoliciesOverview.html) + // in the Amazon IAM User Guide. ReceiveMessageWaitTimeSeconds - The time for // which a ReceiveMessage call will wait for a message to arrive. An integer - // from 0 to 20 (seconds). The default for this attribute is 0. VisibilityTimeout + // from 0 to 20 (seconds). The default for this attribute is 0. VisibilityTimeout // - The visibility timeout for the queue. An integer from 0 to 43200 (12 hours). // The default for this attribute is 30. For more information about visibility // timeout, see Visibility Timeout (http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/AboutVT.html) @@ -1377,6 +1379,8 @@ type MessageAttributeValue struct { // Binary type attributes can store any binary data, for example, compressed // data, encrypted data, or images. + // + // BinaryValue is automatically base64 encoded/decoded by the SDK. BinaryValue []byte `type:"blob"` // Amazon SQS supports the following logical data types: String, Number, and @@ -1442,13 +1446,13 @@ type ReceiveMessageInput struct { // The following lists the names and descriptions of the attributes that can // be returned: // - // All - returns all values. ApproximateFirstReceiveTimestamp - returns - // the time when the message was first received from the queue (epoch time in - // milliseconds). ApproximateReceiveCount - returns the number of times a message - // has been received from the queue but not deleted. SenderId - returns the - // AWS account number (or the IP address, if anonymous access is allowed) of - // the sender. SentTimestamp - returns the time when the message was sent to - // the queue (epoch time in milliseconds). + // All - returns all values. ApproximateFirstReceiveTimestamp - returns the + // time when the message was first received from the queue (epoch time in milliseconds). + // ApproximateReceiveCount - returns the number of times a message has been + // received from the queue but not deleted. SenderId - returns the AWS account + // number (or the IP address, if anonymous access is allowed) of the sender. + // SentTimestamp - returns the time when the message was sent to the queue (epoch + // time in milliseconds). AttributeNames []*string `locationNameList:"AttributeName" type:"list" flattened:"true"` // The maximum number of messages to return. Amazon SQS never returns more messages @@ -1727,22 +1731,22 @@ type SetQueueAttributesInput struct { // The following lists the names, descriptions, and values of the special request // parameters the SetQueueAttributes action uses: // - // DelaySeconds - The time in seconds that the delivery of all messages - // in the queue will be delayed. An integer from 0 to 900 (15 minutes). The - // default for this attribute is 0 (zero). MaximumMessageSize - The limit of - // how many bytes a message can contain before Amazon SQS rejects it. An integer - // from 1024 bytes (1 KiB) up to 262144 bytes (256 KiB). The default for this - // attribute is 262144 (256 KiB). MessageRetentionPeriod - The number of seconds - // Amazon SQS retains a message. Integer representing seconds, from 60 (1 minute) - // to 1209600 (14 days). The default for this attribute is 345600 (4 days). - // Policy - The queue's policy. A valid AWS policy. For more information about - // policy structure, see Overview of AWS IAM Policies (http://docs.aws.amazon.com/IAM/latest/UserGuide/PoliciesOverview.html) - // in the Amazon IAM User Guide. ReceiveMessageWaitTimeSeconds - The time for + // DelaySeconds - The time in seconds that the delivery of all messages in + // the queue will be delayed. An integer from 0 to 900 (15 minutes). The default + // for this attribute is 0 (zero). MaximumMessageSize - The limit of how many + // bytes a message can contain before Amazon SQS rejects it. An integer from + // 1024 bytes (1 KiB) up to 262144 bytes (256 KiB). The default for this attribute + // is 262144 (256 KiB). MessageRetentionPeriod - The number of seconds Amazon + // SQS retains a message. Integer representing seconds, from 60 (1 minute) to + // 1209600 (14 days). The default for this attribute is 345600 (4 days). Policy + // - The queue's policy. A valid AWS policy. For more information about policy + // structure, see Overview of AWS IAM Policies (http://docs.aws.amazon.com/IAM/latest/UserGuide/PoliciesOverview.html) + // in the Amazon IAM User Guide. ReceiveMessageWaitTimeSeconds - The time for // which a ReceiveMessage call will wait for a message to arrive. An integer - // from 0 to 20 (seconds). The default for this attribute is 0. VisibilityTimeout + // from 0 to 20 (seconds). The default for this attribute is 0. VisibilityTimeout // - The visibility timeout for the queue. An integer from 0 to 43200 (12 hours). // The default for this attribute is 30. For more information about visibility - // timeout, see Visibility Timeout in the Amazon SQS Developer Guide. RedrivePolicy + // timeout, see Visibility Timeout in the Amazon SQS Developer Guide. RedrivePolicy // - The parameters for dead letter queue functionality of the source queue. // For more information about RedrivePolicy and dead letter queues, see Using // Amazon SQS Dead Letter Queues in the Amazon SQS Developer Guide. diff --git a/vendor/github.com/aws/aws-sdk-go/service/sqs/service.go b/vendor/github.com/aws/aws-sdk-go/service/sqs/service.go index c6e8208341..dca9d855c3 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/sqs/service.go +++ b/vendor/github.com/aws/aws-sdk-go/service/sqs/service.go @@ -83,10 +83,10 @@ func newClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegio // Handlers svc.Handlers.Sign.PushBack(v4.Sign) - svc.Handlers.Build.PushBack(query.Build) - svc.Handlers.Unmarshal.PushBack(query.Unmarshal) - svc.Handlers.UnmarshalMeta.PushBack(query.UnmarshalMeta) - svc.Handlers.UnmarshalError.PushBack(query.UnmarshalError) + svc.Handlers.Build.PushBackNamed(query.BuildHandler) + svc.Handlers.Unmarshal.PushBackNamed(query.UnmarshalHandler) + svc.Handlers.UnmarshalMeta.PushBackNamed(query.UnmarshalMetaHandler) + svc.Handlers.UnmarshalError.PushBackNamed(query.UnmarshalErrorHandler) // Run custom client initialization if present if initClient != nil {