diff --git a/Godeps/Godeps.json b/Godeps/Godeps.json index 876e217f852..2a59d16ca65 100644 --- a/Godeps/Godeps.json +++ b/Godeps/Godeps.json @@ -1,6 +1,6 @@ { "ImportPath": "github.com/GoogleCloudPlatform/kubernetes", - "GoVersion": "go1.4.2", + "GoVersion": "go1.3.3", "Packages": [ "./..." ], @@ -48,6 +48,34 @@ "Comment": "v0.5.1-55-g87808a3", "Rev": "87808a37061a4a2e6204ccea5fd2fc930576db94" }, + { + "ImportPath": "github.com/awslabs/aws-sdk-go/aws", + "Rev": "c0a38f106248742920a2b786dcae81457af003d3" + }, + { + "ImportPath": "github.com/awslabs/aws-sdk-go/internal/endpoints", + "Rev": "c0a38f106248742920a2b786dcae81457af003d3" + }, + { + "ImportPath": "github.com/awslabs/aws-sdk-go/internal/protocol/ec2query", + "Rev": "c0a38f106248742920a2b786dcae81457af003d3" + }, + { + "ImportPath": "github.com/awslabs/aws-sdk-go/internal/protocol/query/queryutil", + "Rev": "c0a38f106248742920a2b786dcae81457af003d3" + }, + { + "ImportPath": "github.com/awslabs/aws-sdk-go/internal/protocol/xml/xmlutil", + "Rev": "c0a38f106248742920a2b786dcae81457af003d3" + }, + { + "ImportPath": "github.com/awslabs/aws-sdk-go/internal/signer/v4", + "Rev": "c0a38f106248742920a2b786dcae81457af003d3" + }, + { + "ImportPath": "github.com/awslabs/aws-sdk-go/service/ec2", + "Rev": "c0a38f106248742920a2b786dcae81457af003d3" + }, { "ImportPath": "github.com/beorn7/perks/quantile", "Rev": "b965b613227fddccbfffe13eae360ed3fa822f8d" @@ -336,14 +364,6 @@ "ImportPath": "github.com/miekg/dns", "Rev": "3f504e8dabd5d562e997d19ce0200aa41973e1b2" }, - { - "ImportPath": "github.com/mitchellh/goamz/aws", - "Rev": "703cfb45985762869e465f37ed030ff01615ff1e" - }, - { - "ImportPath": "github.com/mitchellh/goamz/ec2", - "Rev": "703cfb45985762869e465f37ed030ff01615ff1e" - }, { "ImportPath": "github.com/mitchellh/mapstructure", "Rev": "740c764bc6149d3f1806231418adb9f52c11bcbf" diff --git a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/awsutil/copy.go b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/awsutil/copy.go new file mode 100644 index 00000000000..ddab85f8a2f --- /dev/null +++ b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/awsutil/copy.go @@ -0,0 +1,69 @@ +package awsutil + +import ( + "io" + "reflect" +) + +// Copy deeply copies a src structure to dst. Useful for copying request and +// response structures. +func Copy(dst, src interface{}) { + rcopy(reflect.ValueOf(dst), reflect.ValueOf(src)) +} + +// CopyOf returns a copy of src while also allocating the memory for dst. +// src must be a pointer type or this operation will fail. +func CopyOf(src interface{}) (dst interface{}) { + dsti := reflect.New(reflect.TypeOf(src).Elem()) + dst = dsti.Interface() + rcopy(dsti, reflect.ValueOf(src)) + return +} + +// rcopy performs a recursive copy of values from the source to destination. +func rcopy(dst, src reflect.Value) { + if !src.IsValid() { + return + } + + switch src.Kind() { + case reflect.Ptr: + if _, ok := src.Interface().(io.Reader); ok { + if dst.Kind() == reflect.Ptr && dst.Elem().CanSet() { + dst.Elem().Set(src) + } else if dst.CanSet() { + dst.Set(src) + } + } else { + e := src.Type().Elem() + if dst.CanSet() { + dst.Set(reflect.New(e)) + } + if src.Elem().IsValid() { + rcopy(dst.Elem(), src.Elem()) + } + } + case reflect.Struct: + dst.Set(reflect.New(src.Type()).Elem()) + for i := 0; i < src.NumField(); i++ { + rcopy(dst.Field(i), src.Field(i)) + } + case reflect.Slice: + s := reflect.MakeSlice(src.Type(), src.Len(), src.Cap()) + dst.Set(s) + for i := 0; i < src.Len(); i++ { + rcopy(dst.Index(i), src.Index(i)) + } + case reflect.Map: + s := reflect.MakeMap(src.Type()) + dst.Set(s) + for _, k := range src.MapKeys() { + v := src.MapIndex(k) + v2 := reflect.New(v.Type()).Elem() + rcopy(v2, v) + dst.SetMapIndex(k, v2) + } + default: + dst.Set(src) + } +} diff --git a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/awsutil/copy_test.go b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/awsutil/copy_test.go new file mode 100644 index 00000000000..15b7929e3e9 --- /dev/null +++ b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/awsutil/copy_test.go @@ -0,0 +1,130 @@ +package awsutil_test + +import ( + "bytes" + "fmt" + "io" + "io/ioutil" + "testing" + + "github.com/awslabs/aws-sdk-go/aws/awsutil" + "github.com/stretchr/testify/assert" +) + +func ExampleCopy() { + type Foo struct { + A int + B []*string + } + + // Create the initial value + str1 := "hello" + str2 := "bye bye" + f1 := &Foo{A: 1, B: []*string{&str1, &str2}} + + // Do the copy + var f2 Foo + awsutil.Copy(&f2, f1) + + // Print the result + fmt.Println(awsutil.StringValue(f2)) + + // Output: + // { + // A: 1, + // B: ["hello","bye bye"] + // } +} + +func TestCopy(t *testing.T) { + type Foo struct { + A int + B []*string + C map[string]*int + } + + // Create the initial value + str1 := "hello" + str2 := "bye bye" + int1 := 1 + int2 := 2 + f1 := &Foo{ + A: 1, + B: []*string{&str1, &str2}, + C: map[string]*int{ + "A": &int1, + "B": &int2, + }, + } + + // Do the copy + var f2 Foo + awsutil.Copy(&f2, f1) + + // Values are equal + assert.Equal(t, f2.A, f1.A) + assert.Equal(t, f2.B, f1.B) + assert.Equal(t, f2.C, f1.C) + + // But pointers are not! + str3 := "nothello" + int3 := 57 + f2.A = 100 + f2.B[0] = &str3 + f2.C["B"] = &int3 + assert.NotEqual(t, f2.A, f1.A) + assert.NotEqual(t, f2.B, f1.B) + assert.NotEqual(t, f2.C, f1.C) +} + +func TestCopyPrimitive(t *testing.T) { + str := "hello" + var s string + awsutil.Copy(&s, &str) + assert.Equal(t, "hello", s) +} + +func TestCopyNil(t *testing.T) { + var s string + awsutil.Copy(&s, nil) + assert.Equal(t, "", s) +} + +func TestCopyReader(t *testing.T) { + var buf io.Reader = bytes.NewReader([]byte("hello world")) + var r io.Reader + awsutil.Copy(&r, buf) + b, err := ioutil.ReadAll(r) + assert.NoError(t, err) + assert.Equal(t, []byte("hello world"), b) + + // empty bytes because this is not a deep copy + b, err = ioutil.ReadAll(buf) + assert.NoError(t, err) + assert.Equal(t, []byte(""), b) +} + +func ExampleCopyOf() { + type Foo struct { + A int + B []*string + } + + // Create the initial value + str1 := "hello" + str2 := "bye bye" + f1 := &Foo{A: 1, B: []*string{&str1, &str2}} + + // Do the copy + v := awsutil.CopyOf(f1) + var f2 *Foo = v.(*Foo) + + // Print the result + fmt.Println(awsutil.StringValue(f2)) + + // Output: + // { + // A: 1, + // B: ["hello","bye bye"] + // } +} diff --git a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/awsutil/path_value.go b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/awsutil/path_value.go new file mode 100644 index 00000000000..c98e93ea0b7 --- /dev/null +++ b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/awsutil/path_value.go @@ -0,0 +1,144 @@ +package awsutil + +import ( + "reflect" + "regexp" + "strconv" + "strings" +) + +var indexRe = regexp.MustCompile(`(.+)\[(-?\d+)?\]$`) + +// rValuesAtPath returns a slice of values found in value v. The values +// in v are explored recursively so all nested values are collected. +func rValuesAtPath(v interface{}, path string, create bool) []reflect.Value { + pathparts := strings.Split(path, "||") + if len(pathparts) > 1 { + for _, pathpart := range pathparts { + vals := rValuesAtPath(v, pathpart, create) + if vals != nil && len(vals) > 0 { + return vals + } + } + return nil + } + + values := []reflect.Value{reflect.Indirect(reflect.ValueOf(v))} + components := strings.Split(path, ".") + for len(values) > 0 && len(components) > 0 { + var index *int64 + var indexStar bool + c := strings.TrimSpace(components[0]) + if c == "" { // no actual component, illegal syntax + return nil + } else if c != "*" && strings.ToLower(c[0:1]) == c[0:1] { + // TODO normalize case for user + return nil // don't support unexported fields + } + + // parse this component + if m := indexRe.FindStringSubmatch(c); m != nil { + c = m[1] + if m[2] == "" { + index = nil + indexStar = true + } else { + i, _ := strconv.ParseInt(m[2], 10, 32) + index = &i + indexStar = false + } + } + + nextvals := []reflect.Value{} + for _, value := range values { + // pull component name out of struct member + if value.Kind() != reflect.Struct { + continue + } + + if c == "*" { // pull all members + for i := 0; i < value.NumField(); i++ { + if f := reflect.Indirect(value.Field(i)); f.IsValid() { + nextvals = append(nextvals, f) + } + } + continue + } + + value = value.FieldByName(c) + if create && value.Kind() == reflect.Ptr && value.IsNil() { + value.Set(reflect.New(value.Type().Elem())) + value = value.Elem() + } else { + value = reflect.Indirect(value) + } + + if value.IsValid() { + nextvals = append(nextvals, value) + } + } + values = nextvals + + if indexStar || index != nil { + nextvals = []reflect.Value{} + for _, value := range values { + value := reflect.Indirect(value) + if value.Kind() != reflect.Slice { + continue + } + + if indexStar { // grab all indices + for i := 0; i < value.Len(); i++ { + idx := reflect.Indirect(value.Index(i)) + if idx.IsValid() { + nextvals = append(nextvals, idx) + } + } + continue + } + + // pull out index + i := int(*index) + if i >= value.Len() { // check out of bounds + if create { + // TODO resize slice + } else { + continue + } + } else if i < 0 { // support negative indexing + i = value.Len() + i + } + value = reflect.Indirect(value.Index(i)) + + if value.IsValid() { + nextvals = append(nextvals, value) + } + } + values = nextvals + } + + components = components[1:] + } + return values +} + +// ValuesAtPath returns a list of objects at the lexical path inside of a structure +func ValuesAtPath(i interface{}, path string) []interface{} { + if rvals := rValuesAtPath(i, path, false); rvals != nil { + vals := make([]interface{}, len(rvals)) + for i, rval := range rvals { + vals[i] = rval.Interface() + } + return vals + } + return nil +} + +// SetValueAtPath sets an object at the lexical path inside of a structure +func SetValueAtPath(i interface{}, path string, v interface{}) { + if rvals := rValuesAtPath(i, path, true); rvals != nil { + for _, rval := range rvals { + rval.Set(reflect.ValueOf(v)) + } + } +} diff --git a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/awsutil/path_value_test.go b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/awsutil/path_value_test.go new file mode 100644 index 00000000000..88192736501 --- /dev/null +++ b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/awsutil/path_value_test.go @@ -0,0 +1,60 @@ +package awsutil_test + +import ( + "testing" + + "github.com/awslabs/aws-sdk-go/aws/awsutil" + "github.com/stretchr/testify/assert" +) + +type Struct struct { + A []Struct + a []Struct + B *Struct + D *Struct + C string +} + +var data = Struct{ + A: []Struct{Struct{C: "value1"}, Struct{C: "value2"}, Struct{C: "value3"}}, + a: []Struct{Struct{C: "value1"}, Struct{C: "value2"}, Struct{C: "value3"}}, + B: &Struct{B: &Struct{C: "terminal"}, D: &Struct{C: "terminal2"}}, + C: "initial", +} + +func TestValueAtPathSuccess(t *testing.T) { + assert.Equal(t, []interface{}{"initial"}, awsutil.ValuesAtPath(data, "C")) + assert.Equal(t, []interface{}{"value1"}, awsutil.ValuesAtPath(data, "A[0].C")) + assert.Equal(t, []interface{}{"value2"}, awsutil.ValuesAtPath(data, "A[1].C")) + assert.Equal(t, []interface{}{"value3"}, awsutil.ValuesAtPath(data, "A[2].C")) + assert.Equal(t, []interface{}{"value3"}, awsutil.ValuesAtPath(data, "A[-1].C")) + assert.Equal(t, []interface{}{"value1", "value2", "value3"}, awsutil.ValuesAtPath(data, "A[].C")) + assert.Equal(t, []interface{}{"terminal"}, awsutil.ValuesAtPath(data, "B . B . C")) + assert.Equal(t, []interface{}{"terminal", "terminal2"}, awsutil.ValuesAtPath(data, "B.*.C")) + assert.Equal(t, []interface{}{"initial"}, awsutil.ValuesAtPath(data, "A.D.X || C")) +} + +func TestValueAtPathFailure(t *testing.T) { + assert.Equal(t, []interface{}(nil), awsutil.ValuesAtPath(data, "C.x")) + assert.Equal(t, []interface{}(nil), awsutil.ValuesAtPath(data, ".x")) + assert.Equal(t, []interface{}{}, awsutil.ValuesAtPath(data, "X.Y.Z")) + assert.Equal(t, []interface{}{}, awsutil.ValuesAtPath(data, "A[100].C")) + assert.Equal(t, []interface{}{}, awsutil.ValuesAtPath(data, "A[3].C")) + assert.Equal(t, []interface{}{}, awsutil.ValuesAtPath(data, "B.B.C.Z")) + assert.Equal(t, []interface{}(nil), awsutil.ValuesAtPath(data, "a[-1].C")) + assert.Equal(t, []interface{}{}, awsutil.ValuesAtPath(nil, "A.B.C")) +} + +func TestSetValueAtPathSuccess(t *testing.T) { + var s Struct + awsutil.SetValueAtPath(&s, "C", "test1") + awsutil.SetValueAtPath(&s, "B.B.C", "test2") + awsutil.SetValueAtPath(&s, "B.D.C", "test3") + assert.Equal(t, "test1", s.C) + assert.Equal(t, "test2", s.B.B.C) + assert.Equal(t, "test3", s.B.D.C) + + awsutil.SetValueAtPath(&s, "B.*.C", "test0") + assert.Equal(t, "test0", s.B.B.C) + assert.Equal(t, "test0", s.B.D.C) +} diff --git a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/awsutil/string_value.go b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/awsutil/string_value.go new file mode 100644 index 00000000000..4c859e2154b --- /dev/null +++ b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/awsutil/string_value.go @@ -0,0 +1,103 @@ +package awsutil + +import ( + "bytes" + "fmt" + "io" + "reflect" + "strings" +) + +// StringValue returns the string representation of a value. +func StringValue(i interface{}) string { + var buf bytes.Buffer + stringValue(reflect.ValueOf(i), 0, &buf) + return buf.String() +} + +// stringValue will recursively walk value v to build a textual +// representation of the value. +func stringValue(v reflect.Value, indent int, buf *bytes.Buffer) { + for v.Kind() == reflect.Ptr { + v = v.Elem() + } + + switch v.Kind() { + case reflect.Struct: + strtype := v.Type().String() + if strtype == "time.Time" { + fmt.Fprintf(buf, "%s", v.Interface()) + break + } else if strings.HasPrefix(strtype, "io.") { + buf.WriteString("") + break + } + + buf.WriteString("{\n") + + names := []string{} + for i := 0; i < v.Type().NumField(); i++ { + name := v.Type().Field(i).Name + f := v.Field(i) + if name[0:1] == strings.ToLower(name[0:1]) { + continue // ignore unexported fields + } + if (f.Kind() == reflect.Ptr || f.Kind() == reflect.Slice) && f.IsNil() { + continue // ignore unset fields + } + names = append(names, name) + } + + for i, n := range names { + val := v.FieldByName(n) + buf.WriteString(strings.Repeat(" ", indent+2)) + buf.WriteString(n + ": ") + stringValue(val, indent+2, buf) + + if i < len(names)-1 { + buf.WriteString(",\n") + } + } + + buf.WriteString("\n" + strings.Repeat(" ", indent) + "}") + case reflect.Slice: + nl, id, id2 := "", "", "" + if v.Len() > 3 { + nl, id, id2 = "\n", strings.Repeat(" ", indent), strings.Repeat(" ", indent+2) + } + buf.WriteString("[" + nl) + for i := 0; i < v.Len(); i++ { + buf.WriteString(id2) + stringValue(v.Index(i), indent+2, buf) + + if i < v.Len()-1 { + buf.WriteString("," + nl) + } + } + + buf.WriteString(nl + id + "]") + case reflect.Map: + buf.WriteString("{\n") + + for i, k := range v.MapKeys() { + buf.WriteString(strings.Repeat(" ", indent+2)) + buf.WriteString(k.String() + ": ") + stringValue(v.MapIndex(k), indent+2, buf) + + if i < v.Len()-1 { + buf.WriteString(",\n") + } + } + + buf.WriteString("\n" + strings.Repeat(" ", indent) + "}") + default: + format := "%v" + switch v.Interface().(type) { + case string: + format = "%q" + case io.ReadSeeker, io.Reader: + format = "buffer(%p)" + } + fmt.Fprintf(buf, format, v.Interface()) + } +} diff --git a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/config.go b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/config.go new file mode 100644 index 00000000000..044fea7f028 --- /dev/null +++ b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/config.go @@ -0,0 +1,167 @@ +package aws + +import ( + "io" + "net/http" + "os" + + "github.com/awslabs/aws-sdk-go/aws/credentials" +) + +// DefaultChainCredentials is a Credentials which will find the first available +// credentials Value from the list of Providers. +// +// This should be used in the default case. Once the type of credentials are +// known switching to the specific Credentials will be more efficient. +var DefaultChainCredentials = credentials.NewChainCredentials( + []credentials.Provider{ + &credentials.EnvProvider{}, + &credentials.SharedCredentialsProvider{Filename: "", Profile: ""}, + &credentials.EC2RoleProvider{}, + }) + +// The default number of retries for a service. The value of -1 indicates that +// the service specific retry default will be used. +const DefaultRetries = -1 + +// DefaultConfig is the default all service configuration will be based off of. +var DefaultConfig = &Config{ + Credentials: DefaultChainCredentials, + Endpoint: "", + Region: os.Getenv("AWS_REGION"), + DisableSSL: false, + ManualSend: false, + HTTPClient: http.DefaultClient, + LogHTTPBody: false, + LogLevel: 0, + Logger: os.Stdout, + MaxRetries: DefaultRetries, + DisableParamValidation: false, + DisableComputeChecksums: false, + S3ForcePathStyle: false, +} + +// A Config provides service configuration +type Config struct { + Credentials *credentials.Credentials + Endpoint string + Region string + DisableSSL bool + ManualSend bool + HTTPClient *http.Client + LogHTTPBody bool + LogLevel uint + Logger io.Writer + MaxRetries int + DisableParamValidation bool + DisableComputeChecksums bool + S3ForcePathStyle bool +} + +// Copy will return a shallow copy of the Config object. +func (c Config) Copy() Config { + dst := Config{} + dst.Credentials = c.Credentials + dst.Endpoint = c.Endpoint + dst.Region = c.Region + dst.DisableSSL = c.DisableSSL + dst.ManualSend = c.ManualSend + dst.HTTPClient = c.HTTPClient + dst.LogLevel = c.LogLevel + dst.Logger = c.Logger + dst.MaxRetries = c.MaxRetries + dst.DisableParamValidation = c.DisableParamValidation + dst.DisableComputeChecksums = c.DisableComputeChecksums + dst.S3ForcePathStyle = c.S3ForcePathStyle + + return dst +} + +// Merge merges the newcfg attribute values into this Config. Each attribute +// will be merged into this config if the newcfg attribute's value is non-zero. +// Due to this, newcfg attributes with zero values cannot be merged in. For +// example bool attributes cannot be cleared using Merge, and must be explicitly +// set on the Config structure. +func (c Config) Merge(newcfg *Config) *Config { + cfg := Config{} + + if newcfg != nil && newcfg.Credentials != nil { + cfg.Credentials = newcfg.Credentials + } else { + cfg.Credentials = c.Credentials + } + + if newcfg != nil && newcfg.Endpoint != "" { + cfg.Endpoint = newcfg.Endpoint + } else { + cfg.Endpoint = c.Endpoint + } + + if newcfg != nil && newcfg.Region != "" { + cfg.Region = newcfg.Region + } else { + cfg.Region = c.Region + } + + if newcfg != nil && newcfg.DisableSSL { + cfg.DisableSSL = newcfg.DisableSSL + } else { + cfg.DisableSSL = c.DisableSSL + } + + if newcfg != nil && newcfg.ManualSend { + cfg.ManualSend = newcfg.ManualSend + } else { + cfg.ManualSend = c.ManualSend + } + + if newcfg != nil && newcfg.HTTPClient != nil { + cfg.HTTPClient = newcfg.HTTPClient + } else { + cfg.HTTPClient = c.HTTPClient + } + + if newcfg != nil && newcfg.LogHTTPBody { + cfg.LogHTTPBody = newcfg.LogHTTPBody + } else { + cfg.LogHTTPBody = c.LogHTTPBody + } + + if newcfg != nil && newcfg.LogLevel != 0 { + cfg.LogLevel = newcfg.LogLevel + } else { + cfg.LogLevel = c.LogLevel + } + + if newcfg != nil && newcfg.Logger != nil { + cfg.Logger = newcfg.Logger + } else { + cfg.Logger = c.Logger + } + + if newcfg != nil && newcfg.MaxRetries != DefaultRetries { + cfg.MaxRetries = newcfg.MaxRetries + } else { + cfg.MaxRetries = c.MaxRetries + } + + if newcfg != nil && newcfg.DisableParamValidation { + cfg.DisableParamValidation = newcfg.DisableParamValidation + } else { + cfg.DisableParamValidation = c.DisableParamValidation + } + + if newcfg != nil && newcfg.DisableComputeChecksums { + cfg.DisableComputeChecksums = newcfg.DisableComputeChecksums + } else { + cfg.DisableComputeChecksums = c.DisableComputeChecksums + } + + if newcfg != nil && newcfg.S3ForcePathStyle { + cfg.S3ForcePathStyle = newcfg.S3ForcePathStyle + } else { + cfg.S3ForcePathStyle = c.S3ForcePathStyle + } + + return &cfg +} diff --git a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/credentials/chain_provider.go b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/credentials/chain_provider.go new file mode 100644 index 00000000000..67e36055e21 --- /dev/null +++ b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/credentials/chain_provider.go @@ -0,0 +1,81 @@ +package credentials + +import ( + "fmt" +) + +var ( + // ErrNoValidProvidersFoundInChain Is returned when there are no valid + // providers in the ChainProvider. + ErrNoValidProvidersFoundInChain = fmt.Errorf("no valid providers in chain") +) + +// A ChainProvider will search for a provider which returns credentials +// and cache that provider until Retrieve is called again. +// +// The ChainProvider provides a way of chaining multiple providers together +// which will pick the first available using priority order of the Providers +// in the list. +// +// If none of the Providers retrieve valid credentials Value, ChainProvider's +// Retrieve() will return the error ErrNoValidProvidersFoundInChain. +// +// If a Provider is found which returns valid credentials Value ChainProvider +// will cache that Provider for all calls to IsExpired(), until Retrieve is +// called again. +// +// Example of ChainProvider to be used with an EnvProvider and EC2RoleProvider. +// In this example EnvProvider will first check if any credentials are available +// vai the environment variables. If there are none ChainProvider will check +// the next Provider in the list, EC2RoleProvider in this case. If EC2RoleProvider +// does not return any credentials ChainProvider will return the error +// ErrNoValidProvidersFoundInChain +// +// creds := NewChainCredentials( +// []Provider{ +// &EnvProvider{}, +// &EC2RoleProvider{}, +// }) +// creds.Retrieve() +// +type ChainProvider struct { + Providers []Provider + curr Provider +} + +// NewChainCredentials returns a pointer to a new Credentials object +// wrapping a chain of providers. +func NewChainCredentials(providers []Provider) *Credentials { + return NewCredentials(&ChainProvider{ + Providers: append([]Provider{}, providers...), + }) +} + +// Retrieve returns the credentials value or error if no provider returned +// without error. +// +// 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) { + for _, p := range c.Providers { + if creds, err := p.Retrieve(); err == nil { + c.curr = p + return creds, nil + } + } + c.curr = nil + + // TODO better error reporting. maybe report error for each failed retrieve? + + return Value{}, ErrNoValidProvidersFoundInChain +} + +// IsExpired will returned the expired state of the currently cached provider +// if there is one. If there is no current provider, true will be returned. +func (c *ChainProvider) IsExpired() bool { + if c.curr != nil { + return c.curr.IsExpired() + } + + return true +} diff --git a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/credentials/chain_provider_test.go b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/credentials/chain_provider_test.go new file mode 100644 index 00000000000..9c0a765fa8c --- /dev/null +++ b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/credentials/chain_provider_test.go @@ -0,0 +1,72 @@ +package credentials + +import ( + "errors" + "github.com/stretchr/testify/assert" + "testing" +) + +func TestChainProviderGet(t *testing.T) { + p := &ChainProvider{ + Providers: []Provider{ + &stubProvider{err: errors.New("first provider error")}, + &stubProvider{err: errors.New("second provider error")}, + &stubProvider{ + creds: Value{ + AccessKeyID: "AKID", + SecretAccessKey: "SECRET", + SessionToken: "", + }, + }, + }, + } + + creds, err := p.Retrieve() + assert.Nil(t, err, "Expect no error") + assert.Equal(t, "AKID", creds.AccessKeyID, "Expect access key ID to match") + assert.Equal(t, "SECRET", creds.SecretAccessKey, "Expect secret access key to match") + assert.Empty(t, creds.SessionToken, "Expect session token to be empty") +} + +func TestChainProviderIsExpired(t *testing.T) { + stubProvider := &stubProvider{expired: true} + p := &ChainProvider{ + Providers: []Provider{ + stubProvider, + }, + } + + assert.True(t, p.IsExpired(), "Expect expired to be true before any Retrieve") + _, err := p.Retrieve() + assert.Nil(t, err, "Expect no error") + assert.False(t, p.IsExpired(), "Expect not expired after retrieve") + + stubProvider.expired = true + assert.True(t, p.IsExpired(), "Expect return of expired provider") + + _, err = p.Retrieve() + assert.False(t, p.IsExpired(), "Expect not expired after retrieve") +} + +func TestChainProviderWithNoProvider(t *testing.T) { + p := &ChainProvider{ + Providers: []Provider{}, + } + + assert.True(t, p.IsExpired(), "Expect expired with no providers") + _, err := p.Retrieve() + assert.Equal(t, ErrNoValidProvidersFoundInChain, err, "Expect no providers error returned") +} + +func TestChainProviderWithNoValidProvider(t *testing.T) { + p := &ChainProvider{ + Providers: []Provider{ + &stubProvider{err: errors.New("first provider error")}, + &stubProvider{err: errors.New("second provider error")}, + }, + } + + assert.True(t, p.IsExpired(), "Expect expired with no providers") + _, err := p.Retrieve() + assert.Contains(t, "no valid providers in chain", err.Error(), "Expect no providers error returned") +} diff --git a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/credentials/credentials.go b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/credentials/credentials.go new file mode 100644 index 00000000000..6f6ec03127e --- /dev/null +++ b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/credentials/credentials.go @@ -0,0 +1,178 @@ +// Package credentials provides credential retrieval and management +// +// The Credentials is the primary method of getting access to and managing +// credentials Values. Using dependency injection retrieval of the credential +// values is handled by a object which satisfies the Provider interface. +// +// By default the Credentials.Get() will cache the successful result of a +// Provider's Retrieve() until Provider.IsExpired() returns true. At which +// point Credentials will call Provider's Retrieve() to get new credential Value. +// +// The Provider is responsible for determining when credentials Value have expired. +// It is also important to note that Credentials will always call Retrieve the +// first time Credentials.Get() is called. +// +// Example of using the environment variable credentials. +// +// creds := NewEnvCredentials() +// +// // Retrieve the credentials value +// credValue, err := creds.Get() +// if err != nil { +// // handle error +// } +// +// Example of forcing credentials to expire and be refreshed on the next Get(). +// This may be helpful to proactively expire credentials and refresh them sooner +// than they would naturally expire on their own. +// +// creds := NewCredentials(&EC2RoleProvider{}) +// creds.Expire() +// credsValue, err := creds.Get() +// // New credentials will be retrieved instead of from cache. +// +// +// Custom Provider +// +// Each Provider built into this package also provides a helper method to generate +// a Credentials pointer setup with the provider. To use a custom Provider just +// create a type which satisfies the Provider interface and pass it to the +// NewCredentials method. +// +// type MyProvider struct{} +// func (m *MyProvider) Retrieve() (Value, error) {...} +// func (m *MyProvider) IsExpired() bool {...} +// +// creds := NewCredentials(&MyProvider{}) +// credValue, err := creds.Get() +// +package credentials + +import ( + "sync" + "time" +) + +// Create an empty Credential object that can be used as dummy placeholder +// credentials for requests that do not need signed. +// +// This Credentials can be used to configure a service to not sign requests +// when making service API calls. For example, when accessing public +// s3 buckets. +// +// svc := s3.New(&aws.Config{Credentials: AnonymousCredentials}) +// // Access public S3 buckets. +// +var AnonymousCredentials = NewStaticCredentials("", "", "") + +// A Value is the AWS credentials value for individual credential fields. +type Value struct { + // AWS Access key ID + AccessKeyID string + + // AWS Secret Access Key + SecretAccessKey string + + // AWS Session Token + SessionToken string +} + +// A Provider is the interface for any component which will provide credentials +// Value. A provider is required to manage its own Expired state, and what to +// be expired means. +// +// The Provider should not need to implement its own mutexes, because +// that will be managed by Credentials. +type Provider interface { + // Refresh returns nil if it successfully retrieved the value. + // Error is returned if the value were not obtainable, or empty. + Retrieve() (Value, error) + + // IsExpired returns if the credentials are no longer valid, and need + // to be retrieved. + IsExpired() bool +} + +// A Credentials provides synchronous safe retrieval of AWS credentials Value. +// Credentials will cache the credentials value until they expire. Once the value +// expires the next Get will attempt to retrieve valid credentials. +// +// Credentials is safe to use across multiple goroutines and will manage the +// synchronous state so the Providers do not need to implement their own +// synchronization. +// +// The first Credentials.Get() will always call Provider.Retrieve() to get the +// first instance of the credentials Value. All calls to Get() after that +// will return the cached credentials Value until IsExpired() returns true. +type Credentials struct { + creds Value + forceRefresh bool + m sync.Mutex + + provider Provider +} + +// NewCredentials returns a pointer to a new Credentials with the provider set. +func NewCredentials(provider Provider) *Credentials { + return &Credentials{ + provider: provider, + forceRefresh: true, + } +} + +// Get returns the credentials value, or error if the credentials Value failed +// to be retrieved. +// +// Will return the cached credentials Value if it has not expired. If the +// credentials Value has expired the Provider's Retrieve() will be called +// to refresh the credentials. +// +// If Credentials.Expire() was called the credentials Value will be force +// expired, and the next call to Get() will cause them to be refreshed. +func (c *Credentials) Get() (Value, error) { + c.m.Lock() + defer c.m.Unlock() + + if c.isExpired() { + creds, err := c.provider.Retrieve() + if err != nil { + return Value{}, err + } + c.creds = creds + c.forceRefresh = false + } + + return c.creds, nil +} + +// Expire expires the credentials and forces them to be retrieved on the +// next call to Get(). +// +// This will override the Provider's expired state, and force Credentials +// to call the Provider's Retrieve(). +func (c *Credentials) Expire() { + c.m.Lock() + defer c.m.Unlock() + + c.forceRefresh = true +} + +// IsExpired returns if the credentials are no longer valid, and need +// to be retrieved. +// +// If the Credentials were forced to be expired with Expire() this will +// reflect that override. +func (c *Credentials) IsExpired() bool { + c.m.Lock() + defer c.m.Unlock() + + return c.isExpired() +} + +// isExpired helper method wrapping the definition of expired credentials. +func (c *Credentials) isExpired() bool { + return c.forceRefresh || c.provider.IsExpired() +} + +// Provide a stub-able time.Now for unit tests so expiry can be tested. +var currentTime = time.Now diff --git a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/credentials/credentials_test.go b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/credentials/credentials_test.go new file mode 100644 index 00000000000..96961bf1654 --- /dev/null +++ b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/credentials/credentials_test.go @@ -0,0 +1,61 @@ +package credentials + +import ( + "errors" + "github.com/stretchr/testify/assert" + "testing" +) + +type stubProvider struct { + creds Value + expired bool + err error +} + +func (s *stubProvider) Retrieve() (Value, error) { + s.expired = false + return s.creds, s.err +} +func (s *stubProvider) IsExpired() bool { + return s.expired +} + +func TestCredentialsGet(t *testing.T) { + c := NewCredentials(&stubProvider{ + creds: Value{ + AccessKeyID: "AKID", + SecretAccessKey: "SECRET", + SessionToken: "", + }, + expired: true, + }) + + creds, err := c.Get() + assert.Nil(t, err, "Expected no error") + assert.Equal(t, "AKID", creds.AccessKeyID, "Expect access key ID to match") + assert.Equal(t, "SECRET", creds.SecretAccessKey, "Expect secret access key to match") + assert.Empty(t, creds.SessionToken, "Expect session token to be empty") +} + +func TestCredentialsGetWithError(t *testing.T) { + c := NewCredentials(&stubProvider{err: errors.New("provider error"), expired: true}) + + _, err := c.Get() + assert.Equal(t, "provider error", err.Error(), "Expected provider error") +} + +func TestCredentialsExpire(t *testing.T) { + stub := &stubProvider{} + c := NewCredentials(stub) + + stub.expired = false + assert.True(t, c.IsExpired(), "Expected to start out expired") + c.Expire() + assert.True(t, c.IsExpired(), "Expected to be expired") + + c.forceRefresh = false + assert.False(t, c.IsExpired(), "Expected not to be expired") + + stub.expired = true + assert.True(t, c.IsExpired(), "Expected to be expired") +} diff --git a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/credentials/ec2_role_provider.go b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/credentials/ec2_role_provider.go new file mode 100644 index 00000000000..cd9c34165cd --- /dev/null +++ b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/credentials/ec2_role_provider.go @@ -0,0 +1,167 @@ +package credentials + +import ( + "bufio" + "encoding/json" + "fmt" + "net/http" + "time" +) + +const metadataCredentialsEndpoint = "http://169.254.169.254/latest/meta-data/iam/security-credentials/" + +// A EC2RoleProvider retrieves credentials from the EC2 service, and keeps track if +// those credentials are expired. +// +// Example how to configure the EC2RoleProvider with custom http Client, Endpoint +// or ExpiryWindow +// +// p := &credentials.EC2RoleProvider{ +// // Pass in a custom timeout to be used when requesting +// // IAM EC2 Role credentials. +// Client: &http.Client{ +// Timeout: 10 * time.Second, +// }, +// // Use default EC2 Role metadata endpoint, Alternate endpoints can be +// // specified setting Endpoint to something else. +// Endpoint: "", +// // Do not use early expiry of credentials. If a non zero value is +// // specified the credentials will be expired early +// ExpiryWindow: 0, +// } +// +type EC2RoleProvider struct { + // Endpoint must be fully quantified URL + Endpoint string + + // HTTP client to use when connecting to EC2 service + Client *http.Client + + // ExpiryWindow will allow the credentials to trigger refreshing prior to + // the credentials actually expiring. This is beneficial so race conditions + // with expiring credentials do not cause request to fail unexpectedly + // due to ExpiredTokenException exceptions. + // + // So a ExpiryWindow of 10s would cause calls to IsExpired() to return true + // 10 seconds before the credentials are actually expired. + // + // If ExpiryWindow is 0 or less it will be ignored. + ExpiryWindow time.Duration + + // The date/time at which the credentials expire. + expiresOn time.Time +} + +// NewEC2RoleCredentials returns a pointer to a new Credentials object +// wrapping the EC2RoleProvider. +// +// Takes a custom http.Client which can be configured for custom handling of +// things such as timeout. +// +// Endpoint is the URL that the EC2RoleProvider will connect to when retrieving +// role and credentials. +// +// Window is the expiry window that will be subtracted from the expiry returned +// by the role credential request. This is done so that the credentials will +// expire sooner than their actual lifespan. +func NewEC2RoleCredentials(client *http.Client, endpoint string, window time.Duration) *Credentials { + return NewCredentials(&EC2RoleProvider{ + Endpoint: endpoint, + Client: client, + ExpiryWindow: window, + }) +} + +// Retrieve retrieves credentials from the EC2 service. +// Error will be returned if the request fails, or unable to extract +// the desired credentials. +func (m *EC2RoleProvider) Retrieve() (Value, error) { + if m.Client == nil { + m.Client = http.DefaultClient + } + if m.Endpoint == "" { + m.Endpoint = metadataCredentialsEndpoint + } + + credsList, err := requestCredList(m.Client, m.Endpoint) + if err != nil { + return Value{}, err + } + + if len(credsList) == 0 { + return Value{}, fmt.Errorf("empty MetadataService credentials list") + } + credsName := credsList[0] + + roleCreds, err := requestCred(m.Client, m.Endpoint, credsName) + if err != nil { + return Value{}, err + } + + m.expiresOn = roleCreds.Expiration + if m.ExpiryWindow > 0 { + // Offset based on expiry window if set. + m.expiresOn = m.expiresOn.Add(-m.ExpiryWindow) + } + + return Value{ + AccessKeyID: roleCreds.AccessKeyID, + SecretAccessKey: roleCreds.SecretAccessKey, + SessionToken: roleCreds.Token, + }, nil +} + +// IsExpired returns if the credentials are expired. +func (m *EC2RoleProvider) IsExpired() bool { + return m.expiresOn.Before(currentTime()) +} + +// A ec2RoleCredRespBody provides the shape for deserializing credential +// request responses. +type ec2RoleCredRespBody struct { + Expiration time.Time + AccessKeyID string + SecretAccessKey string + Token string +} + +// requestCredList requests a list of credentials from the EC2 service. +// If there are no credentials, or there is an error making or receiving the request +func requestCredList(client *http.Client, endpoint string) ([]string, error) { + resp, err := client.Get(endpoint) + if err != nil { + return nil, fmt.Errorf("%s listing MetadataService credentials", err) + } + defer resp.Body.Close() + + credsList := []string{} + s := bufio.NewScanner(resp.Body) + for s.Scan() { + credsList = append(credsList, s.Text()) + } + + if err := s.Err(); err != nil { + return nil, fmt.Errorf("%s reading list of MetadataService credentials", err) + } + + return credsList, nil +} + +// requestCred requests the credentials for a specific credentials from the EC2 service. +// +// If the credentials cannot be found, or there is an error reading the response +// and error will be returned. +func requestCred(client *http.Client, endpoint, credsName string) (*ec2RoleCredRespBody, error) { + resp, err := client.Get(endpoint + credsName) + if err != nil { + return nil, fmt.Errorf("getting %s MetadataService credentials", credsName) + } + defer resp.Body.Close() + + respCreds := &ec2RoleCredRespBody{} + if err := json.NewDecoder(resp.Body).Decode(respCreds); err != nil { + return nil, fmt.Errorf("decoding %s MetadataService credentials", credsName) + } + + return respCreds, nil +} diff --git a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/credentials/ec2_role_provider_test.go b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/credentials/ec2_role_provider_test.go new file mode 100644 index 00000000000..5232a1dcafd --- /dev/null +++ b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/credentials/ec2_role_provider_test.go @@ -0,0 +1,114 @@ +package credentials + +import ( + "fmt" + "github.com/stretchr/testify/assert" + "net/http" + "net/http/httptest" + "testing" + "time" +) + +func initTestServer(expireOn string) *httptest.Server { + server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + if r.RequestURI == "/" { + fmt.Fprintln(w, "/creds") + } else { + fmt.Fprintf(w, `{ + "AccessKeyId" : "accessKey", + "SecretAccessKey" : "secret", + "Token" : "token", + "Expiration" : "%s" +}`, expireOn) + } + })) + + return server +} + +func TestEC2RoleProvider(t *testing.T) { + server := initTestServer("2014-12-16T01:51:37Z") + defer server.Close() + + p := &EC2RoleProvider{Client: http.DefaultClient, Endpoint: server.URL} + + creds, err := p.Retrieve() + assert.Nil(t, err, "Expect no error") + + assert.Equal(t, "accessKey", creds.AccessKeyID, "Expect access key ID to match") + assert.Equal(t, "secret", creds.SecretAccessKey, "Expect secret access key to match") + assert.Equal(t, "token", creds.SessionToken, "Expect session token to match") +} + +func TestEC2RoleProviderIsExpired(t *testing.T) { + server := initTestServer("2014-12-16T01:51:37Z") + defer server.Close() + + p := &EC2RoleProvider{Client: http.DefaultClient, Endpoint: server.URL} + defer func() { + currentTime = time.Now + }() + currentTime = func() time.Time { + return time.Date(2014, 12, 15, 21, 26, 0, 0, time.UTC) + } + + assert.True(t, p.IsExpired(), "Expect creds to be expired before retrieve.") + + _, err := p.Retrieve() + assert.Nil(t, err, "Expect no error") + + assert.False(t, p.IsExpired(), "Expect creds to not be expired after retrieve.") + + currentTime = func() time.Time { + return time.Date(3014, 12, 15, 21, 26, 0, 0, time.UTC) + } + + assert.True(t, p.IsExpired(), "Expect creds to be expired.") +} + +func TestEC2RoleProviderExpiryWindowIsExpired(t *testing.T) { + server := initTestServer("2014-12-16T01:51:37Z") + defer server.Close() + + p := &EC2RoleProvider{Client: http.DefaultClient, Endpoint: server.URL, ExpiryWindow: time.Hour * 1} + defer func() { + currentTime = time.Now + }() + currentTime = func() time.Time { + return time.Date(2014, 12, 15, 0, 51, 37, 0, time.UTC) + } + + assert.True(t, p.IsExpired(), "Expect creds to be expired before retrieve.") + + _, err := p.Retrieve() + assert.Nil(t, err, "Expect no error") + + assert.False(t, p.IsExpired(), "Expect creds to not be expired after retrieve.") + + currentTime = func() time.Time { + return time.Date(2014, 12, 16, 0, 55, 37, 0, time.UTC) + } + + assert.True(t, p.IsExpired(), "Expect creds to be expired.") +} + +func BenchmarkEC2RoleProvider(b *testing.B) { + server := initTestServer("2014-12-16T01:51:37Z") + defer server.Close() + + p := &EC2RoleProvider{Client: http.DefaultClient, Endpoint: server.URL} + _, err := p.Retrieve() + if err != nil { + b.Fatal(err) + } + + b.ResetTimer() + b.RunParallel(func(pb *testing.PB) { + for pb.Next() { + _, err := p.Retrieve() + if err != nil { + b.Fatal(err) + } + } + }) +} diff --git a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/credentials/env_provider.go b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/credentials/env_provider.go new file mode 100644 index 00000000000..0b4e81160d7 --- /dev/null +++ b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/credentials/env_provider.go @@ -0,0 +1,66 @@ +package credentials + +import ( + "fmt" + "os" +) + +var ( + // ErrAccessKeyIDNotFound is returned when the AWS Access Key ID can't be + // found in the process's environment. + ErrAccessKeyIDNotFound = fmt.Errorf("AWS_ACCESS_KEY_ID or AWS_ACCESS_KEY not found in environment") + // ErrSecretAccessKeyNotFound is returned when the AWS Secret Access Key + // can't be found in the process's environment. + ErrSecretAccessKeyNotFound = fmt.Errorf("AWS_SECRET_ACCESS_KEY or AWS_SECRET_KEY not found in environment") +) + +// A EnvProvider retrieves credentials from the environment variables of the +// running process. Environment credentials never expire. +// +// Environment variables used: +// - Access Key ID: AWS_ACCESS_KEY_ID or AWS_ACCESS_KEY +// - Secret Access Key: AWS_SECRET_ACCESS_KEY or AWS_SECRET_KEY +type EnvProvider struct { + retrieved bool +} + +// NewEnvCredentials returns a pointer to a new Credentials object +// wrapping the environment variable provider. +func NewEnvCredentials() *Credentials { + return NewCredentials(&EnvProvider{}) +} + +// Retrieve retrieves the keys from the environment. +func (e *EnvProvider) Retrieve() (Value, error) { + e.retrieved = false + + id := os.Getenv("AWS_ACCESS_KEY_ID") + if id == "" { + id = os.Getenv("AWS_ACCESS_KEY") + } + + secret := os.Getenv("AWS_SECRET_ACCESS_KEY") + if secret == "" { + secret = os.Getenv("AWS_SECRET_KEY") + } + + if id == "" { + return Value{}, ErrAccessKeyIDNotFound + } + + if secret == "" { + return Value{}, ErrSecretAccessKeyNotFound + } + + e.retrieved = true + return Value{ + AccessKeyID: id, + SecretAccessKey: secret, + SessionToken: os.Getenv("AWS_SESSION_TOKEN"), + }, nil +} + +// IsExpired returns if the credentials have been retrieved. +func (e *EnvProvider) IsExpired() bool { + return !e.retrieved +} diff --git a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/credentials/env_provider_test.go b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/credentials/env_provider_test.go new file mode 100644 index 00000000000..32317faef6d --- /dev/null +++ b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/credentials/env_provider_test.go @@ -0,0 +1,70 @@ +package credentials + +import ( + "github.com/stretchr/testify/assert" + "os" + "testing" +) + +func TestEnvProviderRetrieve(t *testing.T) { + os.Clearenv() + os.Setenv("AWS_ACCESS_KEY_ID", "access") + os.Setenv("AWS_SECRET_ACCESS_KEY", "secret") + os.Setenv("AWS_SESSION_TOKEN", "token") + + e := EnvProvider{} + creds, err := e.Retrieve() + assert.Nil(t, err, "Expect no error", err) + + assert.Equal(t, "access", creds.AccessKeyID, "Expect access key ID to match") + assert.Equal(t, "secret", creds.SecretAccessKey, "Expect secret access key to match") + assert.Equal(t, "token", creds.SessionToken, "Expect session token to match") +} + +func TestEnvProviderIsExpired(t *testing.T) { + os.Clearenv() + os.Setenv("AWS_ACCESS_KEY_ID", "access") + os.Setenv("AWS_SECRET_ACCESS_KEY", "secret") + os.Setenv("AWS_SESSION_TOKEN", "token") + + e := EnvProvider{} + + assert.True(t, e.IsExpired(), "Expect creds to be expired before retrieve.") + + _, err := e.Retrieve() + assert.Nil(t, err, "Expect no error", err) + + assert.False(t, e.IsExpired(), "Expect creds to not be expired after retrieve.") +} + +func TestEnvProviderNoAccessKeyID(t *testing.T) { + os.Clearenv() + os.Setenv("AWS_SECRET_ACCESS_KEY", "secret") + + e := EnvProvider{} + creds, err := e.Retrieve() + assert.Equal(t, ErrAccessKeyIDNotFound, err, "ErrAccessKeyIDNotFound expected, but was %#v error: %#v", creds, err) +} + +func TestEnvProviderNoSecretAccessKey(t *testing.T) { + os.Clearenv() + os.Setenv("AWS_ACCESS_KEY_ID", "access") + + e := EnvProvider{} + creds, err := e.Retrieve() + assert.Equal(t, ErrSecretAccessKeyNotFound, err, "ErrSecretAccessKeyNotFound expected, but was %#v error: %#v", creds, err) +} + +func TestEnvProviderAlternateNames(t *testing.T) { + os.Clearenv() + os.Setenv("AWS_ACCESS_KEY", "access") + os.Setenv("AWS_SECRET_KEY", "secret") + + e := EnvProvider{} + creds, err := e.Retrieve() + assert.Nil(t, err, "Expect no error") + + assert.Equal(t, "access", creds.AccessKeyID, "Expected access key ID") + assert.Equal(t, "secret", creds.SecretAccessKey, "Expected secret access key") + assert.Empty(t, creds.SessionToken, "Expected no token") +} diff --git a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/credentials/example.ini b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/credentials/example.ini new file mode 100644 index 00000000000..aa2dc506ad0 --- /dev/null +++ b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/credentials/example.ini @@ -0,0 +1,8 @@ +[default] +aws_access_key_id = accessKey +aws_secret_access_key = secret +aws_session_token = token + +[no_token] +aws_access_key_id = accessKey +aws_secret_access_key = secret diff --git a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/credentials/shared_credentials_provider.go b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/credentials/shared_credentials_provider.go new file mode 100644 index 00000000000..e6867947e25 --- /dev/null +++ b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/credentials/shared_credentials_provider.go @@ -0,0 +1,127 @@ +package credentials + +import ( + "fmt" + "os" + "path/filepath" + + "github.com/vaughan0/go-ini" +) + +var ( + // ErrSharedCredentialsHomeNotFound is emitted when the user directory cannot be found. + ErrSharedCredentialsHomeNotFound = fmt.Errorf("User home directory not found.") +) + +// A SharedCredentialsProvider retrieves credentials from the current user's home +// directory, and keeps track if those credentials are expired. +// +// Profile ini file example: $HOME/.aws/credentials +type SharedCredentialsProvider struct { + // Path to the shared credentials file. If empty will default to current user's + // home directory. + Filename string + + // AWS Profile to extract credentials from the shared credentials file. If empty + // will default to environment variable "AWS_PROFILE" or "default" if + // environment variable is also not set. + Profile string + + // retrieved states if the credentials have been successfully retrieved. + retrieved bool +} + +// NewSharedCredentials returns a pointer to a new Credentials object +// wrapping the Profile file provider. +func NewSharedCredentials(filename, profile string) *Credentials { + return NewCredentials(&SharedCredentialsProvider{ + Filename: filename, + Profile: profile, + }) +} + +// Retrieve reads and extracts the shared credentials from the current +// users home directory. +func (p *SharedCredentialsProvider) Retrieve() (Value, error) { + p.retrieved = false + + filename, err := p.filename() + if err != nil { + return Value{}, err + } + + creds, err := loadProfile(filename, p.profile()) + if err != nil { + return Value{}, err + } + + p.retrieved = true + return creds, nil +} + +// IsExpired returns if the shared credentials have expired. +func (p *SharedCredentialsProvider) IsExpired() bool { + return !p.retrieved +} + +// loadProfiles loads from the file pointed to by shared credentials filename for profile. +// The credentials retrieved from the profile will be returned or error. Error will be +// returned if it fails to read from the file, or the data is invalid. +func loadProfile(filename, profile string) (Value, error) { + config, err := ini.LoadFile(filename) + if err != nil { + return Value{}, err + } + iniProfile := config.Section(profile) + + id, ok := iniProfile["aws_access_key_id"] + if !ok { + return Value{}, fmt.Errorf("shared credentials %s in %s did not contain aws_access_key_id", profile, filename) + } + + secret, ok := iniProfile["aws_secret_access_key"] + if !ok { + return Value{}, fmt.Errorf("shared credentials %s in %s did not contain aws_secret_access_key", profile, filename) + } + + token := iniProfile["aws_session_token"] + + return Value{ + AccessKeyID: id, + SecretAccessKey: secret, + SessionToken: token, + }, nil +} + +// filename returns the filename to use to read AWS shared credentials. +// +// Will return an error if the user's home directory path cannot be found. +func (p *SharedCredentialsProvider) filename() (string, error) { + if p.Filename == "" { + homeDir := os.Getenv("HOME") // *nix + if homeDir == "" { // Windows + homeDir = os.Getenv("USERPROFILE") + } + if homeDir == "" { + return "", ErrSharedCredentialsHomeNotFound + } + + p.Filename = filepath.Join(homeDir, ".aws", "credentials") + } + + return p.Filename, nil +} + +// profile returns the AWS shared credentials profile. If empty will read +// environment variable "AWS_PROFILE". If that is not set profile will +// return "default". +func (p *SharedCredentialsProvider) profile() string { + if p.Profile == "" { + p.Profile = os.Getenv("AWS_PROFILE") + } + if p.Profile == "" { + p.Profile = "default" + } + + return p.Profile +} diff --git a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/credentials/shared_credentials_provider_test.go b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/credentials/shared_credentials_provider_test.go new file mode 100644 index 00000000000..3621d56eddc --- /dev/null +++ b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/credentials/shared_credentials_provider_test.go @@ -0,0 +1,77 @@ +package credentials + +import ( + "github.com/stretchr/testify/assert" + "os" + "testing" +) + +func TestSharedCredentialsProvider(t *testing.T) { + os.Clearenv() + + p := SharedCredentialsProvider{Filename: "example.ini", Profile: ""} + creds, err := p.Retrieve() + assert.Nil(t, err, "Expect no error") + + assert.Equal(t, "accessKey", creds.AccessKeyID, "Expect access key ID to match") + assert.Equal(t, "secret", creds.SecretAccessKey, "Expect secret access key to match") + assert.Equal(t, "token", creds.SessionToken, "Expect session token to match") +} + +func TestSharedCredentialsProviderIsExpired(t *testing.T) { + os.Clearenv() + + p := SharedCredentialsProvider{Filename: "example.ini", Profile: ""} + + assert.True(t, p.IsExpired(), "Expect creds to be expired before retrieve") + + _, err := p.Retrieve() + assert.Nil(t, err, "Expect no error") + + assert.False(t, p.IsExpired(), "Expect creds to not be expired after retrieve") +} + +func TestSharedCredentialsProviderWithAWS_PROFILE(t *testing.T) { + os.Clearenv() + os.Setenv("AWS_PROFILE", "no_token") + + p := SharedCredentialsProvider{Filename: "example.ini", Profile: ""} + creds, err := p.Retrieve() + assert.Nil(t, err, "Expect no error") + + assert.Equal(t, "accessKey", creds.AccessKeyID, "Expect access key ID to match") + assert.Equal(t, "secret", creds.SecretAccessKey, "Expect secret access key to match") + assert.Empty(t, creds.SessionToken, "Expect no token") +} + +func TestSharedCredentialsProviderWithoutTokenFromProfile(t *testing.T) { + os.Clearenv() + + p := SharedCredentialsProvider{Filename: "example.ini", Profile: "no_token"} + creds, err := p.Retrieve() + assert.Nil(t, err, "Expect no error") + + assert.Equal(t, "accessKey", creds.AccessKeyID, "Expect access key ID to match") + assert.Equal(t, "secret", creds.SecretAccessKey, "Expect secret access key to match") + assert.Empty(t, creds.SessionToken, "Expect no token") +} + +func BenchmarkSharedCredentialsProvider(b *testing.B) { + os.Clearenv() + + p := SharedCredentialsProvider{Filename: "example.ini", Profile: ""} + _, err := p.Retrieve() + if err != nil { + b.Fatal(err) + } + + b.ResetTimer() + b.RunParallel(func(pb *testing.PB) { + for pb.Next() { + _, err := p.Retrieve() + if err != nil { + b.Fatal(err) + } + } + }) +} diff --git a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/credentials/static_provider.go b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/credentials/static_provider.go new file mode 100644 index 00000000000..5ea6cc12a91 --- /dev/null +++ b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/credentials/static_provider.go @@ -0,0 +1,42 @@ +package credentials + +import ( + "fmt" +) + +var ( + // ErrStaticCredentialsEmpty is emitted when static credentials are empty. + ErrStaticCredentialsEmpty = fmt.Errorf("static credentials are empty") +) + +// A StaticProvider is a set of credentials which are set pragmatically, +// and will never expire. +type StaticProvider struct { + Value +} + +// NewStaticCredentials returns a pointer to a new Credentials object +// wrapping a static credentials value provider. +func NewStaticCredentials(id, secret, token string) *Credentials { + return NewCredentials(&StaticProvider{Value: Value{ + AccessKeyID: id, + SecretAccessKey: secret, + SessionToken: token, + }}) +} + +// 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 s.Value, nil +} + +// IsExpired returns if the credentials are expired. +// +// For StaticProvider, the credentials never expired. +func (s *StaticProvider) IsExpired() bool { + return false +} diff --git a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/credentials/static_provider_test.go b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/credentials/static_provider_test.go new file mode 100644 index 00000000000..ea012369624 --- /dev/null +++ b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/credentials/static_provider_test.go @@ -0,0 +1,34 @@ +package credentials + +import ( + "github.com/stretchr/testify/assert" + "testing" +) + +func TestStaticProviderGet(t *testing.T) { + s := StaticProvider{ + Value: Value{ + AccessKeyID: "AKID", + SecretAccessKey: "SECRET", + SessionToken: "", + }, + } + + creds, err := s.Retrieve() + assert.Nil(t, err, "Expect no error") + assert.Equal(t, "AKID", creds.AccessKeyID, "Expect access key ID to match") + assert.Equal(t, "SECRET", creds.SecretAccessKey, "Expect secret access key to match") + assert.Empty(t, creds.SessionToken, "Expect no session token") +} + +func TestStaticProviderIsExpired(t *testing.T) { + s := StaticProvider{ + Value: Value{ + AccessKeyID: "AKID", + SecretAccessKey: "SECRET", + SessionToken: "", + }, + } + + assert.False(t, s.IsExpired(), "Expect static credentials to never expire") +} diff --git a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/error.go b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/error.go new file mode 100644 index 00000000000..c3921dcf482 --- /dev/null +++ b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/error.go @@ -0,0 +1,26 @@ +package aws + +// An APIError is an error returned by an AWS API. +type APIError struct { + StatusCode int // HTTP status code e.g. 200 + Code string + Message string + RequestID string +} + +// Error returns the error as a string. Satisfies error interface. +func (e APIError) Error() string { + return e.Code + ": " + e.Message +} + +// Error returns an APIError pointer if the error e is an APIError type. +// If the error is not an APIError nil will be returned. +func Error(e error) *APIError { + if err, ok := e.(*APIError); ok { + return err + } else if err, ok := e.(APIError); ok { + return &err + } else { + return nil + } +} diff --git a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/handler_functions.go b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/handler_functions.go new file mode 100644 index 00000000000..64d50643b5c --- /dev/null +++ b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/handler_functions.go @@ -0,0 +1,136 @@ +package aws + +import ( + "bytes" + "fmt" + "io" + "io/ioutil" + "net/http" + "net/url" + "regexp" + "strconv" + "time" +) + +var sleepDelay = func(delay time.Duration) { + time.Sleep(delay) +} + +// Interface for matching types which also have a Len method. +type lener interface { + Len() int +} + +// BuildContentLength builds the content length of a request based on the body, +// or will use the HTTPRequest.Header's "Content-Length" if defined. If unable +// to determine request body length and no "Content-Length" was specified it will panic. +func BuildContentLength(r *Request) { + if slength := r.HTTPRequest.Header.Get("Content-Length"); slength != "" { + length, _ := strconv.ParseInt(slength, 10, 64) + r.HTTPRequest.ContentLength = length + return + } + + var length int64 + switch body := r.Body.(type) { + case nil: + length = 0 + case lener: + length = int64(body.Len()) + case io.Seeker: + r.bodyStart, _ = body.Seek(0, 1) + end, _ := body.Seek(0, 2) + body.Seek(r.bodyStart, 0) // make sure to seek back to original location + length = end - r.bodyStart + default: + panic("Cannot get length of body, must provide `ContentLength`") + } + + r.HTTPRequest.ContentLength = length + r.HTTPRequest.Header.Set("Content-Length", fmt.Sprintf("%d", length)) +} + +// UserAgentHandler is a request handler for injecting User agent into requests. +func UserAgentHandler(r *Request) { + r.HTTPRequest.Header.Set("User-Agent", SDKName+"/"+SDKVersion) +} + +var reStatusCode = regexp.MustCompile(`^(\d+)`) + +// SendHandler is a request handler to send service request using HTTP client. +func SendHandler(r *Request) { + r.HTTPResponse, r.Error = r.Service.Config.HTTPClient.Do(r.HTTPRequest) + if r.Error != nil { + if e, ok := r.Error.(*url.Error); ok { + if s := reStatusCode.FindStringSubmatch(e.Err.Error()); s != nil { + code, _ := strconv.ParseInt(s[1], 10, 64) + r.Error = nil + r.HTTPResponse = &http.Response{ + StatusCode: int(code), + Status: http.StatusText(int(code)), + Body: ioutil.NopCloser(bytes.NewReader([]byte{})), + } + } + } + } +} + +// ValidateResponseHandler is a request handler to validate service response. +func ValidateResponseHandler(r *Request) { + if r.HTTPResponse.StatusCode == 0 || r.HTTPResponse.StatusCode >= 300 { + // this may be replaced by an UnmarshalError handler + r.Error = &APIError{ + StatusCode: r.HTTPResponse.StatusCode, + Code: "UnknownError", + Message: "unknown error", + } + } +} + +// AfterRetryHandler performs final checks to determine if the request should +// be retried and how long to delay. +func AfterRetryHandler(r *Request) { + // If one of the other handlers already set the retry state + // we don't want to override it based on the service's state + if !r.Retryable.IsSet() { + r.Retryable.Set(r.Service.ShouldRetry(r)) + } + + if r.WillRetry() { + r.RetryDelay = r.Service.RetryRules(r) + sleepDelay(r.RetryDelay) + + // when the expired token exception occurs the credentials + // need to be expired locally so that the next request to + // get credentials will trigger a credentials refresh. + if err := Error(r.Error); err != nil && err.Code == "ExpiredTokenException" { + r.Config.Credentials.Expire() + // The credentials will need to be resigned with new credentials + r.signed = false + } + + r.RetryCount++ + r.Error = nil + } +} + +var ( + // ErrMissingRegion is an error that is returned if region configuration is + // not found. + ErrMissingRegion = fmt.Errorf("could not find region configuration") + + // ErrMissingEndpoint is an error that is returned if an endpoint cannot be + // resolved for a service. + ErrMissingEndpoint = fmt.Errorf("`Endpoint' configuration is required for this service") +) + +// ValidateEndpointHandler is a request handler to validate a request had the +// appropriate Region and Endpoint set. Will set r.Error if the endpoint or +// region is not valid. +func ValidateEndpointHandler(r *Request) { + if r.Service.SigningRegion == "" && r.Service.Config.Region == "" { + r.Error = ErrMissingRegion + } else if r.Service.Endpoint == "" { + r.Error = ErrMissingEndpoint + } +} diff --git a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/handler_functions_test.go b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/handler_functions_test.go new file mode 100644 index 00000000000..b8a6d4b2342 --- /dev/null +++ b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/handler_functions_test.go @@ -0,0 +1,80 @@ +package aws + +import ( + "net/http" + "os" + "testing" + + "github.com/awslabs/aws-sdk-go/aws/credentials" + "github.com/stretchr/testify/assert" +) + +func TestValidateEndpointHandler(t *testing.T) { + os.Clearenv() + svc := NewService(&Config{Region: "us-west-2"}) + svc.Handlers.Clear() + svc.Handlers.Validate.PushBack(ValidateEndpointHandler) + + req := NewRequest(svc, &Operation{Name: "Operation"}, nil, nil) + err := req.Build() + + assert.NoError(t, err) +} + +func TestValidateEndpointHandlerErrorRegion(t *testing.T) { + os.Clearenv() + svc := NewService(nil) + svc.Handlers.Clear() + svc.Handlers.Validate.PushBack(ValidateEndpointHandler) + + req := NewRequest(svc, &Operation{Name: "Operation"}, nil, nil) + err := req.Build() + + assert.Error(t, err) + assert.Equal(t, ErrMissingRegion, err) +} + +type mockCredsProvider struct { + expired bool + retreiveCalled bool +} + +func (m *mockCredsProvider) Retrieve() (credentials.Value, error) { + m.retreiveCalled = true + return credentials.Value{}, nil +} + +func (m *mockCredsProvider) IsExpired() bool { + return m.expired +} + +func TestAfterRetryRefreshCreds(t *testing.T) { + os.Clearenv() + credProvider := &mockCredsProvider{} + svc := NewService(&Config{Credentials: credentials.NewCredentials(credProvider), MaxRetries: 1}) + + svc.Handlers.Clear() + svc.Handlers.ValidateResponse.PushBack(func(r *Request) { + r.Error = &APIError{Code: "UnknownError"} + r.HTTPResponse = &http.Response{StatusCode: 400} + }) + svc.Handlers.UnmarshalError.PushBack(func(r *Request) { + r.Error = &APIError{Code: "ExpiredTokenException"} + }) + svc.Handlers.AfterRetry.PushBack(func(r *Request) { + AfterRetryHandler(r) + }) + + assert.True(t, svc.Config.Credentials.IsExpired(), "Expect to start out expired") + assert.False(t, credProvider.retreiveCalled) + + req := NewRequest(svc, &Operation{Name: "Operation"}, nil, nil) + req.Send() + + assert.True(t, svc.Config.Credentials.IsExpired()) + assert.False(t, credProvider.retreiveCalled) + + _, err := svc.Config.Credentials.Get() + assert.NoError(t, err) + assert.True(t, credProvider.retreiveCalled) +} diff --git a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/handlers.go b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/handlers.go new file mode 100644 index 00000000000..1968cb9f8b1 --- /dev/null +++ b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/handlers.go @@ -0,0 +1,85 @@ +package aws + +// A Handlers provides a collection of request handlers for various +// stages of handling requests. +type Handlers struct { + Validate HandlerList + Build HandlerList + Sign HandlerList + Send HandlerList + ValidateResponse HandlerList + Unmarshal HandlerList + UnmarshalMeta HandlerList + UnmarshalError HandlerList + Retry HandlerList + AfterRetry HandlerList +} + +// copy returns of this handler's lists. +func (h *Handlers) copy() Handlers { + return Handlers{ + Validate: h.Validate.copy(), + Build: h.Build.copy(), + Sign: h.Sign.copy(), + Send: h.Send.copy(), + ValidateResponse: h.ValidateResponse.copy(), + Unmarshal: h.Unmarshal.copy(), + UnmarshalError: h.UnmarshalError.copy(), + UnmarshalMeta: h.UnmarshalMeta.copy(), + Retry: h.Retry.copy(), + AfterRetry: h.AfterRetry.copy(), + } +} + +// Clear removes callback functions for all handlers +func (h *Handlers) Clear() { + h.Validate.Clear() + h.Build.Clear() + h.Send.Clear() + h.Sign.Clear() + h.Unmarshal.Clear() + h.UnmarshalMeta.Clear() + h.UnmarshalError.Clear() + h.ValidateResponse.Clear() + h.Retry.Clear() + h.AfterRetry.Clear() +} + +// A HandlerList manages zero or more handlers in a list. +type HandlerList struct { + list []func(*Request) +} + +// copy creates a copy of the handler list. +func (l *HandlerList) copy() HandlerList { + var n HandlerList + n.list = append([]func(*Request){}, l.list...) + return n +} + +// Clear clears the handler list. +func (l *HandlerList) Clear() { + l.list = []func(*Request){} +} + +// Len returns the number of handlers in the list. +func (l *HandlerList) Len() int { + return len(l.list) +} + +// PushBack pushes handlers f to the back of the handler list. +func (l *HandlerList) PushBack(f ...func(*Request)) { + l.list = append(l.list, f...) +} + +// PushFront pushes handlers f to the front of the handler list. +func (l *HandlerList) PushFront(f ...func(*Request)) { + l.list = append(f, l.list...) +} + +// Run executes all handlers in the list with a given request object. +func (l *HandlerList) Run(r *Request) { + for _, f := range l.list { + f(r) + } +} diff --git a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/handlers_test.go b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/handlers_test.go new file mode 100644 index 00000000000..26776f6da6c --- /dev/null +++ b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/handlers_test.go @@ -0,0 +1,31 @@ +package aws + +import ( + "testing" + + "github.com/stretchr/testify/assert" +) + +func TestHandlerList(t *testing.T) { + s := "" + r := &Request{} + l := HandlerList{} + l.PushBack(func(r *Request) { + s += "a" + r.Data = s + }) + l.Run(r) + assert.Equal(t, "a", s) + assert.Equal(t, "a", r.Data) +} + +func TestMultipleHandlers(t *testing.T) { + r := &Request{} + l := HandlerList{} + l.PushBack(func(r *Request) { r.Data = nil }) + l.PushFront(func(r *Request) { r.Data = Boolean(true) }) + l.Run(r) + if r.Data != nil { + t.Error("Expected handler to execute") + } +} diff --git a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/param_validator.go b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/param_validator.go new file mode 100644 index 00000000000..00efc8add23 --- /dev/null +++ b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/param_validator.go @@ -0,0 +1,87 @@ +package aws + +import ( + "fmt" + "reflect" + "strings" +) + +// ValidateParameters is a request handler to validate the input parameters. +// Validating parameters only has meaning if done prior to the request being sent. +func ValidateParameters(r *Request) { + if r.ParamsFilled() { + v := validator{errors: []string{}} + v.validateAny(reflect.ValueOf(r.Params), "") + + if count := len(v.errors); count > 0 { + format := "%d validation errors:\n- %s" + msg := fmt.Sprintf(format, count, strings.Join(v.errors, "\n- ")) + r.Error = APIError{Code: "InvalidParameter", Message: msg} + } + } +} + +// A validator validates values. Collects validations errors which occurs. +type validator struct { + errors []string +} + +// 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) { + value = reflect.Indirect(value) + if !value.IsValid() { + return + } + + switch value.Kind() { + case reflect.Struct: + v.validateStruct(value, path) + case reflect.Slice: + for i := 0; i < value.Len(); i++ { + v.validateAny(value.Index(i), path+fmt.Sprintf("[%d]", i)) + } + case reflect.Map: + for _, n := range value.MapKeys() { + v.validateAny(value.MapIndex(n), path+fmt.Sprintf("[%q]", n.String())) + } + } +} + +// validateStruct will validate the struct value's fields. If the structure has +// nested types those types will be validated also. +func (v *validator) validateStruct(value reflect.Value, path string) { + prefix := "." + if path == "" { + prefix = "" + } + + for i := 0; i < value.Type().NumField(); i++ { + f := value.Type().Field(i) + if strings.ToLower(f.Name[0:1]) == f.Name[0:1] { + continue + } + fvalue := value.FieldByName(f.Name) + + notset := false + if f.Tag.Get("required") != "" { + switch fvalue.Kind() { + case reflect.Ptr, reflect.Slice: + if fvalue.IsNil() { + notset = true + } + default: + if !fvalue.IsValid() { + notset = true + } + } + } + + if notset { + msg := "missing required parameter: " + path + prefix + f.Name + v.errors = append(v.errors, msg) + } else { + v.validateAny(fvalue, path+prefix+f.Name) + } + } +} diff --git a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/param_validator_test.go b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/param_validator_test.go new file mode 100644 index 00000000000..08deca15a18 --- /dev/null +++ b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/param_validator_test.go @@ -0,0 +1,85 @@ +package aws_test + +import ( + "testing" + + "github.com/awslabs/aws-sdk-go/aws" + "github.com/stretchr/testify/assert" +) + +var service = func() *aws.Service { + s := &aws.Service{ + Config: &aws.Config{}, + ServiceName: "mock-service", + APIVersion: "2015-01-01", + } + return s +}() + +type StructShape struct { + RequiredList []*ConditionalStructShape `required:"true"` + RequiredMap *map[string]*ConditionalStructShape `required:"true"` + RequiredBool *bool `required:"true"` + OptionalStruct *ConditionalStructShape + + hiddenParameter *string + + metadataStructureShape +} + +type metadataStructureShape struct { + SDKShapeTraits bool +} + +type ConditionalStructShape struct { + Name *string `required:"true"` + SDKShapeTraits bool +} + +func TestNoErrors(t *testing.T) { + input := &StructShape{ + RequiredList: []*ConditionalStructShape{}, + RequiredMap: &map[string]*ConditionalStructShape{ + "key1": &ConditionalStructShape{Name: aws.String("Name")}, + "key2": &ConditionalStructShape{Name: aws.String("Name")}, + }, + RequiredBool: aws.Boolean(true), + OptionalStruct: &ConditionalStructShape{Name: aws.String("Name")}, + } + + req := aws.NewRequest(service, &aws.Operation{}, input, nil) + aws.ValidateParameters(req) + assert.NoError(t, req.Error) +} + +func TestMissingRequiredParameters(t *testing.T) { + input := &StructShape{} + req := aws.NewRequest(service, &aws.Operation{}, input, nil) + aws.ValidateParameters(req) + err := aws.Error(req.Error) + + assert.Error(t, err) + assert.Equal(t, "InvalidParameter", err.Code) + assert.Equal(t, "3 validation errors:\n- missing required parameter: RequiredList\n- missing required parameter: RequiredMap\n- missing required parameter: RequiredBool", err.Message) +} + +func TestNestedMissingRequiredParameters(t *testing.T) { + input := &StructShape{ + RequiredList: []*ConditionalStructShape{&ConditionalStructShape{}}, + RequiredMap: &map[string]*ConditionalStructShape{ + "key1": &ConditionalStructShape{Name: aws.String("Name")}, + "key2": &ConditionalStructShape{}, + }, + RequiredBool: aws.Boolean(true), + OptionalStruct: &ConditionalStructShape{}, + } + + req := aws.NewRequest(service, &aws.Operation{}, input, nil) + aws.ValidateParameters(req) + err := aws.Error(req.Error) + + assert.Error(t, err) + assert.Equal(t, "InvalidParameter", err.Code) + assert.Equal(t, "3 validation errors:\n- missing required parameter: RequiredList[0].Name\n- missing required parameter: RequiredMap[\"key2\"].Name\n- missing required parameter: OptionalStruct.Name", err.Message) + +} diff --git a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/request.go b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/request.go new file mode 100644 index 00000000000..95e944d76f7 --- /dev/null +++ b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/request.go @@ -0,0 +1,219 @@ +package aws + +import ( + "bytes" + "io" + "io/ioutil" + "net/http" + "net/url" + "reflect" + "strings" + "time" +) + +// A Request is the service request to be made. +type Request struct { + *Service + Handlers Handlers + 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 uint + Retryable SettableBool + RetryDelay time.Duration + + built bool + signed bool +} + +// An Operation is the service API operation to be made. +type Operation struct { + Name string + HTTPMethod string + HTTPPath string +} + +// NewRequest returns a new Request pointer for the service API +// operation and parameters. +// +// Params is any value of input parameters to be the request payload. +// Data is pointer value to an object which the request's response +// payload will be deserialized to. +func NewRequest(service *Service, operation *Operation, params interface{}, data interface{}) *Request { + method := operation.HTTPMethod + if method == "" { + method = "POST" + } + p := operation.HTTPPath + if p == "" { + p = "/" + } + + httpReq, _ := http.NewRequest(method, "", nil) + httpReq.URL, _ = url.Parse(service.Endpoint + p) + + r := &Request{ + Service: service, + Handlers: service.Handlers.copy(), + Time: time.Now(), + ExpireTime: 0, + Operation: operation, + HTTPRequest: httpReq, + Body: nil, + Params: params, + Error: nil, + Data: data, + } + r.SetBufferBody([]byte{}) + + return r +} + +// WillRetry returns if the request's can be retried. +func (r *Request) WillRetry() bool { + return r.Error != nil && r.Retryable.Get() && r.RetryCount < r.Service.MaxRetries() +} + +// ParamsFilled returns if the request's parameters have been populated +// and the parameters are valid. False is returned if no parameters are +// provided or invalid. +func (r *Request) ParamsFilled() bool { + return r.Params != nil && reflect.ValueOf(r.Params).Elem().IsValid() +} + +// DataFilled returns true if the request's data for response deserialization +// target has been set and is a valid. False is returned if data is not +// set, or is invalid. +func (r *Request) DataFilled() bool { + return r.Data != nil && reflect.ValueOf(r.Data).Elem().IsValid() +} + +// SetBufferBody will set the request's body bytes that will be sent to +// the service API. +func (r *Request) SetBufferBody(buf []byte) { + r.SetReaderBody(bytes.NewReader(buf)) +} + +// SetStringBody sets the body of the request to be backed by a string. +func (r *Request) SetStringBody(s string) { + r.SetReaderBody(strings.NewReader(s)) +} + +// SetReaderBody will set the request's body reader. +func (r *Request) SetReaderBody(reader io.ReadSeeker) { + r.HTTPRequest.Body = ioutil.NopCloser(reader) + r.Body = reader +} + +// Presign returns the request's signed URL. Error will be returned +// if the signing fails. +func (r *Request) Presign(expireTime time.Duration) (string, error) { + r.ExpireTime = expireTime + r.Sign() + if r.Error != nil { + return "", r.Error + } + return r.HTTPRequest.URL.String(), nil +} + +// Build will build the request's object so it can be signed and sent +// to the service. Build will also validate all the request's parameters. +// Anny additional build Handlers set on this request will be run +// in the order they were set. +// +// The request will only be built once. Multiple calls to build will have +// no effect. +// +// If any Validate or Build errors occur the build will stop and the error +// which occurred will be returned. +func (r *Request) Build() error { + if !r.built { + r.Error = nil + r.Handlers.Validate.Run(r) + if r.Error != nil { + return r.Error + } + r.Handlers.Build.Run(r) + r.built = true + } + + return r.Error +} + +// Sign will sign the request retuning error if errors are encountered. +// +// Send will build the request prior to signing. All Sign Handlers will +// be executed in the order they were set. +func (r *Request) Sign() error { + if r.signed { + return r.Error + } + + r.Build() + if r.Error != nil { + return r.Error + } + + r.Handlers.Sign.Run(r) + r.signed = r.Error != nil + return r.Error +} + +// Send will send the request returning error if errors are encountered. +// +// Send will sign the request prior to sending. All Send Handlers will +// be executed in the order they were set. +func (r *Request) Send() error { + for { + r.Sign() + if r.Error != nil { + return r.Error + } + + if r.Retryable.Get() { + // 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.Retryable.Reset() + + r.Handlers.Send.Run(r) + if r.Error != nil { + return r.Error + } + + r.Handlers.UnmarshalMeta.Run(r) + r.Handlers.ValidateResponse.Run(r) + if r.Error != nil { + r.Handlers.UnmarshalError.Run(r) + r.Handlers.Retry.Run(r) + r.Handlers.AfterRetry.Run(r) + if r.Error != nil { + return r.Error + } + continue + } + + r.Handlers.Unmarshal.Run(r) + if r.Error != nil { + r.Handlers.Retry.Run(r) + r.Handlers.AfterRetry.Run(r) + if r.Error != nil { + return r.Error + } + continue + } + + break + } + + return nil +} diff --git a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/request_test.go b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/request_test.go new file mode 100644 index 00000000000..bc398dabb99 --- /dev/null +++ b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/request_test.go @@ -0,0 +1,218 @@ +package aws + +import ( + "bytes" + "encoding/json" + "io" + "io/ioutil" + "net/http" + "reflect" + "testing" + "time" + + "github.com/awslabs/aws-sdk-go/aws/credentials" + "github.com/stretchr/testify/assert" +) + +type testData struct { + Data string +} + +func body(str string) io.ReadCloser { + return ioutil.NopCloser(bytes.NewReader([]byte(str))) +} + +func unmarshal(req *Request) { + defer req.HTTPResponse.Body.Close() + if req.Data != nil { + json.NewDecoder(req.HTTPResponse.Body).Decode(req.Data) + } + return +} + +func unmarshalError(req *Request) { + bodyBytes, err := ioutil.ReadAll(req.HTTPResponse.Body) + if err != nil { + req.Error = err + return + } + if len(bodyBytes) == 0 { + req.Error = APIError{ + StatusCode: req.HTTPResponse.StatusCode, + Message: req.HTTPResponse.Status, + } + return + } + var jsonErr jsonErrorResponse + if err := json.Unmarshal(bodyBytes, &jsonErr); err != nil { + req.Error = err + return + } + req.Error = APIError{ + StatusCode: req.HTTPResponse.StatusCode, + Code: jsonErr.Code, + Message: jsonErr.Message, + } +} + +type jsonErrorResponse struct { + Code string `json:"__type"` + Message string `json:"message"` +} + +// test that retries occur for 5xx status codes +func TestRequestRecoverRetry5xx(t *testing.T) { + reqNum := 0 + reqs := []http.Response{ + http.Response{StatusCode: 500, Body: body(`{"__type":"UnknownError","message":"An error occurred."}`)}, + http.Response{StatusCode: 501, Body: body(`{"__type":"UnknownError","message":"An error occurred."}`)}, + http.Response{StatusCode: 200, Body: body(`{"data":"valid"}`)}, + } + + s := NewService(&Config{MaxRetries: 10}) + s.Handlers.Validate.Clear() + s.Handlers.Unmarshal.PushBack(unmarshal) + s.Handlers.UnmarshalError.PushBack(unmarshalError) + s.Handlers.Send.Clear() // mock sending + s.Handlers.Send.PushBack(func(r *Request) { + r.HTTPResponse = &reqs[reqNum] + reqNum++ + }) + out := &testData{} + r := NewRequest(s, &Operation{Name: "Operation"}, nil, out) + err := r.Send() + assert.Nil(t, err) + assert.Equal(t, 2, int(r.RetryCount)) + assert.Equal(t, "valid", out.Data) +} + +// test that retries occur for 4xx status codes with a response type that can be retried - see `shouldRetry` +func TestRequestRecoverRetry4xxRetryable(t *testing.T) { + reqNum := 0 + reqs := []http.Response{ + http.Response{StatusCode: 400, Body: body(`{"__type":"Throttling","message":"Rate exceeded."}`)}, + http.Response{StatusCode: 429, Body: body(`{"__type":"ProvisionedThroughputExceededException","message":"Rate exceeded."}`)}, + http.Response{StatusCode: 200, Body: body(`{"data":"valid"}`)}, + } + + s := NewService(&Config{MaxRetries: 10}) + s.Handlers.Validate.Clear() + s.Handlers.Unmarshal.PushBack(unmarshal) + s.Handlers.UnmarshalError.PushBack(unmarshalError) + s.Handlers.Send.Clear() // mock sending + s.Handlers.Send.PushBack(func(r *Request) { + r.HTTPResponse = &reqs[reqNum] + reqNum++ + }) + out := &testData{} + r := NewRequest(s, &Operation{Name: "Operation"}, nil, out) + err := r.Send() + assert.Nil(t, err) + assert.Equal(t, 2, int(r.RetryCount)) + assert.Equal(t, "valid", out.Data) +} + +// test that retries don't occur for 4xx status codes with a response type that can't be retried +func TestRequest4xxUnretryable(t *testing.T) { + s := NewService(&Config{MaxRetries: 10}) + s.Handlers.Validate.Clear() + s.Handlers.Unmarshal.PushBack(unmarshal) + s.Handlers.UnmarshalError.PushBack(unmarshalError) + s.Handlers.Send.Clear() // mock sending + s.Handlers.Send.PushBack(func(r *Request) { + r.HTTPResponse = &http.Response{StatusCode: 401, Body: body(`{"__type":"SignatureDoesNotMatch","message":"Signature does not match."}`)} + }) + out := &testData{} + r := NewRequest(s, &Operation{Name: "Operation"}, nil, out) + err := r.Send() + apiErr := Error(err) + assert.NotNil(t, err) + assert.NotNil(t, apiErr) + assert.Equal(t, 401, apiErr.StatusCode) + assert.Equal(t, "SignatureDoesNotMatch", apiErr.Code) + assert.Equal(t, "Signature does not match.", apiErr.Message) + assert.Equal(t, 0, int(r.RetryCount)) +} + +func TestRequestExhaustRetries(t *testing.T) { + delays := []time.Duration{} + sleepDelay = func(delay time.Duration) { + delays = append(delays, delay) + } + + reqNum := 0 + reqs := []http.Response{ + http.Response{StatusCode: 500, Body: body(`{"__type":"UnknownError","message":"An error occurred."}`)}, + http.Response{StatusCode: 500, Body: body(`{"__type":"UnknownError","message":"An error occurred."}`)}, + http.Response{StatusCode: 500, Body: body(`{"__type":"UnknownError","message":"An error occurred."}`)}, + http.Response{StatusCode: 500, Body: body(`{"__type":"UnknownError","message":"An error occurred."}`)}, + } + + s := NewService(&Config{MaxRetries: -1}) + s.Handlers.Validate.Clear() + s.Handlers.Unmarshal.PushBack(unmarshal) + s.Handlers.UnmarshalError.PushBack(unmarshalError) + s.Handlers.Send.Clear() // mock sending + s.Handlers.Send.PushBack(func(r *Request) { + r.HTTPResponse = &reqs[reqNum] + reqNum++ + }) + r := NewRequest(s, &Operation{Name: "Operation"}, nil, nil) + err := r.Send() + apiErr := Error(err) + assert.NotNil(t, err) + assert.NotNil(t, apiErr) + assert.Equal(t, 500, apiErr.StatusCode) + assert.Equal(t, "UnknownError", apiErr.Code) + assert.Equal(t, "An error occurred.", apiErr.Message) + assert.Equal(t, 3, int(r.RetryCount)) + assert.True(t, reflect.DeepEqual([]time.Duration{30 * time.Millisecond, 60 * time.Millisecond, 120 * time.Millisecond}, delays)) +} + +// test that the request is retried after the credentials are expired. +func TestRequestRecoverExpiredCreds(t *testing.T) { + reqNum := 0 + reqs := []http.Response{ + http.Response{StatusCode: 400, Body: body(`{"__type":"ExpiredTokenException","message":"expired token"}`)}, + http.Response{StatusCode: 200, Body: body(`{"data":"valid"}`)}, + } + + s := NewService(&Config{MaxRetries: 10, Credentials: credentials.NewStaticCredentials("AKID", "SECRET", "")}) + s.Handlers.Validate.Clear() + s.Handlers.Unmarshal.PushBack(unmarshal) + s.Handlers.UnmarshalError.PushBack(unmarshalError) + + credExpiredBeforeRetry := false + credExpiredAfterRetry := false + + s.Handlers.Retry.PushBack(func(r *Request) { + if err := Error(r.Error); err != nil && err.Code == "ExpiredTokenException" { + credExpiredBeforeRetry = r.Config.Credentials.IsExpired() + } + }) + + s.Handlers.AfterRetry.PushBack(func(r *Request) { + credExpiredAfterRetry = r.Config.Credentials.IsExpired() + }) + + s.Handlers.Sign.Clear() + s.Handlers.Sign.PushBack(func(r *Request) { + r.Config.Credentials.Get() + }) + s.Handlers.Send.Clear() // mock sending + s.Handlers.Send.PushBack(func(r *Request) { + r.HTTPResponse = &reqs[reqNum] + reqNum++ + }) + out := &testData{} + r := NewRequest(s, &Operation{Name: "Operation"}, nil, out) + err := r.Send() + assert.Nil(t, err) + + assert.False(t, credExpiredBeforeRetry, "Expect valid creds before retry check") + assert.True(t, credExpiredAfterRetry, "Expect expired creds after retry check") + assert.False(t, s.Config.Credentials.IsExpired(), "Expect valid creds after cred expired recovery") + + assert.Equal(t, 1, int(r.RetryCount)) + assert.Equal(t, "valid", out.Data) +} diff --git a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/service.go b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/service.go new file mode 100644 index 00000000000..8dfc32e8bf5 --- /dev/null +++ b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/service.go @@ -0,0 +1,154 @@ +package aws + +import ( + "fmt" + "math" + "net/http" + "net/http/httputil" + "regexp" + "time" + + "github.com/awslabs/aws-sdk-go/internal/endpoints" +) + +// A Service implements the base service request and response handling +// used by all services. +type Service struct { + Config *Config + Handlers Handlers + ManualSend bool + ServiceName string + APIVersion string + Endpoint string + SigningName string + SigningRegion string + JSONVersion string + TargetPrefix string + RetryRules func(*Request) time.Duration + ShouldRetry func(*Request) bool + DefaultMaxRetries uint +} + +var schemeRE = regexp.MustCompile("^([^:]+)://") + +// NewService will return a pointer to a new Server object initialized. +func NewService(config *Config) *Service { + svc := &Service{Config: config} + svc.Initialize() + return svc +} + +// Initialize initializes the service. +func (s *Service) Initialize() { + if s.Config == nil { + s.Config = &Config{} + } + if s.Config.HTTPClient == nil { + s.Config.HTTPClient = http.DefaultClient + } + + if s.RetryRules == nil { + s.RetryRules = retryRules + } + + if s.ShouldRetry == nil { + s.ShouldRetry = shouldRetry + } + + s.DefaultMaxRetries = 3 + s.Handlers.Validate.PushBack(ValidateEndpointHandler) + s.Handlers.Build.PushBack(UserAgentHandler) + s.Handlers.Sign.PushBack(BuildContentLength) + s.Handlers.Send.PushBack(SendHandler) + s.Handlers.AfterRetry.PushBack(AfterRetryHandler) + s.Handlers.ValidateResponse.PushBack(ValidateResponseHandler) + s.AddDebugHandlers() + s.buildEndpoint() + + if !s.Config.DisableParamValidation { + s.Handlers.Validate.PushBack(ValidateParameters) + } +} + +// buildEndpoint builds the endpoint values the service will use to make requests with. +func (s *Service) buildEndpoint() { + if s.Config.Endpoint != "" { + s.Endpoint = s.Config.Endpoint + } else { + s.Endpoint, s.SigningRegion = + endpoints.EndpointForRegion(s.ServiceName, s.Config.Region) + } + + if s.Endpoint != "" && !schemeRE.MatchString(s.Endpoint) { + scheme := "https" + if s.Config.DisableSSL { + scheme = "http" + } + s.Endpoint = scheme + "://" + s.Endpoint + } +} + +// AddDebugHandlers injects debug logging handlers into the service to log request +// debug information. +func (s *Service) AddDebugHandlers() { + out := s.Config.Logger + if s.Config.LogLevel == 0 { + return + } + + s.Handlers.Send.PushFront(func(r *Request) { + logBody := r.Config.LogHTTPBody + dumpedBody, _ := httputil.DumpRequestOut(r.HTTPRequest, logBody) + + fmt.Fprintf(out, "---[ REQUEST POST-SIGN ]-----------------------------\n") + fmt.Fprintf(out, "%s\n", string(dumpedBody)) + fmt.Fprintf(out, "-----------------------------------------------------\n") + }) + s.Handlers.Send.PushBack(func(r *Request) { + fmt.Fprintf(out, "---[ RESPONSE ]--------------------------------------\n") + if r.HTTPResponse != nil { + logBody := r.Config.LogHTTPBody + dumpedBody, _ := httputil.DumpResponse(r.HTTPResponse, logBody) + fmt.Fprintf(out, "%s\n", string(dumpedBody)) + } else if r.Error != nil { + fmt.Fprintf(out, "%s\n", r.Error) + } + fmt.Fprintf(out, "-----------------------------------------------------\n") + }) +} + +// MaxRetries returns the number of maximum returns the service will use to make +// an individual API request. +func (s *Service) MaxRetries() uint { + if s.Config.MaxRetries < 0 { + return s.DefaultMaxRetries + } + return uint(s.Config.MaxRetries) +} + +// retryRules returns the delay duration before retrying this request again +func retryRules(r *Request) time.Duration { + delay := time.Duration(math.Pow(2, float64(r.RetryCount))) * 30 + return delay * time.Millisecond +} + +// Collection of service response codes which are generically +// retryable for all services. +var retryableCodes = map[string]struct{}{ + "ExpiredTokenException": struct{}{}, + "ProvisionedThroughputExceededException": struct{}{}, + "Throttling": struct{}{}, +} + +// shouldRetry returns if the request should be retried. +func shouldRetry(r *Request) bool { + if r.HTTPResponse.StatusCode >= 500 { + return true + } + if err := Error(r.Error); err != nil { + if _, ok := retryableCodes[err.Code]; ok { + return true + } + } + return false +} diff --git a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/types.go b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/types.go new file mode 100644 index 00000000000..7801cb689a5 --- /dev/null +++ b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/types.go @@ -0,0 +1,131 @@ +package aws + +import ( + "fmt" + "io" + "time" +) + +// String converts a Go string into a string pointer. +func String(v string) *string { + return &v +} + +// Boolean converts a Go bool into a boolean pointer. +func Boolean(v bool) *bool { + return &v +} + +// Long converts a Go int64 into a long pointer. +func Long(v int64) *int64 { + return &v +} + +// Double converts a Go float64 into a double pointer. +func Double(v float64) *float64 { + return &v +} + +// Time converts a Go Time into a Time pointer +func Time(t time.Time) *time.Time { + return &t +} + +// ReadSeekCloser wraps a io.Reader returning a ReaderSeakerCloser +func ReadSeekCloser(r io.Reader) ReaderSeekerCloser { + return ReaderSeekerCloser{r} +} + +// ReaderSeekerCloser represents a reader that can also delegate io.Seeker and +// io.Closer interfaces to the underlying object if they are available. +type ReaderSeekerCloser struct { + r io.Reader +} + +// Read reads from the reader up to size of p. The number of bytes read, and +// error if it occurred will be returned. +// +// If the reader is not an io.Reader zero bytes read, and nil error will be returned. +// +// Performs the same functionality as io.Reader Read +func (r ReaderSeekerCloser) Read(p []byte) (int, error) { + switch t := r.r.(type) { + case io.Reader: + return t.Read(p) + } + return 0, nil +} + +// Seek sets the offset for the next Read to offset, interpreted according to +// whence: 0 means relative to the origin of the file, 1 means relative to the +// current offset, and 2 means relative to the end. Seek returns the new offset +// and an error, if any. +// +// If the ReaderSeekerCloser is not an io.Seeker nothing will be done. +func (r ReaderSeekerCloser) Seek(offset int64, whence int) (int64, error) { + switch t := r.r.(type) { + case io.Seeker: + return t.Seek(offset, whence) + } + return int64(0), nil +} + +// Close closes the ReaderSeekerCloser. +// +// If the ReaderSeekerCloser is not an io.Closer nothing will be done. +func (r ReaderSeekerCloser) Close() error { + switch t := r.r.(type) { + case io.Closer: + return t.Close() + } + return nil +} + +// A SettableBool provides a boolean value which includes the state if +// the value was set or unset. The set state is in addition to the value's +// value(true|false) +type SettableBool struct { + value bool + set bool +} + +// SetBool returns a SettableBool with a value set +func SetBool(value bool) SettableBool { + return SettableBool{value: value, set: true} +} + +// Get returns the value. Will always be false if the SettableBool was not set. +func (b *SettableBool) Get() bool { + if !b.set { + return false + } + return b.value +} + +// Set sets the value and updates the state that the value has been set. +func (b *SettableBool) Set(value bool) { + b.value = value + b.set = true +} + +// IsSet returns if the value has been set +func (b *SettableBool) IsSet() bool { + return b.set +} + +// Reset resets the state and value of the SettableBool to its initial default +// state of not set and zero value. +func (b *SettableBool) Reset() { + b.value = false + b.set = false +} + +// String returns the string representation of the value if set. Zero if not set. +func (b *SettableBool) String() string { + return fmt.Sprintf("%t", b.Get()) +} + +// GoString returns the string representation of the SettableBool value and state +func (b *SettableBool) GoString() string { + return fmt.Sprintf("Bool{value:%t, set:%t}", b.value, b.set) +} diff --git a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/version.go b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/version.go new file mode 100644 index 00000000000..f644ae0c20b --- /dev/null +++ b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/version.go @@ -0,0 +1,8 @@ +// Package aws provides core functionality for making requests to AWS services. +package aws + +// SDKName is the name of this AWS SDK +const SDKName = "aws-sdk-go" + +// SDKVersion is the version of this SDK +const SDKVersion = "0.5.0" diff --git a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/internal/endpoints/endpoints.go b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/internal/endpoints/endpoints.go new file mode 100644 index 00000000000..8298a5b20b0 --- /dev/null +++ b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/internal/endpoints/endpoints.go @@ -0,0 +1,29 @@ +package endpoints + +//go:generate go run ../model/cli/gen-endpoints/main.go endpoints.json endpoints_map.go + +import "strings" + +// EndpointForRegion returns an endpoint and its signing region for a service and region. +// if the service and region pair are not found endpoint and signingRegion will be empty. +func EndpointForRegion(svcName, region string) (endpoint, signingRegion string) { + derivedKeys := []string{ + region + "/" + svcName, + region + "/*", + "*/" + svcName, + "*/*", + } + + for _, key := range derivedKeys { + if val, ok := endpointsMap.Endpoints[key]; ok { + ep := val.Endpoint + ep = strings.Replace(ep, "{region}", region, -1) + ep = strings.Replace(ep, "{service}", svcName, -1) + + endpoint = ep + signingRegion = val.SigningRegion + return + } + } + return +} diff --git a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/internal/endpoints/endpoints.json b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/internal/endpoints/endpoints.json new file mode 100644 index 00000000000..4c588090a9c --- /dev/null +++ b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/internal/endpoints/endpoints.json @@ -0,0 +1,77 @@ +{ + "version": 2, + "endpoints": { + "*/*": { + "endpoint": "{service}.{region}.amazonaws.com" + }, + "cn-north-1/*": { + "endpoint": "{service}.{region}.amazonaws.com.cn", + "signatureVersion": "v4" + }, + "us-gov-west-1/iam": { + "endpoint": "iam.us-gov.amazonaws.com" + }, + "us-gov-west-1/sts": { + "endpoint": "sts.us-gov-west-1.amazonaws.com" + }, + "us-gov-west-1/s3": { + "endpoint": "s3-{region}.amazonaws.com" + }, + "*/cloudfront": { + "endpoint": "cloudfront.amazonaws.com", + "signingRegion": "us-east-1" + }, + "*/cloudsearchdomain": { + "endpoint": "", + "signingRegion": "us-east-1" + }, + "*/iam": { + "endpoint": "iam.amazonaws.com", + "signingRegion": "us-east-1" + }, + "*/importexport": { + "endpoint": "importexport.amazonaws.com", + "signingRegion": "us-east-1" + }, + "*/route53": { + "endpoint": "route53.amazonaws.com", + "signingRegion": "us-east-1" + }, + "*/sts": { + "endpoint": "sts.amazonaws.com", + "signingRegion": "us-east-1" + }, + "us-east-1/sdb": { + "endpoint": "sdb.amazonaws.com", + "signingRegion": "us-east-1" + }, + "us-east-1/s3": { + "endpoint": "s3.amazonaws.com" + }, + "us-west-1/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" + }, + "eu-central-1/s3": { + "endpoint": "{service}.{region}.amazonaws.com", + "signatureVersion": "v4" + } + } +} diff --git a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/internal/endpoints/endpoints_map.go b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/internal/endpoints/endpoints_map.go new file mode 100644 index 00000000000..637fcbe43aa --- /dev/null +++ b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/internal/endpoints/endpoints_map.go @@ -0,0 +1,89 @@ +package endpoints + +// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. + +type endpointStruct struct { + Version int + Endpoints map[string]endpointEntry +} + +type endpointEntry struct { + Endpoint string + SigningRegion string +} + +var endpointsMap = endpointStruct{ + Version: 2, + Endpoints: map[string]endpointEntry{ + "*/*": endpointEntry{ + Endpoint: "{service}.{region}.amazonaws.com", + }, + "*/cloudfront": endpointEntry{ + Endpoint: "cloudfront.amazonaws.com", + SigningRegion: "us-east-1", + }, + "*/cloudsearchdomain": endpointEntry{ + Endpoint: "", + SigningRegion: "us-east-1", + }, + "*/iam": endpointEntry{ + Endpoint: "iam.amazonaws.com", + SigningRegion: "us-east-1", + }, + "*/importexport": endpointEntry{ + Endpoint: "importexport.amazonaws.com", + SigningRegion: "us-east-1", + }, + "*/route53": endpointEntry{ + Endpoint: "route53.amazonaws.com", + SigningRegion: "us-east-1", + }, + "*/sts": endpointEntry{ + Endpoint: "sts.amazonaws.com", + SigningRegion: "us-east-1", + }, + "ap-northeast-1/s3": endpointEntry{ + Endpoint: "s3-{region}.amazonaws.com", + }, + "ap-southeast-1/s3": endpointEntry{ + Endpoint: "s3-{region}.amazonaws.com", + }, + "ap-southeast-2/s3": endpointEntry{ + Endpoint: "s3-{region}.amazonaws.com", + }, + "cn-north-1/*": endpointEntry{ + Endpoint: "{service}.{region}.amazonaws.com.cn", + }, + "eu-central-1/s3": endpointEntry{ + Endpoint: "{service}.{region}.amazonaws.com", + }, + "eu-west-1/s3": endpointEntry{ + Endpoint: "s3-{region}.amazonaws.com", + }, + "sa-east-1/s3": endpointEntry{ + Endpoint: "s3-{region}.amazonaws.com", + }, + "us-east-1/s3": endpointEntry{ + Endpoint: "s3.amazonaws.com", + }, + "us-east-1/sdb": endpointEntry{ + Endpoint: "sdb.amazonaws.com", + SigningRegion: "us-east-1", + }, + "us-gov-west-1/iam": endpointEntry{ + Endpoint: "iam.us-gov.amazonaws.com", + }, + "us-gov-west-1/s3": endpointEntry{ + Endpoint: "s3-{region}.amazonaws.com", + }, + "us-gov-west-1/sts": endpointEntry{ + Endpoint: "sts.us-gov-west-1.amazonaws.com", + }, + "us-west-1/s3": endpointEntry{ + Endpoint: "s3-{region}.amazonaws.com", + }, + "us-west-2/s3": endpointEntry{ + Endpoint: "s3-{region}.amazonaws.com", + }, + }, +} diff --git a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/internal/endpoints/endpoints_test.go b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/internal/endpoints/endpoints_test.go new file mode 100644 index 00000000000..8af65879d40 --- /dev/null +++ b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/internal/endpoints/endpoints_test.go @@ -0,0 +1,28 @@ +package endpoints + +import ( + "testing" + + "github.com/stretchr/testify/assert" +) + +func TestGlobalEndpoints(t *testing.T) { + region := "mock-region-1" + svcs := []string{"cloudfront", "iam", "importexport", "route53", "sts"} + + for _, name := range svcs { + ep, sr := EndpointForRegion(name, region) + assert.Equal(t, name+".amazonaws.com", ep) + assert.Equal(t, "us-east-1", sr) + } +} + +func TestServicesInCN(t *testing.T) { + region := "cn-north-1" + svcs := []string{"cloudfront", "iam", "importexport", "route53", "sts", "s3"} + + for _, name := range svcs { + ep, _ := EndpointForRegion(name, region) + assert.Equal(t, name+"."+region+".amazonaws.com.cn", ep) + } +} diff --git a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/internal/protocol/ec2query/build.go b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/internal/protocol/ec2query/build.go new file mode 100644 index 00000000000..89b334b66d1 --- /dev/null +++ b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/internal/protocol/ec2query/build.go @@ -0,0 +1,31 @@ +package ec2query + +//go:generate go run ../../fixtures/protocol/generate.go ../../fixtures/protocol/input/ec2.json build_test.go + +import ( + "net/url" + + "github.com/awslabs/aws-sdk-go/aws" + "github.com/awslabs/aws-sdk-go/internal/protocol/query/queryutil" +) + +// Build builds a request for the EC2 protocol. +func Build(r *aws.Request) { + body := url.Values{ + "Action": {r.Operation.Name}, + "Version": {r.Service.APIVersion}, + } + if err := queryutil.Parse(body, r.Params, true); err != nil { + r.Error = err + return + } + + if r.ExpireTime == 0 { + r.HTTPRequest.Method = "POST" + r.HTTPRequest.Header.Set("Content-Type", "application/x-www-form-urlencoded; charset=utf-8") + r.SetBufferBody([]byte(body.Encode())) + } else { // This is a pre-signed request + r.HTTPRequest.Method = "GET" + r.HTTPRequest.URL.RawQuery = body.Encode() + } +} diff --git a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/internal/protocol/ec2query/build_test.go b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/internal/protocol/ec2query/build_test.go new file mode 100644 index 00000000000..61f1854fe27 --- /dev/null +++ b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/internal/protocol/ec2query/build_test.go @@ -0,0 +1,933 @@ +package ec2query_test + +import ( + "github.com/awslabs/aws-sdk-go/aws" + "github.com/awslabs/aws-sdk-go/internal/protocol/ec2query" + "github.com/awslabs/aws-sdk-go/internal/signer/v4" + + "bytes" + "encoding/json" + "encoding/xml" + "github.com/awslabs/aws-sdk-go/internal/protocol/xml/xmlutil" + "github.com/awslabs/aws-sdk-go/internal/util" + "github.com/stretchr/testify/assert" + "io" + "io/ioutil" + "net/http" + "net/url" + "testing" + "time" +) + +var _ bytes.Buffer // always import bytes +var _ http.Request +var _ json.Marshaler +var _ time.Time +var _ xmlutil.XMLNode +var _ xml.Attr +var _ = ioutil.Discard +var _ = util.Trim("") +var _ = url.Values{} +var _ = io.EOF + +// InputService1ProtocolTest is a client for InputService1ProtocolTest. +type InputService1ProtocolTest struct { + *aws.Service +} + +// New returns a new InputService1ProtocolTest client. +func NewInputService1ProtocolTest(config *aws.Config) *InputService1ProtocolTest { + if config == nil { + config = &aws.Config{} + } + + service := &aws.Service{ + Config: aws.DefaultConfig.Merge(config), + ServiceName: "inputservice1protocoltest", + APIVersion: "2014-01-01", + } + service.Initialize() + + // Handlers + service.Handlers.Sign.PushBack(v4.Sign) + service.Handlers.Build.PushBack(ec2query.Build) + service.Handlers.Unmarshal.PushBack(ec2query.Unmarshal) + service.Handlers.UnmarshalMeta.PushBack(ec2query.UnmarshalMeta) + service.Handlers.UnmarshalError.PushBack(ec2query.UnmarshalError) + + return &InputService1ProtocolTest{service} +} + +// newRequest creates a new request for a InputService1ProtocolTest operation and runs any +// custom request initialization. +func (c *InputService1ProtocolTest) newRequest(op *aws.Operation, params, data interface{}) *aws.Request { + req := aws.NewRequest(c.Service, op, params, data) + + return req +} + +// InputService1TestCaseOperation1Request generates a request for the InputService1TestCaseOperation1 operation. +func (c *InputService1ProtocolTest) InputService1TestCaseOperation1Request(input *InputService1TestShapeInputShape) (req *aws.Request, output *InputService1TestShapeInputService1TestCaseOperation1Output) { + + if opInputService1TestCaseOperation1 == nil { + opInputService1TestCaseOperation1 = &aws.Operation{ + Name: "OperationName", + } + } + + if input == nil { + input = &InputService1TestShapeInputShape{} + } + + req = c.newRequest(opInputService1TestCaseOperation1, input, output) + output = &InputService1TestShapeInputService1TestCaseOperation1Output{} + req.Data = output + return +} + +func (c *InputService1ProtocolTest) InputService1TestCaseOperation1(input *InputService1TestShapeInputShape) (output *InputService1TestShapeInputService1TestCaseOperation1Output, err error) { + req, out := c.InputService1TestCaseOperation1Request(input) + output = out + err = req.Send() + return +} + +var opInputService1TestCaseOperation1 *aws.Operation + +type InputService1TestShapeInputService1TestCaseOperation1Output struct { + metadataInputService1TestShapeInputService1TestCaseOperation1Output `json:"-" xml:"-"` +} + +type metadataInputService1TestShapeInputService1TestCaseOperation1Output struct { + SDKShapeTraits bool `type:"structure"` +} + +type InputService1TestShapeInputShape struct { + Bar *string `type:"string"` + + Foo *string `type:"string"` + + metadataInputService1TestShapeInputShape `json:"-" xml:"-"` +} + +type metadataInputService1TestShapeInputShape struct { + SDKShapeTraits bool `type:"structure"` +} + +// InputService2ProtocolTest is a client for InputService2ProtocolTest. +type InputService2ProtocolTest struct { + *aws.Service +} + +// New returns a new InputService2ProtocolTest client. +func NewInputService2ProtocolTest(config *aws.Config) *InputService2ProtocolTest { + if config == nil { + config = &aws.Config{} + } + + service := &aws.Service{ + Config: aws.DefaultConfig.Merge(config), + ServiceName: "inputservice2protocoltest", + APIVersion: "2014-01-01", + } + service.Initialize() + + // Handlers + service.Handlers.Sign.PushBack(v4.Sign) + service.Handlers.Build.PushBack(ec2query.Build) + service.Handlers.Unmarshal.PushBack(ec2query.Unmarshal) + service.Handlers.UnmarshalMeta.PushBack(ec2query.UnmarshalMeta) + service.Handlers.UnmarshalError.PushBack(ec2query.UnmarshalError) + + return &InputService2ProtocolTest{service} +} + +// newRequest creates a new request for a InputService2ProtocolTest operation and runs any +// custom request initialization. +func (c *InputService2ProtocolTest) newRequest(op *aws.Operation, params, data interface{}) *aws.Request { + req := aws.NewRequest(c.Service, op, params, data) + + return req +} + +// InputService2TestCaseOperation1Request generates a request for the InputService2TestCaseOperation1 operation. +func (c *InputService2ProtocolTest) InputService2TestCaseOperation1Request(input *InputService2TestShapeInputShape) (req *aws.Request, output *InputService2TestShapeInputService2TestCaseOperation1Output) { + + if opInputService2TestCaseOperation1 == nil { + opInputService2TestCaseOperation1 = &aws.Operation{ + Name: "OperationName", + } + } + + if input == nil { + input = &InputService2TestShapeInputShape{} + } + + req = c.newRequest(opInputService2TestCaseOperation1, input, output) + output = &InputService2TestShapeInputService2TestCaseOperation1Output{} + req.Data = output + return +} + +func (c *InputService2ProtocolTest) InputService2TestCaseOperation1(input *InputService2TestShapeInputShape) (output *InputService2TestShapeInputService2TestCaseOperation1Output, err error) { + req, out := c.InputService2TestCaseOperation1Request(input) + output = out + err = req.Send() + return +} + +var opInputService2TestCaseOperation1 *aws.Operation + +type InputService2TestShapeInputService2TestCaseOperation1Output struct { + metadataInputService2TestShapeInputService2TestCaseOperation1Output `json:"-" xml:"-"` +} + +type metadataInputService2TestShapeInputService2TestCaseOperation1Output struct { + SDKShapeTraits bool `type:"structure"` +} + +type InputService2TestShapeInputShape struct { + Bar *string `locationName:"barLocationName" type:"string"` + + Foo *string `type:"string"` + + Yuck *string `locationName:"yuckLocationName" queryName:"yuckQueryName" type:"string"` + + metadataInputService2TestShapeInputShape `json:"-" xml:"-"` +} + +type metadataInputService2TestShapeInputShape struct { + SDKShapeTraits bool `type:"structure"` +} + +// InputService3ProtocolTest is a client for InputService3ProtocolTest. +type InputService3ProtocolTest struct { + *aws.Service +} + +// New returns a new InputService3ProtocolTest client. +func NewInputService3ProtocolTest(config *aws.Config) *InputService3ProtocolTest { + if config == nil { + config = &aws.Config{} + } + + service := &aws.Service{ + Config: aws.DefaultConfig.Merge(config), + ServiceName: "inputservice3protocoltest", + APIVersion: "2014-01-01", + } + service.Initialize() + + // Handlers + service.Handlers.Sign.PushBack(v4.Sign) + service.Handlers.Build.PushBack(ec2query.Build) + service.Handlers.Unmarshal.PushBack(ec2query.Unmarshal) + service.Handlers.UnmarshalMeta.PushBack(ec2query.UnmarshalMeta) + service.Handlers.UnmarshalError.PushBack(ec2query.UnmarshalError) + + return &InputService3ProtocolTest{service} +} + +// newRequest creates a new request for a InputService3ProtocolTest operation and runs any +// custom request initialization. +func (c *InputService3ProtocolTest) newRequest(op *aws.Operation, params, data interface{}) *aws.Request { + req := aws.NewRequest(c.Service, op, params, data) + + return req +} + +// InputService3TestCaseOperation1Request generates a request for the InputService3TestCaseOperation1 operation. +func (c *InputService3ProtocolTest) InputService3TestCaseOperation1Request(input *InputService3TestShapeInputShape) (req *aws.Request, output *InputService3TestShapeInputService3TestCaseOperation1Output) { + + if opInputService3TestCaseOperation1 == nil { + opInputService3TestCaseOperation1 = &aws.Operation{ + Name: "OperationName", + } + } + + if input == nil { + input = &InputService3TestShapeInputShape{} + } + + req = c.newRequest(opInputService3TestCaseOperation1, input, output) + output = &InputService3TestShapeInputService3TestCaseOperation1Output{} + req.Data = output + return +} + +func (c *InputService3ProtocolTest) InputService3TestCaseOperation1(input *InputService3TestShapeInputShape) (output *InputService3TestShapeInputService3TestCaseOperation1Output, err error) { + req, out := c.InputService3TestCaseOperation1Request(input) + output = out + err = req.Send() + return +} + +var opInputService3TestCaseOperation1 *aws.Operation + +type InputService3TestShapeInputService3TestCaseOperation1Output struct { + metadataInputService3TestShapeInputService3TestCaseOperation1Output `json:"-" xml:"-"` +} + +type metadataInputService3TestShapeInputService3TestCaseOperation1Output struct { + SDKShapeTraits bool `type:"structure"` +} + +type InputService3TestShapeInputShape struct { + StructArg *InputService3TestShapeStructType `locationName:"Struct" type:"structure"` + + metadataInputService3TestShapeInputShape `json:"-" xml:"-"` +} + +type metadataInputService3TestShapeInputShape struct { + SDKShapeTraits bool `type:"structure"` +} + +type InputService3TestShapeStructType struct { + ScalarArg *string `locationName:"Scalar" type:"string"` + + metadataInputService3TestShapeStructType `json:"-" xml:"-"` +} + +type metadataInputService3TestShapeStructType struct { + SDKShapeTraits bool `type:"structure"` +} + +// InputService4ProtocolTest is a client for InputService4ProtocolTest. +type InputService4ProtocolTest struct { + *aws.Service +} + +// New returns a new InputService4ProtocolTest client. +func NewInputService4ProtocolTest(config *aws.Config) *InputService4ProtocolTest { + if config == nil { + config = &aws.Config{} + } + + service := &aws.Service{ + Config: aws.DefaultConfig.Merge(config), + ServiceName: "inputservice4protocoltest", + APIVersion: "2014-01-01", + } + service.Initialize() + + // Handlers + service.Handlers.Sign.PushBack(v4.Sign) + service.Handlers.Build.PushBack(ec2query.Build) + service.Handlers.Unmarshal.PushBack(ec2query.Unmarshal) + service.Handlers.UnmarshalMeta.PushBack(ec2query.UnmarshalMeta) + service.Handlers.UnmarshalError.PushBack(ec2query.UnmarshalError) + + return &InputService4ProtocolTest{service} +} + +// newRequest creates a new request for a InputService4ProtocolTest operation and runs any +// custom request initialization. +func (c *InputService4ProtocolTest) newRequest(op *aws.Operation, params, data interface{}) *aws.Request { + req := aws.NewRequest(c.Service, op, params, data) + + return req +} + +// InputService4TestCaseOperation1Request generates a request for the InputService4TestCaseOperation1 operation. +func (c *InputService4ProtocolTest) InputService4TestCaseOperation1Request(input *InputService4TestShapeInputShape) (req *aws.Request, output *InputService4TestShapeInputService4TestCaseOperation1Output) { + + if opInputService4TestCaseOperation1 == nil { + opInputService4TestCaseOperation1 = &aws.Operation{ + Name: "OperationName", + } + } + + if input == nil { + input = &InputService4TestShapeInputShape{} + } + + req = c.newRequest(opInputService4TestCaseOperation1, input, output) + output = &InputService4TestShapeInputService4TestCaseOperation1Output{} + req.Data = output + return +} + +func (c *InputService4ProtocolTest) InputService4TestCaseOperation1(input *InputService4TestShapeInputShape) (output *InputService4TestShapeInputService4TestCaseOperation1Output, err error) { + req, out := c.InputService4TestCaseOperation1Request(input) + output = out + err = req.Send() + return +} + +var opInputService4TestCaseOperation1 *aws.Operation + +type InputService4TestShapeInputService4TestCaseOperation1Output struct { + metadataInputService4TestShapeInputService4TestCaseOperation1Output `json:"-" xml:"-"` +} + +type metadataInputService4TestShapeInputService4TestCaseOperation1Output struct { + SDKShapeTraits bool `type:"structure"` +} + +type InputService4TestShapeInputShape struct { + ListArg []*string `type:"list"` + + metadataInputService4TestShapeInputShape `json:"-" xml:"-"` +} + +type metadataInputService4TestShapeInputShape struct { + SDKShapeTraits bool `type:"structure"` +} + +// InputService5ProtocolTest is a client for InputService5ProtocolTest. +type InputService5ProtocolTest struct { + *aws.Service +} + +// New returns a new InputService5ProtocolTest client. +func NewInputService5ProtocolTest(config *aws.Config) *InputService5ProtocolTest { + if config == nil { + config = &aws.Config{} + } + + service := &aws.Service{ + Config: aws.DefaultConfig.Merge(config), + ServiceName: "inputservice5protocoltest", + APIVersion: "2014-01-01", + } + service.Initialize() + + // Handlers + service.Handlers.Sign.PushBack(v4.Sign) + service.Handlers.Build.PushBack(ec2query.Build) + service.Handlers.Unmarshal.PushBack(ec2query.Unmarshal) + service.Handlers.UnmarshalMeta.PushBack(ec2query.UnmarshalMeta) + service.Handlers.UnmarshalError.PushBack(ec2query.UnmarshalError) + + return &InputService5ProtocolTest{service} +} + +// newRequest creates a new request for a InputService5ProtocolTest operation and runs any +// custom request initialization. +func (c *InputService5ProtocolTest) newRequest(op *aws.Operation, params, data interface{}) *aws.Request { + req := aws.NewRequest(c.Service, op, params, data) + + return req +} + +// InputService5TestCaseOperation1Request generates a request for the InputService5TestCaseOperation1 operation. +func (c *InputService5ProtocolTest) InputService5TestCaseOperation1Request(input *InputService5TestShapeInputShape) (req *aws.Request, output *InputService5TestShapeInputService5TestCaseOperation1Output) { + + if opInputService5TestCaseOperation1 == nil { + opInputService5TestCaseOperation1 = &aws.Operation{ + Name: "OperationName", + } + } + + if input == nil { + input = &InputService5TestShapeInputShape{} + } + + req = c.newRequest(opInputService5TestCaseOperation1, input, output) + output = &InputService5TestShapeInputService5TestCaseOperation1Output{} + req.Data = output + return +} + +func (c *InputService5ProtocolTest) InputService5TestCaseOperation1(input *InputService5TestShapeInputShape) (output *InputService5TestShapeInputService5TestCaseOperation1Output, err error) { + req, out := c.InputService5TestCaseOperation1Request(input) + output = out + err = req.Send() + return +} + +var opInputService5TestCaseOperation1 *aws.Operation + +type InputService5TestShapeInputService5TestCaseOperation1Output struct { + metadataInputService5TestShapeInputService5TestCaseOperation1Output `json:"-" xml:"-"` +} + +type metadataInputService5TestShapeInputService5TestCaseOperation1Output struct { + SDKShapeTraits bool `type:"structure"` +} + +type InputService5TestShapeInputShape struct { + ListArg []*string `locationName:"ListMemberName" locationNameList:"item" type:"list"` + + metadataInputService5TestShapeInputShape `json:"-" xml:"-"` +} + +type metadataInputService5TestShapeInputShape struct { + SDKShapeTraits bool `type:"structure"` +} + +// InputService6ProtocolTest is a client for InputService6ProtocolTest. +type InputService6ProtocolTest struct { + *aws.Service +} + +// New returns a new InputService6ProtocolTest client. +func NewInputService6ProtocolTest(config *aws.Config) *InputService6ProtocolTest { + if config == nil { + config = &aws.Config{} + } + + service := &aws.Service{ + Config: aws.DefaultConfig.Merge(config), + ServiceName: "inputservice6protocoltest", + APIVersion: "2014-01-01", + } + service.Initialize() + + // Handlers + service.Handlers.Sign.PushBack(v4.Sign) + service.Handlers.Build.PushBack(ec2query.Build) + service.Handlers.Unmarshal.PushBack(ec2query.Unmarshal) + service.Handlers.UnmarshalMeta.PushBack(ec2query.UnmarshalMeta) + service.Handlers.UnmarshalError.PushBack(ec2query.UnmarshalError) + + return &InputService6ProtocolTest{service} +} + +// newRequest creates a new request for a InputService6ProtocolTest operation and runs any +// custom request initialization. +func (c *InputService6ProtocolTest) newRequest(op *aws.Operation, params, data interface{}) *aws.Request { + req := aws.NewRequest(c.Service, op, params, data) + + return req +} + +// InputService6TestCaseOperation1Request generates a request for the InputService6TestCaseOperation1 operation. +func (c *InputService6ProtocolTest) InputService6TestCaseOperation1Request(input *InputService6TestShapeInputShape) (req *aws.Request, output *InputService6TestShapeInputService6TestCaseOperation1Output) { + + if opInputService6TestCaseOperation1 == nil { + opInputService6TestCaseOperation1 = &aws.Operation{ + Name: "OperationName", + } + } + + if input == nil { + input = &InputService6TestShapeInputShape{} + } + + req = c.newRequest(opInputService6TestCaseOperation1, input, output) + output = &InputService6TestShapeInputService6TestCaseOperation1Output{} + req.Data = output + return +} + +func (c *InputService6ProtocolTest) InputService6TestCaseOperation1(input *InputService6TestShapeInputShape) (output *InputService6TestShapeInputService6TestCaseOperation1Output, err error) { + req, out := c.InputService6TestCaseOperation1Request(input) + output = out + err = req.Send() + return +} + +var opInputService6TestCaseOperation1 *aws.Operation + +type InputService6TestShapeInputService6TestCaseOperation1Output struct { + metadataInputService6TestShapeInputService6TestCaseOperation1Output `json:"-" xml:"-"` +} + +type metadataInputService6TestShapeInputService6TestCaseOperation1Output struct { + SDKShapeTraits bool `type:"structure"` +} + +type InputService6TestShapeInputShape struct { + ListArg []*string `locationName:"ListMemberName" queryName:"ListQueryName" locationNameList:"item" type:"list"` + + metadataInputService6TestShapeInputShape `json:"-" xml:"-"` +} + +type metadataInputService6TestShapeInputShape struct { + SDKShapeTraits bool `type:"structure"` +} + +// InputService7ProtocolTest is a client for InputService7ProtocolTest. +type InputService7ProtocolTest struct { + *aws.Service +} + +// New returns a new InputService7ProtocolTest client. +func NewInputService7ProtocolTest(config *aws.Config) *InputService7ProtocolTest { + if config == nil { + config = &aws.Config{} + } + + service := &aws.Service{ + Config: aws.DefaultConfig.Merge(config), + ServiceName: "inputservice7protocoltest", + APIVersion: "2014-01-01", + } + service.Initialize() + + // Handlers + service.Handlers.Sign.PushBack(v4.Sign) + service.Handlers.Build.PushBack(ec2query.Build) + service.Handlers.Unmarshal.PushBack(ec2query.Unmarshal) + service.Handlers.UnmarshalMeta.PushBack(ec2query.UnmarshalMeta) + service.Handlers.UnmarshalError.PushBack(ec2query.UnmarshalError) + + return &InputService7ProtocolTest{service} +} + +// newRequest creates a new request for a InputService7ProtocolTest operation and runs any +// custom request initialization. +func (c *InputService7ProtocolTest) newRequest(op *aws.Operation, params, data interface{}) *aws.Request { + req := aws.NewRequest(c.Service, op, params, data) + + return req +} + +// InputService7TestCaseOperation1Request generates a request for the InputService7TestCaseOperation1 operation. +func (c *InputService7ProtocolTest) InputService7TestCaseOperation1Request(input *InputService7TestShapeInputShape) (req *aws.Request, output *InputService7TestShapeInputService7TestCaseOperation1Output) { + + if opInputService7TestCaseOperation1 == nil { + opInputService7TestCaseOperation1 = &aws.Operation{ + Name: "OperationName", + } + } + + if input == nil { + input = &InputService7TestShapeInputShape{} + } + + req = c.newRequest(opInputService7TestCaseOperation1, input, output) + output = &InputService7TestShapeInputService7TestCaseOperation1Output{} + req.Data = output + return +} + +func (c *InputService7ProtocolTest) InputService7TestCaseOperation1(input *InputService7TestShapeInputShape) (output *InputService7TestShapeInputService7TestCaseOperation1Output, err error) { + req, out := c.InputService7TestCaseOperation1Request(input) + output = out + err = req.Send() + return +} + +var opInputService7TestCaseOperation1 *aws.Operation + +type InputService7TestShapeInputService7TestCaseOperation1Output struct { + metadataInputService7TestShapeInputService7TestCaseOperation1Output `json:"-" xml:"-"` +} + +type metadataInputService7TestShapeInputService7TestCaseOperation1Output struct { + SDKShapeTraits bool `type:"structure"` +} + +type InputService7TestShapeInputShape struct { + BlobArg []byte `type:"blob"` + + metadataInputService7TestShapeInputShape `json:"-" xml:"-"` +} + +type metadataInputService7TestShapeInputShape struct { + SDKShapeTraits bool `type:"structure"` +} + +// InputService8ProtocolTest is a client for InputService8ProtocolTest. +type InputService8ProtocolTest struct { + *aws.Service +} + +// New returns a new InputService8ProtocolTest client. +func NewInputService8ProtocolTest(config *aws.Config) *InputService8ProtocolTest { + if config == nil { + config = &aws.Config{} + } + + service := &aws.Service{ + Config: aws.DefaultConfig.Merge(config), + ServiceName: "inputservice8protocoltest", + APIVersion: "2014-01-01", + } + service.Initialize() + + // Handlers + service.Handlers.Sign.PushBack(v4.Sign) + service.Handlers.Build.PushBack(ec2query.Build) + service.Handlers.Unmarshal.PushBack(ec2query.Unmarshal) + service.Handlers.UnmarshalMeta.PushBack(ec2query.UnmarshalMeta) + service.Handlers.UnmarshalError.PushBack(ec2query.UnmarshalError) + + return &InputService8ProtocolTest{service} +} + +// newRequest creates a new request for a InputService8ProtocolTest operation and runs any +// custom request initialization. +func (c *InputService8ProtocolTest) newRequest(op *aws.Operation, params, data interface{}) *aws.Request { + req := aws.NewRequest(c.Service, op, params, data) + + return req +} + +// InputService8TestCaseOperation1Request generates a request for the InputService8TestCaseOperation1 operation. +func (c *InputService8ProtocolTest) InputService8TestCaseOperation1Request(input *InputService8TestShapeInputShape) (req *aws.Request, output *InputService8TestShapeInputService8TestCaseOperation1Output) { + + if opInputService8TestCaseOperation1 == nil { + opInputService8TestCaseOperation1 = &aws.Operation{ + Name: "OperationName", + } + } + + if input == nil { + input = &InputService8TestShapeInputShape{} + } + + req = c.newRequest(opInputService8TestCaseOperation1, input, output) + output = &InputService8TestShapeInputService8TestCaseOperation1Output{} + req.Data = output + return +} + +func (c *InputService8ProtocolTest) InputService8TestCaseOperation1(input *InputService8TestShapeInputShape) (output *InputService8TestShapeInputService8TestCaseOperation1Output, err error) { + req, out := c.InputService8TestCaseOperation1Request(input) + output = out + err = req.Send() + return +} + +var opInputService8TestCaseOperation1 *aws.Operation + +type InputService8TestShapeInputService8TestCaseOperation1Output struct { + metadataInputService8TestShapeInputService8TestCaseOperation1Output `json:"-" xml:"-"` +} + +type metadataInputService8TestShapeInputService8TestCaseOperation1Output struct { + SDKShapeTraits bool `type:"structure"` +} + +type InputService8TestShapeInputShape struct { + TimeArg *time.Time `type:"timestamp" timestampFormat:"iso8601"` + + metadataInputService8TestShapeInputShape `json:"-" xml:"-"` +} + +type metadataInputService8TestShapeInputShape struct { + SDKShapeTraits bool `type:"structure"` +} + +// +// Tests begin here +// + +func TestInputService1ProtocolTestScalarMembersCase1(t *testing.T) { + svc := NewInputService1ProtocolTest(nil) + svc.Endpoint = "https://test" + + input := &InputService1TestShapeInputShape{ + Bar: aws.String("val2"), + Foo: aws.String("val1"), + } + req, _ := svc.InputService1TestCaseOperation1Request(input) + r := req.HTTPRequest + + // build request + ec2query.Build(req) + assert.NoError(t, req.Error) + + // assert body + assert.NotNil(t, r.Body) + body, _ := ioutil.ReadAll(r.Body) + assert.Equal(t, util.Trim(`Action=OperationName&Bar=val2&Foo=val1&Version=2014-01-01`), util.Trim(string(body))) + + // assert URL + assert.Equal(t, "https://test/", r.URL.String()) + + // assert headers + +} + +func TestInputService2ProtocolTestStructureWithLocationNameAndQueryNameAppliedToMembersCase1(t *testing.T) { + svc := NewInputService2ProtocolTest(nil) + svc.Endpoint = "https://test" + + input := &InputService2TestShapeInputShape{ + Bar: aws.String("val2"), + Foo: aws.String("val1"), + Yuck: aws.String("val3"), + } + req, _ := svc.InputService2TestCaseOperation1Request(input) + r := req.HTTPRequest + + // build request + ec2query.Build(req) + assert.NoError(t, req.Error) + + // assert body + assert.NotNil(t, r.Body) + body, _ := ioutil.ReadAll(r.Body) + assert.Equal(t, util.Trim(`Action=OperationName&BarLocationName=val2&Foo=val1&Version=2014-01-01&yuckQueryName=val3`), util.Trim(string(body))) + + // assert URL + assert.Equal(t, "https://test/", r.URL.String()) + + // assert headers + +} + +func TestInputService3ProtocolTestNestedStructureMembersCase1(t *testing.T) { + svc := NewInputService3ProtocolTest(nil) + svc.Endpoint = "https://test" + + input := &InputService3TestShapeInputShape{ + StructArg: &InputService3TestShapeStructType{ + ScalarArg: aws.String("foo"), + }, + } + req, _ := svc.InputService3TestCaseOperation1Request(input) + r := req.HTTPRequest + + // build request + ec2query.Build(req) + assert.NoError(t, req.Error) + + // assert body + assert.NotNil(t, r.Body) + body, _ := ioutil.ReadAll(r.Body) + assert.Equal(t, util.Trim(`Action=OperationName&Struct.Scalar=foo&Version=2014-01-01`), util.Trim(string(body))) + + // assert URL + assert.Equal(t, "https://test/", r.URL.String()) + + // assert headers + +} + +func TestInputService4ProtocolTestListTypesCase1(t *testing.T) { + svc := NewInputService4ProtocolTest(nil) + svc.Endpoint = "https://test" + + input := &InputService4TestShapeInputShape{ + ListArg: []*string{ + aws.String("foo"), + aws.String("bar"), + aws.String("baz"), + }, + } + req, _ := svc.InputService4TestCaseOperation1Request(input) + r := req.HTTPRequest + + // build request + ec2query.Build(req) + assert.NoError(t, req.Error) + + // assert body + assert.NotNil(t, r.Body) + body, _ := ioutil.ReadAll(r.Body) + assert.Equal(t, util.Trim(`Action=OperationName&ListArg.1=foo&ListArg.2=bar&ListArg.3=baz&Version=2014-01-01`), util.Trim(string(body))) + + // assert URL + assert.Equal(t, "https://test/", r.URL.String()) + + // assert headers + +} + +func TestInputService5ProtocolTestListWithLocationNameAppliedToMemberCase1(t *testing.T) { + svc := NewInputService5ProtocolTest(nil) + svc.Endpoint = "https://test" + + input := &InputService5TestShapeInputShape{ + ListArg: []*string{ + aws.String("a"), + aws.String("b"), + aws.String("c"), + }, + } + req, _ := svc.InputService5TestCaseOperation1Request(input) + r := req.HTTPRequest + + // build request + ec2query.Build(req) + assert.NoError(t, req.Error) + + // assert body + assert.NotNil(t, r.Body) + body, _ := ioutil.ReadAll(r.Body) + assert.Equal(t, util.Trim(`Action=OperationName&ListMemberName.1=a&ListMemberName.2=b&ListMemberName.3=c&Version=2014-01-01`), util.Trim(string(body))) + + // assert URL + assert.Equal(t, "https://test/", r.URL.String()) + + // assert headers + +} + +func TestInputService6ProtocolTestListWithLocationNameAndQueryNameCase1(t *testing.T) { + svc := NewInputService6ProtocolTest(nil) + svc.Endpoint = "https://test" + + input := &InputService6TestShapeInputShape{ + ListArg: []*string{ + aws.String("a"), + aws.String("b"), + aws.String("c"), + }, + } + req, _ := svc.InputService6TestCaseOperation1Request(input) + r := req.HTTPRequest + + // build request + ec2query.Build(req) + assert.NoError(t, req.Error) + + // assert body + assert.NotNil(t, r.Body) + body, _ := ioutil.ReadAll(r.Body) + assert.Equal(t, util.Trim(`Action=OperationName&ListQueryName.1=a&ListQueryName.2=b&ListQueryName.3=c&Version=2014-01-01`), util.Trim(string(body))) + + // assert URL + assert.Equal(t, "https://test/", r.URL.String()) + + // assert headers + +} + +func TestInputService7ProtocolTestBase64EncodedBlobsCase1(t *testing.T) { + svc := NewInputService7ProtocolTest(nil) + svc.Endpoint = "https://test" + + input := &InputService7TestShapeInputShape{ + BlobArg: []byte("foo"), + } + req, _ := svc.InputService7TestCaseOperation1Request(input) + r := req.HTTPRequest + + // build request + ec2query.Build(req) + assert.NoError(t, req.Error) + + // assert body + assert.NotNil(t, r.Body) + body, _ := ioutil.ReadAll(r.Body) + assert.Equal(t, util.Trim(`Action=OperationName&BlobArg=Zm9v&Version=2014-01-01`), util.Trim(string(body))) + + // assert URL + assert.Equal(t, "https://test/", r.URL.String()) + + // assert headers + +} + +func TestInputService8ProtocolTestTimestampValuesCase1(t *testing.T) { + svc := NewInputService8ProtocolTest(nil) + svc.Endpoint = "https://test" + + input := &InputService8TestShapeInputShape{ + TimeArg: aws.Time(time.Unix(1422172800, 0)), + } + req, _ := svc.InputService8TestCaseOperation1Request(input) + r := req.HTTPRequest + + // build request + ec2query.Build(req) + assert.NoError(t, req.Error) + + // assert body + assert.NotNil(t, r.Body) + body, _ := ioutil.ReadAll(r.Body) + assert.Equal(t, util.Trim(`Action=OperationName&TimeArg=2015-01-25T08%3A00%3A00Z&Version=2014-01-01`), util.Trim(string(body))) + + // assert URL + assert.Equal(t, "https://test/", r.URL.String()) + + // assert headers + +} + diff --git a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/internal/protocol/ec2query/unmarshal.go b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/internal/protocol/ec2query/unmarshal.go new file mode 100644 index 00000000000..aa13622aeed --- /dev/null +++ b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/internal/protocol/ec2query/unmarshal.go @@ -0,0 +1,53 @@ +package ec2query + +//go:generate go run ../../fixtures/protocol/generate.go ../../fixtures/protocol/output/ec2.json unmarshal_test.go + +import ( + "encoding/xml" + "io" + + "github.com/awslabs/aws-sdk-go/aws" + "github.com/awslabs/aws-sdk-go/internal/protocol/xml/xmlutil" +) + +// Unmarshal unmarshals a response body for the EC2 protocol. +func Unmarshal(r *aws.Request) { + defer r.HTTPResponse.Body.Close() + if r.DataFilled() { + decoder := xml.NewDecoder(r.HTTPResponse.Body) + err := xmlutil.UnmarshalXML(r.Data, decoder, "") + if err != nil { + r.Error = err + return + } + } +} + +// UnmarshalMeta unmarshals response headers for the EC2 protocol. +func UnmarshalMeta(r *aws.Request) { + // TODO implement unmarshaling of request IDs +} + +type xmlErrorResponse struct { + XMLName xml.Name `xml:"Response"` + Code string `xml:"Errors>Error>Code"` + Message string `xml:"Errors>Error>Message"` + RequestID string `xml:"RequestId"` +} + +// UnmarshalError unmarshals a response error for the EC2 protocol. +func UnmarshalError(r *aws.Request) { + defer r.HTTPResponse.Body.Close() + + resp := &xmlErrorResponse{} + err := xml.NewDecoder(r.HTTPResponse.Body).Decode(resp) + if err != nil && err != io.EOF { + r.Error = err + } else { + r.Error = aws.APIError{ + StatusCode: r.HTTPResponse.StatusCode, + Code: resp.Code, + Message: resp.Message, + } + } +} diff --git a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/internal/protocol/ec2query/unmarshal_test.go b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/internal/protocol/ec2query/unmarshal_test.go new file mode 100644 index 00000000000..cc9c283d7e5 --- /dev/null +++ b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/internal/protocol/ec2query/unmarshal_test.go @@ -0,0 +1,889 @@ +package ec2query_test + +import ( + "github.com/awslabs/aws-sdk-go/aws" + "github.com/awslabs/aws-sdk-go/internal/protocol/ec2query" + "github.com/awslabs/aws-sdk-go/internal/signer/v4" + + "bytes" + "encoding/json" + "encoding/xml" + "github.com/awslabs/aws-sdk-go/internal/protocol/xml/xmlutil" + "github.com/awslabs/aws-sdk-go/internal/util" + "github.com/stretchr/testify/assert" + "io" + "io/ioutil" + "net/http" + "net/url" + "testing" + "time" +) + +var _ bytes.Buffer // always import bytes +var _ http.Request +var _ json.Marshaler +var _ time.Time +var _ xmlutil.XMLNode +var _ xml.Attr +var _ = ioutil.Discard +var _ = util.Trim("") +var _ = url.Values{} +var _ = io.EOF + +// OutputService1ProtocolTest is a client for OutputService1ProtocolTest. +type OutputService1ProtocolTest struct { + *aws.Service +} + +// New returns a new OutputService1ProtocolTest client. +func NewOutputService1ProtocolTest(config *aws.Config) *OutputService1ProtocolTest { + if config == nil { + config = &aws.Config{} + } + + service := &aws.Service{ + Config: aws.DefaultConfig.Merge(config), + ServiceName: "outputservice1protocoltest", + APIVersion: "", + } + service.Initialize() + + // Handlers + service.Handlers.Sign.PushBack(v4.Sign) + service.Handlers.Build.PushBack(ec2query.Build) + service.Handlers.Unmarshal.PushBack(ec2query.Unmarshal) + service.Handlers.UnmarshalMeta.PushBack(ec2query.UnmarshalMeta) + service.Handlers.UnmarshalError.PushBack(ec2query.UnmarshalError) + + return &OutputService1ProtocolTest{service} +} + +// newRequest creates a new request for a OutputService1ProtocolTest operation and runs any +// custom request initialization. +func (c *OutputService1ProtocolTest) newRequest(op *aws.Operation, params, data interface{}) *aws.Request { + req := aws.NewRequest(c.Service, op, params, data) + + return req +} + +// OutputService1TestCaseOperation1Request generates a request for the OutputService1TestCaseOperation1 operation. +func (c *OutputService1ProtocolTest) OutputService1TestCaseOperation1Request(input *OutputService1TestShapeOutputService1TestCaseOperation1Input) (req *aws.Request, output *OutputService1TestShapeOutputShape) { + + if opOutputService1TestCaseOperation1 == nil { + opOutputService1TestCaseOperation1 = &aws.Operation{ + Name: "OperationName", + } + } + + if input == nil { + input = &OutputService1TestShapeOutputService1TestCaseOperation1Input{} + } + + req = c.newRequest(opOutputService1TestCaseOperation1, input, output) + output = &OutputService1TestShapeOutputShape{} + req.Data = output + return +} + +func (c *OutputService1ProtocolTest) OutputService1TestCaseOperation1(input *OutputService1TestShapeOutputService1TestCaseOperation1Input) (output *OutputService1TestShapeOutputShape, err error) { + req, out := c.OutputService1TestCaseOperation1Request(input) + output = out + err = req.Send() + return +} + +var opOutputService1TestCaseOperation1 *aws.Operation + +type OutputService1TestShapeOutputService1TestCaseOperation1Input struct { + metadataOutputService1TestShapeOutputService1TestCaseOperation1Input `json:"-" xml:"-"` +} + +type metadataOutputService1TestShapeOutputService1TestCaseOperation1Input struct { + SDKShapeTraits bool `type:"structure"` +} + +type OutputService1TestShapeOutputShape struct { + Char *string `type:"character"` + + Double *float64 `type:"double"` + + FalseBool *bool `type:"boolean"` + + Float *float64 `type:"float"` + + Long *int64 `type:"long"` + + Num *int64 `locationName:"FooNum" type:"integer"` + + Str *string `type:"string"` + + TrueBool *bool `type:"boolean"` + + metadataOutputService1TestShapeOutputShape `json:"-" xml:"-"` +} + +type metadataOutputService1TestShapeOutputShape struct { + SDKShapeTraits bool `type:"structure"` +} + +// OutputService2ProtocolTest is a client for OutputService2ProtocolTest. +type OutputService2ProtocolTest struct { + *aws.Service +} + +// New returns a new OutputService2ProtocolTest client. +func NewOutputService2ProtocolTest(config *aws.Config) *OutputService2ProtocolTest { + if config == nil { + config = &aws.Config{} + } + + service := &aws.Service{ + Config: aws.DefaultConfig.Merge(config), + ServiceName: "outputservice2protocoltest", + APIVersion: "", + } + service.Initialize() + + // Handlers + service.Handlers.Sign.PushBack(v4.Sign) + service.Handlers.Build.PushBack(ec2query.Build) + service.Handlers.Unmarshal.PushBack(ec2query.Unmarshal) + service.Handlers.UnmarshalMeta.PushBack(ec2query.UnmarshalMeta) + service.Handlers.UnmarshalError.PushBack(ec2query.UnmarshalError) + + return &OutputService2ProtocolTest{service} +} + +// newRequest creates a new request for a OutputService2ProtocolTest operation and runs any +// custom request initialization. +func (c *OutputService2ProtocolTest) newRequest(op *aws.Operation, params, data interface{}) *aws.Request { + req := aws.NewRequest(c.Service, op, params, data) + + return req +} + +// OutputService2TestCaseOperation1Request generates a request for the OutputService2TestCaseOperation1 operation. +func (c *OutputService2ProtocolTest) OutputService2TestCaseOperation1Request(input *OutputService2TestShapeOutputService2TestCaseOperation1Input) (req *aws.Request, output *OutputService2TestShapeOutputShape) { + + if opOutputService2TestCaseOperation1 == nil { + opOutputService2TestCaseOperation1 = &aws.Operation{ + Name: "OperationName", + } + } + + if input == nil { + input = &OutputService2TestShapeOutputService2TestCaseOperation1Input{} + } + + req = c.newRequest(opOutputService2TestCaseOperation1, input, output) + output = &OutputService2TestShapeOutputShape{} + req.Data = output + return +} + +func (c *OutputService2ProtocolTest) OutputService2TestCaseOperation1(input *OutputService2TestShapeOutputService2TestCaseOperation1Input) (output *OutputService2TestShapeOutputShape, err error) { + req, out := c.OutputService2TestCaseOperation1Request(input) + output = out + err = req.Send() + return +} + +var opOutputService2TestCaseOperation1 *aws.Operation + +type OutputService2TestShapeOutputService2TestCaseOperation1Input struct { + metadataOutputService2TestShapeOutputService2TestCaseOperation1Input `json:"-" xml:"-"` +} + +type metadataOutputService2TestShapeOutputService2TestCaseOperation1Input struct { + SDKShapeTraits bool `type:"structure"` +} + +type OutputService2TestShapeOutputShape struct { + Blob []byte `type:"blob"` + + metadataOutputService2TestShapeOutputShape `json:"-" xml:"-"` +} + +type metadataOutputService2TestShapeOutputShape struct { + SDKShapeTraits bool `type:"structure"` +} + +// OutputService3ProtocolTest is a client for OutputService3ProtocolTest. +type OutputService3ProtocolTest struct { + *aws.Service +} + +// New returns a new OutputService3ProtocolTest client. +func NewOutputService3ProtocolTest(config *aws.Config) *OutputService3ProtocolTest { + if config == nil { + config = &aws.Config{} + } + + service := &aws.Service{ + Config: aws.DefaultConfig.Merge(config), + ServiceName: "outputservice3protocoltest", + APIVersion: "", + } + service.Initialize() + + // Handlers + service.Handlers.Sign.PushBack(v4.Sign) + service.Handlers.Build.PushBack(ec2query.Build) + service.Handlers.Unmarshal.PushBack(ec2query.Unmarshal) + service.Handlers.UnmarshalMeta.PushBack(ec2query.UnmarshalMeta) + service.Handlers.UnmarshalError.PushBack(ec2query.UnmarshalError) + + return &OutputService3ProtocolTest{service} +} + +// newRequest creates a new request for a OutputService3ProtocolTest operation and runs any +// custom request initialization. +func (c *OutputService3ProtocolTest) newRequest(op *aws.Operation, params, data interface{}) *aws.Request { + req := aws.NewRequest(c.Service, op, params, data) + + return req +} + +// OutputService3TestCaseOperation1Request generates a request for the OutputService3TestCaseOperation1 operation. +func (c *OutputService3ProtocolTest) OutputService3TestCaseOperation1Request(input *OutputService3TestShapeOutputService3TestCaseOperation1Input) (req *aws.Request, output *OutputService3TestShapeOutputShape) { + + if opOutputService3TestCaseOperation1 == nil { + opOutputService3TestCaseOperation1 = &aws.Operation{ + Name: "OperationName", + } + } + + if input == nil { + input = &OutputService3TestShapeOutputService3TestCaseOperation1Input{} + } + + req = c.newRequest(opOutputService3TestCaseOperation1, input, output) + output = &OutputService3TestShapeOutputShape{} + req.Data = output + return +} + +func (c *OutputService3ProtocolTest) OutputService3TestCaseOperation1(input *OutputService3TestShapeOutputService3TestCaseOperation1Input) (output *OutputService3TestShapeOutputShape, err error) { + req, out := c.OutputService3TestCaseOperation1Request(input) + output = out + err = req.Send() + return +} + +var opOutputService3TestCaseOperation1 *aws.Operation + +type OutputService3TestShapeOutputService3TestCaseOperation1Input struct { + metadataOutputService3TestShapeOutputService3TestCaseOperation1Input `json:"-" xml:"-"` +} + +type metadataOutputService3TestShapeOutputService3TestCaseOperation1Input struct { + SDKShapeTraits bool `type:"structure"` +} + +type OutputService3TestShapeOutputShape struct { + ListMember []*string `type:"list"` + + metadataOutputService3TestShapeOutputShape `json:"-" xml:"-"` +} + +type metadataOutputService3TestShapeOutputShape struct { + SDKShapeTraits bool `type:"structure"` +} + +// OutputService4ProtocolTest is a client for OutputService4ProtocolTest. +type OutputService4ProtocolTest struct { + *aws.Service +} + +// New returns a new OutputService4ProtocolTest client. +func NewOutputService4ProtocolTest(config *aws.Config) *OutputService4ProtocolTest { + if config == nil { + config = &aws.Config{} + } + + service := &aws.Service{ + Config: aws.DefaultConfig.Merge(config), + ServiceName: "outputservice4protocoltest", + APIVersion: "", + } + service.Initialize() + + // Handlers + service.Handlers.Sign.PushBack(v4.Sign) + service.Handlers.Build.PushBack(ec2query.Build) + service.Handlers.Unmarshal.PushBack(ec2query.Unmarshal) + service.Handlers.UnmarshalMeta.PushBack(ec2query.UnmarshalMeta) + service.Handlers.UnmarshalError.PushBack(ec2query.UnmarshalError) + + return &OutputService4ProtocolTest{service} +} + +// newRequest creates a new request for a OutputService4ProtocolTest operation and runs any +// custom request initialization. +func (c *OutputService4ProtocolTest) newRequest(op *aws.Operation, params, data interface{}) *aws.Request { + req := aws.NewRequest(c.Service, op, params, data) + + return req +} + +// OutputService4TestCaseOperation1Request generates a request for the OutputService4TestCaseOperation1 operation. +func (c *OutputService4ProtocolTest) OutputService4TestCaseOperation1Request(input *OutputService4TestShapeOutputService4TestCaseOperation1Input) (req *aws.Request, output *OutputService4TestShapeOutputShape) { + + if opOutputService4TestCaseOperation1 == nil { + opOutputService4TestCaseOperation1 = &aws.Operation{ + Name: "OperationName", + } + } + + if input == nil { + input = &OutputService4TestShapeOutputService4TestCaseOperation1Input{} + } + + req = c.newRequest(opOutputService4TestCaseOperation1, input, output) + output = &OutputService4TestShapeOutputShape{} + req.Data = output + return +} + +func (c *OutputService4ProtocolTest) OutputService4TestCaseOperation1(input *OutputService4TestShapeOutputService4TestCaseOperation1Input) (output *OutputService4TestShapeOutputShape, err error) { + req, out := c.OutputService4TestCaseOperation1Request(input) + output = out + err = req.Send() + return +} + +var opOutputService4TestCaseOperation1 *aws.Operation + +type OutputService4TestShapeOutputService4TestCaseOperation1Input struct { + metadataOutputService4TestShapeOutputService4TestCaseOperation1Input `json:"-" xml:"-"` +} + +type metadataOutputService4TestShapeOutputService4TestCaseOperation1Input struct { + SDKShapeTraits bool `type:"structure"` +} + +type OutputService4TestShapeOutputShape struct { + ListMember []*string `locationNameList:"item" type:"list"` + + metadataOutputService4TestShapeOutputShape `json:"-" xml:"-"` +} + +type metadataOutputService4TestShapeOutputShape struct { + SDKShapeTraits bool `type:"structure"` +} + +// OutputService5ProtocolTest is a client for OutputService5ProtocolTest. +type OutputService5ProtocolTest struct { + *aws.Service +} + +// New returns a new OutputService5ProtocolTest client. +func NewOutputService5ProtocolTest(config *aws.Config) *OutputService5ProtocolTest { + if config == nil { + config = &aws.Config{} + } + + service := &aws.Service{ + Config: aws.DefaultConfig.Merge(config), + ServiceName: "outputservice5protocoltest", + APIVersion: "", + } + service.Initialize() + + // Handlers + service.Handlers.Sign.PushBack(v4.Sign) + service.Handlers.Build.PushBack(ec2query.Build) + service.Handlers.Unmarshal.PushBack(ec2query.Unmarshal) + service.Handlers.UnmarshalMeta.PushBack(ec2query.UnmarshalMeta) + service.Handlers.UnmarshalError.PushBack(ec2query.UnmarshalError) + + return &OutputService5ProtocolTest{service} +} + +// newRequest creates a new request for a OutputService5ProtocolTest operation and runs any +// custom request initialization. +func (c *OutputService5ProtocolTest) newRequest(op *aws.Operation, params, data interface{}) *aws.Request { + req := aws.NewRequest(c.Service, op, params, data) + + return req +} + +// OutputService5TestCaseOperation1Request generates a request for the OutputService5TestCaseOperation1 operation. +func (c *OutputService5ProtocolTest) OutputService5TestCaseOperation1Request(input *OutputService5TestShapeOutputService5TestCaseOperation1Input) (req *aws.Request, output *OutputService5TestShapeOutputShape) { + + if opOutputService5TestCaseOperation1 == nil { + opOutputService5TestCaseOperation1 = &aws.Operation{ + Name: "OperationName", + } + } + + if input == nil { + input = &OutputService5TestShapeOutputService5TestCaseOperation1Input{} + } + + req = c.newRequest(opOutputService5TestCaseOperation1, input, output) + output = &OutputService5TestShapeOutputShape{} + req.Data = output + return +} + +func (c *OutputService5ProtocolTest) OutputService5TestCaseOperation1(input *OutputService5TestShapeOutputService5TestCaseOperation1Input) (output *OutputService5TestShapeOutputShape, err error) { + req, out := c.OutputService5TestCaseOperation1Request(input) + output = out + err = req.Send() + return +} + +var opOutputService5TestCaseOperation1 *aws.Operation + +type OutputService5TestShapeOutputService5TestCaseOperation1Input struct { + metadataOutputService5TestShapeOutputService5TestCaseOperation1Input `json:"-" xml:"-"` +} + +type metadataOutputService5TestShapeOutputService5TestCaseOperation1Input struct { + SDKShapeTraits bool `type:"structure"` +} + +type OutputService5TestShapeOutputShape struct { + ListMember []*string `type:"list" flattened:"true"` + + metadataOutputService5TestShapeOutputShape `json:"-" xml:"-"` +} + +type metadataOutputService5TestShapeOutputShape struct { + SDKShapeTraits bool `type:"structure"` +} + +// OutputService6ProtocolTest is a client for OutputService6ProtocolTest. +type OutputService6ProtocolTest struct { + *aws.Service +} + +// New returns a new OutputService6ProtocolTest client. +func NewOutputService6ProtocolTest(config *aws.Config) *OutputService6ProtocolTest { + if config == nil { + config = &aws.Config{} + } + + service := &aws.Service{ + Config: aws.DefaultConfig.Merge(config), + ServiceName: "outputservice6protocoltest", + APIVersion: "", + } + service.Initialize() + + // Handlers + service.Handlers.Sign.PushBack(v4.Sign) + service.Handlers.Build.PushBack(ec2query.Build) + service.Handlers.Unmarshal.PushBack(ec2query.Unmarshal) + service.Handlers.UnmarshalMeta.PushBack(ec2query.UnmarshalMeta) + service.Handlers.UnmarshalError.PushBack(ec2query.UnmarshalError) + + return &OutputService6ProtocolTest{service} +} + +// newRequest creates a new request for a OutputService6ProtocolTest operation and runs any +// custom request initialization. +func (c *OutputService6ProtocolTest) newRequest(op *aws.Operation, params, data interface{}) *aws.Request { + req := aws.NewRequest(c.Service, op, params, data) + + return req +} + +// OutputService6TestCaseOperation1Request generates a request for the OutputService6TestCaseOperation1 operation. +func (c *OutputService6ProtocolTest) OutputService6TestCaseOperation1Request(input *OutputService6TestShapeOutputService6TestCaseOperation1Input) (req *aws.Request, output *OutputService6TestShapeOutputShape) { + + if opOutputService6TestCaseOperation1 == nil { + opOutputService6TestCaseOperation1 = &aws.Operation{ + Name: "OperationName", + } + } + + if input == nil { + input = &OutputService6TestShapeOutputService6TestCaseOperation1Input{} + } + + req = c.newRequest(opOutputService6TestCaseOperation1, input, output) + output = &OutputService6TestShapeOutputShape{} + req.Data = output + return +} + +func (c *OutputService6ProtocolTest) OutputService6TestCaseOperation1(input *OutputService6TestShapeOutputService6TestCaseOperation1Input) (output *OutputService6TestShapeOutputShape, err error) { + req, out := c.OutputService6TestCaseOperation1Request(input) + output = out + err = req.Send() + return +} + +var opOutputService6TestCaseOperation1 *aws.Operation + +type OutputService6TestShapeOutputService6TestCaseOperation1Input struct { + metadataOutputService6TestShapeOutputService6TestCaseOperation1Input `json:"-" xml:"-"` +} + +type metadataOutputService6TestShapeOutputService6TestCaseOperation1Input struct { + SDKShapeTraits bool `type:"structure"` +} + +type OutputService6TestShapeOutputShape struct { + Map *map[string]*OutputService6TestShapeStructureType `type:"map"` + + metadataOutputService6TestShapeOutputShape `json:"-" xml:"-"` +} + +type metadataOutputService6TestShapeOutputShape struct { + SDKShapeTraits bool `type:"structure"` +} + +type OutputService6TestShapeStructureType struct { + Foo *string `locationName:"foo" type:"string"` + + metadataOutputService6TestShapeStructureType `json:"-" xml:"-"` +} + +type metadataOutputService6TestShapeStructureType struct { + SDKShapeTraits bool `type:"structure"` +} + +// OutputService7ProtocolTest is a client for OutputService7ProtocolTest. +type OutputService7ProtocolTest struct { + *aws.Service +} + +// New returns a new OutputService7ProtocolTest client. +func NewOutputService7ProtocolTest(config *aws.Config) *OutputService7ProtocolTest { + if config == nil { + config = &aws.Config{} + } + + service := &aws.Service{ + Config: aws.DefaultConfig.Merge(config), + ServiceName: "outputservice7protocoltest", + APIVersion: "", + } + service.Initialize() + + // Handlers + service.Handlers.Sign.PushBack(v4.Sign) + service.Handlers.Build.PushBack(ec2query.Build) + service.Handlers.Unmarshal.PushBack(ec2query.Unmarshal) + service.Handlers.UnmarshalMeta.PushBack(ec2query.UnmarshalMeta) + service.Handlers.UnmarshalError.PushBack(ec2query.UnmarshalError) + + return &OutputService7ProtocolTest{service} +} + +// newRequest creates a new request for a OutputService7ProtocolTest operation and runs any +// custom request initialization. +func (c *OutputService7ProtocolTest) newRequest(op *aws.Operation, params, data interface{}) *aws.Request { + req := aws.NewRequest(c.Service, op, params, data) + + return req +} + +// OutputService7TestCaseOperation1Request generates a request for the OutputService7TestCaseOperation1 operation. +func (c *OutputService7ProtocolTest) OutputService7TestCaseOperation1Request(input *OutputService7TestShapeOutputService7TestCaseOperation1Input) (req *aws.Request, output *OutputService7TestShapeOutputShape) { + + if opOutputService7TestCaseOperation1 == nil { + opOutputService7TestCaseOperation1 = &aws.Operation{ + Name: "OperationName", + } + } + + if input == nil { + input = &OutputService7TestShapeOutputService7TestCaseOperation1Input{} + } + + req = c.newRequest(opOutputService7TestCaseOperation1, input, output) + output = &OutputService7TestShapeOutputShape{} + req.Data = output + return +} + +func (c *OutputService7ProtocolTest) OutputService7TestCaseOperation1(input *OutputService7TestShapeOutputService7TestCaseOperation1Input) (output *OutputService7TestShapeOutputShape, err error) { + req, out := c.OutputService7TestCaseOperation1Request(input) + output = out + err = req.Send() + return +} + +var opOutputService7TestCaseOperation1 *aws.Operation + +type OutputService7TestShapeOutputService7TestCaseOperation1Input struct { + metadataOutputService7TestShapeOutputService7TestCaseOperation1Input `json:"-" xml:"-"` +} + +type metadataOutputService7TestShapeOutputService7TestCaseOperation1Input struct { + SDKShapeTraits bool `type:"structure"` +} + +type OutputService7TestShapeOutputShape struct { + Map *map[string]*string `type:"map" flattened:"true"` + + metadataOutputService7TestShapeOutputShape `json:"-" xml:"-"` +} + +type metadataOutputService7TestShapeOutputShape struct { + SDKShapeTraits bool `type:"structure"` +} + +// OutputService8ProtocolTest is a client for OutputService8ProtocolTest. +type OutputService8ProtocolTest struct { + *aws.Service +} + +// New returns a new OutputService8ProtocolTest client. +func NewOutputService8ProtocolTest(config *aws.Config) *OutputService8ProtocolTest { + if config == nil { + config = &aws.Config{} + } + + service := &aws.Service{ + Config: aws.DefaultConfig.Merge(config), + ServiceName: "outputservice8protocoltest", + APIVersion: "", + } + service.Initialize() + + // Handlers + service.Handlers.Sign.PushBack(v4.Sign) + service.Handlers.Build.PushBack(ec2query.Build) + service.Handlers.Unmarshal.PushBack(ec2query.Unmarshal) + service.Handlers.UnmarshalMeta.PushBack(ec2query.UnmarshalMeta) + service.Handlers.UnmarshalError.PushBack(ec2query.UnmarshalError) + + return &OutputService8ProtocolTest{service} +} + +// newRequest creates a new request for a OutputService8ProtocolTest operation and runs any +// custom request initialization. +func (c *OutputService8ProtocolTest) newRequest(op *aws.Operation, params, data interface{}) *aws.Request { + req := aws.NewRequest(c.Service, op, params, data) + + return req +} + +// OutputService8TestCaseOperation1Request generates a request for the OutputService8TestCaseOperation1 operation. +func (c *OutputService8ProtocolTest) OutputService8TestCaseOperation1Request(input *OutputService8TestShapeOutputService8TestCaseOperation1Input) (req *aws.Request, output *OutputService8TestShapeOutputShape) { + + if opOutputService8TestCaseOperation1 == nil { + opOutputService8TestCaseOperation1 = &aws.Operation{ + Name: "OperationName", + } + } + + if input == nil { + input = &OutputService8TestShapeOutputService8TestCaseOperation1Input{} + } + + req = c.newRequest(opOutputService8TestCaseOperation1, input, output) + output = &OutputService8TestShapeOutputShape{} + req.Data = output + return +} + +func (c *OutputService8ProtocolTest) OutputService8TestCaseOperation1(input *OutputService8TestShapeOutputService8TestCaseOperation1Input) (output *OutputService8TestShapeOutputShape, err error) { + req, out := c.OutputService8TestCaseOperation1Request(input) + output = out + err = req.Send() + return +} + +var opOutputService8TestCaseOperation1 *aws.Operation + +type OutputService8TestShapeOutputService8TestCaseOperation1Input struct { + metadataOutputService8TestShapeOutputService8TestCaseOperation1Input `json:"-" xml:"-"` +} + +type metadataOutputService8TestShapeOutputService8TestCaseOperation1Input struct { + SDKShapeTraits bool `type:"structure"` +} + +type OutputService8TestShapeOutputShape struct { + Map *map[string]*string `locationNameKey:"foo" locationNameValue:"bar" type:"map" flattened:"true"` + + metadataOutputService8TestShapeOutputShape `json:"-" xml:"-"` +} + +type metadataOutputService8TestShapeOutputShape struct { + SDKShapeTraits bool `type:"structure"` +} + +// +// Tests begin here +// + +func TestOutputService1ProtocolTestScalarMembersCase1(t *testing.T) { + svc := NewOutputService1ProtocolTest(nil) + + buf := bytes.NewReader([]byte("myname123falsetrue1.21.3200arequest-id")) + req, out := svc.OutputService1TestCaseOperation1Request(nil) + req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} + + // set headers + + // unmarshal response + ec2query.UnmarshalMeta(req) + ec2query.Unmarshal(req) + assert.NoError(t, req.Error) + + // assert response + assert.NotNil(t, out) // ensure out variable is used + assert.Equal(t, "a", *out.Char) + assert.Equal(t, 1.3, *out.Double) + assert.Equal(t, false, *out.FalseBool) + assert.Equal(t, 1.2, *out.Float) + assert.Equal(t, int64(200), *out.Long) + assert.Equal(t, int64(123), *out.Num) + assert.Equal(t, "myname", *out.Str) + assert.Equal(t, true, *out.TrueBool) + +} + +func TestOutputService2ProtocolTestBlobCase1(t *testing.T) { + svc := NewOutputService2ProtocolTest(nil) + + buf := bytes.NewReader([]byte("dmFsdWU=requestid")) + req, out := svc.OutputService2TestCaseOperation1Request(nil) + req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} + + // set headers + + // unmarshal response + ec2query.UnmarshalMeta(req) + ec2query.Unmarshal(req) + assert.NoError(t, req.Error) + + // assert response + assert.NotNil(t, out) // ensure out variable is used + assert.Equal(t, "value", string(out.Blob)) + +} + +func TestOutputService3ProtocolTestListsCase1(t *testing.T) { + svc := NewOutputService3ProtocolTest(nil) + + buf := bytes.NewReader([]byte("abc123requestid")) + req, out := svc.OutputService3TestCaseOperation1Request(nil) + req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} + + // set headers + + // unmarshal response + ec2query.UnmarshalMeta(req) + ec2query.Unmarshal(req) + assert.NoError(t, req.Error) + + // assert response + assert.NotNil(t, out) // ensure out variable is used + assert.Equal(t, "abc", *out.ListMember[0]) + assert.Equal(t, "123", *out.ListMember[1]) + +} + +func TestOutputService4ProtocolTestListWithCustomMemberNameCase1(t *testing.T) { + svc := NewOutputService4ProtocolTest(nil) + + buf := bytes.NewReader([]byte("abc123requestid")) + req, out := svc.OutputService4TestCaseOperation1Request(nil) + req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} + + // set headers + + // unmarshal response + ec2query.UnmarshalMeta(req) + ec2query.Unmarshal(req) + assert.NoError(t, req.Error) + + // assert response + assert.NotNil(t, out) // ensure out variable is used + assert.Equal(t, "abc", *out.ListMember[0]) + assert.Equal(t, "123", *out.ListMember[1]) + +} + +func TestOutputService5ProtocolTestFlattenedListCase1(t *testing.T) { + svc := NewOutputService5ProtocolTest(nil) + + buf := bytes.NewReader([]byte("abc123requestid")) + req, out := svc.OutputService5TestCaseOperation1Request(nil) + req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} + + // set headers + + // unmarshal response + ec2query.UnmarshalMeta(req) + ec2query.Unmarshal(req) + assert.NoError(t, req.Error) + + // assert response + assert.NotNil(t, out) // ensure out variable is used + assert.Equal(t, "abc", *out.ListMember[0]) + assert.Equal(t, "123", *out.ListMember[1]) + +} + +func TestOutputService6ProtocolTestNormalMapCase1(t *testing.T) { + svc := NewOutputService6ProtocolTest(nil) + + buf := bytes.NewReader([]byte("quxbarbazbamrequestid")) + req, out := svc.OutputService6TestCaseOperation1Request(nil) + req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} + + // set headers + + // unmarshal response + ec2query.UnmarshalMeta(req) + ec2query.Unmarshal(req) + assert.NoError(t, req.Error) + + // assert response + assert.NotNil(t, out) // ensure out variable is used + assert.Equal(t, "bam", *(*out.Map)["baz"].Foo) + assert.Equal(t, "bar", *(*out.Map)["qux"].Foo) + +} + +func TestOutputService7ProtocolTestFlattenedMapCase1(t *testing.T) { + svc := NewOutputService7ProtocolTest(nil) + + buf := bytes.NewReader([]byte("quxbarbazbamrequestid")) + req, out := svc.OutputService7TestCaseOperation1Request(nil) + req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} + + // set headers + + // unmarshal response + ec2query.UnmarshalMeta(req) + ec2query.Unmarshal(req) + assert.NoError(t, req.Error) + + // assert response + assert.NotNil(t, out) // ensure out variable is used + assert.Equal(t, "bam", *(*out.Map)["baz"]) + assert.Equal(t, "bar", *(*out.Map)["qux"]) + +} + +func TestOutputService8ProtocolTestNamedMapCase1(t *testing.T) { + svc := NewOutputService8ProtocolTest(nil) + + buf := bytes.NewReader([]byte("quxbarbazbamrequestid")) + req, out := svc.OutputService8TestCaseOperation1Request(nil) + req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} + + // set headers + + // unmarshal response + ec2query.UnmarshalMeta(req) + ec2query.Unmarshal(req) + assert.NoError(t, req.Error) + + // assert response + assert.NotNil(t, out) // ensure out variable is used + assert.Equal(t, "bam", *(*out.Map)["baz"]) + assert.Equal(t, "bar", *(*out.Map)["qux"]) + +} + diff --git a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/internal/protocol/query/queryutil/queryutil.go b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/internal/protocol/query/queryutil/queryutil.go new file mode 100644 index 00000000000..3b417a89f71 --- /dev/null +++ b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/internal/protocol/query/queryutil/queryutil.go @@ -0,0 +1,223 @@ +package queryutil + +import ( + "encoding/base64" + "fmt" + "net/url" + "reflect" + "sort" + "strconv" + "strings" + "time" +) + +// Parse parses an object i and fills a url.Values object. The isEC2 flag +// indicates if this is the EC2 Query sub-protocol. +func Parse(body url.Values, i interface{}, isEC2 bool) error { + q := queryParser{isEC2: isEC2} + return q.parseValue(body, reflect.ValueOf(i), "", "") +} + +func elemOf(value reflect.Value) reflect.Value { + for value.Kind() == reflect.Ptr { + value = value.Elem() + } + return value +} + +type queryParser struct { + isEC2 bool +} + +func (q *queryParser) parseValue(v url.Values, value reflect.Value, prefix string, tag reflect.StructTag) error { + value = elemOf(value) + + // no need to handle zero values + if !value.IsValid() { + return nil + } + + t := tag.Get("type") + if t == "" { + switch value.Kind() { + case reflect.Struct: + t = "structure" + case reflect.Slice: + t = "list" + case reflect.Map: + t = "map" + } + } + + switch t { + case "structure": + return q.parseStruct(v, value, prefix) + case "list": + return q.parseList(v, value, prefix, tag) + case "map": + return q.parseMap(v, value, prefix, tag) + default: + return q.parseScalar(v, value, prefix, tag) + } +} + +func (q *queryParser) parseStruct(v url.Values, value reflect.Value, prefix string) error { + if !value.IsValid() { + return nil + } + + t := value.Type() + for i := 0; i < value.NumField(); i++ { + if c := t.Field(i).Name[0:1]; strings.ToLower(c) == c { + continue // ignore unexported fields + } + + value := elemOf(value.Field(i)) + field := t.Field(i) + var name string + + if q.isEC2 { + name = field.Tag.Get("queryName") + } + if name == "" { + if field.Tag.Get("flattened") != "" && field.Tag.Get("locationNameList") != "" { + name = field.Tag.Get("locationNameList") + } else if locName := field.Tag.Get("locationName"); locName != "" { + name = locName + } + if name != "" && q.isEC2 { + name = strings.ToUpper(name[0:1]) + name[1:] + } + } + if name == "" { + name = field.Name + } + + if prefix != "" { + name = prefix + "." + name + } + + if err := q.parseValue(v, value, name, field.Tag); err != nil { + return err + } + } + return nil +} + +func (q *queryParser) parseList(v url.Values, value reflect.Value, prefix string, tag reflect.StructTag) error { + // If it's empty, generate an empty value + if !value.IsNil() && value.Len() == 0 { + v.Set(prefix, "") + return nil + } + + // check for unflattened list member + if !q.isEC2 && tag.Get("flattened") == "" { + prefix += ".member" + } + + for i := 0; i < value.Len(); i++ { + slicePrefix := prefix + if slicePrefix == "" { + slicePrefix = strconv.Itoa(i + 1) + } else { + slicePrefix = slicePrefix + "." + strconv.Itoa(i+1) + } + if err := q.parseValue(v, value.Index(i), slicePrefix, ""); err != nil { + return err + } + } + return nil +} + +func (q *queryParser) parseMap(v url.Values, value reflect.Value, prefix string, tag reflect.StructTag) error { + // If it's empty, generate an empty value + if !value.IsNil() && value.Len() == 0 { + v.Set(prefix, "") + return nil + } + + // check for unflattened list member + if !q.isEC2 && tag.Get("flattened") == "" { + prefix += ".entry" + } + + // sort keys for improved serialization consistency. + // this is not strictly necessary for protocol support. + mapKeyValues := value.MapKeys() + mapKeys := map[string]reflect.Value{} + mapKeyNames := make([]string, len(mapKeyValues)) + for i, mapKey := range mapKeyValues { + name := mapKey.String() + mapKeys[name] = mapKey + mapKeyNames[i] = name + } + sort.Strings(mapKeyNames) + + for i, mapKeyName := range mapKeyNames { + mapKey := mapKeys[mapKeyName] + mapValue := value.MapIndex(mapKey) + + kname := tag.Get("locationNameKey") + if kname == "" { + kname = "key" + } + vname := tag.Get("locationNameValue") + if vname == "" { + vname = "value" + } + + // serialize key + var keyName string + if prefix == "" { + keyName = strconv.Itoa(i+1) + "." + kname + } else { + keyName = prefix + "." + strconv.Itoa(i+1) + "." + kname + } + + if err := q.parseValue(v, mapKey, keyName, ""); err != nil { + return err + } + + // serialize value + var valueName string + if prefix == "" { + valueName = strconv.Itoa(i+1) + "." + vname + } else { + valueName = prefix + "." + strconv.Itoa(i+1) + "." + vname + } + + if err := q.parseValue(v, mapValue, valueName, ""); err != nil { + return err + } + } + + return nil +} + +func (q *queryParser) parseScalar(v url.Values, r reflect.Value, name string, tag reflect.StructTag) error { + switch value := r.Interface().(type) { + case string: + v.Set(name, value) + case []byte: + if !r.IsNil() { + v.Set(name, base64.StdEncoding.EncodeToString(value)) + } + case bool: + v.Set(name, strconv.FormatBool(value)) + case int64: + v.Set(name, strconv.FormatInt(value, 10)) + case int: + v.Set(name, strconv.Itoa(value)) + case float64: + v.Set(name, strconv.FormatFloat(value, 'f', -1, 64)) + case float32: + v.Set(name, strconv.FormatFloat(float64(value), 'f', -1, 32)) + case time.Time: + const ISO8601UTC = "2006-01-02T15:04:05Z" + v.Set(name, value.UTC().Format(ISO8601UTC)) + default: + return fmt.Errorf("unsupported value for param %s: %v (%s)", name, r.Interface(), r.Type().Name()) + } + return nil +} diff --git a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/internal/protocol/xml/xmlutil/build.go b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/internal/protocol/xml/xmlutil/build.go new file mode 100644 index 00000000000..8791bfdabff --- /dev/null +++ b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/internal/protocol/xml/xmlutil/build.go @@ -0,0 +1,286 @@ +package xmlutil + +import ( + "encoding/base64" + "encoding/xml" + "fmt" + "reflect" + "sort" + "strconv" + "strings" + "time" +) + +// BuildXML will serialize params into an xml.Encoder. +// Error will be returned if the serialization of any of the params or nested values fails. +func BuildXML(params interface{}, e *xml.Encoder) error { + b := xmlBuilder{encoder: e, namespaces: map[string]string{}} + root := NewXMLElement(xml.Name{}) + if err := b.buildValue(reflect.ValueOf(params), root, ""); err != nil { + return err + } + for _, c := range root.Children { + for _, v := range c { + return StructToXML(e, v, false) + } + } + return nil +} + +// Returns the reflection element of a value, if it is a pointer. +func elemOf(value reflect.Value) reflect.Value { + for value.Kind() == reflect.Ptr { + value = value.Elem() + } + return value +} + +// A xmlBuilder serializes values from Go code to XML +type xmlBuilder struct { + encoder *xml.Encoder + namespaces map[string]string +} + +// buildValue generic XMLNode builder for any type. Will build value for their specific type +// struct, list, map, scalar. +// +// Also takes a "type" tag value to set what type a value should be converted to XMLNode as. If +// type is not provided reflect will be used to determine the value's type. +func (b *xmlBuilder) buildValue(value reflect.Value, current *XMLNode, tag reflect.StructTag) error { + value = elemOf(value) + if !value.IsValid() { // no need to handle zero values + return nil + } else if tag.Get("location") != "" { // don't handle non-body location values + return nil + } + + t := tag.Get("type") + if t == "" { + switch value.Kind() { + case reflect.Struct: + t = "structure" + case reflect.Slice: + t = "list" + case reflect.Map: + t = "map" + } + } + + switch t { + case "structure": + if field, ok := value.Type().FieldByName("SDKShapeTraits"); ok { + tag = tag + reflect.StructTag(" ") + field.Tag + } + return b.buildStruct(value, current, tag) + case "list": + return b.buildList(value, current, tag) + case "map": + return b.buildMap(value, current, tag) + default: + return b.buildScalar(value, current, tag) + } +} + +// buildStruct adds a struct and its fields to the current XMLNode. All fields any any nested +// types are converted to XMLNodes also. +func (b *xmlBuilder) buildStruct(value reflect.Value, current *XMLNode, tag reflect.StructTag) error { + if !value.IsValid() { + return nil + } + + fieldAdded := false + + // unwrap payloads + if payload := tag.Get("payload"); payload != "" { + field, _ := value.Type().FieldByName(payload) + tag = field.Tag + value = elemOf(value.FieldByName(payload)) + + if !value.IsValid() { + return nil + } + } + + child := NewXMLElement(xml.Name{Local: tag.Get("locationName")}) + + // there is an xmlNamespace associated with this struct + if prefix, uri := tag.Get("xmlPrefix"), tag.Get("xmlURI"); uri != "" { + ns := xml.Attr{ + Name: xml.Name{Local: "xmlns"}, + Value: uri, + } + if prefix != "" { + b.namespaces[prefix] = uri // register the namespace + ns.Name.Local = "xmlns:" + prefix + } + + child.Attr = append(child.Attr, ns) + } + + t := value.Type() + for i := 0; i < value.NumField(); i++ { + if c := t.Field(i).Name[0:1]; strings.ToLower(c) == c { + 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 + } + + memberName := mTag.Get("locationName") + if memberName == "" { + memberName = field.Name + mTag = reflect.StructTag(string(mTag) + ` locationName:"` + memberName + `"`) + } + if err := b.buildValue(member, child, mTag); err != nil { + return err + } + + fieldAdded = true + } + + if fieldAdded { // only append this child if we have one ore more valid members + current.AddChild(child) + } + + return nil +} + +// buildList adds the value's list items to the current XMLNode as children nodes. All +// nested values in the list are converted to XMLNodes also. +func (b *xmlBuilder) buildList(value reflect.Value, current *XMLNode, tag reflect.StructTag) error { + if value.IsNil() { // don't build omitted lists + return nil + } + + // check for unflattened list member + flattened := tag.Get("flattened") != "" + + xname := xml.Name{Local: tag.Get("locationName")} + if flattened { + for i := 0; i < value.Len(); i++ { + child := NewXMLElement(xname) + current.AddChild(child) + if err := b.buildValue(value.Index(i), child, ""); err != nil { + return err + } + } + } else { + list := NewXMLElement(xname) + current.AddChild(list) + + for i := 0; i < value.Len(); i++ { + iname := tag.Get("locationNameList") + if iname == "" { + iname = "member" + } + + child := NewXMLElement(xml.Name{Local: iname}) + list.AddChild(child) + if err := b.buildValue(value.Index(i), child, ""); err != nil { + return err + } + } + } + + return nil +} + +// buildMap adds the value's key/value pairs to the current XMLNode as children nodes. All +// nested values in the map are converted to XMLNodes also. +// +// Error will be returned if it is unable to build the map's values into XMLNodes +func (b *xmlBuilder) buildMap(value reflect.Value, current *XMLNode, tag reflect.StructTag) error { + if value.IsNil() { // don't build omitted maps + return nil + } + + maproot := NewXMLElement(xml.Name{Local: tag.Get("locationName")}) + current.AddChild(maproot) + current = maproot + + kname, vname := "key", "value" + if n := tag.Get("locationNameKey"); n != "" { + kname = n + } + if n := tag.Get("locationNameValue"); n != "" { + vname = n + } + + // sorting is not required for compliance, but it makes testing easier + keys := make([]string, value.Len()) + for i, k := range value.MapKeys() { + keys[i] = k.String() + } + sort.Strings(keys) + + for _, k := range keys { + v := value.MapIndex(reflect.ValueOf(k)) + + mapcur := current + if tag.Get("flattened") == "" { // add "entry" tag to non-flat maps + child := NewXMLElement(xml.Name{Local: "entry"}) + mapcur.AddChild(child) + mapcur = child + } + + kchild := NewXMLElement(xml.Name{Local: kname}) + kchild.Text = k + vchild := NewXMLElement(xml.Name{Local: vname}) + mapcur.AddChild(kchild) + mapcur.AddChild(vchild) + + if err := b.buildValue(v, vchild, ""); err != nil { + return err + } + } + + return nil +} + +// buildScalar will convert the value into a string and append it as a attribute or child +// of the current XMLNode. +// +// The value will be added as an attribute if tag contains a "xmlAttribute" attribute value. +// +// Error will be returned if the value type is unsupported. +func (b *xmlBuilder) buildScalar(value reflect.Value, current *XMLNode, tag reflect.StructTag) error { + var str string + switch converted := value.Interface().(type) { + case string: + str = converted + case []byte: + if !value.IsNil() { + str = base64.StdEncoding.EncodeToString(converted) + } + case bool: + str = strconv.FormatBool(converted) + case int64: + str = strconv.FormatInt(converted, 10) + case int: + str = strconv.Itoa(converted) + case float64: + str = strconv.FormatFloat(converted, 'f', -1, 64) + case float32: + str = strconv.FormatFloat(float64(converted), 'f', -1, 32) + case time.Time: + const ISO8601UTC = "2006-01-02T15:04:05Z" + str = converted.UTC().Format(ISO8601UTC) + default: + return fmt.Errorf("unsupported value for param %s: %v (%s)", + tag.Get("locationName"), value.Interface(), value.Type().Name()) + } + + xname := xml.Name{Local: tag.Get("locationName")} + if tag.Get("xmlAttribute") != "" { // put into current node's attribute list + attr := xml.Attr{Name: xname, Value: str} + current.Attr = append(current.Attr, attr) + } else { // regular text node + current.AddChild(&XMLNode{Name: xname, Text: str}) + } + return nil +} diff --git a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/internal/protocol/xml/xmlutil/unmarshal.go b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/internal/protocol/xml/xmlutil/unmarshal.go new file mode 100644 index 00000000000..a84b269a467 --- /dev/null +++ b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/internal/protocol/xml/xmlutil/unmarshal.go @@ -0,0 +1,267 @@ +package xmlutil + +import ( + "encoding/base64" + "encoding/xml" + "fmt" + "io" + "reflect" + "strconv" + "strings" + "time" +) + +// UnmarshalXML deserializes an xml.Decoder into the container v. V +// needs to match the shape of the XML expected to be decoded. +// If the shape doesn't match unmarshaling will fail. +func UnmarshalXML(v interface{}, d *xml.Decoder, wrapper string) error { + n, _ := XMLToStruct(d, nil) + if n.Children != nil { + for _, root := range n.Children { + for _, c := range root { + if wrappedChild, ok := c.Children[wrapper]; ok { + c = wrappedChild[0] // pull out wrapped element + } + + err := parse(reflect.ValueOf(v), c, "") + if err != nil { + if err == io.EOF { + return nil + } + return err + } + } + } + return nil + } + return nil +} + +// parse deserializes any value from the XMLNode. The type tag is used to infer the type, or reflect +// will be used to determine the type from r. +func parse(r reflect.Value, node *XMLNode, tag reflect.StructTag) error { + rtype := r.Type() + if rtype.Kind() == reflect.Ptr { + rtype = rtype.Elem() // check kind of actual element type + } + + t := tag.Get("type") + if t == "" { + switch rtype.Kind() { + case reflect.Struct: + t = "structure" + case reflect.Slice: + t = "list" + case reflect.Map: + t = "map" + } + } + + switch t { + case "structure": + if field, ok := rtype.FieldByName("SDKShapeTraits"); ok { + tag = field.Tag + } + return parseStruct(r, node, tag) + case "list": + return parseList(r, node, tag) + case "map": + return parseMap(r, node, tag) + default: + return parseScalar(r, node, tag) + } +} + +// parseStruct deserializes a structure and its fields from an XMLNode. Any nested +// types in the structure will also be deserialized. +func parseStruct(r reflect.Value, node *XMLNode, tag reflect.StructTag) error { + t := r.Type() + if r.Kind() == reflect.Ptr { + if r.IsNil() { // create the structure if it's nil + s := reflect.New(r.Type().Elem()) + r.Set(s) + r = s + } + + r = r.Elem() + t = t.Elem() + } + + // unwrap any payloads + if payload := tag.Get("payload"); payload != "" { + field, _ := t.FieldByName(payload) + return parseStruct(r.FieldByName(payload), node, field.Tag) + } + + for i := 0; i < t.NumField(); i++ { + field := t.Field(i) + if c := field.Name[0:1]; strings.ToLower(c) == c { + continue // ignore unexported fields + } + + // figure out what this field is called + name := field.Name + if field.Tag.Get("flattened") != "" && field.Tag.Get("locationNameList") != "" { + name = field.Tag.Get("locationNameList") + } else if locName := field.Tag.Get("locationName"); locName != "" { + name = locName + } + + // try to find the field by name in elements + elems := node.Children[name] + + if elems == nil { // try to find the field in attributes + for _, a := range node.Attr { + if name == a.Name.Local { + // turn this into a text node for de-serializing + elems = []*XMLNode{&XMLNode{Text: a.Value}} + } + } + } + + member := r.FieldByName(field.Name) + for _, elem := range elems { + err := parse(member, elem, field.Tag) + if err != nil { + return err + } + } + } + return nil +} + +// parseList deserializes a list of values from an XML node. Each list entry +// will also be deserialized. +func parseList(r reflect.Value, node *XMLNode, tag reflect.StructTag) error { + t := r.Type() + + if tag.Get("flattened") == "" { // look at all item entries + mname := "member" + if name := tag.Get("locationNameList"); name != "" { + mname = name + } + + if Children, ok := node.Children[mname]; ok { + if r.IsNil() { + r.Set(reflect.MakeSlice(t, len(Children), len(Children))) + } + + for i, c := range Children { + err := parse(r.Index(i), c, "") + if err != nil { + return err + } + } + } + } else { // flattened list means this is a single element + if r.IsNil() { + r.Set(reflect.MakeSlice(t, 0, 0)) + } + + childR := reflect.Zero(t.Elem()) + r.Set(reflect.Append(r, childR)) + err := parse(r.Index(r.Len()-1), node, "") + if err != nil { + return err + } + } + + return nil +} + +// parseMap deserializes a map from an XMLNode. The direct children of the XMLNode +// will also be deserialized as map entries. +func parseMap(r reflect.Value, node *XMLNode, tag reflect.StructTag) error { + t := r.Type() + if r.Kind() == reflect.Ptr { + t = t.Elem() + if r.IsNil() { + r.Set(reflect.New(t)) + r.Elem().Set(reflect.MakeMap(t)) + } + + r = r.Elem() + } + + if tag.Get("flattened") == "" { // look at all child entries + for _, entry := range node.Children["entry"] { + parseMapEntry(r, entry, tag) + } + } else { // this element is itself an entry + parseMapEntry(r, node, tag) + } + + return nil +} + +// parseMapEntry deserializes a map entry from a XML node. +func parseMapEntry(r reflect.Value, node *XMLNode, tag reflect.StructTag) error { + kname, vname := "key", "value" + if n := tag.Get("locationNameKey"); n != "" { + kname = n + } + if n := tag.Get("locationNameValue"); n != "" { + vname = n + } + + keys, ok := node.Children[kname] + values := node.Children[vname] + if ok { + for i, key := range keys { + keyR := reflect.ValueOf(key.Text) + value := values[i] + valueR := reflect.New(r.Type().Elem()).Elem() + + parse(valueR, value, "") + r.SetMapIndex(keyR, valueR) + } + } + return nil +} + +// parseScaller deserializes an XMLNode value into a concrete type based on the +// interface type of r. +// +// Error is returned if the deserialization fails due to invalid type conversion, +// or unsupported interface type. +func parseScalar(r reflect.Value, node *XMLNode, tag reflect.StructTag) error { + switch r.Interface().(type) { + case *string: + r.Set(reflect.ValueOf(&node.Text)) + return nil + case []byte: + b, err := base64.StdEncoding.DecodeString(node.Text) + if err != nil { + return err + } + r.Set(reflect.ValueOf(b)) + case *bool: + v, err := strconv.ParseBool(node.Text) + if err != nil { + return err + } + r.Set(reflect.ValueOf(&v)) + case *int64: + v, err := strconv.ParseInt(node.Text, 10, 64) + if err != nil { + return err + } + r.Set(reflect.ValueOf(&v)) + case *float64: + v, err := strconv.ParseFloat(node.Text, 64) + if err != nil { + return err + } + r.Set(reflect.ValueOf(&v)) + case *time.Time: + const ISO8601UTC = "2006-01-02T15:04:05Z" + t, err := time.Parse(ISO8601UTC, node.Text) + if err != nil { + return err + } + r.Set(reflect.ValueOf(&t)) + default: + return fmt.Errorf("unsupported value: %v (%s)", r.Interface(), r.Type()) + } + return nil +} diff --git a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/internal/protocol/xml/xmlutil/xml_to_struct.go b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/internal/protocol/xml/xmlutil/xml_to_struct.go new file mode 100644 index 00000000000..72c198a9d8d --- /dev/null +++ b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/internal/protocol/xml/xmlutil/xml_to_struct.go @@ -0,0 +1,105 @@ +package xmlutil + +import ( + "encoding/xml" + "io" + "sort" +) + +// A XMLNode contains the values to be encoded or decoded. +type XMLNode struct { + Name xml.Name `json:",omitempty"` + Children map[string][]*XMLNode `json:",omitempty"` + Text string `json:",omitempty"` + Attr []xml.Attr `json:",omitempty"` +} + +// NewXMLElement returns a pointer to a new XMLNode initialized to default values. +func NewXMLElement(name xml.Name) *XMLNode { + return &XMLNode{ + Name: name, + Children: map[string][]*XMLNode{}, + Attr: []xml.Attr{}, + } +} + +// AddChild adds child to the XMLNode. +func (n *XMLNode) AddChild(child *XMLNode) { + if _, ok := n.Children[child.Name.Local]; !ok { + n.Children[child.Name.Local] = []*XMLNode{} + } + n.Children[child.Name.Local] = append(n.Children[child.Name.Local], child) +} + +// XMLToStruct converts a xml.Decoder stream to XMLNode with nested values. +func XMLToStruct(d *xml.Decoder, s *xml.StartElement) (*XMLNode, error) { + out := &XMLNode{} + for { + tok, err := d.Token() + if tok == nil || err == io.EOF { + break + } + if err != nil { + return out, err + } + + switch typed := tok.(type) { + case xml.CharData: + out.Text = string(typed.Copy()) + case xml.StartElement: + el := typed.Copy() + out.Attr = el.Attr + if out.Children == nil { + out.Children = map[string][]*XMLNode{} + } + + name := typed.Name.Local + slice := out.Children[name] + if slice == nil { + slice = []*XMLNode{} + } + node, e := XMLToStruct(d, &el) + if e != nil { + return out, e + } + node.Name = typed.Name + slice = append(slice, node) + out.Children[name] = slice + case xml.EndElement: + if s != nil && s.Name.Local == typed.Name.Local { // matching end token + return out, nil + } + } + } + return out, nil +} + +// StructToXML writes an XMLNode to a xml.Encoder as tokens. +func StructToXML(e *xml.Encoder, node *XMLNode, sorted bool) error { + e.EncodeToken(xml.StartElement{Name: node.Name, Attr: node.Attr}) + + if node.Text != "" { + e.EncodeToken(xml.CharData([]byte(node.Text))) + } else if sorted { + sortedNames := []string{} + for k := range node.Children { + sortedNames = append(sortedNames, k) + } + sort.Strings(sortedNames) + + for _, k := range sortedNames { + for _, v := range node.Children[k] { + StructToXML(e, v, sorted) + } + } + } else { + for _, c := range node.Children { + for _, v := range c { + StructToXML(e, v, sorted) + } + } + } + + e.EncodeToken(xml.EndElement{Name: node.Name}) + return e.Flush() +} diff --git a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/internal/signer/v4/functional_test.go b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/internal/signer/v4/functional_test.go new file mode 100644 index 00000000000..1d51135162b --- /dev/null +++ b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/internal/signer/v4/functional_test.go @@ -0,0 +1,45 @@ +// +build !integration + +package v4_test + +import ( + "net/url" + "testing" + "time" + + "github.com/awslabs/aws-sdk-go/aws" + "github.com/awslabs/aws-sdk-go/internal/test/unit" + "github.com/awslabs/aws-sdk-go/service/s3" + "github.com/stretchr/testify/assert" +) + +var _ = unit.Imported + +func TestPresignHandler(t *testing.T) { + svc := s3.New(nil) + req, _ := svc.PutObjectRequest(&s3.PutObjectInput{ + Bucket: aws.String("bucket"), + Key: aws.String("key"), + ContentDisposition: aws.String("a+b c$d"), + ACL: aws.String("public-read"), + }) + req.Time = time.Unix(0, 0) + urlstr, err := req.Presign(5 * time.Minute) + + assert.NoError(t, err) + + expectedDate := "19700101T000000Z" + expectedHeaders := "host;x-amz-acl" + expectedSig := "7edcb4e3a1bf12f4989018d75acbe3a7f03df24bd6f3112602d59fc551f0e4e2" + expectedCred := "AKID/19700101/mock-region/s3/aws4_request" + + u, _ := url.Parse(urlstr) + urlQ := u.Query() + assert.Equal(t, expectedSig, urlQ.Get("X-Amz-Signature")) + assert.Equal(t, expectedCred, urlQ.Get("X-Amz-Credential")) + assert.Equal(t, expectedHeaders, urlQ.Get("X-Amz-SignedHeaders")) + assert.Equal(t, expectedDate, urlQ.Get("X-Amz-Date")) + assert.Equal(t, "300", urlQ.Get("X-Amz-Expires")) + + assert.NotContains(t, urlstr, "+") // + encoded as %20 +} diff --git a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/internal/signer/v4/v4.go b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/internal/signer/v4/v4.go new file mode 100644 index 00000000000..673b19dfed3 --- /dev/null +++ b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/internal/signer/v4/v4.go @@ -0,0 +1,320 @@ +package v4 + +import ( + "crypto/hmac" + "crypto/sha256" + "encoding/hex" + "fmt" + "io" + "net/http" + "net/url" + "sort" + "strconv" + "strings" + "time" + + "github.com/awslabs/aws-sdk-go/aws/credentials" + + "github.com/awslabs/aws-sdk-go/aws" +) + +const ( + authHeaderPrefix = "AWS4-HMAC-SHA256" + timeFormat = "20060102T150405Z" + shortTimeFormat = "20060102" +) + +var ignoredHeaders = map[string]bool{ + "Authorization": true, + "Content-Type": true, + "Content-Length": true, + "User-Agent": true, +} + +type signer struct { + Request *http.Request + Time time.Time + ExpireTime time.Duration + ServiceName string + Region string + AccessKeyID string + SecretAccessKey string + SessionToken string + Query url.Values + Body io.ReadSeeker + Debug uint + Logger io.Writer + + isPresign bool + formattedTime string + formattedShortTime string + + signedHeaders string + canonicalHeaders string + canonicalString string + credentialString string + stringToSign string + signature string + authorization string +} + +// Sign requests with signature version 4. +// +// Will sign the requests with the service config's Credentials object +// Signing is skipped if the credentials is the credentials.AnonymousCredentials +// object. +func Sign(req *aws.Request) { + // If the request does not need to be signed ignore the signing of the + // request if the AnonymousCredentials object is used. + if req.Service.Config.Credentials == credentials.AnonymousCredentials { + return + } + creds, err := req.Service.Config.Credentials.Get() + if err != nil { + req.Error = err + return + } + + region := req.Service.SigningRegion + if region == "" { + region = req.Service.Config.Region + } + + name := req.Service.SigningName + if name == "" { + name = req.Service.ServiceName + } + + s := signer{ + Request: req.HTTPRequest, + Time: req.Time, + ExpireTime: req.ExpireTime, + Query: req.HTTPRequest.URL.Query(), + Body: req.Body, + ServiceName: name, + Region: region, + AccessKeyID: creds.AccessKeyID, + SecretAccessKey: creds.SecretAccessKey, + SessionToken: creds.SessionToken, + Debug: req.Service.Config.LogLevel, + Logger: req.Service.Config.Logger, + } + s.sign() + return +} + +func (v4 *signer) sign() { + if v4.ExpireTime != 0 { + v4.isPresign = true + } + + if v4.isPresign { + v4.Query.Set("X-Amz-Algorithm", authHeaderPrefix) + if v4.SessionToken != "" { + v4.Query.Set("X-Amz-Security-Token", v4.SessionToken) + } else { + v4.Query.Del("X-Amz-Security-Token") + } + } else if v4.SessionToken != "" { + v4.Request.Header.Set("X-Amz-Security-Token", v4.SessionToken) + } + + v4.build() + + if v4.Debug > 0 { + out := v4.Logger + fmt.Fprintf(out, "---[ CANONICAL STRING ]-----------------------------\n") + fmt.Fprintln(out, v4.canonicalString) + fmt.Fprintf(out, "---[ STRING TO SIGN ]--------------------------------\n") + fmt.Fprintln(out, v4.stringToSign) + if v4.isPresign { + fmt.Fprintf(out, "---[ SIGNED URL ]--------------------------------\n") + fmt.Fprintln(out, v4.Request.URL) + } + fmt.Fprintf(out, "-----------------------------------------------------\n") + } +} + +func (v4 *signer) build() { + v4.buildTime() // no depends + v4.buildCredentialString() // no depends + if v4.isPresign { + v4.buildQuery() // no depends + } + 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 + + if v4.isPresign { + v4.Request.URL.RawQuery += "&X-Amz-Signature=" + v4.signature + } else { + parts := []string{ + authHeaderPrefix + " Credential=" + v4.AccessKeyID + "/" + v4.credentialString, + "SignedHeaders=" + v4.signedHeaders, + "Signature=" + v4.signature, + } + v4.Request.Header.Set("Authorization", strings.Join(parts, ", ")) + } +} + +func (v4 *signer) buildTime() { + v4.formattedTime = v4.Time.UTC().Format(timeFormat) + v4.formattedShortTime = v4.Time.UTC().Format(shortTimeFormat) + + if v4.isPresign { + duration := int64(v4.ExpireTime / time.Second) + v4.Query.Set("X-Amz-Date", v4.formattedTime) + v4.Query.Set("X-Amz-Expires", strconv.FormatInt(duration, 10)) + } else { + v4.Request.Header.Set("X-Amz-Date", v4.formattedTime) + } +} + +func (v4 *signer) buildCredentialString() { + v4.credentialString = strings.Join([]string{ + v4.formattedShortTime, + v4.Region, + v4.ServiceName, + "aws4_request", + }, "/") + + if v4.isPresign { + v4.Query.Set("X-Amz-Credential", v4.AccessKeyID+"/"+v4.credentialString) + } +} + +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 (v4 *signer) buildCanonicalHeaders() { + var headers []string + headers = append(headers, "host") + for k := range v4.Request.Header { + if _, ok := ignoredHeaders[http.CanonicalHeaderKey(k)]; ok { + continue // ignored header + } + headers = append(headers, strings.ToLower(k)) + } + sort.Strings(headers) + + v4.signedHeaders = strings.Join(headers, ";") + + if v4.isPresign { + v4.Query.Set("X-Amz-SignedHeaders", v4.signedHeaders) + } + + headerValues := make([]string, len(headers)) + for i, k := range headers { + if k == "host" { + headerValues[i] = "host:" + v4.Request.URL.Host + } else { + headerValues[i] = k + ":" + + strings.Join(v4.Request.Header[http.CanonicalHeaderKey(k)], ",") + } + } + + v4.canonicalHeaders = strings.Join(headerValues, "\n") +} + +func (v4 *signer) buildCanonicalString() { + v4.Request.URL.RawQuery = strings.Replace(v4.Query.Encode(), "+", "%20", -1) + uri := v4.Request.URL.Opaque + if uri != "" { + uri = "/" + strings.Join(strings.Split(uri, "/")[3:], "/") + } else { + uri = v4.Request.URL.Path + } + if uri == "" { + uri = "/" + } + + v4.canonicalString = strings.Join([]string{ + v4.Request.Method, + uri, + v4.Request.URL.RawQuery, + v4.canonicalHeaders + "\n", + v4.signedHeaders, + v4.bodyDigest(), + }, "\n") +} + +func (v4 *signer) buildStringToSign() { + v4.stringToSign = strings.Join([]string{ + authHeaderPrefix, + v4.formattedTime, + v4.credentialString, + hex.EncodeToString(makeSha256([]byte(v4.canonicalString))), + }, "\n") +} + +func (v4 *signer) buildSignature() { + secret := v4.SecretAccessKey + date := makeHmac([]byte("AWS4"+secret), []byte(v4.formattedShortTime)) + region := makeHmac(date, []byte(v4.Region)) + service := makeHmac(region, []byte(v4.ServiceName)) + credentials := makeHmac(service, []byte("aws4_request")) + signature := makeHmac(credentials, []byte(v4.stringToSign)) + v4.signature = hex.EncodeToString(signature) +} + +func (v4 *signer) bodyDigest() string { + hash := v4.Request.Header.Get("X-Amz-Content-Sha256") + if hash == "" { + if v4.isPresign && v4.ServiceName == "s3" { + hash = "UNSIGNED-PAYLOAD" + } else if v4.Body == nil { + hash = hex.EncodeToString(makeSha256([]byte{})) + } else { + hash = hex.EncodeToString(makeSha256Reader(v4.Body)) + } + v4.Request.Header.Add("X-Amz-Content-Sha256", hash) + } + return hash +} + +func makeHmac(key []byte, data []byte) []byte { + hash := hmac.New(sha256.New, key) + hash.Write(data) + return hash.Sum(nil) +} + +func makeSha256(data []byte) []byte { + hash := sha256.New() + hash.Write(data) + return hash.Sum(nil) +} + +func makeSha256Reader(reader io.ReadSeeker) []byte { + packet := make([]byte, 4096) + hash := sha256.New() + + start, _ := reader.Seek(0, 1) + defer reader.Seek(start, 0) + + for { + n, err := reader.Read(packet) + if n > 0 { + hash.Write(packet[0:n]) + } + if err == io.EOF || n == 0 { + break + } + } + + return hash.Sum(nil) +} diff --git a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/internal/signer/v4/v4_test.go b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/internal/signer/v4/v4_test.go new file mode 100644 index 00000000000..5e537026604 --- /dev/null +++ b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/internal/signer/v4/v4_test.go @@ -0,0 +1,156 @@ +package v4 + +import ( + "net/http" + "strings" + "testing" + "time" + + "github.com/awslabs/aws-sdk-go/aws" + "github.com/awslabs/aws-sdk-go/aws/credentials" + "github.com/stretchr/testify/assert" +) + +func buildSigner(serviceName string, region string, signTime time.Time, expireTime time.Duration, body string) signer { + endpoint := "https://" + serviceName + "." + region + ".amazonaws.com" + reader := strings.NewReader(body) + req, _ := http.NewRequest("POST", endpoint, reader) + req.URL.Opaque = "//example.org/bucket/key-._~,!@#$%^&*()" + req.Header.Add("X-Amz-Target", "prefix.Operation") + req.Header.Add("Content-Type", "application/x-amz-json-1.0") + req.Header.Add("Content-Length", string(len(body))) + req.Header.Add("X-Amz-Meta-Other-Header", "some-value=!@#$%^&* (+)") + + return signer{ + Request: req, + Time: signTime, + ExpireTime: expireTime, + Query: req.URL.Query(), + Body: reader, + ServiceName: serviceName, + Region: region, + AccessKeyID: "AKID", + SecretAccessKey: "SECRET", + SessionToken: "SESSION", + } +} + +func removeWS(text string) string { + text = strings.Replace(text, " ", "", -1) + text = strings.Replace(text, "\n", "", -1) + text = strings.Replace(text, "\t", "", -1) + return text +} + +func assertEqual(t *testing.T, expected, given string) { + if removeWS(expected) != removeWS(given) { + t.Errorf("\nExpected: %s\nGiven: %s", expected, given) + } +} + +func TestPresignRequest(t *testing.T) { + signer := buildSigner("dynamodb", "us-east-1", time.Unix(0, 0), 300*time.Second, "{}") + signer.sign() + + expectedDate := "19700101T000000Z" + expectedHeaders := "host;x-amz-meta-other-header;x-amz-target" + expectedSig := "4c86bacebb78e458e8e898e93547513079d67ab95d3d5c02236889e21ea0df2b" + expectedCred := "AKID/19700101/us-east-1/dynamodb/aws4_request" + + q := signer.Request.URL.Query() + assert.Equal(t, expectedSig, q.Get("X-Amz-Signature")) + assert.Equal(t, expectedCred, q.Get("X-Amz-Credential")) + assert.Equal(t, expectedHeaders, q.Get("X-Amz-SignedHeaders")) + assert.Equal(t, expectedDate, q.Get("X-Amz-Date")) +} + +func TestSignRequest(t *testing.T) { + signer := buildSigner("dynamodb", "us-east-1", time.Unix(0, 0), 0, "{}") + signer.sign() + + expectedDate := "19700101T000000Z" + expectedSig := "AWS4-HMAC-SHA256 Credential=AKID/19700101/us-east-1/dynamodb/aws4_request, SignedHeaders=host;x-amz-date;x-amz-meta-other-header;x-amz-security-token;x-amz-target, Signature=d4df864b291252d2c9206be75963db54db09ca70265622cc787cbe50ca0efcc8" + + q := signer.Request.Header + assert.Equal(t, expectedSig, q.Get("Authorization")) + assert.Equal(t, expectedDate, q.Get("X-Amz-Date")) +} + +func TestSignEmptyBody(t *testing.T) { + signer := buildSigner("dynamodb", "us-east-1", time.Now(), 0, "") + signer.Body = nil + signer.sign() + hash := signer.Request.Header.Get("X-Amz-Content-Sha256") + assert.Equal(t, "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", hash) +} + +func TestSignBody(t *testing.T) { + signer := buildSigner("dynamodb", "us-east-1", time.Now(), 0, "hello") + signer.sign() + hash := signer.Request.Header.Get("X-Amz-Content-Sha256") + assert.Equal(t, "2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824", hash) +} + +func TestSignSeekedBody(t *testing.T) { + signer := buildSigner("dynamodb", "us-east-1", time.Now(), 0, " hello") + signer.Body.Read(make([]byte, 3)) // consume first 3 bytes so body is now "hello" + signer.sign() + hash := signer.Request.Header.Get("X-Amz-Content-Sha256") + assert.Equal(t, "2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824", hash) + + start, _ := signer.Body.Seek(0, 1) + assert.Equal(t, int64(3), start) +} + +func TestPresignEmptyBodyS3(t *testing.T) { + signer := buildSigner("s3", "us-east-1", time.Now(), 5*time.Minute, "hello") + signer.sign() + hash := signer.Request.Header.Get("X-Amz-Content-Sha256") + assert.Equal(t, "UNSIGNED-PAYLOAD", hash) +} + +func TestSignPrecomputedBodyChecksum(t *testing.T) { + signer := buildSigner("dynamodb", "us-east-1", time.Now(), 0, "hello") + signer.Request.Header.Set("X-Amz-Content-Sha256", "PRECOMPUTED") + signer.sign() + hash := signer.Request.Header.Get("X-Amz-Content-Sha256") + assert.Equal(t, "PRECOMPUTED", hash) +} + +func TestAnonymousCredentials(t *testing.T) { + r := aws.NewRequest( + aws.NewService(&aws.Config{Credentials: credentials.AnonymousCredentials}), + &aws.Operation{ + Name: "BatchGetItem", + HTTPMethod: "POST", + HTTPPath: "/", + }, + nil, + nil, + ) + Sign(r) + + urlQ := r.HTTPRequest.URL.Query() + assert.Empty(t, urlQ.Get("X-Amz-Signature")) + assert.Empty(t, urlQ.Get("X-Amz-Credential")) + assert.Empty(t, urlQ.Get("X-Amz-SignedHeaders")) + assert.Empty(t, urlQ.Get("X-Amz-Date")) + + hQ := r.HTTPRequest.Header + assert.Empty(t, hQ.Get("Authorization")) + assert.Empty(t, hQ.Get("X-Amz-Date")) +} + +func BenchmarkPresignRequest(b *testing.B) { + signer := buildSigner("dynamodb", "us-east-1", time.Now(), 300*time.Second, "{}") + for i := 0; i < b.N; i++ { + signer.sign() + } +} + +func BenchmarkSignRequest(b *testing.B) { + signer := buildSigner("dynamodb", "us-east-1", time.Now(), 0, "{}") + for i := 0; i < b.N; i++ { + signer.sign() + } +} diff --git a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/service/ec2/api.go b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/service/ec2/api.go new file mode 100644 index 00000000000..6ee46a98ae1 --- /dev/null +++ b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/service/ec2/api.go @@ -0,0 +1,16951 @@ +// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. + +// Package ec2 provides a client for Amazon Elastic Compute Cloud. +package ec2 + +import ( + "sync" + "time" + + "github.com/awslabs/aws-sdk-go/aws" +) + +var oprw sync.Mutex + +// AcceptVPCPeeringConnectionRequest generates a request for the AcceptVPCPeeringConnection operation. +func (c *EC2) AcceptVPCPeeringConnectionRequest(input *AcceptVPCPeeringConnectionInput) (req *aws.Request, output *AcceptVPCPeeringConnectionOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opAcceptVPCPeeringConnection == nil { + opAcceptVPCPeeringConnection = &aws.Operation{ + Name: "AcceptVpcPeeringConnection", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &AcceptVPCPeeringConnectionInput{} + } + + req = c.newRequest(opAcceptVPCPeeringConnection, input, output) + output = &AcceptVPCPeeringConnectionOutput{} + req.Data = output + return +} + +// Accept a VPC peering connection request. To accept a request, the VPC peering +// connection must be in the pending-acceptance state, and you must be the owner +// of the peer VPC. Use the DescribeVpcPeeringConnections request to view your +// outstanding VPC peering connection requests. +func (c *EC2) AcceptVPCPeeringConnection(input *AcceptVPCPeeringConnectionInput) (output *AcceptVPCPeeringConnectionOutput, err error) { + req, out := c.AcceptVPCPeeringConnectionRequest(input) + output = out + err = req.Send() + return +} + +var opAcceptVPCPeeringConnection *aws.Operation + +// AllocateAddressRequest generates a request for the AllocateAddress operation. +func (c *EC2) AllocateAddressRequest(input *AllocateAddressInput) (req *aws.Request, output *AllocateAddressOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opAllocateAddress == nil { + opAllocateAddress = &aws.Operation{ + Name: "AllocateAddress", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &AllocateAddressInput{} + } + + req = c.newRequest(opAllocateAddress, input, output) + output = &AllocateAddressOutput{} + req.Data = output + return +} + +// Acquires an Elastic IP address. +// +// An Elastic IP address is for use either in the EC2-Classic platform or in +// a VPC. For more information, see Elastic IP Addresses (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/elastic-ip-addresses-eip.html) +// in the Amazon Elastic Compute Cloud User Guide. +func (c *EC2) AllocateAddress(input *AllocateAddressInput) (output *AllocateAddressOutput, err error) { + req, out := c.AllocateAddressRequest(input) + output = out + err = req.Send() + return +} + +var opAllocateAddress *aws.Operation + +// AssignPrivateIPAddressesRequest generates a request for the AssignPrivateIPAddresses operation. +func (c *EC2) AssignPrivateIPAddressesRequest(input *AssignPrivateIPAddressesInput) (req *aws.Request, output *AssignPrivateIPAddressesOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opAssignPrivateIPAddresses == nil { + opAssignPrivateIPAddresses = &aws.Operation{ + Name: "AssignPrivateIpAddresses", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &AssignPrivateIPAddressesInput{} + } + + req = c.newRequest(opAssignPrivateIPAddresses, input, output) + output = &AssignPrivateIPAddressesOutput{} + req.Data = output + return +} + +// Assigns one or more secondary private IP addresses to the specified network +// interface. You can specify one or more specific secondary IP addresses, or +// you can specify the number of secondary IP addresses to be automatically +// assigned within the subnet's CIDR block range. The number of secondary IP +// addresses that you can assign to an instance varies by instance type. For +// information about instance types, see Instance Types (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-types.html) +// in the Amazon Elastic Compute Cloud User Guide. For more information about +// Elastic IP addresses, see Elastic IP Addresses (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/elastic-ip-addresses-eip.html) +// in the Amazon Elastic Compute Cloud User Guide. +// +// AssignPrivateIpAddresses is available only in EC2-VPC. +func (c *EC2) AssignPrivateIPAddresses(input *AssignPrivateIPAddressesInput) (output *AssignPrivateIPAddressesOutput, err error) { + req, out := c.AssignPrivateIPAddressesRequest(input) + output = out + err = req.Send() + return +} + +var opAssignPrivateIPAddresses *aws.Operation + +// AssociateAddressRequest generates a request for the AssociateAddress operation. +func (c *EC2) AssociateAddressRequest(input *AssociateAddressInput) (req *aws.Request, output *AssociateAddressOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opAssociateAddress == nil { + opAssociateAddress = &aws.Operation{ + Name: "AssociateAddress", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &AssociateAddressInput{} + } + + req = c.newRequest(opAssociateAddress, input, output) + output = &AssociateAddressOutput{} + req.Data = output + return +} + +// Associates an Elastic IP address with an instance or a network interface. +// +// An Elastic IP address is for use in either the EC2-Classic platform or in +// a VPC. For more information, see Elastic IP Addresses (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/elastic-ip-addresses-eip.html) +// in the Amazon Elastic Compute Cloud User Guide. +// +// [EC2-Classic, VPC in an EC2-VPC-only account] If the Elastic IP address +// is already associated with a different instance, it is disassociated from +// that instance and associated with the specified instance. +// +// [VPC in an EC2-Classic account] If you don't specify a private IP address, +// the Elastic IP address is associated with the primary IP address. If the +// Elastic IP address is already associated with a different instance or a network +// interface, you get an error unless you allow reassociation. +// +// This is an idempotent operation. If you perform the operation more than +// once, Amazon EC2 doesn't return an error. +func (c *EC2) AssociateAddress(input *AssociateAddressInput) (output *AssociateAddressOutput, err error) { + req, out := c.AssociateAddressRequest(input) + output = out + err = req.Send() + return +} + +var opAssociateAddress *aws.Operation + +// AssociateDHCPOptionsRequest generates a request for the AssociateDHCPOptions operation. +func (c *EC2) AssociateDHCPOptionsRequest(input *AssociateDHCPOptionsInput) (req *aws.Request, output *AssociateDHCPOptionsOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opAssociateDHCPOptions == nil { + opAssociateDHCPOptions = &aws.Operation{ + Name: "AssociateDhcpOptions", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &AssociateDHCPOptionsInput{} + } + + req = c.newRequest(opAssociateDHCPOptions, input, output) + output = &AssociateDHCPOptionsOutput{} + req.Data = output + return +} + +// Associates a set of DHCP options (that you've previously created) with the +// specified VPC, or associates no DHCP options with the VPC. +// +// After you associate the options with the VPC, any existing instances and +// all new instances that you launch in that VPC use the options. You don't +// need to restart or relaunch the instances. They automatically pick up the +// changes within a few hours, depending on how frequently the instance renews +// its DHCP lease. You can explicitly renew the lease using the operating system +// on the instance. +// +// For more information, see DHCP Options Sets (http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_DHCP_Options.html) +// in the Amazon Virtual Private Cloud User Guide. +func (c *EC2) AssociateDHCPOptions(input *AssociateDHCPOptionsInput) (output *AssociateDHCPOptionsOutput, err error) { + req, out := c.AssociateDHCPOptionsRequest(input) + output = out + err = req.Send() + return +} + +var opAssociateDHCPOptions *aws.Operation + +// AssociateRouteTableRequest generates a request for the AssociateRouteTable operation. +func (c *EC2) AssociateRouteTableRequest(input *AssociateRouteTableInput) (req *aws.Request, output *AssociateRouteTableOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opAssociateRouteTable == nil { + opAssociateRouteTable = &aws.Operation{ + Name: "AssociateRouteTable", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &AssociateRouteTableInput{} + } + + req = c.newRequest(opAssociateRouteTable, input, output) + output = &AssociateRouteTableOutput{} + req.Data = output + return +} + +// Associates a subnet with a route table. The subnet and route table must be +// in the same VPC. This association causes traffic originating from the subnet +// to be routed according to the routes in the route table. The action returns +// an association ID, which you need in order to disassociate the route table +// from the subnet later. A route table can be associated with multiple subnets. +// +// For more information about route tables, see Route Tables (http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_Route_Tables.html) +// in the Amazon Virtual Private Cloud User Guide. +func (c *EC2) AssociateRouteTable(input *AssociateRouteTableInput) (output *AssociateRouteTableOutput, err error) { + req, out := c.AssociateRouteTableRequest(input) + output = out + err = req.Send() + return +} + +var opAssociateRouteTable *aws.Operation + +// AttachClassicLinkVPCRequest generates a request for the AttachClassicLinkVPC operation. +func (c *EC2) AttachClassicLinkVPCRequest(input *AttachClassicLinkVPCInput) (req *aws.Request, output *AttachClassicLinkVPCOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opAttachClassicLinkVPC == nil { + opAttachClassicLinkVPC = &aws.Operation{ + Name: "AttachClassicLinkVpc", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &AttachClassicLinkVPCInput{} + } + + req = c.newRequest(opAttachClassicLinkVPC, input, output) + output = &AttachClassicLinkVPCOutput{} + req.Data = output + return +} + +// Links an EC2-Classic instance to a ClassicLink-enabled VPC through one or +// more of the VPC's security groups. You cannot link an EC2-Classic instance +// to more than one VPC at a time. You can only link an instance that's in the +// running state. An instance is automatically unlinked from a VPC when it's +// stopped - you can link it to the VPC again when you restart it. +// +// After you've linked an instance, you cannot change the VPC security groups +// that are associated with it. To change the security groups, you must first +// unlink the instance, and then link it again. +// +// Linking your instance to a VPC is sometimes referred to as attaching your +// instance. +func (c *EC2) AttachClassicLinkVPC(input *AttachClassicLinkVPCInput) (output *AttachClassicLinkVPCOutput, err error) { + req, out := c.AttachClassicLinkVPCRequest(input) + output = out + err = req.Send() + return +} + +var opAttachClassicLinkVPC *aws.Operation + +// AttachInternetGatewayRequest generates a request for the AttachInternetGateway operation. +func (c *EC2) AttachInternetGatewayRequest(input *AttachInternetGatewayInput) (req *aws.Request, output *AttachInternetGatewayOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opAttachInternetGateway == nil { + opAttachInternetGateway = &aws.Operation{ + Name: "AttachInternetGateway", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &AttachInternetGatewayInput{} + } + + req = c.newRequest(opAttachInternetGateway, input, output) + output = &AttachInternetGatewayOutput{} + req.Data = output + return +} + +// Attaches an Internet gateway to a VPC, enabling connectivity between the +// Internet and the VPC. For more information about your VPC and Internet gateway, +// see the Amazon Virtual Private Cloud User Guide (http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/). +func (c *EC2) AttachInternetGateway(input *AttachInternetGatewayInput) (output *AttachInternetGatewayOutput, err error) { + req, out := c.AttachInternetGatewayRequest(input) + output = out + err = req.Send() + return +} + +var opAttachInternetGateway *aws.Operation + +// AttachNetworkInterfaceRequest generates a request for the AttachNetworkInterface operation. +func (c *EC2) AttachNetworkInterfaceRequest(input *AttachNetworkInterfaceInput) (req *aws.Request, output *AttachNetworkInterfaceOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opAttachNetworkInterface == nil { + opAttachNetworkInterface = &aws.Operation{ + Name: "AttachNetworkInterface", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &AttachNetworkInterfaceInput{} + } + + req = c.newRequest(opAttachNetworkInterface, input, output) + output = &AttachNetworkInterfaceOutput{} + req.Data = output + return +} + +// Attaches a network interface to an instance. +func (c *EC2) AttachNetworkInterface(input *AttachNetworkInterfaceInput) (output *AttachNetworkInterfaceOutput, err error) { + req, out := c.AttachNetworkInterfaceRequest(input) + output = out + err = req.Send() + return +} + +var opAttachNetworkInterface *aws.Operation + +// AttachVPNGatewayRequest generates a request for the AttachVPNGateway operation. +func (c *EC2) AttachVPNGatewayRequest(input *AttachVPNGatewayInput) (req *aws.Request, output *AttachVPNGatewayOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opAttachVPNGateway == nil { + opAttachVPNGateway = &aws.Operation{ + Name: "AttachVpnGateway", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &AttachVPNGatewayInput{} + } + + req = c.newRequest(opAttachVPNGateway, input, output) + output = &AttachVPNGatewayOutput{} + req.Data = output + return +} + +// Attaches a virtual private gateway to a VPC. For more information, see Adding +// a Hardware Virtual Private Gateway to Your VPC (http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_VPN.html) +// in the Amazon Virtual Private Cloud User Guide. +func (c *EC2) AttachVPNGateway(input *AttachVPNGatewayInput) (output *AttachVPNGatewayOutput, err error) { + req, out := c.AttachVPNGatewayRequest(input) + output = out + err = req.Send() + return +} + +var opAttachVPNGateway *aws.Operation + +// AttachVolumeRequest generates a request for the AttachVolume operation. +func (c *EC2) AttachVolumeRequest(input *AttachVolumeInput) (req *aws.Request, output *VolumeAttachment) { + oprw.Lock() + defer oprw.Unlock() + + if opAttachVolume == nil { + opAttachVolume = &aws.Operation{ + Name: "AttachVolume", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &AttachVolumeInput{} + } + + req = c.newRequest(opAttachVolume, input, output) + output = &VolumeAttachment{} + req.Data = output + return +} + +// Attaches an Amazon EBS volume to a running or stopped instance and exposes +// it to the instance with the specified device name. +// +// Encrypted Amazon EBS volumes may only be attached to instances that support +// Amazon EBS encryption. For more information, see Amazon EBS Encryption (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSEncryption.html) +// in the Amazon Elastic Compute Cloud User Guide. +// +// For a list of supported device names, see Attaching an Amazon EBS Volume +// to an Instance (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-attaching-volume.html). +// Any device names that aren't reserved for instance store volumes can be used +// for Amazon EBS volumes. For more information, see Amazon EC2 Instance Store +// (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/InstanceStorage.html) +// in the Amazon Elastic Compute Cloud User Guide. +// +// If a volume has an AWS Marketplace product code: +// +// The volume can be attached only to a stopped instance. AWS Marketplace +// product codes are copied from the volume to the instance. You must be subscribed +// to the product. The instance type and operating system of the instance must +// support the product. For example, you can't detach a volume from a Windows +// instance and attach it to a Linux instance. For an overview of the AWS Marketplace, +// see Introducing AWS Marketplace (https://aws.amazon.com/marketplace/help/200900000). +// +// For more information about Amazon EBS volumes, see Attaching Amazon EBS +// Volumes (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-attaching-volume.html) +// in the Amazon Elastic Compute Cloud User Guide. +func (c *EC2) AttachVolume(input *AttachVolumeInput) (output *VolumeAttachment, err error) { + req, out := c.AttachVolumeRequest(input) + output = out + err = req.Send() + return +} + +var opAttachVolume *aws.Operation + +// AuthorizeSecurityGroupEgressRequest generates a request for the AuthorizeSecurityGroupEgress operation. +func (c *EC2) AuthorizeSecurityGroupEgressRequest(input *AuthorizeSecurityGroupEgressInput) (req *aws.Request, output *AuthorizeSecurityGroupEgressOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opAuthorizeSecurityGroupEgress == nil { + opAuthorizeSecurityGroupEgress = &aws.Operation{ + Name: "AuthorizeSecurityGroupEgress", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &AuthorizeSecurityGroupEgressInput{} + } + + req = c.newRequest(opAuthorizeSecurityGroupEgress, input, output) + output = &AuthorizeSecurityGroupEgressOutput{} + req.Data = output + return +} + +// Adds one or more egress rules to a security group for use with a VPC. Specifically, +// this action permits instances to send traffic to one or more destination +// CIDR IP address ranges, or to one or more destination security groups for +// the same VPC. +// +// You can have up to 50 rules per security group (covering both ingress and +// egress rules). +// +// A security group is for use with instances either in the EC2-Classic platform +// or in a specific VPC. This action doesn't apply to security groups for use +// in EC2-Classic. For more information, see Security Groups for Your VPC (http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_SecurityGroups.html) +// in the Amazon Virtual Private Cloud User Guide. +// +// Each rule consists of the protocol (for example, TCP), plus either a CIDR +// range or a source group. For the TCP and UDP protocols, you must also specify +// the destination port or port range. For the ICMP protocol, you must also +// specify the ICMP type and code. You can use -1 for the type or code to mean +// all types or all codes. +// +// Rule changes are propagated to affected instances as quickly as possible. +// However, a small delay might occur. +func (c *EC2) AuthorizeSecurityGroupEgress(input *AuthorizeSecurityGroupEgressInput) (output *AuthorizeSecurityGroupEgressOutput, err error) { + req, out := c.AuthorizeSecurityGroupEgressRequest(input) + output = out + err = req.Send() + return +} + +var opAuthorizeSecurityGroupEgress *aws.Operation + +// AuthorizeSecurityGroupIngressRequest generates a request for the AuthorizeSecurityGroupIngress operation. +func (c *EC2) AuthorizeSecurityGroupIngressRequest(input *AuthorizeSecurityGroupIngressInput) (req *aws.Request, output *AuthorizeSecurityGroupIngressOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opAuthorizeSecurityGroupIngress == nil { + opAuthorizeSecurityGroupIngress = &aws.Operation{ + Name: "AuthorizeSecurityGroupIngress", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &AuthorizeSecurityGroupIngressInput{} + } + + req = c.newRequest(opAuthorizeSecurityGroupIngress, input, output) + output = &AuthorizeSecurityGroupIngressOutput{} + req.Data = output + return +} + +// Adds one or more ingress rules to a security group. +// +// EC2-Classic: You can have up to 100 rules per group. +// +// EC2-VPC: You can have up to 50 rules per group (covering both ingress and +// egress rules). +// +// Rule changes are propagated to instances within the security group as quickly +// as possible. However, a small delay might occur. +// +// [EC2-Classic] This action gives one or more CIDR IP address ranges permission +// to access a security group in your account, or gives one or more security +// groups (called the source groups) permission to access a security group for +// your account. A source group can be for your own AWS account, or another. +// +// [EC2-VPC] This action gives one or more CIDR IP address ranges permission +// to access a security group in your VPC, or gives one or more other security +// groups (called the source groups) permission to access a security group for +// your VPC. The security groups must all be for the same VPC. +func (c *EC2) AuthorizeSecurityGroupIngress(input *AuthorizeSecurityGroupIngressInput) (output *AuthorizeSecurityGroupIngressOutput, err error) { + req, out := c.AuthorizeSecurityGroupIngressRequest(input) + output = out + err = req.Send() + return +} + +var opAuthorizeSecurityGroupIngress *aws.Operation + +// BundleInstanceRequest generates a request for the BundleInstance operation. +func (c *EC2) BundleInstanceRequest(input *BundleInstanceInput) (req *aws.Request, output *BundleInstanceOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opBundleInstance == nil { + opBundleInstance = &aws.Operation{ + Name: "BundleInstance", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &BundleInstanceInput{} + } + + req = c.newRequest(opBundleInstance, input, output) + output = &BundleInstanceOutput{} + req.Data = output + return +} + +// Bundles an Amazon instance store-backed Windows instance. +// +// During bundling, only the root device volume (C:\) is bundled. Data on other +// instance store volumes is not preserved. +// +// This action is not applicable for Linux/Unix instances or Windows instances +// that are backed by Amazon EBS. +// +// For more information, see Creating an Instance Store-Backed Windows AMI +// (http://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/Creating_InstanceStoreBacked_WinAMI.html). +func (c *EC2) BundleInstance(input *BundleInstanceInput) (output *BundleInstanceOutput, err error) { + req, out := c.BundleInstanceRequest(input) + output = out + err = req.Send() + return +} + +var opBundleInstance *aws.Operation + +// CancelBundleTaskRequest generates a request for the CancelBundleTask operation. +func (c *EC2) CancelBundleTaskRequest(input *CancelBundleTaskInput) (req *aws.Request, output *CancelBundleTaskOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opCancelBundleTask == nil { + opCancelBundleTask = &aws.Operation{ + Name: "CancelBundleTask", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &CancelBundleTaskInput{} + } + + req = c.newRequest(opCancelBundleTask, input, output) + output = &CancelBundleTaskOutput{} + req.Data = output + return +} + +// Cancels a bundling operation for an instance store-backed Windows instance. +func (c *EC2) CancelBundleTask(input *CancelBundleTaskInput) (output *CancelBundleTaskOutput, err error) { + req, out := c.CancelBundleTaskRequest(input) + output = out + err = req.Send() + return +} + +var opCancelBundleTask *aws.Operation + +// CancelConversionTaskRequest generates a request for the CancelConversionTask operation. +func (c *EC2) CancelConversionTaskRequest(input *CancelConversionTaskInput) (req *aws.Request, output *CancelConversionTaskOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opCancelConversionTask == nil { + opCancelConversionTask = &aws.Operation{ + Name: "CancelConversionTask", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &CancelConversionTaskInput{} + } + + req = c.newRequest(opCancelConversionTask, input, output) + output = &CancelConversionTaskOutput{} + req.Data = output + return +} + +// Cancels an active conversion task. The task can be the import of an instance +// or volume. The action removes all artifacts of the conversion, including +// a partially uploaded volume or instance. If the conversion is complete or +// is in the process of transferring the final disk image, the command fails +// and returns an exception. +// +// For more information, 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. +func (c *EC2) CancelConversionTask(input *CancelConversionTaskInput) (output *CancelConversionTaskOutput, err error) { + req, out := c.CancelConversionTaskRequest(input) + output = out + err = req.Send() + return +} + +var opCancelConversionTask *aws.Operation + +// CancelExportTaskRequest generates a request for the CancelExportTask operation. +func (c *EC2) CancelExportTaskRequest(input *CancelExportTaskInput) (req *aws.Request, output *CancelExportTaskOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opCancelExportTask == nil { + opCancelExportTask = &aws.Operation{ + Name: "CancelExportTask", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &CancelExportTaskInput{} + } + + req = c.newRequest(opCancelExportTask, input, output) + output = &CancelExportTaskOutput{} + req.Data = output + return +} + +// Cancels an active export task. The request removes all artifacts of the export, +// including any partially-created Amazon S3 objects. If the export task is +// complete or is in the process of transferring the final disk image, the command +// fails and returns an error. +func (c *EC2) CancelExportTask(input *CancelExportTaskInput) (output *CancelExportTaskOutput, err error) { + req, out := c.CancelExportTaskRequest(input) + output = out + err = req.Send() + return +} + +var opCancelExportTask *aws.Operation + +// CancelImportTaskRequest generates a request for the CancelImportTask operation. +func (c *EC2) CancelImportTaskRequest(input *CancelImportTaskInput) (req *aws.Request, output *CancelImportTaskOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opCancelImportTask == nil { + opCancelImportTask = &aws.Operation{ + Name: "CancelImportTask", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &CancelImportTaskInput{} + } + + req = c.newRequest(opCancelImportTask, input, output) + output = &CancelImportTaskOutput{} + req.Data = output + return +} + +// Cancels an in-process import virtual machine or import snapshot task. +func (c *EC2) CancelImportTask(input *CancelImportTaskInput) (output *CancelImportTaskOutput, err error) { + req, out := c.CancelImportTaskRequest(input) + output = out + err = req.Send() + return +} + +var opCancelImportTask *aws.Operation + +// CancelReservedInstancesListingRequest generates a request for the CancelReservedInstancesListing operation. +func (c *EC2) CancelReservedInstancesListingRequest(input *CancelReservedInstancesListingInput) (req *aws.Request, output *CancelReservedInstancesListingOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opCancelReservedInstancesListing == nil { + opCancelReservedInstancesListing = &aws.Operation{ + Name: "CancelReservedInstancesListing", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &CancelReservedInstancesListingInput{} + } + + req = c.newRequest(opCancelReservedInstancesListing, input, output) + output = &CancelReservedInstancesListingOutput{} + req.Data = output + return +} + +// 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) +// in the Amazon Elastic Compute Cloud User Guide. +func (c *EC2) CancelReservedInstancesListing(input *CancelReservedInstancesListingInput) (output *CancelReservedInstancesListingOutput, err error) { + req, out := c.CancelReservedInstancesListingRequest(input) + output = out + err = req.Send() + return +} + +var opCancelReservedInstancesListing *aws.Operation + +// CancelSpotInstanceRequestsRequest generates a request for the CancelSpotInstanceRequests operation. +func (c *EC2) CancelSpotInstanceRequestsRequest(input *CancelSpotInstanceRequestsInput) (req *aws.Request, output *CancelSpotInstanceRequestsOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opCancelSpotInstanceRequests == nil { + opCancelSpotInstanceRequests = &aws.Operation{ + Name: "CancelSpotInstanceRequests", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &CancelSpotInstanceRequestsInput{} + } + + req = c.newRequest(opCancelSpotInstanceRequests, input, output) + output = &CancelSpotInstanceRequestsOutput{} + req.Data = output + return +} + +// Cancels one or more Spot Instance requests. Spot Instances are instances +// that Amazon EC2 starts on your behalf when the bid price that you specify +// exceeds the current Spot Price. Amazon EC2 periodically sets the Spot Price +// based on available Spot Instance capacity and current Spot Instance requests. +// For more information, see Spot Instance Requests (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/spot-requests.html) +// in the Amazon Elastic Compute Cloud User Guide. +// +// Canceling a Spot Instance request does not terminate running Spot Instances +// associated with the request. +func (c *EC2) CancelSpotInstanceRequests(input *CancelSpotInstanceRequestsInput) (output *CancelSpotInstanceRequestsOutput, err error) { + req, out := c.CancelSpotInstanceRequestsRequest(input) + output = out + err = req.Send() + return +} + +var opCancelSpotInstanceRequests *aws.Operation + +// ConfirmProductInstanceRequest generates a request for the ConfirmProductInstance operation. +func (c *EC2) ConfirmProductInstanceRequest(input *ConfirmProductInstanceInput) (req *aws.Request, output *ConfirmProductInstanceOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opConfirmProductInstance == nil { + opConfirmProductInstance = &aws.Operation{ + Name: "ConfirmProductInstance", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &ConfirmProductInstanceInput{} + } + + req = c.newRequest(opConfirmProductInstance, input, output) + output = &ConfirmProductInstanceOutput{} + req.Data = output + return +} + +// Determines whether a product code is associated with an instance. This action +// can only be used by the owner of the product code. It is useful when a product +// code owner needs to verify whether another user's instance is eligible for +// support. +func (c *EC2) ConfirmProductInstance(input *ConfirmProductInstanceInput) (output *ConfirmProductInstanceOutput, err error) { + req, out := c.ConfirmProductInstanceRequest(input) + output = out + err = req.Send() + return +} + +var opConfirmProductInstance *aws.Operation + +// CopyImageRequest generates a request for the CopyImage operation. +func (c *EC2) CopyImageRequest(input *CopyImageInput) (req *aws.Request, output *CopyImageOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opCopyImage == nil { + opCopyImage = &aws.Operation{ + Name: "CopyImage", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &CopyImageInput{} + } + + req = c.newRequest(opCopyImage, input, output) + output = &CopyImageOutput{} + req.Data = output + return +} + +// Initiates the copy of an AMI from the specified source region to the current +// region. You specify the destination region by using its endpoint when making +// the request. AMIs that use encrypted Amazon EBS snapshots cannot be copied +// with this method. +// +// For more information, see Copying AMIs (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/CopyingAMIs.html) +// in the Amazon Elastic Compute Cloud User Guide. +func (c *EC2) CopyImage(input *CopyImageInput) (output *CopyImageOutput, err error) { + req, out := c.CopyImageRequest(input) + output = out + err = req.Send() + return +} + +var opCopyImage *aws.Operation + +// CopySnapshotRequest generates a request for the CopySnapshot operation. +func (c *EC2) CopySnapshotRequest(input *CopySnapshotInput) (req *aws.Request, output *CopySnapshotOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opCopySnapshot == nil { + opCopySnapshot = &aws.Operation{ + Name: "CopySnapshot", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &CopySnapshotInput{} + } + + req = c.newRequest(opCopySnapshot, input, output) + output = &CopySnapshotOutput{} + req.Data = output + return +} + +// Copies a point-in-time snapshot of an Amazon EBS volume and stores it in +// Amazon S3. You can copy the snapshot within the same region or from one region +// to another. You can use the snapshot to create Amazon EBS volumes or Amazon +// Machine Images (AMIs). The snapshot is copied to the regional endpoint that +// you send the HTTP request to. +// +// Copies of encrypted Amazon EBS snapshots remain encrypted. Copies of unencrypted +// snapshots remain unencrypted. +// +// Copying snapshots that were encrypted with non-default AWS Key Management +// Service (KMS) master keys is not supported at this time. +// +// For more information, see Copying an Amazon EBS Snapshot (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-copy-snapshot.html) +// in the Amazon Elastic Compute Cloud User Guide. +func (c *EC2) CopySnapshot(input *CopySnapshotInput) (output *CopySnapshotOutput, err error) { + req, out := c.CopySnapshotRequest(input) + output = out + err = req.Send() + return +} + +var opCopySnapshot *aws.Operation + +// CreateCustomerGatewayRequest generates a request for the CreateCustomerGateway operation. +func (c *EC2) CreateCustomerGatewayRequest(input *CreateCustomerGatewayInput) (req *aws.Request, output *CreateCustomerGatewayOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opCreateCustomerGateway == nil { + opCreateCustomerGateway = &aws.Operation{ + Name: "CreateCustomerGateway", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &CreateCustomerGatewayInput{} + } + + req = c.newRequest(opCreateCustomerGateway, input, output) + output = &CreateCustomerGatewayOutput{} + req.Data = output + return +} + +// Provides information to AWS about your VPN customer gateway device. The customer +// gateway is the appliance at your end of the VPN connection. (The device on +// the AWS side of the VPN connection is the virtual private gateway.) You must +// provide the Internet-routable IP address of the customer gateway's external +// interface. The IP address must be static and can't be behind a device performing +// network address translation (NAT). +// +// For devices that use Border Gateway Protocol (BGP), you can also provide +// the device's BGP Autonomous System Number (ASN). You can use an existing +// ASN assigned to your network. If you don't have an ASN already, you can use +// a private ASN (in the 64512 - 65534 range). +// +// Amazon EC2 supports all 2-byte ASN numbers in the range of 1 - 65534, with +// the exception of 7224, which is reserved in the us-east-1 region, and 9059, +// which is reserved in the eu-west-1 region. +// +// For more information about VPN customer gateways, see Adding a Hardware +// Virtual Private Gateway to Your VPC (http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_VPN.html) +// in the Amazon Virtual Private Cloud User Guide. +// +// You cannot create more than one customer gateway with the same VPN type, +// IP address, and BGP ASN parameter values. If you run an identical request +// more than one time, the first request creates the customer gateway, and subsequent +// requests return information about the existing customer gateway. The subsequent +// requests do not create new customer gateway resources. +func (c *EC2) CreateCustomerGateway(input *CreateCustomerGatewayInput) (output *CreateCustomerGatewayOutput, err error) { + req, out := c.CreateCustomerGatewayRequest(input) + output = out + err = req.Send() + return +} + +var opCreateCustomerGateway *aws.Operation + +// CreateDHCPOptionsRequest generates a request for the CreateDHCPOptions operation. +func (c *EC2) CreateDHCPOptionsRequest(input *CreateDHCPOptionsInput) (req *aws.Request, output *CreateDHCPOptionsOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opCreateDHCPOptions == nil { + opCreateDHCPOptions = &aws.Operation{ + Name: "CreateDhcpOptions", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &CreateDHCPOptionsInput{} + } + + req = c.newRequest(opCreateDHCPOptions, input, output) + output = &CreateDHCPOptionsOutput{} + req.Data = output + return +} + +// Creates a set of DHCP options for your VPC. After creating the set, you must +// associate it with the VPC, causing all existing and new instances that you +// launch in the VPC to use this set of DHCP options. The following are the +// individual DHCP options you can specify. For more information about the options, +// see RFC 2132 (http://www.ietf.org/rfc/rfc2132.txt). +// +// domain-name-servers - The IP addresses of up to four domain name servers, +// or AmazonProvidedDNS. The default DHCP option set specifies AmazonProvidedDNS. +// If specifying more than one domain name server, specify the IP addresses +// in a single parameter, separated by commas. domain-name - If you're using +// AmazonProvidedDNS in us-east-1, specify ec2.internal. If you're using AmazonProvidedDNS +// in another region, specify region.compute.internal (for example, ap-northeast-1.compute.internal). +// Otherwise, specify a domain name (for example, MyCompany.com). Important: +// Some Linux operating systems accept multiple domain names separated by spaces. +// However, Windows and other Linux operating systems treat the value as a single +// domain, which results in unexpected behavior. If your DHCP options set is +// associated with a VPC that has instances with multiple operating systems, +// specify only one domain name. ntp-servers - The IP addresses of up to four +// Network Time Protocol (NTP) servers. netbios-name-servers - The IP addresses +// of up to four NetBIOS name servers. netbios-node-type - The NetBIOS node +// type (1, 2, 4, or 8). We recommend that you specify 2 (broadcast and multicast +// are not currently supported). For more information about these node types, +// see RFC 2132 (http://www.ietf.org/rfc/rfc2132.txt). Your VPC automatically +// starts out with a set of DHCP options that includes only a DNS server that +// we provide (AmazonProvidedDNS). If you create a set of options, and if your +// VPC has an Internet gateway, make sure to set the domain-name-servers option +// either to AmazonProvidedDNS or to a domain name server of your choice. For +// more information about DHCP options, see DHCP Options Sets (http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_DHCP_Options.html) +// in the Amazon Virtual Private Cloud User Guide. +func (c *EC2) CreateDHCPOptions(input *CreateDHCPOptionsInput) (output *CreateDHCPOptionsOutput, err error) { + req, out := c.CreateDHCPOptionsRequest(input) + output = out + err = req.Send() + return +} + +var opCreateDHCPOptions *aws.Operation + +// CreateImageRequest generates a request for the CreateImage operation. +func (c *EC2) CreateImageRequest(input *CreateImageInput) (req *aws.Request, output *CreateImageOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opCreateImage == nil { + opCreateImage = &aws.Operation{ + Name: "CreateImage", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &CreateImageInput{} + } + + req = c.newRequest(opCreateImage, input, output) + output = &CreateImageOutput{} + req.Data = output + return +} + +// Creates an Amazon EBS-backed AMI from an Amazon EBS-backed instance that +// is either running or stopped. +// +// If you customized your instance with instance store volumes or EBS volumes +// in addition to the root device volume, the new AMI contains block device +// mapping information for those volumes. When you launch an instance from this +// new AMI, the instance automatically launches with those additional volumes. +// +// For more information, see Creating Amazon EBS-Backed Linux AMIs (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/creating-an-ami-ebs.html) +// in the Amazon Elastic Compute Cloud User Guide. +func (c *EC2) CreateImage(input *CreateImageInput) (output *CreateImageOutput, err error) { + req, out := c.CreateImageRequest(input) + output = out + err = req.Send() + return +} + +var opCreateImage *aws.Operation + +// CreateInstanceExportTaskRequest generates a request for the CreateInstanceExportTask operation. +func (c *EC2) CreateInstanceExportTaskRequest(input *CreateInstanceExportTaskInput) (req *aws.Request, output *CreateInstanceExportTaskOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opCreateInstanceExportTask == nil { + opCreateInstanceExportTask = &aws.Operation{ + Name: "CreateInstanceExportTask", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &CreateInstanceExportTaskInput{} + } + + req = c.newRequest(opCreateInstanceExportTask, input, output) + output = &CreateInstanceExportTaskOutput{} + req.Data = output + return +} + +// Exports a running or stopped instance to an Amazon S3 bucket. +// +// For information about the supported operating systems, image formats, and +// known limitations for the types of instances you can export, see Exporting +// EC2 Instances (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ExportingEC2Instances.html) +// in the Amazon Elastic Compute Cloud User Guide. +func (c *EC2) CreateInstanceExportTask(input *CreateInstanceExportTaskInput) (output *CreateInstanceExportTaskOutput, err error) { + req, out := c.CreateInstanceExportTaskRequest(input) + output = out + err = req.Send() + return +} + +var opCreateInstanceExportTask *aws.Operation + +// CreateInternetGatewayRequest generates a request for the CreateInternetGateway operation. +func (c *EC2) CreateInternetGatewayRequest(input *CreateInternetGatewayInput) (req *aws.Request, output *CreateInternetGatewayOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opCreateInternetGateway == nil { + opCreateInternetGateway = &aws.Operation{ + Name: "CreateInternetGateway", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &CreateInternetGatewayInput{} + } + + req = c.newRequest(opCreateInternetGateway, input, output) + output = &CreateInternetGatewayOutput{} + req.Data = output + return +} + +// Creates an Internet gateway for use with a VPC. After creating the Internet +// gateway, you attach it to a VPC using AttachInternetGateway. +// +// For more information about your VPC and Internet gateway, see the Amazon +// Virtual Private Cloud User Guide (http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/). +func (c *EC2) CreateInternetGateway(input *CreateInternetGatewayInput) (output *CreateInternetGatewayOutput, err error) { + req, out := c.CreateInternetGatewayRequest(input) + output = out + err = req.Send() + return +} + +var opCreateInternetGateway *aws.Operation + +// CreateKeyPairRequest generates a request for the CreateKeyPair operation. +func (c *EC2) CreateKeyPairRequest(input *CreateKeyPairInput) (req *aws.Request, output *CreateKeyPairOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opCreateKeyPair == nil { + opCreateKeyPair = &aws.Operation{ + Name: "CreateKeyPair", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &CreateKeyPairInput{} + } + + req = c.newRequest(opCreateKeyPair, input, output) + output = &CreateKeyPairOutput{} + req.Data = output + return +} + +// Creates a 2048-bit RSA key pair with the specified name. Amazon EC2 stores +// the public key and displays the private key for you to save to a file. The +// private key is returned as an unencrypted PEM encoded PKCS#8 private key. +// If a key with the specified name already exists, Amazon EC2 returns an error. +// +// You can have up to five thousand key pairs per region. +// +// The key pair returned to you is available only in the region in which you +// create it. To create a key pair that is available in all regions, use ImportKeyPair. +// +// For more information about key pairs, see Key Pairs (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-key-pairs.html) +// in the Amazon Elastic Compute Cloud User Guide. +func (c *EC2) CreateKeyPair(input *CreateKeyPairInput) (output *CreateKeyPairOutput, err error) { + req, out := c.CreateKeyPairRequest(input) + output = out + err = req.Send() + return +} + +var opCreateKeyPair *aws.Operation + +// CreateNetworkACLRequest generates a request for the CreateNetworkACL operation. +func (c *EC2) CreateNetworkACLRequest(input *CreateNetworkACLInput) (req *aws.Request, output *CreateNetworkACLOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opCreateNetworkACL == nil { + opCreateNetworkACL = &aws.Operation{ + Name: "CreateNetworkAcl", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &CreateNetworkACLInput{} + } + + req = c.newRequest(opCreateNetworkACL, input, output) + output = &CreateNetworkACLOutput{} + req.Data = output + return +} + +// Creates a network ACL in a VPC. Network ACLs provide an optional layer of +// security (in addition to security groups) for the instances in your VPC. +// +// For more information about network ACLs, see Network ACLs (http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_ACLs.html) +// in the Amazon Virtual Private Cloud User Guide. +func (c *EC2) CreateNetworkACL(input *CreateNetworkACLInput) (output *CreateNetworkACLOutput, err error) { + req, out := c.CreateNetworkACLRequest(input) + output = out + err = req.Send() + return +} + +var opCreateNetworkACL *aws.Operation + +// CreateNetworkACLEntryRequest generates a request for the CreateNetworkACLEntry operation. +func (c *EC2) CreateNetworkACLEntryRequest(input *CreateNetworkACLEntryInput) (req *aws.Request, output *CreateNetworkACLEntryOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opCreateNetworkACLEntry == nil { + opCreateNetworkACLEntry = &aws.Operation{ + Name: "CreateNetworkAclEntry", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &CreateNetworkACLEntryInput{} + } + + req = c.newRequest(opCreateNetworkACLEntry, input, output) + output = &CreateNetworkACLEntryOutput{} + req.Data = output + return +} + +// Creates an entry (a rule) in a network ACL with the specified rule number. +// Each network ACL has a set of numbered ingress rules and a separate set of +// numbered egress rules. When determining whether a packet should be allowed +// in or out of a subnet associated with the ACL, we process the entries in +// the ACL according to the rule numbers, in ascending order. Each network ACL +// has a set of ingress rules and a separate set of egress rules. +// +// We recommend that you leave room between the rule numbers (for example, +// 100, 110, 120, ...), and not number them one right after the other (for example, +// 101, 102, 103, ...). This makes it easier to add a rule between existing +// ones without having to renumber the rules. +// +// After you add an entry, you can't modify it; you must either replace it, +// or create an entry and delete the old one. +// +// For more information about network ACLs, see Network ACLs (http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_ACLs.html) +// in the Amazon Virtual Private Cloud User Guide. +func (c *EC2) CreateNetworkACLEntry(input *CreateNetworkACLEntryInput) (output *CreateNetworkACLEntryOutput, err error) { + req, out := c.CreateNetworkACLEntryRequest(input) + output = out + err = req.Send() + return +} + +var opCreateNetworkACLEntry *aws.Operation + +// CreateNetworkInterfaceRequest generates a request for the CreateNetworkInterface operation. +func (c *EC2) CreateNetworkInterfaceRequest(input *CreateNetworkInterfaceInput) (req *aws.Request, output *CreateNetworkInterfaceOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opCreateNetworkInterface == nil { + opCreateNetworkInterface = &aws.Operation{ + Name: "CreateNetworkInterface", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &CreateNetworkInterfaceInput{} + } + + req = c.newRequest(opCreateNetworkInterface, input, output) + output = &CreateNetworkInterfaceOutput{} + req.Data = output + return +} + +// Creates a network interface in the specified subnet. +// +// For more information about network interfaces, see Elastic Network Interfaces +// (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-eni.html) in the +// Amazon Elastic Compute Cloud User Guide. +func (c *EC2) CreateNetworkInterface(input *CreateNetworkInterfaceInput) (output *CreateNetworkInterfaceOutput, err error) { + req, out := c.CreateNetworkInterfaceRequest(input) + output = out + err = req.Send() + return +} + +var opCreateNetworkInterface *aws.Operation + +// CreatePlacementGroupRequest generates a request for the CreatePlacementGroup operation. +func (c *EC2) CreatePlacementGroupRequest(input *CreatePlacementGroupInput) (req *aws.Request, output *CreatePlacementGroupOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opCreatePlacementGroup == nil { + opCreatePlacementGroup = &aws.Operation{ + Name: "CreatePlacementGroup", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &CreatePlacementGroupInput{} + } + + req = c.newRequest(opCreatePlacementGroup, input, output) + output = &CreatePlacementGroupOutput{} + req.Data = output + return +} + +// Creates a placement group that you launch cluster instances into. You must +// give the group a name that's unique within the scope of your account. +// +// For more information about placement groups and cluster instances, see Cluster +// Instances (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using_cluster_computing.html) +// in the Amazon Elastic Compute Cloud User Guide. +func (c *EC2) CreatePlacementGroup(input *CreatePlacementGroupInput) (output *CreatePlacementGroupOutput, err error) { + req, out := c.CreatePlacementGroupRequest(input) + output = out + err = req.Send() + return +} + +var opCreatePlacementGroup *aws.Operation + +// CreateReservedInstancesListingRequest generates a request for the CreateReservedInstancesListing operation. +func (c *EC2) CreateReservedInstancesListingRequest(input *CreateReservedInstancesListingInput) (req *aws.Request, output *CreateReservedInstancesListingOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opCreateReservedInstancesListing == nil { + opCreateReservedInstancesListing = &aws.Operation{ + Name: "CreateReservedInstancesListing", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &CreateReservedInstancesListingInput{} + } + + req = c.newRequest(opCreateReservedInstancesListing, input, output) + output = &CreateReservedInstancesListingOutput{} + req.Data = output + 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 +// 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. +// +// 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 +// operation. +// +// 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. +func (c *EC2) CreateReservedInstancesListing(input *CreateReservedInstancesListingInput) (output *CreateReservedInstancesListingOutput, err error) { + req, out := c.CreateReservedInstancesListingRequest(input) + output = out + err = req.Send() + return +} + +var opCreateReservedInstancesListing *aws.Operation + +// CreateRouteRequest generates a request for the CreateRoute operation. +func (c *EC2) CreateRouteRequest(input *CreateRouteInput) (req *aws.Request, output *CreateRouteOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opCreateRoute == nil { + opCreateRoute = &aws.Operation{ + Name: "CreateRoute", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &CreateRouteInput{} + } + + req = c.newRequest(opCreateRoute, input, output) + output = &CreateRouteOutput{} + req.Data = output + return +} + +// Creates a route in a route table within a VPC. +// +// You must specify one of the following targets: Internet gateway or virtual +// private gateway, NAT instance, VPC peering connection, or network interface. +// +// When determining how to route traffic, we use the route with the most specific +// match. For example, let's say the traffic is destined for 192.0.2.3, and +// the route table includes the following two routes: +// +// 192.0.2.0/24 (goes to some target A) +// +// 192.0.2.0/28 (goes to some target B) +// +// Both routes apply to the traffic destined for 192.0.2.3. However, the +// second route in the list covers a smaller number of IP addresses and is therefore +// more specific, so we use that route to determine where to target the traffic. +// +// For more information about route tables, see Route Tables (http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_Route_Tables.html) +// in the Amazon Virtual Private Cloud User Guide. +func (c *EC2) CreateRoute(input *CreateRouteInput) (output *CreateRouteOutput, err error) { + req, out := c.CreateRouteRequest(input) + output = out + err = req.Send() + return +} + +var opCreateRoute *aws.Operation + +// CreateRouteTableRequest generates a request for the CreateRouteTable operation. +func (c *EC2) CreateRouteTableRequest(input *CreateRouteTableInput) (req *aws.Request, output *CreateRouteTableOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opCreateRouteTable == nil { + opCreateRouteTable = &aws.Operation{ + Name: "CreateRouteTable", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &CreateRouteTableInput{} + } + + req = c.newRequest(opCreateRouteTable, input, output) + output = &CreateRouteTableOutput{} + req.Data = output + return +} + +// Creates a route table for the specified VPC. After you create a route table, +// you can add routes and associate the table with a subnet. +// +// For more information about route tables, see Route Tables (http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_Route_Tables.html) +// in the Amazon Virtual Private Cloud User Guide. +func (c *EC2) CreateRouteTable(input *CreateRouteTableInput) (output *CreateRouteTableOutput, err error) { + req, out := c.CreateRouteTableRequest(input) + output = out + err = req.Send() + return +} + +var opCreateRouteTable *aws.Operation + +// CreateSecurityGroupRequest generates a request for the CreateSecurityGroup operation. +func (c *EC2) CreateSecurityGroupRequest(input *CreateSecurityGroupInput) (req *aws.Request, output *CreateSecurityGroupOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opCreateSecurityGroup == nil { + opCreateSecurityGroup = &aws.Operation{ + Name: "CreateSecurityGroup", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &CreateSecurityGroupInput{} + } + + req = c.newRequest(opCreateSecurityGroup, input, output) + output = &CreateSecurityGroupOutput{} + req.Data = output + return +} + +// Creates a security group. +// +// A security group is for use with instances either in the EC2-Classic platform +// or in a specific VPC. For more information, see Amazon EC2 Security Groups +// (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-network-security.html) +// in the Amazon Elastic Compute Cloud User Guide and Security Groups for Your +// VPC (http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_SecurityGroups.html) +// in the Amazon Virtual Private Cloud User Guide. +// +// EC2-Classic: You can have up to 500 security groups. +// +// EC2-VPC: You can create up to 100 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 +// a security group for use in a VPC. However, you can't have two security groups +// for use in EC2-Classic with the same name or two security groups for use +// in a VPC with the same name. +// +// You have a default security group for use in EC2-Classic and a default security +// group for use in your VPC. If you don't specify a security group when you +// launch an instance, the instance is launched into the appropriate default +// security group. A default security group includes a default rule that grants +// instances unrestricted network access to each other. +// +// You can add or remove rules from your security groups using AuthorizeSecurityGroupIngress, +// AuthorizeSecurityGroupEgress, RevokeSecurityGroupIngress, and RevokeSecurityGroupEgress. +func (c *EC2) CreateSecurityGroup(input *CreateSecurityGroupInput) (output *CreateSecurityGroupOutput, err error) { + req, out := c.CreateSecurityGroupRequest(input) + output = out + err = req.Send() + return +} + +var opCreateSecurityGroup *aws.Operation + +// CreateSnapshotRequest generates a request for the CreateSnapshot operation. +func (c *EC2) CreateSnapshotRequest(input *CreateSnapshotInput) (req *aws.Request, output *Snapshot) { + oprw.Lock() + defer oprw.Unlock() + + if opCreateSnapshot == nil { + opCreateSnapshot = &aws.Operation{ + Name: "CreateSnapshot", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &CreateSnapshotInput{} + } + + req = c.newRequest(opCreateSnapshot, input, output) + output = &Snapshot{} + req.Data = output + return +} + +// Creates a snapshot of an Amazon EBS volume and stores it in Amazon S3. You +// can use snapshots for backups, to make copies of Amazon EBS volumes, and +// to save data before shutting down an instance. +// +// When a snapshot is created, any AWS Marketplace product codes that are associated +// with the source volume are propagated to the snapshot. +// +// You can take a snapshot of an attached volume that is in use. However, snapshots +// only capture data that has been written to your Amazon EBS volume at the +// time the snapshot command is issued; this may exclude any data that has been +// cached by any applications or the operating system. If you can pause any +// file systems on the volume long enough to take a snapshot, your snapshot +// should be complete. However, if you cannot pause all file writes to the volume, +// you should unmount the volume from within the instance, issue the snapshot +// command, and then remount the volume to ensure a consistent and complete +// snapshot. You may remount and use your volume while the snapshot status is +// pending. +// +// To create a snapshot for Amazon EBS volumes that serve as root devices, +// you should stop the instance before taking the snapshot. +// +// Snapshots that are taken from encrypted volumes are automatically encrypted. +// Volumes that are created from encrypted snapshots are also automatically +// encrypted. Your encrypted volumes and any associated snapshots always remain +// protected. +// +// For more information, see Amazon Elastic Block Store (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/AmazonEBS.html) +// and Amazon EBS Encryption (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSEncryption.html) +// in the Amazon Elastic Compute Cloud User Guide. +func (c *EC2) CreateSnapshot(input *CreateSnapshotInput) (output *Snapshot, err error) { + req, out := c.CreateSnapshotRequest(input) + output = out + err = req.Send() + return +} + +var opCreateSnapshot *aws.Operation + +// CreateSpotDatafeedSubscriptionRequest generates a request for the CreateSpotDatafeedSubscription operation. +func (c *EC2) CreateSpotDatafeedSubscriptionRequest(input *CreateSpotDatafeedSubscriptionInput) (req *aws.Request, output *CreateSpotDatafeedSubscriptionOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opCreateSpotDatafeedSubscription == nil { + opCreateSpotDatafeedSubscription = &aws.Operation{ + Name: "CreateSpotDatafeedSubscription", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &CreateSpotDatafeedSubscriptionInput{} + } + + req = c.newRequest(opCreateSpotDatafeedSubscription, input, output) + output = &CreateSpotDatafeedSubscriptionOutput{} + req.Data = output + return +} + +// Creates a data feed for Spot Instances, enabling you to view Spot Instance +// usage logs. You can create one data feed per AWS account. For more information, +// see Spot Instance Data Feed (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/spot-data-feeds.html) +// in the Amazon Elastic Compute Cloud User Guide. +func (c *EC2) CreateSpotDatafeedSubscription(input *CreateSpotDatafeedSubscriptionInput) (output *CreateSpotDatafeedSubscriptionOutput, err error) { + req, out := c.CreateSpotDatafeedSubscriptionRequest(input) + output = out + err = req.Send() + return +} + +var opCreateSpotDatafeedSubscription *aws.Operation + +// CreateSubnetRequest generates a request for the CreateSubnet operation. +func (c *EC2) CreateSubnetRequest(input *CreateSubnetInput) (req *aws.Request, output *CreateSubnetOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opCreateSubnet == nil { + opCreateSubnet = &aws.Operation{ + Name: "CreateSubnet", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &CreateSubnetInput{} + } + + req = c.newRequest(opCreateSubnet, input, output) + output = &CreateSubnetOutput{} + req.Data = output + return +} + +// Creates a subnet in an existing VPC. +// +// When you create each subnet, you provide the VPC ID and the CIDR block you +// want for the subnet. After you create a subnet, you can't change its CIDR +// block. The subnet's CIDR block can be the same as the VPC's CIDR block (assuming +// you want only a single subnet in the VPC), or a subset of the VPC's CIDR +// block. If you create more than one subnet in a VPC, the subnets' CIDR blocks +// must not overlap. The smallest subnet (and VPC) you can create uses a /28 +// netmask (16 IP addresses), and the largest uses a /16 netmask (65,536 IP +// addresses). +// +// AWS reserves both the first four and the last IP address in each subnet's +// CIDR block. They're not available for use. +// +// If you add more than one subnet to a VPC, they're set up in a star topology +// with a logical router in the middle. +// +// If you launch an instance in a VPC using an Amazon EBS-backed AMI, the IP +// address doesn't change if you stop and restart the instance (unlike a similar +// instance launched outside a VPC, which gets a new IP address when restarted). +// It's therefore possible to have a subnet with no running instances (they're +// all stopped), but no remaining IP addresses available. +// +// For more information about subnets, see Your VPC and Subnets (http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_Subnets.html) +// in the Amazon Virtual Private Cloud User Guide. +func (c *EC2) CreateSubnet(input *CreateSubnetInput) (output *CreateSubnetOutput, err error) { + req, out := c.CreateSubnetRequest(input) + output = out + err = req.Send() + return +} + +var opCreateSubnet *aws.Operation + +// CreateTagsRequest generates a request for the CreateTags operation. +func (c *EC2) CreateTagsRequest(input *CreateTagsInput) (req *aws.Request, output *CreateTagsOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opCreateTags == nil { + opCreateTags = &aws.Operation{ + Name: "CreateTags", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &CreateTagsInput{} + } + + req = c.newRequest(opCreateTags, input, output) + output = &CreateTagsOutput{} + req.Data = output + return +} + +// Adds or overwrites one or more tags for the specified Amazon EC2 resource +// or resources. Each resource can have a maximum of 10 tags. Each tag consists +// of a key and optional value. Tag keys must be unique per resource. +// +// For more information about tags, see Tagging Your Resources (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Using_Tags.html) +// in the Amazon Elastic Compute Cloud User Guide. +func (c *EC2) CreateTags(input *CreateTagsInput) (output *CreateTagsOutput, err error) { + req, out := c.CreateTagsRequest(input) + output = out + err = req.Send() + return +} + +var opCreateTags *aws.Operation + +// CreateVPCRequest generates a request for the CreateVPC operation. +func (c *EC2) CreateVPCRequest(input *CreateVPCInput) (req *aws.Request, output *CreateVPCOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opCreateVPC == nil { + opCreateVPC = &aws.Operation{ + Name: "CreateVpc", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &CreateVPCInput{} + } + + req = c.newRequest(opCreateVPC, input, output) + output = &CreateVPCOutput{} + req.Data = output + return +} + +// Creates a VPC with the specified CIDR block. +// +// The smallest VPC you can create uses a /28 netmask (16 IP addresses), and +// the largest uses a /16 netmask (65,536 IP addresses). To help you decide +// how big to make your VPC, see Your VPC and Subnets (http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_Subnets.html) +// in the Amazon Virtual Private Cloud User Guide. +// +// By default, each instance you launch in the VPC has the default DHCP options, +// which includes only a default DNS server that we provide (AmazonProvidedDNS). +// For more information about DHCP options, see DHCP Options Sets (http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_DHCP_Options.html) +// in the Amazon Virtual Private Cloud User Guide. +func (c *EC2) CreateVPC(input *CreateVPCInput) (output *CreateVPCOutput, err error) { + req, out := c.CreateVPCRequest(input) + output = out + err = req.Send() + return +} + +var opCreateVPC *aws.Operation + +// CreateVPCPeeringConnectionRequest generates a request for the CreateVPCPeeringConnection operation. +func (c *EC2) CreateVPCPeeringConnectionRequest(input *CreateVPCPeeringConnectionInput) (req *aws.Request, output *CreateVPCPeeringConnectionOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opCreateVPCPeeringConnection == nil { + opCreateVPCPeeringConnection = &aws.Operation{ + Name: "CreateVpcPeeringConnection", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &CreateVPCPeeringConnectionInput{} + } + + req = c.newRequest(opCreateVPCPeeringConnection, input, output) + output = &CreateVPCPeeringConnectionOutput{} + req.Data = output + return +} + +// Requests a VPC peering connection between two VPCs: a requester VPC that +// you own and a peer VPC with which to create the connection. The peer VPC +// can belong to another AWS account. The requester VPC and peer VPC cannot +// have overlapping CIDR blocks. +// +// The owner of the peer VPC must accept the peering request to activate the +// peering connection. The VPC peering connection request expires after 7 days, +// after which it cannot be accepted or rejected. +// +// A CreateVpcPeeringConnection request between VPCs with overlapping CIDR +// blocks results in the VPC peering connection having a status of failed. +func (c *EC2) CreateVPCPeeringConnection(input *CreateVPCPeeringConnectionInput) (output *CreateVPCPeeringConnectionOutput, err error) { + req, out := c.CreateVPCPeeringConnectionRequest(input) + output = out + err = req.Send() + return +} + +var opCreateVPCPeeringConnection *aws.Operation + +// CreateVPNConnectionRequest generates a request for the CreateVPNConnection operation. +func (c *EC2) CreateVPNConnectionRequest(input *CreateVPNConnectionInput) (req *aws.Request, output *CreateVPNConnectionOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opCreateVPNConnection == nil { + opCreateVPNConnection = &aws.Operation{ + Name: "CreateVpnConnection", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &CreateVPNConnectionInput{} + } + + req = c.newRequest(opCreateVPNConnection, input, output) + output = &CreateVPNConnectionOutput{} + req.Data = output + return +} + +// Creates a VPN connection between an existing virtual private gateway and +// a VPN customer gateway. The only supported connection type is ipsec.1. +// +// The response includes information that you need to give to your network +// administrator to configure your customer gateway. +// +// We strongly recommend that you use HTTPS when calling this operation because +// the response contains sensitive cryptographic information for configuring +// your customer gateway. +// +// If you decide to shut down your VPN connection for any reason and later +// create a new VPN connection, you must reconfigure your customer gateway with +// the new information returned from this call. +// +// For more information about VPN connections, see Adding a Hardware Virtual +// Private Gateway to Your VPC (http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_VPN.html) +// in the Amazon Virtual Private Cloud User Guide. +func (c *EC2) CreateVPNConnection(input *CreateVPNConnectionInput) (output *CreateVPNConnectionOutput, err error) { + req, out := c.CreateVPNConnectionRequest(input) + output = out + err = req.Send() + return +} + +var opCreateVPNConnection *aws.Operation + +// CreateVPNConnectionRouteRequest generates a request for the CreateVPNConnectionRoute operation. +func (c *EC2) CreateVPNConnectionRouteRequest(input *CreateVPNConnectionRouteInput) (req *aws.Request, output *CreateVPNConnectionRouteOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opCreateVPNConnectionRoute == nil { + opCreateVPNConnectionRoute = &aws.Operation{ + Name: "CreateVpnConnectionRoute", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &CreateVPNConnectionRouteInput{} + } + + req = c.newRequest(opCreateVPNConnectionRoute, input, output) + output = &CreateVPNConnectionRouteOutput{} + req.Data = output + return +} + +// Creates a static route associated with a VPN connection between an existing +// virtual private gateway and a VPN customer gateway. The static route allows +// traffic to be routed from the virtual private gateway to the VPN customer +// gateway. +// +// For more information about VPN connections, see Adding a Hardware Virtual +// Private Gateway to Your VPC (http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_VPN.html) +// in the Amazon Virtual Private Cloud User Guide. +func (c *EC2) CreateVPNConnectionRoute(input *CreateVPNConnectionRouteInput) (output *CreateVPNConnectionRouteOutput, err error) { + req, out := c.CreateVPNConnectionRouteRequest(input) + output = out + err = req.Send() + return +} + +var opCreateVPNConnectionRoute *aws.Operation + +// CreateVPNGatewayRequest generates a request for the CreateVPNGateway operation. +func (c *EC2) CreateVPNGatewayRequest(input *CreateVPNGatewayInput) (req *aws.Request, output *CreateVPNGatewayOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opCreateVPNGateway == nil { + opCreateVPNGateway = &aws.Operation{ + Name: "CreateVpnGateway", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &CreateVPNGatewayInput{} + } + + req = c.newRequest(opCreateVPNGateway, input, output) + output = &CreateVPNGatewayOutput{} + req.Data = output + return +} + +// Creates a virtual private gateway. A virtual private gateway is the endpoint +// on the VPC side of your VPN connection. You can create a virtual private +// gateway before creating the VPC itself. +// +// For more information about virtual private gateways, see Adding a Hardware +// Virtual Private Gateway to Your VPC (http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_VPN.html) +// in the Amazon Virtual Private Cloud User Guide. +func (c *EC2) CreateVPNGateway(input *CreateVPNGatewayInput) (output *CreateVPNGatewayOutput, err error) { + req, out := c.CreateVPNGatewayRequest(input) + output = out + err = req.Send() + return +} + +var opCreateVPNGateway *aws.Operation + +// CreateVolumeRequest generates a request for the CreateVolume operation. +func (c *EC2) CreateVolumeRequest(input *CreateVolumeInput) (req *aws.Request, output *Volume) { + oprw.Lock() + defer oprw.Unlock() + + if opCreateVolume == nil { + opCreateVolume = &aws.Operation{ + Name: "CreateVolume", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &CreateVolumeInput{} + } + + req = c.newRequest(opCreateVolume, input, output) + output = &Volume{} + req.Data = output + return +} + +// Creates an Amazon EBS volume that can be attached to an instance in the same +// Availability Zone. The volume is created in the regional endpoint that you +// send the HTTP request to. For more information see Regions and Endpoints +// (http://docs.aws.amazon.com/general/latest/gr/rande.html). +// +// You can create a new empty volume or restore a volume from an Amazon EBS +// snapshot. Any AWS Marketplace product codes from the snapshot are propagated +// to the volume. +// +// You can create encrypted volumes with the Encrypted parameter. Encrypted +// volumes may only be attached to instances that support Amazon EBS encryption. +// Volumes that are created from encrypted snapshots are also automatically +// encrypted. For more information, see Amazon EBS Encryption (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSEncryption.html) +// in the Amazon Elastic Compute Cloud User Guide. +// +// For more information, see Creating or Restoring an Amazon EBS Volume (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-creating-volume.html) +// in the Amazon Elastic Compute Cloud User Guide. +func (c *EC2) CreateVolume(input *CreateVolumeInput) (output *Volume, err error) { + req, out := c.CreateVolumeRequest(input) + output = out + err = req.Send() + return +} + +var opCreateVolume *aws.Operation + +// DeleteCustomerGatewayRequest generates a request for the DeleteCustomerGateway operation. +func (c *EC2) DeleteCustomerGatewayRequest(input *DeleteCustomerGatewayInput) (req *aws.Request, output *DeleteCustomerGatewayOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opDeleteCustomerGateway == nil { + opDeleteCustomerGateway = &aws.Operation{ + Name: "DeleteCustomerGateway", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &DeleteCustomerGatewayInput{} + } + + req = c.newRequest(opDeleteCustomerGateway, input, output) + output = &DeleteCustomerGatewayOutput{} + req.Data = output + return +} + +// Deletes the specified customer gateway. You must delete the VPN connection +// before you can delete the customer gateway. +func (c *EC2) DeleteCustomerGateway(input *DeleteCustomerGatewayInput) (output *DeleteCustomerGatewayOutput, err error) { + req, out := c.DeleteCustomerGatewayRequest(input) + output = out + err = req.Send() + return +} + +var opDeleteCustomerGateway *aws.Operation + +// DeleteDHCPOptionsRequest generates a request for the DeleteDHCPOptions operation. +func (c *EC2) DeleteDHCPOptionsRequest(input *DeleteDHCPOptionsInput) (req *aws.Request, output *DeleteDHCPOptionsOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opDeleteDHCPOptions == nil { + opDeleteDHCPOptions = &aws.Operation{ + Name: "DeleteDhcpOptions", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &DeleteDHCPOptionsInput{} + } + + req = c.newRequest(opDeleteDHCPOptions, input, output) + output = &DeleteDHCPOptionsOutput{} + req.Data = output + return +} + +// Deletes the specified set of DHCP options. You must disassociate the set +// of DHCP options before you can delete it. You can disassociate the set of +// DHCP options by associating either a new set of options or the default set +// of options with the VPC. +func (c *EC2) DeleteDHCPOptions(input *DeleteDHCPOptionsInput) (output *DeleteDHCPOptionsOutput, err error) { + req, out := c.DeleteDHCPOptionsRequest(input) + output = out + err = req.Send() + return +} + +var opDeleteDHCPOptions *aws.Operation + +// DeleteInternetGatewayRequest generates a request for the DeleteInternetGateway operation. +func (c *EC2) DeleteInternetGatewayRequest(input *DeleteInternetGatewayInput) (req *aws.Request, output *DeleteInternetGatewayOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opDeleteInternetGateway == nil { + opDeleteInternetGateway = &aws.Operation{ + Name: "DeleteInternetGateway", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &DeleteInternetGatewayInput{} + } + + req = c.newRequest(opDeleteInternetGateway, input, output) + output = &DeleteInternetGatewayOutput{} + req.Data = output + return +} + +// Deletes the specified Internet gateway. You must detach the Internet gateway +// from the VPC before you can delete it. +func (c *EC2) DeleteInternetGateway(input *DeleteInternetGatewayInput) (output *DeleteInternetGatewayOutput, err error) { + req, out := c.DeleteInternetGatewayRequest(input) + output = out + err = req.Send() + return +} + +var opDeleteInternetGateway *aws.Operation + +// DeleteKeyPairRequest generates a request for the DeleteKeyPair operation. +func (c *EC2) DeleteKeyPairRequest(input *DeleteKeyPairInput) (req *aws.Request, output *DeleteKeyPairOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opDeleteKeyPair == nil { + opDeleteKeyPair = &aws.Operation{ + Name: "DeleteKeyPair", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &DeleteKeyPairInput{} + } + + req = c.newRequest(opDeleteKeyPair, input, output) + output = &DeleteKeyPairOutput{} + req.Data = output + return +} + +// Deletes the specified key pair, by removing the public key from Amazon EC2. +func (c *EC2) DeleteKeyPair(input *DeleteKeyPairInput) (output *DeleteKeyPairOutput, err error) { + req, out := c.DeleteKeyPairRequest(input) + output = out + err = req.Send() + return +} + +var opDeleteKeyPair *aws.Operation + +// DeleteNetworkACLRequest generates a request for the DeleteNetworkACL operation. +func (c *EC2) DeleteNetworkACLRequest(input *DeleteNetworkACLInput) (req *aws.Request, output *DeleteNetworkACLOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opDeleteNetworkACL == nil { + opDeleteNetworkACL = &aws.Operation{ + Name: "DeleteNetworkAcl", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &DeleteNetworkACLInput{} + } + + req = c.newRequest(opDeleteNetworkACL, input, output) + output = &DeleteNetworkACLOutput{} + req.Data = output + return +} + +// Deletes the specified network ACL. You can't delete the ACL if it's associated +// with any subnets. You can't delete the default network ACL. +func (c *EC2) DeleteNetworkACL(input *DeleteNetworkACLInput) (output *DeleteNetworkACLOutput, err error) { + req, out := c.DeleteNetworkACLRequest(input) + output = out + err = req.Send() + return +} + +var opDeleteNetworkACL *aws.Operation + +// DeleteNetworkACLEntryRequest generates a request for the DeleteNetworkACLEntry operation. +func (c *EC2) DeleteNetworkACLEntryRequest(input *DeleteNetworkACLEntryInput) (req *aws.Request, output *DeleteNetworkACLEntryOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opDeleteNetworkACLEntry == nil { + opDeleteNetworkACLEntry = &aws.Operation{ + Name: "DeleteNetworkAclEntry", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &DeleteNetworkACLEntryInput{} + } + + req = c.newRequest(opDeleteNetworkACLEntry, input, output) + output = &DeleteNetworkACLEntryOutput{} + req.Data = output + return +} + +// Deletes the specified ingress or egress entry (rule) from the specified network +// ACL. +func (c *EC2) DeleteNetworkACLEntry(input *DeleteNetworkACLEntryInput) (output *DeleteNetworkACLEntryOutput, err error) { + req, out := c.DeleteNetworkACLEntryRequest(input) + output = out + err = req.Send() + return +} + +var opDeleteNetworkACLEntry *aws.Operation + +// DeleteNetworkInterfaceRequest generates a request for the DeleteNetworkInterface operation. +func (c *EC2) DeleteNetworkInterfaceRequest(input *DeleteNetworkInterfaceInput) (req *aws.Request, output *DeleteNetworkInterfaceOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opDeleteNetworkInterface == nil { + opDeleteNetworkInterface = &aws.Operation{ + Name: "DeleteNetworkInterface", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &DeleteNetworkInterfaceInput{} + } + + req = c.newRequest(opDeleteNetworkInterface, input, output) + output = &DeleteNetworkInterfaceOutput{} + req.Data = output + return +} + +// Deletes the specified network interface. You must detach the network interface +// before you can delete it. +func (c *EC2) DeleteNetworkInterface(input *DeleteNetworkInterfaceInput) (output *DeleteNetworkInterfaceOutput, err error) { + req, out := c.DeleteNetworkInterfaceRequest(input) + output = out + err = req.Send() + return +} + +var opDeleteNetworkInterface *aws.Operation + +// DeletePlacementGroupRequest generates a request for the DeletePlacementGroup operation. +func (c *EC2) DeletePlacementGroupRequest(input *DeletePlacementGroupInput) (req *aws.Request, output *DeletePlacementGroupOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opDeletePlacementGroup == nil { + opDeletePlacementGroup = &aws.Operation{ + Name: "DeletePlacementGroup", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &DeletePlacementGroupInput{} + } + + req = c.newRequest(opDeletePlacementGroup, input, output) + output = &DeletePlacementGroupOutput{} + req.Data = output + return +} + +// Deletes the specified placement group. You must terminate all instances in +// the placement group before you can delete the placement group. For more information +// about placement groups and cluster instances, see Cluster Instances (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using_cluster_computing.html) +// in the Amazon Elastic Compute Cloud User Guide. +func (c *EC2) DeletePlacementGroup(input *DeletePlacementGroupInput) (output *DeletePlacementGroupOutput, err error) { + req, out := c.DeletePlacementGroupRequest(input) + output = out + err = req.Send() + return +} + +var opDeletePlacementGroup *aws.Operation + +// DeleteRouteRequest generates a request for the DeleteRoute operation. +func (c *EC2) DeleteRouteRequest(input *DeleteRouteInput) (req *aws.Request, output *DeleteRouteOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opDeleteRoute == nil { + opDeleteRoute = &aws.Operation{ + Name: "DeleteRoute", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &DeleteRouteInput{} + } + + req = c.newRequest(opDeleteRoute, input, output) + output = &DeleteRouteOutput{} + req.Data = output + return +} + +// Deletes the specified route from the specified route table. +func (c *EC2) DeleteRoute(input *DeleteRouteInput) (output *DeleteRouteOutput, err error) { + req, out := c.DeleteRouteRequest(input) + output = out + err = req.Send() + return +} + +var opDeleteRoute *aws.Operation + +// DeleteRouteTableRequest generates a request for the DeleteRouteTable operation. +func (c *EC2) DeleteRouteTableRequest(input *DeleteRouteTableInput) (req *aws.Request, output *DeleteRouteTableOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opDeleteRouteTable == nil { + opDeleteRouteTable = &aws.Operation{ + Name: "DeleteRouteTable", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &DeleteRouteTableInput{} + } + + req = c.newRequest(opDeleteRouteTable, input, output) + output = &DeleteRouteTableOutput{} + req.Data = output + return +} + +// Deletes the specified route table. You must disassociate the route table +// from any subnets before you can delete it. You can't delete the main route +// table. +func (c *EC2) DeleteRouteTable(input *DeleteRouteTableInput) (output *DeleteRouteTableOutput, err error) { + req, out := c.DeleteRouteTableRequest(input) + output = out + err = req.Send() + return +} + +var opDeleteRouteTable *aws.Operation + +// DeleteSecurityGroupRequest generates a request for the DeleteSecurityGroup operation. +func (c *EC2) DeleteSecurityGroupRequest(input *DeleteSecurityGroupInput) (req *aws.Request, output *DeleteSecurityGroupOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opDeleteSecurityGroup == nil { + opDeleteSecurityGroup = &aws.Operation{ + Name: "DeleteSecurityGroup", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &DeleteSecurityGroupInput{} + } + + req = c.newRequest(opDeleteSecurityGroup, input, output) + output = &DeleteSecurityGroupOutput{} + req.Data = output + return +} + +// Deletes a security group. +// +// If you attempt to delete a security group that is associated with an instance, +// or is referenced by another security group, the operation fails with InvalidGroup.InUse +// in EC2-Classic or DependencyViolation in EC2-VPC. +func (c *EC2) DeleteSecurityGroup(input *DeleteSecurityGroupInput) (output *DeleteSecurityGroupOutput, err error) { + req, out := c.DeleteSecurityGroupRequest(input) + output = out + err = req.Send() + return +} + +var opDeleteSecurityGroup *aws.Operation + +// DeleteSnapshotRequest generates a request for the DeleteSnapshot operation. +func (c *EC2) DeleteSnapshotRequest(input *DeleteSnapshotInput) (req *aws.Request, output *DeleteSnapshotOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opDeleteSnapshot == nil { + opDeleteSnapshot = &aws.Operation{ + Name: "DeleteSnapshot", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &DeleteSnapshotInput{} + } + + req = c.newRequest(opDeleteSnapshot, input, output) + output = &DeleteSnapshotOutput{} + req.Data = output + return +} + +// Deletes the specified snapshot. +// +// When you make periodic snapshots of a volume, the snapshots are incremental, +// and only the blocks on the device that have changed since your last snapshot +// are saved in the new snapshot. When you delete a snapshot, only the data +// not needed for any other snapshot is removed. So regardless of which prior +// snapshots have been deleted, all active snapshots will have access to all +// the information needed to restore the volume. +// +// You cannot delete a snapshot of the root device of an Amazon EBS volume +// used by a registered AMI. You must first de-register the AMI before you can +// delete the snapshot. +// +// For more information, see Deleting an Amazon EBS Snapshot (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-deleting-snapshot.html) +// in the Amazon Elastic Compute Cloud User Guide. +func (c *EC2) DeleteSnapshot(input *DeleteSnapshotInput) (output *DeleteSnapshotOutput, err error) { + req, out := c.DeleteSnapshotRequest(input) + output = out + err = req.Send() + return +} + +var opDeleteSnapshot *aws.Operation + +// DeleteSpotDatafeedSubscriptionRequest generates a request for the DeleteSpotDatafeedSubscription operation. +func (c *EC2) DeleteSpotDatafeedSubscriptionRequest(input *DeleteSpotDatafeedSubscriptionInput) (req *aws.Request, output *DeleteSpotDatafeedSubscriptionOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opDeleteSpotDatafeedSubscription == nil { + opDeleteSpotDatafeedSubscription = &aws.Operation{ + Name: "DeleteSpotDatafeedSubscription", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &DeleteSpotDatafeedSubscriptionInput{} + } + + req = c.newRequest(opDeleteSpotDatafeedSubscription, input, output) + output = &DeleteSpotDatafeedSubscriptionOutput{} + req.Data = output + return +} + +// Deletes the data feed for Spot Instances. For more information, see Spot +// Instance Data Feed (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/spot-data-feeds.html) +// in the Amazon Elastic Compute Cloud User Guide. +func (c *EC2) DeleteSpotDatafeedSubscription(input *DeleteSpotDatafeedSubscriptionInput) (output *DeleteSpotDatafeedSubscriptionOutput, err error) { + req, out := c.DeleteSpotDatafeedSubscriptionRequest(input) + output = out + err = req.Send() + return +} + +var opDeleteSpotDatafeedSubscription *aws.Operation + +// DeleteSubnetRequest generates a request for the DeleteSubnet operation. +func (c *EC2) DeleteSubnetRequest(input *DeleteSubnetInput) (req *aws.Request, output *DeleteSubnetOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opDeleteSubnet == nil { + opDeleteSubnet = &aws.Operation{ + Name: "DeleteSubnet", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &DeleteSubnetInput{} + } + + req = c.newRequest(opDeleteSubnet, input, output) + output = &DeleteSubnetOutput{} + req.Data = output + return +} + +// Deletes the specified subnet. You must terminate all running instances in +// the subnet before you can delete the subnet. +func (c *EC2) DeleteSubnet(input *DeleteSubnetInput) (output *DeleteSubnetOutput, err error) { + req, out := c.DeleteSubnetRequest(input) + output = out + err = req.Send() + return +} + +var opDeleteSubnet *aws.Operation + +// DeleteTagsRequest generates a request for the DeleteTags operation. +func (c *EC2) DeleteTagsRequest(input *DeleteTagsInput) (req *aws.Request, output *DeleteTagsOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opDeleteTags == nil { + opDeleteTags = &aws.Operation{ + Name: "DeleteTags", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &DeleteTagsInput{} + } + + req = c.newRequest(opDeleteTags, input, output) + output = &DeleteTagsOutput{} + req.Data = output + return +} + +// Deletes the specified set of tags from the specified set of resources. This +// call is designed to follow a DescribeTags request. +// +// For more information about tags, see Tagging Your Resources (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Using_Tags.html) +// in the Amazon Elastic Compute Cloud User Guide. +func (c *EC2) DeleteTags(input *DeleteTagsInput) (output *DeleteTagsOutput, err error) { + req, out := c.DeleteTagsRequest(input) + output = out + err = req.Send() + return +} + +var opDeleteTags *aws.Operation + +// DeleteVPCRequest generates a request for the DeleteVPC operation. +func (c *EC2) DeleteVPCRequest(input *DeleteVPCInput) (req *aws.Request, output *DeleteVPCOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opDeleteVPC == nil { + opDeleteVPC = &aws.Operation{ + Name: "DeleteVpc", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &DeleteVPCInput{} + } + + req = c.newRequest(opDeleteVPC, input, output) + output = &DeleteVPCOutput{} + req.Data = output + return +} + +// Deletes the specified VPC. You must detach or delete all gateways and resources +// that are associated with the VPC before you can delete it. For example, you +// must terminate all instances running in the VPC, delete all security groups +// associated with the VPC (except the default one), delete all route tables +// associated with the VPC (except the default one), and so on. +func (c *EC2) DeleteVPC(input *DeleteVPCInput) (output *DeleteVPCOutput, err error) { + req, out := c.DeleteVPCRequest(input) + output = out + err = req.Send() + return +} + +var opDeleteVPC *aws.Operation + +// DeleteVPCPeeringConnectionRequest generates a request for the DeleteVPCPeeringConnection operation. +func (c *EC2) DeleteVPCPeeringConnectionRequest(input *DeleteVPCPeeringConnectionInput) (req *aws.Request, output *DeleteVPCPeeringConnectionOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opDeleteVPCPeeringConnection == nil { + opDeleteVPCPeeringConnection = &aws.Operation{ + Name: "DeleteVpcPeeringConnection", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &DeleteVPCPeeringConnectionInput{} + } + + req = c.newRequest(opDeleteVPCPeeringConnection, input, output) + output = &DeleteVPCPeeringConnectionOutput{} + req.Data = output + return +} + +// Deletes a VPC peering connection. Either the owner of the requester VPC or +// the owner of the peer VPC can delete the VPC peering connection if it's in +// the active state. The owner of the requester VPC can delete a VPC peering +// connection in the pending-acceptance state. +func (c *EC2) DeleteVPCPeeringConnection(input *DeleteVPCPeeringConnectionInput) (output *DeleteVPCPeeringConnectionOutput, err error) { + req, out := c.DeleteVPCPeeringConnectionRequest(input) + output = out + err = req.Send() + return +} + +var opDeleteVPCPeeringConnection *aws.Operation + +// DeleteVPNConnectionRequest generates a request for the DeleteVPNConnection operation. +func (c *EC2) DeleteVPNConnectionRequest(input *DeleteVPNConnectionInput) (req *aws.Request, output *DeleteVPNConnectionOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opDeleteVPNConnection == nil { + opDeleteVPNConnection = &aws.Operation{ + Name: "DeleteVpnConnection", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &DeleteVPNConnectionInput{} + } + + req = c.newRequest(opDeleteVPNConnection, input, output) + output = &DeleteVPNConnectionOutput{} + req.Data = output + return +} + +// Deletes the specified VPN connection. +// +// If you're deleting the VPC and its associated components, we recommend that +// you detach the virtual private gateway from the VPC and delete the VPC before +// deleting the VPN connection. If you believe that the tunnel credentials for +// your VPN connection have been compromised, you can delete the VPN connection +// and create a new one that has new keys, without needing to delete the VPC +// or virtual private gateway. If you create a new VPN connection, you must +// reconfigure the customer gateway using the new configuration information +// returned with the new VPN connection ID. +func (c *EC2) DeleteVPNConnection(input *DeleteVPNConnectionInput) (output *DeleteVPNConnectionOutput, err error) { + req, out := c.DeleteVPNConnectionRequest(input) + output = out + err = req.Send() + return +} + +var opDeleteVPNConnection *aws.Operation + +// DeleteVPNConnectionRouteRequest generates a request for the DeleteVPNConnectionRoute operation. +func (c *EC2) DeleteVPNConnectionRouteRequest(input *DeleteVPNConnectionRouteInput) (req *aws.Request, output *DeleteVPNConnectionRouteOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opDeleteVPNConnectionRoute == nil { + opDeleteVPNConnectionRoute = &aws.Operation{ + Name: "DeleteVpnConnectionRoute", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &DeleteVPNConnectionRouteInput{} + } + + req = c.newRequest(opDeleteVPNConnectionRoute, input, output) + output = &DeleteVPNConnectionRouteOutput{} + req.Data = output + return +} + +// Deletes the specified static route associated with a VPN connection between +// an existing virtual private gateway and a VPN customer gateway. The static +// route allows traffic to be routed from the virtual private gateway to the +// VPN customer gateway. +func (c *EC2) DeleteVPNConnectionRoute(input *DeleteVPNConnectionRouteInput) (output *DeleteVPNConnectionRouteOutput, err error) { + req, out := c.DeleteVPNConnectionRouteRequest(input) + output = out + err = req.Send() + return +} + +var opDeleteVPNConnectionRoute *aws.Operation + +// DeleteVPNGatewayRequest generates a request for the DeleteVPNGateway operation. +func (c *EC2) DeleteVPNGatewayRequest(input *DeleteVPNGatewayInput) (req *aws.Request, output *DeleteVPNGatewayOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opDeleteVPNGateway == nil { + opDeleteVPNGateway = &aws.Operation{ + Name: "DeleteVpnGateway", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &DeleteVPNGatewayInput{} + } + + req = c.newRequest(opDeleteVPNGateway, input, output) + output = &DeleteVPNGatewayOutput{} + req.Data = output + return +} + +// Deletes the specified virtual private gateway. We recommend that before you +// delete a virtual private gateway, you detach it from the VPC and delete the +// VPN connection. Note that you don't need to delete the virtual private gateway +// if you plan to delete and recreate the VPN connection between your VPC and +// your network. +func (c *EC2) DeleteVPNGateway(input *DeleteVPNGatewayInput) (output *DeleteVPNGatewayOutput, err error) { + req, out := c.DeleteVPNGatewayRequest(input) + output = out + err = req.Send() + return +} + +var opDeleteVPNGateway *aws.Operation + +// DeleteVolumeRequest generates a request for the DeleteVolume operation. +func (c *EC2) DeleteVolumeRequest(input *DeleteVolumeInput) (req *aws.Request, output *DeleteVolumeOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opDeleteVolume == nil { + opDeleteVolume = &aws.Operation{ + Name: "DeleteVolume", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &DeleteVolumeInput{} + } + + req = c.newRequest(opDeleteVolume, input, output) + output = &DeleteVolumeOutput{} + req.Data = output + return +} + +// Deletes the specified Amazon EBS volume. The volume must be in the available +// state (not attached to an instance). +// +// The volume may remain in the deleting state for several minutes. +// +// For more information, see Deleting an Amazon EBS Volume (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-deleting-volume.html) +// in the Amazon Elastic Compute Cloud User Guide. +func (c *EC2) DeleteVolume(input *DeleteVolumeInput) (output *DeleteVolumeOutput, err error) { + req, out := c.DeleteVolumeRequest(input) + output = out + err = req.Send() + return +} + +var opDeleteVolume *aws.Operation + +// DeregisterImageRequest generates a request for the DeregisterImage operation. +func (c *EC2) DeregisterImageRequest(input *DeregisterImageInput) (req *aws.Request, output *DeregisterImageOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opDeregisterImage == nil { + opDeregisterImage = &aws.Operation{ + Name: "DeregisterImage", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &DeregisterImageInput{} + } + + req = c.newRequest(opDeregisterImage, input, output) + output = &DeregisterImageOutput{} + req.Data = output + return +} + +// Deregisters the specified AMI. After you deregister an AMI, it can't be used +// to launch new instances. +// +// This command does not delete the AMI. +func (c *EC2) DeregisterImage(input *DeregisterImageInput) (output *DeregisterImageOutput, err error) { + req, out := c.DeregisterImageRequest(input) + output = out + err = req.Send() + return +} + +var opDeregisterImage *aws.Operation + +// DescribeAccountAttributesRequest generates a request for the DescribeAccountAttributes operation. +func (c *EC2) DescribeAccountAttributesRequest(input *DescribeAccountAttributesInput) (req *aws.Request, output *DescribeAccountAttributesOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opDescribeAccountAttributes == nil { + opDescribeAccountAttributes = &aws.Operation{ + Name: "DescribeAccountAttributes", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &DescribeAccountAttributesInput{} + } + + req = c.newRequest(opDescribeAccountAttributes, input, output) + output = &DescribeAccountAttributesOutput{} + req.Data = output + return +} + +// Describes attributes of your AWS account. The following are the supported +// account attributes: +// +// supported-platforms: Indicates whether your account can launch instances +// into EC2-Classic and EC2-VPC, or only into EC2-VPC. +// +// default-vpc: The ID of the default VPC for your account, or none. +// +// max-instances: The maximum number of On-Demand instances that you can +// run. +// +// vpc-max-security-groups-per-interface: The maximum number of security +// groups that you can assign to a network interface. +// +// max-elastic-ips: The maximum number of Elastic IP addresses that you can +// allocate for use with EC2-Classic. +// +// vpc-max-elastic-ips: The maximum number of Elastic IP addresses that you +// can allocate for use with EC2-VPC. +func (c *EC2) DescribeAccountAttributes(input *DescribeAccountAttributesInput) (output *DescribeAccountAttributesOutput, err error) { + req, out := c.DescribeAccountAttributesRequest(input) + output = out + err = req.Send() + return +} + +var opDescribeAccountAttributes *aws.Operation + +// DescribeAddressesRequest generates a request for the DescribeAddresses operation. +func (c *EC2) DescribeAddressesRequest(input *DescribeAddressesInput) (req *aws.Request, output *DescribeAddressesOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opDescribeAddresses == nil { + opDescribeAddresses = &aws.Operation{ + Name: "DescribeAddresses", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &DescribeAddressesInput{} + } + + req = c.newRequest(opDescribeAddresses, input, output) + output = &DescribeAddressesOutput{} + req.Data = output + return +} + +// Describes one or more of your Elastic IP addresses. +// +// An Elastic IP address is for use in either the EC2-Classic platform or in +// a VPC. For more information, see Elastic IP Addresses (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/elastic-ip-addresses-eip.html) +// in the Amazon Elastic Compute Cloud User Guide. +func (c *EC2) DescribeAddresses(input *DescribeAddressesInput) (output *DescribeAddressesOutput, err error) { + req, out := c.DescribeAddressesRequest(input) + output = out + err = req.Send() + return +} + +var opDescribeAddresses *aws.Operation + +// DescribeAvailabilityZonesRequest generates a request for the DescribeAvailabilityZones operation. +func (c *EC2) DescribeAvailabilityZonesRequest(input *DescribeAvailabilityZonesInput) (req *aws.Request, output *DescribeAvailabilityZonesOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opDescribeAvailabilityZones == nil { + opDescribeAvailabilityZones = &aws.Operation{ + Name: "DescribeAvailabilityZones", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &DescribeAvailabilityZonesInput{} + } + + req = c.newRequest(opDescribeAvailabilityZones, input, output) + output = &DescribeAvailabilityZonesOutput{} + req.Data = output + return +} + +// Describes one or more of the Availability Zones that are available to you. +// The results include zones only for the region you're currently using. If +// there is an event impacting an Availability Zone, you can use this request +// to view the state and any provided message for that Availability Zone. +// +// For more information, see Regions and Availability Zones (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-regions-availability-zones.html) +// in the Amazon Elastic Compute Cloud User Guide. +func (c *EC2) DescribeAvailabilityZones(input *DescribeAvailabilityZonesInput) (output *DescribeAvailabilityZonesOutput, err error) { + req, out := c.DescribeAvailabilityZonesRequest(input) + output = out + err = req.Send() + return +} + +var opDescribeAvailabilityZones *aws.Operation + +// DescribeBundleTasksRequest generates a request for the DescribeBundleTasks operation. +func (c *EC2) DescribeBundleTasksRequest(input *DescribeBundleTasksInput) (req *aws.Request, output *DescribeBundleTasksOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opDescribeBundleTasks == nil { + opDescribeBundleTasks = &aws.Operation{ + Name: "DescribeBundleTasks", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &DescribeBundleTasksInput{} + } + + req = c.newRequest(opDescribeBundleTasks, input, output) + output = &DescribeBundleTasksOutput{} + req.Data = output + return +} + +// Describes one or more of your bundling tasks. +// +// Completed bundle tasks are listed for only a limited time. If your bundle +// task is no longer in the list, you can still register an AMI from it. Just +// use RegisterImage with the Amazon S3 bucket name and image manifest name +// you provided to the bundle task. +func (c *EC2) DescribeBundleTasks(input *DescribeBundleTasksInput) (output *DescribeBundleTasksOutput, err error) { + req, out := c.DescribeBundleTasksRequest(input) + output = out + err = req.Send() + return +} + +var opDescribeBundleTasks *aws.Operation + +// DescribeClassicLinkInstancesRequest generates a request for the DescribeClassicLinkInstances operation. +func (c *EC2) DescribeClassicLinkInstancesRequest(input *DescribeClassicLinkInstancesInput) (req *aws.Request, output *DescribeClassicLinkInstancesOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opDescribeClassicLinkInstances == nil { + opDescribeClassicLinkInstances = &aws.Operation{ + Name: "DescribeClassicLinkInstances", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &DescribeClassicLinkInstancesInput{} + } + + req = c.newRequest(opDescribeClassicLinkInstances, input, output) + output = &DescribeClassicLinkInstancesOutput{} + req.Data = output + return +} + +// Describes one or more of your linked EC2-Classic instances. This request +// only returns information about EC2-Classic instances linked to a VPC through +// ClassicLink; you cannot use this request to return information about other +// instances. +func (c *EC2) DescribeClassicLinkInstances(input *DescribeClassicLinkInstancesInput) (output *DescribeClassicLinkInstancesOutput, err error) { + req, out := c.DescribeClassicLinkInstancesRequest(input) + output = out + err = req.Send() + return +} + +var opDescribeClassicLinkInstances *aws.Operation + +// DescribeConversionTasksRequest generates a request for the DescribeConversionTasks operation. +func (c *EC2) DescribeConversionTasksRequest(input *DescribeConversionTasksInput) (req *aws.Request, output *DescribeConversionTasksOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opDescribeConversionTasks == nil { + opDescribeConversionTasks = &aws.Operation{ + Name: "DescribeConversionTasks", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &DescribeConversionTasksInput{} + } + + req = c.newRequest(opDescribeConversionTasks, input, output) + output = &DescribeConversionTasksOutput{} + req.Data = output + return +} + +// Describes one or more of your conversion tasks. For more information, 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. +func (c *EC2) DescribeConversionTasks(input *DescribeConversionTasksInput) (output *DescribeConversionTasksOutput, err error) { + req, out := c.DescribeConversionTasksRequest(input) + output = out + err = req.Send() + return +} + +var opDescribeConversionTasks *aws.Operation + +// DescribeCustomerGatewaysRequest generates a request for the DescribeCustomerGateways operation. +func (c *EC2) DescribeCustomerGatewaysRequest(input *DescribeCustomerGatewaysInput) (req *aws.Request, output *DescribeCustomerGatewaysOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opDescribeCustomerGateways == nil { + opDescribeCustomerGateways = &aws.Operation{ + Name: "DescribeCustomerGateways", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &DescribeCustomerGatewaysInput{} + } + + req = c.newRequest(opDescribeCustomerGateways, input, output) + output = &DescribeCustomerGatewaysOutput{} + req.Data = output + return +} + +// Describes one or more of your VPN customer gateways. +// +// For more information about VPN customer gateways, see Adding a Hardware +// Virtual Private Gateway to Your VPC (http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_VPN.html) +// in the Amazon Virtual Private Cloud User Guide. +func (c *EC2) DescribeCustomerGateways(input *DescribeCustomerGatewaysInput) (output *DescribeCustomerGatewaysOutput, err error) { + req, out := c.DescribeCustomerGatewaysRequest(input) + output = out + err = req.Send() + return +} + +var opDescribeCustomerGateways *aws.Operation + +// DescribeDHCPOptionsRequest generates a request for the DescribeDHCPOptions operation. +func (c *EC2) DescribeDHCPOptionsRequest(input *DescribeDHCPOptionsInput) (req *aws.Request, output *DescribeDHCPOptionsOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opDescribeDHCPOptions == nil { + opDescribeDHCPOptions = &aws.Operation{ + Name: "DescribeDhcpOptions", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &DescribeDHCPOptionsInput{} + } + + req = c.newRequest(opDescribeDHCPOptions, input, output) + output = &DescribeDHCPOptionsOutput{} + req.Data = output + return +} + +// Describes one or more of your DHCP options sets. +// +// For more information about DHCP options sets, see DHCP Options Sets (http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_DHCP_Options.html) +// in the Amazon Virtual Private Cloud User Guide. +func (c *EC2) DescribeDHCPOptions(input *DescribeDHCPOptionsInput) (output *DescribeDHCPOptionsOutput, err error) { + req, out := c.DescribeDHCPOptionsRequest(input) + output = out + err = req.Send() + return +} + +var opDescribeDHCPOptions *aws.Operation + +// DescribeExportTasksRequest generates a request for the DescribeExportTasks operation. +func (c *EC2) DescribeExportTasksRequest(input *DescribeExportTasksInput) (req *aws.Request, output *DescribeExportTasksOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opDescribeExportTasks == nil { + opDescribeExportTasks = &aws.Operation{ + Name: "DescribeExportTasks", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &DescribeExportTasksInput{} + } + + req = c.newRequest(opDescribeExportTasks, input, output) + output = &DescribeExportTasksOutput{} + req.Data = output + return +} + +// Describes one or more of your export tasks. +func (c *EC2) DescribeExportTasks(input *DescribeExportTasksInput) (output *DescribeExportTasksOutput, err error) { + req, out := c.DescribeExportTasksRequest(input) + output = out + err = req.Send() + return +} + +var opDescribeExportTasks *aws.Operation + +// DescribeImageAttributeRequest generates a request for the DescribeImageAttribute operation. +func (c *EC2) DescribeImageAttributeRequest(input *DescribeImageAttributeInput) (req *aws.Request, output *DescribeImageAttributeOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opDescribeImageAttribute == nil { + opDescribeImageAttribute = &aws.Operation{ + Name: "DescribeImageAttribute", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &DescribeImageAttributeInput{} + } + + req = c.newRequest(opDescribeImageAttribute, input, output) + output = &DescribeImageAttributeOutput{} + req.Data = output + return +} + +// Describes the specified attribute of the specified AMI. You can specify only +// one attribute at a time. +func (c *EC2) DescribeImageAttribute(input *DescribeImageAttributeInput) (output *DescribeImageAttributeOutput, err error) { + req, out := c.DescribeImageAttributeRequest(input) + output = out + err = req.Send() + return +} + +var opDescribeImageAttribute *aws.Operation + +// DescribeImagesRequest generates a request for the DescribeImages operation. +func (c *EC2) DescribeImagesRequest(input *DescribeImagesInput) (req *aws.Request, output *DescribeImagesOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opDescribeImages == nil { + opDescribeImages = &aws.Operation{ + Name: "DescribeImages", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &DescribeImagesInput{} + } + + req = c.newRequest(opDescribeImages, input, output) + output = &DescribeImagesOutput{} + req.Data = output + return +} + +// Describes one or more of the images (AMIs, AKIs, and ARIs) available to you. +// Images available to you include public images, private images that you own, +// and private images owned by other AWS accounts but for which you have explicit +// launch permissions. +// +// Deregistered images are included in the returned results for an unspecified +// interval after deregistration. +func (c *EC2) DescribeImages(input *DescribeImagesInput) (output *DescribeImagesOutput, err error) { + req, out := c.DescribeImagesRequest(input) + output = out + err = req.Send() + return +} + +var opDescribeImages *aws.Operation + +// DescribeImportImageTasksRequest generates a request for the DescribeImportImageTasks operation. +func (c *EC2) DescribeImportImageTasksRequest(input *DescribeImportImageTasksInput) (req *aws.Request, output *DescribeImportImageTasksOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opDescribeImportImageTasks == nil { + opDescribeImportImageTasks = &aws.Operation{ + Name: "DescribeImportImageTasks", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &DescribeImportImageTasksInput{} + } + + req = c.newRequest(opDescribeImportImageTasks, input, output) + output = &DescribeImportImageTasksOutput{} + req.Data = output + return +} + +// Displays details about an import virtual machine or import snapshot tasks +// that are already created. +func (c *EC2) DescribeImportImageTasks(input *DescribeImportImageTasksInput) (output *DescribeImportImageTasksOutput, err error) { + req, out := c.DescribeImportImageTasksRequest(input) + output = out + err = req.Send() + return +} + +var opDescribeImportImageTasks *aws.Operation + +// DescribeImportSnapshotTasksRequest generates a request for the DescribeImportSnapshotTasks operation. +func (c *EC2) DescribeImportSnapshotTasksRequest(input *DescribeImportSnapshotTasksInput) (req *aws.Request, output *DescribeImportSnapshotTasksOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opDescribeImportSnapshotTasks == nil { + opDescribeImportSnapshotTasks = &aws.Operation{ + Name: "DescribeImportSnapshotTasks", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &DescribeImportSnapshotTasksInput{} + } + + req = c.newRequest(opDescribeImportSnapshotTasks, input, output) + output = &DescribeImportSnapshotTasksOutput{} + req.Data = output + return +} + +// Displays details about an import snapshot tasks that is already created. +func (c *EC2) DescribeImportSnapshotTasks(input *DescribeImportSnapshotTasksInput) (output *DescribeImportSnapshotTasksOutput, err error) { + req, out := c.DescribeImportSnapshotTasksRequest(input) + output = out + err = req.Send() + return +} + +var opDescribeImportSnapshotTasks *aws.Operation + +// DescribeInstanceAttributeRequest generates a request for the DescribeInstanceAttribute operation. +func (c *EC2) DescribeInstanceAttributeRequest(input *DescribeInstanceAttributeInput) (req *aws.Request, output *DescribeInstanceAttributeOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opDescribeInstanceAttribute == nil { + opDescribeInstanceAttribute = &aws.Operation{ + Name: "DescribeInstanceAttribute", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &DescribeInstanceAttributeInput{} + } + + req = c.newRequest(opDescribeInstanceAttribute, input, output) + output = &DescribeInstanceAttributeOutput{} + req.Data = output + return +} + +// Describes the specified attribute of the specified instance. You can specify +// only one attribute at a time. Valid attribute values are: instanceType | +// kernel | ramdisk | userData | disableApiTermination | instanceInitiatedShutdownBehavior +// | rootDeviceName | blockDeviceMapping | productCodes | sourceDestCheck | +// groupSet | ebsOptimized | sriovNetSupport +func (c *EC2) DescribeInstanceAttribute(input *DescribeInstanceAttributeInput) (output *DescribeInstanceAttributeOutput, err error) { + req, out := c.DescribeInstanceAttributeRequest(input) + output = out + err = req.Send() + return +} + +var opDescribeInstanceAttribute *aws.Operation + +// DescribeInstanceStatusRequest generates a request for the DescribeInstanceStatus operation. +func (c *EC2) DescribeInstanceStatusRequest(input *DescribeInstanceStatusInput) (req *aws.Request, output *DescribeInstanceStatusOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opDescribeInstanceStatus == nil { + opDescribeInstanceStatus = &aws.Operation{ + Name: "DescribeInstanceStatus", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &DescribeInstanceStatusInput{} + } + + req = c.newRequest(opDescribeInstanceStatus, input, output) + output = &DescribeInstanceStatusOutput{} + req.Data = output + return +} + +// Describes the status of one or more instances, including any scheduled events. +// +// Instance status has two main components: +// +// System Status reports impaired functionality that stems from issues related +// to the systems that support an instance, such as such as hardware failures +// and network connectivity problems. This call reports such problems as impaired +// reachability. +// +// Instance Status reports impaired functionality that arises from problems +// internal to the instance. This call reports such problems as impaired reachability. +// +// Instance status provides information about four types of scheduled events +// for an instance that may require your attention: +// +// Scheduled Reboot: When Amazon EC2 determines that an instance must be +// rebooted, the instances status returns one of two event codes: system-reboot +// or instance-reboot. System reboot commonly occurs if certain maintenance +// or upgrade operations require a reboot of the underlying host that supports +// an instance. Instance reboot commonly occurs if the instance must be rebooted, +// rather than the underlying host. Rebooting events include a scheduled start +// and end time. +// +// System Maintenance: When Amazon EC2 determines that an instance requires +// maintenance that requires power or network impact, the instance status is +// the event code system-maintenance. System maintenance is either power maintenance +// or network maintenance. For power maintenance, your instance will be unavailable +// for a brief period of time and then rebooted. For network maintenance, your +// instance will experience a brief loss of network connectivity. System maintenance +// events include a scheduled start and end time. You will also be notified +// by email if one of your instances is set for system maintenance. The email +// message indicates when your instance is scheduled for maintenance. +// +// Scheduled Retirement: When Amazon EC2 determines that an instance must +// be shut down, the instance status is the event code instance-retirement. +// Retirement commonly occurs when the underlying host is degraded and must +// be replaced. Retirement events include a scheduled start and end time. You +// will also be notified by email if one of your instances is set to retiring. +// The email message indicates when your instance will be permanently retired. +// +// Scheduled Stop: When Amazon EC2 determines that an instance must be shut +// down, the instances status returns an event code called instance-stop. Stop +// events include a scheduled start and end time. You will also be notified +// by email if one of your instances is set to stop. The email message indicates +// when your instance will be stopped. +// +// When your instance is retired, it will either be terminated (if its root +// device type is the instance-store) or stopped (if its root device type is +// an EBS volume). Instances stopped due to retirement will not be restarted, +// but you can do so manually. You can also avoid retirement of EBS-backed instances +// by manually restarting your instance when its event code is instance-retirement. +// This ensures that your instance is started on a different underlying host. +// +// For more information about failed status checks, see Troubleshooting Instances +// with Failed Status Checks (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/TroubleshootingInstances.html) +// in the Amazon Elastic Compute Cloud User Guide. For more information about +// working with scheduled events, see Working with an Instance That Has a Scheduled +// Event (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/monitoring-instances-status-check_sched.html#schedevents_actions) +// in the Amazon Elastic Compute Cloud User Guide. +func (c *EC2) DescribeInstanceStatus(input *DescribeInstanceStatusInput) (output *DescribeInstanceStatusOutput, err error) { + req, out := c.DescribeInstanceStatusRequest(input) + output = out + err = req.Send() + return +} + +var opDescribeInstanceStatus *aws.Operation + +// DescribeInstancesRequest generates a request for the DescribeInstances operation. +func (c *EC2) DescribeInstancesRequest(input *DescribeInstancesInput) (req *aws.Request, output *DescribeInstancesOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opDescribeInstances == nil { + opDescribeInstances = &aws.Operation{ + Name: "DescribeInstances", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &DescribeInstancesInput{} + } + + req = c.newRequest(opDescribeInstances, input, output) + output = &DescribeInstancesOutput{} + req.Data = output + return +} + +// Describes one or more of your instances. +// +// If you specify one or more instance IDs, Amazon EC2 returns information +// for those instances. If you do not specify instance IDs, Amazon EC2 returns +// information for all relevant instances. If you specify an instance ID that +// is not valid, an error is returned. If you specify an instance that you do +// not own, it is not included in the returned results. +// +// Recently terminated instances might appear in the returned results. This +// interval is usually less than one hour. +func (c *EC2) DescribeInstances(input *DescribeInstancesInput) (output *DescribeInstancesOutput, err error) { + req, out := c.DescribeInstancesRequest(input) + output = out + err = req.Send() + return +} + +var opDescribeInstances *aws.Operation + +// DescribeInternetGatewaysRequest generates a request for the DescribeInternetGateways operation. +func (c *EC2) DescribeInternetGatewaysRequest(input *DescribeInternetGatewaysInput) (req *aws.Request, output *DescribeInternetGatewaysOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opDescribeInternetGateways == nil { + opDescribeInternetGateways = &aws.Operation{ + Name: "DescribeInternetGateways", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &DescribeInternetGatewaysInput{} + } + + req = c.newRequest(opDescribeInternetGateways, input, output) + output = &DescribeInternetGatewaysOutput{} + req.Data = output + return +} + +// Describes one or more of your Internet gateways. +func (c *EC2) DescribeInternetGateways(input *DescribeInternetGatewaysInput) (output *DescribeInternetGatewaysOutput, err error) { + req, out := c.DescribeInternetGatewaysRequest(input) + output = out + err = req.Send() + return +} + +var opDescribeInternetGateways *aws.Operation + +// DescribeKeyPairsRequest generates a request for the DescribeKeyPairs operation. +func (c *EC2) DescribeKeyPairsRequest(input *DescribeKeyPairsInput) (req *aws.Request, output *DescribeKeyPairsOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opDescribeKeyPairs == nil { + opDescribeKeyPairs = &aws.Operation{ + Name: "DescribeKeyPairs", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &DescribeKeyPairsInput{} + } + + req = c.newRequest(opDescribeKeyPairs, input, output) + output = &DescribeKeyPairsOutput{} + req.Data = output + return +} + +// Describes one or more of your key pairs. +// +// For more information about key pairs, see Key Pairs (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-key-pairs.html) +// in the Amazon Elastic Compute Cloud User Guide. +func (c *EC2) DescribeKeyPairs(input *DescribeKeyPairsInput) (output *DescribeKeyPairsOutput, err error) { + req, out := c.DescribeKeyPairsRequest(input) + output = out + err = req.Send() + return +} + +var opDescribeKeyPairs *aws.Operation + +// DescribeNetworkACLsRequest generates a request for the DescribeNetworkACLs operation. +func (c *EC2) DescribeNetworkACLsRequest(input *DescribeNetworkACLsInput) (req *aws.Request, output *DescribeNetworkACLsOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opDescribeNetworkACLs == nil { + opDescribeNetworkACLs = &aws.Operation{ + Name: "DescribeNetworkAcls", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &DescribeNetworkACLsInput{} + } + + req = c.newRequest(opDescribeNetworkACLs, input, output) + output = &DescribeNetworkACLsOutput{} + req.Data = output + return +} + +// Describes one or more of your network ACLs. +// +// For more information about network ACLs, see Network ACLs (http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_ACLs.html) +// in the Amazon Virtual Private Cloud User Guide. +func (c *EC2) DescribeNetworkACLs(input *DescribeNetworkACLsInput) (output *DescribeNetworkACLsOutput, err error) { + req, out := c.DescribeNetworkACLsRequest(input) + output = out + err = req.Send() + return +} + +var opDescribeNetworkACLs *aws.Operation + +// DescribeNetworkInterfaceAttributeRequest generates a request for the DescribeNetworkInterfaceAttribute operation. +func (c *EC2) DescribeNetworkInterfaceAttributeRequest(input *DescribeNetworkInterfaceAttributeInput) (req *aws.Request, output *DescribeNetworkInterfaceAttributeOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opDescribeNetworkInterfaceAttribute == nil { + opDescribeNetworkInterfaceAttribute = &aws.Operation{ + Name: "DescribeNetworkInterfaceAttribute", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &DescribeNetworkInterfaceAttributeInput{} + } + + req = c.newRequest(opDescribeNetworkInterfaceAttribute, input, output) + output = &DescribeNetworkInterfaceAttributeOutput{} + req.Data = output + return +} + +// Describes a network interface attribute. You can specify only one attribute +// at a time. +func (c *EC2) DescribeNetworkInterfaceAttribute(input *DescribeNetworkInterfaceAttributeInput) (output *DescribeNetworkInterfaceAttributeOutput, err error) { + req, out := c.DescribeNetworkInterfaceAttributeRequest(input) + output = out + err = req.Send() + return +} + +var opDescribeNetworkInterfaceAttribute *aws.Operation + +// DescribeNetworkInterfacesRequest generates a request for the DescribeNetworkInterfaces operation. +func (c *EC2) DescribeNetworkInterfacesRequest(input *DescribeNetworkInterfacesInput) (req *aws.Request, output *DescribeNetworkInterfacesOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opDescribeNetworkInterfaces == nil { + opDescribeNetworkInterfaces = &aws.Operation{ + Name: "DescribeNetworkInterfaces", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &DescribeNetworkInterfacesInput{} + } + + req = c.newRequest(opDescribeNetworkInterfaces, input, output) + output = &DescribeNetworkInterfacesOutput{} + req.Data = output + return +} + +// Describes one or more of your network interfaces. +func (c *EC2) DescribeNetworkInterfaces(input *DescribeNetworkInterfacesInput) (output *DescribeNetworkInterfacesOutput, err error) { + req, out := c.DescribeNetworkInterfacesRequest(input) + output = out + err = req.Send() + return +} + +var opDescribeNetworkInterfaces *aws.Operation + +// DescribePlacementGroupsRequest generates a request for the DescribePlacementGroups operation. +func (c *EC2) DescribePlacementGroupsRequest(input *DescribePlacementGroupsInput) (req *aws.Request, output *DescribePlacementGroupsOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opDescribePlacementGroups == nil { + opDescribePlacementGroups = &aws.Operation{ + Name: "DescribePlacementGroups", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &DescribePlacementGroupsInput{} + } + + req = c.newRequest(opDescribePlacementGroups, input, output) + output = &DescribePlacementGroupsOutput{} + req.Data = output + return +} + +// Describes one or more of your placement groups. For more information about +// placement groups and cluster instances, see Cluster Instances (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using_cluster_computing.html) +// in the Amazon Elastic Compute Cloud User Guide. +func (c *EC2) DescribePlacementGroups(input *DescribePlacementGroupsInput) (output *DescribePlacementGroupsOutput, err error) { + req, out := c.DescribePlacementGroupsRequest(input) + output = out + err = req.Send() + return +} + +var opDescribePlacementGroups *aws.Operation + +// DescribeRegionsRequest generates a request for the DescribeRegions operation. +func (c *EC2) DescribeRegionsRequest(input *DescribeRegionsInput) (req *aws.Request, output *DescribeRegionsOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opDescribeRegions == nil { + opDescribeRegions = &aws.Operation{ + Name: "DescribeRegions", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &DescribeRegionsInput{} + } + + req = c.newRequest(opDescribeRegions, input, output) + output = &DescribeRegionsOutput{} + req.Data = output + return +} + +// Describes one or more regions that are currently available to you. +// +// For a list of the regions supported by Amazon EC2, see Regions and Endpoints +// (http://docs.aws.amazon.com/general/latest/gr/rande.html#ec2_region). +func (c *EC2) DescribeRegions(input *DescribeRegionsInput) (output *DescribeRegionsOutput, err error) { + req, out := c.DescribeRegionsRequest(input) + output = out + err = req.Send() + return +} + +var opDescribeRegions *aws.Operation + +// DescribeReservedInstancesRequest generates a request for the DescribeReservedInstances operation. +func (c *EC2) DescribeReservedInstancesRequest(input *DescribeReservedInstancesInput) (req *aws.Request, output *DescribeReservedInstancesOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opDescribeReservedInstances == nil { + opDescribeReservedInstances = &aws.Operation{ + Name: "DescribeReservedInstances", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &DescribeReservedInstancesInput{} + } + + req = c.newRequest(opDescribeReservedInstances, input, output) + output = &DescribeReservedInstancesOutput{} + req.Data = output + return +} + +// 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) +// in the Amazon Elastic Compute Cloud User Guide. +func (c *EC2) DescribeReservedInstances(input *DescribeReservedInstancesInput) (output *DescribeReservedInstancesOutput, err error) { + req, out := c.DescribeReservedInstancesRequest(input) + output = out + err = req.Send() + return +} + +var opDescribeReservedInstances *aws.Operation + +// DescribeReservedInstancesListingsRequest generates a request for the DescribeReservedInstancesListings operation. +func (c *EC2) DescribeReservedInstancesListingsRequest(input *DescribeReservedInstancesListingsInput) (req *aws.Request, output *DescribeReservedInstancesListingsOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opDescribeReservedInstancesListings == nil { + opDescribeReservedInstancesListings = &aws.Operation{ + Name: "DescribeReservedInstancesListings", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &DescribeReservedInstancesListingsInput{} + } + + req = c.newRequest(opDescribeReservedInstancesListings, input, output) + output = &DescribeReservedInstancesListingsOutput{} + req.Data = output + return +} + +// 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 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 +// 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, +// and the Marketplace matches what you're searching for with what's available. +// 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. +// +// 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. +func (c *EC2) DescribeReservedInstancesListings(input *DescribeReservedInstancesListingsInput) (output *DescribeReservedInstancesListingsOutput, err error) { + req, out := c.DescribeReservedInstancesListingsRequest(input) + output = out + err = req.Send() + return +} + +var opDescribeReservedInstancesListings *aws.Operation + +// DescribeReservedInstancesModificationsRequest generates a request for the DescribeReservedInstancesModifications operation. +func (c *EC2) DescribeReservedInstancesModificationsRequest(input *DescribeReservedInstancesModificationsInput) (req *aws.Request, output *DescribeReservedInstancesModificationsOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opDescribeReservedInstancesModifications == nil { + opDescribeReservedInstancesModifications = &aws.Operation{ + Name: "DescribeReservedInstancesModifications", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &DescribeReservedInstancesModificationsInput{} + } + + req = c.newRequest(opDescribeReservedInstancesModifications, input, output) + output = &DescribeReservedInstancesModificationsOutput{} + req.Data = output + return +} + +// 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. +// +// For more information, see Modifying Reserved Instances (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ri-modifying.html) +// in the Amazon Elastic Compute Cloud User Guide. +func (c *EC2) DescribeReservedInstancesModifications(input *DescribeReservedInstancesModificationsInput) (output *DescribeReservedInstancesModificationsOutput, err error) { + req, out := c.DescribeReservedInstancesModificationsRequest(input) + output = out + err = req.Send() + return +} + +var opDescribeReservedInstancesModifications *aws.Operation + +// DescribeReservedInstancesOfferingsRequest generates a request for the DescribeReservedInstancesOfferings operation. +func (c *EC2) DescribeReservedInstancesOfferingsRequest(input *DescribeReservedInstancesOfferingsInput) (req *aws.Request, output *DescribeReservedInstancesOfferingsOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opDescribeReservedInstancesOfferings == nil { + opDescribeReservedInstancesOfferings = &aws.Operation{ + Name: "DescribeReservedInstancesOfferings", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &DescribeReservedInstancesOfferingsInput{} + } + + req = c.newRequest(opDescribeReservedInstancesOfferings, input, output) + output = &DescribeReservedInstancesOfferingsOutput{} + req.Data = output + return +} + +// 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. +// +// 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. +func (c *EC2) DescribeReservedInstancesOfferings(input *DescribeReservedInstancesOfferingsInput) (output *DescribeReservedInstancesOfferingsOutput, err error) { + req, out := c.DescribeReservedInstancesOfferingsRequest(input) + output = out + err = req.Send() + return +} + +var opDescribeReservedInstancesOfferings *aws.Operation + +// DescribeRouteTablesRequest generates a request for the DescribeRouteTables operation. +func (c *EC2) DescribeRouteTablesRequest(input *DescribeRouteTablesInput) (req *aws.Request, output *DescribeRouteTablesOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opDescribeRouteTables == nil { + opDescribeRouteTables = &aws.Operation{ + Name: "DescribeRouteTables", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &DescribeRouteTablesInput{} + } + + req = c.newRequest(opDescribeRouteTables, input, output) + output = &DescribeRouteTablesOutput{} + req.Data = output + return +} + +// Describes one or more of your route tables. +// +// For more information about route tables, see Route Tables (http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_Route_Tables.html) +// in the Amazon Virtual Private Cloud User Guide. +func (c *EC2) DescribeRouteTables(input *DescribeRouteTablesInput) (output *DescribeRouteTablesOutput, err error) { + req, out := c.DescribeRouteTablesRequest(input) + output = out + err = req.Send() + return +} + +var opDescribeRouteTables *aws.Operation + +// DescribeSecurityGroupsRequest generates a request for the DescribeSecurityGroups operation. +func (c *EC2) DescribeSecurityGroupsRequest(input *DescribeSecurityGroupsInput) (req *aws.Request, output *DescribeSecurityGroupsOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opDescribeSecurityGroups == nil { + opDescribeSecurityGroups = &aws.Operation{ + Name: "DescribeSecurityGroups", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &DescribeSecurityGroupsInput{} + } + + req = c.newRequest(opDescribeSecurityGroups, input, output) + output = &DescribeSecurityGroupsOutput{} + req.Data = output + return +} + +// Describes one or more of your security groups. +// +// A security group is for use with instances either in the EC2-Classic platform +// or in a specific VPC. For more information, see Amazon EC2 Security Groups +// (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-network-security.html) +// in the Amazon Elastic Compute Cloud User Guide and Security Groups for Your +// VPC (http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_SecurityGroups.html) +// in the Amazon Virtual Private Cloud User Guide. +func (c *EC2) DescribeSecurityGroups(input *DescribeSecurityGroupsInput) (output *DescribeSecurityGroupsOutput, err error) { + req, out := c.DescribeSecurityGroupsRequest(input) + output = out + err = req.Send() + return +} + +var opDescribeSecurityGroups *aws.Operation + +// DescribeSnapshotAttributeRequest generates a request for the DescribeSnapshotAttribute operation. +func (c *EC2) DescribeSnapshotAttributeRequest(input *DescribeSnapshotAttributeInput) (req *aws.Request, output *DescribeSnapshotAttributeOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opDescribeSnapshotAttribute == nil { + opDescribeSnapshotAttribute = &aws.Operation{ + Name: "DescribeSnapshotAttribute", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &DescribeSnapshotAttributeInput{} + } + + req = c.newRequest(opDescribeSnapshotAttribute, input, output) + output = &DescribeSnapshotAttributeOutput{} + req.Data = output + return +} + +// Describes the specified attribute of the specified snapshot. You can specify +// only one attribute at a time. +// +// For more information about Amazon EBS snapshots, see Amazon EBS Snapshots +// in the Amazon Elastic Compute Cloud User Guide. +func (c *EC2) DescribeSnapshotAttribute(input *DescribeSnapshotAttributeInput) (output *DescribeSnapshotAttributeOutput, err error) { + req, out := c.DescribeSnapshotAttributeRequest(input) + output = out + err = req.Send() + return +} + +var opDescribeSnapshotAttribute *aws.Operation + +// DescribeSnapshotsRequest generates a request for the DescribeSnapshots operation. +func (c *EC2) DescribeSnapshotsRequest(input *DescribeSnapshotsInput) (req *aws.Request, output *DescribeSnapshotsOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opDescribeSnapshots == nil { + opDescribeSnapshots = &aws.Operation{ + Name: "DescribeSnapshots", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &DescribeSnapshotsInput{} + } + + req = c.newRequest(opDescribeSnapshots, input, output) + output = &DescribeSnapshotsOutput{} + req.Data = output + return +} + +// Describes one or more of the Amazon EBS snapshots available to you. Available +// snapshots include public snapshots available for any AWS account to launch, +// private snapshots that you own, and private snapshots owned by another AWS +// account but for which you've been given explicit create volume permissions. +// +// The create volume permissions fall into the following categories: +// +// public: The owner of the snapshot granted create volume permissions for +// the snapshot to the all group. All AWS accounts have create volume permissions +// for these snapshots. explicit: The owner of the snapshot granted create +// volume permissions to a specific AWS account. implicit: An AWS account has +// implicit create volume permissions for all snapshots it owns. The list of +// snapshots returned can be modified by specifying snapshot IDs, snapshot owners, +// or AWS accounts with create volume permissions. If no options are specified, +// Amazon EC2 returns all snapshots for which you have create volume permissions. +// +// If you specify one or more snapshot IDs, only snapshots that have the specified +// IDs are returned. If you specify an invalid snapshot ID, an error is returned. +// If you specify a snapshot ID for which you do not have access, it is not +// included in the returned results. +// +// If you specify one or more snapshot owners, only snapshots from the specified +// owners and for which you have access are returned. The results can include +// the AWS account IDs of the specified owners, amazon for snapshots owned by +// Amazon, or self for snapshots that you own. +// +// If you specify a list of restorable users, only snapshots with create snapshot +// permissions for those users are returned. You can specify AWS account IDs +// (if you own the snapshots), self for snapshots for which you own or have +// explicit permissions, or all for public snapshots. +// +// If you are describing a long list of snapshots, you can paginate the output +// to make the list more manageable. The MaxResults parameter sets the maximum +// number of results returned in a single page. If the list of results exceeds +// your MaxResults value, then that number of results is returned along with +// a NextToken value that can be passed to a subsequent DescribeSnapshots request +// to retrieve the remaining results. +// +// For more information about Amazon EBS snapshots, see Amazon EBS Snapshots +// in the Amazon Elastic Compute Cloud User Guide. +func (c *EC2) DescribeSnapshots(input *DescribeSnapshotsInput) (output *DescribeSnapshotsOutput, err error) { + req, out := c.DescribeSnapshotsRequest(input) + output = out + err = req.Send() + return +} + +var opDescribeSnapshots *aws.Operation + +// DescribeSpotDatafeedSubscriptionRequest generates a request for the DescribeSpotDatafeedSubscription operation. +func (c *EC2) DescribeSpotDatafeedSubscriptionRequest(input *DescribeSpotDatafeedSubscriptionInput) (req *aws.Request, output *DescribeSpotDatafeedSubscriptionOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opDescribeSpotDatafeedSubscription == nil { + opDescribeSpotDatafeedSubscription = &aws.Operation{ + Name: "DescribeSpotDatafeedSubscription", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &DescribeSpotDatafeedSubscriptionInput{} + } + + req = c.newRequest(opDescribeSpotDatafeedSubscription, input, output) + output = &DescribeSpotDatafeedSubscriptionOutput{} + req.Data = output + return +} + +// Describes the data feed for Spot Instances. For more information, see Spot +// Instance Data Feed (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/spot-data-feeds.html) +// in the Amazon Elastic Compute Cloud User Guide. +func (c *EC2) DescribeSpotDatafeedSubscription(input *DescribeSpotDatafeedSubscriptionInput) (output *DescribeSpotDatafeedSubscriptionOutput, err error) { + req, out := c.DescribeSpotDatafeedSubscriptionRequest(input) + output = out + err = req.Send() + return +} + +var opDescribeSpotDatafeedSubscription *aws.Operation + +// DescribeSpotInstanceRequestsRequest generates a request for the DescribeSpotInstanceRequests operation. +func (c *EC2) DescribeSpotInstanceRequestsRequest(input *DescribeSpotInstanceRequestsInput) (req *aws.Request, output *DescribeSpotInstanceRequestsOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opDescribeSpotInstanceRequests == nil { + opDescribeSpotInstanceRequests = &aws.Operation{ + Name: "DescribeSpotInstanceRequests", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &DescribeSpotInstanceRequestsInput{} + } + + req = c.newRequest(opDescribeSpotInstanceRequests, input, output) + output = &DescribeSpotInstanceRequestsOutput{} + req.Data = output + return +} + +// Describes the Spot Instance requests that belong to your account. Spot Instances +// are instances that Amazon EC2 launches when the bid price that you specify +// exceeds the current Spot Price. Amazon EC2 periodically sets the Spot Price +// based on available Spot Instance capacity and current Spot Instance requests. +// For more information, see Spot Instance Requests (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/spot-requests.html) +// in the Amazon Elastic Compute Cloud User Guide. +// +// You can use DescribeSpotInstanceRequests to find a running Spot Instance +// by examining the response. If the status of the Spot Instance is fulfilled, +// the instance ID appears in the response and contains the identifier of the +// instance. Alternatively, you can use DescribeInstances with a filter to look +// for instances where the instance lifecycle is spot. +func (c *EC2) DescribeSpotInstanceRequests(input *DescribeSpotInstanceRequestsInput) (output *DescribeSpotInstanceRequestsOutput, err error) { + req, out := c.DescribeSpotInstanceRequestsRequest(input) + output = out + err = req.Send() + return +} + +var opDescribeSpotInstanceRequests *aws.Operation + +// DescribeSpotPriceHistoryRequest generates a request for the DescribeSpotPriceHistory operation. +func (c *EC2) DescribeSpotPriceHistoryRequest(input *DescribeSpotPriceHistoryInput) (req *aws.Request, output *DescribeSpotPriceHistoryOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opDescribeSpotPriceHistory == nil { + opDescribeSpotPriceHistory = &aws.Operation{ + Name: "DescribeSpotPriceHistory", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &DescribeSpotPriceHistoryInput{} + } + + req = c.newRequest(opDescribeSpotPriceHistory, input, output) + output = &DescribeSpotPriceHistoryOutput{} + req.Data = output + return +} + +// Describes the Spot Price history. The prices returned are listed in chronological +// order, from the oldest to the most recent, for up to the past 90 days. For +// more information, see Spot Instance Pricing History (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-spot-instances-history.html) +// in the Amazon Elastic Compute Cloud User Guide. +// +// When you specify a start and end time, this operation returns the prices +// of the instance types within the time range that you specified and the time +// when the price changed. The price is valid within the time period that you +// specified; the response merely indicates the last time that the price changed. +func (c *EC2) DescribeSpotPriceHistory(input *DescribeSpotPriceHistoryInput) (output *DescribeSpotPriceHistoryOutput, err error) { + req, out := c.DescribeSpotPriceHistoryRequest(input) + output = out + err = req.Send() + return +} + +var opDescribeSpotPriceHistory *aws.Operation + +// DescribeSubnetsRequest generates a request for the DescribeSubnets operation. +func (c *EC2) DescribeSubnetsRequest(input *DescribeSubnetsInput) (req *aws.Request, output *DescribeSubnetsOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opDescribeSubnets == nil { + opDescribeSubnets = &aws.Operation{ + Name: "DescribeSubnets", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &DescribeSubnetsInput{} + } + + req = c.newRequest(opDescribeSubnets, input, output) + output = &DescribeSubnetsOutput{} + req.Data = output + return +} + +// Describes one or more of your subnets. +// +// For more information about subnets, see Your VPC and Subnets (http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_Subnets.html) +// in the Amazon Virtual Private Cloud User Guide. +func (c *EC2) DescribeSubnets(input *DescribeSubnetsInput) (output *DescribeSubnetsOutput, err error) { + req, out := c.DescribeSubnetsRequest(input) + output = out + err = req.Send() + return +} + +var opDescribeSubnets *aws.Operation + +// DescribeTagsRequest generates a request for the DescribeTags operation. +func (c *EC2) DescribeTagsRequest(input *DescribeTagsInput) (req *aws.Request, output *DescribeTagsOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opDescribeTags == nil { + opDescribeTags = &aws.Operation{ + Name: "DescribeTags", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &DescribeTagsInput{} + } + + req = c.newRequest(opDescribeTags, input, output) + output = &DescribeTagsOutput{} + req.Data = output + return +} + +// Describes one or more of the tags for your EC2 resources. +// +// For more information about tags, see Tagging Your Resources (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Using_Tags.html) +// in the Amazon Elastic Compute Cloud User Guide. +func (c *EC2) DescribeTags(input *DescribeTagsInput) (output *DescribeTagsOutput, err error) { + req, out := c.DescribeTagsRequest(input) + output = out + err = req.Send() + return +} + +var opDescribeTags *aws.Operation + +// DescribeVPCAttributeRequest generates a request for the DescribeVPCAttribute operation. +func (c *EC2) DescribeVPCAttributeRequest(input *DescribeVPCAttributeInput) (req *aws.Request, output *DescribeVPCAttributeOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opDescribeVPCAttribute == nil { + opDescribeVPCAttribute = &aws.Operation{ + Name: "DescribeVpcAttribute", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &DescribeVPCAttributeInput{} + } + + req = c.newRequest(opDescribeVPCAttribute, input, output) + output = &DescribeVPCAttributeOutput{} + req.Data = output + return +} + +// Describes the specified attribute of the specified VPC. You can specify only +// one attribute at a time. +func (c *EC2) DescribeVPCAttribute(input *DescribeVPCAttributeInput) (output *DescribeVPCAttributeOutput, err error) { + req, out := c.DescribeVPCAttributeRequest(input) + output = out + err = req.Send() + return +} + +var opDescribeVPCAttribute *aws.Operation + +// DescribeVPCClassicLinkRequest generates a request for the DescribeVPCClassicLink operation. +func (c *EC2) DescribeVPCClassicLinkRequest(input *DescribeVPCClassicLinkInput) (req *aws.Request, output *DescribeVPCClassicLinkOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opDescribeVPCClassicLink == nil { + opDescribeVPCClassicLink = &aws.Operation{ + Name: "DescribeVpcClassicLink", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &DescribeVPCClassicLinkInput{} + } + + req = c.newRequest(opDescribeVPCClassicLink, input, output) + output = &DescribeVPCClassicLinkOutput{} + req.Data = output + return +} + +// Describes the ClassicLink status of one or more VPCs. +func (c *EC2) DescribeVPCClassicLink(input *DescribeVPCClassicLinkInput) (output *DescribeVPCClassicLinkOutput, err error) { + req, out := c.DescribeVPCClassicLinkRequest(input) + output = out + err = req.Send() + return +} + +var opDescribeVPCClassicLink *aws.Operation + +// DescribeVPCPeeringConnectionsRequest generates a request for the DescribeVPCPeeringConnections operation. +func (c *EC2) DescribeVPCPeeringConnectionsRequest(input *DescribeVPCPeeringConnectionsInput) (req *aws.Request, output *DescribeVPCPeeringConnectionsOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opDescribeVPCPeeringConnections == nil { + opDescribeVPCPeeringConnections = &aws.Operation{ + Name: "DescribeVpcPeeringConnections", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &DescribeVPCPeeringConnectionsInput{} + } + + req = c.newRequest(opDescribeVPCPeeringConnections, input, output) + output = &DescribeVPCPeeringConnectionsOutput{} + req.Data = output + return +} + +// Describes one or more of your VPC peering connections. +func (c *EC2) DescribeVPCPeeringConnections(input *DescribeVPCPeeringConnectionsInput) (output *DescribeVPCPeeringConnectionsOutput, err error) { + req, out := c.DescribeVPCPeeringConnectionsRequest(input) + output = out + err = req.Send() + return +} + +var opDescribeVPCPeeringConnections *aws.Operation + +// DescribeVPCsRequest generates a request for the DescribeVPCs operation. +func (c *EC2) DescribeVPCsRequest(input *DescribeVPCsInput) (req *aws.Request, output *DescribeVPCsOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opDescribeVPCs == nil { + opDescribeVPCs = &aws.Operation{ + Name: "DescribeVpcs", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &DescribeVPCsInput{} + } + + req = c.newRequest(opDescribeVPCs, input, output) + output = &DescribeVPCsOutput{} + req.Data = output + return +} + +// Describes one or more of your VPCs. +func (c *EC2) DescribeVPCs(input *DescribeVPCsInput) (output *DescribeVPCsOutput, err error) { + req, out := c.DescribeVPCsRequest(input) + output = out + err = req.Send() + return +} + +var opDescribeVPCs *aws.Operation + +// DescribeVPNConnectionsRequest generates a request for the DescribeVPNConnections operation. +func (c *EC2) DescribeVPNConnectionsRequest(input *DescribeVPNConnectionsInput) (req *aws.Request, output *DescribeVPNConnectionsOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opDescribeVPNConnections == nil { + opDescribeVPNConnections = &aws.Operation{ + Name: "DescribeVpnConnections", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &DescribeVPNConnectionsInput{} + } + + req = c.newRequest(opDescribeVPNConnections, input, output) + output = &DescribeVPNConnectionsOutput{} + req.Data = output + return +} + +// Describes one or more of your VPN connections. +// +// For more information about VPN connections, see Adding a Hardware Virtual +// Private Gateway to Your VPC (http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_VPN.html) +// in the Amazon Virtual Private Cloud User Guide. +func (c *EC2) DescribeVPNConnections(input *DescribeVPNConnectionsInput) (output *DescribeVPNConnectionsOutput, err error) { + req, out := c.DescribeVPNConnectionsRequest(input) + output = out + err = req.Send() + return +} + +var opDescribeVPNConnections *aws.Operation + +// DescribeVPNGatewaysRequest generates a request for the DescribeVPNGateways operation. +func (c *EC2) DescribeVPNGatewaysRequest(input *DescribeVPNGatewaysInput) (req *aws.Request, output *DescribeVPNGatewaysOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opDescribeVPNGateways == nil { + opDescribeVPNGateways = &aws.Operation{ + Name: "DescribeVpnGateways", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &DescribeVPNGatewaysInput{} + } + + req = c.newRequest(opDescribeVPNGateways, input, output) + output = &DescribeVPNGatewaysOutput{} + req.Data = output + return +} + +// Describes one or more of your virtual private gateways. +// +// For more information about virtual private gateways, see Adding an IPsec +// Hardware VPN to Your VPC (http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_VPN.html) +// in the Amazon Virtual Private Cloud User Guide. +func (c *EC2) DescribeVPNGateways(input *DescribeVPNGatewaysInput) (output *DescribeVPNGatewaysOutput, err error) { + req, out := c.DescribeVPNGatewaysRequest(input) + output = out + err = req.Send() + return +} + +var opDescribeVPNGateways *aws.Operation + +// DescribeVolumeAttributeRequest generates a request for the DescribeVolumeAttribute operation. +func (c *EC2) DescribeVolumeAttributeRequest(input *DescribeVolumeAttributeInput) (req *aws.Request, output *DescribeVolumeAttributeOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opDescribeVolumeAttribute == nil { + opDescribeVolumeAttribute = &aws.Operation{ + Name: "DescribeVolumeAttribute", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &DescribeVolumeAttributeInput{} + } + + req = c.newRequest(opDescribeVolumeAttribute, input, output) + output = &DescribeVolumeAttributeOutput{} + req.Data = output + return +} + +// Describes the specified attribute of the specified volume. You can specify +// only one attribute at a time. +// +// For more information about Amazon EBS volumes, see Amazon EBS Volumes in +// the Amazon Elastic Compute Cloud User Guide. +func (c *EC2) DescribeVolumeAttribute(input *DescribeVolumeAttributeInput) (output *DescribeVolumeAttributeOutput, err error) { + req, out := c.DescribeVolumeAttributeRequest(input) + output = out + err = req.Send() + return +} + +var opDescribeVolumeAttribute *aws.Operation + +// DescribeVolumeStatusRequest generates a request for the DescribeVolumeStatus operation. +func (c *EC2) DescribeVolumeStatusRequest(input *DescribeVolumeStatusInput) (req *aws.Request, output *DescribeVolumeStatusOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opDescribeVolumeStatus == nil { + opDescribeVolumeStatus = &aws.Operation{ + Name: "DescribeVolumeStatus", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &DescribeVolumeStatusInput{} + } + + req = c.newRequest(opDescribeVolumeStatus, input, output) + output = &DescribeVolumeStatusOutput{} + req.Data = output + return +} + +// Describes the status of the specified volumes. Volume status provides the +// result of the checks performed on your volumes to determine events that can +// impair the performance of your volumes. The performance of a volume can be +// affected if an issue occurs on the volume's underlying host. If the volume's +// underlying host experiences a power outage or system issue, after the system +// is restored, there could be data inconsistencies on the volume. Volume events +// notify you if this occurs. Volume actions notify you if any action needs +// to be taken in response to the event. +// +// The DescribeVolumeStatus operation provides the following information about +// the specified volumes: +// +// Status: Reflects the current status of the volume. The possible values are +// ok, impaired , warning, or insufficient-data. If all checks pass, the overall +// status of the volume is ok. If the check fails, the overall status is impaired. +// If the status is insufficient-data, then the checks may still be taking place +// on your volume at the time. We recommend that you retry the request. For +// more information on volume status, see Monitoring the Status of Your Volumes +// (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/monitoring-volume-status.html). +// +// Events: Reflect the cause of a volume status and may require you to take +// action. For example, if your volume returns an impaired status, then the +// volume event might be potential-data-inconsistency. This means that your +// volume has been affected by an issue with the underlying host, has all I/O +// operations disabled, and may have inconsistent data. +// +// Actions: Reflect the actions you may have to take in response to an event. +// For example, if the status of the volume is impaired and the volume event +// shows potential-data-inconsistency, then the action shows enable-volume-io. +// This means that you may want to enable the I/O operations for the volume +// by calling the EnableVolumeIO action and then check the volume for data consistency. +// +// Volume status is based on the volume status checks, and does not reflect +// the volume state. Therefore, volume status does not indicate volumes in the +// error state (for example, when a volume is incapable of accepting I/O.) +func (c *EC2) DescribeVolumeStatus(input *DescribeVolumeStatusInput) (output *DescribeVolumeStatusOutput, err error) { + req, out := c.DescribeVolumeStatusRequest(input) + output = out + err = req.Send() + return +} + +var opDescribeVolumeStatus *aws.Operation + +// DescribeVolumesRequest generates a request for the DescribeVolumes operation. +func (c *EC2) DescribeVolumesRequest(input *DescribeVolumesInput) (req *aws.Request, output *DescribeVolumesOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opDescribeVolumes == nil { + opDescribeVolumes = &aws.Operation{ + Name: "DescribeVolumes", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &DescribeVolumesInput{} + } + + req = c.newRequest(opDescribeVolumes, input, output) + output = &DescribeVolumesOutput{} + req.Data = output + return +} + +// Describes the specified Amazon EBS volumes. +// +// If you are describing a long list of volumes, you can paginate the output +// to make the list more manageable. The MaxResults parameter sets the maximum +// number of results returned in a single page. If the list of results exceeds +// your MaxResults value, then that number of results is returned along with +// a NextToken value that can be passed to a subsequent DescribeVolumes request +// to retrieve the remaining results. +// +// For more information about Amazon EBS volumes, see Amazon EBS Volumes in +// the Amazon Elastic Compute Cloud User Guide. +func (c *EC2) DescribeVolumes(input *DescribeVolumesInput) (output *DescribeVolumesOutput, err error) { + req, out := c.DescribeVolumesRequest(input) + output = out + err = req.Send() + return +} + +var opDescribeVolumes *aws.Operation + +// DetachClassicLinkVPCRequest generates a request for the DetachClassicLinkVPC operation. +func (c *EC2) DetachClassicLinkVPCRequest(input *DetachClassicLinkVPCInput) (req *aws.Request, output *DetachClassicLinkVPCOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opDetachClassicLinkVPC == nil { + opDetachClassicLinkVPC = &aws.Operation{ + Name: "DetachClassicLinkVpc", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &DetachClassicLinkVPCInput{} + } + + req = c.newRequest(opDetachClassicLinkVPC, input, output) + output = &DetachClassicLinkVPCOutput{} + req.Data = output + return +} + +// Unlinks (detaches) a linked EC2-Classic instance from a VPC. After the instance +// has been unlinked, the VPC security groups are no longer associated with +// it. An instance is automatically unlinked from a VPC when it's stopped. +func (c *EC2) DetachClassicLinkVPC(input *DetachClassicLinkVPCInput) (output *DetachClassicLinkVPCOutput, err error) { + req, out := c.DetachClassicLinkVPCRequest(input) + output = out + err = req.Send() + return +} + +var opDetachClassicLinkVPC *aws.Operation + +// DetachInternetGatewayRequest generates a request for the DetachInternetGateway operation. +func (c *EC2) DetachInternetGatewayRequest(input *DetachInternetGatewayInput) (req *aws.Request, output *DetachInternetGatewayOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opDetachInternetGateway == nil { + opDetachInternetGateway = &aws.Operation{ + Name: "DetachInternetGateway", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &DetachInternetGatewayInput{} + } + + req = c.newRequest(opDetachInternetGateway, input, output) + output = &DetachInternetGatewayOutput{} + req.Data = output + return +} + +// Detaches an Internet gateway from a VPC, disabling connectivity between the +// Internet and the VPC. The VPC must not contain any running instances with +// Elastic IP addresses. +func (c *EC2) DetachInternetGateway(input *DetachInternetGatewayInput) (output *DetachInternetGatewayOutput, err error) { + req, out := c.DetachInternetGatewayRequest(input) + output = out + err = req.Send() + return +} + +var opDetachInternetGateway *aws.Operation + +// DetachNetworkInterfaceRequest generates a request for the DetachNetworkInterface operation. +func (c *EC2) DetachNetworkInterfaceRequest(input *DetachNetworkInterfaceInput) (req *aws.Request, output *DetachNetworkInterfaceOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opDetachNetworkInterface == nil { + opDetachNetworkInterface = &aws.Operation{ + Name: "DetachNetworkInterface", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &DetachNetworkInterfaceInput{} + } + + req = c.newRequest(opDetachNetworkInterface, input, output) + output = &DetachNetworkInterfaceOutput{} + req.Data = output + return +} + +// Detaches a network interface from an instance. +func (c *EC2) DetachNetworkInterface(input *DetachNetworkInterfaceInput) (output *DetachNetworkInterfaceOutput, err error) { + req, out := c.DetachNetworkInterfaceRequest(input) + output = out + err = req.Send() + return +} + +var opDetachNetworkInterface *aws.Operation + +// DetachVPNGatewayRequest generates a request for the DetachVPNGateway operation. +func (c *EC2) DetachVPNGatewayRequest(input *DetachVPNGatewayInput) (req *aws.Request, output *DetachVPNGatewayOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opDetachVPNGateway == nil { + opDetachVPNGateway = &aws.Operation{ + Name: "DetachVpnGateway", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &DetachVPNGatewayInput{} + } + + req = c.newRequest(opDetachVPNGateway, input, output) + output = &DetachVPNGatewayOutput{} + req.Data = output + return +} + +// Detaches a virtual private gateway from a VPC. You do this if you're planning +// to turn off the VPC and not use it anymore. You can confirm a virtual private +// gateway has been completely detached from a VPC by describing the virtual +// private gateway (any attachments to the virtual private gateway are also +// described). +// +// You must wait for the attachment's state to switch to detached before you +// can delete the VPC or attach a different VPC to the virtual private gateway. +func (c *EC2) DetachVPNGateway(input *DetachVPNGatewayInput) (output *DetachVPNGatewayOutput, err error) { + req, out := c.DetachVPNGatewayRequest(input) + output = out + err = req.Send() + return +} + +var opDetachVPNGateway *aws.Operation + +// DetachVolumeRequest generates a request for the DetachVolume operation. +func (c *EC2) DetachVolumeRequest(input *DetachVolumeInput) (req *aws.Request, output *VolumeAttachment) { + oprw.Lock() + defer oprw.Unlock() + + if opDetachVolume == nil { + opDetachVolume = &aws.Operation{ + Name: "DetachVolume", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &DetachVolumeInput{} + } + + req = c.newRequest(opDetachVolume, input, output) + output = &VolumeAttachment{} + req.Data = output + return +} + +// Detaches an Amazon EBS volume from an instance. Make sure to unmount any +// file systems on the device within your operating system before detaching +// the volume. Failure to do so results in the volume being stuck in a busy +// state while detaching. +// +// If an Amazon EBS volume is the root device of an instance, it can't be detached +// while the instance is running. To detach the root volume, stop the instance +// first. +// +// When a volume with an AWS Marketplace product code is detached from an instance, +// the product code is no longer associated with the instance. +// +// For more information, see Detaching an Amazon EBS Volume (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-detaching-volume.html) +// in the Amazon Elastic Compute Cloud User Guide. +func (c *EC2) DetachVolume(input *DetachVolumeInput) (output *VolumeAttachment, err error) { + req, out := c.DetachVolumeRequest(input) + output = out + err = req.Send() + return +} + +var opDetachVolume *aws.Operation + +// DisableVGWRoutePropagationRequest generates a request for the DisableVGWRoutePropagation operation. +func (c *EC2) DisableVGWRoutePropagationRequest(input *DisableVGWRoutePropagationInput) (req *aws.Request, output *DisableVGWRoutePropagationOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opDisableVGWRoutePropagation == nil { + opDisableVGWRoutePropagation = &aws.Operation{ + Name: "DisableVgwRoutePropagation", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &DisableVGWRoutePropagationInput{} + } + + req = c.newRequest(opDisableVGWRoutePropagation, input, output) + output = &DisableVGWRoutePropagationOutput{} + req.Data = output + return +} + +// Disables a virtual private gateway (VGW) from propagating routes to a specified +// route table of a VPC. +func (c *EC2) DisableVGWRoutePropagation(input *DisableVGWRoutePropagationInput) (output *DisableVGWRoutePropagationOutput, err error) { + req, out := c.DisableVGWRoutePropagationRequest(input) + output = out + err = req.Send() + return +} + +var opDisableVGWRoutePropagation *aws.Operation + +// DisableVPCClassicLinkRequest generates a request for the DisableVPCClassicLink operation. +func (c *EC2) DisableVPCClassicLinkRequest(input *DisableVPCClassicLinkInput) (req *aws.Request, output *DisableVPCClassicLinkOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opDisableVPCClassicLink == nil { + opDisableVPCClassicLink = &aws.Operation{ + Name: "DisableVpcClassicLink", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &DisableVPCClassicLinkInput{} + } + + req = c.newRequest(opDisableVPCClassicLink, input, output) + output = &DisableVPCClassicLinkOutput{} + req.Data = output + return +} + +// Disables ClassicLink for a VPC. You cannot disable ClassicLink for a VPC +// that has EC2-Classic instances linked to it. +func (c *EC2) DisableVPCClassicLink(input *DisableVPCClassicLinkInput) (output *DisableVPCClassicLinkOutput, err error) { + req, out := c.DisableVPCClassicLinkRequest(input) + output = out + err = req.Send() + return +} + +var opDisableVPCClassicLink *aws.Operation + +// DisassociateAddressRequest generates a request for the DisassociateAddress operation. +func (c *EC2) DisassociateAddressRequest(input *DisassociateAddressInput) (req *aws.Request, output *DisassociateAddressOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opDisassociateAddress == nil { + opDisassociateAddress = &aws.Operation{ + Name: "DisassociateAddress", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &DisassociateAddressInput{} + } + + req = c.newRequest(opDisassociateAddress, input, output) + output = &DisassociateAddressOutput{} + req.Data = output + return +} + +// Disassociates an Elastic IP address from the instance or network interface +// it's associated with. +// +// An Elastic IP address is for use in either the EC2-Classic platform or in +// a VPC. For more information, see Elastic IP Addresses (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/elastic-ip-addresses-eip.html) +// in the Amazon Elastic Compute Cloud User Guide. +// +// This is an idempotent operation. If you perform the operation more than +// once, Amazon EC2 doesn't return an error. +func (c *EC2) DisassociateAddress(input *DisassociateAddressInput) (output *DisassociateAddressOutput, err error) { + req, out := c.DisassociateAddressRequest(input) + output = out + err = req.Send() + return +} + +var opDisassociateAddress *aws.Operation + +// DisassociateRouteTableRequest generates a request for the DisassociateRouteTable operation. +func (c *EC2) DisassociateRouteTableRequest(input *DisassociateRouteTableInput) (req *aws.Request, output *DisassociateRouteTableOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opDisassociateRouteTable == nil { + opDisassociateRouteTable = &aws.Operation{ + Name: "DisassociateRouteTable", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &DisassociateRouteTableInput{} + } + + req = c.newRequest(opDisassociateRouteTable, input, output) + output = &DisassociateRouteTableOutput{} + req.Data = output + return +} + +// Disassociates a subnet from a route table. +// +// After you perform this action, the subnet no longer uses the routes in the +// route table. Instead, it uses the routes in the VPC's main route table. For +// more information about route tables, see Route Tables (http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_Route_Tables.html) +// in the Amazon Virtual Private Cloud User Guide. +func (c *EC2) DisassociateRouteTable(input *DisassociateRouteTableInput) (output *DisassociateRouteTableOutput, err error) { + req, out := c.DisassociateRouteTableRequest(input) + output = out + err = req.Send() + return +} + +var opDisassociateRouteTable *aws.Operation + +// EnableVGWRoutePropagationRequest generates a request for the EnableVGWRoutePropagation operation. +func (c *EC2) EnableVGWRoutePropagationRequest(input *EnableVGWRoutePropagationInput) (req *aws.Request, output *EnableVGWRoutePropagationOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opEnableVGWRoutePropagation == nil { + opEnableVGWRoutePropagation = &aws.Operation{ + Name: "EnableVgwRoutePropagation", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &EnableVGWRoutePropagationInput{} + } + + req = c.newRequest(opEnableVGWRoutePropagation, input, output) + output = &EnableVGWRoutePropagationOutput{} + req.Data = output + return +} + +// Enables a virtual private gateway (VGW) to propagate routes to the specified +// route table of a VPC. +func (c *EC2) EnableVGWRoutePropagation(input *EnableVGWRoutePropagationInput) (output *EnableVGWRoutePropagationOutput, err error) { + req, out := c.EnableVGWRoutePropagationRequest(input) + output = out + err = req.Send() + return +} + +var opEnableVGWRoutePropagation *aws.Operation + +// EnableVPCClassicLinkRequest generates a request for the EnableVPCClassicLink operation. +func (c *EC2) EnableVPCClassicLinkRequest(input *EnableVPCClassicLinkInput) (req *aws.Request, output *EnableVPCClassicLinkOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opEnableVPCClassicLink == nil { + opEnableVPCClassicLink = &aws.Operation{ + Name: "EnableVpcClassicLink", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &EnableVPCClassicLinkInput{} + } + + req = c.newRequest(opEnableVPCClassicLink, input, output) + output = &EnableVPCClassicLinkOutput{} + req.Data = output + return +} + +// Enables a VPC for ClassicLink. You can then link EC2-Classic instances to +// your ClassicLink-enabled VPC to allow communication over private IP addresses. +// You cannot enable your VPC for ClassicLink if any of your VPC's route tables +// have existing routes for address ranges within the 10.0.0.0/8 IP address +// range, excluding local routes for VPCs in the 10.0.0.0/16 and 10.1.0.0/16 +// IP address ranges. For more information, see ClassicLink (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/vpc-classiclink.html) +// in the Amazon Elastic Compute Cloud User Guide. +func (c *EC2) EnableVPCClassicLink(input *EnableVPCClassicLinkInput) (output *EnableVPCClassicLinkOutput, err error) { + req, out := c.EnableVPCClassicLinkRequest(input) + output = out + err = req.Send() + return +} + +var opEnableVPCClassicLink *aws.Operation + +// EnableVolumeIORequest generates a request for the EnableVolumeIO operation. +func (c *EC2) EnableVolumeIORequest(input *EnableVolumeIOInput) (req *aws.Request, output *EnableVolumeIOOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opEnableVolumeIO == nil { + opEnableVolumeIO = &aws.Operation{ + Name: "EnableVolumeIO", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &EnableVolumeIOInput{} + } + + req = c.newRequest(opEnableVolumeIO, input, output) + output = &EnableVolumeIOOutput{} + req.Data = output + return +} + +// Enables I/O operations for a volume that had I/O operations disabled because +// the data on the volume was potentially inconsistent. +func (c *EC2) EnableVolumeIO(input *EnableVolumeIOInput) (output *EnableVolumeIOOutput, err error) { + req, out := c.EnableVolumeIORequest(input) + output = out + err = req.Send() + return +} + +var opEnableVolumeIO *aws.Operation + +// GetConsoleOutputRequest generates a request for the GetConsoleOutput operation. +func (c *EC2) GetConsoleOutputRequest(input *GetConsoleOutputInput) (req *aws.Request, output *GetConsoleOutputOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opGetConsoleOutput == nil { + opGetConsoleOutput = &aws.Operation{ + Name: "GetConsoleOutput", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &GetConsoleOutputInput{} + } + + req = c.newRequest(opGetConsoleOutput, input, output) + output = &GetConsoleOutputOutput{} + req.Data = output + return +} + +// Gets the console output for the specified instance. +// +// Instances do not have a physical monitor through which you can view their +// console output. They also lack physical controls that allow you to power +// up, reboot, or shut them down. To allow these actions, we provide them through +// the Amazon EC2 API and command line interface. +// +// Instance console output is buffered and posted shortly after instance boot, +// reboot, and termination. Amazon EC2 preserves the most recent 64 KB output +// which is available for at least one hour after the most recent post. +// +// For Linux instances, the instance console output displays the exact console +// output that would normally be displayed on a physical monitor attached to +// a computer. This output is buffered because the instance produces it and +// then posts it to a store where the instance's owner can retrieve it. +// +// For Windows instances, the instance console output includes output from +// the EC2Config service. +func (c *EC2) GetConsoleOutput(input *GetConsoleOutputInput) (output *GetConsoleOutputOutput, err error) { + req, out := c.GetConsoleOutputRequest(input) + output = out + err = req.Send() + return +} + +var opGetConsoleOutput *aws.Operation + +// GetPasswordDataRequest generates a request for the GetPasswordData operation. +func (c *EC2) GetPasswordDataRequest(input *GetPasswordDataInput) (req *aws.Request, output *GetPasswordDataOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opGetPasswordData == nil { + opGetPasswordData = &aws.Operation{ + Name: "GetPasswordData", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &GetPasswordDataInput{} + } + + req = c.newRequest(opGetPasswordData, input, output) + output = &GetPasswordDataOutput{} + req.Data = output + return +} + +// Retrieves the encrypted administrator password for an instance running Windows. +// +// The Windows password is generated at boot if the EC2Config service plugin, +// Ec2SetPassword, is enabled. This usually only happens the first time an AMI +// is launched, and then Ec2SetPassword is automatically disabled. The password +// is not generated for rebundled AMIs unless Ec2SetPassword is enabled before +// bundling. +// +// The password is encrypted using the key pair that you specified when you +// launched the instance. You must provide the corresponding key pair file. +// +// Password generation and encryption takes a few moments. We recommend that +// you wait up to 15 minutes after launching an instance before trying to retrieve +// the generated password. +func (c *EC2) GetPasswordData(input *GetPasswordDataInput) (output *GetPasswordDataOutput, err error) { + req, out := c.GetPasswordDataRequest(input) + output = out + err = req.Send() + return +} + +var opGetPasswordData *aws.Operation + +// ImportImageRequest generates a request for the ImportImage operation. +func (c *EC2) ImportImageRequest(input *ImportImageInput) (req *aws.Request, output *ImportImageOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opImportImage == nil { + opImportImage = &aws.Operation{ + Name: "ImportImage", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &ImportImageInput{} + } + + req = c.newRequest(opImportImage, input, output) + output = &ImportImageOutput{} + req.Data = output + return +} + +// Import single or multi-volume disk images or Amazon EBS snapshots into an +// Amazon Machine Image (AMI). +func (c *EC2) ImportImage(input *ImportImageInput) (output *ImportImageOutput, err error) { + req, out := c.ImportImageRequest(input) + output = out + err = req.Send() + return +} + +var opImportImage *aws.Operation + +// ImportInstanceRequest generates a request for the ImportInstance operation. +func (c *EC2) ImportInstanceRequest(input *ImportInstanceInput) (req *aws.Request, output *ImportInstanceOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opImportInstance == nil { + opImportInstance = &aws.Operation{ + Name: "ImportInstance", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &ImportInstanceInput{} + } + + req = c.newRequest(opImportInstance, input, output) + output = &ImportInstanceOutput{} + req.Data = output + return +} + +// Creates an import instance task using metadata from the specified disk image. +// ImportInstance only supports single-volume VMs. To import multi-volume VMs, +// use ImportImage. After importing the image, you then upload it using the +// ec2-import-volume command in the EC2 command line tools. For more information, +// 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. +func (c *EC2) ImportInstance(input *ImportInstanceInput) (output *ImportInstanceOutput, err error) { + req, out := c.ImportInstanceRequest(input) + output = out + err = req.Send() + return +} + +var opImportInstance *aws.Operation + +// ImportKeyPairRequest generates a request for the ImportKeyPair operation. +func (c *EC2) ImportKeyPairRequest(input *ImportKeyPairInput) (req *aws.Request, output *ImportKeyPairOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opImportKeyPair == nil { + opImportKeyPair = &aws.Operation{ + Name: "ImportKeyPair", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &ImportKeyPairInput{} + } + + req = c.newRequest(opImportKeyPair, input, output) + output = &ImportKeyPairOutput{} + req.Data = output + return +} + +// Imports the public key from an RSA key pair that you created with a third-party +// tool. Compare this with CreateKeyPair, in which AWS creates the key pair +// and gives the keys to you (AWS keeps a copy of the public key). With ImportKeyPair, +// you create the key pair and give AWS just the public key. The private key +// is never transferred between you and AWS. +// +// For more information about key pairs, see Key Pairs (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-key-pairs.html) +// in the Amazon Elastic Compute Cloud User Guide. +func (c *EC2) ImportKeyPair(input *ImportKeyPairInput) (output *ImportKeyPairOutput, err error) { + req, out := c.ImportKeyPairRequest(input) + output = out + err = req.Send() + return +} + +var opImportKeyPair *aws.Operation + +// ImportSnapshotRequest generates a request for the ImportSnapshot operation. +func (c *EC2) ImportSnapshotRequest(input *ImportSnapshotInput) (req *aws.Request, output *ImportSnapshotOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opImportSnapshot == nil { + opImportSnapshot = &aws.Operation{ + Name: "ImportSnapshot", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &ImportSnapshotInput{} + } + + req = c.newRequest(opImportSnapshot, input, output) + output = &ImportSnapshotOutput{} + req.Data = output + return +} + +// Import a disk into an Amazon Elastic Block Store (Amazon EBS) snapshot. +func (c *EC2) ImportSnapshot(input *ImportSnapshotInput) (output *ImportSnapshotOutput, err error) { + req, out := c.ImportSnapshotRequest(input) + output = out + err = req.Send() + return +} + +var opImportSnapshot *aws.Operation + +// ImportVolumeRequest generates a request for the ImportVolume operation. +func (c *EC2) ImportVolumeRequest(input *ImportVolumeInput) (req *aws.Request, output *ImportVolumeOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opImportVolume == nil { + opImportVolume = &aws.Operation{ + Name: "ImportVolume", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &ImportVolumeInput{} + } + + req = c.newRequest(opImportVolume, input, output) + output = &ImportVolumeOutput{} + req.Data = output + return +} + +// Creates an import volume task using metadata from the specified disk image. +// After importing the image, you then upload it using the ec2-import-volume +// command in the Amazon EC2 command-line interface (CLI) tools. For more information, +// 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. +func (c *EC2) ImportVolume(input *ImportVolumeInput) (output *ImportVolumeOutput, err error) { + req, out := c.ImportVolumeRequest(input) + output = out + err = req.Send() + return +} + +var opImportVolume *aws.Operation + +// ModifyImageAttributeRequest generates a request for the ModifyImageAttribute operation. +func (c *EC2) ModifyImageAttributeRequest(input *ModifyImageAttributeInput) (req *aws.Request, output *ModifyImageAttributeOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opModifyImageAttribute == nil { + opModifyImageAttribute = &aws.Operation{ + Name: "ModifyImageAttribute", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &ModifyImageAttributeInput{} + } + + req = c.newRequest(opModifyImageAttribute, input, output) + output = &ModifyImageAttributeOutput{} + req.Data = output + return +} + +// Modifies the specified attribute of the specified AMI. You can specify only +// one attribute at a time. +// +// AWS Marketplace product codes cannot be modified. Images with an AWS Marketplace +// product code cannot be made public. +func (c *EC2) ModifyImageAttribute(input *ModifyImageAttributeInput) (output *ModifyImageAttributeOutput, err error) { + req, out := c.ModifyImageAttributeRequest(input) + output = out + err = req.Send() + return +} + +var opModifyImageAttribute *aws.Operation + +// ModifyInstanceAttributeRequest generates a request for the ModifyInstanceAttribute operation. +func (c *EC2) ModifyInstanceAttributeRequest(input *ModifyInstanceAttributeInput) (req *aws.Request, output *ModifyInstanceAttributeOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opModifyInstanceAttribute == nil { + opModifyInstanceAttribute = &aws.Operation{ + Name: "ModifyInstanceAttribute", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &ModifyInstanceAttributeInput{} + } + + req = c.newRequest(opModifyInstanceAttribute, input, output) + output = &ModifyInstanceAttributeOutput{} + req.Data = output + return +} + +// Modifies the specified attribute of the specified instance. You can specify +// only one attribute at a time. +// +// To modify some attributes, the instance must be stopped. For more information, +// see Modifying Attributes of a Stopped Instance (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Using_ChangingAttributesWhileInstanceStopped.html) +// in the Amazon Elastic Compute Cloud User Guide. +func (c *EC2) ModifyInstanceAttribute(input *ModifyInstanceAttributeInput) (output *ModifyInstanceAttributeOutput, err error) { + req, out := c.ModifyInstanceAttributeRequest(input) + output = out + err = req.Send() + return +} + +var opModifyInstanceAttribute *aws.Operation + +// ModifyNetworkInterfaceAttributeRequest generates a request for the ModifyNetworkInterfaceAttribute operation. +func (c *EC2) ModifyNetworkInterfaceAttributeRequest(input *ModifyNetworkInterfaceAttributeInput) (req *aws.Request, output *ModifyNetworkInterfaceAttributeOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opModifyNetworkInterfaceAttribute == nil { + opModifyNetworkInterfaceAttribute = &aws.Operation{ + Name: "ModifyNetworkInterfaceAttribute", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &ModifyNetworkInterfaceAttributeInput{} + } + + req = c.newRequest(opModifyNetworkInterfaceAttribute, input, output) + output = &ModifyNetworkInterfaceAttributeOutput{} + req.Data = output + return +} + +// Modifies the specified network interface attribute. You can specify only +// one attribute at a time. +func (c *EC2) ModifyNetworkInterfaceAttribute(input *ModifyNetworkInterfaceAttributeInput) (output *ModifyNetworkInterfaceAttributeOutput, err error) { + req, out := c.ModifyNetworkInterfaceAttributeRequest(input) + output = out + err = req.Send() + return +} + +var opModifyNetworkInterfaceAttribute *aws.Operation + +// ModifyReservedInstancesRequest generates a request for the ModifyReservedInstances operation. +func (c *EC2) ModifyReservedInstancesRequest(input *ModifyReservedInstancesInput) (req *aws.Request, output *ModifyReservedInstancesOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opModifyReservedInstances == nil { + opModifyReservedInstances = &aws.Operation{ + Name: "ModifyReservedInstances", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &ModifyReservedInstancesInput{} + } + + req = c.newRequest(opModifyReservedInstances, input, output) + output = &ModifyReservedInstancesOutput{} + req.Data = output + return +} + +// 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, +// network platform, and instance type. +// +// For more information, see Modifying Reserved Instances (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ri-modifying.html) +// in the Amazon Elastic Compute Cloud User Guide. +func (c *EC2) ModifyReservedInstances(input *ModifyReservedInstancesInput) (output *ModifyReservedInstancesOutput, err error) { + req, out := c.ModifyReservedInstancesRequest(input) + output = out + err = req.Send() + return +} + +var opModifyReservedInstances *aws.Operation + +// ModifySnapshotAttributeRequest generates a request for the ModifySnapshotAttribute operation. +func (c *EC2) ModifySnapshotAttributeRequest(input *ModifySnapshotAttributeInput) (req *aws.Request, output *ModifySnapshotAttributeOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opModifySnapshotAttribute == nil { + opModifySnapshotAttribute = &aws.Operation{ + Name: "ModifySnapshotAttribute", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &ModifySnapshotAttributeInput{} + } + + req = c.newRequest(opModifySnapshotAttribute, input, output) + output = &ModifySnapshotAttributeOutput{} + req.Data = output + return +} + +// Adds or removes permission settings for the specified snapshot. You may add +// or remove specified AWS account IDs from a snapshot's list of create volume +// permissions, but you cannot do both in a single API call. If you need to +// both add and remove account IDs for a snapshot, you must use multiple API +// calls. +// +// For more information on modifying snapshot permissions, see Sharing Snapshots +// (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-modifying-snapshot-permissions.html) +// in the Amazon Elastic Compute Cloud User Guide. +// +// Snapshots with AWS Marketplace product codes cannot be made public. +func (c *EC2) ModifySnapshotAttribute(input *ModifySnapshotAttributeInput) (output *ModifySnapshotAttributeOutput, err error) { + req, out := c.ModifySnapshotAttributeRequest(input) + output = out + err = req.Send() + return +} + +var opModifySnapshotAttribute *aws.Operation + +// ModifySubnetAttributeRequest generates a request for the ModifySubnetAttribute operation. +func (c *EC2) ModifySubnetAttributeRequest(input *ModifySubnetAttributeInput) (req *aws.Request, output *ModifySubnetAttributeOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opModifySubnetAttribute == nil { + opModifySubnetAttribute = &aws.Operation{ + Name: "ModifySubnetAttribute", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &ModifySubnetAttributeInput{} + } + + req = c.newRequest(opModifySubnetAttribute, input, output) + output = &ModifySubnetAttributeOutput{} + req.Data = output + return +} + +// Modifies a subnet attribute. +func (c *EC2) ModifySubnetAttribute(input *ModifySubnetAttributeInput) (output *ModifySubnetAttributeOutput, err error) { + req, out := c.ModifySubnetAttributeRequest(input) + output = out + err = req.Send() + return +} + +var opModifySubnetAttribute *aws.Operation + +// ModifyVPCAttributeRequest generates a request for the ModifyVPCAttribute operation. +func (c *EC2) ModifyVPCAttributeRequest(input *ModifyVPCAttributeInput) (req *aws.Request, output *ModifyVPCAttributeOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opModifyVPCAttribute == nil { + opModifyVPCAttribute = &aws.Operation{ + Name: "ModifyVpcAttribute", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &ModifyVPCAttributeInput{} + } + + req = c.newRequest(opModifyVPCAttribute, input, output) + output = &ModifyVPCAttributeOutput{} + req.Data = output + return +} + +// Modifies the specified attribute of the specified VPC. +func (c *EC2) ModifyVPCAttribute(input *ModifyVPCAttributeInput) (output *ModifyVPCAttributeOutput, err error) { + req, out := c.ModifyVPCAttributeRequest(input) + output = out + err = req.Send() + return +} + +var opModifyVPCAttribute *aws.Operation + +// ModifyVolumeAttributeRequest generates a request for the ModifyVolumeAttribute operation. +func (c *EC2) ModifyVolumeAttributeRequest(input *ModifyVolumeAttributeInput) (req *aws.Request, output *ModifyVolumeAttributeOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opModifyVolumeAttribute == nil { + opModifyVolumeAttribute = &aws.Operation{ + Name: "ModifyVolumeAttribute", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &ModifyVolumeAttributeInput{} + } + + req = c.newRequest(opModifyVolumeAttribute, input, output) + output = &ModifyVolumeAttributeOutput{} + req.Data = output + return +} + +// Modifies a volume attribute. +// +// By default, all I/O operations for the volume are suspended when the data +// on the volume is determined to be potentially inconsistent, to prevent undetectable, +// latent data corruption. The I/O access to the volume can be resumed by first +// enabling I/O access and then checking the data consistency on your volume. +// +// You can change the default behavior to resume I/O operations. We recommend +// that you change this only for boot volumes or for volumes that are stateless +// or disposable. +func (c *EC2) ModifyVolumeAttribute(input *ModifyVolumeAttributeInput) (output *ModifyVolumeAttributeOutput, err error) { + req, out := c.ModifyVolumeAttributeRequest(input) + output = out + err = req.Send() + return +} + +var opModifyVolumeAttribute *aws.Operation + +// MonitorInstancesRequest generates a request for the MonitorInstances operation. +func (c *EC2) MonitorInstancesRequest(input *MonitorInstancesInput) (req *aws.Request, output *MonitorInstancesOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opMonitorInstances == nil { + opMonitorInstances = &aws.Operation{ + Name: "MonitorInstances", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &MonitorInstancesInput{} + } + + req = c.newRequest(opMonitorInstances, input, output) + output = &MonitorInstancesOutput{} + req.Data = output + return +} + +// Enables monitoring for a running instance. For more information about monitoring +// instances, see Monitoring Your Instances and Volumes (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-cloudwatch.html) +// in the Amazon Elastic Compute Cloud User Guide. +func (c *EC2) MonitorInstances(input *MonitorInstancesInput) (output *MonitorInstancesOutput, err error) { + req, out := c.MonitorInstancesRequest(input) + output = out + err = req.Send() + return +} + +var opMonitorInstances *aws.Operation + +// PurchaseReservedInstancesOfferingRequest generates a request for the PurchaseReservedInstancesOffering operation. +func (c *EC2) PurchaseReservedInstancesOfferingRequest(input *PurchaseReservedInstancesOfferingInput) (req *aws.Request, output *PurchaseReservedInstancesOfferingOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opPurchaseReservedInstancesOffering == nil { + opPurchaseReservedInstancesOffering = &aws.Operation{ + Name: "PurchaseReservedInstancesOffering", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &PurchaseReservedInstancesOfferingInput{} + } + + req = c.newRequest(opPurchaseReservedInstancesOffering, input, output) + output = &PurchaseReservedInstancesOfferingOutput{} + req.Data = output + 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. You pay a lower usage rate +// than with On-Demand instances for the time that you actually use the capacity +// reservation. +// +// 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. +// +// 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) +// in the Amazon Elastic Compute Cloud User Guide. +func (c *EC2) PurchaseReservedInstancesOffering(input *PurchaseReservedInstancesOfferingInput) (output *PurchaseReservedInstancesOfferingOutput, err error) { + req, out := c.PurchaseReservedInstancesOfferingRequest(input) + output = out + err = req.Send() + return +} + +var opPurchaseReservedInstancesOffering *aws.Operation + +// RebootInstancesRequest generates a request for the RebootInstances operation. +func (c *EC2) RebootInstancesRequest(input *RebootInstancesInput) (req *aws.Request, output *RebootInstancesOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opRebootInstances == nil { + opRebootInstances = &aws.Operation{ + Name: "RebootInstances", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &RebootInstancesInput{} + } + + req = c.newRequest(opRebootInstances, input, output) + output = &RebootInstancesOutput{} + req.Data = output + return +} + +// Requests a reboot of one or more instances. This operation is asynchronous; +// it only queues a request to reboot the specified instances. The operation +// succeeds if the instances are valid and belong to you. Requests to reboot +// terminated instances are ignored. +// +// If a Linux/Unix instance does not cleanly shut down within four minutes, +// Amazon EC2 performs a hard reboot. +// +// For more information about troubleshooting, see Getting Console Output and +// Rebooting Instances (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-console.html) +// in the Amazon Elastic Compute Cloud User Guide. +func (c *EC2) RebootInstances(input *RebootInstancesInput) (output *RebootInstancesOutput, err error) { + req, out := c.RebootInstancesRequest(input) + output = out + err = req.Send() + return +} + +var opRebootInstances *aws.Operation + +// RegisterImageRequest generates a request for the RegisterImage operation. +func (c *EC2) RegisterImageRequest(input *RegisterImageInput) (req *aws.Request, output *RegisterImageOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opRegisterImage == nil { + opRegisterImage = &aws.Operation{ + Name: "RegisterImage", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &RegisterImageInput{} + } + + req = c.newRequest(opRegisterImage, input, output) + output = &RegisterImageOutput{} + req.Data = output + return +} + +// Registers an AMI. When you're creating an AMI, this is the final step you +// must complete before you can launch an instance from the AMI. For more information +// about creating AMIs, see Creating Your Own AMIs (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/creating-an-ami.html) +// in the Amazon Elastic Compute Cloud User Guide. +// +// For Amazon EBS-backed instances, CreateImage creates and registers the AMI +// in a single request, so you don't have to register the AMI yourself. +// +// You can also use RegisterImage to create an Amazon EBS-backed AMI from a +// snapshot of a root device volume. For more information, see Launching an +// Instance from a Snapshot (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Using_LaunchingInstanceFromSnapshot.html) +// in the Amazon Elastic Compute Cloud User Guide. +// +// If needed, you can deregister an AMI at any time. Any modifications you +// make to an AMI backed by an instance store volume invalidates its registration. +// If you make changes to an image, deregister the previous image and register +// the new image. +// +// You can't register an image where a secondary (non-root) snapshot has AWS +// Marketplace product codes. +func (c *EC2) RegisterImage(input *RegisterImageInput) (output *RegisterImageOutput, err error) { + req, out := c.RegisterImageRequest(input) + output = out + err = req.Send() + return +} + +var opRegisterImage *aws.Operation + +// RejectVPCPeeringConnectionRequest generates a request for the RejectVPCPeeringConnection operation. +func (c *EC2) RejectVPCPeeringConnectionRequest(input *RejectVPCPeeringConnectionInput) (req *aws.Request, output *RejectVPCPeeringConnectionOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opRejectVPCPeeringConnection == nil { + opRejectVPCPeeringConnection = &aws.Operation{ + Name: "RejectVpcPeeringConnection", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &RejectVPCPeeringConnectionInput{} + } + + req = c.newRequest(opRejectVPCPeeringConnection, input, output) + output = &RejectVPCPeeringConnectionOutput{} + req.Data = output + return +} + +// Rejects a VPC peering connection request. The VPC peering connection must +// be in the pending-acceptance state. Use the DescribeVpcPeeringConnections +// request to view your outstanding VPC peering connection requests. To delete +// an active VPC peering connection, or to delete a VPC peering connection request +// that you initiated, use DeleteVpcPeeringConnection. +func (c *EC2) RejectVPCPeeringConnection(input *RejectVPCPeeringConnectionInput) (output *RejectVPCPeeringConnectionOutput, err error) { + req, out := c.RejectVPCPeeringConnectionRequest(input) + output = out + err = req.Send() + return +} + +var opRejectVPCPeeringConnection *aws.Operation + +// ReleaseAddressRequest generates a request for the ReleaseAddress operation. +func (c *EC2) ReleaseAddressRequest(input *ReleaseAddressInput) (req *aws.Request, output *ReleaseAddressOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opReleaseAddress == nil { + opReleaseAddress = &aws.Operation{ + Name: "ReleaseAddress", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &ReleaseAddressInput{} + } + + req = c.newRequest(opReleaseAddress, input, output) + output = &ReleaseAddressOutput{} + req.Data = output + return +} + +// Releases the specified Elastic IP address. +// +// After releasing an Elastic IP address, it is released to the IP address +// pool and might be unavailable to you. Be sure to update your DNS records +// and any servers or devices that communicate with the address. If you attempt +// to release an Elastic IP address that you already released, you'll get an +// AuthFailure error if the address is already allocated to another AWS account. +// +// [EC2-Classic, default VPC] Releasing an Elastic IP address automatically +// disassociates it from any instance that it's associated with. To disassociate +// an Elastic IP address without releasing it, use DisassociateAddress. +// +// [Nondefault VPC] You must use DisassociateAddress to disassociate the Elastic +// IP address before you try to release it. Otherwise, Amazon EC2 returns an +// error (InvalidIPAddress.InUse). +func (c *EC2) ReleaseAddress(input *ReleaseAddressInput) (output *ReleaseAddressOutput, err error) { + req, out := c.ReleaseAddressRequest(input) + output = out + err = req.Send() + return +} + +var opReleaseAddress *aws.Operation + +// ReplaceNetworkACLAssociationRequest generates a request for the ReplaceNetworkACLAssociation operation. +func (c *EC2) ReplaceNetworkACLAssociationRequest(input *ReplaceNetworkACLAssociationInput) (req *aws.Request, output *ReplaceNetworkACLAssociationOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opReplaceNetworkACLAssociation == nil { + opReplaceNetworkACLAssociation = &aws.Operation{ + Name: "ReplaceNetworkAclAssociation", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &ReplaceNetworkACLAssociationInput{} + } + + req = c.newRequest(opReplaceNetworkACLAssociation, input, output) + output = &ReplaceNetworkACLAssociationOutput{} + req.Data = output + return +} + +// Changes which network ACL a subnet is associated with. By default when you +// create a subnet, it's automatically associated with the default network ACL. +// For more information about network ACLs, see Network ACLs (http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_ACLs.html) +// in the Amazon Virtual Private Cloud User Guide. +func (c *EC2) ReplaceNetworkACLAssociation(input *ReplaceNetworkACLAssociationInput) (output *ReplaceNetworkACLAssociationOutput, err error) { + req, out := c.ReplaceNetworkACLAssociationRequest(input) + output = out + err = req.Send() + return +} + +var opReplaceNetworkACLAssociation *aws.Operation + +// ReplaceNetworkACLEntryRequest generates a request for the ReplaceNetworkACLEntry operation. +func (c *EC2) ReplaceNetworkACLEntryRequest(input *ReplaceNetworkACLEntryInput) (req *aws.Request, output *ReplaceNetworkACLEntryOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opReplaceNetworkACLEntry == nil { + opReplaceNetworkACLEntry = &aws.Operation{ + Name: "ReplaceNetworkAclEntry", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &ReplaceNetworkACLEntryInput{} + } + + req = c.newRequest(opReplaceNetworkACLEntry, input, output) + output = &ReplaceNetworkACLEntryOutput{} + req.Data = output + return +} + +// Replaces an entry (rule) in a network ACL. For more information about network +// ACLs, see Network ACLs (http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_ACLs.html) +// in the Amazon Virtual Private Cloud User Guide. +func (c *EC2) ReplaceNetworkACLEntry(input *ReplaceNetworkACLEntryInput) (output *ReplaceNetworkACLEntryOutput, err error) { + req, out := c.ReplaceNetworkACLEntryRequest(input) + output = out + err = req.Send() + return +} + +var opReplaceNetworkACLEntry *aws.Operation + +// ReplaceRouteRequest generates a request for the ReplaceRoute operation. +func (c *EC2) ReplaceRouteRequest(input *ReplaceRouteInput) (req *aws.Request, output *ReplaceRouteOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opReplaceRoute == nil { + opReplaceRoute = &aws.Operation{ + Name: "ReplaceRoute", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &ReplaceRouteInput{} + } + + req = c.newRequest(opReplaceRoute, input, output) + output = &ReplaceRouteOutput{} + req.Data = output + return +} + +// Replaces an existing route within a route table in a VPC. You must provide +// only one of the following: Internet gateway or virtual private gateway, NAT +// instance, VPC peering connection, or network interface. +// +// For more information about route tables, see Route Tables (http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_Route_Tables.html) +// in the Amazon Virtual Private Cloud User Guide. +func (c *EC2) ReplaceRoute(input *ReplaceRouteInput) (output *ReplaceRouteOutput, err error) { + req, out := c.ReplaceRouteRequest(input) + output = out + err = req.Send() + return +} + +var opReplaceRoute *aws.Operation + +// ReplaceRouteTableAssociationRequest generates a request for the ReplaceRouteTableAssociation operation. +func (c *EC2) ReplaceRouteTableAssociationRequest(input *ReplaceRouteTableAssociationInput) (req *aws.Request, output *ReplaceRouteTableAssociationOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opReplaceRouteTableAssociation == nil { + opReplaceRouteTableAssociation = &aws.Operation{ + Name: "ReplaceRouteTableAssociation", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &ReplaceRouteTableAssociationInput{} + } + + req = c.newRequest(opReplaceRouteTableAssociation, input, output) + output = &ReplaceRouteTableAssociationOutput{} + req.Data = output + return +} + +// Changes the route table associated with a given subnet in a VPC. After the +// operation completes, the subnet uses the routes in the new route table it's +// associated with. For more information about route tables, see Route Tables +// (http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_Route_Tables.html) +// in the Amazon Virtual Private Cloud User Guide. +// +// You can also use ReplaceRouteTableAssociation to change which table is the +// main route table in the VPC. You just specify the main route table's association +// ID and the route table to be the new main route table. +func (c *EC2) ReplaceRouteTableAssociation(input *ReplaceRouteTableAssociationInput) (output *ReplaceRouteTableAssociationOutput, err error) { + req, out := c.ReplaceRouteTableAssociationRequest(input) + output = out + err = req.Send() + return +} + +var opReplaceRouteTableAssociation *aws.Operation + +// ReportInstanceStatusRequest generates a request for the ReportInstanceStatus operation. +func (c *EC2) ReportInstanceStatusRequest(input *ReportInstanceStatusInput) (req *aws.Request, output *ReportInstanceStatusOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opReportInstanceStatus == nil { + opReportInstanceStatus = &aws.Operation{ + Name: "ReportInstanceStatus", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &ReportInstanceStatusInput{} + } + + req = c.newRequest(opReportInstanceStatus, input, output) + output = &ReportInstanceStatusOutput{} + req.Data = output + return +} + +// Submits feedback about the status of an instance. The instance must be in +// the running state. If your experience with the instance differs from the +// instance status returned by DescribeInstanceStatus, use ReportInstanceStatus +// to report your experience with the instance. Amazon EC2 collects this information +// to improve the accuracy of status checks. +// +// Use of this action does not change the value returned by DescribeInstanceStatus. +func (c *EC2) ReportInstanceStatus(input *ReportInstanceStatusInput) (output *ReportInstanceStatusOutput, err error) { + req, out := c.ReportInstanceStatusRequest(input) + output = out + err = req.Send() + return +} + +var opReportInstanceStatus *aws.Operation + +// RequestSpotInstancesRequest generates a request for the RequestSpotInstances operation. +func (c *EC2) RequestSpotInstancesRequest(input *RequestSpotInstancesInput) (req *aws.Request, output *RequestSpotInstancesOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opRequestSpotInstances == nil { + opRequestSpotInstances = &aws.Operation{ + Name: "RequestSpotInstances", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &RequestSpotInstancesInput{} + } + + req = c.newRequest(opRequestSpotInstances, input, output) + output = &RequestSpotInstancesOutput{} + req.Data = output + return +} + +// Creates a Spot Instance request. Spot Instances are instances that Amazon +// EC2 launches when the bid price that you specify exceeds the current Spot +// Price. Amazon EC2 periodically sets the Spot Price based on available Spot +// Instance capacity and current Spot Instance requests. For more information, +// see Spot Instance Requests (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/spot-requests.html) +// in the Amazon Elastic Compute Cloud User Guide. +func (c *EC2) RequestSpotInstances(input *RequestSpotInstancesInput) (output *RequestSpotInstancesOutput, err error) { + req, out := c.RequestSpotInstancesRequest(input) + output = out + err = req.Send() + return +} + +var opRequestSpotInstances *aws.Operation + +// ResetImageAttributeRequest generates a request for the ResetImageAttribute operation. +func (c *EC2) ResetImageAttributeRequest(input *ResetImageAttributeInput) (req *aws.Request, output *ResetImageAttributeOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opResetImageAttribute == nil { + opResetImageAttribute = &aws.Operation{ + Name: "ResetImageAttribute", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &ResetImageAttributeInput{} + } + + req = c.newRequest(opResetImageAttribute, input, output) + output = &ResetImageAttributeOutput{} + req.Data = output + return +} + +// Resets an attribute of an AMI to its default value. +// +// The productCodes attribute can't be reset. +func (c *EC2) ResetImageAttribute(input *ResetImageAttributeInput) (output *ResetImageAttributeOutput, err error) { + req, out := c.ResetImageAttributeRequest(input) + output = out + err = req.Send() + return +} + +var opResetImageAttribute *aws.Operation + +// ResetInstanceAttributeRequest generates a request for the ResetInstanceAttribute operation. +func (c *EC2) ResetInstanceAttributeRequest(input *ResetInstanceAttributeInput) (req *aws.Request, output *ResetInstanceAttributeOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opResetInstanceAttribute == nil { + opResetInstanceAttribute = &aws.Operation{ + Name: "ResetInstanceAttribute", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &ResetInstanceAttributeInput{} + } + + req = c.newRequest(opResetInstanceAttribute, input, output) + output = &ResetInstanceAttributeOutput{} + req.Data = output + return +} + +// Resets an attribute of an instance to its default value. To reset the kernel +// or ramdisk, the instance must be in a stopped state. To reset the SourceDestCheck, +// the instance can be either running or stopped. +// +// The SourceDestCheck attribute controls whether source/destination checking +// is enabled. The default value is true, which means checking is enabled. This +// value must be false for a NAT instance to perform NAT. For more information, +// see NAT Instances (http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_NAT_Instance.html) +// in the Amazon Virtual Private Cloud User Guide. +func (c *EC2) ResetInstanceAttribute(input *ResetInstanceAttributeInput) (output *ResetInstanceAttributeOutput, err error) { + req, out := c.ResetInstanceAttributeRequest(input) + output = out + err = req.Send() + return +} + +var opResetInstanceAttribute *aws.Operation + +// ResetNetworkInterfaceAttributeRequest generates a request for the ResetNetworkInterfaceAttribute operation. +func (c *EC2) ResetNetworkInterfaceAttributeRequest(input *ResetNetworkInterfaceAttributeInput) (req *aws.Request, output *ResetNetworkInterfaceAttributeOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opResetNetworkInterfaceAttribute == nil { + opResetNetworkInterfaceAttribute = &aws.Operation{ + Name: "ResetNetworkInterfaceAttribute", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &ResetNetworkInterfaceAttributeInput{} + } + + req = c.newRequest(opResetNetworkInterfaceAttribute, input, output) + output = &ResetNetworkInterfaceAttributeOutput{} + req.Data = output + return +} + +// Resets a network interface attribute. You can specify only one attribute +// at a time. +func (c *EC2) ResetNetworkInterfaceAttribute(input *ResetNetworkInterfaceAttributeInput) (output *ResetNetworkInterfaceAttributeOutput, err error) { + req, out := c.ResetNetworkInterfaceAttributeRequest(input) + output = out + err = req.Send() + return +} + +var opResetNetworkInterfaceAttribute *aws.Operation + +// ResetSnapshotAttributeRequest generates a request for the ResetSnapshotAttribute operation. +func (c *EC2) ResetSnapshotAttributeRequest(input *ResetSnapshotAttributeInput) (req *aws.Request, output *ResetSnapshotAttributeOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opResetSnapshotAttribute == nil { + opResetSnapshotAttribute = &aws.Operation{ + Name: "ResetSnapshotAttribute", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &ResetSnapshotAttributeInput{} + } + + req = c.newRequest(opResetSnapshotAttribute, input, output) + output = &ResetSnapshotAttributeOutput{} + req.Data = output + return +} + +// Resets permission settings for the specified snapshot. +// +// For more information on modifying snapshot permissions, see Sharing Snapshots +// (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-modifying-snapshot-permissions.html) +// in the Amazon Elastic Compute Cloud User Guide. +func (c *EC2) ResetSnapshotAttribute(input *ResetSnapshotAttributeInput) (output *ResetSnapshotAttributeOutput, err error) { + req, out := c.ResetSnapshotAttributeRequest(input) + output = out + err = req.Send() + return +} + +var opResetSnapshotAttribute *aws.Operation + +// RevokeSecurityGroupEgressRequest generates a request for the RevokeSecurityGroupEgress operation. +func (c *EC2) RevokeSecurityGroupEgressRequest(input *RevokeSecurityGroupEgressInput) (req *aws.Request, output *RevokeSecurityGroupEgressOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opRevokeSecurityGroupEgress == nil { + opRevokeSecurityGroupEgress = &aws.Operation{ + Name: "RevokeSecurityGroupEgress", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &RevokeSecurityGroupEgressInput{} + } + + req = c.newRequest(opRevokeSecurityGroupEgress, input, output) + output = &RevokeSecurityGroupEgressOutput{} + req.Data = output + return +} + +// Removes one or more egress rules from a security group for EC2-VPC. The values +// that you specify in the revoke request (for example, ports) must match the +// existing rule's values for the rule to be revoked. +// +// Each rule consists of the protocol and the CIDR range or source security +// group. For the TCP and UDP protocols, you must also specify the destination +// port or range of ports. For the ICMP protocol, you must also specify the +// ICMP type and code. +// +// Rule changes are propagated to instances within the security group as quickly +// as possible. However, a small delay might occur. +func (c *EC2) RevokeSecurityGroupEgress(input *RevokeSecurityGroupEgressInput) (output *RevokeSecurityGroupEgressOutput, err error) { + req, out := c.RevokeSecurityGroupEgressRequest(input) + output = out + err = req.Send() + return +} + +var opRevokeSecurityGroupEgress *aws.Operation + +// RevokeSecurityGroupIngressRequest generates a request for the RevokeSecurityGroupIngress operation. +func (c *EC2) RevokeSecurityGroupIngressRequest(input *RevokeSecurityGroupIngressInput) (req *aws.Request, output *RevokeSecurityGroupIngressOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opRevokeSecurityGroupIngress == nil { + opRevokeSecurityGroupIngress = &aws.Operation{ + Name: "RevokeSecurityGroupIngress", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &RevokeSecurityGroupIngressInput{} + } + + req = c.newRequest(opRevokeSecurityGroupIngress, input, output) + output = &RevokeSecurityGroupIngressOutput{} + req.Data = output + return +} + +// Removes one or more ingress rules from a security group. The values that +// you specify in the revoke request (for example, ports) must match the existing +// rule's values for the rule to be removed. +// +// Each rule consists of the protocol and the CIDR range or source security +// group. For the TCP and UDP protocols, you must also specify the destination +// port or range of ports. For the ICMP protocol, you must also specify the +// ICMP type and code. +// +// Rule changes are propagated to instances within the security group as quickly +// as possible. However, a small delay might occur. +func (c *EC2) RevokeSecurityGroupIngress(input *RevokeSecurityGroupIngressInput) (output *RevokeSecurityGroupIngressOutput, err error) { + req, out := c.RevokeSecurityGroupIngressRequest(input) + output = out + err = req.Send() + return +} + +var opRevokeSecurityGroupIngress *aws.Operation + +// RunInstancesRequest generates a request for the RunInstances operation. +func (c *EC2) RunInstancesRequest(input *RunInstancesInput) (req *aws.Request, output *Reservation) { + oprw.Lock() + defer oprw.Unlock() + + if opRunInstances == nil { + opRunInstances = &aws.Operation{ + Name: "RunInstances", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &RunInstancesInput{} + } + + req = c.newRequest(opRunInstances, input, output) + output = &Reservation{} + req.Data = output + return +} + +// Launches the specified number of instances using an AMI for which you have +// permissions. +// +// When you launch an instance, it enters the pending state. After the instance +// is ready for you, it enters the running state. To check the state of your +// instance, call DescribeInstances. +// +// 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) +// in the Amazon Elastic Compute Cloud User Guide. +// +// Linux instances have access to the public key of the key pair at boot. You +// can use this key to provide secure access to the instance. Amazon EC2 public +// images use this feature to provide secure access without passwords. For more +// information, see Key Pairs (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-key-pairs.html) +// in the Amazon Elastic Compute Cloud User Guide. +// +// You can provide optional user data when launching an instance. For more +// information, see Instance Metadata (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/AESDG-chapter-instancedata.html) +// in the Amazon Elastic Compute Cloud User Guide. +// +// 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. +// +// 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), +// and Troubleshooting Connecting to Your Instance (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/TroubleshootingInstancesConnecting.html) +// in the Amazon Elastic Compute Cloud User Guide. +func (c *EC2) RunInstances(input *RunInstancesInput) (output *Reservation, err error) { + req, out := c.RunInstancesRequest(input) + output = out + err = req.Send() + return +} + +var opRunInstances *aws.Operation + +// StartInstancesRequest generates a request for the StartInstances operation. +func (c *EC2) StartInstancesRequest(input *StartInstancesInput) (req *aws.Request, output *StartInstancesOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opStartInstances == nil { + opStartInstances = &aws.Operation{ + Name: "StartInstances", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &StartInstancesInput{} + } + + req = c.newRequest(opStartInstances, input, output) + output = &StartInstancesOutput{} + req.Data = output + return +} + +// Starts an Amazon EBS-backed AMI that you've previously stopped. +// +// Instances that use Amazon EBS volumes as their root devices can be quickly +// stopped and started. When an instance is stopped, the compute resources are +// released and you are not billed for hourly instance usage. However, your +// root partition Amazon EBS volume remains, continues to persist your data, +// and you are charged for Amazon EBS volume usage. You can restart your instance +// at any time. Each time you transition an instance from stopped to started, +// Amazon EC2 charges a full instance hour, even if transitions happen multiple +// times within a single hour. +// +// Before stopping an instance, make sure it is in a state from which it can +// be restarted. Stopping an instance does not preserve data stored in RAM. +// +// Performing this operation on an instance that uses an instance store as +// its root device returns an error. +// +// For more information, see Stopping Instances (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Stop_Start.html) +// in the Amazon Elastic Compute Cloud User Guide. +func (c *EC2) StartInstances(input *StartInstancesInput) (output *StartInstancesOutput, err error) { + req, out := c.StartInstancesRequest(input) + output = out + err = req.Send() + return +} + +var opStartInstances *aws.Operation + +// StopInstancesRequest generates a request for the StopInstances operation. +func (c *EC2) StopInstancesRequest(input *StopInstancesInput) (req *aws.Request, output *StopInstancesOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opStopInstances == nil { + opStopInstances = &aws.Operation{ + Name: "StopInstances", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &StopInstancesInput{} + } + + req = c.newRequest(opStopInstances, input, output) + output = &StopInstancesOutput{} + req.Data = output + return +} + +// Stops an Amazon EBS-backed instance. Each time you transition an instance +// from stopped to started, Amazon EC2 charges a full instance hour, even if +// transitions happen multiple times within a single hour. +// +// You can't start or stop Spot Instances. +// +// Instances that use Amazon EBS volumes as their root devices can be quickly +// stopped and started. When an instance is stopped, the compute resources are +// released and you are not billed for hourly instance usage. However, your +// root partition Amazon EBS volume remains, continues to persist your data, +// and you are charged for Amazon EBS volume usage. You can restart your instance +// at any time. +// +// Before stopping an instance, make sure it is in a state from which it can +// be restarted. Stopping an instance does not preserve data stored in RAM. +// +// Performing this operation on an instance that uses an instance store as +// its root device returns an error. +// +// You can stop, start, and terminate EBS-backed instances. You can only terminate +// instance store-backed instances. What happens to an instance differs if you +// stop it or terminate it. For example, when you stop an instance, the root +// device and any other devices attached to the instance persist. When you terminate +// an instance, the root device and any other devices attached during the instance +// launch are automatically deleted. For more information about the differences +// between stopping and terminating instances, see Instance Lifecycle (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-lifecycle.html) +// in the Amazon Elastic Compute Cloud User Guide. +// +// For more information about troubleshooting, see Troubleshooting Stopping +// Your Instance (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/TroubleshootingInstancesStopping.html) +// in the Amazon Elastic Compute Cloud User Guide. +func (c *EC2) StopInstances(input *StopInstancesInput) (output *StopInstancesOutput, err error) { + req, out := c.StopInstancesRequest(input) + output = out + err = req.Send() + return +} + +var opStopInstances *aws.Operation + +// TerminateInstancesRequest generates a request for the TerminateInstances operation. +func (c *EC2) TerminateInstancesRequest(input *TerminateInstancesInput) (req *aws.Request, output *TerminateInstancesOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opTerminateInstances == nil { + opTerminateInstances = &aws.Operation{ + Name: "TerminateInstances", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &TerminateInstancesInput{} + } + + req = c.newRequest(opTerminateInstances, input, output) + output = &TerminateInstancesOutput{} + req.Data = output + return +} + +// Shuts down one or more instances. This operation is idempotent; if you terminate +// an instance more than once, each call succeeds. +// +// Terminated instances remain visible after termination (for approximately +// one hour). +// +// By default, Amazon EC2 deletes all Amazon EBS volumes that were attached +// when the instance launched. Volumes attached after instance launch continue +// running. +// +// You can stop, start, and terminate EBS-backed instances. You can only terminate +// instance store-backed instances. What happens to an instance differs if you +// stop it or terminate it. For example, when you stop an instance, the root +// device and any other devices attached to the instance persist. When you terminate +// an instance, the root device and any other devices attached during the instance +// launch are automatically deleted. For more information about the differences +// between stopping and terminating instances, see Instance Lifecycle (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-lifecycle.html) +// in the Amazon Elastic Compute Cloud User Guide. +// +// For more information about troubleshooting, see Troubleshooting Terminating +// Your Instance (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/TroubleshootingInstancesShuttingDown.html) +// in the Amazon Elastic Compute Cloud User Guide. +func (c *EC2) TerminateInstances(input *TerminateInstancesInput) (output *TerminateInstancesOutput, err error) { + req, out := c.TerminateInstancesRequest(input) + output = out + err = req.Send() + return +} + +var opTerminateInstances *aws.Operation + +// UnassignPrivateIPAddressesRequest generates a request for the UnassignPrivateIPAddresses operation. +func (c *EC2) UnassignPrivateIPAddressesRequest(input *UnassignPrivateIPAddressesInput) (req *aws.Request, output *UnassignPrivateIPAddressesOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opUnassignPrivateIPAddresses == nil { + opUnassignPrivateIPAddresses = &aws.Operation{ + Name: "UnassignPrivateIpAddresses", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &UnassignPrivateIPAddressesInput{} + } + + req = c.newRequest(opUnassignPrivateIPAddresses, input, output) + output = &UnassignPrivateIPAddressesOutput{} + req.Data = output + return +} + +// Unassigns one or more secondary private IP addresses from a network interface. +func (c *EC2) UnassignPrivateIPAddresses(input *UnassignPrivateIPAddressesInput) (output *UnassignPrivateIPAddressesOutput, err error) { + req, out := c.UnassignPrivateIPAddressesRequest(input) + output = out + err = req.Send() + return +} + +var opUnassignPrivateIPAddresses *aws.Operation + +// UnmonitorInstancesRequest generates a request for the UnmonitorInstances operation. +func (c *EC2) UnmonitorInstancesRequest(input *UnmonitorInstancesInput) (req *aws.Request, output *UnmonitorInstancesOutput) { + oprw.Lock() + defer oprw.Unlock() + + if opUnmonitorInstances == nil { + opUnmonitorInstances = &aws.Operation{ + Name: "UnmonitorInstances", + HTTPMethod: "POST", + HTTPPath: "/", + } + } + + if input == nil { + input = &UnmonitorInstancesInput{} + } + + req = c.newRequest(opUnmonitorInstances, input, output) + output = &UnmonitorInstancesOutput{} + req.Data = output + return +} + +// Disables monitoring for a running instance. For more information about monitoring +// instances, see Monitoring Your Instances and Volumes (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-cloudwatch.html) +// in the Amazon Elastic Compute Cloud User Guide. +func (c *EC2) UnmonitorInstances(input *UnmonitorInstancesInput) (output *UnmonitorInstancesOutput, err error) { + req, out := c.UnmonitorInstancesRequest(input) + output = out + err = req.Send() + return +} + +var opUnmonitorInstances *aws.Operation + +type AcceptVPCPeeringConnectionInput struct { + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // The ID of the VPC peering connection. + VPCPeeringConnectionID *string `locationName:"vpcPeeringConnectionId" type:"string"` + + metadataAcceptVPCPeeringConnectionInput `json:"-" xml:"-"` +} + +type metadataAcceptVPCPeeringConnectionInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type AcceptVPCPeeringConnectionOutput struct { + // Information about the VPC peering connection. + VPCPeeringConnection *VPCPeeringConnection `locationName:"vpcPeeringConnection" type:"structure"` + + metadataAcceptVPCPeeringConnectionOutput `json:"-" xml:"-"` +} + +type metadataAcceptVPCPeeringConnectionOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +// Describes an account attribute. +type AccountAttribute struct { + // The name of the account attribute. + AttributeName *string `locationName:"attributeName" type:"string"` + + // One or more values for the account attribute. + AttributeValues []*AccountAttributeValue `locationName:"attributeValueSet" locationNameList:"item" type:"list"` + + metadataAccountAttribute `json:"-" xml:"-"` +} + +type metadataAccountAttribute struct { + SDKShapeTraits bool `type:"structure"` +} + +// Describes a value of an account attribute. +type AccountAttributeValue struct { + // The value of the attribute. + AttributeValue *string `locationName:"attributeValue" type:"string"` + + metadataAccountAttributeValue `json:"-" xml:"-"` +} + +type metadataAccountAttributeValue struct { + SDKShapeTraits bool `type:"structure"` +} + +// Describes an Elastic IP address. +type Address struct { + // The ID representing the allocation of the address for use with EC2-VPC. + AllocationID *string `locationName:"allocationId" type:"string"` + + // The ID representing the association of the address with an instance in a + // VPC. + AssociationID *string `locationName:"associationId" type:"string"` + + // Indicates whether this Elastic IP address is for use with instances in EC2-Classic + // (standard) or instances in a VPC (vpc). + Domain *string `locationName:"domain" type:"string"` + + // The ID of the instance the address is associated with (if any). + InstanceID *string `locationName:"instanceId" type:"string"` + + // The ID of the network interface. + NetworkInterfaceID *string `locationName:"networkInterfaceId" type:"string"` + + // The ID of the AWS account that owns the network interface. + NetworkInterfaceOwnerID *string `locationName:"networkInterfaceOwnerId" type:"string"` + + // The private IP address associated with the Elastic IP address. + PrivateIPAddress *string `locationName:"privateIpAddress" type:"string"` + + // The Elastic IP address. + PublicIP *string `locationName:"publicIp" type:"string"` + + metadataAddress `json:"-" xml:"-"` +} + +type metadataAddress struct { + SDKShapeTraits bool `type:"structure"` +} + +type AllocateAddressInput struct { + // Set to vpc to allocate the address for use with instances in a VPC. + // + // Default: The address is for use with instances in EC2-Classic. + Domain *string `type:"string"` + + DryRun *bool `locationName:"dryRun" type:"boolean"` + + metadataAllocateAddressInput `json:"-" xml:"-"` +} + +type metadataAllocateAddressInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type AllocateAddressOutput struct { + // [EC2-VPC] The ID that AWS assigns to represent the allocation of the Elastic + // IP address for use with instances in a VPC. + AllocationID *string `locationName:"allocationId" type:"string"` + + // Indicates whether this Elastic IP address is for use with instances in EC2-Classic + // (standard) or instances in a VPC (vpc). + Domain *string `locationName:"domain" type:"string"` + + // The Elastic IP address. + PublicIP *string `locationName:"publicIp" type:"string"` + + metadataAllocateAddressOutput `json:"-" xml:"-"` +} + +type metadataAllocateAddressOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +type AssignPrivateIPAddressesInput struct { + // Indicates whether to allow an IP address that is already assigned to another + // network interface or instance to be reassigned to the specified network interface. + AllowReassignment *bool `locationName:"allowReassignment" type:"boolean"` + + // The ID of the network interface. + NetworkInterfaceID *string `locationName:"networkInterfaceId" type:"string" required:"true"` + + // One or more IP addresses to be assigned as a secondary private IP address + // to the network interface. You can't specify this parameter when also specifying + // a number of secondary IP addresses. + // + // If you don't specify an IP address, Amazon EC2 automatically selects an + // IP address within the subnet range. + PrivateIPAddresses []*string `locationName:"privateIpAddress" locationNameList:"PrivateIpAddress" type:"list"` + + // The number of secondary IP addresses to assign to the network interface. + // You can't specify this parameter when also specifying private IP addresses. + SecondaryPrivateIPAddressCount *int64 `locationName:"secondaryPrivateIpAddressCount" type:"integer"` + + metadataAssignPrivateIPAddressesInput `json:"-" xml:"-"` +} + +type metadataAssignPrivateIPAddressesInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type AssignPrivateIPAddressesOutput struct { + metadataAssignPrivateIPAddressesOutput `json:"-" xml:"-"` +} + +type metadataAssignPrivateIPAddressesOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +type AssociateAddressInput struct { + // [EC2-VPC] The allocation ID. This is required for EC2-VPC. + AllocationID *string `locationName:"AllocationId" type:"string"` + + // [EC2-VPC] Allows an Elastic IP address that is already associated with an + // instance or network interface to be re-associated with the specified instance + // or network interface. Otherwise, the operation fails. + // + // Default: false + AllowReassociation *bool `locationName:"allowReassociation" type:"boolean"` + + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // The ID of the instance. This is required for EC2-Classic. For EC2-VPC, you + // can specify either the instance ID or the network interface ID, but not both. + // The operation fails if you specify an instance ID unless exactly one network + // interface is attached. + InstanceID *string `locationName:"InstanceId" type:"string"` + + // [EC2-VPC] The ID of the network interface. If the instance has more than + // one network interface, you must specify a network interface ID. + NetworkInterfaceID *string `locationName:"networkInterfaceId" type:"string"` + + // [EC2-VPC] The primary or secondary private IP address to associate with the + // Elastic IP address. If no private IP address is specified, the Elastic IP + // address is associated with the primary private IP address. + PrivateIPAddress *string `locationName:"privateIpAddress" type:"string"` + + // The Elastic IP address. This is required for EC2-Classic. + PublicIP *string `locationName:"PublicIp" type:"string"` + + metadataAssociateAddressInput `json:"-" xml:"-"` +} + +type metadataAssociateAddressInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type AssociateAddressOutput struct { + // [EC2-VPC] The ID that represents the association of the Elastic IP address + // with an instance. + AssociationID *string `locationName:"associationId" type:"string"` + + metadataAssociateAddressOutput `json:"-" xml:"-"` +} + +type metadataAssociateAddressOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +type AssociateDHCPOptionsInput struct { + // The ID of the DHCP options set, or default to associate no DHCP options with + // the VPC. + DHCPOptionsID *string `locationName:"DhcpOptionsId" type:"string" required:"true"` + + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // The ID of the VPC. + VPCID *string `locationName:"VpcId" type:"string" required:"true"` + + metadataAssociateDHCPOptionsInput `json:"-" xml:"-"` +} + +type metadataAssociateDHCPOptionsInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type AssociateDHCPOptionsOutput struct { + metadataAssociateDHCPOptionsOutput `json:"-" xml:"-"` +} + +type metadataAssociateDHCPOptionsOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +type AssociateRouteTableInput struct { + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // The ID of the route table. + RouteTableID *string `locationName:"routeTableId" type:"string" required:"true"` + + // The ID of the subnet. + SubnetID *string `locationName:"subnetId" type:"string" required:"true"` + + metadataAssociateRouteTableInput `json:"-" xml:"-"` +} + +type metadataAssociateRouteTableInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type AssociateRouteTableOutput struct { + // The route table association ID (needed to disassociate the route table). + AssociationID *string `locationName:"associationId" type:"string"` + + metadataAssociateRouteTableOutput `json:"-" xml:"-"` +} + +type metadataAssociateRouteTableOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +type AttachClassicLinkVPCInput struct { + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // The ID of one or more of the VPC's security groups. You cannot specify security + // groups from a different VPC. + Groups []*string `locationName:"SecurityGroupId" locationNameList:"groupId" type:"list" required:"true"` + + // The ID of an EC2-Classic instance to link to the ClassicLink-enabled VPC. + InstanceID *string `locationName:"instanceId" type:"string" required:"true"` + + // The ID of a ClassicLink-enabled VPC. + VPCID *string `locationName:"vpcId" type:"string" required:"true"` + + metadataAttachClassicLinkVPCInput `json:"-" xml:"-"` +} + +type metadataAttachClassicLinkVPCInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type AttachClassicLinkVPCOutput struct { + // Returns true if the request succeeds; otherwise, it returns an error. + Return *bool `locationName:"return" type:"boolean"` + + metadataAttachClassicLinkVPCOutput `json:"-" xml:"-"` +} + +type metadataAttachClassicLinkVPCOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +type AttachInternetGatewayInput struct { + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // The ID of the Internet gateway. + InternetGatewayID *string `locationName:"internetGatewayId" type:"string" required:"true"` + + // The ID of the VPC. + VPCID *string `locationName:"vpcId" type:"string" required:"true"` + + metadataAttachInternetGatewayInput `json:"-" xml:"-"` +} + +type metadataAttachInternetGatewayInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type AttachInternetGatewayOutput struct { + metadataAttachInternetGatewayOutput `json:"-" xml:"-"` +} + +type metadataAttachInternetGatewayOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +type AttachNetworkInterfaceInput struct { + // The index of the device for the network interface attachment. + DeviceIndex *int64 `locationName:"deviceIndex" type:"integer" required:"true"` + + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // The ID of the instance. + InstanceID *string `locationName:"instanceId" type:"string" required:"true"` + + // The ID of the network interface. + NetworkInterfaceID *string `locationName:"networkInterfaceId" type:"string" required:"true"` + + metadataAttachNetworkInterfaceInput `json:"-" xml:"-"` +} + +type metadataAttachNetworkInterfaceInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type AttachNetworkInterfaceOutput struct { + // The ID of the network interface attachment. + AttachmentID *string `locationName:"attachmentId" type:"string"` + + metadataAttachNetworkInterfaceOutput `json:"-" xml:"-"` +} + +type metadataAttachNetworkInterfaceOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +type AttachVPNGatewayInput struct { + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // The ID of the VPC. + VPCID *string `locationName:"VpcId" type:"string" required:"true"` + + // The ID of the virtual private gateway. + VPNGatewayID *string `locationName:"VpnGatewayId" type:"string" required:"true"` + + metadataAttachVPNGatewayInput `json:"-" xml:"-"` +} + +type metadataAttachVPNGatewayInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type AttachVPNGatewayOutput struct { + // Information about the attachment. + VPCAttachment *VPCAttachment `locationName:"attachment" type:"structure"` + + metadataAttachVPNGatewayOutput `json:"-" xml:"-"` +} + +type metadataAttachVPNGatewayOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +type AttachVolumeInput struct { + // The device name to expose to the instance (for example, /dev/sdh or xvdh). + Device *string `type:"string" required:"true"` + + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // The ID of the instance. + InstanceID *string `locationName:"InstanceId" type:"string" required:"true"` + + // The ID of the Amazon EBS volume. The volume and instance must be within the + // same Availability Zone. + VolumeID *string `locationName:"VolumeId" type:"string" required:"true"` + + metadataAttachVolumeInput `json:"-" xml:"-"` +} + +type metadataAttachVolumeInput struct { + SDKShapeTraits bool `type:"structure"` +} + +// The value to use when a resource attribute accepts a Boolean value. +type AttributeBooleanValue struct { + // Valid values are true or false. + Value *bool `locationName:"value" type:"boolean"` + + metadataAttributeBooleanValue `json:"-" xml:"-"` +} + +type metadataAttributeBooleanValue struct { + SDKShapeTraits bool `type:"structure"` +} + +// The value to use for a resource attribute. +type AttributeValue struct { + // Valid values are case-sensitive and vary by action. + Value *string `locationName:"value" type:"string"` + + metadataAttributeValue `json:"-" xml:"-"` +} + +type metadataAttributeValue struct { + SDKShapeTraits bool `type:"structure"` +} + +type AuthorizeSecurityGroupEgressInput struct { + // The CIDR IP address range. You can't specify this parameter when specifying + // a source security group. + CIDRIP *string `locationName:"cidrIp" type:"string"` + + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // The start of port range for the TCP and UDP protocols, or an ICMP type number. + // For the ICMP type number, use -1 to specify all ICMP types. + FromPort *int64 `locationName:"fromPort" type:"integer"` + + // The ID of the security group. + GroupID *string `locationName:"groupId" type:"string" required:"true"` + + // A set of IP permissions. You can't specify a destination security group and + // a CIDR IP address range. + IPPermissions []*IPPermission `locationName:"ipPermissions" locationNameList:"item" type:"list"` + + // The IP protocol name (tcp, udp, icmp) or number (see Protocol Numbers (http://www.iana.org/assignments/protocol-numbers/protocol-numbers.xhtml)). + // Use -1 to specify all. + IPProtocol *string `locationName:"ipProtocol" type:"string"` + + // [EC2-Classic, default VPC] The name of the destination security group. You + // can't specify a destination security group and a CIDR IP address range. + SourceSecurityGroupName *string `locationName:"sourceSecurityGroupName" type:"string"` + + // The ID of the destination security group. You can't specify a destination + // security group and a CIDR IP address range. + SourceSecurityGroupOwnerID *string `locationName:"sourceSecurityGroupOwnerId" type:"string"` + + // The end of port range for the TCP and UDP protocols, or an ICMP code number. + // For the ICMP code number, use -1 to specify all ICMP codes for the ICMP type. + ToPort *int64 `locationName:"toPort" type:"integer"` + + metadataAuthorizeSecurityGroupEgressInput `json:"-" xml:"-"` +} + +type metadataAuthorizeSecurityGroupEgressInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type AuthorizeSecurityGroupEgressOutput struct { + metadataAuthorizeSecurityGroupEgressOutput `json:"-" xml:"-"` +} + +type metadataAuthorizeSecurityGroupEgressOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +type AuthorizeSecurityGroupIngressInput struct { + // The CIDR IP address range. You can't specify this parameter when specifying + // a source security group. + CIDRIP *string `locationName:"CidrIp" type:"string"` + + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // The start of port range for the TCP and UDP protocols, or an ICMP type number. + // For the ICMP type number, use -1 to specify all ICMP types. + FromPort *int64 `type:"integer"` + + // The ID of the security group. Required for a nondefault VPC. + GroupID *string `locationName:"GroupId" type:"string"` + + // [EC2-Classic, default VPC] The name of the security group. + GroupName *string `type:"string"` + + // A set of IP permissions. Can be used to specify multiple rules in a single + // command. + IPPermissions []*IPPermission `locationName:"IpPermissions" locationNameList:"item" type:"list"` + + // The IP protocol name (tcp, udp, icmp) or number (see Protocol Numbers (http://www.iana.org/assignments/protocol-numbers/protocol-numbers.xhtml)). + // (VPC only) Use -1 to specify all. + IPProtocol *string `locationName:"IpProtocol" type:"string"` + + // [EC2-Classic, default VPC] The name of the source security group. You can't + // specify a source security group and a CIDR IP address range. + SourceSecurityGroupName *string `type:"string"` + + // The ID of the source security group. You can't specify a source security + // group and a CIDR IP address range. + SourceSecurityGroupOwnerID *string `locationName:"SourceSecurityGroupOwnerId" type:"string"` + + // The end of port range for the TCP and UDP protocols, or an ICMP code number. + // For the ICMP code number, use -1 to specify all ICMP codes for the ICMP type. + ToPort *int64 `type:"integer"` + + metadataAuthorizeSecurityGroupIngressInput `json:"-" xml:"-"` +} + +type metadataAuthorizeSecurityGroupIngressInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type AuthorizeSecurityGroupIngressOutput struct { + metadataAuthorizeSecurityGroupIngressOutput `json:"-" xml:"-"` +} + +type metadataAuthorizeSecurityGroupIngressOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +// Describes an Availability Zone. +type AvailabilityZone struct { + // Any messages about the Availability Zone. + Messages []*AvailabilityZoneMessage `locationName:"messageSet" locationNameList:"item" type:"list"` + + // The name of the region. + RegionName *string `locationName:"regionName" type:"string"` + + // The state of the Availability Zone (available | impaired | unavailable). + State *string `locationName:"zoneState" type:"string"` + + // The name of the Availability Zone. + ZoneName *string `locationName:"zoneName" type:"string"` + + metadataAvailabilityZone `json:"-" xml:"-"` +} + +type metadataAvailabilityZone struct { + SDKShapeTraits bool `type:"structure"` +} + +// Describes a message about an Availability Zone. +type AvailabilityZoneMessage struct { + // The message about the Availability Zone. + Message *string `locationName:"message" type:"string"` + + metadataAvailabilityZoneMessage `json:"-" xml:"-"` +} + +type metadataAvailabilityZoneMessage struct { + SDKShapeTraits bool `type:"structure"` +} + +type BlobAttributeValue struct { + Value []byte `locationName:"value" type:"blob"` + + metadataBlobAttributeValue `json:"-" xml:"-"` +} + +type metadataBlobAttributeValue struct { + SDKShapeTraits bool `type:"structure"` +} + +// Describes a block device mapping. +type BlockDeviceMapping struct { + // The device name exposed to the instance (for example, /dev/sdh or xvdh). + DeviceName *string `locationName:"deviceName" type:"string"` + + // Parameters used to automatically set up Amazon EBS volumes when the instance + // is launched. + EBS *EBSBlockDevice `locationName:"ebs" type:"structure"` + + // Suppresses the specified device included in the block device mapping of the + // AMI. + NoDevice *string `locationName:"noDevice" type:"string"` + + // The virtual device name (ephemeralN). Instance store volumes are numbered + // starting from 0. An instance type with 2 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 `locationName:"virtualName" type:"string"` + + metadataBlockDeviceMapping `json:"-" xml:"-"` +} + +type metadataBlockDeviceMapping struct { + SDKShapeTraits bool `type:"structure"` +} + +type BundleInstanceInput struct { + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // The ID of the instance to bundle. + // + // Type: String + // + // Default: None + // + // Required: Yes + InstanceID *string `locationName:"InstanceId" type:"string" required:"true"` + + // The bucket in which to store the AMI. You can specify a bucket that you already + // own or a new bucket that Amazon EC2 creates on your behalf. If you specify + // a bucket that belongs to someone else, Amazon EC2 returns an error. + Storage *Storage `type:"structure" required:"true"` + + metadataBundleInstanceInput `json:"-" xml:"-"` +} + +type metadataBundleInstanceInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type BundleInstanceOutput struct { + // Information about the bundle task. + BundleTask *BundleTask `locationName:"bundleInstanceTask" type:"structure"` + + metadataBundleInstanceOutput `json:"-" xml:"-"` +} + +type metadataBundleInstanceOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +// Describes a bundle task. +type BundleTask struct { + // The ID of the bundle task. + BundleID *string `locationName:"bundleId" type:"string"` + + // If the task fails, a description of the error. + BundleTaskError *BundleTaskError `locationName:"error" type:"structure"` + + // The ID of the instance associated with this bundle task. + InstanceID *string `locationName:"instanceId" type:"string"` + + // The level of task completion, as a percent (for example, 20%). + Progress *string `locationName:"progress" type:"string"` + + // The time this task started. + StartTime *time.Time `locationName:"startTime" type:"timestamp" timestampFormat:"iso8601"` + + // The state of the task. + State *string `locationName:"state" type:"string"` + + // The Amazon S3 storage locations. + Storage *Storage `locationName:"storage" type:"structure"` + + // The time of the most recent update for the task. + UpdateTime *time.Time `locationName:"updateTime" type:"timestamp" timestampFormat:"iso8601"` + + metadataBundleTask `json:"-" xml:"-"` +} + +type metadataBundleTask struct { + SDKShapeTraits bool `type:"structure"` +} + +// Describes an error for BundleInstance. +type BundleTaskError struct { + // The error code. + Code *string `locationName:"code" type:"string"` + + // The error message. + Message *string `locationName:"message" type:"string"` + + metadataBundleTaskError `json:"-" xml:"-"` +} + +type metadataBundleTaskError struct { + SDKShapeTraits bool `type:"structure"` +} + +type CancelBundleTaskInput struct { + // The ID of the bundle task. + BundleID *string `locationName:"BundleId" type:"string" required:"true"` + + DryRun *bool `locationName:"dryRun" type:"boolean"` + + metadataCancelBundleTaskInput `json:"-" xml:"-"` +} + +type metadataCancelBundleTaskInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type CancelBundleTaskOutput struct { + // The bundle task. + BundleTask *BundleTask `locationName:"bundleInstanceTask" type:"structure"` + + metadataCancelBundleTaskOutput `json:"-" xml:"-"` +} + +type metadataCancelBundleTaskOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +type CancelConversionTaskInput struct { + // The ID of the conversion task. + ConversionTaskID *string `locationName:"conversionTaskId" type:"string" required:"true"` + + DryRun *bool `locationName:"dryRun" type:"boolean"` + + ReasonMessage *string `locationName:"reasonMessage" type:"string"` + + metadataCancelConversionTaskInput `json:"-" xml:"-"` +} + +type metadataCancelConversionTaskInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type CancelConversionTaskOutput struct { + metadataCancelConversionTaskOutput `json:"-" xml:"-"` +} + +type metadataCancelConversionTaskOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +type CancelExportTaskInput struct { + // The ID of the export task. This is the ID returned by CreateInstanceExportTask. + ExportTaskID *string `locationName:"exportTaskId" type:"string" required:"true"` + + metadataCancelExportTaskInput `json:"-" xml:"-"` +} + +type metadataCancelExportTaskInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type CancelExportTaskOutput struct { + metadataCancelExportTaskOutput `json:"-" xml:"-"` +} + +type metadataCancelExportTaskOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +type CancelImportTaskInput struct { + // The reason for canceling the task. + CancelReason *string `type:"string"` + + DryRun *bool `type:"boolean"` + + // The ID of the ImportImage or ImportSnapshot task to be cancelled. + ImportTaskID *string `locationName:"ImportTaskId" type:"string"` + + metadataCancelImportTaskInput `json:"-" xml:"-"` +} + +type metadataCancelImportTaskInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type CancelImportTaskOutput struct { + // The task ID of the ImportImage or ImportSnapshot task being canceled. + ImportTaskID *string `locationName:"importTaskId" type:"string"` + + // The current state of the ImportImage or ImportSnapshot task being canceled. + PreviousState *string `locationName:"previousState" type:"string"` + + // The current state of the ImportImage or ImportSnapshot task being canceled. + State *string `locationName:"state" type:"string"` + + metadataCancelImportTaskOutput `json:"-" xml:"-"` +} + +type metadataCancelImportTaskOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +type CancelReservedInstancesListingInput struct { + // The ID of the Reserved Instance listing. + ReservedInstancesListingID *string `locationName:"reservedInstancesListingId" type:"string" required:"true"` + + metadataCancelReservedInstancesListingInput `json:"-" xml:"-"` +} + +type metadataCancelReservedInstancesListingInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type CancelReservedInstancesListingOutput struct { + // The Reserved Instance listing. + ReservedInstancesListings []*ReservedInstancesListing `locationName:"reservedInstancesListingsSet" locationNameList:"item" type:"list"` + + metadataCancelReservedInstancesListingOutput `json:"-" xml:"-"` +} + +type metadataCancelReservedInstancesListingOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +type CancelSpotInstanceRequestsInput struct { + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // One or more Spot Instance request IDs. + SpotInstanceRequestIDs []*string `locationName:"SpotInstanceRequestId" locationNameList:"SpotInstanceRequestId" type:"list" required:"true"` + + metadataCancelSpotInstanceRequestsInput `json:"-" xml:"-"` +} + +type metadataCancelSpotInstanceRequestsInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type CancelSpotInstanceRequestsOutput struct { + // One or more Spot Instance requests. + CancelledSpotInstanceRequests []*CancelledSpotInstanceRequest `locationName:"spotInstanceRequestSet" locationNameList:"item" type:"list"` + + metadataCancelSpotInstanceRequestsOutput `json:"-" xml:"-"` +} + +type metadataCancelSpotInstanceRequestsOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +// Describes a request to cancel a Spot Instance. +type CancelledSpotInstanceRequest struct { + // The ID of the Spot Instance request. + SpotInstanceRequestID *string `locationName:"spotInstanceRequestId" type:"string"` + + // The state of the Spot Instance request. + State *string `locationName:"state" type:"string"` + + metadataCancelledSpotInstanceRequest `json:"-" xml:"-"` +} + +type metadataCancelledSpotInstanceRequest struct { + SDKShapeTraits bool `type:"structure"` +} + +// Describes a linked EC2-Classic instance. +type ClassicLinkInstance struct { + // A list of security groups. + Groups []*GroupIdentifier `locationName:"groupSet" locationNameList:"item" type:"list"` + + // The ID of the instance. + InstanceID *string `locationName:"instanceId" type:"string"` + + // Any tags assigned to the instance. + Tags []*Tag `locationName:"tagSet" locationNameList:"item" type:"list"` + + // The ID of the VPC. + VPCID *string `locationName:"vpcId" type:"string"` + + metadataClassicLinkInstance `json:"-" xml:"-"` +} + +type metadataClassicLinkInstance struct { + SDKShapeTraits bool `type:"structure"` +} + +// Client-specific data. +type ClientData struct { + // User-defined comment about the upload. + Comment *string `type:"string"` + + // The time that the disk upload ends. + UploadEnd *time.Time `type:"timestamp" timestampFormat:"iso8601"` + + // The size of the uploaded disk image. + UploadSize *float64 `type:"double"` + + // The time that the disk upload starts. + UploadStart *time.Time `type:"timestamp" timestampFormat:"iso8601"` + + metadataClientData `json:"-" xml:"-"` +} + +type metadataClientData struct { + SDKShapeTraits bool `type:"structure"` +} + +type ConfirmProductInstanceInput struct { + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // The ID of the instance. + InstanceID *string `locationName:"InstanceId" type:"string" required:"true"` + + // The product code. This must be a product code that you own. + ProductCode *string `type:"string" required:"true"` + + metadataConfirmProductInstanceInput `json:"-" xml:"-"` +} + +type metadataConfirmProductInstanceInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type ConfirmProductInstanceOutput struct { + // The AWS account ID of the instance owner. This is only present if the product + // code is attached to the instance. + OwnerID *string `locationName:"ownerId" type:"string"` + + metadataConfirmProductInstanceOutput `json:"-" xml:"-"` +} + +type metadataConfirmProductInstanceOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +// Describes a conversion task. +type ConversionTask struct { + // The ID of the conversion task. + ConversionTaskID *string `locationName:"conversionTaskId" type:"string" required:"true"` + + // The time when the task expires. If the upload isn't complete before the expiration + // time, we automatically cancel the task. + ExpirationTime *string `locationName:"expirationTime" type:"string"` + + // If the task is for importing an instance, this contains information about + // the import instance task. + ImportInstance *ImportInstanceTaskDetails `locationName:"importInstance" type:"structure"` + + // If the task is for importing a volume, this contains information about the + // import volume task. + ImportVolume *ImportVolumeTaskDetails `locationName:"importVolume" type:"structure"` + + // The state of the conversion task. + State *string `locationName:"state" type:"string" required:"true"` + + // The status message related to the conversion task. + StatusMessage *string `locationName:"statusMessage" type:"string"` + + Tags []*Tag `locationName:"tagSet" locationNameList:"item" type:"list"` + + metadataConversionTask `json:"-" xml:"-"` +} + +type metadataConversionTask struct { + SDKShapeTraits bool `type:"structure"` +} + +type CopyImageInput struct { + // Unique, case-sensitive identifier you provide to ensure idempotency of the + // request. For more information, see How to Ensure Idempotency (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Run_Instance_Idempotency.html) + // in the Amazon Elastic Compute Cloud User Guide. + ClientToken *string `type:"string"` + + // A description for the new AMI in the destination region. + Description *string `type:"string"` + + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // The name of the new AMI in the destination region. + Name *string `type:"string" required:"true"` + + // The ID of the AMI to copy. + SourceImageID *string `locationName:"SourceImageId" type:"string" required:"true"` + + // The name of the region that contains the AMI to copy. + SourceRegion *string `type:"string" required:"true"` + + metadataCopyImageInput `json:"-" xml:"-"` +} + +type metadataCopyImageInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type CopyImageOutput struct { + // The ID of the new AMI. + ImageID *string `locationName:"imageId" type:"string"` + + metadataCopyImageOutput `json:"-" xml:"-"` +} + +type metadataCopyImageOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +type CopySnapshotInput struct { + // A description for the new Amazon EBS snapshot. + Description *string `type:"string"` + + // The destination region to use in the PresignedUrl parameter of a snapshot + // copy operation. This parameter is only valid for specifying the destination + // region in a PresignedUrl parameter, where it is required. + // + // CopySnapshot sends the snapshot copy to the regional endpoint that you + // send the HTTP request to, such as ec2.us-east-1.amazonaws.com (in the AWS + // CLI, this is specified with the --region parameter or the default region + // in your AWS configuration file). + DestinationRegion *string `locationName:"destinationRegion" type:"string"` + + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // The pre-signed URL that facilitates copying an encrypted snapshot. This parameter + // is only required when copying an encrypted snapshot with the Amazon EC2 Query + // API; it is available as an optional parameter in all other cases. The PresignedUrl + // should use the snapshot source endpoint, the CopySnapshot action, and include + // the SourceRegion, SourceSnapshotId, and DestinationRegion parameters. The + // PresignedUrl must be signed using AWS Signature Version 4. Because Amazon + // EBS snapshots are stored in Amazon S3, the signing algorithm for this parameter + // uses the same logic that is described in Authenticating Requests by Using + // Query Parameters (AWS Signature Version 4) (http://docs.aws.amazon.com/AmazonS3/latest/API/sigv4-query-string-auth.html) + // in the Amazon Simple Storage Service API Reference. An invalid or improperly + // signed PresignedUrl will cause the copy operation to fail asynchronously, + // and the snapshot will move to an error state. + PresignedURL *string `locationName:"presignedUrl" type:"string"` + + // The ID of the region that contains the snapshot to be copied. + SourceRegion *string `type:"string" required:"true"` + + // The ID of the Amazon EBS snapshot to copy. + SourceSnapshotID *string `locationName:"SourceSnapshotId" type:"string" required:"true"` + + metadataCopySnapshotInput `json:"-" xml:"-"` +} + +type metadataCopySnapshotInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type CopySnapshotOutput struct { + // The ID of the new snapshot. + SnapshotID *string `locationName:"snapshotId" type:"string"` + + metadataCopySnapshotOutput `json:"-" xml:"-"` +} + +type metadataCopySnapshotOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +type CreateCustomerGatewayInput struct { + // For devices that support BGP, the customer gateway's BGP ASN. + // + // Default: 65000 + BGPASN *int64 `locationName:"BgpAsn" type:"integer" required:"true"` + + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // The Internet-routable IP address for the customer gateway's outside interface. + // The address must be static. + PublicIP *string `locationName:"IpAddress" type:"string" required:"true"` + + // The type of VPN connection that this customer gateway supports (ipsec.1). + Type *string `type:"string" required:"true"` + + metadataCreateCustomerGatewayInput `json:"-" xml:"-"` +} + +type metadataCreateCustomerGatewayInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type CreateCustomerGatewayOutput struct { + // Information about the customer gateway. + CustomerGateway *CustomerGateway `locationName:"customerGateway" type:"structure"` + + metadataCreateCustomerGatewayOutput `json:"-" xml:"-"` +} + +type metadataCreateCustomerGatewayOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +type CreateDHCPOptionsInput struct { + // A DHCP configuration option. + DHCPConfigurations []*NewDHCPConfiguration `locationName:"dhcpConfiguration" locationNameList:"item" type:"list" required:"true"` + + DryRun *bool `locationName:"dryRun" type:"boolean"` + + metadataCreateDHCPOptionsInput `json:"-" xml:"-"` +} + +type metadataCreateDHCPOptionsInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type CreateDHCPOptionsOutput struct { + // A set of DHCP options. + DHCPOptions *DHCPOptions `locationName:"dhcpOptions" type:"structure"` + + metadataCreateDHCPOptionsOutput `json:"-" xml:"-"` +} + +type metadataCreateDHCPOptionsOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +type CreateImageInput struct { + // Information about one or more block device mappings. + BlockDeviceMappings []*BlockDeviceMapping `locationName:"blockDeviceMapping" locationNameList:"BlockDeviceMapping" type:"list"` + + // A description for the new image. + Description *string `locationName:"description" type:"string"` + + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // The ID of the instance. + InstanceID *string `locationName:"instanceId" type:"string" required:"true"` + + // A name for the new image. + // + // Constraints: 3-128 alphanumeric characters, parentheses (()), square brackets + // ([]), spaces ( ), periods (.), slashes (/), dashes (-), single quotes ('), + // at-signs (@), or underscores(_) + Name *string `locationName:"name" type:"string" required:"true"` + + // By default, this parameter is set to false, which means Amazon EC2 attempts + // to shut down the instance cleanly before image creation and then reboots + // the instance. When the parameter is set to true, Amazon EC2 doesn't shut + // down the instance before creating the image. When this option is used, file + // system integrity on the created image can't be guaranteed. + NoReboot *bool `locationName:"noReboot" type:"boolean"` + + metadataCreateImageInput `json:"-" xml:"-"` +} + +type metadataCreateImageInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type CreateImageOutput struct { + // The ID of the new AMI. + ImageID *string `locationName:"imageId" type:"string"` + + metadataCreateImageOutput `json:"-" xml:"-"` +} + +type metadataCreateImageOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +type CreateInstanceExportTaskInput struct { + // A description for the conversion task or the resource being exported. The + // maximum length is 255 bytes. + Description *string `locationName:"description" type:"string"` + + ExportToS3Task *ExportToS3TaskSpecification `locationName:"exportToS3" type:"structure"` + + // The ID of the instance. + InstanceID *string `locationName:"instanceId" type:"string" required:"true"` + + // The target virtualization environment. + TargetEnvironment *string `locationName:"targetEnvironment" type:"string"` + + metadataCreateInstanceExportTaskInput `json:"-" xml:"-"` +} + +type metadataCreateInstanceExportTaskInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type CreateInstanceExportTaskOutput struct { + // Describes an export task. + ExportTask *ExportTask `locationName:"exportTask" type:"structure"` + + metadataCreateInstanceExportTaskOutput `json:"-" xml:"-"` +} + +type metadataCreateInstanceExportTaskOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +type CreateInternetGatewayInput struct { + DryRun *bool `locationName:"dryRun" type:"boolean"` + + metadataCreateInternetGatewayInput `json:"-" xml:"-"` +} + +type metadataCreateInternetGatewayInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type CreateInternetGatewayOutput struct { + // Information about the Internet gateway. + InternetGateway *InternetGateway `locationName:"internetGateway" type:"structure"` + + metadataCreateInternetGatewayOutput `json:"-" xml:"-"` +} + +type metadataCreateInternetGatewayOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +type CreateKeyPairInput struct { + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // A unique name for the key pair. + // + // Constraints: Up to 255 ASCII characters + KeyName *string `type:"string" required:"true"` + + metadataCreateKeyPairInput `json:"-" xml:"-"` +} + +type metadataCreateKeyPairInput struct { + SDKShapeTraits bool `type:"structure"` +} + +// Describes a key pair. +type CreateKeyPairOutput struct { + // The SHA-1 digest of the DER encoded private key. + KeyFingerprint *string `locationName:"keyFingerprint" type:"string"` + + // An unencrypted PEM encoded RSA private key. + KeyMaterial *string `locationName:"keyMaterial" type:"string"` + + // The name of the key pair. + KeyName *string `locationName:"keyName" type:"string"` + + metadataCreateKeyPairOutput `json:"-" xml:"-"` +} + +type metadataCreateKeyPairOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +type CreateNetworkACLEntryInput struct { + // The network range to allow or deny, in CIDR notation (for example 172.16.0.0/24). + CIDRBlock *string `locationName:"cidrBlock" type:"string" required:"true"` + + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // Indicates whether this is an egress rule (rule is applied to traffic leaving + // the subnet). + Egress *bool `locationName:"egress" type:"boolean" required:"true"` + + // ICMP protocol: The ICMP type and code. Required if specifying ICMP for the + // protocol. + ICMPTypeCode *ICMPTypeCode `locationName:"Icmp" type:"structure"` + + // The ID of the network ACL. + NetworkACLID *string `locationName:"networkAclId" type:"string" required:"true"` + + // TCP or UDP protocols: The range of ports the rule applies to. + PortRange *PortRange `locationName:"portRange" type:"structure"` + + // The protocol. A value of -1 means all protocols. + Protocol *string `locationName:"protocol" type:"string" required:"true"` + + // Indicates whether to allow or deny the traffic that matches the rule. + RuleAction *string `locationName:"ruleAction" type:"string" required:"true"` + + // The rule number for the entry (for example, 100). ACL entries are processed + // in ascending order by rule number. + // + // Constraints: Positive integer from 1 to 32766 + RuleNumber *int64 `locationName:"ruleNumber" type:"integer" required:"true"` + + metadataCreateNetworkACLEntryInput `json:"-" xml:"-"` +} + +type metadataCreateNetworkACLEntryInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type CreateNetworkACLEntryOutput struct { + metadataCreateNetworkACLEntryOutput `json:"-" xml:"-"` +} + +type metadataCreateNetworkACLEntryOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +type CreateNetworkACLInput struct { + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // The ID of the VPC. + VPCID *string `locationName:"vpcId" type:"string" required:"true"` + + metadataCreateNetworkACLInput `json:"-" xml:"-"` +} + +type metadataCreateNetworkACLInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type CreateNetworkACLOutput struct { + // Information about the network ACL. + NetworkACL *NetworkACL `locationName:"networkAcl" type:"structure"` + + metadataCreateNetworkACLOutput `json:"-" xml:"-"` +} + +type metadataCreateNetworkACLOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +type CreateNetworkInterfaceInput struct { + // A description for the network interface. + Description *string `locationName:"description" type:"string"` + + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // The IDs of one or more security groups. + Groups []*string `locationName:"SecurityGroupId" locationNameList:"SecurityGroupId" type:"list"` + + // The primary private IP address of the network interface. If you don't specify + // an IP address, Amazon EC2 selects one for you from the subnet range. If you + // specify an IP address, you cannot indicate any IP addresses specified in + // privateIpAddresses as primary (only one IP address can be designated as primary). + PrivateIPAddress *string `locationName:"privateIpAddress" type:"string"` + + // One or more private IP addresses. + PrivateIPAddresses []*PrivateIPAddressSpecification `locationName:"privateIpAddresses" locationNameList:"item" type:"list"` + + // The number of secondary private IP addresses to assign to a network interface. + // When you specify a number of secondary IP addresses, Amazon EC2 selects these + // IP addresses within the subnet range. You can't specify this option and specify + // more than one private IP address using privateIpAddresses. + // + // The number of IP addresses you can assign to a network interface varies + // by instance type. For more information, see Private IP Addresses Per ENI + // Per Instance Type (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-eni.html#AvailableIpPerENI) + // in the Amazon Elastic Compute Cloud User Guide. + SecondaryPrivateIPAddressCount *int64 `locationName:"secondaryPrivateIpAddressCount" type:"integer"` + + // The ID of the subnet to associate with the network interface. + SubnetID *string `locationName:"subnetId" type:"string" required:"true"` + + metadataCreateNetworkInterfaceInput `json:"-" xml:"-"` +} + +type metadataCreateNetworkInterfaceInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type CreateNetworkInterfaceOutput struct { + // Information about the network interface. + NetworkInterface *NetworkInterface `locationName:"networkInterface" type:"structure"` + + metadataCreateNetworkInterfaceOutput `json:"-" xml:"-"` +} + +type metadataCreateNetworkInterfaceOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +type CreatePlacementGroupInput struct { + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // A name for the placement group. + // + // Constraints: Up to 255 ASCII characters + GroupName *string `locationName:"groupName" type:"string" required:"true"` + + // The placement strategy. + Strategy *string `locationName:"strategy" type:"string" required:"true"` + + metadataCreatePlacementGroupInput `json:"-" xml:"-"` +} + +type metadataCreatePlacementGroupInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type CreatePlacementGroupOutput struct { + metadataCreatePlacementGroupOutput `json:"-" xml:"-"` +} + +type metadataCreatePlacementGroupOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +type CreateReservedInstancesListingInput struct { + // Unique, case-sensitive identifier you provide to ensure idempotency of your + // listings. This helps avoid duplicate listings. For more information, see + // 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 + // be listed in the Reserved Instance Marketplace. This number should be less + // 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. + PriceSchedules []*PriceScheduleSpecification `locationName:"priceSchedules" locationNameList:"item" type:"list" required:"true"` + + // The ID of the active Reserved Instance. + ReservedInstancesID *string `locationName:"reservedInstancesId" type:"string" required:"true"` + + metadataCreateReservedInstancesListingInput `json:"-" xml:"-"` +} + +type metadataCreateReservedInstancesListingInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type CreateReservedInstancesListingOutput struct { + // Information about the Reserved Instances listing. + ReservedInstancesListings []*ReservedInstancesListing `locationName:"reservedInstancesListingsSet" locationNameList:"item" type:"list"` + + metadataCreateReservedInstancesListingOutput `json:"-" xml:"-"` +} + +type metadataCreateReservedInstancesListingOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +type CreateRouteInput struct { + // The CIDR address block used for the destination match. Routing decisions + // are based on the most specific match. + DestinationCIDRBlock *string `locationName:"destinationCidrBlock" type:"string" required:"true"` + + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // The ID of an Internet gateway or virtual private gateway attached to your + // VPC. + GatewayID *string `locationName:"gatewayId" type:"string"` + + // The ID of a NAT instance in your VPC. The operation fails if you specify + // an instance ID unless exactly one network interface is attached. + InstanceID *string `locationName:"instanceId" type:"string"` + + // The ID of a network interface. + NetworkInterfaceID *string `locationName:"networkInterfaceId" type:"string"` + + // The ID of the route table for the route. + RouteTableID *string `locationName:"routeTableId" type:"string" required:"true"` + + // The ID of a VPC peering connection. + VPCPeeringConnectionID *string `locationName:"vpcPeeringConnectionId" type:"string"` + + metadataCreateRouteInput `json:"-" xml:"-"` +} + +type metadataCreateRouteInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type CreateRouteOutput struct { + metadataCreateRouteOutput `json:"-" xml:"-"` +} + +type metadataCreateRouteOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +type CreateRouteTableInput struct { + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // The ID of the VPC. + VPCID *string `locationName:"vpcId" type:"string" required:"true"` + + metadataCreateRouteTableInput `json:"-" xml:"-"` +} + +type metadataCreateRouteTableInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type CreateRouteTableOutput struct { + // Information about the route table. + RouteTable *RouteTable `locationName:"routeTable" type:"structure"` + + metadataCreateRouteTableOutput `json:"-" xml:"-"` +} + +type metadataCreateRouteTableOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +type CreateSecurityGroupInput struct { + // A description for the security group. This is informational only. + // + // Constraints: Up to 255 characters in length + // + // Constraints for EC2-Classic: ASCII characters + // + // Constraints for EC2-VPC: a-z, A-Z, 0-9, spaces, and ._-:/()#,@[]+=&;{}!$* + Description *string `locationName:"GroupDescription" type:"string" required:"true"` + + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // The name of the security group. + // + // Constraints: Up to 255 characters in length + // + // Constraints for EC2-Classic: ASCII characters + // + // Constraints for EC2-VPC: a-z, A-Z, 0-9, spaces, and ._-:/()#,@[]+=&;{}!$* + GroupName *string `type:"string" required:"true"` + + // [EC2-VPC] The ID of the VPC. Required for EC2-VPC. + VPCID *string `locationName:"VpcId" type:"string"` + + metadataCreateSecurityGroupInput `json:"-" xml:"-"` +} + +type metadataCreateSecurityGroupInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type CreateSecurityGroupOutput struct { + // The ID of the security group. + GroupID *string `locationName:"groupId" type:"string"` + + metadataCreateSecurityGroupOutput `json:"-" xml:"-"` +} + +type metadataCreateSecurityGroupOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +type CreateSnapshotInput struct { + // A description for the snapshot. + Description *string `type:"string"` + + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // The ID of the Amazon EBS volume. + VolumeID *string `locationName:"VolumeId" type:"string" required:"true"` + + metadataCreateSnapshotInput `json:"-" xml:"-"` +} + +type metadataCreateSnapshotInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type CreateSpotDatafeedSubscriptionInput struct { + // The Amazon S3 bucket in which to store the Spot Instance data feed. + Bucket *string `locationName:"bucket" type:"string" required:"true"` + + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // A prefix for the data feed file names. + Prefix *string `locationName:"prefix" type:"string"` + + metadataCreateSpotDatafeedSubscriptionInput `json:"-" xml:"-"` +} + +type metadataCreateSpotDatafeedSubscriptionInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type CreateSpotDatafeedSubscriptionOutput struct { + // The Spot Instance data feed subscription. + SpotDatafeedSubscription *SpotDatafeedSubscription `locationName:"spotDatafeedSubscription" type:"structure"` + + metadataCreateSpotDatafeedSubscriptionOutput `json:"-" xml:"-"` +} + +type metadataCreateSpotDatafeedSubscriptionOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +type CreateSubnetInput struct { + // The Availability Zone for the subnet. + // + // Default: Amazon EC2 selects one for you (recommended). + AvailabilityZone *string `type:"string"` + + // The network range for the subnet, in CIDR notation. For example, 10.0.0.0/24. + CIDRBlock *string `locationName:"CidrBlock" type:"string" required:"true"` + + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // The ID of the VPC. + VPCID *string `locationName:"VpcId" type:"string" required:"true"` + + metadataCreateSubnetInput `json:"-" xml:"-"` +} + +type metadataCreateSubnetInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type CreateSubnetOutput struct { + // Information about the subnet. + Subnet *Subnet `locationName:"subnet" type:"structure"` + + metadataCreateSubnetOutput `json:"-" xml:"-"` +} + +type metadataCreateSubnetOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +type CreateTagsInput struct { + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // The IDs of one or more resources to tag. For example, ami-1a2b3c4d. + Resources []*string `locationName:"ResourceId" type:"list" required:"true"` + + // One or more tags. The value parameter is required, but if you don't want + // the tag to have a value, specify the parameter with no value, and we set + // the value to an empty string. + Tags []*Tag `locationName:"Tag" locationNameList:"item" type:"list" required:"true"` + + metadataCreateTagsInput `json:"-" xml:"-"` +} + +type metadataCreateTagsInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type CreateTagsOutput struct { + metadataCreateTagsOutput `json:"-" xml:"-"` +} + +type metadataCreateTagsOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +type CreateVPCInput struct { + // The network range for the VPC, in CIDR notation. For example, 10.0.0.0/16. + CIDRBlock *string `locationName:"CidrBlock" type:"string" required:"true"` + + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // The supported tenancy options for instances launched into the VPC. A value + // of default means that instances can be launched with any tenancy; a value + // of dedicated means all instances launched into the VPC are launched as dedicated + // tenancy instances regardless of the tenancy assigned to the instance at launch. + // Dedicated tenancy instances run on single-tenant hardware. + // + // Default: default + InstanceTenancy *string `locationName:"instanceTenancy" type:"string"` + + metadataCreateVPCInput `json:"-" xml:"-"` +} + +type metadataCreateVPCInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type CreateVPCOutput struct { + // Information about the VPC. + VPC *VPC `locationName:"vpc" type:"structure"` + + metadataCreateVPCOutput `json:"-" xml:"-"` +} + +type metadataCreateVPCOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +type CreateVPCPeeringConnectionInput struct { + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // The AWS account ID of the owner of the peer VPC. + // + // Default: Your AWS account ID + PeerOwnerID *string `locationName:"peerOwnerId" type:"string"` + + // The ID of the VPC with which you are creating the VPC peering connection. + PeerVPCID *string `locationName:"peerVpcId" type:"string"` + + // The ID of the requester VPC. + VPCID *string `locationName:"vpcId" type:"string"` + + metadataCreateVPCPeeringConnectionInput `json:"-" xml:"-"` +} + +type metadataCreateVPCPeeringConnectionInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type CreateVPCPeeringConnectionOutput struct { + // Information about the VPC peering connection. + VPCPeeringConnection *VPCPeeringConnection `locationName:"vpcPeeringConnection" type:"structure"` + + metadataCreateVPCPeeringConnectionOutput `json:"-" xml:"-"` +} + +type metadataCreateVPCPeeringConnectionOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +type CreateVPNConnectionInput struct { + // The ID of the customer gateway. + CustomerGatewayID *string `locationName:"CustomerGatewayId" type:"string" required:"true"` + + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // Indicates whether the VPN connection requires static routes. If you are creating + // a VPN connection for a device that does not support BGP, you must specify + // true. + // + // Default: false + Options *VPNConnectionOptionsSpecification `locationName:"options" type:"structure"` + + // The type of VPN connection (ipsec.1). + Type *string `type:"string" required:"true"` + + // The ID of the virtual private gateway. + VPNGatewayID *string `locationName:"VpnGatewayId" type:"string" required:"true"` + + metadataCreateVPNConnectionInput `json:"-" xml:"-"` +} + +type metadataCreateVPNConnectionInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type CreateVPNConnectionOutput struct { + // Information about the VPN connection. + VPNConnection *VPNConnection `locationName:"vpnConnection" type:"structure"` + + metadataCreateVPNConnectionOutput `json:"-" xml:"-"` +} + +type metadataCreateVPNConnectionOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +type CreateVPNConnectionRouteInput struct { + // The CIDR block associated with the local subnet of the customer network. + DestinationCIDRBlock *string `locationName:"DestinationCidrBlock" type:"string" required:"true"` + + // The ID of the VPN connection. + VPNConnectionID *string `locationName:"VpnConnectionId" type:"string" required:"true"` + + metadataCreateVPNConnectionRouteInput `json:"-" xml:"-"` +} + +type metadataCreateVPNConnectionRouteInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type CreateVPNConnectionRouteOutput struct { + metadataCreateVPNConnectionRouteOutput `json:"-" xml:"-"` +} + +type metadataCreateVPNConnectionRouteOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +type CreateVPNGatewayInput struct { + // The Availability Zone for the virtual private gateway. + AvailabilityZone *string `type:"string"` + + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // The type of VPN connection this virtual private gateway supports. + Type *string `type:"string" required:"true"` + + metadataCreateVPNGatewayInput `json:"-" xml:"-"` +} + +type metadataCreateVPNGatewayInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type CreateVPNGatewayOutput struct { + // Information about the virtual private gateway. + VPNGateway *VPNGateway `locationName:"vpnGateway" type:"structure"` + + metadataCreateVPNGatewayOutput `json:"-" xml:"-"` +} + +type metadataCreateVPNGatewayOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +type CreateVolumeInput struct { + // The Availability Zone in which to create the volume. Use DescribeAvailabilityZones + // to list the Availability Zones that are currently available to you. + AvailabilityZone *string `type:"string" required:"true"` + + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // Specifies whether the volume should be encrypted. Encrypted Amazon EBS volumes + // may only be attached to instances that support Amazon EBS encryption. Volumes + // that are created from encrypted snapshots are automatically encrypted. There + // is no way to create an encrypted volume from an unencrypted snapshot or vice + // versa. If your AMI uses encrypted volumes, you can only launch it on supported + // instance types. For more information, see Amazon EBS Encryption (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSEncryption.html) + // in the Amazon Elastic Compute Cloud User Guide. + Encrypted *bool `locationName:"encrypted" type:"boolean"` + + // Only valid for Provisioned IOPS (SSD) volumes. The number of I/O operations + // per second (IOPS) to provision for the volume, with a maximum ratio of 30 + // IOPS/GiB. + // + // Constraint: Range is 100 to 20000 for Provisioned IOPS (SSD) volumes + IOPS *int64 `locationName:"Iops" type:"integer"` + + // The full ARN of the AWS Key Management Service (KMS) master key to use when + // creating the encrypted volume. This parameter is only required if you want + // to use a non-default master key; if this parameter is not specified, the + // default master key is used. The ARN contains the arn:aws:kms namespace, followed + // by the region of the master key, the AWS account ID of the master key owner, + // the key namespace, and then the master key ID. For example, arn:aws:kms:us-east-1:012345678910:key/abcd1234-a123-456a-a12b-a123b4cd56ef. + KMSKeyID *string `locationName:"KmsKeyId" type:"string"` + + // The size of the volume, in GiBs. + // + // Constraints: 1-1024 for standard volumes, 1-16384 for gp2 volumes, and 4-16384 + // for io1 volumes. If you specify a snapshot, the volume size must be equal + // to or larger than the snapshot size. + // + // Default: If you're creating the volume from a snapshot and don't specify + // a volume size, the default is the snapshot size. + Size *int64 `type:"integer"` + + // The snapshot from which to create the volume. + SnapshotID *string `locationName:"SnapshotId" type:"string"` + + // The volume type. This can be gp2 for General Purpose (SSD) volumes, io1 for + // Provisioned IOPS (SSD) volumes, or standard for Magnetic volumes. + // + // Default: standard + VolumeType *string `type:"string"` + + metadataCreateVolumeInput `json:"-" xml:"-"` +} + +type metadataCreateVolumeInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type CreateVolumePermission struct { + // The specific group that is to be added or removed from a volume's list of + // create volume permissions. + Group *string `locationName:"group" type:"string"` + + // The specific AWS account ID that is to be added or removed from a volume's + // list of create volume permissions. + UserID *string `locationName:"userId" type:"string"` + + metadataCreateVolumePermission `json:"-" xml:"-"` +} + +type metadataCreateVolumePermission struct { + SDKShapeTraits bool `type:"structure"` +} + +type CreateVolumePermissionModifications struct { + // Adds a specific AWS account ID or group to a volume's list of create volume + // permissions. + Add []*CreateVolumePermission `locationNameList:"item" type:"list"` + + // Removes a specific AWS account ID or group from a volume's list of create + // volume permissions. + Remove []*CreateVolumePermission `locationNameList:"item" type:"list"` + + metadataCreateVolumePermissionModifications `json:"-" xml:"-"` +} + +type metadataCreateVolumePermissionModifications struct { + SDKShapeTraits bool `type:"structure"` +} + +// Describes a customer gateway. +type CustomerGateway struct { + // The customer gateway's Border Gateway Protocol (BGP) Autonomous System Number + // (ASN). + BGPASN *string `locationName:"bgpAsn" type:"string"` + + // The ID of the customer gateway. + CustomerGatewayID *string `locationName:"customerGatewayId" type:"string"` + + // The Internet-routable IP address of the customer gateway's outside interface. + IPAddress *string `locationName:"ipAddress" type:"string"` + + // The current state of the customer gateway (pending | available | deleting + // | deleted). + State *string `locationName:"state" type:"string"` + + // Any tags assigned to the customer gateway. + Tags []*Tag `locationName:"tagSet" locationNameList:"item" type:"list"` + + // The type of VPN connection the customer gateway supports (ipsec.1). + Type *string `locationName:"type" type:"string"` + + metadataCustomerGateway `json:"-" xml:"-"` +} + +type metadataCustomerGateway struct { + SDKShapeTraits bool `type:"structure"` +} + +// Describes a DHCP configuration option. +type DHCPConfiguration struct { + // The name of a DHCP option. + Key *string `locationName:"key" type:"string"` + + // One or more values for the DHCP option. + Values []*AttributeValue `locationName:"valueSet" locationNameList:"item" type:"list"` + + metadataDHCPConfiguration `json:"-" xml:"-"` +} + +type metadataDHCPConfiguration struct { + SDKShapeTraits bool `type:"structure"` +} + +// Describes a set of DHCP options. +type DHCPOptions struct { + // One or more DHCP options in the set. + DHCPConfigurations []*DHCPConfiguration `locationName:"dhcpConfigurationSet" locationNameList:"item" type:"list"` + + // The ID of the set of DHCP options. + DHCPOptionsID *string `locationName:"dhcpOptionsId" type:"string"` + + // Any tags assigned to the DHCP options set. + Tags []*Tag `locationName:"tagSet" locationNameList:"item" type:"list"` + + metadataDHCPOptions `json:"-" xml:"-"` +} + +type metadataDHCPOptions struct { + SDKShapeTraits bool `type:"structure"` +} + +type DeleteCustomerGatewayInput struct { + // The ID of the customer gateway. + CustomerGatewayID *string `locationName:"CustomerGatewayId" type:"string" required:"true"` + + DryRun *bool `locationName:"dryRun" type:"boolean"` + + metadataDeleteCustomerGatewayInput `json:"-" xml:"-"` +} + +type metadataDeleteCustomerGatewayInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type DeleteCustomerGatewayOutput struct { + metadataDeleteCustomerGatewayOutput `json:"-" xml:"-"` +} + +type metadataDeleteCustomerGatewayOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +type DeleteDHCPOptionsInput struct { + // The ID of the DHCP options set. + DHCPOptionsID *string `locationName:"DhcpOptionsId" type:"string" required:"true"` + + DryRun *bool `locationName:"dryRun" type:"boolean"` + + metadataDeleteDHCPOptionsInput `json:"-" xml:"-"` +} + +type metadataDeleteDHCPOptionsInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type DeleteDHCPOptionsOutput struct { + metadataDeleteDHCPOptionsOutput `json:"-" xml:"-"` +} + +type metadataDeleteDHCPOptionsOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +type DeleteInternetGatewayInput struct { + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // The ID of the Internet gateway. + InternetGatewayID *string `locationName:"internetGatewayId" type:"string" required:"true"` + + metadataDeleteInternetGatewayInput `json:"-" xml:"-"` +} + +type metadataDeleteInternetGatewayInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type DeleteInternetGatewayOutput struct { + metadataDeleteInternetGatewayOutput `json:"-" xml:"-"` +} + +type metadataDeleteInternetGatewayOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +type DeleteKeyPairInput struct { + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // The name of the key pair. + KeyName *string `type:"string" required:"true"` + + metadataDeleteKeyPairInput `json:"-" xml:"-"` +} + +type metadataDeleteKeyPairInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type DeleteKeyPairOutput struct { + metadataDeleteKeyPairOutput `json:"-" xml:"-"` +} + +type metadataDeleteKeyPairOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +type DeleteNetworkACLEntryInput struct { + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // Indicates whether the rule is an egress rule. + Egress *bool `locationName:"egress" type:"boolean" required:"true"` + + // The ID of the network ACL. + NetworkACLID *string `locationName:"networkAclId" type:"string" required:"true"` + + // The rule number of the entry to delete. + RuleNumber *int64 `locationName:"ruleNumber" type:"integer" required:"true"` + + metadataDeleteNetworkACLEntryInput `json:"-" xml:"-"` +} + +type metadataDeleteNetworkACLEntryInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type DeleteNetworkACLEntryOutput struct { + metadataDeleteNetworkACLEntryOutput `json:"-" xml:"-"` +} + +type metadataDeleteNetworkACLEntryOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +type DeleteNetworkACLInput struct { + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // The ID of the network ACL. + NetworkACLID *string `locationName:"networkAclId" type:"string" required:"true"` + + metadataDeleteNetworkACLInput `json:"-" xml:"-"` +} + +type metadataDeleteNetworkACLInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type DeleteNetworkACLOutput struct { + metadataDeleteNetworkACLOutput `json:"-" xml:"-"` +} + +type metadataDeleteNetworkACLOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +type DeleteNetworkInterfaceInput struct { + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // The ID of the network interface. + NetworkInterfaceID *string `locationName:"networkInterfaceId" type:"string" required:"true"` + + metadataDeleteNetworkInterfaceInput `json:"-" xml:"-"` +} + +type metadataDeleteNetworkInterfaceInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type DeleteNetworkInterfaceOutput struct { + metadataDeleteNetworkInterfaceOutput `json:"-" xml:"-"` +} + +type metadataDeleteNetworkInterfaceOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +type DeletePlacementGroupInput struct { + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // The name of the placement group. + GroupName *string `locationName:"groupName" type:"string" required:"true"` + + metadataDeletePlacementGroupInput `json:"-" xml:"-"` +} + +type metadataDeletePlacementGroupInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type DeletePlacementGroupOutput struct { + metadataDeletePlacementGroupOutput `json:"-" xml:"-"` +} + +type metadataDeletePlacementGroupOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +type DeleteRouteInput struct { + // The CIDR range for the route. The value you specify must match the CIDR for + // the route exactly. + DestinationCIDRBlock *string `locationName:"destinationCidrBlock" type:"string" required:"true"` + + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // The ID of the route table. + RouteTableID *string `locationName:"routeTableId" type:"string" required:"true"` + + metadataDeleteRouteInput `json:"-" xml:"-"` +} + +type metadataDeleteRouteInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type DeleteRouteOutput struct { + metadataDeleteRouteOutput `json:"-" xml:"-"` +} + +type metadataDeleteRouteOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +type DeleteRouteTableInput struct { + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // The ID of the route table. + RouteTableID *string `locationName:"routeTableId" type:"string" required:"true"` + + metadataDeleteRouteTableInput `json:"-" xml:"-"` +} + +type metadataDeleteRouteTableInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type DeleteRouteTableOutput struct { + metadataDeleteRouteTableOutput `json:"-" xml:"-"` +} + +type metadataDeleteRouteTableOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +type DeleteSecurityGroupInput struct { + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // The ID of the security group. Required for a nondefault VPC. + GroupID *string `locationName:"GroupId" type:"string"` + + // [EC2-Classic, default VPC] The name of the security group. You can specify + // either the security group name or the security group ID. + GroupName *string `type:"string"` + + metadataDeleteSecurityGroupInput `json:"-" xml:"-"` +} + +type metadataDeleteSecurityGroupInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type DeleteSecurityGroupOutput struct { + metadataDeleteSecurityGroupOutput `json:"-" xml:"-"` +} + +type metadataDeleteSecurityGroupOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +type DeleteSnapshotInput struct { + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // The ID of the Amazon EBS snapshot. + SnapshotID *string `locationName:"SnapshotId" type:"string" required:"true"` + + metadataDeleteSnapshotInput `json:"-" xml:"-"` +} + +type metadataDeleteSnapshotInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type DeleteSnapshotOutput struct { + metadataDeleteSnapshotOutput `json:"-" xml:"-"` +} + +type metadataDeleteSnapshotOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +type DeleteSpotDatafeedSubscriptionInput struct { + DryRun *bool `locationName:"dryRun" type:"boolean"` + + metadataDeleteSpotDatafeedSubscriptionInput `json:"-" xml:"-"` +} + +type metadataDeleteSpotDatafeedSubscriptionInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type DeleteSpotDatafeedSubscriptionOutput struct { + metadataDeleteSpotDatafeedSubscriptionOutput `json:"-" xml:"-"` +} + +type metadataDeleteSpotDatafeedSubscriptionOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +type DeleteSubnetInput struct { + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // The ID of the subnet. + SubnetID *string `locationName:"SubnetId" type:"string" required:"true"` + + metadataDeleteSubnetInput `json:"-" xml:"-"` +} + +type metadataDeleteSubnetInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type DeleteSubnetOutput struct { + metadataDeleteSubnetOutput `json:"-" xml:"-"` +} + +type metadataDeleteSubnetOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +type DeleteTagsInput struct { + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // The ID of the resource. For example, ami-1a2b3c4d. You can specify more than + // one resource ID. + Resources []*string `locationName:"resourceId" type:"list" required:"true"` + + // One or more tags to delete. If you omit the value parameter, we delete the + // tag regardless of its value. If you specify this parameter with an empty + // string as the value, we delete the key only if its value is an empty string. + Tags []*Tag `locationName:"tag" locationNameList:"item" type:"list"` + + metadataDeleteTagsInput `json:"-" xml:"-"` +} + +type metadataDeleteTagsInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type DeleteTagsOutput struct { + metadataDeleteTagsOutput `json:"-" xml:"-"` +} + +type metadataDeleteTagsOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +type DeleteVPCInput struct { + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // The ID of the VPC. + VPCID *string `locationName:"VpcId" type:"string" required:"true"` + + metadataDeleteVPCInput `json:"-" xml:"-"` +} + +type metadataDeleteVPCInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type DeleteVPCOutput struct { + metadataDeleteVPCOutput `json:"-" xml:"-"` +} + +type metadataDeleteVPCOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +type DeleteVPCPeeringConnectionInput struct { + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // The ID of the VPC peering connection. + VPCPeeringConnectionID *string `locationName:"vpcPeeringConnectionId" type:"string" required:"true"` + + metadataDeleteVPCPeeringConnectionInput `json:"-" xml:"-"` +} + +type metadataDeleteVPCPeeringConnectionInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type DeleteVPCPeeringConnectionOutput struct { + // Returns true if the request succeeds; otherwise, it returns an error. + Return *bool `locationName:"return" type:"boolean"` + + metadataDeleteVPCPeeringConnectionOutput `json:"-" xml:"-"` +} + +type metadataDeleteVPCPeeringConnectionOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +type DeleteVPNConnectionInput struct { + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // The ID of the VPN connection. + VPNConnectionID *string `locationName:"VpnConnectionId" type:"string" required:"true"` + + metadataDeleteVPNConnectionInput `json:"-" xml:"-"` +} + +type metadataDeleteVPNConnectionInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type DeleteVPNConnectionOutput struct { + metadataDeleteVPNConnectionOutput `json:"-" xml:"-"` +} + +type metadataDeleteVPNConnectionOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +type DeleteVPNConnectionRouteInput struct { + // The CIDR block associated with the local subnet of the customer network. + DestinationCIDRBlock *string `locationName:"DestinationCidrBlock" type:"string" required:"true"` + + // The ID of the VPN connection. + VPNConnectionID *string `locationName:"VpnConnectionId" type:"string" required:"true"` + + metadataDeleteVPNConnectionRouteInput `json:"-" xml:"-"` +} + +type metadataDeleteVPNConnectionRouteInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type DeleteVPNConnectionRouteOutput struct { + metadataDeleteVPNConnectionRouteOutput `json:"-" xml:"-"` +} + +type metadataDeleteVPNConnectionRouteOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +type DeleteVPNGatewayInput struct { + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // The ID of the virtual private gateway. + VPNGatewayID *string `locationName:"VpnGatewayId" type:"string" required:"true"` + + metadataDeleteVPNGatewayInput `json:"-" xml:"-"` +} + +type metadataDeleteVPNGatewayInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type DeleteVPNGatewayOutput struct { + metadataDeleteVPNGatewayOutput `json:"-" xml:"-"` +} + +type metadataDeleteVPNGatewayOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +type DeleteVolumeInput struct { + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // The ID of the volume. + VolumeID *string `locationName:"VolumeId" type:"string" required:"true"` + + metadataDeleteVolumeInput `json:"-" xml:"-"` +} + +type metadataDeleteVolumeInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type DeleteVolumeOutput struct { + metadataDeleteVolumeOutput `json:"-" xml:"-"` +} + +type metadataDeleteVolumeOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +type DeregisterImageInput struct { + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // The ID of the AMI. + ImageID *string `locationName:"ImageId" type:"string" required:"true"` + + metadataDeregisterImageInput `json:"-" xml:"-"` +} + +type metadataDeregisterImageInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type DeregisterImageOutput struct { + metadataDeregisterImageOutput `json:"-" xml:"-"` +} + +type metadataDeregisterImageOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +type DescribeAccountAttributesInput struct { + // One or more account attribute names. + AttributeNames []*string `locationName:"attributeName" locationNameList:"attributeName" type:"list"` + + DryRun *bool `locationName:"dryRun" type:"boolean"` + + metadataDescribeAccountAttributesInput `json:"-" xml:"-"` +} + +type metadataDescribeAccountAttributesInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type DescribeAccountAttributesOutput struct { + // Information about one or more account attributes. + AccountAttributes []*AccountAttribute `locationName:"accountAttributeSet" locationNameList:"item" type:"list"` + + metadataDescribeAccountAttributesOutput `json:"-" xml:"-"` +} + +type metadataDescribeAccountAttributesOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +type DescribeAddressesInput struct { + // [EC2-VPC] One or more allocation IDs. + // + // Default: Describes all your Elastic IP addresses. + AllocationIDs []*string `locationName:"AllocationId" locationNameList:"AllocationId" type:"list"` + + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // One or more filters. Filter names and values are case-sensitive. + // + // allocation-id - [EC2-VPC] The allocation ID for the address. + // + // association-id - [EC2-VPC] The association ID for the address. + // + // domain - Indicates whether the address is for use in EC2-Classic (standard) + // or in a VPC (vpc). + // + // instance-id - The ID of the instance the address is associated with, if + // any. + // + // network-interface-id - [EC2-VPC] The ID of the network interface that + // the address is associated with, if any. + // + // network-interface-owner-id - The AWS account ID of the owner. + // + // private-ip-address - [EC2-VPC] The private IP address associated with + // the Elastic IP address. + // + // public-ip - The Elastic IP address. + Filters []*Filter `locationName:"Filter" locationNameList:"Filter" type:"list"` + + // [EC2-Classic] One or more Elastic IP addresses. + // + // Default: Describes all your Elastic IP addresses. + PublicIPs []*string `locationName:"PublicIp" locationNameList:"PublicIp" type:"list"` + + metadataDescribeAddressesInput `json:"-" xml:"-"` +} + +type metadataDescribeAddressesInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type DescribeAddressesOutput struct { + // Information about one or more Elastic IP addresses. + Addresses []*Address `locationName:"addressesSet" locationNameList:"item" type:"list"` + + metadataDescribeAddressesOutput `json:"-" xml:"-"` +} + +type metadataDescribeAddressesOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +type DescribeAvailabilityZonesInput struct { + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // One or more filters. + // + // message - Information about the Availability Zone. + // + // region-name - The name of the region for the Availability Zone (for example, + // us-east-1). + // + // state - The state of the Availability Zone (available | impaired | unavailable). + // + // zone-name - The name of the Availability Zone (for example, us-east-1a). + Filters []*Filter `locationName:"Filter" locationNameList:"Filter" type:"list"` + + // The names of one or more Availability Zones. + ZoneNames []*string `locationName:"ZoneName" locationNameList:"ZoneName" type:"list"` + + metadataDescribeAvailabilityZonesInput `json:"-" xml:"-"` +} + +type metadataDescribeAvailabilityZonesInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type DescribeAvailabilityZonesOutput struct { + // Information about one or more Availability Zones. + AvailabilityZones []*AvailabilityZone `locationName:"availabilityZoneInfo" locationNameList:"item" type:"list"` + + metadataDescribeAvailabilityZonesOutput `json:"-" xml:"-"` +} + +type metadataDescribeAvailabilityZonesOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +type DescribeBundleTasksInput struct { + // One or more bundle task IDs. + // + // Default: Describes all your bundle tasks. + BundleIDs []*string `locationName:"BundleId" locationNameList:"BundleId" type:"list"` + + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // One or more filters. + // + // bundle-id - The ID of the bundle task. + // + // error-code - If the task failed, the error code returned. + // + // error-message - If the task failed, the error message returned. + // + // instance-id - The ID of the instance. + // + // progress - The level of task completion, as a percentage (for example, + // 20%). + // + // s3-bucket - The Amazon S3 bucket to store the AMI. + // + // s3-prefix - The beginning of the AMI name. + // + // start-time - The time the task started (for example, 2013-09-15T17:15:20.000Z). + // + // state - The state of the task (pending | waiting-for-shutdown | bundling + // | storing | cancelling | complete | failed). + // + // update-time - The time of the most recent update for the task. + Filters []*Filter `locationName:"Filter" locationNameList:"Filter" type:"list"` + + metadataDescribeBundleTasksInput `json:"-" xml:"-"` +} + +type metadataDescribeBundleTasksInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type DescribeBundleTasksOutput struct { + // Information about one or more bundle tasks. + BundleTasks []*BundleTask `locationName:"bundleInstanceTasksSet" locationNameList:"item" type:"list"` + + metadataDescribeBundleTasksOutput `json:"-" xml:"-"` +} + +type metadataDescribeBundleTasksOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +type DescribeClassicLinkInstancesInput struct { + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // One or more filters. + // + // group-id - The ID of a VPC security group that's associated with the instance. + // + // instance-id - The ID of the instance. + // + // tag:key=value - The key/value combination of a tag assigned to the resource. + // + // tag-key - The key of a tag assigned to the resource. This filter is independent + // of the tag-value filter. For example, if you use both the filter "tag-key=Purpose" + // and the filter "tag-value=X", you get any resources assigned both the tag + // key Purpose (regardless of what the tag's value is), and the tag value X + // (regardless of what the tag's key is). If you want to list only resources + // where Purpose is X, see the tag:key=value filter. + // + // tag-value - The value of a tag assigned to the resource. This filter is + // independent of the tag-key filter. + // + // vpc-id - The ID of the VPC that the instance is linked to. + Filters []*Filter `locationName:"Filter" locationNameList:"Filter" type:"list"` + + // One or more instance IDs. Must be instances linked to a VPC through ClassicLink. + InstanceIDs []*string `locationName:"InstanceId" locationNameList:"InstanceId" type:"list"` + + // The maximum number of results to return for the request in a single page. + // The remaining results of the initial request can be seen by sending another + // request with the returned NextToken value. This value can be between 5 and + // 1000; if MaxResults is given a value larger than 1000, only 1000 results + // are returned. You cannot specify this parameter and the instance IDs parameter + // in the same request. + // + // Constraint: If the value is greater than 1000, we return only 1000 items. + MaxResults *int64 `locationName:"maxResults" type:"integer"` + + // The token to retrieve the next page of results. + NextToken *string `locationName:"nextToken" type:"string"` + + metadataDescribeClassicLinkInstancesInput `json:"-" xml:"-"` +} + +type metadataDescribeClassicLinkInstancesInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type DescribeClassicLinkInstancesOutput struct { + // Information about one or more linked EC2-Classic instances. + Instances []*ClassicLinkInstance `locationName:"instancesSet" locationNameList:"item" type:"list"` + + // The token to use to retrieve the next page of results. This value is null + // when there are no more results to return. + NextToken *string `locationName:"nextToken" type:"string"` + + metadataDescribeClassicLinkInstancesOutput `json:"-" xml:"-"` +} + +type metadataDescribeClassicLinkInstancesOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +type DescribeConversionTasksInput struct { + // One or more conversion task IDs. + ConversionTaskIDs []*string `locationName:"conversionTaskId" locationNameList:"item" type:"list"` + + DryRun *bool `locationName:"dryRun" type:"boolean"` + + Filters []*Filter `locationName:"filter" locationNameList:"Filter" type:"list"` + + metadataDescribeConversionTasksInput `json:"-" xml:"-"` +} + +type metadataDescribeConversionTasksInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type DescribeConversionTasksOutput struct { + ConversionTasks []*ConversionTask `locationName:"conversionTasks" locationNameList:"item" type:"list"` + + metadataDescribeConversionTasksOutput `json:"-" xml:"-"` +} + +type metadataDescribeConversionTasksOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +type DescribeCustomerGatewaysInput struct { + // One or more customer gateway IDs. + // + // Default: Describes all your customer gateways. + CustomerGatewayIDs []*string `locationName:"CustomerGatewayId" locationNameList:"CustomerGatewayId" type:"list"` + + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // One or more filters. + // + // bgp-asn - The customer gateway's Border Gateway Protocol (BGP) Autonomous + // System Number (ASN). + // + // customer-gateway-id - The ID of the customer gateway. + // + // ip-address - The IP address of the customer gateway's Internet-routable + // external interface. + // + // state - The state of the customer gateway (pending | available | deleting + // | deleted). + // + // type - The type of customer gateway. Currently, the only supported type + // is ipsec.1. + // + // tag:key=value - The key/value combination of a tag assigned to the resource. + // + // tag-key - The key of a tag assigned to the resource. This filter is independent + // of the tag-value filter. For example, if you use both the filter "tag-key=Purpose" + // and the filter "tag-value=X", you get any resources assigned both the tag + // key Purpose (regardless of what the tag's value is), and the tag value X + // (regardless of what the tag's key is). If you want to list only resources + // where Purpose is X, see the tag:key=value filter. + // + // tag-value - The value of a tag assigned to the resource. This filter is + // independent of the tag-key filter. + Filters []*Filter `locationName:"Filter" locationNameList:"Filter" type:"list"` + + metadataDescribeCustomerGatewaysInput `json:"-" xml:"-"` +} + +type metadataDescribeCustomerGatewaysInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type DescribeCustomerGatewaysOutput struct { + // Information about one or more customer gateways. + CustomerGateways []*CustomerGateway `locationName:"customerGatewaySet" locationNameList:"item" type:"list"` + + metadataDescribeCustomerGatewaysOutput `json:"-" xml:"-"` +} + +type metadataDescribeCustomerGatewaysOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +type DescribeDHCPOptionsInput struct { + // The IDs of one or more DHCP options sets. + // + // Default: Describes all your DHCP options sets. + DHCPOptionsIDs []*string `locationName:"DhcpOptionsId" locationNameList:"DhcpOptionsId" type:"list"` + + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // One or more filters. + // + // dhcp-options-id - The ID of a set of DHCP options. + // + // key - The key for one of the options (for example, domain-name). + // + // value - The value for one of the options. + // + // tag:key=value - The key/value combination of a tag assigned to the resource. + // + // tag-key - The key of a tag assigned to the resource. This filter is independent + // of the tag-value filter. For example, if you use both the filter "tag-key=Purpose" + // and the filter "tag-value=X", you get any resources assigned both the tag + // key Purpose (regardless of what the tag's value is), and the tag value X + // (regardless of what the tag's key is). If you want to list only resources + // where Purpose is X, see the tag:key=value filter. + // + // tag-value - The value of a tag assigned to the resource. This filter is + // independent of the tag-key filter. + Filters []*Filter `locationName:"Filter" locationNameList:"Filter" type:"list"` + + metadataDescribeDHCPOptionsInput `json:"-" xml:"-"` +} + +type metadataDescribeDHCPOptionsInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type DescribeDHCPOptionsOutput struct { + // Information about one or more DHCP options sets. + DHCPOptions []*DHCPOptions `locationName:"dhcpOptionsSet" locationNameList:"item" type:"list"` + + metadataDescribeDHCPOptionsOutput `json:"-" xml:"-"` +} + +type metadataDescribeDHCPOptionsOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +type DescribeExportTasksInput struct { + // One or more export task IDs. + ExportTaskIDs []*string `locationName:"exportTaskId" locationNameList:"ExportTaskId" type:"list"` + + metadataDescribeExportTasksInput `json:"-" xml:"-"` +} + +type metadataDescribeExportTasksInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type DescribeExportTasksOutput struct { + ExportTasks []*ExportTask `locationName:"exportTaskSet" locationNameList:"item" type:"list"` + + metadataDescribeExportTasksOutput `json:"-" xml:"-"` +} + +type metadataDescribeExportTasksOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +type DescribeImageAttributeInput struct { + // The AMI attribute. + // + // Note: Depending on your account privileges, the blockDeviceMapping attribute + // may return a Client.AuthFailure error. If this happens, use DescribeImages + // to get information about the block device mapping for the AMI. + Attribute *string `type:"string" required:"true"` + + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // The ID of the AMI. + ImageID *string `locationName:"ImageId" type:"string" required:"true"` + + metadataDescribeImageAttributeInput `json:"-" xml:"-"` +} + +type metadataDescribeImageAttributeInput struct { + SDKShapeTraits bool `type:"structure"` +} + +// Describes an image attribute. +type DescribeImageAttributeOutput struct { + // One or more block device mapping entries. + BlockDeviceMappings []*BlockDeviceMapping `locationName:"blockDeviceMapping" locationNameList:"item" type:"list"` + + // A description for the AMI. + Description *AttributeValue `locationName:"description" type:"structure"` + + // The ID of the AMI. + ImageID *string `locationName:"imageId" type:"string"` + + // The kernel ID. + KernelID *AttributeValue `locationName:"kernel" type:"structure"` + + // One or more launch permissions. + LaunchPermissions []*LaunchPermission `locationName:"launchPermission" locationNameList:"item" type:"list"` + + // One or more product codes. + ProductCodes []*ProductCode `locationName:"productCodes" locationNameList:"item" type:"list"` + + // The RAM disk ID. + RAMDiskID *AttributeValue `locationName:"ramdisk" type:"structure"` + + // The value to use for a resource attribute. + SRIOVNetSupport *AttributeValue `locationName:"sriovNetSupport" type:"structure"` + + metadataDescribeImageAttributeOutput `json:"-" xml:"-"` +} + +type metadataDescribeImageAttributeOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +type DescribeImagesInput struct { + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // Scopes the images by users with explicit launch permissions. Specify an AWS + // account ID, self (the sender of the request), or all (public AMIs). + ExecutableUsers []*string `locationName:"ExecutableBy" locationNameList:"ExecutableBy" type:"list"` + + // One or more filters. + // + // architecture - The image architecture (i386 | x86_64). + // + // block-device-mapping.delete-on-termination - A Boolean value that indicates + // whether the Amazon EBS volume is deleted on instance termination. + // + // block-device-mapping.device-name - The device name for the Amazon EBS + // volume (for example, /dev/sdh). + // + // block-device-mapping.snapshot-id - The ID of the snapshot used for the + // Amazon EBS volume. + // + // block-device-mapping.volume-size - The volume size of the Amazon EBS volume, + // in GiB. + // + // block-device-mapping.volume-type - The volume type of the Amazon EBS volume + // (gp2 | standard | io1). + // + // description - The description of the image (provided during image creation). + // + // hypervisor - The hypervisor type (ovm | xen). + // + // image-id - The ID of the image. + // + // image-type - The image type (machine | kernel | ramdisk). + // + // is-public - A Boolean that indicates whether the image is public. + // + // kernel-id - The kernel ID. + // + // manifest-location - The location of the image manifest. + // + // name - The name of the AMI (provided during image creation). + // + // owner-alias - The AWS account alias (for example, amazon). + // + // owner-id - The AWS account ID of the image owner. + // + // platform - The platform. To only list Windows-based AMIs, use windows. + // + // product-code - The product code. + // + // product-code.type - The type of the product code (devpay | marketplace). + // + // ramdisk-id - The RAM disk ID. + // + // root-device-name - The name of the root device volume (for example, /dev/sda1). + // + // root-device-type - The type of the root device volume (ebs | instance-store). + // + // state - The state of the image (available | pending | failed). + // + // state-reason-code - The reason code for the state change. + // + // state-reason-message - The message for the state change. + // + // tag:key=value - The key/value combination of a tag assigned to the resource. + // + // tag-key - The key of a tag assigned to the resource. This filter is independent + // of the tag-value filter. For example, if you use both the filter "tag-key=Purpose" + // and the filter "tag-value=X", you get any resources assigned both the tag + // key Purpose (regardless of what the tag's value is), and the tag value X + // (regardless of what the tag's key is). If you want to list only resources + // where Purpose is X, see the tag:key=value filter. + // + // tag-value - The value of a tag assigned to the resource. This filter is + // independent of the tag-key filter. + // + // virtualization-type - The virtualization type (paravirtual | hvm). + Filters []*Filter `locationName:"Filter" locationNameList:"Filter" type:"list"` + + // One or more image IDs. + // + // Default: Describes all images available to you. + ImageIDs []*string `locationName:"ImageId" locationNameList:"ImageId" type:"list"` + + // Filters the images by the owner. Specify an AWS account ID, amazon (owner + // is Amazon), aws-marketplace (owner is AWS Marketplace), self (owner is the + // sender of the request). Omitting this option returns all images for which + // you have launch permissions, regardless of ownership. + Owners []*string `locationName:"Owner" locationNameList:"Owner" type:"list"` + + metadataDescribeImagesInput `json:"-" xml:"-"` +} + +type metadataDescribeImagesInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type DescribeImagesOutput struct { + // Information about one or more images. + Images []*Image `locationName:"imagesSet" locationNameList:"item" type:"list"` + + metadataDescribeImagesOutput `json:"-" xml:"-"` +} + +type metadataDescribeImagesOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +type DescribeImportImageTasksInput struct { + DryRun *bool `type:"boolean"` + + // Filters to be applied on a describe request. + Filters []*Filter `locationNameList:"Filter" type:"list"` + + // A list of ImportImage task IDs to describe. + ImportTaskIDs []*string `locationName:"ImportTaskId" locationNameList:"ImportTaskId" type:"list"` + + // The maximum number of results in a page. + MaxResults *int64 `type:"integer"` + + // The token to get the next page of paginated describe requests. + NextToken *string `type:"string"` + + metadataDescribeImportImageTasksInput `json:"-" xml:"-"` +} + +type metadataDescribeImportImageTasksInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type DescribeImportImageTasksOutput struct { + // A list of zero or more ImportImage tasks that are currently active or completed/cancelled + // in the previous 7 days. + ImportImageTasks []*ImportImageTask `locationName:"importImageTaskSet" locationNameList:"item" type:"list"` + + // The token to get the next page of paginated describe requests. + NextToken *string `locationName:"nextToken" type:"string"` + + metadataDescribeImportImageTasksOutput `json:"-" xml:"-"` +} + +type metadataDescribeImportImageTasksOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +type DescribeImportSnapshotTasksInput struct { + DryRun *bool `type:"boolean"` + + // The filters to be applied on a describe request. + Filters []*Filter `locationNameList:"Filter" type:"list"` + + // A list of IDs of the ImportSnapshot tasks to describe. + ImportTaskIDs []*string `locationName:"ImportTaskId" locationNameList:"ImportTaskId" type:"list"` + + // The maximum number of results in a page. + MaxResults *int64 `type:"integer"` + + // The token to get to the next page of paginated describe requests. + NextToken *string `type:"string"` + + metadataDescribeImportSnapshotTasksInput `json:"-" xml:"-"` +} + +type metadataDescribeImportSnapshotTasksInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type DescribeImportSnapshotTasksOutput struct { + // A list of zero or more ImportSnapshot tasks that are currently active or + // completed/cancelled in the previous 7 days. + ImportSnapshotTasks []*ImportSnapshotTask `locationName:"importSnapshotTaskSet" locationNameList:"item" type:"list"` + + // The token to get to the next page of paginated describe requests. + NextToken *string `locationName:"nextToken" type:"string"` + + metadataDescribeImportSnapshotTasksOutput `json:"-" xml:"-"` +} + +type metadataDescribeImportSnapshotTasksOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +type DescribeInstanceAttributeInput struct { + // The instance attribute. + Attribute *string `locationName:"attribute" type:"string" required:"true"` + + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // The ID of the instance. + InstanceID *string `locationName:"instanceId" type:"string" required:"true"` + + metadataDescribeInstanceAttributeInput `json:"-" xml:"-"` +} + +type metadataDescribeInstanceAttributeInput struct { + SDKShapeTraits bool `type:"structure"` +} + +// Describes an instance attribute. +type DescribeInstanceAttributeOutput struct { + // The block device mapping of the instance. + BlockDeviceMappings []*InstanceBlockDeviceMapping `locationName:"blockDeviceMapping" locationNameList:"item" type:"list"` + + // If the value is true, you can't terminate the instance through the Amazon + // EC2 console, CLI, or API; otherwise, you can. + DisableAPITermination *AttributeBooleanValue `locationName:"disableApiTermination" type:"structure"` + + // Indicates whether the instance is optimized for EBS I/O. + EBSOptimized *AttributeBooleanValue `locationName:"ebsOptimized" type:"structure"` + + // The security groups associated with the instance. + Groups []*GroupIdentifier `locationName:"groupSet" locationNameList:"item" type:"list"` + + // The ID of the instance. + InstanceID *string `locationName:"instanceId" type:"string"` + + // Indicates whether an instance stops or terminates when you initiate shutdown + // from the instance (using the operating system command for system shutdown). + InstanceInitiatedShutdownBehavior *AttributeValue `locationName:"instanceInitiatedShutdownBehavior" type:"structure"` + + // The instance type. + InstanceType *AttributeValue `locationName:"instanceType" type:"structure"` + + // The kernel ID. + KernelID *AttributeValue `locationName:"kernel" type:"structure"` + + // A list of product codes. + ProductCodes []*ProductCode `locationName:"productCodes" locationNameList:"item" type:"list"` + + // The RAM disk ID. + RAMDiskID *AttributeValue `locationName:"ramdisk" type:"structure"` + + // The name of the root device (for example, /dev/sda1 or /dev/xvda). + RootDeviceName *AttributeValue `locationName:"rootDeviceName" type:"structure"` + + // The value to use for a resource attribute. + SRIOVNetSupport *AttributeValue `locationName:"sriovNetSupport" type:"structure"` + + // Indicates whether source/destination checking is enabled. A value of true + // means checking is enabled, and false means checking is disabled. This value + // must be false for a NAT instance to perform NAT. + SourceDestCheck *AttributeBooleanValue `locationName:"sourceDestCheck" type:"structure"` + + // The Base64-encoded MIME user data. + UserData *AttributeValue `locationName:"userData" type:"structure"` + + metadataDescribeInstanceAttributeOutput `json:"-" xml:"-"` +} + +type metadataDescribeInstanceAttributeOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +type DescribeInstanceStatusInput struct { + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // One or more filters. + // + // availability-zone - The Availability Zone of the instance. + // + // event.code - The code identifying the type of event (instance-reboot | + // system-reboot | system-maintenance | instance-retirement | instance-stop). + // + // event.description - A description of the event. + // + // event.not-after - The latest end time for the scheduled event, for example: + // 2010-09-15T17:15:20.000Z. + // + // event.not-before - The earliest start time for the scheduled event, for + // example: 2010-09-15T17:15:20.000Z. + // + // instance-state-code - A code representing the state of the instance, as + // a 16-bit unsigned integer. The high byte is an opaque internal value and + // should be ignored. The low byte is set based on the state represented. The + // valid values are 0 (pending), 16 (running), 32 (shutting-down), 48 (terminated), + // 64 (stopping), and 80 (stopped). + // + // instance-state-name - The state of the instance (pending | running | shutting-down + // | terminated | stopping | stopped). + // + // instance-status.reachability - Filters on instance status where the name + // is reachability (passed | failed | initializing | insufficient-data). + // + // instance-status.status - The status of the instance (ok | impaired | initializing + // | insufficient-data | not-applicable). + // + // system-status.reachability - Filters on system status where the name is + // reachability (passed | failed | initializing | insufficient-data). + // + // system-status.status - The system status of the instance (ok | impaired + // | initializing | insufficient-data | not-applicable). + Filters []*Filter `locationName:"Filter" locationNameList:"Filter" type:"list"` + + // When true, includes the health status for all instances. When false, includes + // the health status for running instances only. + // + // Default: false + IncludeAllInstances *bool `locationName:"includeAllInstances" type:"boolean"` + + // One or more instance IDs. + // + // Default: Describes all your instances. + // + // Constraints: Maximum 100 explicitly specified instance IDs. + InstanceIDs []*string `locationName:"InstanceId" locationNameList:"InstanceId" type:"list"` + + // The maximum number of results to return for the request in a single page. + // The remaining results of the initial request can be seen by sending another + // request with the returned NextToken value. This value can be between 5 and + // 1000; if MaxResults is given a value larger than 1000, only 1000 results + // are returned. You cannot specify this parameter and the instance IDs parameter + // in the same request. + MaxResults *int64 `type:"integer"` + + // The token to retrieve the next page of results. + NextToken *string `type:"string"` + + metadataDescribeInstanceStatusInput `json:"-" xml:"-"` +} + +type metadataDescribeInstanceStatusInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type DescribeInstanceStatusOutput struct { + // One or more instance status descriptions. + InstanceStatuses []*InstanceStatus `locationName:"instanceStatusSet" locationNameList:"item" type:"list"` + + // The token to use to retrieve the next page of results. This value is null + // when there are no more results to return. + NextToken *string `locationName:"nextToken" type:"string"` + + metadataDescribeInstanceStatusOutput `json:"-" xml:"-"` +} + +type metadataDescribeInstanceStatusOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +type DescribeInstancesInput struct { + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // One or more filters. + // + // architecture - The instance architecture (i386 | x86_64). + // + // availability-zone - The Availability Zone of the instance. + // + // block-device-mapping.attach-time - The attach time for an Amazon EBS volume + // mapped to the instance, for example, 2010-09-15T17:15:20.000Z. + // + // block-device-mapping.delete-on-termination - A Boolean that indicates + // whether the Amazon EBS volume is deleted on instance termination. + // + // block-device-mapping.device-name - The device name for the Amazon EBS + // volume (for example, /dev/sdh or xvdh). + // + // block-device-mapping.status - The status for the Amazon EBS volume (attaching + // | attached | detaching | detached). + // + // block-device-mapping.volume-id - The volume ID of the Amazon EBS volume. + // + // client-token - The idempotency token you provided when you launched the + // instance. + // + // dns-name - The public DNS name of the instance. + // + // group-id - The ID of the security group for the instance. EC2-Classic + // only. + // + // group-name - The name of the security group for the instance. EC2-Classic + // only. + // + // hypervisor - The hypervisor type of the instance (ovm | xen). + // + // iam-instance-profile.arn - The instance profile associated with the instance. + // Specified as an ARN. + // + // image-id - The ID of the image used to launch the instance. + // + // instance-id - The ID of the instance. + // + // instance-lifecycle - Indicates whether this is a Spot Instance (spot). + // + // 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. + // The low byte is set based on the state represented. The valid values are: + // 0 (pending), 16 (running), 32 (shutting-down), 48 (terminated), 64 (stopping), + // and 80 (stopped). + // + // instance-state-name - The state of the instance (pending | running | shutting-down + // | terminated | stopping | stopped). + // + // instance-type - The type of instance (for example, t2.micro). + // + // instance.group-id - The ID of the security group for the instance. + // + // instance.group-name - The name of the security group for the instance. + // + // ip-address - The public IP address of the instance. + // + // kernel-id - The kernel ID. + // + // key-name - The name of the key pair used when the instance was launched. + // + // launch-index - When launching multiple instances, this is the index for + // the instance in the launch group (for example, 0, 1, 2, and so on). + // + // launch-time - The time when the instance was launched. + // + // monitoring-state - Indicates whether monitoring is enabled for the instance + // (disabled | enabled). + // + // owner-id - The AWS account ID of the instance owner. + // + // placement-group-name - The name of the placement group for the instance. + // + // platform - The platform. Use windows if you have Windows instances; otherwise, + // leave blank. + // + // private-dns-name - The private DNS name of the instance. + // + // private-ip-address - The private IP address of the instance. + // + // product-code - The product code associated with the AMI used to launch + // the instance. + // + // product-code.type - The type of product code (devpay | marketplace). + // + // ramdisk-id - The RAM disk ID. + // + // reason - The reason for the current state of the instance (for example, + // shows "User Initiated [date]" when you stop or terminate the instance). Similar + // to the state-reason-code filter. + // + // requester-id - The ID of the entity that launched the instance on your + // behalf (for example, AWS Management Console, Auto Scaling, and so on). + // + // reservation-id - The ID of the instance's reservation. A reservation ID + // is created any time you launch an instance. A reservation ID has a one-to-one + // relationship with an instance launch request, but can be associated with + // more than one instance if you launch multiple instances using the same launch + // request. For example, if you launch one instance, you'll get one reservation + // ID. If you launch ten instances using the same launch request, you'll also + // get one reservation ID. + // + // root-device-name - The name of the root device for the instance (for example, + // /dev/sda1 or /dev/xvda). + // + // root-device-type - The type of root device that the instance uses (ebs + // | instance-store). + // + // source-dest-check - Indicates whether the instance performs source/destination + // checking. A value of true means that checking is enabled, and false means + // checking is disabled. The value must be false for the instance to perform + // network address translation (NAT) in your VPC. + // + // spot-instance-request-id - The ID of the Spot Instance request. + // + // state-reason-code - The reason code for the state change. + // + // state-reason-message - A message that describes the state change. + // + // subnet-id - The ID of the subnet for the instance. + // + // tag:key=value - The key/value combination of a tag assigned to the resource, + // where tag:key is the tag's key. + // + // tag-key - The key of a tag assigned to the resource. This filter is independent + // of the tag-value filter. For example, if you use both the filter "tag-key=Purpose" + // and the filter "tag-value=X", you get any resources assigned both the tag + // key Purpose (regardless of what the tag's value is), and the tag value X + // (regardless of what the tag's key is). If you want to list only resources + // where Purpose is X, see the tag:key=value filter. + // + // tag-value - The value of a tag assigned to the resource. This filter is + // independent of the tag-key filter. + // + // tenancy - The tenancy of an instance (dedicated | default). + // + // virtualization-type - The virtualization type of the instance (paravirtual + // | hvm). + // + // vpc-id - The ID of the VPC that the instance is running in. + // + // network-interface.description - The description of the network interface. + // + // network-interface.subnet-id - The ID of the subnet for the network interface. + // + // network-interface.vpc-id - The ID of the VPC for the network interface. + // + // network-interface.network-interface.id - The ID of the network interface. + // + // network-interface.owner-id - The ID of the owner of the network interface. + // + // network-interface.availability-zone - The Availability Zone for the network + // interface. + // + // network-interface.requester-id - The requester ID for the network interface. + // + // network-interface.requester-managed - Indicates whether the network interface + // is being managed by AWS. + // + // network-interface.status - The status of the network interface (available) + // | in-use). + // + // network-interface.mac-address - The MAC address of the network interface. + // + // network-interface-private-dns-name - The private DNS name of the network + // interface. + // + // network-interface.source-dest-check - Whether the network interface performs + // source/destination checking. A value of true means checking is enabled, and + // false means checking is disabled. The value must be false for the network + // interface to perform network address translation (NAT) in your VPC. + // + // network-interface.group-id - The ID of a security group associated with + // the network interface. + // + // network-interface.group-name - The name of a security group associated + // with the network interface. + // + // network-interface.attachment.attachment-id - The ID of the interface attachment. + // + // network-interface.attachment.instance-id - The ID of the instance to which + // the network interface is attached. + // + // network-interface.attachment.instance-owner-id - The owner ID of the instance + // to which the network interface is attached. + // + // network-interface.addresses.private-ip-address - The private IP address + // associated with the network interface. + // + // network-interface.attachment.device-index - The device index to which + // the network interface is attached. + // + // network-interface.attachment.status - The status of the attachment (attaching + // | attached | detaching | detached). + // + // network-interface.attachment.attach-time - The time that the network interface + // was attached to an instance. + // + // network-interface.attachment.delete-on-termination - Specifies whether + // the attachment is deleted when an instance is terminated. + // + // network-interface.addresses.primary - Specifies whether the IP address + // of the network interface is the primary private IP address. + // + // network-interface.addresses.association.public-ip - The ID of the association + // of an Elastic IP address with a network interface. + // + // network-interface.addresses.association.ip-owner-id - The owner ID of + // the private IP address associated with the network interface. + // + // association.public-ip - The address of the Elastic IP address bound to + // the network interface. + // + // association.ip-owner-id - The owner of the Elastic IP address associated + // with the network interface. + // + // association.allocation-id - The allocation ID returned when you allocated + // the Elastic IP address for your network interface. + // + // association.association-id - The association ID returned when the network + // interface was associated with an IP address. + Filters []*Filter `locationName:"Filter" locationNameList:"Filter" type:"list"` + + // One or more instance IDs. + // + // Default: Describes all your instances. + InstanceIDs []*string `locationName:"InstanceId" locationNameList:"InstanceId" type:"list"` + + // The maximum number of results to return for the request in a single page. + // The remaining results of the initial request can be seen by sending another + // request with the returned NextToken value. This value can be between 5 and + // 1000; if MaxResults is given a value larger than 1000, only 1000 results + // are returned. You cannot specify this parameter and the instance IDs parameter + // in the same request. + MaxResults *int64 `locationName:"maxResults" type:"integer"` + + // The token to request the next page of results. + NextToken *string `locationName:"nextToken" type:"string"` + + metadataDescribeInstancesInput `json:"-" xml:"-"` +} + +type metadataDescribeInstancesInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type DescribeInstancesOutput struct { + // The token to use to retrieve the next page of results. This value is null + // when there are no more results to return. + NextToken *string `locationName:"nextToken" type:"string"` + + // One or more reservations. + Reservations []*Reservation `locationName:"reservationSet" locationNameList:"item" type:"list"` + + metadataDescribeInstancesOutput `json:"-" xml:"-"` +} + +type metadataDescribeInstancesOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +type DescribeInternetGatewaysInput struct { + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // One or more filters. + // + // attachment.state - The current state of the attachment between the gateway + // and the VPC (available). Present only if a VPC is attached. + // + // attachment.vpc-id - The ID of an attached VPC. + // + // internet-gateway-id - The ID of the Internet gateway. + // + // tag:key=value - The key/value combination of a tag assigned to the resource. + // + // tag-key - The key of a tag assigned to the resource. This filter is independent + // of the tag-value filter. For example, if you use both the filter "tag-key=Purpose" + // and the filter "tag-value=X", you get any resources assigned both the tag + // key Purpose (regardless of what the tag's value is), and the tag value X + // (regardless of what the tag's key is). If you want to list only resources + // where Purpose is X, see the tag:key=value filter. + // + // tag-value - The value of a tag assigned to the resource. This filter is + // independent of the tag-key filter. + Filters []*Filter `locationName:"Filter" locationNameList:"Filter" type:"list"` + + // One or more Internet gateway IDs. + // + // Default: Describes all your Internet gateways. + InternetGatewayIDs []*string `locationName:"internetGatewayId" locationNameList:"item" type:"list"` + + metadataDescribeInternetGatewaysInput `json:"-" xml:"-"` +} + +type metadataDescribeInternetGatewaysInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type DescribeInternetGatewaysOutput struct { + // Information about one or more Internet gateways. + InternetGateways []*InternetGateway `locationName:"internetGatewaySet" locationNameList:"item" type:"list"` + + metadataDescribeInternetGatewaysOutput `json:"-" xml:"-"` +} + +type metadataDescribeInternetGatewaysOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +type DescribeKeyPairsInput struct { + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // One or more filters. + // + // fingerprint - The fingerprint of the key pair. + // + // key-name - The name of the key pair. + Filters []*Filter `locationName:"Filter" locationNameList:"Filter" type:"list"` + + // One or more key pair names. + // + // Default: Describes all your key pairs. + KeyNames []*string `locationName:"KeyName" locationNameList:"KeyName" type:"list"` + + metadataDescribeKeyPairsInput `json:"-" xml:"-"` +} + +type metadataDescribeKeyPairsInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type DescribeKeyPairsOutput struct { + // Information about one or more key pairs. + KeyPairs []*KeyPairInfo `locationName:"keySet" locationNameList:"item" type:"list"` + + metadataDescribeKeyPairsOutput `json:"-" xml:"-"` +} + +type metadataDescribeKeyPairsOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +type DescribeNetworkACLsInput struct { + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // One or more filters. + // + // association.association-id - The ID of an association ID for the ACL. + // + // association.network-acl-id - The ID of the network ACL involved in the + // association. + // + // association.subnet-id - The ID of the subnet involved in the association. + // + // default - Indicates whether the ACL is the default network ACL for the + // VPC. + // + // entry.cidr - The CIDR range specified in the entry. + // + // entry.egress - Indicates whether the entry applies to egress traffic. + // + // entry.icmp.code - The ICMP code specified in the entry, if any. + // + // entry.icmp.type - The ICMP type specified in the entry, if any. + // + // entry.port-range.from - The start of the port range specified in the entry. + // + // entry.port-range.to - The end of the port range specified in the entry. + // + // entry.protocol - The protocol specified in the entry (tcp | udp | icmp + // or a protocol number). + // + // entry.rule-action - Allows or denies the matching traffic (allow | deny). + // + // entry.rule-number - The number of an entry (in other words, rule) in the + // ACL's set of entries. + // + // network-acl-id - The ID of the network ACL. + // + // tag:key=value - The key/value combination of a tag assigned to the resource. + // + // tag-key - The key of a tag assigned to the resource. This filter is independent + // of the tag-value filter. For example, if you use both the filter "tag-key=Purpose" + // and the filter "tag-value=X", you get any resources assigned both the tag + // key Purpose (regardless of what the tag's value is), and the tag value X + // (regardless of what the tag's key is). If you want to list only resources + // where Purpose is X, see the tag:key=value filter. + // + // tag-value - The value of a tag assigned to the resource. This filter is + // independent of the tag-key filter. + // + // vpc-id - The ID of the VPC for the network ACL. + Filters []*Filter `locationName:"Filter" locationNameList:"Filter" type:"list"` + + // One or more network ACL IDs. + // + // Default: Describes all your network ACLs. + NetworkACLIDs []*string `locationName:"NetworkAclId" locationNameList:"item" type:"list"` + + metadataDescribeNetworkACLsInput `json:"-" xml:"-"` +} + +type metadataDescribeNetworkACLsInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type DescribeNetworkACLsOutput struct { + // Information about one or more network ACLs. + NetworkACLs []*NetworkACL `locationName:"networkAclSet" locationNameList:"item" type:"list"` + + metadataDescribeNetworkACLsOutput `json:"-" xml:"-"` +} + +type metadataDescribeNetworkACLsOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +type DescribeNetworkInterfaceAttributeInput struct { + // The attribute of the network interface. + Attribute *string `locationName:"attribute" type:"string"` + + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // The ID of the network interface. + NetworkInterfaceID *string `locationName:"networkInterfaceId" type:"string" required:"true"` + + metadataDescribeNetworkInterfaceAttributeInput `json:"-" xml:"-"` +} + +type metadataDescribeNetworkInterfaceAttributeInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type DescribeNetworkInterfaceAttributeOutput struct { + // The attachment (if any) of the network interface. + Attachment *NetworkInterfaceAttachment `locationName:"attachment" type:"structure"` + + // The description of the network interface. + Description *AttributeValue `locationName:"description" type:"structure"` + + // The security groups associated with the network interface. + Groups []*GroupIdentifier `locationName:"groupSet" locationNameList:"item" type:"list"` + + // The ID of the network interface. + NetworkInterfaceID *string `locationName:"networkInterfaceId" type:"string"` + + // Indicates whether source/destination checking is enabled. + SourceDestCheck *AttributeBooleanValue `locationName:"sourceDestCheck" type:"structure"` + + metadataDescribeNetworkInterfaceAttributeOutput `json:"-" xml:"-"` +} + +type metadataDescribeNetworkInterfaceAttributeOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +type DescribeNetworkInterfacesInput struct { + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // One or more filters. + // + // addresses.private-ip-address - The private IP addresses associated with + // the network interface. + // + // addresses.primary - Whether the private IP address is the primary IP address + // associated with the network interface. + // + // addresses.association.public-ip - The association ID returned when the + // network interface was associated with the Elastic IP address. + // + // addresses.association.owner-id - The owner ID of the addresses associated + // with the network interface. + // + // association.association-id - The association ID returned when the network + // interface was associated with an IP address. + // + // association.allocation-id - The allocation ID returned when you allocated + // the Elastic IP address for your network interface. + // + // association.ip-owner-id - The owner of the Elastic IP address associated + // with the network interface. + // + // association.public-ip - The address of the Elastic IP address bound to + // the network interface. + // + // association.public-dns-name - The public DNS name for the network interface. + // + // attachment.attachment-id - The ID of the interface attachment. + // + // attachment.instance-id - The ID of the instance to which the network interface + // is attached. + // + // attachment.instance-owner-id - The owner ID of the instance to which the + // network interface is attached. + // + // attachment.device-index - The device index to which the network interface + // is attached. + // + // attachment.status - The status of the attachment (attaching | attached + // | detaching | detached). + // + // attachment.attach.time - The time that the network interface was attached + // to an instance. + // + // attachment.delete-on-termination - Indicates whether the attachment is + // deleted when an instance is terminated. + // + // availability-zone - The Availability Zone of the network interface. + // + // description - The description of the network interface. + // + // group-id - The ID of a security group associated with the network interface. + // + // group-name - The name of a security group associated with the network + // interface. + // + // mac-address - The MAC address of the network interface. + // + // network-interface-id - The ID of the network interface. + // + // owner-id - The AWS account ID of the network interface owner. + // + // private-ip-address - The private IP address or addresses of the network + // interface. + // + // private-dns-name - The private DNS name of the network interface. + // + // requester-id - The ID of the entity that launched the instance on your + // behalf (for example, AWS Management Console, Auto Scaling, and so on). + // + // requester-managed - Indicates whether the network interface is being managed + // by an AWS service (for example, AWS Management Console, Auto Scaling, and + // so on). + // + // source-desk-check - Indicates whether the network interface performs source/destination + // checking. A value of true means checking is enabled, and false means checking + // is disabled. The value must be false for the network interface to perform + // Network Address Translation (NAT) in your VPC. + // + // status - The status of the network interface. If the network interface + // is not attached to an instance, the status is available; if a network interface + // is attached to an instance the status is in-use. + // + // subnet-id - The ID of the subnet for the network interface. + // + // tag:key=value - The key/value combination of a tag assigned to the resource. + // + // tag-key - The key of a tag assigned to the resource. This filter is independent + // of the tag-value filter. For example, if you use both the filter "tag-key=Purpose" + // and the filter "tag-value=X", you get any resources assigned both the tag + // key Purpose (regardless of what the tag's value is), and the tag value X + // (regardless of what the tag's key is). If you want to list only resources + // where Purpose is X, see the tag:key=value filter. + // + // tag-value - The value of a tag assigned to the resource. This filter is + // independent of the tag-key filter. + // + // vpc-id - The ID of the VPC for the network interface. + Filters []*Filter `locationName:"filter" locationNameList:"Filter" type:"list"` + + // One or more network interface IDs. + // + // Default: Describes all your network interfaces. + NetworkInterfaceIDs []*string `locationName:"NetworkInterfaceId" locationNameList:"item" type:"list"` + + metadataDescribeNetworkInterfacesInput `json:"-" xml:"-"` +} + +type metadataDescribeNetworkInterfacesInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type DescribeNetworkInterfacesOutput struct { + // Information about one or more network interfaces. + NetworkInterfaces []*NetworkInterface `locationName:"networkInterfaceSet" locationNameList:"item" type:"list"` + + metadataDescribeNetworkInterfacesOutput `json:"-" xml:"-"` +} + +type metadataDescribeNetworkInterfacesOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +type DescribePlacementGroupsInput struct { + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // One or more filters. + // + // group-name - The name of the placement group. + // + // state - The state of the placement group (pending | available | deleting + // | deleted). + // + // strategy - The strategy of the placement group (cluster). + Filters []*Filter `locationName:"Filter" locationNameList:"Filter" type:"list"` + + // One or more placement group names. + // + // Default: Describes all your placement groups, or only those otherwise specified. + GroupNames []*string `locationName:"groupName" type:"list"` + + metadataDescribePlacementGroupsInput `json:"-" xml:"-"` +} + +type metadataDescribePlacementGroupsInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type DescribePlacementGroupsOutput struct { + // One or more placement groups. + PlacementGroups []*PlacementGroup `locationName:"placementGroupSet" locationNameList:"item" type:"list"` + + metadataDescribePlacementGroupsOutput `json:"-" xml:"-"` +} + +type metadataDescribePlacementGroupsOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +type DescribeRegionsInput struct { + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // One or more filters. + // + // endpoint - The endpoint of the region (for example, ec2.us-east-1.amazonaws.com). + // + // region-name - The name of the region (for example, us-east-1). + Filters []*Filter `locationName:"Filter" locationNameList:"Filter" type:"list"` + + // The names of one or more regions. + RegionNames []*string `locationName:"RegionName" locationNameList:"RegionName" type:"list"` + + metadataDescribeRegionsInput `json:"-" xml:"-"` +} + +type metadataDescribeRegionsInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type DescribeRegionsOutput struct { + // Information about one or more regions. + Regions []*Region `locationName:"regionInfo" locationNameList:"item" type:"list"` + + metadataDescribeRegionsOutput `json:"-" xml:"-"` +} + +type metadataDescribeRegionsOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +type DescribeReservedInstancesInput struct { + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // One or more filters. + // + // availability-zone - The Availability Zone where the Reserved Instance + // can be used. + // + // 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, 2014-08-07T11:54:42.000Z). + // + // fixed-price - The purchase price of the Reserved Instance (for example, + // 9800.0). + // + // instance-type - The instance type on which the Reserved Instance can be + // used. + // + // product-description - The product description of the Reserved Instance + // (Linux/UNIX | Linux/UNIX (Amazon VPC) | Windows | Windows (Amazon VPC)). + // + // reserved-instances-id - The ID of the Reserved Instance. + // + // 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 (pending-payment | active | + // payment-failed | retired). + // + // tag:key=value - The key/value combination of a tag assigned to the resource. + // + // tag-key - The key of a tag assigned to the resource. This filter is independent + // of the tag-value filter. For example, if you use both the filter "tag-key=Purpose" + // and the filter "tag-value=X", you get any resources assigned both the tag + // key Purpose (regardless of what the tag's value is), and the tag value X + // (regardless of what the tag's key is). If you want to list only resources + // where Purpose is X, see the tag:key=value filter. + // + // 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 + // example, 0.84). + Filters []*Filter `locationName:"Filter" locationNameList:"Filter" type:"list"` + + // 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. + OfferingType *string `locationName:"offeringType" type:"string"` + + // One or more Reserved Instance IDs. + // + // Default: Describes all your Reserved Instances, or only those otherwise + // specified. + ReservedInstancesIDs []*string `locationName:"ReservedInstancesId" locationNameList:"ReservedInstancesId" type:"list"` + + metadataDescribeReservedInstancesInput `json:"-" xml:"-"` +} + +type metadataDescribeReservedInstancesInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type DescribeReservedInstancesListingsInput struct { + // One or more filters. + // + // reserved-instances-id - The ID of the Reserved Instances. + // + // reserved-instances-listing-id - The ID of the Reserved Instances listing. + // + // 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. + ReservedInstancesID *string `locationName:"reservedInstancesId" type:"string"` + + // One or more Reserved Instance Listing IDs. + ReservedInstancesListingID *string `locationName:"reservedInstancesListingId" type:"string"` + + metadataDescribeReservedInstancesListingsInput `json:"-" xml:"-"` +} + +type metadataDescribeReservedInstancesListingsInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type DescribeReservedInstancesListingsOutput struct { + // Information about the Reserved Instance listing. + ReservedInstancesListings []*ReservedInstancesListing `locationName:"reservedInstancesListingsSet" locationNameList:"item" type:"list"` + + metadataDescribeReservedInstancesListingsOutput `json:"-" xml:"-"` +} + +type metadataDescribeReservedInstancesListingsOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +type DescribeReservedInstancesModificationsInput struct { + // One or more filters. + // + // client-token - The idempotency token for the modification request. + // + // create-date - The time when the modification request was created. + // + // effective-date - The time when the modification becomes effective. + // + // 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. + // + // modification-result.target-configuration.instance-count - The number + // of new Reserved Instances. + // + // modification-result.target-configuration.instance-type - The instance + // type of the new Reserved Instances. + // + // modification-result.target-configuration.platform - The network platform + // of the new Reserved Instances (EC2-Classic | EC2-VPC). + // + // 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 + // | fulfilled | failed). + // + // status-message - The reason for the status. + // + // update-date - The time when the modification request was last updated. + Filters []*Filter `locationName:"Filter" locationNameList:"Filter" type:"list"` + + // The token to retrieve the next page of results. + NextToken *string `locationName:"nextToken" type:"string"` + + // IDs for the submitted modification request. + ReservedInstancesModificationIDs []*string `locationName:"ReservedInstancesModificationId" locationNameList:"ReservedInstancesModificationId" type:"list"` + + metadataDescribeReservedInstancesModificationsInput `json:"-" xml:"-"` +} + +type metadataDescribeReservedInstancesModificationsInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type DescribeReservedInstancesModificationsOutput struct { + // The token to use to retrieve the next page of results. This value is null + // when there are no more results to return. + NextToken *string `locationName:"nextToken" type:"string"` + + // The Reserved Instance modification information. + ReservedInstancesModifications []*ReservedInstancesModification `locationName:"reservedInstancesModificationsSet" locationNameList:"item" type:"list"` + + metadataDescribeReservedInstancesModificationsOutput `json:"-" xml:"-"` +} + +type metadataDescribeReservedInstancesModificationsOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +type DescribeReservedInstancesOfferingsInput struct { + // The Availability Zone in which the Reserved Instance can be used. + AvailabilityZone *string `type:"string"` + + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // One or more filters. + // + // availability-zone - The Availability Zone where the Reserved Instance + // can be used. + // + // 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, + // 9800.0). + // + // instance-type - The instance type on which the Reserved Instance can be + // used. + // + // marketplace - Set to true to show only Reserved Instance Marketplace offerings. + // When this filter is not used, which is the default behavior, all offerings + // from AWS and Reserved Instance Marketplace are listed. + // + // product-description - The description of the Reserved Instance (Linux/UNIX + // | Linux/UNIX (Amazon VPC) | Windows | Windows (Amazon VPC)). + // + // reserved-instances-offering-id - The Reserved Instances offering ID. + // + // usage-price - The usage price of the Reserved Instance, per hour (for + // example, 0.84). + Filters []*Filter `locationName:"Filter" locationNameList:"Filter" type:"list"` + + // Include Marketplace offerings in the response. + IncludeMarketplace *bool `type:"boolean"` + + // The tenancy of the Reserved Instance offering. A Reserved Instance with dedicated + // tenancy runs on single-tenant hardware and can only be launched within a + // VPC. + // + // Default: default + InstanceTenancy *string `locationName:"instanceTenancy" type:"string"` + + // The instance type on which the Reserved Instance can be used. For more information, + // see Instance Types (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-types.html) + // in the Amazon Elastic Compute Cloud User Guide. + InstanceType *string `type:"string"` + + // The maximum duration (in seconds) to filter when searching for offerings. + // + // Default: 94608000 (3 years) + MaxDuration *int64 `type:"long"` + + // The maximum number of instances to filter when searching for offerings. + // + // Default: 20 + MaxInstanceCount *int64 `type:"integer"` + + // The maximum number of results to return for the request in a single page. + // The remaining results of the initial request can be seen by sending another + // request with the returned NextToken value. The maximum is 100. + // + // Default: 100 + MaxResults *int64 `locationName:"maxResults" type:"integer"` + + // The minimum duration (in seconds) to filter when searching for offerings. + // + // Default: 2592000 (1 month) + MinDuration *int64 `type:"long"` + + // 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 2011-11-01 API version, you only have access to the Medium Utilization + // Reserved Instance offering type. + OfferingType *string `locationName:"offeringType" type:"string"` + + // The Reserved Instance description. Instances that include (Amazon VPC) in + // the description are for use with Amazon VPC. + ProductDescription *string `type:"string"` + + // One or more Reserved Instances offering IDs. + ReservedInstancesOfferingIDs []*string `locationName:"ReservedInstancesOfferingId" type:"list"` + + metadataDescribeReservedInstancesOfferingsInput `json:"-" xml:"-"` +} + +type metadataDescribeReservedInstancesOfferingsInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type DescribeReservedInstancesOfferingsOutput struct { + // The token to use to retrieve the next page of results. This value is null + // when there are no more results to return. + NextToken *string `locationName:"nextToken" type:"string"` + + // A list of Reserved Instances offerings. + ReservedInstancesOfferings []*ReservedInstancesOffering `locationName:"reservedInstancesOfferingsSet" locationNameList:"item" type:"list"` + + metadataDescribeReservedInstancesOfferingsOutput `json:"-" xml:"-"` +} + +type metadataDescribeReservedInstancesOfferingsOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +type DescribeReservedInstancesOutput struct { + // A list of Reserved Instances. + ReservedInstances []*ReservedInstances `locationName:"reservedInstancesSet" locationNameList:"item" type:"list"` + + metadataDescribeReservedInstancesOutput `json:"-" xml:"-"` +} + +type metadataDescribeReservedInstancesOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +type DescribeRouteTablesInput struct { + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // One or more filters. + // + // association.route-table-association-id - The ID of an association ID for + // the route table. + // + // association.route-table-id - The ID of the route table involved in the + // association. + // + // association.subnet-id - The ID of the subnet involved in the association. + // + // association.main - Indicates whether the route table is the main route + // table for the VPC. + // + // route-table-id - The ID of the route table. + // + // route.destination-cidr-block - The CIDR range specified in a route in + // the table. + // + // route.gateway-id - The ID of a gateway specified in a route in the table. + // + // route.instance-id - The ID of an instance specified in a route in the + // table. + // + // route.origin - Describes how the route was created. CreateRouteTable indicates + // that the route was automatically created when the route table was created; + // CreateRoute indicates that the route was manually added to the route table; + // EnableVgwRoutePropagation indicates that the route was propagated by route + // propagation. + // + // route.state - The state of a route in the route table (active | blackhole). + // The blackhole state indicates that the route's target isn't available (for + // example, the specified gateway isn't attached to the VPC, the specified NAT + // instance has been terminated, and so on). + // + // route.vpc-peering-connection-id - The ID of a VPC peering connection specified + // in a route in the table. + // + // tag:key=value - The key/value combination of a tag assigned to the resource. + // + // tag-key - The key of a tag assigned to the resource. This filter is independent + // of the tag-value filter. For example, if you use both the filter "tag-key=Purpose" + // and the filter "tag-value=X", you get any resources assigned both the tag + // key Purpose (regardless of what the tag's value is), and the tag value X + // (regardless of what the tag's key is). If you want to list only resources + // where Purpose is X, see the tag:key=value filter. + // + // tag-value - The value of a tag assigned to the resource. This filter is + // independent of the tag-key filter. + // + // vpc-id - The ID of the VPC for the route table. + Filters []*Filter `locationName:"Filter" locationNameList:"Filter" type:"list"` + + // One or more route table IDs. + // + // Default: Describes all your route tables. + RouteTableIDs []*string `locationName:"RouteTableId" locationNameList:"item" type:"list"` + + metadataDescribeRouteTablesInput `json:"-" xml:"-"` +} + +type metadataDescribeRouteTablesInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type DescribeRouteTablesOutput struct { + // Information about one or more route tables. + RouteTables []*RouteTable `locationName:"routeTableSet" locationNameList:"item" type:"list"` + + metadataDescribeRouteTablesOutput `json:"-" xml:"-"` +} + +type metadataDescribeRouteTablesOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +type DescribeSecurityGroupsInput struct { + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // One or more filters. + // + // description - The description of the security group. + // + // 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"` + + metadataDescribeSecurityGroupsInput `json:"-" xml:"-"` +} + +type metadataDescribeSecurityGroupsInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type DescribeSecurityGroupsOutput struct { + // Information about one or more security groups. + SecurityGroups []*SecurityGroup `locationName:"securityGroupInfo" locationNameList:"item" type:"list"` + + metadataDescribeSecurityGroupsOutput `json:"-" xml:"-"` +} + +type metadataDescribeSecurityGroupsOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +type DescribeSnapshotAttributeInput struct { + // The snapshot attribute you would like to view. + Attribute *string `type:"string" required:"true"` + + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // The ID of the Amazon EBS snapshot. + SnapshotID *string `locationName:"SnapshotId" type:"string" required:"true"` + + metadataDescribeSnapshotAttributeInput `json:"-" xml:"-"` +} + +type metadataDescribeSnapshotAttributeInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type DescribeSnapshotAttributeOutput struct { + // A list of permissions for creating volumes from the snapshot. + CreateVolumePermissions []*CreateVolumePermission `locationName:"createVolumePermission" locationNameList:"item" type:"list"` + + // A list of product codes. + ProductCodes []*ProductCode `locationName:"productCodes" locationNameList:"item" type:"list"` + + // The ID of the Amazon EBS snapshot. + SnapshotID *string `locationName:"snapshotId" type:"string"` + + metadataDescribeSnapshotAttributeOutput `json:"-" xml:"-"` +} + +type metadataDescribeSnapshotAttributeOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +type DescribeSnapshotsInput struct { + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // One or more filters. + // + // description - A description of the snapshot. + // + // owner-alias - The AWS account alias (for example, amazon) that owns the + // snapshot. + // + // owner-id - The ID of the AWS account that owns the snapshot. + // + // progress - The progress of the snapshot, as a percentage (for example, + // 80%). + // + // snapshot-id - The snapshot ID. + // + // start-time - The time stamp when the snapshot was initiated. + // + // status - The status of the snapshot (pending | completed | error). + // + // tag:key=value - The key/value combination of a tag assigned to the resource. + // + // tag-key - The key of a tag assigned to the resource. This filter is independent + // of the tag-value filter. For example, if you use both the filter "tag-key=Purpose" + // and the filter "tag-value=X", you get any resources assigned both the tag + // key Purpose (regardless of what the tag's value is), and the tag value X + // (regardless of what the tag's key is). If you want to list only resources + // where Purpose is X, see the tag:key=value filter. + // + // tag-value - The value of a tag assigned to the resource. This filter is + // independent of the tag-key filter. + // + // volume-id - The ID of the volume the snapshot is for. + // + // volume-size - The size of the volume, in GiB. + Filters []*Filter `locationName:"Filter" locationNameList:"Filter" type:"list"` + + // The maximum number of snapshot results returned by DescribeSnapshots in paginated + // output. When this parameter is used, DescribeSnapshots only returns MaxResults + // results in a single page along with a NextToken response element. The remaining + // results of the initial request can be seen by sending another DescribeSnapshots + // request with the returned NextToken value. This value can be between 5 and + // 1000; if MaxResults is given a value larger than 1000, only 1000 results + // are returned. If this parameter is not used, then DescribeSnapshots returns + // all results. You cannot specify this parameter and the snapshot IDs parameter + // in the same request. + MaxResults *int64 `type:"integer"` + + // The NextToken value returned from a previous paginated DescribeSnapshots + // request where MaxResults was used and the results exceeded the value of that + // parameter. Pagination continues from the end of the previous results that + // returned the NextToken value. This value is null when there are no more results + // to return. + NextToken *string `type:"string"` + + // Returns the snapshots owned by the specified owner. Multiple owners can be + // specified. + OwnerIDs []*string `locationName:"Owner" locationNameList:"Owner" type:"list"` + + // One or more AWS accounts IDs that can create volumes from the snapshot. + RestorableByUserIDs []*string `locationName:"RestorableBy" type:"list"` + + // One or more snapshot IDs. + // + // Default: Describes snapshots for which you have launch permissions. + SnapshotIDs []*string `locationName:"SnapshotId" locationNameList:"SnapshotId" type:"list"` + + metadataDescribeSnapshotsInput `json:"-" xml:"-"` +} + +type metadataDescribeSnapshotsInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type DescribeSnapshotsOutput struct { + // The NextToken value to include in a future DescribeSnapshots request. When + // the results of a DescribeSnapshots request exceed MaxResults, this value + // can be used to retrieve the next page of results. This value is null when + // there are no more results to return. + NextToken *string `locationName:"nextToken" type:"string"` + + Snapshots []*Snapshot `locationName:"snapshotSet" locationNameList:"item" type:"list"` + + metadataDescribeSnapshotsOutput `json:"-" xml:"-"` +} + +type metadataDescribeSnapshotsOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +type DescribeSpotDatafeedSubscriptionInput struct { + DryRun *bool `locationName:"dryRun" type:"boolean"` + + metadataDescribeSpotDatafeedSubscriptionInput `json:"-" xml:"-"` +} + +type metadataDescribeSpotDatafeedSubscriptionInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type DescribeSpotDatafeedSubscriptionOutput struct { + // The Spot Instance data feed subscription. + SpotDatafeedSubscription *SpotDatafeedSubscription `locationName:"spotDatafeedSubscription" type:"structure"` + + metadataDescribeSpotDatafeedSubscriptionOutput `json:"-" xml:"-"` +} + +type metadataDescribeSpotDatafeedSubscriptionOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +type DescribeSpotInstanceRequestsInput struct { + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // One or more filters. + // + // availability-zone-group - The Availability Zone group. + // + // create-time - The time stamp when the Spot Instance request was created. + // + // fault-code - The fault code related to the request. + // + // fault-message - The fault message related to the request. + // + // instance-id - The ID of the instance that fulfilled the request. + // + // launch-group - The Spot Instance launch group. + // + // launch.block-device-mapping.delete-on-termination - Indicates whether + // the Amazon EBS volume is deleted on instance termination. + // + // launch.block-device-mapping.device-name - The device name for the Amazon + // EBS volume (for example, /dev/sdh). + // + // launch.block-device-mapping.snapshot-id - The ID of the snapshot used + // for the Amazon EBS volume. + // + // launch.block-device-mapping.volume-size - The size of the Amazon EBS volume, + // in GiB. + // + // launch.block-device-mapping.volume-type - The type of the Amazon EBS volume + // (gp2 | standard | io1). + // + // launch.group-id - The security group for the instance. + // + // launch.image-id - The ID of the AMI. + // + // launch.instance-type - The type of instance (for example, m1.small). + // + // launch.kernel-id - The kernel ID. + // + // launch.key-name - The name of the key pair the instance launched with. + // + // launch.monitoring-enabled - Whether monitoring is enabled for the Spot + // Instance. + // + // launch.ramdisk-id - The RAM disk ID. + // + // network-interface.network-interface-id - The ID of the network interface. + // + // network-interface.device-index - The index of the device for the network + // interface attachment on the instance. + // + // network-interface.subnet-id - The ID of the subnet for the instance. + // + // network-interface.description - A description of the network interface. + // + // network-interface.private-ip-address - The primary private IP address + // of the network interface. + // + // network-interface.delete-on-termination - Indicates whether the network + // interface is deleted when the instance is terminated. + // + // network-interface.group-id - The ID of the security group associated with + // the network interface. + // + // network-interface.group-name - The name of the security group associated + // with the network interface. + // + // network-interface.addresses.primary - Indicates whether the IP address + // is the primary private IP address. + // + // product-description - The product description associated with the instance + // (Linux/UNIX | Windows). + // + // spot-instance-request-id - The Spot Instance request ID. + // + // spot-price - The maximum hourly price for any Spot Instance launched to + // fulfill the request. + // + // state - The state of the Spot Instance request (open | active | closed + // | cancelled | failed). Spot bid status information can help you track your + // Amazon EC2 Spot Instance requests. For more information, see Spot Bid Status + // (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/spot-bid-status.html) + // in the Amazon Elastic Compute Cloud User Guide. + // + // status-code - The short code describing the most recent evaluation of + // your Spot Instance request. + // + // status-message - The message explaining the status of the Spot Instance + // request. + // + // tag:key=value - The key/value combination of a tag assigned to the resource. + // + // tag-key - The key of a tag assigned to the resource. This filter is independent + // of the tag-value filter. For example, if you use both the filter "tag-key=Purpose" + // and the filter "tag-value=X", you get any resources assigned both the tag + // key Purpose (regardless of what the tag's value is), and the tag value X + // (regardless of what the tag's key is). If you want to list only resources + // where Purpose is X, see the tag:key=value filter. + // + // tag-value - The value of a tag assigned to the resource. This filter is + // independent of the tag-key filter. + // + // type - The type of Spot Instance request (one-time | persistent). + // + // launched-availability-zone - The Availability Zone in which the bid is + // launched. + // + // valid-from - The start date of the request. + // + // valid-until - The end date of the request. + Filters []*Filter `locationName:"Filter" locationNameList:"Filter" type:"list"` + + // One or more Spot Instance request IDs. + SpotInstanceRequestIDs []*string `locationName:"SpotInstanceRequestId" locationNameList:"SpotInstanceRequestId" type:"list"` + + metadataDescribeSpotInstanceRequestsInput `json:"-" xml:"-"` +} + +type metadataDescribeSpotInstanceRequestsInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type DescribeSpotInstanceRequestsOutput struct { + // One or more Spot Instance requests. + SpotInstanceRequests []*SpotInstanceRequest `locationName:"spotInstanceRequestSet" locationNameList:"item" type:"list"` + + metadataDescribeSpotInstanceRequestsOutput `json:"-" xml:"-"` +} + +type metadataDescribeSpotInstanceRequestsOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +type DescribeSpotPriceHistoryInput struct { + // Filters the results by the specified Availability Zone. + AvailabilityZone *string `locationName:"availabilityZone" type:"string"` + + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // The date and time, up to the current date, from which to stop retrieving + // the price history data. + EndTime *time.Time `locationName:"endTime" type:"timestamp" timestampFormat:"iso8601"` + + // One or more filters. + // + // availability-zone - The Availability Zone for which prices should be returned. + // + // instance-type - The type of instance (for example, m1.small). + // + // product-description - The product description for the Spot Price (Linux/UNIX + // | SUSE Linux | Windows | Linux/UNIX (Amazon VPC) | SUSE Linux (Amazon VPC) + // | Windows (Amazon VPC)). + // + // spot-price - The Spot Price. The value must match exactly (or use wildcards; + // greater than or less than comparison is not supported). + // + // timestamp - The timestamp of the Spot Price history (for example, 2010-08-16T05:06:11.000Z). + // You can use wildcards (* and ?). Greater than or less than comparison is + // not supported. + Filters []*Filter `locationName:"Filter" locationNameList:"Filter" type:"list"` + + // Filters the results by the specified instance types. + InstanceTypes []*string `locationName:"InstanceType" type:"list"` + + // The maximum number of results to return for the request in a single page. + // The remaining results of the initial request can be seen by sending another + // request with the returned NextToken value. This value can be between 5 and + // 1000; if MaxResults is given a value larger than 1000, only 1000 results + // are returned. + MaxResults *int64 `locationName:"maxResults" type:"integer"` + + // The token to retrieve the next page of results. + NextToken *string `locationName:"nextToken" type:"string"` + + // Filters the results by the specified basic product descriptions. + ProductDescriptions []*string `locationName:"ProductDescription" type:"list"` + + // The date and time, up to the past 90 days, from which to start retrieving + // the price history data. + StartTime *time.Time `locationName:"startTime" type:"timestamp" timestampFormat:"iso8601"` + + metadataDescribeSpotPriceHistoryInput `json:"-" xml:"-"` +} + +type metadataDescribeSpotPriceHistoryInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type DescribeSpotPriceHistoryOutput struct { + // The token to use to retrieve the next page of results. This value is null + // when there are no more results to return. + NextToken *string `locationName:"nextToken" type:"string"` + + // The historical Spot Prices. + SpotPriceHistory []*SpotPrice `locationName:"spotPriceHistorySet" locationNameList:"item" type:"list"` + + metadataDescribeSpotPriceHistoryOutput `json:"-" xml:"-"` +} + +type metadataDescribeSpotPriceHistoryOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +type DescribeSubnetsInput struct { + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // One or more filters. + // + // availabilityZone - The Availability Zone for the subnet. You can also + // use availability-zone as the filter name. + // + // available-ip-address-count - The number of IP addresses in the subnet + // that are available. + // + // cidrBlock - The CIDR block of the subnet. The CIDR block you specify must + // exactly match the subnet's CIDR block for information to be returned for + // the subnet. You can also use cidr or cidr-block as the filter names. + // + // defaultForAz - Indicates whether this is the default subnet for the Availability + // Zone. You can also use default-for-az as the filter name. + // + // state - The state of the subnet (pending | available). + // + // subnet-id - The ID of the subnet. + // + // tag:key=value - The key/value combination of a tag assigned to the resource. + // + // tag-key - The key of a tag assigned to the resource. This filter is independent + // of the tag-value filter. For example, if you use both the filter "tag-key=Purpose" + // and the filter "tag-value=X", you get any resources assigned both the tag + // key Purpose (regardless of what the tag's value is), and the tag value X + // (regardless of what the tag's key is). If you want to list only resources + // where Purpose is X, see the tag:key=value filter. + // + // tag-value - The value of a tag assigned to the resource. This filter is + // independent of the tag-key filter. + // + // vpc-id - The ID of the VPC for the subnet. + Filters []*Filter `locationName:"Filter" locationNameList:"Filter" type:"list"` + + // One or more subnet IDs. + // + // Default: Describes all your subnets. + SubnetIDs []*string `locationName:"SubnetId" locationNameList:"SubnetId" type:"list"` + + metadataDescribeSubnetsInput `json:"-" xml:"-"` +} + +type metadataDescribeSubnetsInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type DescribeSubnetsOutput struct { + // Information about one or more subnets. + Subnets []*Subnet `locationName:"subnetSet" locationNameList:"item" type:"list"` + + metadataDescribeSubnetsOutput `json:"-" xml:"-"` +} + +type metadataDescribeSubnetsOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +type DescribeTagsInput struct { + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // One or more filters. + // + // key - The tag key. + // + // resource-id - The resource ID. + // + // resource-type - The resource type (customer-gateway | dhcp-options | image + // | instance | internet-gateway | network-acl | network-interface | reserved-instances + // | route-table | security-group | snapshot | spot-instances-request | subnet + // | volume | vpc | vpn-connection | vpn-gateway). + // + // value - The tag value. + Filters []*Filter `locationName:"Filter" locationNameList:"Filter" type:"list"` + + // The maximum number of results to return for the request in a single page. + // The remaining results of the initial request can be seen by sending another + // request with the returned NextToken value. This value can be between 5 and + // 1000; if MaxResults is given a value larger than 1000, only 1000 results + // are returned. + MaxResults *int64 `locationName:"maxResults" type:"integer"` + + // The token to retrieve the next page of results. + NextToken *string `locationName:"nextToken" type:"string"` + + metadataDescribeTagsInput `json:"-" xml:"-"` +} + +type metadataDescribeTagsInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type DescribeTagsOutput struct { + // The token to use to retrieve the next page of results. This value is null + // when there are no more results to return.. + NextToken *string `locationName:"nextToken" type:"string"` + + // A list of tags. + Tags []*TagDescription `locationName:"tagSet" locationNameList:"item" type:"list"` + + metadataDescribeTagsOutput `json:"-" xml:"-"` +} + +type metadataDescribeTagsOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +type DescribeVPCAttributeInput struct { + // The VPC attribute. + Attribute *string `type:"string"` + + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // The ID of the VPC. + VPCID *string `locationName:"VpcId" type:"string" required:"true"` + + metadataDescribeVPCAttributeInput `json:"-" xml:"-"` +} + +type metadataDescribeVPCAttributeInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type DescribeVPCAttributeOutput struct { + // Indicates whether the instances launched in the VPC get DNS hostnames. If + // this attribute is true, instances in the VPC get DNS hostnames; otherwise, + // they do not. + EnableDNSHostnames *AttributeBooleanValue `locationName:"enableDnsHostnames" type:"structure"` + + // Indicates whether DNS resolution is enabled for the VPC. If this attribute + // is true, the Amazon DNS server resolves DNS hostnames for your instances + // to their corresponding IP addresses; otherwise, it does not. + EnableDNSSupport *AttributeBooleanValue `locationName:"enableDnsSupport" type:"structure"` + + // The ID of the VPC. + VPCID *string `locationName:"vpcId" type:"string"` + + metadataDescribeVPCAttributeOutput `json:"-" xml:"-"` +} + +type metadataDescribeVPCAttributeOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +type DescribeVPCClassicLinkInput struct { + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // One or more filters. + // + // is-classic-link-enabled - Whether the VPC is enabled for ClassicLink (true + // | false). + // + // tag:key=value - The key/value combination of a tag assigned to the resource. + // + // tag-key - The key of a tag assigned to the resource. This filter is independent + // of the tag-value filter. For example, if you use both the filter "tag-key=Purpose" + // and the filter "tag-value=X", you get any resources assigned both the tag + // key Purpose (regardless of what the tag's value is), and the tag value X + // (regardless of what the tag's key is). If you want to list only resources + // where Purpose is X, see the tag:key=value filter. + // + // tag-value - The value of a tag assigned to the resource. This filter is + // independent of the tag-key filter. + Filters []*Filter `locationName:"Filter" locationNameList:"Filter" type:"list"` + + // One or more VPCs for which you want to describe the ClassicLink status. + VPCIDs []*string `locationName:"VpcId" locationNameList:"VpcId" type:"list"` + + metadataDescribeVPCClassicLinkInput `json:"-" xml:"-"` +} + +type metadataDescribeVPCClassicLinkInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type DescribeVPCClassicLinkOutput struct { + // The ClassicLink status of one or more VPCs. + VPCs []*VPCClassicLink `locationName:"vpcSet" locationNameList:"item" type:"list"` + + metadataDescribeVPCClassicLinkOutput `json:"-" xml:"-"` +} + +type metadataDescribeVPCClassicLinkOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +type DescribeVPCPeeringConnectionsInput struct { + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // One or more filters. + // + // accepter-vpc-info.cidr-block - The CIDR block of the peer VPC. + // + // accepter-vpc-info.owner-id - The AWS account ID of the owner of the peer + // VPC. + // + // accepter-vpc-info.vpc-id - The ID of the peer VPC. + // + // expiration-time - The expiration date and time for the VPC peering connection. + // + // requester-vpc-info.cidr-block - The CIDR block of the requester's VPC. + // + // requester-vpc-info.owner-id - The AWS account ID of the owner of the requester + // VPC. + // + // requester-vpc-info.vpc-id - The ID of the requester VPC. + // + // status-code - The status of the VPC peering connection (pending-acceptance + // | failed | expired | provisioning | active | deleted | rejected). + // + // status-message - A message that provides more information about the status + // of the VPC peering connection, if applicable. + // + // tag:key=value - The key/value combination of a tag assigned to the resource. + // + // tag-key - The key of a tag assigned to the resource. This filter is independent + // of the tag-value filter. For example, if you use both the filter "tag-key=Purpose" + // and the filter "tag-value=X", you get any resources assigned both the tag + // key Purpose (regardless of what the tag's value is), and the tag value X + // (regardless of what the tag's key is). If you want to list only resources + // where Purpose is X, see the tag:key=value filter. + // + // tag-value - The value of a tag assigned to the resource. This filter is + // independent of the tag-key filter. + // + // vpc-peering-connection-id - The ID of the VPC peering connection. + Filters []*Filter `locationName:"Filter" locationNameList:"Filter" type:"list"` + + // One or more VPC peering connection IDs. + // + // Default: Describes all your VPC peering connections. + VPCPeeringConnectionIDs []*string `locationName:"VpcPeeringConnectionId" locationNameList:"item" type:"list"` + + metadataDescribeVPCPeeringConnectionsInput `json:"-" xml:"-"` +} + +type metadataDescribeVPCPeeringConnectionsInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type DescribeVPCPeeringConnectionsOutput struct { + // Information about the VPC peering connections. + VPCPeeringConnections []*VPCPeeringConnection `locationName:"vpcPeeringConnectionSet" locationNameList:"item" type:"list"` + + metadataDescribeVPCPeeringConnectionsOutput `json:"-" xml:"-"` +} + +type metadataDescribeVPCPeeringConnectionsOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +type DescribeVPCsInput struct { + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // One or more filters. + // + // cidr - The CIDR block of the VPC. The CIDR block you specify must exactly + // match the VPC's CIDR block for information to be returned for the VPC. Must + // contain the slash followed by one or two digits (for example, /28). + // + // dhcp-options-id - The ID of a set of DHCP options. + // + // isDefault - Indicates whether the VPC is the default VPC. + // + // state - The state of the VPC (pending | available). + // + // tag:key=value - The key/value combination of a tag assigned to the resource. + // + // tag-key - The key of a tag assigned to the resource. This filter is independent + // of the tag-value filter. For example, if you use both the filter "tag-key=Purpose" + // and the filter "tag-value=X", you get any resources assigned both the tag + // key Purpose (regardless of what the tag's value is), and the tag value X + // (regardless of what the tag's key is). If you want to list only resources + // where Purpose is X, see the tag:key=value filter. + // + // tag-value - The value of a tag assigned to the resource. This filter is + // independent of the tag-key filter. + // + // vpc-id - The ID of the VPC. + Filters []*Filter `locationName:"Filter" locationNameList:"Filter" type:"list"` + + // One or more VPC IDs. + // + // Default: Describes all your VPCs. + VPCIDs []*string `locationName:"VpcId" locationNameList:"VpcId" type:"list"` + + metadataDescribeVPCsInput `json:"-" xml:"-"` +} + +type metadataDescribeVPCsInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type DescribeVPCsOutput struct { + // Information about one or more VPCs. + VPCs []*VPC `locationName:"vpcSet" locationNameList:"item" type:"list"` + + metadataDescribeVPCsOutput `json:"-" xml:"-"` +} + +type metadataDescribeVPCsOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +type DescribeVPNConnectionsInput struct { + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // One or more filters. + // + // customer-gateway-configuration - The configuration information for the + // customer gateway. + // + // customer-gateway-id - The ID of a customer gateway associated with the + // VPN connection. + // + // state - The state of the VPN connection (pending | available | deleting + // | deleted). + // + // option.static-routes-only - Indicates whether the connection has static + // routes only. Used for devices that do not support Border Gateway Protocol + // (BGP). + // + // route.destination-cidr-block - The destination CIDR block. This corresponds + // to the subnet used in a customer data center. + // + // bgp-asn - The BGP Autonomous System Number (ASN) associated with a BGP + // device. + // + // tag:key=value - The key/value combination of a tag assigned to the resource. + // + // tag-key - The key of a tag assigned to the resource. This filter is independent + // of the tag-value filter. For example, if you use both the filter "tag-key=Purpose" + // and the filter "tag-value=X", you get any resources assigned both the tag + // key Purpose (regardless of what the tag's value is), and the tag value X + // (regardless of what the tag's key is). If you want to list only resources + // where Purpose is X, see the tag:key=value filter. + // + // tag-value - The value of a tag assigned to the resource. This filter is + // independent of the tag-key filter. + // + // type - The type of VPN connection. Currently the only supported type is + // ipsec.1. + // + // vpn-connection-id - The ID of the VPN connection. + // + // vpn-gateway-id - The ID of a virtual private gateway associated with the + // VPN connection. + Filters []*Filter `locationName:"Filter" locationNameList:"Filter" type:"list"` + + // One or more VPN connection IDs. + // + // Default: Describes your VPN connections. + VPNConnectionIDs []*string `locationName:"VpnConnectionId" locationNameList:"VpnConnectionId" type:"list"` + + metadataDescribeVPNConnectionsInput `json:"-" xml:"-"` +} + +type metadataDescribeVPNConnectionsInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type DescribeVPNConnectionsOutput struct { + // Information about one or more VPN connections. + VPNConnections []*VPNConnection `locationName:"vpnConnectionSet" locationNameList:"item" type:"list"` + + metadataDescribeVPNConnectionsOutput `json:"-" xml:"-"` +} + +type metadataDescribeVPNConnectionsOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +type DescribeVPNGatewaysInput struct { + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // One or more filters. + // + // attachment.state - The current state of the attachment between the gateway + // and the VPC (attaching | attached | detaching | detached). + // + // attachment.vpc-id - The ID of an attached VPC. + // + // availability-zone - The Availability Zone for the virtual private gateway. + // + // state - The state of the virtual private gateway (pending | available + // | deleting | deleted). + // + // tag:key=value - The key/value combination of a tag assigned to the resource. + // + // tag-key - The key of a tag assigned to the resource. This filter is independent + // of the tag-value filter. For example, if you use both the filter "tag-key=Purpose" + // and the filter "tag-value=X", you get any resources assigned both the tag + // key Purpose (regardless of what the tag's value is), and the tag value X + // (regardless of what the tag's key is). If you want to list only resources + // where Purpose is X, see the tag:key=value filter. + // + // tag-value - The value of a tag assigned to the resource. This filter is + // independent of the tag-key filter. + // + // type - The type of virtual private gateway. Currently the only supported + // type is ipsec.1. + // + // vpn-gateway-id - The ID of the virtual private gateway. + Filters []*Filter `locationName:"Filter" locationNameList:"Filter" type:"list"` + + // One or more virtual private gateway IDs. + // + // Default: Describes all your virtual private gateways. + VPNGatewayIDs []*string `locationName:"VpnGatewayId" locationNameList:"VpnGatewayId" type:"list"` + + metadataDescribeVPNGatewaysInput `json:"-" xml:"-"` +} + +type metadataDescribeVPNGatewaysInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type DescribeVPNGatewaysOutput struct { + // Information about one or more virtual private gateways. + VPNGateways []*VPNGateway `locationName:"vpnGatewaySet" locationNameList:"item" type:"list"` + + metadataDescribeVPNGatewaysOutput `json:"-" xml:"-"` +} + +type metadataDescribeVPNGatewaysOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +type DescribeVolumeAttributeInput struct { + // The instance attribute. + Attribute *string `type:"string"` + + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // The ID of the volume. + VolumeID *string `locationName:"VolumeId" type:"string" required:"true"` + + metadataDescribeVolumeAttributeInput `json:"-" xml:"-"` +} + +type metadataDescribeVolumeAttributeInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type DescribeVolumeAttributeOutput struct { + // The state of autoEnableIO attribute. + AutoEnableIO *AttributeBooleanValue `locationName:"autoEnableIO" type:"structure"` + + // A list of product codes. + ProductCodes []*ProductCode `locationName:"productCodes" locationNameList:"item" type:"list"` + + // The ID of the volume. + VolumeID *string `locationName:"volumeId" type:"string"` + + metadataDescribeVolumeAttributeOutput `json:"-" xml:"-"` +} + +type metadataDescribeVolumeAttributeOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +type DescribeVolumeStatusInput struct { + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // One or more filters. + // + // action.code - The action code for the event (for example, enable-volume-io). + // + // action.description - A description of the action. + // + // action.event-id - The event ID associated with the action. + // + // availability-zone - The Availability Zone of the instance. + // + // event.description - A description of the event. + // + // event.event-id - The event ID. + // + // event.event-type - The event type (for io-enabled: passed | failed; for + // io-performance: io-performance:degraded | io-performance:severely-degraded + // | io-performance:stalled). + // + // event.not-after - The latest end time for the event. + // + // event.not-before - The earliest start time for the event. + // + // volume-status.details-name - The cause for volume-status.status (io-enabled + // | io-performance). + // + // volume-status.details-status - The status of volume-status.details-name + // (for io-enabled: passed | failed; for io-performance: normal | degraded | + // severely-degraded | stalled). + // + // volume-status.status - The status of the volume (ok | impaired | warning + // | insufficient-data). + Filters []*Filter `locationName:"Filter" locationNameList:"Filter" type:"list"` + + // The maximum number of volume results returned by DescribeVolumeStatus in + // paginated output. When this parameter is used, the request only returns MaxResults + // results in a single page along with a NextToken response element. The remaining + // results of the initial request can be seen by sending another request with + // the returned NextToken value. This value can be between 5 and 1000; if MaxResults + // is given a value larger than 1000, only 1000 results are returned. If this + // parameter is not used, then DescribeVolumeStatus returns all results. You + // cannot specify this parameter and the volume IDs parameter in the same request. + MaxResults *int64 `type:"integer"` + + // The NextToken value to include in a future DescribeVolumeStatus request. + // When the results of the request exceed MaxResults, this value can be used + // to retrieve the next page of results. This value is null when there are no + // more results to return. + NextToken *string `type:"string"` + + // One or more volume IDs. + // + // Default: Describes all your volumes. + VolumeIDs []*string `locationName:"VolumeId" locationNameList:"VolumeId" type:"list"` + + metadataDescribeVolumeStatusInput `json:"-" xml:"-"` +} + +type metadataDescribeVolumeStatusInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type DescribeVolumeStatusOutput struct { + // The token to use to retrieve the next page of results. This value is null + // when there are no more results to return. + NextToken *string `locationName:"nextToken" type:"string"` + + // A list of volumes. + VolumeStatuses []*VolumeStatusItem `locationName:"volumeStatusSet" locationNameList:"item" type:"list"` + + metadataDescribeVolumeStatusOutput `json:"-" xml:"-"` +} + +type metadataDescribeVolumeStatusOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +type DescribeVolumesInput struct { + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // One or more filters. + // + // attachment.attach-time - The time stamp when the attachment initiated. + // + // attachment.delete-on-termination - Whether the volume is deleted on instance + // termination. + // + // attachment.device - The device name that is exposed to the instance (for + // example, /dev/sda1). + // + // attachment.instance-id - The ID of the instance the volume is attached + // to. + // + // attachment.status - The attachment state (attaching | attached | detaching + // | detached). + // + // availability-zone - The Availability Zone in which the volume was created. + // + // create-time - The time stamp when the volume was created. + // + // encrypted - The encryption status of the volume. + // + // size - The size of the volume, in GiB. + // + // snapshot-id - The snapshot from which the volume was created. + // + // status - The status of the volume (creating | available | in-use | deleting + // | deleted | error). + // + // tag:key=value - The key/value combination of a tag assigned to the resource. + // + // tag-key - The key of a tag assigned to the resource. This filter is independent + // of the tag-value filter. For example, if you use both the filter "tag-key=Purpose" + // and the filter "tag-value=X", you get any resources assigned both the tag + // key Purpose (regardless of what the tag's value is), and the tag value X + // (regardless of what the tag's key is). If you want to list only resources + // where Purpose is X, see the tag:key=value filter. + // + // tag-value - The value of a tag assigned to the resource. This filter is + // independent of the tag-key filter. + // + // volume-id - The volume ID. + // + // volume-type - The Amazon EBS volume type. This can be gp2 for General + // Purpose (SSD) volumes, io1 for Provisioned IOPS (SSD) volumes, or standard + // for Magnetic volumes. + Filters []*Filter `locationName:"Filter" locationNameList:"Filter" type:"list"` + + // The maximum number of volume results returned by DescribeVolumes in paginated + // output. When this parameter is used, DescribeVolumes only returns MaxResults + // results in a single page along with a NextToken response element. The remaining + // results of the initial request can be seen by sending another DescribeVolumes + // request with the returned NextToken value. This value can be between 5 and + // 1000; if MaxResults is given a value larger than 1000, only 1000 results + // are returned. If this parameter is not used, then DescribeVolumes returns + // all results. You cannot specify this parameter and the volume IDs parameter + // in the same request. + MaxResults *int64 `locationName:"maxResults" type:"integer"` + + // The NextToken value returned from a previous paginated DescribeVolumes request + // where MaxResults was used and the results exceeded the value of that parameter. + // Pagination continues from the end of the previous results that returned the + // NextToken value. This value is null when there are no more results to return. + NextToken *string `locationName:"nextToken" type:"string"` + + // One or more volume IDs. + VolumeIDs []*string `locationName:"VolumeId" locationNameList:"VolumeId" type:"list"` + + metadataDescribeVolumesInput `json:"-" xml:"-"` +} + +type metadataDescribeVolumesInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type DescribeVolumesOutput struct { + // The NextToken value to include in a future DescribeVolumes request. When + // the results of a DescribeVolumes request exceed MaxResults, this value can + // be used to retrieve the next page of results. This value is null when there + // are no more results to return. + NextToken *string `locationName:"nextToken" type:"string"` + + Volumes []*Volume `locationName:"volumeSet" locationNameList:"item" type:"list"` + + metadataDescribeVolumesOutput `json:"-" xml:"-"` +} + +type metadataDescribeVolumesOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +type DetachClassicLinkVPCInput struct { + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // The ID of the instance to unlink from the VPC. + InstanceID *string `locationName:"instanceId" type:"string" required:"true"` + + // The ID of the VPC to which the instance is linked. + VPCID *string `locationName:"vpcId" type:"string" required:"true"` + + metadataDetachClassicLinkVPCInput `json:"-" xml:"-"` +} + +type metadataDetachClassicLinkVPCInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type DetachClassicLinkVPCOutput struct { + // Returns true if the request succeeds; otherwise, it returns an error. + Return *bool `locationName:"return" type:"boolean"` + + metadataDetachClassicLinkVPCOutput `json:"-" xml:"-"` +} + +type metadataDetachClassicLinkVPCOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +type DetachInternetGatewayInput struct { + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // The ID of the Internet gateway. + InternetGatewayID *string `locationName:"internetGatewayId" type:"string" required:"true"` + + // The ID of the VPC. + VPCID *string `locationName:"vpcId" type:"string" required:"true"` + + metadataDetachInternetGatewayInput `json:"-" xml:"-"` +} + +type metadataDetachInternetGatewayInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type DetachInternetGatewayOutput struct { + metadataDetachInternetGatewayOutput `json:"-" xml:"-"` +} + +type metadataDetachInternetGatewayOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +type DetachNetworkInterfaceInput struct { + // The ID of the attachment. + AttachmentID *string `locationName:"attachmentId" type:"string" required:"true"` + + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // Specifies whether to force a detachment. + Force *bool `locationName:"force" type:"boolean"` + + metadataDetachNetworkInterfaceInput `json:"-" xml:"-"` +} + +type metadataDetachNetworkInterfaceInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type DetachNetworkInterfaceOutput struct { + metadataDetachNetworkInterfaceOutput `json:"-" xml:"-"` +} + +type metadataDetachNetworkInterfaceOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +type DetachVPNGatewayInput struct { + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // The ID of the VPC. + VPCID *string `locationName:"VpcId" type:"string" required:"true"` + + // The ID of the virtual private gateway. + VPNGatewayID *string `locationName:"VpnGatewayId" type:"string" required:"true"` + + metadataDetachVPNGatewayInput `json:"-" xml:"-"` +} + +type metadataDetachVPNGatewayInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type DetachVPNGatewayOutput struct { + metadataDetachVPNGatewayOutput `json:"-" xml:"-"` +} + +type metadataDetachVPNGatewayOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +type DetachVolumeInput struct { + // The device name. + Device *string `type:"string"` + + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // Forces detachment if the previous detachment attempt did not occur cleanly + // (for example, logging into an instance, unmounting the volume, and detaching + // normally). This option can lead to data loss or a corrupted file system. + // Use this option only as a last resort to detach a volume from a failed instance. + // The instance won't have an opportunity to flush file system caches or file + // system metadata. If you use this option, you must perform file system check + // and repair procedures. + Force *bool `type:"boolean"` + + // The ID of the instance. + InstanceID *string `locationName:"InstanceId" type:"string"` + + // The ID of the volume. + VolumeID *string `locationName:"VolumeId" type:"string" required:"true"` + + metadataDetachVolumeInput `json:"-" xml:"-"` +} + +type metadataDetachVolumeInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type DisableVGWRoutePropagationInput struct { + // The ID of the virtual private gateway. + GatewayID *string `locationName:"GatewayId" type:"string" required:"true"` + + // The ID of the route table. + RouteTableID *string `locationName:"RouteTableId" type:"string" required:"true"` + + metadataDisableVGWRoutePropagationInput `json:"-" xml:"-"` +} + +type metadataDisableVGWRoutePropagationInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type DisableVGWRoutePropagationOutput struct { + metadataDisableVGWRoutePropagationOutput `json:"-" xml:"-"` +} + +type metadataDisableVGWRoutePropagationOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +type DisableVPCClassicLinkInput struct { + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // The ID of the VPC. + VPCID *string `locationName:"vpcId" type:"string" required:"true"` + + metadataDisableVPCClassicLinkInput `json:"-" xml:"-"` +} + +type metadataDisableVPCClassicLinkInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type DisableVPCClassicLinkOutput struct { + // Returns true if the request succeeds; otherwise, it returns an error. + Return *bool `locationName:"return" type:"boolean"` + + metadataDisableVPCClassicLinkOutput `json:"-" xml:"-"` +} + +type metadataDisableVPCClassicLinkOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +type DisassociateAddressInput struct { + // [EC2-VPC] The association ID. Required for EC2-VPC. + AssociationID *string `locationName:"AssociationId" type:"string"` + + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // [EC2-Classic] The Elastic IP address. Required for EC2-Classic. + PublicIP *string `locationName:"PublicIp" type:"string"` + + metadataDisassociateAddressInput `json:"-" xml:"-"` +} + +type metadataDisassociateAddressInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type DisassociateAddressOutput struct { + metadataDisassociateAddressOutput `json:"-" xml:"-"` +} + +type metadataDisassociateAddressOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +type DisassociateRouteTableInput struct { + // The association ID representing the current association between the route + // table and subnet. + AssociationID *string `locationName:"associationId" type:"string" required:"true"` + + DryRun *bool `locationName:"dryRun" type:"boolean"` + + metadataDisassociateRouteTableInput `json:"-" xml:"-"` +} + +type metadataDisassociateRouteTableInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type DisassociateRouteTableOutput struct { + metadataDisassociateRouteTableOutput `json:"-" xml:"-"` +} + +type metadataDisassociateRouteTableOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +// Describes a disk image. +type DiskImage struct { + Description *string `type:"string"` + + Image *DiskImageDetail `type:"structure"` + + // Describes an Amazon EBS volume. + Volume *VolumeDetail `type:"structure"` + + metadataDiskImage `json:"-" xml:"-"` +} + +type metadataDiskImage struct { + SDKShapeTraits bool `type:"structure"` +} + +type DiskImageDescription struct { + // The checksum computed for the disk image. + Checksum *string `locationName:"checksum" type:"string"` + + // The disk image format. + Format *string `locationName:"format" type:"string" required:"true"` + + // A presigned URL for the import manifest stored in Amazon S3. For information + // about creating a presigned 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. + ImportManifestURL *string `locationName:"importManifestUrl" type:"string" required:"true"` + + // The size of the disk image. + Size *int64 `locationName:"size" type:"long" required:"true"` + + metadataDiskImageDescription `json:"-" xml:"-"` +} + +type metadataDiskImageDescription struct { + SDKShapeTraits bool `type:"structure"` +} + +type DiskImageDetail struct { + Bytes *int64 `locationName:"bytes" type:"long" required:"true"` + + // The disk image format. + Format *string `locationName:"format" type:"string" required:"true"` + + // A presigned URL for the import manifest stored in Amazon S3 and presented + // here as an Amazon S3 presigned URL. For information about creating a presigned + // 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. + ImportManifestURL *string `locationName:"importManifestUrl" type:"string" required:"true"` + + metadataDiskImageDetail `json:"-" xml:"-"` +} + +type metadataDiskImageDetail struct { + SDKShapeTraits bool `type:"structure"` +} + +type DiskImageVolumeDescription struct { + // The volume identifier. + ID *string `locationName:"id" type:"string" required:"true"` + + // The size of the volume. + Size *int64 `locationName:"size" type:"long"` + + metadataDiskImageVolumeDescription `json:"-" xml:"-"` +} + +type metadataDiskImageVolumeDescription struct { + SDKShapeTraits bool `type:"structure"` +} + +// Describes an Amazon EBS block device. +type EBSBlockDevice struct { + // Indicates whether the Amazon EBS volume is deleted on instance termination. + DeleteOnTermination *bool `locationName:"deleteOnTermination" type:"boolean"` + + // Indicates whether the Amazon EBS volume is encrypted. Encrypted Amazon EBS + // volumes may only be attached to instances that support Amazon EBS encryption. + Encrypted *bool `locationName:"encrypted" 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 on 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 `locationName:"iops" type:"integer"` + + // The ID of the snapshot. + SnapshotID *string `locationName:"snapshotId" type:"string"` + + // The size of the volume, in GiB. + // + // Constraints: 1-1024 for standard volumes, 1-16384 for gp2 volumes, and 4-16384 + // for io1 volumes. If you specify a snapshot, the volume size must be equal + // to or larger than the snapshot size. + // + // 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 `locationName:"volumeSize" 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 `locationName:"volumeType" type:"string"` + + metadataEBSBlockDevice `json:"-" xml:"-"` +} + +type metadataEBSBlockDevice struct { + SDKShapeTraits bool `type:"structure"` +} + +// Describes a parameter used to set up an Amazon EBS volume in a block device +// mapping. +type EBSInstanceBlockDevice struct { + // The time stamp when the attachment initiated. + AttachTime *time.Time `locationName:"attachTime" type:"timestamp" timestampFormat:"iso8601"` + + // Indicates whether the volume is deleted on instance termination. + DeleteOnTermination *bool `locationName:"deleteOnTermination" type:"boolean"` + + // The attachment state. + Status *string `locationName:"status" type:"string"` + + // The ID of the Amazon EBS volume. + VolumeID *string `locationName:"volumeId" type:"string"` + + metadataEBSInstanceBlockDevice `json:"-" xml:"-"` +} + +type metadataEBSInstanceBlockDevice struct { + SDKShapeTraits bool `type:"structure"` +} + +type EBSInstanceBlockDeviceSpecification struct { + // Indicates whether the volume is deleted on instance termination. + DeleteOnTermination *bool `locationName:"deleteOnTermination" type:"boolean"` + + // The ID of the Amazon EBS volume. + VolumeID *string `locationName:"volumeId" type:"string"` + + metadataEBSInstanceBlockDeviceSpecification `json:"-" xml:"-"` +} + +type metadataEBSInstanceBlockDeviceSpecification struct { + SDKShapeTraits bool `type:"structure"` +} + +type EnableVGWRoutePropagationInput struct { + // The ID of the virtual private gateway. + GatewayID *string `locationName:"GatewayId" type:"string" required:"true"` + + // The ID of the route table. + RouteTableID *string `locationName:"RouteTableId" type:"string" required:"true"` + + metadataEnableVGWRoutePropagationInput `json:"-" xml:"-"` +} + +type metadataEnableVGWRoutePropagationInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type EnableVGWRoutePropagationOutput struct { + metadataEnableVGWRoutePropagationOutput `json:"-" xml:"-"` +} + +type metadataEnableVGWRoutePropagationOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +type EnableVPCClassicLinkInput struct { + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // The ID of the VPC. + VPCID *string `locationName:"vpcId" type:"string" required:"true"` + + metadataEnableVPCClassicLinkInput `json:"-" xml:"-"` +} + +type metadataEnableVPCClassicLinkInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type EnableVPCClassicLinkOutput struct { + // Returns true if the request succeeds; otherwise, it returns an error. + Return *bool `locationName:"return" type:"boolean"` + + metadataEnableVPCClassicLinkOutput `json:"-" xml:"-"` +} + +type metadataEnableVPCClassicLinkOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +type EnableVolumeIOInput struct { + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // The ID of the volume. + VolumeID *string `locationName:"volumeId" type:"string" required:"true"` + + metadataEnableVolumeIOInput `json:"-" xml:"-"` +} + +type metadataEnableVolumeIOInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type EnableVolumeIOOutput struct { + metadataEnableVolumeIOOutput `json:"-" xml:"-"` +} + +type metadataEnableVolumeIOOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +// Describes an export task. +type ExportTask struct { + // A description of the resource being exported. + Description *string `locationName:"description" type:"string"` + + // The ID of the export task. + ExportTaskID *string `locationName:"exportTaskId" type:"string"` + + ExportToS3Task *ExportToS3Task `locationName:"exportToS3" type:"structure"` + + // The instance being exported. + InstanceExportDetails *InstanceExportDetails `locationName:"instanceExport" type:"structure"` + + // The state of the conversion task. + State *string `locationName:"state" type:"string"` + + // The status message related to the export task. + StatusMessage *string `locationName:"statusMessage" type:"string"` + + metadataExportTask `json:"-" xml:"-"` +} + +type metadataExportTask struct { + SDKShapeTraits bool `type:"structure"` +} + +type ExportToS3Task struct { + // The container format used to combine disk images with metadata (such as OVF). + // If absent, only the disk image is exported. + ContainerFormat *string `locationName:"containerFormat" type:"string"` + + // The format for the exported image. + DiskImageFormat *string `locationName:"diskImageFormat" type:"string"` + + // The Amazon S3 bucket for the destination image. The destination bucket must + // exist and grant WRITE and READ_ACP permissions to the AWS account vm-import-export@amazon.com. + S3Bucket *string `locationName:"s3Bucket" type:"string"` + + S3Key *string `locationName:"s3Key" type:"string"` + + metadataExportToS3Task `json:"-" xml:"-"` +} + +type metadataExportToS3Task struct { + SDKShapeTraits bool `type:"structure"` +} + +type ExportToS3TaskSpecification struct { + ContainerFormat *string `locationName:"containerFormat" type:"string"` + + DiskImageFormat *string `locationName:"diskImageFormat" type:"string"` + + S3Bucket *string `locationName:"s3Bucket" type:"string"` + + // The image is written to a single object in the Amazon S3 bucket at the S3 + // key s3prefix + exportTaskId + '.' + diskImageFormat. + S3Prefix *string `locationName:"s3Prefix" type:"string"` + + metadataExportToS3TaskSpecification `json:"-" xml:"-"` +} + +type metadataExportToS3TaskSpecification struct { + SDKShapeTraits bool `type:"structure"` +} + +// A filter name and value pair that is used to return a more specific list +// of results. Filters can be used to match a set of resources by various criteria, +// such as tags, attributes, or IDs. +type Filter struct { + // The name of the filter. Filter names are case-sensitive. + Name *string `type:"string"` + + // One or more filter values. Filter values are case-sensitive. + Values []*string `locationName:"Value" locationNameList:"item" type:"list"` + + metadataFilter `json:"-" xml:"-"` +} + +type metadataFilter struct { + SDKShapeTraits bool `type:"structure"` +} + +type GetConsoleOutputInput struct { + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // The ID of the instance. + InstanceID *string `locationName:"InstanceId" type:"string" required:"true"` + + metadataGetConsoleOutputInput `json:"-" xml:"-"` +} + +type metadataGetConsoleOutputInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type GetConsoleOutputOutput struct { + // The ID of the instance. + InstanceID *string `locationName:"instanceId" type:"string"` + + // The console output, Base64 encoded. + Output *string `locationName:"output" type:"string"` + + // The time the output was last updated. + Timestamp *time.Time `locationName:"timestamp" type:"timestamp" timestampFormat:"iso8601"` + + metadataGetConsoleOutputOutput `json:"-" xml:"-"` +} + +type metadataGetConsoleOutputOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +type GetPasswordDataInput struct { + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // The ID of the Windows instance. + InstanceID *string `locationName:"InstanceId" type:"string" required:"true"` + + metadataGetPasswordDataInput `json:"-" xml:"-"` +} + +type metadataGetPasswordDataInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type GetPasswordDataOutput struct { + // The ID of the Windows instance. + InstanceID *string `locationName:"instanceId" type:"string"` + + // The password of the instance. + PasswordData *string `locationName:"passwordData" type:"string"` + + // The time the data was last updated. + Timestamp *time.Time `locationName:"timestamp" type:"timestamp" timestampFormat:"iso8601"` + + metadataGetPasswordDataOutput `json:"-" xml:"-"` +} + +type metadataGetPasswordDataOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +// Describes a security group. +type GroupIdentifier struct { + // The ID of the security group. + GroupID *string `locationName:"groupId" type:"string"` + + // The name of the security group. + GroupName *string `locationName:"groupName" type:"string"` + + metadataGroupIdentifier `json:"-" xml:"-"` +} + +type metadataGroupIdentifier struct { + SDKShapeTraits bool `type:"structure"` +} + +// Describes an IAM instance profile. +type IAMInstanceProfile struct { + // The Amazon Resource Name (ARN) of the instance profile. + ARN *string `locationName:"arn" type:"string"` + + // The ID of the instance profile. + ID *string `locationName:"id" type:"string"` + + metadataIAMInstanceProfile `json:"-" xml:"-"` +} + +type metadataIAMInstanceProfile struct { + SDKShapeTraits bool `type:"structure"` +} + +// Describes an IAM instance profile. +type IAMInstanceProfileSpecification struct { + // The Amazon Resource Name (ARN) of the instance profile. + ARN *string `locationName:"arn" type:"string"` + + // The name of the instance profile. + Name *string `locationName:"name" type:"string"` + + metadataIAMInstanceProfileSpecification `json:"-" xml:"-"` +} + +type metadataIAMInstanceProfileSpecification struct { + SDKShapeTraits bool `type:"structure"` +} + +// Describes the ICMP type and code. +type ICMPTypeCode struct { + // The ICMP type. A value of -1 means all types. + Code *int64 `locationName:"code" type:"integer"` + + // The ICMP code. A value of -1 means all codes for the specified ICMP type. + Type *int64 `locationName:"type" type:"integer"` + + metadataICMPTypeCode `json:"-" xml:"-"` +} + +type metadataICMPTypeCode struct { + SDKShapeTraits bool `type:"structure"` +} + +// Describes a security group rule. +type IPPermission struct { + // The start of port range for the TCP and UDP protocols, or an ICMP type number. + // A value of -1 indicates all ICMP types. + FromPort *int64 `locationName:"fromPort" type:"integer"` + + // The protocol. + // + // When you call DescribeSecurityGroups, the protocol value returned is the + // number. Exception: For TCP, UDP, and ICMP, the value returned is the name + // (for example, tcp, udp, or icmp). For a list of protocol numbers, see Protocol + // Numbers (http://www.iana.org/assignments/protocol-numbers/protocol-numbers.xhtml). + // (VPC only) When you call AuthorizeSecurityGroupIngress, you can use -1 to + // specify all. + IPProtocol *string `locationName:"ipProtocol" type:"string"` + + // One or more IP ranges. + IPRanges []*IPRange `locationName:"ipRanges" locationNameList:"item" type:"list"` + + // The end of port range for the TCP and UDP protocols, or an ICMP code. A value + // of -1 indicates all ICMP codes for the specified ICMP type. + ToPort *int64 `locationName:"toPort" type:"integer"` + + // One or more security group and AWS account ID pairs. + UserIDGroupPairs []*UserIDGroupPair `locationName:"groups" locationNameList:"item" type:"list"` + + metadataIPPermission `json:"-" xml:"-"` +} + +type metadataIPPermission struct { + SDKShapeTraits bool `type:"structure"` +} + +// Describes an IP range. +type IPRange struct { + // The CIDR range. You can either specify a CIDR range or a source security + // group, not both. + CIDRIP *string `locationName:"cidrIp" type:"string"` + + metadataIPRange `json:"-" xml:"-"` +} + +type metadataIPRange struct { + SDKShapeTraits bool `type:"structure"` +} + +// Describes an image. +type Image struct { + // The architecture of the image. + Architecture *string `locationName:"architecture" type:"string"` + + // Any block device mapping entries. + BlockDeviceMappings []*BlockDeviceMapping `locationName:"blockDeviceMapping" locationNameList:"item" type:"list"` + + // The date and time the image was created. + CreationDate *string `locationName:"creationDate" type:"string"` + + // The description of the AMI that was provided during image creation. + Description *string `locationName:"description" type:"string"` + + // The hypervisor type of the image. + Hypervisor *string `locationName:"hypervisor" type:"string"` + + // The ID of the AMI. + ImageID *string `locationName:"imageId" type:"string"` + + // The location of the AMI. + ImageLocation *string `locationName:"imageLocation" type:"string"` + + // The AWS account alias (for example, amazon, self) or the AWS account ID of + // the AMI owner. + ImageOwnerAlias *string `locationName:"imageOwnerAlias" type:"string"` + + // The type of image. + ImageType *string `locationName:"imageType" type:"string"` + + // The kernel associated with the image, if any. Only applicable for machine + // images. + KernelID *string `locationName:"kernelId" type:"string"` + + // The name of the AMI that was provided during image creation. + Name *string `locationName:"name" type:"string"` + + // The AWS account ID of the image owner. + OwnerID *string `locationName:"imageOwnerId" type:"string"` + + // The value is Windows for Windows AMIs; otherwise blank. + Platform *string `locationName:"platform" type:"string"` + + // Any product codes associated with the AMI. + ProductCodes []*ProductCode `locationName:"productCodes" locationNameList:"item" type:"list"` + + // Indicates whether the image has public launch permissions. The value is true + // if this image has public launch permissions or false if it has only implicit + // and explicit launch permissions. + Public *bool `locationName:"isPublic" type:"boolean"` + + // The RAM disk associated with the image, if any. Only applicable for machine + // images. + RAMDiskID *string `locationName:"ramdiskId" type:"string"` + + // The device name of the root device (for example, /dev/sda1 or /dev/xvda). + RootDeviceName *string `locationName:"rootDeviceName" type:"string"` + + // The type of root device used by the AMI. The AMI can use an Amazon EBS volume + // or an instance store volume. + RootDeviceType *string `locationName:"rootDeviceType" type:"string"` + + // Specifies whether enhanced networking is enabled. + SRIOVNetSupport *string `locationName:"sriovNetSupport" type:"string"` + + // The current state of the AMI. If the state is available, the image is successfully + // registered and can be used to launch an instance. + State *string `locationName:"imageState" type:"string"` + + // The reason for the state change. + StateReason *StateReason `locationName:"stateReason" type:"structure"` + + // Any tags assigned to the image. + Tags []*Tag `locationName:"tagSet" locationNameList:"item" type:"list"` + + // The type of virtualization of the AMI. + VirtualizationType *string `locationName:"virtualizationType" type:"string"` + + metadataImage `json:"-" xml:"-"` +} + +type metadataImage struct { + SDKShapeTraits bool `type:"structure"` +} + +// The disk container object for an ImportImage task. +type ImageDiskContainer struct { + // The description of the disk image (optional). + Description *string `type:"string"` + + // The Amazon EBS block device mapping for the disk (optional). + DeviceName *string `type:"string"` + + // The format of the disk image being imported (optional). + Format *string `type:"string"` + + // The Amazon EBS snapshot ID to be used for importing the snapshot. + SnapshotID *string `locationName:"SnapshotId" type:"string"` + + // The URL to the Amazon S3-based disk image being imported. The URL can either + // be a https URL (https://..) or an Amazon S3 URL (s3://..) + URL *string `locationName:"Url" type:"string"` + + // User's Amazon S3 bucket details used to access the image. + UserBucket *UserBucket `type:"structure"` + + metadataImageDiskContainer `json:"-" xml:"-"` +} + +type metadataImageDiskContainer struct { + SDKShapeTraits bool `type:"structure"` +} + +type ImportImageInput struct { + // The architecture of the virtual machine being imported (optional). + Architecture *string `type:"string"` + + // Client-specific data. + ClientData *ClientData `type:"structure"` + + // The token to enable idempotency for VM import requests (optional). + ClientToken *string `type:"string"` + + // A description string for the import image task (optional). + Description *string `type:"string"` + + DiskContainers []*ImageDiskContainer `locationName:"DiskContainer" locationNameList:"item" type:"list"` + + DryRun *bool `type:"boolean"` + + // The target hypervisor platform to use (optional). + Hypervisor *string `type:"string"` + + // The license type to be used for the Amazon Machine Image (AMI) after importing + // (optional). + // + // Note: You may only use BYOL if you have existing licenses with rights to + // use these licenses in a third party cloud like AWS. For more information, + // see VM Import/Export Prerequisites (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/VMImportPrerequisites.html) + // in the Amazon Elastic Compute Cloud User Guide. + // + // Valid Values: AWS | BYOL + LicenseType *string `type:"string"` + + // The operating system of the virtual machine being imported (optional). + Platform *string `type:"string"` + + // The name of the role to use when not using the default role name 'vmimport' + // (optional). + RoleName *string `type:"string"` + + metadataImportImageInput `json:"-" xml:"-"` +} + +type metadataImportImageInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type ImportImageOutput struct { + // Architecture of the virtual machine being imported. + Architecture *string `locationName:"architecture" type:"string"` + + // A description of the import task. + Description *string `locationName:"description" type:"string"` + + // Target hypervisor of the import task. + Hypervisor *string `locationName:"hypervisor" type:"string"` + + // The Amazon Machine Image (AMI) ID created by the import task. + ImageID *string `locationName:"imageId" type:"string"` + + // The task id of the ImportImage task. + ImportTaskID *string `locationName:"importTaskId" type:"string"` + + // License type of the virtual machine being imported. + LicenseType *string `locationName:"licenseType" type:"string"` + + // Operating system of the VM being imported. + Platform *string `locationName:"platform" type:"string"` + + // The task's progress. + Progress *string `locationName:"progress" type:"string"` + + SnapshotDetails []*SnapshotDetail `locationName:"snapshotDetailSet" locationNameList:"item" type:"list"` + + // A brief status of the task. + Status *string `locationName:"status" type:"string"` + + // A detailed status message of the import task. + StatusMessage *string `locationName:"statusMessage" type:"string"` + + metadataImportImageOutput `json:"-" xml:"-"` +} + +type metadataImportImageOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +type ImportImageTask struct { + // Architecture of the VM being imported. + Architecture *string `locationName:"architecture" type:"string"` + + // Description of the import task. + Description *string `locationName:"description" type:"string"` + + // Target hypervisor for the import task. + Hypervisor *string `locationName:"hypervisor" type:"string"` + + // The Amazon Machine Image (AMI) ID of the imported virtual machine. + ImageID *string `locationName:"imageId" type:"string"` + + // The ID of the import task. + ImportTaskID *string `locationName:"importTaskId" type:"string"` + + // License type of the VM being imported. + LicenseType *string `locationName:"licenseType" type:"string"` + + // The description string for the import image task. + Platform *string `locationName:"platform" type:"string"` + + // The percentage of progress of the ImportImage task. + Progress *string `locationName:"progress" type:"string"` + + SnapshotDetails []*SnapshotDetail `locationName:"snapshotDetailSet" locationNameList:"item" type:"list"` + + // A brief status for the ImportImage task. + Status *string `locationName:"status" type:"string"` + + // A descriptive status message for the ImportImage task. + StatusMessage *string `locationName:"statusMessage" type:"string"` + + metadataImportImageTask `json:"-" xml:"-"` +} + +type metadataImportImageTask struct { + SDKShapeTraits bool `type:"structure"` +} + +type ImportInstanceInput struct { + // A description for the instance being imported. + Description *string `locationName:"description" type:"string"` + + DiskImages []*DiskImage `locationName:"diskImage" type:"list"` + + DryRun *bool `locationName:"dryRun" type:"boolean"` + + LaunchSpecification *ImportInstanceLaunchSpecification `locationName:"launchSpecification" type:"structure"` + + // The instance operating system. + Platform *string `locationName:"platform" type:"string" required:"true"` + + metadataImportInstanceInput `json:"-" xml:"-"` +} + +type metadataImportInstanceInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type ImportInstanceLaunchSpecification struct { + AdditionalInfo *string `locationName:"additionalInfo" type:"string"` + + // The architecture of the instance. + Architecture *string `locationName:"architecture" type:"string"` + + // One or more security group IDs. + GroupIDs []*string `locationName:"GroupId" locationNameList:"SecurityGroupId" type:"list"` + + // One or more security group names. + GroupNames []*string `locationName:"GroupName" locationNameList:"SecurityGroup" type:"list"` + + // Indicates whether an instance stops or terminates when you initiate shutdown + // from the instance (using the operating system command for system shutdown). + InstanceInitiatedShutdownBehavior *string `locationName:"instanceInitiatedShutdownBehavior" type:"string"` + + // The instance type. This is not supported for VMs imported into a VPC, which + // are assigned the default security group. After a VM is imported into a VPC, + // you can specify another security group using the AWS Management Console. + // For more information, see Instance Types (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-types.html) + // in the Amazon Elastic Compute Cloud User Guide. For more information about + // the Linux instance types you can import, see Before You Get Started (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/VMImportPrerequisites.html) + // in the Amazon Elastic Compute Cloud User Guide. + InstanceType *string `locationName:"instanceType" type:"string"` + + Monitoring *bool `locationName:"monitoring" type:"boolean"` + + // Describes the placement for the instance. + Placement *Placement `locationName:"placement" type:"structure"` + + // [EC2-VPC] Optionally, you can use this parameter to assign the instance a + // specific available IP address from the IP address range of the subnet. + PrivateIPAddress *string `locationName:"privateIpAddress" type:"string"` + + // [EC2-VPC] The ID of the subnet to launch the instance into. + SubnetID *string `locationName:"subnetId" type:"string"` + + // User data to be made available to the instance. + UserData *UserData `locationName:"userData" type:"structure"` + + metadataImportInstanceLaunchSpecification `json:"-" xml:"-"` +} + +type metadataImportInstanceLaunchSpecification struct { + SDKShapeTraits bool `type:"structure"` +} + +type ImportInstanceOutput struct { + // Describes a conversion task. + ConversionTask *ConversionTask `locationName:"conversionTask" type:"structure"` + + metadataImportInstanceOutput `json:"-" xml:"-"` +} + +type metadataImportInstanceOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +type ImportInstanceTaskDetails struct { + Description *string `locationName:"description" type:"string"` + + InstanceID *string `locationName:"instanceId" type:"string"` + + // The instance operating system. + Platform *string `locationName:"platform" type:"string"` + + Volumes []*ImportInstanceVolumeDetailItem `locationName:"volumes" locationNameList:"item" type:"list" required:"true"` + + metadataImportInstanceTaskDetails `json:"-" xml:"-"` +} + +type metadataImportInstanceTaskDetails struct { + SDKShapeTraits bool `type:"structure"` +} + +// Describes an import volume task. +type ImportInstanceVolumeDetailItem struct { + // The Availability Zone where the resulting instance will reside. + AvailabilityZone *string `locationName:"availabilityZone" type:"string" required:"true"` + + // The number of bytes converted so far. + BytesConverted *int64 `locationName:"bytesConverted" type:"long" required:"true"` + + Description *string `locationName:"description" type:"string"` + + // The image. + Image *DiskImageDescription `locationName:"image" type:"structure" required:"true"` + + // The status of the import of this particular disk image. + Status *string `locationName:"status" type:"string" required:"true"` + + // The status information or errors related to the disk image. + StatusMessage *string `locationName:"statusMessage" type:"string"` + + // The volume. + Volume *DiskImageVolumeDescription `locationName:"volume" type:"structure" required:"true"` + + metadataImportInstanceVolumeDetailItem `json:"-" xml:"-"` +} + +type metadataImportInstanceVolumeDetailItem struct { + SDKShapeTraits bool `type:"structure"` +} + +type ImportKeyPairInput struct { + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // A unique name for the key pair. + KeyName *string `locationName:"keyName" type:"string" required:"true"` + + // The public key. You must base64 encode the public key material before sending + // it to AWS. + PublicKeyMaterial []byte `locationName:"publicKeyMaterial" type:"blob" required:"true"` + + metadataImportKeyPairInput `json:"-" xml:"-"` +} + +type metadataImportKeyPairInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type ImportKeyPairOutput struct { + // The MD5 public key fingerprint as specified in section 4 of RFC 4716. + KeyFingerprint *string `locationName:"keyFingerprint" type:"string"` + + // The key pair name you provided. + KeyName *string `locationName:"keyName" type:"string"` + + metadataImportKeyPairOutput `json:"-" xml:"-"` +} + +type metadataImportKeyPairOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +type ImportSnapshotInput struct { + // Client-specific data. + ClientData *ClientData `type:"structure"` + + // Token to enable idempotency for VM import requests (optional). + ClientToken *string `type:"string"` + + // The description string for the ImportSnapshot task. + Description *string `type:"string"` + + // The disk container object for the ImportSnapshot request. + DiskContainer *SnapshotDiskContainer `type:"structure"` + + DryRun *bool `type:"boolean"` + + // The name of the role to use when not using the default role name 'vmimport' + // (optional). + RoleName *string `type:"string"` + + metadataImportSnapshotInput `json:"-" xml:"-"` +} + +type metadataImportSnapshotInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type ImportSnapshotOutput struct { + // Description of the import snapshot task. + Description *string `locationName:"description" type:"string"` + + // Task ID of the ImportSnapshot task. + ImportTaskID *string `locationName:"importTaskId" type:"string"` + + // Details about the import snapshot task. + SnapshotTaskDetail *SnapshotTaskDetail `locationName:"snapshotTaskDetail" type:"structure"` + + metadataImportSnapshotOutput `json:"-" xml:"-"` +} + +type metadataImportSnapshotOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +type ImportSnapshotTask struct { + // Description for the import snapshot task. + Description *string `locationName:"description" type:"string"` + + // The task ID of the ImportSnapshot task. + ImportTaskID *string `locationName:"importTaskId" type:"string"` + + // Details about the import snapshot task. + SnapshotTaskDetail *SnapshotTaskDetail `locationName:"snapshotTaskDetail" type:"structure"` + + metadataImportSnapshotTask `json:"-" xml:"-"` +} + +type metadataImportSnapshotTask struct { + SDKShapeTraits bool `type:"structure"` +} + +type ImportVolumeInput struct { + // The Availability Zone for the resulting Amazon EBS volume. + AvailabilityZone *string `locationName:"availabilityZone" type:"string" required:"true"` + + // An optional description for the volume being imported. + Description *string `locationName:"description" type:"string"` + + DryRun *bool `locationName:"dryRun" type:"boolean"` + + Image *DiskImageDetail `locationName:"image" type:"structure" required:"true"` + + // Describes an Amazon EBS volume. + Volume *VolumeDetail `locationName:"volume" type:"structure" required:"true"` + + metadataImportVolumeInput `json:"-" xml:"-"` +} + +type metadataImportVolumeInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type ImportVolumeOutput struct { + // Describes a conversion task. + ConversionTask *ConversionTask `locationName:"conversionTask" type:"structure"` + + metadataImportVolumeOutput `json:"-" xml:"-"` +} + +type metadataImportVolumeOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +// Describes an import volume task. +type ImportVolumeTaskDetails struct { + // The Availability Zone where the resulting volume will reside. + AvailabilityZone *string `locationName:"availabilityZone" type:"string" required:"true"` + + // The number of bytes converted so far. + BytesConverted *int64 `locationName:"bytesConverted" type:"long" required:"true"` + + // The description you provided when starting the import volume task. + Description *string `locationName:"description" type:"string"` + + // The image. + Image *DiskImageDescription `locationName:"image" type:"structure" required:"true"` + + // The volume. + Volume *DiskImageVolumeDescription `locationName:"volume" type:"structure" required:"true"` + + metadataImportVolumeTaskDetails `json:"-" xml:"-"` +} + +type metadataImportVolumeTaskDetails struct { + SDKShapeTraits bool `type:"structure"` +} + +// Describes an instance. +type Instance struct { + // The AMI launch index, which can be used to find this instance in the launch + // group. + AMILaunchIndex *int64 `locationName:"amiLaunchIndex" type:"integer"` + + // The architecture of the image. + Architecture *string `locationName:"architecture" type:"string"` + + // Any block device mapping entries for the instance. + BlockDeviceMappings []*InstanceBlockDeviceMapping `locationName:"blockDeviceMapping" locationNameList:"item" type:"list"` + + // The idempotency token you provided when you launched the instance. + ClientToken *string `locationName:"clientToken" type:"string"` + + // Indicates whether the instance is optimized for EBS I/O. This optimization + // provides dedicated throughput to Amazon EBS and an optimized configuration + // stack to provide optimal I/O performance. This optimization isn't available + // with all instance types. Additional usage charges apply when using an EBS + // Optimized instance. + EBSOptimized *bool `locationName:"ebsOptimized" type:"boolean"` + + // The hypervisor type of the instance. + Hypervisor *string `locationName:"hypervisor" type:"string"` + + // The IAM instance profile associated with the instance. + IAMInstanceProfile *IAMInstanceProfile `locationName:"iamInstanceProfile" type:"structure"` + + // The ID of the AMI used to launch the instance. + ImageID *string `locationName:"imageId" type:"string"` + + // The ID of the instance. + InstanceID *string `locationName:"instanceId" type:"string"` + + // Indicates whether this is a Spot Instance. + InstanceLifecycle *string `locationName:"instanceLifecycle" type:"string"` + + // The instance type. + InstanceType *string `locationName:"instanceType" type:"string"` + + // The kernel associated with this instance. + KernelID *string `locationName:"kernelId" type:"string"` + + // The name of the key pair, if this instance was launched with an associated + // key pair. + KeyName *string `locationName:"keyName" type:"string"` + + // The time the instance was launched. + LaunchTime *time.Time `locationName:"launchTime" type:"timestamp" timestampFormat:"iso8601"` + + // The monitoring information for the instance. + Monitoring *Monitoring `locationName:"monitoring" type:"structure"` + + // [EC2-VPC] One or more network interfaces for the instance. + NetworkInterfaces []*InstanceNetworkInterface `locationName:"networkInterfaceSet" locationNameList:"item" type:"list"` + + // The location where the instance launched. + Placement *Placement `locationName:"placement" type:"structure"` + + // The value is Windows for Windows instances; otherwise blank. + Platform *string `locationName:"platform" type:"string"` + + // The private DNS name assigned to the instance. This DNS name can only be + // used inside the Amazon EC2 network. This name is not available until the + // instance enters the running state. + PrivateDNSName *string `locationName:"privateDnsName" type:"string"` + + // The private IP address assigned to the instance. + PrivateIPAddress *string `locationName:"privateIpAddress" type:"string"` + + // The product codes attached to this instance. + ProductCodes []*ProductCode `locationName:"productCodes" locationNameList:"item" type:"list"` + + // The public DNS name assigned to the instance. This name is not available + // until the instance enters the running state. + PublicDNSName *string `locationName:"dnsName" type:"string"` + + // The public IP address assigned to the instance. + PublicIPAddress *string `locationName:"ipAddress" type:"string"` + + // The RAM disk associated with this instance. + RAMDiskID *string `locationName:"ramdiskId" type:"string"` + + // The root device name (for example, /dev/sda1 or /dev/xvda). + RootDeviceName *string `locationName:"rootDeviceName" type:"string"` + + // The root device type used by the AMI. The AMI can use an Amazon EBS volume + // or an instance store volume. + RootDeviceType *string `locationName:"rootDeviceType" type:"string"` + + // Specifies whether enhanced networking is enabled. + SRIOVNetSupport *string `locationName:"sriovNetSupport" type:"string"` + + // One or more security groups for the instance. + SecurityGroups []*GroupIdentifier `locationName:"groupSet" locationNameList:"item" type:"list"` + + // Specifies whether to enable an instance launched in a VPC to perform NAT. + // This controls whether source/destination checking is enabled on the instance. + // A value of true means checking is enabled, and false means checking is disabled. + // The value must be false for the instance to perform NAT. For more information, + // see NAT Instances (http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_NAT_Instance.html) + // in the Amazon Virtual Private Cloud User Guide. + SourceDestCheck *bool `locationName:"sourceDestCheck" type:"boolean"` + + // The ID of the Spot Instance request. + SpotInstanceRequestID *string `locationName:"spotInstanceRequestId" type:"string"` + + // The current state of the instance. + State *InstanceState `locationName:"instanceState" type:"structure"` + + // The reason for the most recent state transition. + StateReason *StateReason `locationName:"stateReason" type:"structure"` + + // The reason for the most recent state transition. This might be an empty string. + StateTransitionReason *string `locationName:"reason" type:"string"` + + // The ID of the subnet in which the instance is running. + SubnetID *string `locationName:"subnetId" type:"string"` + + // Any tags assigned to the instance. + Tags []*Tag `locationName:"tagSet" locationNameList:"item" type:"list"` + + // The ID of the VPC in which the instance is running. + VPCID *string `locationName:"vpcId" type:"string"` + + // The virtualization type of the instance. + VirtualizationType *string `locationName:"virtualizationType" type:"string"` + + metadataInstance `json:"-" xml:"-"` +} + +type metadataInstance struct { + SDKShapeTraits bool `type:"structure"` +} + +// Describes a block device mapping. +type InstanceBlockDeviceMapping struct { + // The device name exposed to the instance (for example, /dev/sdh or xvdh). + DeviceName *string `locationName:"deviceName" type:"string"` + + // Parameters used to automatically set up Amazon EBS volumes when the instance + // is launched. + EBS *EBSInstanceBlockDevice `locationName:"ebs" type:"structure"` + + metadataInstanceBlockDeviceMapping `json:"-" xml:"-"` +} + +type metadataInstanceBlockDeviceMapping struct { + SDKShapeTraits bool `type:"structure"` +} + +// Describes a block device mapping entry. +type InstanceBlockDeviceMappingSpecification struct { + // The device name exposed to the instance (for example, /dev/sdh or xvdh). + DeviceName *string `locationName:"deviceName" type:"string"` + + // Parameters used to automatically set up Amazon EBS volumes when the instance + // is launched. + EBS *EBSInstanceBlockDeviceSpecification `locationName:"ebs" type:"structure"` + + // suppress the specified device included in the block device mapping. + NoDevice *string `locationName:"noDevice" type:"string"` + + // The virtual device name. + VirtualName *string `locationName:"virtualName" type:"string"` + + metadataInstanceBlockDeviceMappingSpecification `json:"-" xml:"-"` +} + +type metadataInstanceBlockDeviceMappingSpecification struct { + SDKShapeTraits bool `type:"structure"` +} + +// Describes a Reserved Instance listing state. +type InstanceCount struct { + // he 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. + State *string `locationName:"state" type:"string"` + + metadataInstanceCount `json:"-" xml:"-"` +} + +type metadataInstanceCount struct { + SDKShapeTraits bool `type:"structure"` +} + +// Describes an instance export task. +type InstanceExportDetails struct { + // The ID of the resource being exported. + InstanceID *string `locationName:"instanceId" type:"string"` + + // The target virtualization environment. + TargetEnvironment *string `locationName:"targetEnvironment" type:"string"` + + metadataInstanceExportDetails `json:"-" xml:"-"` +} + +type metadataInstanceExportDetails struct { + SDKShapeTraits bool `type:"structure"` +} + +// Describes the monitoring information of the instance. +type InstanceMonitoring struct { + // The ID of the instance. + InstanceID *string `locationName:"instanceId" type:"string"` + + // The monitoring information. + Monitoring *Monitoring `locationName:"monitoring" type:"structure"` + + metadataInstanceMonitoring `json:"-" xml:"-"` +} + +type metadataInstanceMonitoring struct { + SDKShapeTraits bool `type:"structure"` +} + +// Describes a network interface. +type InstanceNetworkInterface struct { + // The association information for an Elastic IP associated with the network + // interface. + Association *InstanceNetworkInterfaceAssociation `locationName:"association" type:"structure"` + + // The network interface attachment. + Attachment *InstanceNetworkInterfaceAttachment `locationName:"attachment" type:"structure"` + + // The description. + Description *string `locationName:"description" type:"string"` + + // One or more security groups. + Groups []*GroupIdentifier `locationName:"groupSet" locationNameList:"item" type:"list"` + + // The MAC address. + MACAddress *string `locationName:"macAddress" type:"string"` + + // The ID of the network interface. + NetworkInterfaceID *string `locationName:"networkInterfaceId" type:"string"` + + // The ID of the AWS account that created the network interface. + OwnerID *string `locationName:"ownerId" type:"string"` + + // The private DNS name. + PrivateDNSName *string `locationName:"privateDnsName" type:"string"` + + // The IP address of the network interface within the subnet. + PrivateIPAddress *string `locationName:"privateIpAddress" type:"string"` + + // The private IP addresses associated with the network interface. + PrivateIPAddresses []*InstancePrivateIPAddress `locationName:"privateIpAddressesSet" locationNameList:"item" type:"list"` + + // Indicates whether to validate network traffic to or from this network interface. + SourceDestCheck *bool `locationName:"sourceDestCheck" type:"boolean"` + + // The status of the network interface. + Status *string `locationName:"status" type:"string"` + + // The ID of the subnet. + SubnetID *string `locationName:"subnetId" type:"string"` + + // The ID of the VPC. + VPCID *string `locationName:"vpcId" type:"string"` + + metadataInstanceNetworkInterface `json:"-" xml:"-"` +} + +type metadataInstanceNetworkInterface struct { + SDKShapeTraits bool `type:"structure"` +} + +// Describes association information for an Elastic IP address. +type InstanceNetworkInterfaceAssociation struct { + // The ID of the owner of the Elastic IP address. + IPOwnerID *string `locationName:"ipOwnerId" type:"string"` + + // The public DNS name. + PublicDNSName *string `locationName:"publicDnsName" type:"string"` + + // The public IP address or Elastic IP address bound to the network interface. + PublicIP *string `locationName:"publicIp" type:"string"` + + metadataInstanceNetworkInterfaceAssociation `json:"-" xml:"-"` +} + +type metadataInstanceNetworkInterfaceAssociation struct { + SDKShapeTraits bool `type:"structure"` +} + +// Describes a network interface attachment. +type InstanceNetworkInterfaceAttachment struct { + // The time stamp when the attachment initiated. + AttachTime *time.Time `locationName:"attachTime" type:"timestamp" timestampFormat:"iso8601"` + + // The ID of the network interface attachment. + AttachmentID *string `locationName:"attachmentId" type:"string"` + + // Indicates whether the network interface is deleted when the instance is terminated. + DeleteOnTermination *bool `locationName:"deleteOnTermination" type:"boolean"` + + // The index of the device on the instance for the network interface attachment. + DeviceIndex *int64 `locationName:"deviceIndex" type:"integer"` + + // The attachment state. + Status *string `locationName:"status" type:"string"` + + metadataInstanceNetworkInterfaceAttachment `json:"-" xml:"-"` +} + +type metadataInstanceNetworkInterfaceAttachment struct { + SDKShapeTraits bool `type:"structure"` +} + +// Describes a network interface. +type InstanceNetworkInterfaceSpecification struct { + // Indicates whether to assign a public IP address to an instance you launch + // 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 `locationName:"associatePublicIpAddress" type:"boolean"` + + // If set to true, the interface is deleted when the instance is terminated. + // You can specify true only if creating a new network interface when launching + // an instance. + DeleteOnTermination *bool `locationName:"deleteOnTermination" type:"boolean"` + + // The description of the network interface. Applies only if creating a network + // interface when launching an instance. + Description *string `locationName:"description" type:"string"` + + // The index of the device on the instance for the network interface attachment. + // If you are specifying a network interface in a RunInstances request, you + // must provide the device index. + DeviceIndex *int64 `locationName:"deviceIndex" type:"integer"` + + // The IDs of the security groups for the network interface. Applies only if + // creating a network interface when launching an instance. + Groups []*string `locationName:"SecurityGroupId" locationNameList:"SecurityGroupId" type:"list"` + + // The ID of the network interface. + NetworkInterfaceID *string `locationName:"networkInterfaceId" type:"string"` + + // The private IP address of the network interface. Applies only if creating + // a network interface when launching an instance. + PrivateIPAddress *string `locationName:"privateIpAddress" type:"string"` + + // One or more private IP addresses to assign to the network interface. Only + // one private IP address can be designated as primary. + PrivateIPAddresses []*PrivateIPAddressSpecification `locationName:"privateIpAddressesSet" queryName:"PrivateIpAddresses" locationNameList:"item" type:"list"` + + // The number of secondary private IP addresses. You can't specify this option + // and specify more than one private IP address using the private IP addresses + // option. + SecondaryPrivateIPAddressCount *int64 `locationName:"secondaryPrivateIpAddressCount" type:"integer"` + + // The ID of the subnet associated with the network string. Applies only if + // creating a network interface when launching an instance. + SubnetID *string `locationName:"subnetId" type:"string"` + + metadataInstanceNetworkInterfaceSpecification `json:"-" xml:"-"` +} + +type metadataInstanceNetworkInterfaceSpecification struct { + SDKShapeTraits bool `type:"structure"` +} + +// Describes a private IP address. +type InstancePrivateIPAddress struct { + // The association information for an Elastic IP address for the network interface. + Association *InstanceNetworkInterfaceAssociation `locationName:"association" type:"structure"` + + // Indicates whether this IP address is the primary private IP address of the + // network interface. + Primary *bool `locationName:"primary" type:"boolean"` + + // The private DNS name. + PrivateDNSName *string `locationName:"privateDnsName" type:"string"` + + // The private IP address of the network interface. + PrivateIPAddress *string `locationName:"privateIpAddress" type:"string"` + + metadataInstancePrivateIPAddress `json:"-" xml:"-"` +} + +type metadataInstancePrivateIPAddress struct { + SDKShapeTraits bool `type:"structure"` +} + +// Describes the current state of the instance. +type InstanceState struct { + // The low byte represents the state. The high byte is an opaque internal value + // and should be ignored. + // + // 0 : pending + // + // 16 : running + // + // 32 : shutting-down + // + // 48 : terminated + // + // 64 : stopping + // + // 80 : stopped + Code *int64 `locationName:"code" type:"integer"` + + // The current state of the instance. + Name *string `locationName:"name" type:"string"` + + metadataInstanceState `json:"-" xml:"-"` +} + +type metadataInstanceState struct { + SDKShapeTraits bool `type:"structure"` +} + +// Describes an instance state change. +type InstanceStateChange struct { + // The current state of the instance. + CurrentState *InstanceState `locationName:"currentState" type:"structure"` + + // The ID of the instance. + InstanceID *string `locationName:"instanceId" type:"string"` + + // The previous state of the instance. + PreviousState *InstanceState `locationName:"previousState" type:"structure"` + + metadataInstanceStateChange `json:"-" xml:"-"` +} + +type metadataInstanceStateChange struct { + SDKShapeTraits bool `type:"structure"` +} + +// Describes the status of an instance. +type InstanceStatus struct { + // The Availability Zone of the instance. + AvailabilityZone *string `locationName:"availabilityZone" type:"string"` + + // Extra information regarding events associated with the instance. + Events []*InstanceStatusEvent `locationName:"eventsSet" locationNameList:"item" type:"list"` + + // The ID of the instance. + InstanceID *string `locationName:"instanceId" type:"string"` + + // The intended state of the instance. DescribeInstanceStatus requires that + // an instance be in the running state. + InstanceState *InstanceState `locationName:"instanceState" type:"structure"` + + // Reports impaired functionality that stems from issues internal to the instance, + // such as impaired reachability. + InstanceStatus *InstanceStatusSummary `locationName:"instanceStatus" type:"structure"` + + // Reports impaired functionality that stems from issues related to the systems + // that support an instance, such as hardware failures and network connectivity + // problems. + SystemStatus *InstanceStatusSummary `locationName:"systemStatus" type:"structure"` + + metadataInstanceStatus `json:"-" xml:"-"` +} + +type metadataInstanceStatus struct { + SDKShapeTraits bool `type:"structure"` +} + +// Describes the instance status. +type InstanceStatusDetails struct { + // The time when a status check failed. For an instance that was launched and + // impaired, this is the time when the instance was launched. + ImpairedSince *time.Time `locationName:"impairedSince" type:"timestamp" timestampFormat:"iso8601"` + + // The type of instance status. + Name *string `locationName:"name" type:"string"` + + // The status. + Status *string `locationName:"status" type:"string"` + + metadataInstanceStatusDetails `json:"-" xml:"-"` +} + +type metadataInstanceStatusDetails struct { + SDKShapeTraits bool `type:"structure"` +} + +// Describes an instance event. +type InstanceStatusEvent struct { + // The associated code of the event. + Code *string `locationName:"code" type:"string"` + + // A description of the event. + Description *string `locationName:"description" type:"string"` + + // The latest scheduled end time for the event. + NotAfter *time.Time `locationName:"notAfter" type:"timestamp" timestampFormat:"iso8601"` + + // The earliest scheduled start time for the event. + NotBefore *time.Time `locationName:"notBefore" type:"timestamp" timestampFormat:"iso8601"` + + metadataInstanceStatusEvent `json:"-" xml:"-"` +} + +type metadataInstanceStatusEvent struct { + SDKShapeTraits bool `type:"structure"` +} + +// Describes the status of an instance. +type InstanceStatusSummary struct { + // The system instance health or application instance health. + Details []*InstanceStatusDetails `locationName:"details" locationNameList:"item" type:"list"` + + // The status. + Status *string `locationName:"status" type:"string"` + + metadataInstanceStatusSummary `json:"-" xml:"-"` +} + +type metadataInstanceStatusSummary struct { + SDKShapeTraits bool `type:"structure"` +} + +// Describes an Internet gateway. +type InternetGateway struct { + // Any VPCs attached to the Internet gateway. + Attachments []*InternetGatewayAttachment `locationName:"attachmentSet" locationNameList:"item" type:"list"` + + // The ID of the Internet gateway. + InternetGatewayID *string `locationName:"internetGatewayId" type:"string"` + + // Any tags assigned to the Internet gateway. + Tags []*Tag `locationName:"tagSet" locationNameList:"item" type:"list"` + + metadataInternetGateway `json:"-" xml:"-"` +} + +type metadataInternetGateway struct { + SDKShapeTraits bool `type:"structure"` +} + +// Describes the attachment of a VPC to an Internet gateway. +type InternetGatewayAttachment struct { + // The current state of the attachment. + State *string `locationName:"state" type:"string"` + + // The ID of the VPC. + VPCID *string `locationName:"vpcId" type:"string"` + + metadataInternetGatewayAttachment `json:"-" xml:"-"` +} + +type metadataInternetGatewayAttachment struct { + SDKShapeTraits bool `type:"structure"` +} + +// Describes a key pair. +type KeyPairInfo struct { + // If you used CreateKeyPair to create the key pair, this is the SHA-1 digest + // of the DER encoded private key. If you used ImportKeyPair to provide AWS + // the public key, this is the MD5 public key fingerprint as specified in section + // 4 of RFC4716. + KeyFingerprint *string `locationName:"keyFingerprint" type:"string"` + + // The name of the key pair. + KeyName *string `locationName:"keyName" type:"string"` + + metadataKeyPairInfo `json:"-" xml:"-"` +} + +type metadataKeyPairInfo struct { + SDKShapeTraits bool `type:"structure"` +} + +// Describes a launch permission. +type LaunchPermission struct { + // The name of the group. + Group *string `locationName:"group" type:"string"` + + // The AWS account ID. + UserID *string `locationName:"userId" type:"string"` + + metadataLaunchPermission `json:"-" xml:"-"` +} + +type metadataLaunchPermission struct { + SDKShapeTraits bool `type:"structure"` +} + +// Describes a launch permission modification. +type LaunchPermissionModifications struct { + // The AWS account ID to add to the list of launch permissions for the AMI. + Add []*LaunchPermission `locationNameList:"item" type:"list"` + + // The AWS account ID to remove from the list of launch permissions for the + // AMI. + Remove []*LaunchPermission `locationNameList:"item" type:"list"` + + metadataLaunchPermissionModifications `json:"-" xml:"-"` +} + +type metadataLaunchPermissionModifications struct { + SDKShapeTraits bool `type:"structure"` +} + +// Describes the launch specification for an instance. +type LaunchSpecification struct { + // Deprecated. + AddressingType *string `locationName:"addressingType" type:"string"` + + // One or more block device mapping entries. + BlockDeviceMappings []*BlockDeviceMapping `locationName:"blockDeviceMapping" locationNameList:"item" type:"list"` + + // Indicates whether the instance is 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 `locationName:"ebsOptimized" type:"boolean"` + + // The IAM instance profile. + IAMInstanceProfile *IAMInstanceProfileSpecification `locationName:"iamInstanceProfile" type:"structure"` + + // The ID of the AMI. + ImageID *string `locationName:"imageId" type:"string"` + + // The instance type. + InstanceType *string `locationName:"instanceType" type:"string"` + + // The ID of the kernel. + KernelID *string `locationName:"kernelId" type:"string"` + + // The name of the key pair. + KeyName *string `locationName:"keyName" type:"string"` + + // Describes the monitoring for the instance. + Monitoring *RunInstancesMonitoringEnabled `locationName:"monitoring" type:"structure"` + + // One or more network interfaces. + NetworkInterfaces []*InstanceNetworkInterfaceSpecification `locationName:"networkInterfaceSet" locationNameList:"item" type:"list"` + + // The placement information for the instance. + Placement *SpotPlacement `locationName:"placement" type:"structure"` + + // The ID of the RAM disk. + RAMDiskID *string `locationName:"ramdiskId" type:"string"` + + // One or more security groups. To request an instance in a nondefault VPC, + // you must specify the ID of the security group. To request an instance in + // EC2-Classic or a default VPC, you can specify the name or the ID of the security + // group. + SecurityGroups []*GroupIdentifier `locationName:"groupSet" locationNameList:"item" type:"list"` + + // The ID of the subnet in which to launch the instance. + SubnetID *string `locationName:"subnetId" type:"string"` + + // The Base64-encoded MIME user data to make available to the instances. + UserData *string `locationName:"userData" type:"string"` + + metadataLaunchSpecification `json:"-" xml:"-"` +} + +type metadataLaunchSpecification struct { + SDKShapeTraits bool `type:"structure"` +} + +type ModifyImageAttributeInput struct { + // The name of the attribute to modify. + Attribute *string `type:"string"` + + // A description for the AMI. + Description *AttributeValue `type:"structure"` + + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // The ID of the AMI. + ImageID *string `locationName:"ImageId" type:"string" required:"true"` + + // A launch permission modification. + LaunchPermission *LaunchPermissionModifications `type:"structure"` + + // The operation type. + OperationType *string `type:"string"` + + // One or more product codes. After you add a product code to an AMI, it can't + // be removed. This is only valid when modifying the productCodes attribute. + ProductCodes []*string `locationName:"ProductCode" locationNameList:"ProductCode" type:"list"` + + // One or more user groups. This is only valid when modifying the launchPermission + // attribute. + UserGroups []*string `locationName:"UserGroup" locationNameList:"UserGroup" type:"list"` + + // One or more AWS account IDs. This is only valid when modifying the launchPermission + // attribute. + UserIDs []*string `locationName:"UserId" locationNameList:"UserId" type:"list"` + + // The value of the attribute being modified. This is only valid when modifying + // the description attribute. + Value *string `type:"string"` + + metadataModifyImageAttributeInput `json:"-" xml:"-"` +} + +type metadataModifyImageAttributeInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type ModifyImageAttributeOutput struct { + metadataModifyImageAttributeOutput `json:"-" xml:"-"` +} + +type metadataModifyImageAttributeOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +type ModifyInstanceAttributeInput struct { + // The name of the attribute. + Attribute *string `locationName:"attribute" type:"string"` + + // Modifies the DeleteOnTermination attribute for volumes that are currently + // attached. The volume must be owned by the caller. If no value is specified + // for DeleteOnTermination, the default is true and the volume is deleted when + // the instance is terminated. + // + // To add instance store volumes to an Amazon EBS-backed instance, you must + // add them when you launch the instance. For more information, see Updating + // the Block Device Mapping when Launching an Instance (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/block-device-mapping-concepts.html#Using_OverridingAMIBDM) + // in the Amazon Elastic Compute Cloud User Guide. + BlockDeviceMappings []*InstanceBlockDeviceMappingSpecification `locationName:"blockDeviceMapping" locationNameList:"item" type:"list"` + + // If the value is true, you can't terminate the instance using the Amazon EC2 + // console, CLI, or API; otherwise, you can. + DisableAPITermination *AttributeBooleanValue `locationName:"disableApiTermination" type:"structure"` + + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // Specifies whether the instance is 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. + EBSOptimized *AttributeBooleanValue `locationName:"ebsOptimized" type:"structure"` + + // [EC2-VPC] Changes the security groups of the instance. You must specify at + // least one security group, even if it's just the default security group for + // the VPC. You must specify the security group ID, not the security group name. + Groups []*string `locationName:"GroupId" locationNameList:"groupId" type:"list"` + + // The ID of the instance. + InstanceID *string `locationName:"instanceId" type:"string" required:"true"` + + // Specifies whether an instance stops or terminates when you initiate shutdown + // from the instance (using the operating system command for system shutdown). + InstanceInitiatedShutdownBehavior *AttributeValue `locationName:"instanceInitiatedShutdownBehavior" type:"structure"` + + // Changes the instance type to the specified value. For more information, see + // Instance Types (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-types.html). + // If the instance type is not valid, the error returned is InvalidInstanceAttributeValue. + InstanceType *AttributeValue `locationName:"instanceType" type:"structure"` + + // Changes the instance's kernel to the specified value. We recommend that you + // use PV-GRUB instead of kernels and RAM disks. For more information, see PV-GRUB + // (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/UserProvidedKernels.html). + Kernel *AttributeValue `locationName:"kernel" type:"structure"` + + // Changes the instance's RAM disk to the specified value. We recommend that + // you use PV-GRUB instead of kernels and RAM disks. For more information, see + // PV-GRUB (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/UserProvidedKernels.html). + RAMDisk *AttributeValue `locationName:"ramdisk" type:"structure"` + + // Set to simple to enable enhanced networking for the instance. + // + // There is no way to disable enhanced networking at this time. + // + // This option is supported only for HVM instances. Specifying this option + // with a PV instance can make it unreachable. + SRIOVNetSupport *AttributeValue `locationName:"sriovNetSupport" type:"structure"` + + // Specifies whether source/destination checking is enabled. A value of true + // means that checking is enabled, and false means checking is disabled. This + // value must be false for a NAT instance to perform NAT. + SourceDestCheck *AttributeBooleanValue `type:"structure"` + + // Changes the instance's user data to the specified value. + UserData *BlobAttributeValue `locationName:"userData" type:"structure"` + + // A new value for the attribute. Use only with the kernel, ramdisk, userData, + // disableApiTermination, or intanceInitiateShutdownBehavior attribute. + Value *string `locationName:"value" type:"string"` + + metadataModifyInstanceAttributeInput `json:"-" xml:"-"` +} + +type metadataModifyInstanceAttributeInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type ModifyInstanceAttributeOutput struct { + metadataModifyInstanceAttributeOutput `json:"-" xml:"-"` +} + +type metadataModifyInstanceAttributeOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +type ModifyNetworkInterfaceAttributeInput struct { + // Information about the interface attachment. If modifying the 'delete on termination' + // attribute, you must specify the ID of the interface attachment. + Attachment *NetworkInterfaceAttachmentChanges `locationName:"attachment" type:"structure"` + + // A description for the network interface. + Description *AttributeValue `locationName:"description" type:"structure"` + + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // Changes the security groups for the network interface. The new set of groups + // you specify replaces the current set. You must specify at least one group, + // even if it's just the default security group in the VPC. You must specify + // the ID of the security group, not the name. + Groups []*string `locationName:"SecurityGroupId" locationNameList:"SecurityGroupId" type:"list"` + + // The ID of the network interface. + NetworkInterfaceID *string `locationName:"networkInterfaceId" type:"string" required:"true"` + + // Indicates whether source/destination checking is enabled. A value of true + // means checking is enabled, and false means checking is disabled. This value + // must be false for a NAT instance to perform NAT. For more information, see + // NAT Instances (http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_NAT_Instance.html) + // in the Amazon Virtual Private Cloud User Guide. + SourceDestCheck *AttributeBooleanValue `locationName:"sourceDestCheck" type:"structure"` + + metadataModifyNetworkInterfaceAttributeInput `json:"-" xml:"-"` +} + +type metadataModifyNetworkInterfaceAttributeInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type ModifyNetworkInterfaceAttributeOutput struct { + metadataModifyNetworkInterfaceAttributeOutput `json:"-" xml:"-"` +} + +type metadataModifyNetworkInterfaceAttributeOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +type ModifyReservedInstancesInput struct { + // A unique, case-sensitive token you provide to ensure idempotency of your + // 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. + ReservedInstancesIDs []*string `locationName:"ReservedInstancesId" locationNameList:"ReservedInstancesId" type:"list" required:"true"` + + // The configuration settings for the Reserved Instances to modify. + TargetConfigurations []*ReservedInstancesConfiguration `locationName:"ReservedInstancesConfigurationSetItemType" locationNameList:"item" type:"list" required:"true"` + + metadataModifyReservedInstancesInput `json:"-" xml:"-"` +} + +type metadataModifyReservedInstancesInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type ModifyReservedInstancesOutput struct { + // The ID for the modification. + ReservedInstancesModificationID *string `locationName:"reservedInstancesModificationId" type:"string"` + + metadataModifyReservedInstancesOutput `json:"-" xml:"-"` +} + +type metadataModifyReservedInstancesOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +type ModifySnapshotAttributeInput struct { + // The snapshot attribute to modify. + Attribute *string `type:"string"` + + // A JSON representation of the snapshot attribute modification. + CreateVolumePermission *CreateVolumePermissionModifications `type:"structure"` + + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // The group to modify for the snapshot. + GroupNames []*string `locationName:"UserGroup" locationNameList:"GroupName" type:"list"` + + // The type of operation to perform to the attribute. + OperationType *string `type:"string"` + + // The ID of the snapshot. + SnapshotID *string `locationName:"SnapshotId" type:"string" required:"true"` + + // The account ID to modify for the snapshot. + UserIDs []*string `locationName:"UserId" locationNameList:"UserId" type:"list"` + + metadataModifySnapshotAttributeInput `json:"-" xml:"-"` +} + +type metadataModifySnapshotAttributeInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type ModifySnapshotAttributeOutput struct { + metadataModifySnapshotAttributeOutput `json:"-" xml:"-"` +} + +type metadataModifySnapshotAttributeOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +type ModifySubnetAttributeInput struct { + // Specify true to indicate that instances launched into the specified subnet + // should be assigned public IP address. + MapPublicIPOnLaunch *AttributeBooleanValue `locationName:"MapPublicIpOnLaunch" type:"structure"` + + // The ID of the subnet. + SubnetID *string `locationName:"subnetId" type:"string" required:"true"` + + metadataModifySubnetAttributeInput `json:"-" xml:"-"` +} + +type metadataModifySubnetAttributeInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type ModifySubnetAttributeOutput struct { + metadataModifySubnetAttributeOutput `json:"-" xml:"-"` +} + +type metadataModifySubnetAttributeOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +type ModifyVPCAttributeInput struct { + // Indicates whether the instances launched in the VPC get DNS hostnames. If + // enabled, instances in the VPC get DNS hostnames; otherwise, they do not. + // + // You can only enable DNS hostnames if you also enable DNS support. + EnableDNSHostnames *AttributeBooleanValue `locationName:"EnableDnsHostnames" type:"structure"` + + // Indicates whether the DNS resolution is supported for the VPC. If enabled, + // queries to the Amazon provided DNS server at the 169.254.169.253 IP address, + // or the reserved IP address at the base of the VPC network range "plus two" + // will succeed. If disabled, the Amazon provided DNS service in the VPC that + // resolves public DNS hostnames to IP addresses is not enabled. + EnableDNSSupport *AttributeBooleanValue `locationName:"EnableDnsSupport" type:"structure"` + + // The ID of the VPC. + VPCID *string `locationName:"vpcId" type:"string" required:"true"` + + metadataModifyVPCAttributeInput `json:"-" xml:"-"` +} + +type metadataModifyVPCAttributeInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type ModifyVPCAttributeOutput struct { + metadataModifyVPCAttributeOutput `json:"-" xml:"-"` +} + +type metadataModifyVPCAttributeOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +type ModifyVolumeAttributeInput struct { + // Indicates whether the volume should be auto-enabled for I/O operations. + AutoEnableIO *AttributeBooleanValue `type:"structure"` + + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // The ID of the volume. + VolumeID *string `locationName:"VolumeId" type:"string" required:"true"` + + metadataModifyVolumeAttributeInput `json:"-" xml:"-"` +} + +type metadataModifyVolumeAttributeInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type ModifyVolumeAttributeOutput struct { + metadataModifyVolumeAttributeOutput `json:"-" xml:"-"` +} + +type metadataModifyVolumeAttributeOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +type MonitorInstancesInput struct { + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // One or more instance IDs. + InstanceIDs []*string `locationName:"InstanceId" locationNameList:"InstanceId" type:"list" required:"true"` + + metadataMonitorInstancesInput `json:"-" xml:"-"` +} + +type metadataMonitorInstancesInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type MonitorInstancesOutput struct { + // Monitoring information for one or more instances. + InstanceMonitorings []*InstanceMonitoring `locationName:"instancesSet" locationNameList:"item" type:"list"` + + metadataMonitorInstancesOutput `json:"-" xml:"-"` +} + +type metadataMonitorInstancesOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +// Describes the monitoring for the instance. +type Monitoring struct { + // Indicates whether monitoring is enabled for the instance. + State *string `locationName:"state" type:"string"` + + metadataMonitoring `json:"-" xml:"-"` +} + +type metadataMonitoring struct { + SDKShapeTraits bool `type:"structure"` +} + +// Describes a network ACL. +type NetworkACL struct { + // Any associations between the network ACL and one or more subnets + Associations []*NetworkACLAssociation `locationName:"associationSet" locationNameList:"item" type:"list"` + + // One or more entries (rules) in the network ACL. + Entries []*NetworkACLEntry `locationName:"entrySet" locationNameList:"item" type:"list"` + + // Indicates whether this is the default network ACL for the VPC. + IsDefault *bool `locationName:"default" type:"boolean"` + + // The ID of the network ACL. + NetworkACLID *string `locationName:"networkAclId" type:"string"` + + // Any tags assigned to the network ACL. + Tags []*Tag `locationName:"tagSet" locationNameList:"item" type:"list"` + + // The ID of the VPC for the network ACL. + VPCID *string `locationName:"vpcId" type:"string"` + + metadataNetworkACL `json:"-" xml:"-"` +} + +type metadataNetworkACL struct { + SDKShapeTraits bool `type:"structure"` +} + +// Describes an association between a network ACL and a subnet. +type NetworkACLAssociation struct { + // The ID of the association between a network ACL and a subnet. + NetworkACLAssociationID *string `locationName:"networkAclAssociationId" type:"string"` + + // The ID of the network ACL. + NetworkACLID *string `locationName:"networkAclId" type:"string"` + + // The ID of the subnet. + SubnetID *string `locationName:"subnetId" type:"string"` + + metadataNetworkACLAssociation `json:"-" xml:"-"` +} + +type metadataNetworkACLAssociation struct { + SDKShapeTraits bool `type:"structure"` +} + +// Describes an entry in a network ACL. +type NetworkACLEntry struct { + // The network range to allow or deny, in CIDR notation. + CIDRBlock *string `locationName:"cidrBlock" type:"string"` + + // Indicates whether the rule is an egress rule (applied to traffic leaving + // the subnet). + Egress *bool `locationName:"egress" type:"boolean"` + + // ICMP protocol: The ICMP type and code. + ICMPTypeCode *ICMPTypeCode `locationName:"icmpTypeCode" type:"structure"` + + // TCP or UDP protocols: The range of ports the rule applies to. + PortRange *PortRange `locationName:"portRange" type:"structure"` + + // The protocol. A value of -1 means all protocols. + Protocol *string `locationName:"protocol" type:"string"` + + // Indicates whether to allow or deny the traffic that matches the rule. + RuleAction *string `locationName:"ruleAction" type:"string"` + + // The rule number for the entry. ACL entries are processed in ascending order + // by rule number. + RuleNumber *int64 `locationName:"ruleNumber" type:"integer"` + + metadataNetworkACLEntry `json:"-" xml:"-"` +} + +type metadataNetworkACLEntry struct { + SDKShapeTraits bool `type:"structure"` +} + +// Describes a network interface. +type NetworkInterface struct { + // The association information for an Elastic IP associated with the network + // interface. + Association *NetworkInterfaceAssociation `locationName:"association" type:"structure"` + + // The network interface attachment. + Attachment *NetworkInterfaceAttachment `locationName:"attachment" type:"structure"` + + // The Availability Zone. + AvailabilityZone *string `locationName:"availabilityZone" type:"string"` + + // A description. + Description *string `locationName:"description" type:"string"` + + // Any security groups for the network interface. + Groups []*GroupIdentifier `locationName:"groupSet" locationNameList:"item" type:"list"` + + // The MAC address. + MACAddress *string `locationName:"macAddress" type:"string"` + + // The ID of the network interface. + NetworkInterfaceID *string `locationName:"networkInterfaceId" type:"string"` + + // The AWS account ID of the owner of the network interface. + OwnerID *string `locationName:"ownerId" type:"string"` + + // The private DNS name. + PrivateDNSName *string `locationName:"privateDnsName" type:"string"` + + // The IP address of the network interface within the subnet. + PrivateIPAddress *string `locationName:"privateIpAddress" type:"string"` + + // The private IP addresses associated with the network interface. + PrivateIPAddresses []*NetworkInterfacePrivateIPAddress `locationName:"privateIpAddressesSet" locationNameList:"item" type:"list"` + + // The ID of the entity that launched the instance on your behalf (for example, + // AWS Management Console or Auto Scaling). + RequesterID *string `locationName:"requesterId" type:"string"` + + // Indicates whether the network interface is being managed by AWS. + RequesterManaged *bool `locationName:"requesterManaged" type:"boolean"` + + // Indicates whether traffic to or from the instance is validated. + SourceDestCheck *bool `locationName:"sourceDestCheck" type:"boolean"` + + // The status of the network interface. + Status *string `locationName:"status" type:"string"` + + // The ID of the subnet. + SubnetID *string `locationName:"subnetId" type:"string"` + + // Any tags assigned to the network interface. + TagSet []*Tag `locationName:"tagSet" locationNameList:"item" type:"list"` + + // The ID of the VPC. + VPCID *string `locationName:"vpcId" type:"string"` + + metadataNetworkInterface `json:"-" xml:"-"` +} + +type metadataNetworkInterface struct { + SDKShapeTraits bool `type:"structure"` +} + +// Describes association information for an Elastic IP address. +type NetworkInterfaceAssociation struct { + // The allocation ID. + AllocationID *string `locationName:"allocationId" type:"string"` + + // The association ID. + AssociationID *string `locationName:"associationId" type:"string"` + + // The ID of the Elastic IP address owner. + IPOwnerID *string `locationName:"ipOwnerId" type:"string"` + + // The public DNS name. + PublicDNSName *string `locationName:"publicDnsName" type:"string"` + + // The address of the Elastic IP address bound to the network interface. + PublicIP *string `locationName:"publicIp" type:"string"` + + metadataNetworkInterfaceAssociation `json:"-" xml:"-"` +} + +type metadataNetworkInterfaceAssociation struct { + SDKShapeTraits bool `type:"structure"` +} + +// Describes a network interface attachment. +type NetworkInterfaceAttachment struct { + // The timestamp indicating when the attachment initiated. + AttachTime *time.Time `locationName:"attachTime" type:"timestamp" timestampFormat:"iso8601"` + + // The ID of the network interface attachment. + AttachmentID *string `locationName:"attachmentId" type:"string"` + + // Indicates whether the network interface is deleted when the instance is terminated. + DeleteOnTermination *bool `locationName:"deleteOnTermination" type:"boolean"` + + // The device index of the network interface attachment on the instance. + DeviceIndex *int64 `locationName:"deviceIndex" type:"integer"` + + // The ID of the instance. + InstanceID *string `locationName:"instanceId" type:"string"` + + // The AWS account ID of the owner of the instance. + InstanceOwnerID *string `locationName:"instanceOwnerId" type:"string"` + + // The attachment state. + Status *string `locationName:"status" type:"string"` + + metadataNetworkInterfaceAttachment `json:"-" xml:"-"` +} + +type metadataNetworkInterfaceAttachment struct { + SDKShapeTraits bool `type:"structure"` +} + +// Describes an attachment change. +type NetworkInterfaceAttachmentChanges struct { + // The ID of the network interface attachment. + AttachmentID *string `locationName:"attachmentId" type:"string"` + + // Indicates whether the network interface is deleted when the instance is terminated. + DeleteOnTermination *bool `locationName:"deleteOnTermination" type:"boolean"` + + metadataNetworkInterfaceAttachmentChanges `json:"-" xml:"-"` +} + +type metadataNetworkInterfaceAttachmentChanges struct { + SDKShapeTraits bool `type:"structure"` +} + +// Describes the private IP address of a network interface. +type NetworkInterfacePrivateIPAddress struct { + // The association information for an Elastic IP address associated with the + // network interface. + Association *NetworkInterfaceAssociation `locationName:"association" type:"structure"` + + // Indicates whether this IP address is the primary private IP address of the + // network interface. + Primary *bool `locationName:"primary" type:"boolean"` + + // The private DNS name. + PrivateDNSName *string `locationName:"privateDnsName" type:"string"` + + // The private IP address. + PrivateIPAddress *string `locationName:"privateIpAddress" type:"string"` + + metadataNetworkInterfacePrivateIPAddress `json:"-" xml:"-"` +} + +type metadataNetworkInterfacePrivateIPAddress struct { + SDKShapeTraits bool `type:"structure"` +} + +type NewDHCPConfiguration struct { + Key *string `locationName:"key" type:"string"` + + Values []*string `locationName:"Value" locationNameList:"item" type:"list"` + + metadataNewDHCPConfiguration `json:"-" xml:"-"` +} + +type metadataNewDHCPConfiguration struct { + SDKShapeTraits bool `type:"structure"` +} + +// Describes the placement for the instance. +type Placement struct { + // The Availability Zone of the instance. + AvailabilityZone *string `locationName:"availabilityZone" type:"string"` + + // The name of the placement group the instance is in (for cluster compute instances). + GroupName *string `locationName:"groupName" type:"string"` + + // The tenancy of the instance (if the instance is running in a VPC). An instance + // with a tenancy of dedicated runs on single-tenant hardware. + Tenancy *string `locationName:"tenancy" type:"string"` + + metadataPlacement `json:"-" xml:"-"` +} + +type metadataPlacement struct { + SDKShapeTraits bool `type:"structure"` +} + +// Describes a placement group. +type PlacementGroup struct { + // The name of the placement group. + GroupName *string `locationName:"groupName" type:"string"` + + // The state of the placement group. + State *string `locationName:"state" type:"string"` + + // The placement strategy. + Strategy *string `locationName:"strategy" type:"string"` + + metadataPlacementGroup `json:"-" xml:"-"` +} + +type metadataPlacementGroup struct { + SDKShapeTraits bool `type:"structure"` +} + +// Describes a range of ports. +type PortRange struct { + // The first port in the range. + From *int64 `locationName:"from" type:"integer"` + + // The last port in the range. + To *int64 `locationName:"to" type:"integer"` + + metadataPortRange `json:"-" xml:"-"` +} + +type metadataPortRange struct { + SDKShapeTraits bool `type:"structure"` +} + +// Describes the price for a Reserved Instance. +type PriceSchedule struct { + // The current price schedule, as determined by the term remaining for the Reserved + // 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 + // 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, + // 4, and 3. Then schedule 2, covering the last two months of the term, will + // 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 only supported currency is USD. + CurrencyCode *string `locationName:"currencyCode" type:"string"` + + // The fixed price for the term. + Price *float64 `locationName:"price" type:"double"` + + // The number of months remaining in the reservation. For example, 2 is the + // second to the last month before the capacity reservation expires. + Term *int64 `locationName:"term" type:"long"` + + metadataPriceSchedule `json:"-" xml:"-"` +} + +type metadataPriceSchedule struct { + SDKShapeTraits bool `type:"structure"` +} + +// Describes the price for a Reserved Instance. +type PriceScheduleSpecification struct { + // The currency for transacting the Reserved Instance resale. At this time, + // the only supported currency is USD. + CurrencyCode *string `locationName:"currencyCode" type:"string"` + + // The fixed price for the term. + Price *float64 `locationName:"price" type:"double"` + + // The number of months remaining in the reservation. For example, 2 is the + // second to the last month before the capacity reservation expires. + Term *int64 `locationName:"term" type:"long"` + + metadataPriceScheduleSpecification `json:"-" xml:"-"` +} + +type metadataPriceScheduleSpecification struct { + SDKShapeTraits bool `type:"structure"` +} + +// Describes a Reserved Instance offering. +type PricingDetail struct { + // The number of instances available for the price. + Count *int64 `locationName:"count" type:"integer"` + + // The price per instance. + Price *float64 `locationName:"price" type:"double"` + + metadataPricingDetail `json:"-" xml:"-"` +} + +type metadataPricingDetail struct { + SDKShapeTraits bool `type:"structure"` +} + +// Describes a secondary private IP address for a network interface. +type PrivateIPAddressSpecification struct { + // Indicates whether the private IP address is the primary private IP address. + // Only one IP address can be designated as primary. + Primary *bool `locationName:"primary" type:"boolean"` + + // The private IP addresses. + PrivateIPAddress *string `locationName:"privateIpAddress" type:"string" required:"true"` + + metadataPrivateIPAddressSpecification `json:"-" xml:"-"` +} + +type metadataPrivateIPAddressSpecification struct { + SDKShapeTraits bool `type:"structure"` +} + +// Describes a product code. +type ProductCode struct { + // The product code. + ProductCodeID *string `locationName:"productCode" type:"string"` + + // The type of product code. + ProductCodeType *string `locationName:"type" type:"string"` + + metadataProductCode `json:"-" xml:"-"` +} + +type metadataProductCode struct { + SDKShapeTraits bool `type:"structure"` +} + +// Describes a virtual private gateway propagating route. +type PropagatingVGW struct { + // The ID of the virtual private gateway (VGW). + GatewayID *string `locationName:"gatewayId" type:"string"` + + metadataPropagatingVGW `json:"-" xml:"-"` +} + +type metadataPropagatingVGW struct { + SDKShapeTraits bool `type:"structure"` +} + +type PurchaseReservedInstancesOfferingInput struct { + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // 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 + // prices. + LimitPrice *ReservedInstanceLimitPrice `locationName:"limitPrice" type:"structure"` + + // The ID of the Reserved Instance offering to purchase. + ReservedInstancesOfferingID *string `locationName:"ReservedInstancesOfferingId" type:"string" required:"true"` + + metadataPurchaseReservedInstancesOfferingInput `json:"-" xml:"-"` +} + +type metadataPurchaseReservedInstancesOfferingInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type PurchaseReservedInstancesOfferingOutput struct { + // The IDs of the purchased Reserved Instances. + ReservedInstancesID *string `locationName:"reservedInstancesId" type:"string"` + + metadataPurchaseReservedInstancesOfferingOutput `json:"-" xml:"-"` +} + +type metadataPurchaseReservedInstancesOfferingOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +type RebootInstancesInput struct { + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // One or more instance IDs. + InstanceIDs []*string `locationName:"InstanceId" locationNameList:"InstanceId" type:"list" required:"true"` + + metadataRebootInstancesInput `json:"-" xml:"-"` +} + +type metadataRebootInstancesInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type RebootInstancesOutput struct { + metadataRebootInstancesOutput `json:"-" xml:"-"` +} + +type metadataRebootInstancesOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +// Describes a recurring charge. +type RecurringCharge struct { + // The amount of the recurring charge. + Amount *float64 `locationName:"amount" type:"double"` + + // The frequency of the recurring charge. + Frequency *string `locationName:"frequency" type:"string"` + + metadataRecurringCharge `json:"-" xml:"-"` +} + +type metadataRecurringCharge struct { + SDKShapeTraits bool `type:"structure"` +} + +// Describes a region. +type Region struct { + // The region service endpoint. + Endpoint *string `locationName:"regionEndpoint" type:"string"` + + // The name of the region. + RegionName *string `locationName:"regionName" type:"string"` + + metadataRegion `json:"-" xml:"-"` +} + +type metadataRegion struct { + SDKShapeTraits bool `type:"structure"` +} + +type RegisterImageInput struct { + // The architecture of the AMI. + // + // Default: For Amazon EBS-backed AMIs, i386. For instance store-backed AMIs, + // the architecture specified in the manifest file. + Architecture *string `locationName:"architecture" type:"string"` + + // One or more block device mapping entries. + BlockDeviceMappings []*BlockDeviceMapping `locationName:"BlockDeviceMapping" locationNameList:"BlockDeviceMapping" type:"list"` + + // A description for your AMI. + Description *string `locationName:"description" type:"string"` + + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // The full path to your AMI manifest in Amazon S3 storage. + ImageLocation *string `type:"string"` + + // The ID of the kernel. + KernelID *string `locationName:"kernelId" type:"string"` + + // A name for your AMI. + // + // Constraints: 3-128 alphanumeric characters, parentheses (()), square brackets + // ([]), spaces ( ), periods (.), slashes (/), dashes (-), single quotes ('), + // at-signs (@), or underscores(_) + Name *string `locationName:"name" type:"string" required:"true"` + + // The ID of the RAM disk. + RAMDiskID *string `locationName:"ramdiskId" type:"string"` + + // The name of the root device (for example, /dev/sda1, or /dev/xvda). + RootDeviceName *string `locationName:"rootDeviceName" type:"string"` + + // Set to simple to enable enhanced networking for the AMI and any instances + // that you launch from the AMI. + // + // There is no way to disable enhanced networking at this time. + // + // This option is supported only for HVM AMIs. Specifying this option with + // a PV AMI can make instances launched from the AMI unreachable. + SRIOVNetSupport *string `locationName:"sriovNetSupport" type:"string"` + + // The type of virtualization. + // + // Default: paravirtual + VirtualizationType *string `locationName:"virtualizationType" type:"string"` + + metadataRegisterImageInput `json:"-" xml:"-"` +} + +type metadataRegisterImageInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type RegisterImageOutput struct { + // The ID of the newly registered AMI. + ImageID *string `locationName:"imageId" type:"string"` + + metadataRegisterImageOutput `json:"-" xml:"-"` +} + +type metadataRegisterImageOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +type RejectVPCPeeringConnectionInput struct { + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // The ID of the VPC peering connection. + VPCPeeringConnectionID *string `locationName:"vpcPeeringConnectionId" type:"string" required:"true"` + + metadataRejectVPCPeeringConnectionInput `json:"-" xml:"-"` +} + +type metadataRejectVPCPeeringConnectionInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type RejectVPCPeeringConnectionOutput struct { + // Returns true if the request succeeds; otherwise, it returns an error. + Return *bool `locationName:"return" type:"boolean"` + + metadataRejectVPCPeeringConnectionOutput `json:"-" xml:"-"` +} + +type metadataRejectVPCPeeringConnectionOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +type ReleaseAddressInput struct { + // [EC2-VPC] The allocation ID. Required for EC2-VPC. + AllocationID *string `locationName:"AllocationId" type:"string"` + + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // [EC2-Classic] The Elastic IP address. Required for EC2-Classic. + PublicIP *string `locationName:"PublicIp" type:"string"` + + metadataReleaseAddressInput `json:"-" xml:"-"` +} + +type metadataReleaseAddressInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type ReleaseAddressOutput struct { + metadataReleaseAddressOutput `json:"-" xml:"-"` +} + +type metadataReleaseAddressOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +type ReplaceNetworkACLAssociationInput struct { + // The ID of the current association between the original network ACL and the + // subnet. + AssociationID *string `locationName:"associationId" type:"string" required:"true"` + + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // The ID of the new network ACL to associate with the subnet. + NetworkACLID *string `locationName:"networkAclId" type:"string" required:"true"` + + metadataReplaceNetworkACLAssociationInput `json:"-" xml:"-"` +} + +type metadataReplaceNetworkACLAssociationInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type ReplaceNetworkACLAssociationOutput struct { + // The ID of the new association. + NewAssociationID *string `locationName:"newAssociationId" type:"string"` + + metadataReplaceNetworkACLAssociationOutput `json:"-" xml:"-"` +} + +type metadataReplaceNetworkACLAssociationOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +type ReplaceNetworkACLEntryInput struct { + // The network range to allow or deny, in CIDR notation. + CIDRBlock *string `locationName:"cidrBlock" type:"string" required:"true"` + + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // Indicates whether to replace the egress rule. + // + // Default: If no value is specified, we replace the ingress rule. + Egress *bool `locationName:"egress" type:"boolean" required:"true"` + + // ICMP protocol: The ICMP type and code. Required if specifying 1 (ICMP) for + // the protocol. + ICMPTypeCode *ICMPTypeCode `locationName:"Icmp" type:"structure"` + + // The ID of the ACL. + NetworkACLID *string `locationName:"networkAclId" type:"string" required:"true"` + + // TCP or UDP protocols: The range of ports the rule applies to. Required if + // specifying 6 (TCP) or 17 (UDP) for the protocol. + PortRange *PortRange `locationName:"portRange" type:"structure"` + + // The IP protocol. You can specify all or -1 to mean all protocols. + Protocol *string `locationName:"protocol" type:"string" required:"true"` + + // Indicates whether to allow or deny the traffic that matches the rule. + RuleAction *string `locationName:"ruleAction" type:"string" required:"true"` + + // The rule number of the entry to replace. + RuleNumber *int64 `locationName:"ruleNumber" type:"integer" required:"true"` + + metadataReplaceNetworkACLEntryInput `json:"-" xml:"-"` +} + +type metadataReplaceNetworkACLEntryInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type ReplaceNetworkACLEntryOutput struct { + metadataReplaceNetworkACLEntryOutput `json:"-" xml:"-"` +} + +type metadataReplaceNetworkACLEntryOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +type ReplaceRouteInput struct { + // The CIDR address block used for the destination match. The value you provide + // must match the CIDR of an existing route in the table. + DestinationCIDRBlock *string `locationName:"destinationCidrBlock" type:"string" required:"true"` + + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // The ID of an Internet gateway or virtual private gateway. + GatewayID *string `locationName:"gatewayId" type:"string"` + + // The ID of a NAT instance in your VPC. + InstanceID *string `locationName:"instanceId" type:"string"` + + // The ID of a network interface. + NetworkInterfaceID *string `locationName:"networkInterfaceId" type:"string"` + + // The ID of the route table. + RouteTableID *string `locationName:"routeTableId" type:"string" required:"true"` + + // The ID of a VPC peering connection. + VPCPeeringConnectionID *string `locationName:"vpcPeeringConnectionId" type:"string"` + + metadataReplaceRouteInput `json:"-" xml:"-"` +} + +type metadataReplaceRouteInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type ReplaceRouteOutput struct { + metadataReplaceRouteOutput `json:"-" xml:"-"` +} + +type metadataReplaceRouteOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +type ReplaceRouteTableAssociationInput struct { + // The association ID. + AssociationID *string `locationName:"associationId" type:"string" required:"true"` + + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // The ID of the new route table to associate with the subnet. + RouteTableID *string `locationName:"routeTableId" type:"string" required:"true"` + + metadataReplaceRouteTableAssociationInput `json:"-" xml:"-"` +} + +type metadataReplaceRouteTableAssociationInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type ReplaceRouteTableAssociationOutput struct { + // The ID of the new association. + NewAssociationID *string `locationName:"newAssociationId" type:"string"` + + metadataReplaceRouteTableAssociationOutput `json:"-" xml:"-"` +} + +type metadataReplaceRouteTableAssociationOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +type ReportInstanceStatusInput struct { + // Descriptive text about the health state of your instance. + Description *string `locationName:"description" type:"string"` + + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // The time at which the reported instance health state ended. + EndTime *time.Time `locationName:"endTime" type:"timestamp" timestampFormat:"iso8601"` + + // One or more instances. + Instances []*string `locationName:"instanceId" locationNameList:"InstanceId" type:"list" required:"true"` + + // One or more reason codes that describes the health state of your instance. + // + // instance-stuck-in-state: My instance is stuck in a state. + // + // unresponsive: My instance is unresponsive. + // + // not-accepting-credentials: My instance is not accepting my credentials. + // + // password-not-available: A password is not available for my instance. + // + // performance-network: My instance is experiencing performance problems which + // I believe are network related. + // + // performance-instance-store: My instance is experiencing performance problems + // which I believe are related to the instance stores. + // + // performance-ebs-volume: My instance is experiencing performance problems + // which I believe are related to an EBS volume. + // + // performance-other: My instance is experiencing performance problems. + // + // other: [explain using the description parameter] + ReasonCodes []*string `locationName:"reasonCode" locationNameList:"item" type:"list" required:"true"` + + // The time at which the reported instance health state began. + StartTime *time.Time `locationName:"startTime" type:"timestamp" timestampFormat:"iso8601"` + + // The status of all instances listed. + Status *string `locationName:"status" type:"string" required:"true"` + + metadataReportInstanceStatusInput `json:"-" xml:"-"` +} + +type metadataReportInstanceStatusInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type ReportInstanceStatusOutput struct { + metadataReportInstanceStatusOutput `json:"-" xml:"-"` +} + +type metadataReportInstanceStatusOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +type RequestSpotInstancesInput struct { + // The user-specified name for a logical grouping of bids. + // + // When you specify an Availability Zone group in a Spot Instance request, + // all Spot Instances in the request are launched in the same Availability Zone. + // Instance proximity is maintained with this parameter, but the choice of Availability + // Zone is not. The group applies only to bids for Spot Instances of the same + // instance type. Any additional Spot Instance requests that are specified with + // the same Availability Zone group name are launched in that same Availability + // Zone, as long as at least one instance from the group is still active. + // + // If there is no active instance running in the Availability Zone group that + // you specify for a new Spot Instance request (all instances are terminated, + // the bid is expired, or the bid falls below current market), then Amazon EC2 + // launches the instance in any Availability Zone where the constraint can be + // met. Consequently, the subsequent set of Spot Instances could be placed in + // a different zone from the original request, even if you specified the same + // Availability Zone group. + // + // Default: Instances are launched in any available Availability Zone. + AvailabilityZoneGroup *string `locationName:"availabilityZoneGroup" type:"string"` + + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // The maximum number of Spot Instances to launch. + // + // Default: 1 + InstanceCount *int64 `locationName:"instanceCount" type:"integer"` + + // The instance launch group. Launch groups are Spot Instances that launch together + // and terminate together. + // + // Default: Instances are launched and terminated individually + LaunchGroup *string `locationName:"launchGroup" type:"string"` + + // Describes the launch specification for an instance. + LaunchSpecification *RequestSpotLaunchSpecification `type:"structure"` + + // The maximum hourly price (bid) for any Spot Instance launched to fulfill + // the request. + SpotPrice *string `locationName:"spotPrice" type:"string" required:"true"` + + // The Spot Instance request type. + // + // Default: one-time + Type *string `locationName:"type" type:"string"` + + // The start date of the request. If this is a one-time request, the request + // becomes active at this date and time and remains active until all instances + // launch, the request expires, or the request is canceled. If the request is + // persistent, the request becomes active at this date and time and remains + // active until it expires or is canceled. + // + // Default: The request is effective indefinitely. + ValidFrom *time.Time `locationName:"validFrom" type:"timestamp" timestampFormat:"iso8601"` + + // The end date of the request. If this is a one-time request, the request remains + // active until all instances launch, the request is canceled, or this date + // is reached. If the request is persistent, it remains active until it is canceled + // or this date and time is reached. + // + // Default: The request is effective indefinitely. + ValidUntil *time.Time `locationName:"validUntil" type:"timestamp" timestampFormat:"iso8601"` + + metadataRequestSpotInstancesInput `json:"-" xml:"-"` +} + +type metadataRequestSpotInstancesInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type RequestSpotInstancesOutput struct { + // One or more Spot Instance requests. + SpotInstanceRequests []*SpotInstanceRequest `locationName:"spotInstanceRequestSet" locationNameList:"item" type:"list"` + + metadataRequestSpotInstancesOutput `json:"-" xml:"-"` +} + +type metadataRequestSpotInstancesOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +// Describes the launch specification for an instance. +type RequestSpotLaunchSpecification struct { + // Deprecated. + AddressingType *string `locationName:"addressingType" type:"string"` + + // One or more block device mapping entries. + BlockDeviceMappings []*BlockDeviceMapping `locationName:"blockDeviceMapping" locationNameList:"item" type:"list"` + + // Indicates whether the instance is 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 `locationName:"ebsOptimized" type:"boolean"` + + // The IAM instance profile. + IAMInstanceProfile *IAMInstanceProfileSpecification `locationName:"iamInstanceProfile" type:"structure"` + + // The ID of the AMI. + ImageID *string `locationName:"imageId" type:"string"` + + // The instance type. + InstanceType *string `locationName:"instanceType" type:"string"` + + // The ID of the kernel. + KernelID *string `locationName:"kernelId" type:"string"` + + // The name of the key pair. + KeyName *string `locationName:"keyName" type:"string"` + + // Describes the monitoring for the instance. + Monitoring *RunInstancesMonitoringEnabled `locationName:"monitoring" type:"structure"` + + // One or more network interfaces. + NetworkInterfaces []*InstanceNetworkInterfaceSpecification `locationName:"NetworkInterface" locationNameList:"item" type:"list"` + + // The placement information for the instance. + Placement *SpotPlacement `locationName:"placement" type:"structure"` + + // The ID of the RAM disk. + RAMDiskID *string `locationName:"ramdiskId" type:"string"` + + SecurityGroupIDs []*string `locationName:"SecurityGroupId" locationNameList:"item" type:"list"` + + SecurityGroups []*string `locationName:"SecurityGroup" locationNameList:"item" type:"list"` + + // The ID of the subnet in which to launch the instance. + SubnetID *string `locationName:"subnetId" type:"string"` + + // The Base64-encoded MIME user data to make available to the instances. + UserData *string `locationName:"userData" type:"string"` + + metadataRequestSpotLaunchSpecification `json:"-" xml:"-"` +} + +type metadataRequestSpotLaunchSpecification struct { + SDKShapeTraits bool `type:"structure"` +} + +// Describes a reservation. +type Reservation struct { + // One or more security groups. + Groups []*GroupIdentifier `locationName:"groupSet" locationNameList:"item" type:"list"` + + // One or more instances. + Instances []*Instance `locationName:"instancesSet" locationNameList:"item" type:"list"` + + // The ID of the AWS account that owns the reservation. + OwnerID *string `locationName:"ownerId" type:"string"` + + // The ID of the requester that launched the instances on your behalf (for example, + // AWS Management Console or Auto Scaling). + RequesterID *string `locationName:"requesterId" type:"string"` + + // The ID of the reservation. + ReservationID *string `locationName:"reservationId" type:"string"` + + metadataReservation `json:"-" xml:"-"` +} + +type metadataReservation struct { + SDKShapeTraits bool `type:"structure"` +} + +// Describes the limit price of a Reserved Instance offering. +type ReservedInstanceLimitPrice struct { + // Used for Reserved Instance Marketplace offerings. Specifies the limit price + // on the total order (instanceCount * price). + Amount *float64 `locationName:"amount" type:"double"` + + // The currency in which the limitPrice amount is specified. At this time, the + // only supported currency is USD. + CurrencyCode *string `locationName:"currencyCode" type:"string"` + + metadataReservedInstanceLimitPrice `json:"-" xml:"-"` +} + +type metadataReservedInstanceLimitPrice struct { + SDKShapeTraits bool `type:"structure"` +} + +// Describes a Reserved Instance. +type ReservedInstances struct { + // 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 + // currency codes. At this time, the only supported currency is USD. + CurrencyCode *string `locationName:"currencyCode" type:"string"` + + // The duration of the Reserved Instance, in seconds. + Duration *int64 `locationName:"duration" type:"long"` + + // The time when the Reserved Instance expires. + End *time.Time `locationName:"end" type:"timestamp" timestampFormat:"iso8601"` + + // The purchase price of the Reserved Instance. + FixedPrice *float64 `locationName:"fixedPrice" type:"float"` + + // The number of Reserved Instances purchased. + InstanceCount *int64 `locationName:"instanceCount" type:"integer"` + + // The tenancy of the reserved instance. + InstanceTenancy *string `locationName:"instanceTenancy" type:"string"` + + // The instance type on which the Reserved Instance can be used. + InstanceType *string `locationName:"instanceType" type:"string"` + + // The Reserved Instance offering type. + OfferingType *string `locationName:"offeringType" type:"string"` + + // The Reserved Instance description. + ProductDescription *string `locationName:"productDescription" type:"string"` + + // The recurring charge tag assigned to the resource. + RecurringCharges []*RecurringCharge `locationName:"recurringCharges" locationNameList:"item" type:"list"` + + // The ID of the Reserved Instance. + ReservedInstancesID *string `locationName:"reservedInstancesId" type:"string"` + + // The date and time the Reserved Instance started. + Start *time.Time `locationName:"start" type:"timestamp" timestampFormat:"iso8601"` + + // The state of the Reserved Instance purchase. + State *string `locationName:"state" type:"string"` + + // Any tags assigned to the resource. + Tags []*Tag `locationName:"tagSet" locationNameList:"item" type:"list"` + + // The usage price of the Reserved Instance, per hour. + UsagePrice *float64 `locationName:"usagePrice" type:"float"` + + metadataReservedInstances `json:"-" xml:"-"` +} + +type metadataReservedInstances struct { + SDKShapeTraits bool `type:"structure"` +} + +// Describes the configuration settings for the modified Reserved Instances. +type ReservedInstancesConfiguration struct { + // The Availability Zone for the modified Reserved Instances. + AvailabilityZone *string `locationName:"availabilityZone" type:"string"` + + // The number of modified Reserved Instances. + InstanceCount *int64 `locationName:"instanceCount" type:"integer"` + + // The instance type for the modified Reserved Instances. + InstanceType *string `locationName:"instanceType" type:"string"` + + // The network platform of the modified Reserved Instances, which is either + // EC2-Classic or EC2-VPC. + Platform *string `locationName:"platform" type:"string"` + + metadataReservedInstancesConfiguration `json:"-" xml:"-"` +} + +type metadataReservedInstancesConfiguration struct { + SDKShapeTraits bool `type:"structure"` +} + +// Describes the ID of a Reserved Instance. +type ReservedInstancesID struct { + // The ID of the Reserved Instance. + ReservedInstancesID *string `locationName:"reservedInstancesId" type:"string"` + + metadataReservedInstancesID `json:"-" xml:"-"` +} + +type metadataReservedInstancesID struct { + SDKShapeTraits bool `type:"structure"` +} + +// Describes a Reserved Instance listing. +type ReservedInstancesListing struct { + // A unique, case-sensitive key supplied by the client to ensure that the request + // is idempotent. 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 time the listing was created. + CreateDate *time.Time `locationName:"createDate" type:"timestamp" timestampFormat:"iso8601"` + + // The number of instances in this state. + InstanceCounts []*InstanceCount `locationName:"instanceCounts" locationNameList:"item" type:"list"` + + // The price of the Reserved Instance listing. + PriceSchedules []*PriceSchedule `locationName:"priceSchedules" locationNameList:"item" type:"list"` + + // The ID of the Reserved Instance. + ReservedInstancesID *string `locationName:"reservedInstancesId" type:"string"` + + // The ID of the Reserved Instance listing. + ReservedInstancesListingID *string `locationName:"reservedInstancesListingId" type:"string"` + + // The status of the Reserved Instance listing. + Status *string `locationName:"status" type:"string"` + + // The reason for the current status of the Reserved Instance listing. The response + // can be blank. + StatusMessage *string `locationName:"statusMessage" type:"string"` + + // Any tags assigned to the resource. + Tags []*Tag `locationName:"tagSet" locationNameList:"item" type:"list"` + + // The last modified timestamp of the listing. + UpdateDate *time.Time `locationName:"updateDate" type:"timestamp" timestampFormat:"iso8601"` + + metadataReservedInstancesListing `json:"-" xml:"-"` +} + +type metadataReservedInstancesListing struct { + SDKShapeTraits bool `type:"structure"` +} + +// Describes a Reserved Instance modification. +type ReservedInstancesModification struct { + // A unique, case-sensitive key supplied by the client to ensure that the request + // is idempotent. 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 time when the modification request was created. + CreateDate *time.Time `locationName:"createDate" type:"timestamp" timestampFormat:"iso8601"` + + // The time for the modification to become effective. + EffectiveDate *time.Time `locationName:"effectiveDate" type:"timestamp" timestampFormat:"iso8601"` + + // Contains target configurations along with their corresponding new Reserved + // Instance IDs. + ModificationResults []*ReservedInstancesModificationResult `locationName:"modificationResultSet" locationNameList:"item" type:"list"` + + // The IDs of one or more Reserved Instances. + ReservedInstancesIDs []*ReservedInstancesID `locationName:"reservedInstancesSet" locationNameList:"item" type:"list"` + + // A unique ID for the Reserved Instance modification. + ReservedInstancesModificationID *string `locationName:"reservedInstancesModificationId" type:"string"` + + // The status of the Reserved Instances modification request. + Status *string `locationName:"status" type:"string"` + + // The reason for the status. + StatusMessage *string `locationName:"statusMessage" type:"string"` + + // The time when the modification request was last updated. + UpdateDate *time.Time `locationName:"updateDate" type:"timestamp" timestampFormat:"iso8601"` + + metadataReservedInstancesModification `json:"-" xml:"-"` +} + +type metadataReservedInstancesModification struct { + SDKShapeTraits bool `type:"structure"` +} + +type ReservedInstancesModificationResult struct { + // 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 + // request. + TargetConfiguration *ReservedInstancesConfiguration `locationName:"targetConfiguration" type:"structure"` + + metadataReservedInstancesModificationResult `json:"-" xml:"-"` +} + +type metadataReservedInstancesModificationResult struct { + SDKShapeTraits bool `type:"structure"` +} + +// Describes a Reserved Instance offering. +type ReservedInstancesOffering struct { + // 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 + // using ISO 4217 standard currency codes. At this time, the only supported + // currency is USD. + CurrencyCode *string `locationName:"currencyCode" type:"string"` + + // The duration of the Reserved Instance, in seconds. + Duration *int64 `locationName:"duration" type:"long"` + + // The purchase price of the Reserved Instance. + FixedPrice *float64 `locationName:"fixedPrice" type:"float"` + + // The tenancy of the reserved instance. + InstanceTenancy *string `locationName:"instanceTenancy" type:"string"` + + // The instance type on which the Reserved Instance can be used. + InstanceType *string `locationName:"instanceType" type:"string"` + + // Indicates whether the offering is available through the Reserved Instance + // Marketplace (resale) or AWS. If it's a Reserved Instance Marketplace offering, + // this is true. + Marketplace *bool `locationName:"marketplace" type:"boolean"` + + // The Reserved Instance offering type. + OfferingType *string `locationName:"offeringType" type:"string"` + + // The pricing details of the Reserved Instance offering. + PricingDetails []*PricingDetail `locationName:"pricingDetailsSet" locationNameList:"item" type:"list"` + + // The Reserved Instance description. + ProductDescription *string `locationName:"productDescription" type:"string"` + + // The recurring charge tag assigned to the resource. + RecurringCharges []*RecurringCharge `locationName:"recurringCharges" locationNameList:"item" type:"list"` + + // The ID of the Reserved Instance offering. + ReservedInstancesOfferingID *string `locationName:"reservedInstancesOfferingId" type:"string"` + + // The usage price of the Reserved Instance, per hour. + UsagePrice *float64 `locationName:"usagePrice" type:"float"` + + metadataReservedInstancesOffering `json:"-" xml:"-"` +} + +type metadataReservedInstancesOffering struct { + SDKShapeTraits bool `type:"structure"` +} + +type ResetImageAttributeInput struct { + // The attribute to reset (currently you can only reset the launch permission + // attribute). + Attribute *string `type:"string" required:"true"` + + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // The ID of the AMI. + ImageID *string `locationName:"ImageId" type:"string" required:"true"` + + metadataResetImageAttributeInput `json:"-" xml:"-"` +} + +type metadataResetImageAttributeInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type ResetImageAttributeOutput struct { + metadataResetImageAttributeOutput `json:"-" xml:"-"` +} + +type metadataResetImageAttributeOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +type ResetInstanceAttributeInput struct { + // The attribute to reset. + Attribute *string `locationName:"attribute" type:"string" required:"true"` + + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // The ID of the instance. + InstanceID *string `locationName:"instanceId" type:"string" required:"true"` + + metadataResetInstanceAttributeInput `json:"-" xml:"-"` +} + +type metadataResetInstanceAttributeInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type ResetInstanceAttributeOutput struct { + metadataResetInstanceAttributeOutput `json:"-" xml:"-"` +} + +type metadataResetInstanceAttributeOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +type ResetNetworkInterfaceAttributeInput struct { + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // The ID of the network interface. + NetworkInterfaceID *string `locationName:"networkInterfaceId" type:"string" required:"true"` + + // The source/destination checking attribute. Resets the value to true. + SourceDestCheck *string `locationName:"sourceDestCheck" type:"string"` + + metadataResetNetworkInterfaceAttributeInput `json:"-" xml:"-"` +} + +type metadataResetNetworkInterfaceAttributeInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type ResetNetworkInterfaceAttributeOutput struct { + metadataResetNetworkInterfaceAttributeOutput `json:"-" xml:"-"` +} + +type metadataResetNetworkInterfaceAttributeOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +type ResetSnapshotAttributeInput struct { + // The attribute to reset (currently only the attribute for permission to create + // volumes can be reset). + Attribute *string `type:"string" required:"true"` + + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // The ID of the snapshot. + SnapshotID *string `locationName:"SnapshotId" type:"string" required:"true"` + + metadataResetSnapshotAttributeInput `json:"-" xml:"-"` +} + +type metadataResetSnapshotAttributeInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type ResetSnapshotAttributeOutput struct { + metadataResetSnapshotAttributeOutput `json:"-" xml:"-"` +} + +type metadataResetSnapshotAttributeOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +type RevokeSecurityGroupEgressInput struct { + // The CIDR IP address range. You can't specify this parameter when specifying + // a source security group. + CIDRIP *string `locationName:"cidrIp" type:"string"` + + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // The start of port range for the TCP and UDP protocols, or an ICMP type number. + // For the ICMP type number, use -1 to specify all ICMP types. + FromPort *int64 `locationName:"fromPort" type:"integer"` + + // The ID of the security group. + GroupID *string `locationName:"groupId" type:"string" required:"true"` + + // A set of IP permissions. You can't specify a destination security group and + // a CIDR IP address range. + IPPermissions []*IPPermission `locationName:"ipPermissions" locationNameList:"item" type:"list"` + + // The IP protocol name (tcp, udp, icmp) or number (see Protocol Numbers (http://www.iana.org/assignments/protocol-numbers/protocol-numbers.xhtml)). + // Use -1 to specify all. + IPProtocol *string `locationName:"ipProtocol" type:"string"` + + // [EC2-Classic, default VPC] The name of the destination security group. You + // can't specify a destination security group and a CIDR IP address range. + SourceSecurityGroupName *string `locationName:"sourceSecurityGroupName" type:"string"` + + // The ID of the destination security group. You can't specify a destination + // security group and a CIDR IP address range. + SourceSecurityGroupOwnerID *string `locationName:"sourceSecurityGroupOwnerId" type:"string"` + + // The end of port range for the TCP and UDP protocols, or an ICMP code number. + // For the ICMP code number, use -1 to specify all ICMP codes for the ICMP type. + ToPort *int64 `locationName:"toPort" type:"integer"` + + metadataRevokeSecurityGroupEgressInput `json:"-" xml:"-"` +} + +type metadataRevokeSecurityGroupEgressInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type RevokeSecurityGroupEgressOutput struct { + metadataRevokeSecurityGroupEgressOutput `json:"-" xml:"-"` +} + +type metadataRevokeSecurityGroupEgressOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +type RevokeSecurityGroupIngressInput struct { + // The CIDR IP address range. You can't specify this parameter when specifying + // a source security group. + CIDRIP *string `locationName:"CidrIp" type:"string"` + + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // The start of port range for the TCP and UDP protocols, or an ICMP type number. + // For the ICMP type number, use -1 to specify all ICMP types. + FromPort *int64 `type:"integer"` + + // The ID of the security group. + GroupID *string `locationName:"GroupId" type:"string"` + + // [EC2-Classic, default VPC] The name of the security group. + GroupName *string `type:"string"` + + // A set of IP permissions. You can't specify a source security group and a + // CIDR IP address range. + IPPermissions []*IPPermission `locationName:"IpPermissions" locationNameList:"item" type:"list"` + + // The IP protocol name (tcp, udp, icmp) or number (see Protocol Numbers (http://www.iana.org/assignments/protocol-numbers/protocol-numbers.xhtml)). + // Use -1 to specify all. + IPProtocol *string `locationName:"IpProtocol" type:"string"` + + // [EC2-Classic, default VPC] The name of the source security group. You can't + // specify a source security group and a CIDR IP address range. + SourceSecurityGroupName *string `type:"string"` + + // The ID of the source security group. You can't specify a source security + // group and a CIDR IP address range. + SourceSecurityGroupOwnerID *string `locationName:"SourceSecurityGroupOwnerId" type:"string"` + + // The end of port range for the TCP and UDP protocols, or an ICMP code number. + // For the ICMP code number, use -1 to specify all ICMP codes for the ICMP type. + ToPort *int64 `type:"integer"` + + metadataRevokeSecurityGroupIngressInput `json:"-" xml:"-"` +} + +type metadataRevokeSecurityGroupIngressInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type RevokeSecurityGroupIngressOutput struct { + metadataRevokeSecurityGroupIngressOutput `json:"-" xml:"-"` +} + +type metadataRevokeSecurityGroupIngressOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +// Describes a route in a route table. +type Route struct { + // The CIDR block used for the destination match. + DestinationCIDRBlock *string `locationName:"destinationCidrBlock" type:"string"` + + // The ID of a gateway attached to your VPC. + GatewayID *string `locationName:"gatewayId" type:"string"` + + // The ID of a NAT instance in your VPC. + InstanceID *string `locationName:"instanceId" type:"string"` + + // The AWS account ID of the owner of the instance. + InstanceOwnerID *string `locationName:"instanceOwnerId" type:"string"` + + // The ID of the network interface. + NetworkInterfaceID *string `locationName:"networkInterfaceId" type:"string"` + + // Describes how the route was created. + // + // CreateRouteTable indicates that route was automatically created when the + // route table was created. CreateRoute indicates that the route was manually + // added to the route table. EnableVgwRoutePropagation indicates that the route + // was propagated by route propagation. + Origin *string `locationName:"origin" type:"string"` + + // The state of the route. The blackhole state indicates that the route's target + // isn't available (for example, the specified gateway isn't attached to the + // VPC, or the specified NAT instance has been terminated). + State *string `locationName:"state" type:"string"` + + // The ID of the VPC peering connection. + VPCPeeringConnectionID *string `locationName:"vpcPeeringConnectionId" type:"string"` + + metadataRoute `json:"-" xml:"-"` +} + +type metadataRoute struct { + SDKShapeTraits bool `type:"structure"` +} + +// Describes a route table. +type RouteTable struct { + // The associations between the route table and one or more subnets. + Associations []*RouteTableAssociation `locationName:"associationSet" locationNameList:"item" type:"list"` + + // Any virtual private gateway (VGW) propagating routes. + PropagatingVGWs []*PropagatingVGW `locationName:"propagatingVgwSet" locationNameList:"item" type:"list"` + + // The ID of the route table. + RouteTableID *string `locationName:"routeTableId" type:"string"` + + // The routes in the route table. + Routes []*Route `locationName:"routeSet" locationNameList:"item" type:"list"` + + // Any tags assigned to the route table. + Tags []*Tag `locationName:"tagSet" locationNameList:"item" type:"list"` + + // The ID of the VPC. + VPCID *string `locationName:"vpcId" type:"string"` + + metadataRouteTable `json:"-" xml:"-"` +} + +type metadataRouteTable struct { + SDKShapeTraits bool `type:"structure"` +} + +// Describes an association between a route table and a subnet. +type RouteTableAssociation struct { + // Indicates whether this is the main route table. + Main *bool `locationName:"main" type:"boolean"` + + // The ID of the association between a route table and a subnet. + RouteTableAssociationID *string `locationName:"routeTableAssociationId" type:"string"` + + // The ID of the route table. + RouteTableID *string `locationName:"routeTableId" type:"string"` + + // The ID of the subnet. + SubnetID *string `locationName:"subnetId" type:"string"` + + metadataRouteTableAssociation `json:"-" xml:"-"` +} + +type metadataRouteTableAssociation struct { + SDKShapeTraits bool `type:"structure"` +} + +type RunInstancesInput struct { + // Reserved. + AdditionalInfo *string `locationName:"additionalInfo" type:"string"` + + // The block device mapping. + BlockDeviceMappings []*BlockDeviceMapping `locationName:"BlockDeviceMapping" locationNameList:"BlockDeviceMapping" type:"list"` + + // Unique, case-sensitive identifier you provide to ensure the idempotency of + // the request. For more information, see Ensuring Idempotency (http://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html). + // + // Constraints: Maximum 64 ASCII characters + ClientToken *string `locationName:"clientToken" type:"string"` + + // If you set this parameter to true, you can't terminate the instance using + // the Amazon EC2 console, CLI, or API; otherwise, you can. If you set this + // parameter to true and then later want to be able to terminate the instance, + // you must first change the value of the disableApiTermination attribute to + // false using ModifyInstanceAttribute. Alternatively, if you set InstanceInitiatedShutdownBehavior + // to terminate, you can terminate the instance by running the shutdown command + // from the instance. + // + // Default: false + DisableAPITermination *bool `locationName:"disableApiTermination" type:"boolean"` + + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // Indicates whether the instance is optimized for EBS I/O. This optimization + // provides dedicated throughput to Amazon EBS and an optimized configuration + // stack to provide optimal Amazon 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 `locationName:"ebsOptimized" type:"boolean"` + + // The IAM instance profile. + IAMInstanceProfile *IAMInstanceProfileSpecification `locationName:"iamInstanceProfile" type:"structure"` + + // The ID of the AMI, which you can get by calling DescribeImages. + ImageID *string `locationName:"ImageId" type:"string" required:"true"` + + // Indicates whether an instance stops or terminates when you initiate shutdown + // from the instance (using the operating system command for system shutdown). + // + // Default: stop + InstanceInitiatedShutdownBehavior *string `locationName:"instanceInitiatedShutdownBehavior" type:"string"` + + // The instance type. For more information, see Instance Types (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-types.html) + // in the Amazon Elastic Compute Cloud User Guide. + // + // Default: m1.small + InstanceType *string `type:"string"` + + // The ID of the kernel. + // + // We recommend that you use PV-GRUB instead of kernels and RAM disks. For + // more information, see PV-GRUB (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/UserProvidedkernels.html) + // in the Amazon Elastic Compute Cloud User Guide. + KernelID *string `locationName:"KernelId" type:"string"` + + // The name of the key pair. You can create a key pair using CreateKeyPair or + // ImportKeyPair. + // + // If you launch an instance without specifying a key pair, you can't connect + // to the instance. + KeyName *string `type:"string"` + + // The maximum number of instances to launch. If you specify more instances + // than Amazon EC2 can launch in the target Availability Zone, Amazon EC2 launches + // the largest possible number of instances above MinCount. + // + // 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. + MaxCount *int64 `type:"integer" required:"true"` + + // The minimum number of instances to launch. If you specify a minimum that + // is more instances than Amazon EC2 can launch in the target Availability Zone, + // Amazon EC2 launches no instances. + // + // 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. + MinCount *int64 `type:"integer" required:"true"` + + // The monitoring for the instance. + Monitoring *RunInstancesMonitoringEnabled `type:"structure"` + + // One or more network interfaces. + NetworkInterfaces []*InstanceNetworkInterfaceSpecification `locationName:"networkInterface" locationNameList:"item" type:"list"` + + // The placement for the instance. + Placement *Placement `type:"structure"` + + // [EC2-VPC] The primary IP address. You must specify a value from the IP address + // range of the subnet. + // + // Only one private IP address can be designated as primary. Therefore, you + // can't specify this parameter if PrivateIpAddresses.n.Primary is set to true + // and PrivateIpAddresses.n.PrivateIpAddress is set to an IP address. + // + // Default: We select an IP address from the IP address range of the subnet. + PrivateIPAddress *string `locationName:"privateIpAddress" type:"string"` + + // The ID of the RAM disk. + // + // We recommend that you use PV-GRUB instead of kernels and RAM disks. For + // more information, see PV-GRUB (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/UserProvidedkernels.html) + // in the Amazon Elastic Compute Cloud User Guide. + RAMDiskID *string `locationName:"RamdiskId" type:"string"` + + // One or more security group IDs. You can create a security group using CreateSecurityGroup. + // + // Default: Amazon EC2 uses the default security group. + SecurityGroupIDs []*string `locationName:"SecurityGroupId" locationNameList:"SecurityGroupId" type:"list"` + + // [EC2-Classic, default VPC] One or more security group names. For a nondefault + // VPC, you must use security group IDs instead. + // + // Default: Amazon EC2 uses the default security group. + SecurityGroups []*string `locationName:"SecurityGroup" locationNameList:"SecurityGroup" type:"list"` + + // [EC2-VPC] The ID of the subnet to launch the instance into. + SubnetID *string `locationName:"SubnetId" type:"string"` + + // The Base64-encoded MIME user data for the instances. + UserData *string `type:"string"` + + metadataRunInstancesInput `json:"-" xml:"-"` +} + +type metadataRunInstancesInput struct { + SDKShapeTraits bool `type:"structure"` +} + +// Describes the monitoring for the instance. +type RunInstancesMonitoringEnabled struct { + // Indicates whether monitoring is enabled for the instance. + Enabled *bool `locationName:"enabled" type:"boolean" required:"true"` + + metadataRunInstancesMonitoringEnabled `json:"-" xml:"-"` +} + +type metadataRunInstancesMonitoringEnabled struct { + SDKShapeTraits bool `type:"structure"` +} + +// Describes the storage parameters for S3 and S3 buckets for an instance store-backed +// AMI. +type S3Storage struct { + // The access key ID of the owner of the bucket. Before you specify a value + // for your access key ID, review and follow the guidance in Best Practices + // for Managing AWS Access Keys (http://docs.aws.amazon.com/general/latest/gr/aws-access-keys-best-practices.html). + AWSAccessKeyID *string `locationName:"AWSAccessKeyId" type:"string"` + + // The bucket in which to store the AMI. You can specify a bucket that you already + // own or a new bucket that Amazon EC2 creates on your behalf. If you specify + // a bucket that belongs to someone else, Amazon EC2 returns an error. + Bucket *string `locationName:"bucket" type:"string"` + + // The beginning of the file name of the AMI. + Prefix *string `locationName:"prefix" type:"string"` + + // A Base64-encoded Amazon S3 upload policy that gives Amazon EC2 permission + // to upload items into Amazon S3 on your behalf. + UploadPolicy []byte `locationName:"uploadPolicy" type:"blob"` + + // The signature of the Base64 encoded JSON document. + UploadPolicySignature *string `locationName:"uploadPolicySignature" type:"string"` + + metadataS3Storage `json:"-" xml:"-"` +} + +type metadataS3Storage struct { + SDKShapeTraits bool `type:"structure"` +} + +// Describes a security group +type SecurityGroup struct { + // A description of the security group. + Description *string `locationName:"groupDescription" type:"string"` + + // The ID of the security group. + GroupID *string `locationName:"groupId" type:"string"` + + // The name of the security group. + GroupName *string `locationName:"groupName" type:"string"` + + // One or more inbound rules associated with the security group. + IPPermissions []*IPPermission `locationName:"ipPermissions" locationNameList:"item" type:"list"` + + // [EC2-VPC] One or more outbound rules associated with the security group. + IPPermissionsEgress []*IPPermission `locationName:"ipPermissionsEgress" locationNameList:"item" type:"list"` + + // The AWS account ID of the owner of the security group. + OwnerID *string `locationName:"ownerId" type:"string"` + + // Any tags assigned to the security group. + Tags []*Tag `locationName:"tagSet" locationNameList:"item" type:"list"` + + // [EC2-VPC] The ID of the VPC for the security group. + VPCID *string `locationName:"vpcId" type:"string"` + + metadataSecurityGroup `json:"-" xml:"-"` +} + +type metadataSecurityGroup struct { + SDKShapeTraits bool `type:"structure"` +} + +// Describes a snapshot. +type Snapshot struct { + // The description for the snapshot. + Description *string `locationName:"description" type:"string"` + + // Indicates whether the snapshot is encrypted. + Encrypted *bool `locationName:"encrypted" type:"boolean"` + + // The full ARN of the AWS Key Management Service (KMS) master key that was + // used to protect the volume encryption key for the parent volume. + KMSKeyID *string `locationName:"kmsKeyId" type:"string"` + + // The AWS account alias (for example, amazon, self) or AWS account ID that + // owns the snapshot. + OwnerAlias *string `locationName:"ownerAlias" type:"string"` + + // The AWS account ID of the Amazon EBS snapshot owner. + OwnerID *string `locationName:"ownerId" type:"string"` + + // The progress of the snapshot, as a percentage. + Progress *string `locationName:"progress" type:"string"` + + // The ID of the snapshot. + SnapshotID *string `locationName:"snapshotId" type:"string"` + + // The time stamp when the snapshot was initiated. + StartTime *time.Time `locationName:"startTime" type:"timestamp" timestampFormat:"iso8601"` + + // The snapshot state. + State *string `locationName:"status" type:"string"` + + // Any tags assigned to the snapshot. + Tags []*Tag `locationName:"tagSet" locationNameList:"item" type:"list"` + + // The ID of the volume. + VolumeID *string `locationName:"volumeId" type:"string"` + + // The size of the volume, in GiB. + VolumeSize *int64 `locationName:"volumeSize" type:"integer"` + + metadataSnapshot `json:"-" xml:"-"` +} + +type metadataSnapshot struct { + SDKShapeTraits bool `type:"structure"` +} + +// The details of the snapshot created from the imported disk. +type SnapshotDetail struct { + // Description for the snapshot. + Description *string `locationName:"description" type:"string"` + + // The Amazon EBS block device mapping for the snapshot. + DeviceName *string `locationName:"deviceName" type:"string"` + + // The size of the disk in the snapshot. + DiskImageSize *float64 `locationName:"diskImageSize" type:"double"` + + // The format of the disk image from which the snapshot is created. + Format *string `locationName:"format" type:"string"` + + // The percentage of progress for the task. + Progress *string `locationName:"progress" type:"string"` + + // The snapshot ID of the disk being imported. + SnapshotID *string `locationName:"snapshotId" type:"string"` + + // A brief status of the snapshot creation. + Status *string `locationName:"status" type:"string"` + + // A detailed status message for the snapshot creation. + StatusMessage *string `locationName:"statusMessage" type:"string"` + + // The URL used to access the disk image. + URL *string `locationName:"url" type:"string"` + + // User's Amazon S3 bucket details used to access the image. + UserBucket *UserBucketDetails `locationName:"userBucket" type:"structure"` + + metadataSnapshotDetail `json:"-" xml:"-"` +} + +type metadataSnapshotDetail struct { + SDKShapeTraits bool `type:"structure"` +} + +// The disk container object for the ImportSnapshot request. +type SnapshotDiskContainer struct { + // The description of the disk image being imported. + Description *string `type:"string"` + + // The format of the disk image being imported. + Format *string `type:"string"` + + // The URL to the Amazon S3-based disk image being imported. It can either be + // a https URL (https://..) or an Amazon S3 URL (s3://..). + URL *string `locationName:"Url" type:"string"` + + // User's Amazon S3 bucket details used to access the image. + UserBucket *UserBucket `type:"structure"` + + metadataSnapshotDiskContainer `json:"-" xml:"-"` +} + +type metadataSnapshotDiskContainer struct { + SDKShapeTraits bool `type:"structure"` +} + +// Details about the import snapshot task. +type SnapshotTaskDetail struct { + // The description of the snapshot. + Description *string `locationName:"description" type:"string"` + + // The size of the disk in the snapshot. + DiskImageSize *float64 `locationName:"diskImageSize" type:"double"` + + // The format of the disk image from which the snapshot is created. + Format *string `locationName:"format" type:"string"` + + // The percentage of completion for the ImportSnapshot task. + Progress *string `locationName:"progress" type:"string"` + + // The snapshot ID of the disk being imported. + SnapshotID *string `locationName:"snapshotId" type:"string"` + + // A brief status for the ImportSnapshot task. + Status *string `locationName:"status" type:"string"` + + // A detailed status message for the ImportSnapshot task. + StatusMessage *string `locationName:"statusMessage" type:"string"` + + // The URL of the disk image from which the snapshot is created. + URL *string `locationName:"url" type:"string"` + + // User's Amazon S3 bucket details used to access the image. + UserBucket *UserBucketDetails `locationName:"userBucket" type:"structure"` + + metadataSnapshotTaskDetail `json:"-" xml:"-"` +} + +type metadataSnapshotTaskDetail struct { + SDKShapeTraits bool `type:"structure"` +} + +// Describes the data feed for a Spot Instance. +type SpotDatafeedSubscription struct { + // The Amazon S3 bucket where the Spot Instance data feed is located. + Bucket *string `locationName:"bucket" type:"string"` + + // The fault codes for the Spot Instance request, if any. + Fault *SpotInstanceStateFault `locationName:"fault" type:"structure"` + + // The AWS account ID of the account. + OwnerID *string `locationName:"ownerId" type:"string"` + + // The prefix that is prepended to data feed files. + Prefix *string `locationName:"prefix" type:"string"` + + // The state of the Spot Instance data feed subscription. + State *string `locationName:"state" type:"string"` + + metadataSpotDatafeedSubscription `json:"-" xml:"-"` +} + +type metadataSpotDatafeedSubscription struct { + SDKShapeTraits bool `type:"structure"` +} + +// Describe a Spot Instance request. +type SpotInstanceRequest struct { + // The Availability Zone group. If you specify the same Availability Zone group + // for all Spot Instance requests, all Spot Instances are launched in the same + // Availability Zone. + AvailabilityZoneGroup *string `locationName:"availabilityZoneGroup" type:"string"` + + // The time stamp when the Spot Instance request was created. + CreateTime *time.Time `locationName:"createTime" type:"timestamp" timestampFormat:"iso8601"` + + // The fault codes for the Spot Instance request, if any. + Fault *SpotInstanceStateFault `locationName:"fault" type:"structure"` + + // The instance ID, if an instance has been launched to fulfill the Spot Instance + // request. + InstanceID *string `locationName:"instanceId" type:"string"` + + // The instance launch group. Launch groups are Spot Instances that launch together + // and terminate together. + LaunchGroup *string `locationName:"launchGroup" type:"string"` + + // Additional information for launching instances. + LaunchSpecification *LaunchSpecification `locationName:"launchSpecification" type:"structure"` + + // The Availability Zone in which the bid is launched. + LaunchedAvailabilityZone *string `locationName:"launchedAvailabilityZone" type:"string"` + + // The product description associated with the Spot Instance. + ProductDescription *string `locationName:"productDescription" type:"string"` + + // The ID of the Spot Instance request. + SpotInstanceRequestID *string `locationName:"spotInstanceRequestId" type:"string"` + + // The maximum hourly price (bid) for any Spot Instance launched to fulfill + // the request. + SpotPrice *string `locationName:"spotPrice" type:"string"` + + // The state of the Spot Instance request. Spot bid status information can help + // you track your Spot Instance requests. For more information, see Spot Bid + // Status (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/spot-bid-status.html) + // in the Amazon Elastic Compute Cloud User Guide. + State *string `locationName:"state" type:"string"` + + // The status code and status message describing the Spot Instance request. + Status *SpotInstanceStatus `locationName:"status" type:"structure"` + + // Any tags assigned to the resource. + Tags []*Tag `locationName:"tagSet" locationNameList:"item" type:"list"` + + // The Spot Instance request type. + Type *string `locationName:"type" type:"string"` + + // The start date of the request. If this is a one-time request, the request + // becomes active at this date and time and remains active until all instances + // launch, the request expires, or the request is canceled. If the request is + // persistent, the request becomes active at this date and time and remains + // active until it expires or is canceled. + ValidFrom *time.Time `locationName:"validFrom" type:"timestamp" timestampFormat:"iso8601"` + + // The end date of the request. If this is a one-time request, the request remains + // active until all instances launch, the request is canceled, or this date + // is reached. If the request is persistent, it remains active until it is canceled + // or this date is reached. + ValidUntil *time.Time `locationName:"validUntil" type:"timestamp" timestampFormat:"iso8601"` + + metadataSpotInstanceRequest `json:"-" xml:"-"` +} + +type metadataSpotInstanceRequest struct { + SDKShapeTraits bool `type:"structure"` +} + +// Describes a Spot Instance state change. +type SpotInstanceStateFault struct { + // The reason code for the Spot Instance state change. + Code *string `locationName:"code" type:"string"` + + // The message for the Spot Instance state change. + Message *string `locationName:"message" type:"string"` + + metadataSpotInstanceStateFault `json:"-" xml:"-"` +} + +type metadataSpotInstanceStateFault struct { + SDKShapeTraits bool `type:"structure"` +} + +// Describes the status of a Spot Instance request. +type SpotInstanceStatus struct { + // The status code. + Code *string `locationName:"code" type:"string"` + + // The description for the status code. + Message *string `locationName:"message" type:"string"` + + // The time of the most recent status update. + UpdateTime *time.Time `locationName:"updateTime" type:"timestamp" timestampFormat:"iso8601"` + + metadataSpotInstanceStatus `json:"-" xml:"-"` +} + +type metadataSpotInstanceStatus struct { + SDKShapeTraits bool `type:"structure"` +} + +// Describes Spot Instance placement. +type SpotPlacement struct { + // The Availability Zone. + AvailabilityZone *string `locationName:"availabilityZone" type:"string"` + + // The name of the placement group (for cluster instances). + GroupName *string `locationName:"groupName" type:"string"` + + metadataSpotPlacement `json:"-" xml:"-"` +} + +type metadataSpotPlacement struct { + SDKShapeTraits bool `type:"structure"` +} + +// Describes the maximum hourly price (bid) for any Spot Instance launched to +// fulfill the request. +type SpotPrice struct { + // The Availability Zone. + AvailabilityZone *string `locationName:"availabilityZone" type:"string"` + + // The instance type. + InstanceType *string `locationName:"instanceType" type:"string"` + + // A general description of the AMI. + ProductDescription *string `locationName:"productDescription" type:"string"` + + // The maximum price (bid) that you are willing to pay for a Spot Instance. + SpotPrice *string `locationName:"spotPrice" type:"string"` + + // The date and time the request was created. + Timestamp *time.Time `locationName:"timestamp" type:"timestamp" timestampFormat:"iso8601"` + + metadataSpotPrice `json:"-" xml:"-"` +} + +type metadataSpotPrice struct { + SDKShapeTraits bool `type:"structure"` +} + +type StartInstancesInput struct { + // Reserved. + AdditionalInfo *string `locationName:"additionalInfo" type:"string"` + + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // One or more instance IDs. + InstanceIDs []*string `locationName:"InstanceId" locationNameList:"InstanceId" type:"list" required:"true"` + + metadataStartInstancesInput `json:"-" xml:"-"` +} + +type metadataStartInstancesInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type StartInstancesOutput struct { + // Information about one or more started instances. + StartingInstances []*InstanceStateChange `locationName:"instancesSet" locationNameList:"item" type:"list"` + + metadataStartInstancesOutput `json:"-" xml:"-"` +} + +type metadataStartInstancesOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +// Describes a state change. +type StateReason struct { + // The reason code for the state change. + Code *string `locationName:"code" type:"string"` + + // The message for the state change. + // + // Server.SpotInstanceTermination: A Spot Instance was terminated due to an + // increase in the market price. + // + // Server.InternalError: An internal error occurred during instance launch, + // resulting in termination. + // + // Server.InsufficientInstanceCapacity: There was insufficient instance capacity + // to satisfy the launch request. + // + // Client.InternalError: A client error caused the instance to terminate on + // launch. + // + // Client.InstanceInitiatedShutdown: The instance was shut down using the shutdown + // -h command from the instance. + // + // Client.UserInitiatedShutdown: The instance was shut down using the Amazon + // EC2 API. + // + // Client.VolumeLimitExceeded: The volume limit was exceeded. + // + // Client.InvalidSnapshot.NotFound: The specified snapshot was not found. + Message *string `locationName:"message" type:"string"` + + metadataStateReason `json:"-" xml:"-"` +} + +type metadataStateReason struct { + SDKShapeTraits bool `type:"structure"` +} + +type StopInstancesInput struct { + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // Forces the instances to stop. The instances do not have an opportunity to + // flush file system caches or file system metadata. If you use this option, + // you must perform file system check and repair procedures. This option is + // not recommended for Windows instances. + // + // Default: false + Force *bool `locationName:"force" type:"boolean"` + + // One or more instance IDs. + InstanceIDs []*string `locationName:"InstanceId" locationNameList:"InstanceId" type:"list" required:"true"` + + metadataStopInstancesInput `json:"-" xml:"-"` +} + +type metadataStopInstancesInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type StopInstancesOutput struct { + // Information about one or more stopped instances. + StoppingInstances []*InstanceStateChange `locationName:"instancesSet" locationNameList:"item" type:"list"` + + metadataStopInstancesOutput `json:"-" xml:"-"` +} + +type metadataStopInstancesOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +// Describes the storage location for an instance store-backed AMI. +type Storage struct { + // An Amazon S3 storage location. + S3 *S3Storage `type:"structure"` + + metadataStorage `json:"-" xml:"-"` +} + +type metadataStorage struct { + SDKShapeTraits bool `type:"structure"` +} + +// Describes a subnet. +type Subnet struct { + // The Availability Zone of the subnet. + AvailabilityZone *string `locationName:"availabilityZone" type:"string"` + + // The number of unused IP addresses in the subnet. Note that the IP addresses + // for any stopped instances are considered unavailable. + AvailableIPAddressCount *int64 `locationName:"availableIpAddressCount" type:"integer"` + + // The CIDR block assigned to the subnet. + CIDRBlock *string `locationName:"cidrBlock" type:"string"` + + // Indicates whether this is the default subnet for the Availability Zone. + DefaultForAZ *bool `locationName:"defaultForAz" type:"boolean"` + + // Indicates whether instances launched in this subnet receive a public IP address. + MapPublicIPOnLaunch *bool `locationName:"mapPublicIpOnLaunch" type:"boolean"` + + // The current state of the subnet. + State *string `locationName:"state" type:"string"` + + // The ID of the subnet. + SubnetID *string `locationName:"subnetId" type:"string"` + + // Any tags assigned to the subnet. + Tags []*Tag `locationName:"tagSet" locationNameList:"item" type:"list"` + + // The ID of the VPC the subnet is in. + VPCID *string `locationName:"vpcId" type:"string"` + + metadataSubnet `json:"-" xml:"-"` +} + +type metadataSubnet struct { + SDKShapeTraits bool `type:"structure"` +} + +// Describes a tag. +type Tag struct { + // The key of the tag. + // + // Constraints: Tag keys are case-sensitive and accept a maximum of 127 Unicode + // characters. May not begin with aws: + Key *string `locationName:"key" type:"string"` + + // The value of the tag. + // + // Constraints: Tag values are case-sensitive and accept a maximum of 255 Unicode + // characters. + Value *string `locationName:"value" type:"string"` + + metadataTag `json:"-" xml:"-"` +} + +type metadataTag struct { + SDKShapeTraits bool `type:"structure"` +} + +// Describes a tag. +type TagDescription struct { + // The tag key. + Key *string `locationName:"key" type:"string"` + + // The ID of the resource. For example, ami-1a2b3c4d. + ResourceID *string `locationName:"resourceId" type:"string"` + + // The resource type. + ResourceType *string `locationName:"resourceType" type:"string"` + + // The tag value. + Value *string `locationName:"value" type:"string"` + + metadataTagDescription `json:"-" xml:"-"` +} + +type metadataTagDescription struct { + SDKShapeTraits bool `type:"structure"` +} + +type TerminateInstancesInput struct { + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // One or more instance IDs. + InstanceIDs []*string `locationName:"InstanceId" locationNameList:"InstanceId" type:"list" required:"true"` + + metadataTerminateInstancesInput `json:"-" xml:"-"` +} + +type metadataTerminateInstancesInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type TerminateInstancesOutput struct { + // Information about one or more terminated instances. + TerminatingInstances []*InstanceStateChange `locationName:"instancesSet" locationNameList:"item" type:"list"` + + metadataTerminateInstancesOutput `json:"-" xml:"-"` +} + +type metadataTerminateInstancesOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +type UnassignPrivateIPAddressesInput struct { + // The ID of the network interface. + NetworkInterfaceID *string `locationName:"networkInterfaceId" type:"string" required:"true"` + + // The secondary private IP addresses to unassign from the network interface. + // You can specify this option multiple times to unassign more than one IP address. + PrivateIPAddresses []*string `locationName:"privateIpAddress" locationNameList:"PrivateIpAddress" type:"list" required:"true"` + + metadataUnassignPrivateIPAddressesInput `json:"-" xml:"-"` +} + +type metadataUnassignPrivateIPAddressesInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type UnassignPrivateIPAddressesOutput struct { + metadataUnassignPrivateIPAddressesOutput `json:"-" xml:"-"` +} + +type metadataUnassignPrivateIPAddressesOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +type UnmonitorInstancesInput struct { + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // One or more instance IDs. + InstanceIDs []*string `locationName:"InstanceId" locationNameList:"InstanceId" type:"list" required:"true"` + + metadataUnmonitorInstancesInput `json:"-" xml:"-"` +} + +type metadataUnmonitorInstancesInput struct { + SDKShapeTraits bool `type:"structure"` +} + +type UnmonitorInstancesOutput struct { + // Monitoring information for one or more instances. + InstanceMonitorings []*InstanceMonitoring `locationName:"instancesSet" locationNameList:"item" type:"list"` + + metadataUnmonitorInstancesOutput `json:"-" xml:"-"` +} + +type metadataUnmonitorInstancesOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +// User's Amazon S3 bucket details used to access the image. +type UserBucket struct { + // The Amazon S3 bucket name where the disk image is located. + S3Bucket *string `type:"string"` + + // The Amazon S3 Key for the disk image. + S3Key *string `type:"string"` + + metadataUserBucket `json:"-" xml:"-"` +} + +type metadataUserBucket struct { + SDKShapeTraits bool `type:"structure"` +} + +// User's Amazon S3 bucket details used to access the image. +type UserBucketDetails struct { + // The Amazon S3 bucket from which the disk image was created. + S3Bucket *string `locationName:"s3Bucket" type:"string"` + + // The Amazon S3 key from which the disk image was created. + S3Key *string `locationName:"s3Key" type:"string"` + + metadataUserBucketDetails `json:"-" xml:"-"` +} + +type metadataUserBucketDetails struct { + SDKShapeTraits bool `type:"structure"` +} + +type UserData struct { + Data *string `locationName:"data" type:"string"` + + metadataUserData `json:"-" xml:"-"` +} + +type metadataUserData struct { + SDKShapeTraits bool `type:"structure"` +} + +// Describes a security group and AWS account ID pair. +type UserIDGroupPair struct { + // The ID of the security group. + GroupID *string `locationName:"groupId" type:"string"` + + // The name of the security group. In a request, use this parameter for a security + // group in EC2-Classic or a default VPC only. For a security group in a nondefault + // VPC, use GroupId. + GroupName *string `locationName:"groupName" type:"string"` + + // The ID of an AWS account. EC2-Classic only. + UserID *string `locationName:"userId" type:"string"` + + metadataUserIDGroupPair `json:"-" xml:"-"` +} + +type metadataUserIDGroupPair struct { + SDKShapeTraits bool `type:"structure"` +} + +// Describes telemetry for a VPN tunnel. +type VGWTelemetry struct { + // The number of accepted routes. + AcceptedRouteCount *int64 `locationName:"acceptedRouteCount" type:"integer"` + + // The date and time of the last change in status. + LastStatusChange *time.Time `locationName:"lastStatusChange" type:"timestamp" timestampFormat:"iso8601"` + + // The Internet-routable IP address of the virtual private gateway's outside + // interface. + OutsideIPAddress *string `locationName:"outsideIpAddress" type:"string"` + + // The status of the VPN tunnel. + Status *string `locationName:"status" type:"string"` + + // If an error occurs, a description of the error. + StatusMessage *string `locationName:"statusMessage" type:"string"` + + metadataVGWTelemetry `json:"-" xml:"-"` +} + +type metadataVGWTelemetry struct { + SDKShapeTraits bool `type:"structure"` +} + +// Describes a VPC. +type VPC struct { + // The CIDR block for the VPC. + CIDRBlock *string `locationName:"cidrBlock" type:"string"` + + // The ID of the set of DHCP options you've associated with the VPC (or default + // if the default options are associated with the VPC). + DHCPOptionsID *string `locationName:"dhcpOptionsId" type:"string"` + + // The allowed tenancy of instances launched into the VPC. + InstanceTenancy *string `locationName:"instanceTenancy" type:"string"` + + // Indicates whether the VPC is the default VPC. + IsDefault *bool `locationName:"isDefault" type:"boolean"` + + // The current state of the VPC. + State *string `locationName:"state" type:"string"` + + // Any tags assigned to the VPC. + Tags []*Tag `locationName:"tagSet" locationNameList:"item" type:"list"` + + // The ID of the VPC. + VPCID *string `locationName:"vpcId" type:"string"` + + metadataVPC `json:"-" xml:"-"` +} + +type metadataVPC struct { + SDKShapeTraits bool `type:"structure"` +} + +// Describes an attachment between a virtual private gateway and a VPC. +type VPCAttachment struct { + // The current state of the attachment. + State *string `locationName:"state" type:"string"` + + // The ID of the VPC. + VPCID *string `locationName:"vpcId" type:"string"` + + metadataVPCAttachment `json:"-" xml:"-"` +} + +type metadataVPCAttachment struct { + SDKShapeTraits bool `type:"structure"` +} + +// Describes whether a VPC is enabled for ClassicLink. +type VPCClassicLink struct { + // Indicates whether the VPC is enabled for ClassicLink. + ClassicLinkEnabled *bool `locationName:"classicLinkEnabled" type:"boolean"` + + // Any tags assigned to the VPC. + Tags []*Tag `locationName:"tagSet" locationNameList:"item" type:"list"` + + // The ID of the VPC. + VPCID *string `locationName:"vpcId" type:"string"` + + metadataVPCClassicLink `json:"-" xml:"-"` +} + +type metadataVPCClassicLink struct { + SDKShapeTraits bool `type:"structure"` +} + +// Describes a VPC peering connection. +type VPCPeeringConnection struct { + // The information of the peer VPC. + AccepterVPCInfo *VPCPeeringConnectionVPCInfo `locationName:"accepterVpcInfo" type:"structure"` + + // The time that an unaccepted VPC peering connection will expire. + ExpirationTime *time.Time `locationName:"expirationTime" type:"timestamp" timestampFormat:"iso8601"` + + // The information of the requester VPC. + RequesterVPCInfo *VPCPeeringConnectionVPCInfo `locationName:"requesterVpcInfo" type:"structure"` + + // The status of the VPC peering connection. + Status *VPCPeeringConnectionStateReason `locationName:"status" type:"structure"` + + // Any tags assigned to the resource. + Tags []*Tag `locationName:"tagSet" locationNameList:"item" type:"list"` + + // The ID of the VPC peering connection. + VPCPeeringConnectionID *string `locationName:"vpcPeeringConnectionId" type:"string"` + + metadataVPCPeeringConnection `json:"-" xml:"-"` +} + +type metadataVPCPeeringConnection struct { + SDKShapeTraits bool `type:"structure"` +} + +// Describes the status of a VPC peering connection. +type VPCPeeringConnectionStateReason struct { + // The status of the VPC peering connection. + Code *string `locationName:"code" type:"string"` + + // A message that provides more information about the status, if applicable. + Message *string `locationName:"message" type:"string"` + + metadataVPCPeeringConnectionStateReason `json:"-" xml:"-"` +} + +type metadataVPCPeeringConnectionStateReason struct { + SDKShapeTraits bool `type:"structure"` +} + +// Describes a VPC in a VPC peering connection. +type VPCPeeringConnectionVPCInfo struct { + // The CIDR block for the VPC. + CIDRBlock *string `locationName:"cidrBlock" type:"string"` + + // The AWS account ID of the VPC owner. + OwnerID *string `locationName:"ownerId" type:"string"` + + // The ID of the VPC. + VPCID *string `locationName:"vpcId" type:"string"` + + metadataVPCPeeringConnectionVPCInfo `json:"-" xml:"-"` +} + +type metadataVPCPeeringConnectionVPCInfo struct { + SDKShapeTraits bool `type:"structure"` +} + +// Describes a VPN connection. +type VPNConnection struct { + // The configuration information for the VPN connection's customer gateway (in + // the native XML format). This element is always present in the CreateVpnConnection + // response; however, it's present in the DescribeVpnConnections response only + // if the VPN connection is in the pending or available state. + CustomerGatewayConfiguration *string `locationName:"customerGatewayConfiguration" type:"string"` + + // The ID of the customer gateway at your end of the VPN connection. + CustomerGatewayID *string `locationName:"customerGatewayId" type:"string"` + + // The VPN connection options. + Options *VPNConnectionOptions `locationName:"options" type:"structure"` + + // The static routes associated with the VPN connection. + Routes []*VPNStaticRoute `locationName:"routes" locationNameList:"item" type:"list"` + + // The current state of the VPN connection. + State *string `locationName:"state" type:"string"` + + // Any tags assigned to the VPN connection. + Tags []*Tag `locationName:"tagSet" locationNameList:"item" type:"list"` + + // The type of VPN connection. + Type *string `locationName:"type" type:"string"` + + // Information about the VPN tunnel. + VGWTelemetry []*VGWTelemetry `locationName:"vgwTelemetry" locationNameList:"item" type:"list"` + + // The ID of the VPN connection. + VPNConnectionID *string `locationName:"vpnConnectionId" type:"string"` + + // The ID of the virtual private gateway at the AWS side of the VPN connection. + VPNGatewayID *string `locationName:"vpnGatewayId" type:"string"` + + metadataVPNConnection `json:"-" xml:"-"` +} + +type metadataVPNConnection struct { + SDKShapeTraits bool `type:"structure"` +} + +// Describes VPN connection options. +type VPNConnectionOptions struct { + // Indicates whether the VPN connection uses static routes only. Static routes + // must be used for devices that don't support BGP. + StaticRoutesOnly *bool `locationName:"staticRoutesOnly" type:"boolean"` + + metadataVPNConnectionOptions `json:"-" xml:"-"` +} + +type metadataVPNConnectionOptions struct { + SDKShapeTraits bool `type:"structure"` +} + +// Describes VPN connection options. +type VPNConnectionOptionsSpecification struct { + // Indicates whether the VPN connection uses static routes only. Static routes + // must be used for devices that don't support BGP. + StaticRoutesOnly *bool `locationName:"staticRoutesOnly" type:"boolean"` + + metadataVPNConnectionOptionsSpecification `json:"-" xml:"-"` +} + +type metadataVPNConnectionOptionsSpecification struct { + SDKShapeTraits bool `type:"structure"` +} + +// Describes a virtual private gateway. +type VPNGateway struct { + // The Availability Zone where the virtual private gateway was created. + AvailabilityZone *string `locationName:"availabilityZone" type:"string"` + + // The current state of the virtual private gateway. + State *string `locationName:"state" type:"string"` + + // Any tags assigned to the virtual private gateway. + Tags []*Tag `locationName:"tagSet" locationNameList:"item" type:"list"` + + // The type of VPN connection the virtual private gateway supports. + Type *string `locationName:"type" type:"string"` + + // Any VPCs attached to the virtual private gateway. + VPCAttachments []*VPCAttachment `locationName:"attachments" locationNameList:"item" type:"list"` + + // The ID of the virtual private gateway. + VPNGatewayID *string `locationName:"vpnGatewayId" type:"string"` + + metadataVPNGateway `json:"-" xml:"-"` +} + +type metadataVPNGateway struct { + SDKShapeTraits bool `type:"structure"` +} + +// Describes a static route for a VPN connection. +type VPNStaticRoute struct { + // The CIDR block associated with the local subnet of the customer data center. + DestinationCIDRBlock *string `locationName:"destinationCidrBlock" type:"string"` + + // Indicates how the routes were provided. + Source *string `locationName:"source" type:"string"` + + // The current state of the static route. + State *string `locationName:"state" type:"string"` + + metadataVPNStaticRoute `json:"-" xml:"-"` +} + +type metadataVPNStaticRoute struct { + SDKShapeTraits bool `type:"structure"` +} + +// Describes a volume. +type Volume struct { + Attachments []*VolumeAttachment `locationName:"attachmentSet" locationNameList:"item" type:"list"` + + // The Availability Zone for the volume. + AvailabilityZone *string `locationName:"availabilityZone" type:"string"` + + // The time stamp when volume creation was initiated. + CreateTime *time.Time `locationName:"createTime" type:"timestamp" timestampFormat:"iso8601"` + + // Indicates whether the volume will be encrypted. + Encrypted *bool `locationName:"encrypted" 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 on 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 `locationName:"iops" type:"integer"` + + // The full ARN of the AWS Key Management Service (KMS) master key that was + // used to protect the volume encryption key for the volume. + KMSKeyID *string `locationName:"kmsKeyId" type:"string"` + + // The size of the volume, in GiBs. + Size *int64 `locationName:"size" type:"integer"` + + // The snapshot from which the volume was created, if applicable. + SnapshotID *string `locationName:"snapshotId" type:"string"` + + // The volume state. + State *string `locationName:"status" type:"string"` + + // Any tags assigned to the volume. + Tags []*Tag `locationName:"tagSet" locationNameList:"item" type:"list"` + + // The ID of the volume. + VolumeID *string `locationName:"volumeId" type:"string"` + + // The volume type. This can be gp2 for General Purpose (SSD) volumes, io1 for + // Provisioned IOPS (SSD) volumes, or standard for Magnetic volumes. + VolumeType *string `locationName:"volumeType" type:"string"` + + metadataVolume `json:"-" xml:"-"` +} + +type metadataVolume struct { + SDKShapeTraits bool `type:"structure"` +} + +// Describes volume attachment details. +type VolumeAttachment struct { + // The time stamp when the attachment initiated. + AttachTime *time.Time `locationName:"attachTime" type:"timestamp" timestampFormat:"iso8601"` + + // Indicates whether the Amazon EBS volume is deleted on instance termination. + DeleteOnTermination *bool `locationName:"deleteOnTermination" type:"boolean"` + + // The device name. + Device *string `locationName:"device" type:"string"` + + // The ID of the instance. + InstanceID *string `locationName:"instanceId" type:"string"` + + // The attachment state of the volume. + State *string `locationName:"status" type:"string"` + + // The ID of the volume. + VolumeID *string `locationName:"volumeId" type:"string"` + + metadataVolumeAttachment `json:"-" xml:"-"` +} + +type metadataVolumeAttachment struct { + SDKShapeTraits bool `type:"structure"` +} + +// Describes an Amazon EBS volume. +type VolumeDetail struct { + // The size of the volume, in GiB. + Size *int64 `locationName:"size" type:"long" required:"true"` + + metadataVolumeDetail `json:"-" xml:"-"` +} + +type metadataVolumeDetail struct { + SDKShapeTraits bool `type:"structure"` +} + +// Describes a volume status operation code. +type VolumeStatusAction struct { + // The code identifying the operation, for example, enable-volume-io. + Code *string `locationName:"code" type:"string"` + + // A description of the operation. + Description *string `locationName:"description" type:"string"` + + // The ID of the event associated with this operation. + EventID *string `locationName:"eventId" type:"string"` + + // The event type associated with this operation. + EventType *string `locationName:"eventType" type:"string"` + + metadataVolumeStatusAction `json:"-" xml:"-"` +} + +type metadataVolumeStatusAction struct { + SDKShapeTraits bool `type:"structure"` +} + +// Describes a volume status. +type VolumeStatusDetails struct { + // The name of the volume status. + Name *string `locationName:"name" type:"string"` + + // The intended status of the volume status. + Status *string `locationName:"status" type:"string"` + + metadataVolumeStatusDetails `json:"-" xml:"-"` +} + +type metadataVolumeStatusDetails struct { + SDKShapeTraits bool `type:"structure"` +} + +// Describes a volume status event. +type VolumeStatusEvent struct { + // A description of the event. + Description *string `locationName:"description" type:"string"` + + // The ID of this event. + EventID *string `locationName:"eventId" type:"string"` + + // The type of this event. + EventType *string `locationName:"eventType" type:"string"` + + // The latest end time of the event. + NotAfter *time.Time `locationName:"notAfter" type:"timestamp" timestampFormat:"iso8601"` + + // The earliest start time of the event. + NotBefore *time.Time `locationName:"notBefore" type:"timestamp" timestampFormat:"iso8601"` + + metadataVolumeStatusEvent `json:"-" xml:"-"` +} + +type metadataVolumeStatusEvent struct { + SDKShapeTraits bool `type:"structure"` +} + +// Describes the status of a volume. +type VolumeStatusInfo struct { + // The details of the volume status. + Details []*VolumeStatusDetails `locationName:"details" locationNameList:"item" type:"list"` + + // The status of the volume. + Status *string `locationName:"status" type:"string"` + + metadataVolumeStatusInfo `json:"-" xml:"-"` +} + +type metadataVolumeStatusInfo struct { + SDKShapeTraits bool `type:"structure"` +} + +// Describes the volume status. +type VolumeStatusItem struct { + // The details of the operation. + Actions []*VolumeStatusAction `locationName:"actionsSet" locationNameList:"item" type:"list"` + + // The Availability Zone of the volume. + AvailabilityZone *string `locationName:"availabilityZone" type:"string"` + + // A list of events associated with the volume. + Events []*VolumeStatusEvent `locationName:"eventsSet" locationNameList:"item" type:"list"` + + // The volume ID. + VolumeID *string `locationName:"volumeId" type:"string"` + + // The volume status. + VolumeStatus *VolumeStatusInfo `locationName:"volumeStatus" type:"structure"` + + metadataVolumeStatusItem `json:"-" xml:"-"` +} + +type metadataVolumeStatusItem struct { + SDKShapeTraits bool `type:"structure"` +} diff --git a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/service/ec2/customizations.go b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/service/ec2/customizations.go new file mode 100644 index 00000000000..216e6a7daac --- /dev/null +++ b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/service/ec2/customizations.go @@ -0,0 +1,57 @@ +package ec2 + +import ( + "time" + + "github.com/awslabs/aws-sdk-go/aws" + "github.com/awslabs/aws-sdk-go/aws/awsutil" +) + +func init() { + initRequest = func(r *aws.Request) { + if r.Operation == opCopySnapshot { // fill the PresignedURL parameter + r.Handlers.Build.PushFront(fillPresignedURL) + } + } +} + +func fillPresignedURL(r *aws.Request) { + if !r.ParamsFilled() { + return + } + + params := r.Params.(*CopySnapshotInput) + + // Stop if PresignedURL/DestinationRegion is set + if params.PresignedURL != nil || params.DestinationRegion != nil { + return + } + + // First generate a copy of parameters + r.Params = awsutil.CopyOf(r.Params) + params = r.Params.(*CopySnapshotInput) + + // Set destination region. Avoids infinite handler loop. + // Also needed to sign sub-request. + params.DestinationRegion = &r.Service.Config.Region + + // Create a new client pointing at source region. + // We will use this to presign the CopySnapshot request against + // the source region + config := r.Service.Config.Copy() + + config.Endpoint = "" + config.Region = *params.SourceRegion + client := New(&config) + + // Presign a CopySnapshot request with modified params + req, _ := client.CopySnapshotRequest(params) + url, err := req.Presign(300 * time.Second) // 5 minutes should be enough. + + if err != nil { // bubble error back up to original request + r.Error = err + } + + // We have our URL, set it on params + params.PresignedURL = &url +} diff --git a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/service/ec2/customizations_test.go b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/service/ec2/customizations_test.go new file mode 100644 index 00000000000..f00bebc1109 --- /dev/null +++ b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/service/ec2/customizations_test.go @@ -0,0 +1,38 @@ +// +build !integration + +package ec2_test + +import ( + "io/ioutil" + "net/url" + "testing" + + "github.com/awslabs/aws-sdk-go/aws" + "github.com/awslabs/aws-sdk-go/internal/test/unit" + "github.com/awslabs/aws-sdk-go/service/ec2" + "github.com/stretchr/testify/assert" +) + +var _ = unit.Imported + +func TestCopySnapshotPresignedURL(t *testing.T) { + svc := ec2.New(&aws.Config{Region: "us-west-2"}) + + assert.NotPanics(t, func() { + // Doesn't panic on nil input + req, _ := svc.CopySnapshotRequest(nil) + req.Sign() + }) + + req, _ := svc.CopySnapshotRequest(&ec2.CopySnapshotInput{ + SourceRegion: aws.String("us-west-1"), + SourceSnapshotID: aws.String("snap-id"), + }) + req.Sign() + + b, _ := ioutil.ReadAll(req.HTTPRequest.Body) + q, _ := url.ParseQuery(string(b)) + url, _ := url.QueryUnescape(q.Get("PresignedUrl")) + assert.Equal(t, "us-west-2", q.Get("DestinationRegion")) + assert.Regexp(t, `^https://ec2\.us-west-1\.amazon.+&DestinationRegion=us-west-2`, url) +} diff --git a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/service/ec2/ec2iface/interface.go b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/service/ec2/ec2iface/interface.go new file mode 100644 index 00000000000..6f6e76d30fa --- /dev/null +++ b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/service/ec2/ec2iface/interface.go @@ -0,0 +1,337 @@ +package ec2iface + +import ( + "github.com/awslabs/aws-sdk-go/service/ec2" +) + +type EC2API interface { + AcceptVPCPeeringConnection(*ec2.AcceptVPCPeeringConnectionInput) (*ec2.AcceptVPCPeeringConnectionOutput, error) + + AllocateAddress(*ec2.AllocateAddressInput) (*ec2.AllocateAddressOutput, error) + + AssignPrivateIPAddresses(*ec2.AssignPrivateIPAddressesInput) (*ec2.AssignPrivateIPAddressesOutput, error) + + AssociateAddress(*ec2.AssociateAddressInput) (*ec2.AssociateAddressOutput, error) + + AssociateDHCPOptions(*ec2.AssociateDHCPOptionsInput) (*ec2.AssociateDHCPOptionsOutput, error) + + AssociateRouteTable(*ec2.AssociateRouteTableInput) (*ec2.AssociateRouteTableOutput, error) + + AttachClassicLinkVPC(*ec2.AttachClassicLinkVPCInput) (*ec2.AttachClassicLinkVPCOutput, error) + + AttachInternetGateway(*ec2.AttachInternetGatewayInput) (*ec2.AttachInternetGatewayOutput, error) + + AttachNetworkInterface(*ec2.AttachNetworkInterfaceInput) (*ec2.AttachNetworkInterfaceOutput, error) + + AttachVPNGateway(*ec2.AttachVPNGatewayInput) (*ec2.AttachVPNGatewayOutput, error) + + AttachVolume(*ec2.AttachVolumeInput) (*ec2.VolumeAttachment, error) + + AuthorizeSecurityGroupEgress(*ec2.AuthorizeSecurityGroupEgressInput) (*ec2.AuthorizeSecurityGroupEgressOutput, error) + + AuthorizeSecurityGroupIngress(*ec2.AuthorizeSecurityGroupIngressInput) (*ec2.AuthorizeSecurityGroupIngressOutput, error) + + BundleInstance(*ec2.BundleInstanceInput) (*ec2.BundleInstanceOutput, error) + + CancelBundleTask(*ec2.CancelBundleTaskInput) (*ec2.CancelBundleTaskOutput, error) + + CancelConversionTask(*ec2.CancelConversionTaskInput) (*ec2.CancelConversionTaskOutput, error) + + CancelExportTask(*ec2.CancelExportTaskInput) (*ec2.CancelExportTaskOutput, error) + + CancelImportTask(*ec2.CancelImportTaskInput) (*ec2.CancelImportTaskOutput, error) + + CancelReservedInstancesListing(*ec2.CancelReservedInstancesListingInput) (*ec2.CancelReservedInstancesListingOutput, error) + + CancelSpotInstanceRequests(*ec2.CancelSpotInstanceRequestsInput) (*ec2.CancelSpotInstanceRequestsOutput, error) + + ConfirmProductInstance(*ec2.ConfirmProductInstanceInput) (*ec2.ConfirmProductInstanceOutput, error) + + CopyImage(*ec2.CopyImageInput) (*ec2.CopyImageOutput, error) + + CopySnapshot(*ec2.CopySnapshotInput) (*ec2.CopySnapshotOutput, error) + + CreateCustomerGateway(*ec2.CreateCustomerGatewayInput) (*ec2.CreateCustomerGatewayOutput, error) + + CreateDHCPOptions(*ec2.CreateDHCPOptionsInput) (*ec2.CreateDHCPOptionsOutput, error) + + CreateImage(*ec2.CreateImageInput) (*ec2.CreateImageOutput, error) + + CreateInstanceExportTask(*ec2.CreateInstanceExportTaskInput) (*ec2.CreateInstanceExportTaskOutput, error) + + CreateInternetGateway(*ec2.CreateInternetGatewayInput) (*ec2.CreateInternetGatewayOutput, error) + + CreateKeyPair(*ec2.CreateKeyPairInput) (*ec2.CreateKeyPairOutput, error) + + CreateNetworkACL(*ec2.CreateNetworkACLInput) (*ec2.CreateNetworkACLOutput, error) + + CreateNetworkACLEntry(*ec2.CreateNetworkACLEntryInput) (*ec2.CreateNetworkACLEntryOutput, error) + + CreateNetworkInterface(*ec2.CreateNetworkInterfaceInput) (*ec2.CreateNetworkInterfaceOutput, error) + + CreatePlacementGroup(*ec2.CreatePlacementGroupInput) (*ec2.CreatePlacementGroupOutput, error) + + CreateReservedInstancesListing(*ec2.CreateReservedInstancesListingInput) (*ec2.CreateReservedInstancesListingOutput, error) + + CreateRoute(*ec2.CreateRouteInput) (*ec2.CreateRouteOutput, error) + + CreateRouteTable(*ec2.CreateRouteTableInput) (*ec2.CreateRouteTableOutput, error) + + CreateSecurityGroup(*ec2.CreateSecurityGroupInput) (*ec2.CreateSecurityGroupOutput, error) + + CreateSnapshot(*ec2.CreateSnapshotInput) (*ec2.Snapshot, error) + + CreateSpotDatafeedSubscription(*ec2.CreateSpotDatafeedSubscriptionInput) (*ec2.CreateSpotDatafeedSubscriptionOutput, error) + + CreateSubnet(*ec2.CreateSubnetInput) (*ec2.CreateSubnetOutput, error) + + CreateTags(*ec2.CreateTagsInput) (*ec2.CreateTagsOutput, error) + + CreateVPC(*ec2.CreateVPCInput) (*ec2.CreateVPCOutput, error) + + CreateVPCPeeringConnection(*ec2.CreateVPCPeeringConnectionInput) (*ec2.CreateVPCPeeringConnectionOutput, error) + + CreateVPNConnection(*ec2.CreateVPNConnectionInput) (*ec2.CreateVPNConnectionOutput, error) + + CreateVPNConnectionRoute(*ec2.CreateVPNConnectionRouteInput) (*ec2.CreateVPNConnectionRouteOutput, error) + + CreateVPNGateway(*ec2.CreateVPNGatewayInput) (*ec2.CreateVPNGatewayOutput, error) + + CreateVolume(*ec2.CreateVolumeInput) (*ec2.Volume, error) + + DeleteCustomerGateway(*ec2.DeleteCustomerGatewayInput) (*ec2.DeleteCustomerGatewayOutput, error) + + DeleteDHCPOptions(*ec2.DeleteDHCPOptionsInput) (*ec2.DeleteDHCPOptionsOutput, error) + + DeleteInternetGateway(*ec2.DeleteInternetGatewayInput) (*ec2.DeleteInternetGatewayOutput, error) + + DeleteKeyPair(*ec2.DeleteKeyPairInput) (*ec2.DeleteKeyPairOutput, error) + + DeleteNetworkACL(*ec2.DeleteNetworkACLInput) (*ec2.DeleteNetworkACLOutput, error) + + DeleteNetworkACLEntry(*ec2.DeleteNetworkACLEntryInput) (*ec2.DeleteNetworkACLEntryOutput, error) + + DeleteNetworkInterface(*ec2.DeleteNetworkInterfaceInput) (*ec2.DeleteNetworkInterfaceOutput, error) + + DeletePlacementGroup(*ec2.DeletePlacementGroupInput) (*ec2.DeletePlacementGroupOutput, error) + + DeleteRoute(*ec2.DeleteRouteInput) (*ec2.DeleteRouteOutput, error) + + DeleteRouteTable(*ec2.DeleteRouteTableInput) (*ec2.DeleteRouteTableOutput, error) + + DeleteSecurityGroup(*ec2.DeleteSecurityGroupInput) (*ec2.DeleteSecurityGroupOutput, error) + + DeleteSnapshot(*ec2.DeleteSnapshotInput) (*ec2.DeleteSnapshotOutput, error) + + DeleteSpotDatafeedSubscription(*ec2.DeleteSpotDatafeedSubscriptionInput) (*ec2.DeleteSpotDatafeedSubscriptionOutput, error) + + DeleteSubnet(*ec2.DeleteSubnetInput) (*ec2.DeleteSubnetOutput, error) + + DeleteTags(*ec2.DeleteTagsInput) (*ec2.DeleteTagsOutput, error) + + DeleteVPC(*ec2.DeleteVPCInput) (*ec2.DeleteVPCOutput, error) + + DeleteVPCPeeringConnection(*ec2.DeleteVPCPeeringConnectionInput) (*ec2.DeleteVPCPeeringConnectionOutput, error) + + DeleteVPNConnection(*ec2.DeleteVPNConnectionInput) (*ec2.DeleteVPNConnectionOutput, error) + + DeleteVPNConnectionRoute(*ec2.DeleteVPNConnectionRouteInput) (*ec2.DeleteVPNConnectionRouteOutput, error) + + DeleteVPNGateway(*ec2.DeleteVPNGatewayInput) (*ec2.DeleteVPNGatewayOutput, error) + + DeleteVolume(*ec2.DeleteVolumeInput) (*ec2.DeleteVolumeOutput, error) + + DeregisterImage(*ec2.DeregisterImageInput) (*ec2.DeregisterImageOutput, error) + + DescribeAccountAttributes(*ec2.DescribeAccountAttributesInput) (*ec2.DescribeAccountAttributesOutput, error) + + DescribeAddresses(*ec2.DescribeAddressesInput) (*ec2.DescribeAddressesOutput, error) + + DescribeAvailabilityZones(*ec2.DescribeAvailabilityZonesInput) (*ec2.DescribeAvailabilityZonesOutput, error) + + DescribeBundleTasks(*ec2.DescribeBundleTasksInput) (*ec2.DescribeBundleTasksOutput, error) + + DescribeClassicLinkInstances(*ec2.DescribeClassicLinkInstancesInput) (*ec2.DescribeClassicLinkInstancesOutput, error) + + DescribeConversionTasks(*ec2.DescribeConversionTasksInput) (*ec2.DescribeConversionTasksOutput, error) + + DescribeCustomerGateways(*ec2.DescribeCustomerGatewaysInput) (*ec2.DescribeCustomerGatewaysOutput, error) + + DescribeDHCPOptions(*ec2.DescribeDHCPOptionsInput) (*ec2.DescribeDHCPOptionsOutput, error) + + DescribeExportTasks(*ec2.DescribeExportTasksInput) (*ec2.DescribeExportTasksOutput, error) + + DescribeImageAttribute(*ec2.DescribeImageAttributeInput) (*ec2.DescribeImageAttributeOutput, error) + + DescribeImages(*ec2.DescribeImagesInput) (*ec2.DescribeImagesOutput, error) + + DescribeImportImageTasks(*ec2.DescribeImportImageTasksInput) (*ec2.DescribeImportImageTasksOutput, error) + + DescribeImportSnapshotTasks(*ec2.DescribeImportSnapshotTasksInput) (*ec2.DescribeImportSnapshotTasksOutput, error) + + DescribeInstanceAttribute(*ec2.DescribeInstanceAttributeInput) (*ec2.DescribeInstanceAttributeOutput, error) + + DescribeInstanceStatus(*ec2.DescribeInstanceStatusInput) (*ec2.DescribeInstanceStatusOutput, error) + + DescribeInstances(*ec2.DescribeInstancesInput) (*ec2.DescribeInstancesOutput, error) + + DescribeInternetGateways(*ec2.DescribeInternetGatewaysInput) (*ec2.DescribeInternetGatewaysOutput, error) + + DescribeKeyPairs(*ec2.DescribeKeyPairsInput) (*ec2.DescribeKeyPairsOutput, error) + + DescribeNetworkACLs(*ec2.DescribeNetworkACLsInput) (*ec2.DescribeNetworkACLsOutput, error) + + DescribeNetworkInterfaceAttribute(*ec2.DescribeNetworkInterfaceAttributeInput) (*ec2.DescribeNetworkInterfaceAttributeOutput, error) + + DescribeNetworkInterfaces(*ec2.DescribeNetworkInterfacesInput) (*ec2.DescribeNetworkInterfacesOutput, error) + + DescribePlacementGroups(*ec2.DescribePlacementGroupsInput) (*ec2.DescribePlacementGroupsOutput, error) + + DescribeRegions(*ec2.DescribeRegionsInput) (*ec2.DescribeRegionsOutput, error) + + DescribeReservedInstances(*ec2.DescribeReservedInstancesInput) (*ec2.DescribeReservedInstancesOutput, error) + + DescribeReservedInstancesListings(*ec2.DescribeReservedInstancesListingsInput) (*ec2.DescribeReservedInstancesListingsOutput, error) + + DescribeReservedInstancesModifications(*ec2.DescribeReservedInstancesModificationsInput) (*ec2.DescribeReservedInstancesModificationsOutput, error) + + DescribeReservedInstancesOfferings(*ec2.DescribeReservedInstancesOfferingsInput) (*ec2.DescribeReservedInstancesOfferingsOutput, error) + + DescribeRouteTables(*ec2.DescribeRouteTablesInput) (*ec2.DescribeRouteTablesOutput, error) + + DescribeSecurityGroups(*ec2.DescribeSecurityGroupsInput) (*ec2.DescribeSecurityGroupsOutput, error) + + DescribeSnapshotAttribute(*ec2.DescribeSnapshotAttributeInput) (*ec2.DescribeSnapshotAttributeOutput, error) + + DescribeSnapshots(*ec2.DescribeSnapshotsInput) (*ec2.DescribeSnapshotsOutput, error) + + DescribeSpotDatafeedSubscription(*ec2.DescribeSpotDatafeedSubscriptionInput) (*ec2.DescribeSpotDatafeedSubscriptionOutput, error) + + DescribeSpotInstanceRequests(*ec2.DescribeSpotInstanceRequestsInput) (*ec2.DescribeSpotInstanceRequestsOutput, error) + + DescribeSpotPriceHistory(*ec2.DescribeSpotPriceHistoryInput) (*ec2.DescribeSpotPriceHistoryOutput, error) + + DescribeSubnets(*ec2.DescribeSubnetsInput) (*ec2.DescribeSubnetsOutput, error) + + DescribeTags(*ec2.DescribeTagsInput) (*ec2.DescribeTagsOutput, error) + + DescribeVPCAttribute(*ec2.DescribeVPCAttributeInput) (*ec2.DescribeVPCAttributeOutput, error) + + DescribeVPCClassicLink(*ec2.DescribeVPCClassicLinkInput) (*ec2.DescribeVPCClassicLinkOutput, error) + + DescribeVPCPeeringConnections(*ec2.DescribeVPCPeeringConnectionsInput) (*ec2.DescribeVPCPeeringConnectionsOutput, error) + + DescribeVPCs(*ec2.DescribeVPCsInput) (*ec2.DescribeVPCsOutput, error) + + DescribeVPNConnections(*ec2.DescribeVPNConnectionsInput) (*ec2.DescribeVPNConnectionsOutput, error) + + DescribeVPNGateways(*ec2.DescribeVPNGatewaysInput) (*ec2.DescribeVPNGatewaysOutput, error) + + DescribeVolumeAttribute(*ec2.DescribeVolumeAttributeInput) (*ec2.DescribeVolumeAttributeOutput, error) + + DescribeVolumeStatus(*ec2.DescribeVolumeStatusInput) (*ec2.DescribeVolumeStatusOutput, error) + + DescribeVolumes(*ec2.DescribeVolumesInput) (*ec2.DescribeVolumesOutput, error) + + DetachClassicLinkVPC(*ec2.DetachClassicLinkVPCInput) (*ec2.DetachClassicLinkVPCOutput, error) + + DetachInternetGateway(*ec2.DetachInternetGatewayInput) (*ec2.DetachInternetGatewayOutput, error) + + DetachNetworkInterface(*ec2.DetachNetworkInterfaceInput) (*ec2.DetachNetworkInterfaceOutput, error) + + DetachVPNGateway(*ec2.DetachVPNGatewayInput) (*ec2.DetachVPNGatewayOutput, error) + + DetachVolume(*ec2.DetachVolumeInput) (*ec2.VolumeAttachment, error) + + DisableVGWRoutePropagation(*ec2.DisableVGWRoutePropagationInput) (*ec2.DisableVGWRoutePropagationOutput, error) + + DisableVPCClassicLink(*ec2.DisableVPCClassicLinkInput) (*ec2.DisableVPCClassicLinkOutput, error) + + DisassociateAddress(*ec2.DisassociateAddressInput) (*ec2.DisassociateAddressOutput, error) + + DisassociateRouteTable(*ec2.DisassociateRouteTableInput) (*ec2.DisassociateRouteTableOutput, error) + + EnableVGWRoutePropagation(*ec2.EnableVGWRoutePropagationInput) (*ec2.EnableVGWRoutePropagationOutput, error) + + EnableVPCClassicLink(*ec2.EnableVPCClassicLinkInput) (*ec2.EnableVPCClassicLinkOutput, error) + + EnableVolumeIO(*ec2.EnableVolumeIOInput) (*ec2.EnableVolumeIOOutput, error) + + GetConsoleOutput(*ec2.GetConsoleOutputInput) (*ec2.GetConsoleOutputOutput, error) + + GetPasswordData(*ec2.GetPasswordDataInput) (*ec2.GetPasswordDataOutput, error) + + ImportImage(*ec2.ImportImageInput) (*ec2.ImportImageOutput, error) + + ImportInstance(*ec2.ImportInstanceInput) (*ec2.ImportInstanceOutput, error) + + ImportKeyPair(*ec2.ImportKeyPairInput) (*ec2.ImportKeyPairOutput, error) + + ImportSnapshot(*ec2.ImportSnapshotInput) (*ec2.ImportSnapshotOutput, error) + + ImportVolume(*ec2.ImportVolumeInput) (*ec2.ImportVolumeOutput, error) + + ModifyImageAttribute(*ec2.ModifyImageAttributeInput) (*ec2.ModifyImageAttributeOutput, error) + + ModifyInstanceAttribute(*ec2.ModifyInstanceAttributeInput) (*ec2.ModifyInstanceAttributeOutput, error) + + ModifyNetworkInterfaceAttribute(*ec2.ModifyNetworkInterfaceAttributeInput) (*ec2.ModifyNetworkInterfaceAttributeOutput, error) + + ModifyReservedInstances(*ec2.ModifyReservedInstancesInput) (*ec2.ModifyReservedInstancesOutput, error) + + ModifySnapshotAttribute(*ec2.ModifySnapshotAttributeInput) (*ec2.ModifySnapshotAttributeOutput, error) + + ModifySubnetAttribute(*ec2.ModifySubnetAttributeInput) (*ec2.ModifySubnetAttributeOutput, error) + + ModifyVPCAttribute(*ec2.ModifyVPCAttributeInput) (*ec2.ModifyVPCAttributeOutput, error) + + ModifyVolumeAttribute(*ec2.ModifyVolumeAttributeInput) (*ec2.ModifyVolumeAttributeOutput, error) + + MonitorInstances(*ec2.MonitorInstancesInput) (*ec2.MonitorInstancesOutput, error) + + PurchaseReservedInstancesOffering(*ec2.PurchaseReservedInstancesOfferingInput) (*ec2.PurchaseReservedInstancesOfferingOutput, error) + + RebootInstances(*ec2.RebootInstancesInput) (*ec2.RebootInstancesOutput, error) + + RegisterImage(*ec2.RegisterImageInput) (*ec2.RegisterImageOutput, error) + + RejectVPCPeeringConnection(*ec2.RejectVPCPeeringConnectionInput) (*ec2.RejectVPCPeeringConnectionOutput, error) + + ReleaseAddress(*ec2.ReleaseAddressInput) (*ec2.ReleaseAddressOutput, error) + + ReplaceNetworkACLAssociation(*ec2.ReplaceNetworkACLAssociationInput) (*ec2.ReplaceNetworkACLAssociationOutput, error) + + ReplaceNetworkACLEntry(*ec2.ReplaceNetworkACLEntryInput) (*ec2.ReplaceNetworkACLEntryOutput, error) + + ReplaceRoute(*ec2.ReplaceRouteInput) (*ec2.ReplaceRouteOutput, error) + + ReplaceRouteTableAssociation(*ec2.ReplaceRouteTableAssociationInput) (*ec2.ReplaceRouteTableAssociationOutput, error) + + ReportInstanceStatus(*ec2.ReportInstanceStatusInput) (*ec2.ReportInstanceStatusOutput, error) + + RequestSpotInstances(*ec2.RequestSpotInstancesInput) (*ec2.RequestSpotInstancesOutput, error) + + ResetImageAttribute(*ec2.ResetImageAttributeInput) (*ec2.ResetImageAttributeOutput, error) + + ResetInstanceAttribute(*ec2.ResetInstanceAttributeInput) (*ec2.ResetInstanceAttributeOutput, error) + + ResetNetworkInterfaceAttribute(*ec2.ResetNetworkInterfaceAttributeInput) (*ec2.ResetNetworkInterfaceAttributeOutput, error) + + ResetSnapshotAttribute(*ec2.ResetSnapshotAttributeInput) (*ec2.ResetSnapshotAttributeOutput, error) + + RevokeSecurityGroupEgress(*ec2.RevokeSecurityGroupEgressInput) (*ec2.RevokeSecurityGroupEgressOutput, error) + + RevokeSecurityGroupIngress(*ec2.RevokeSecurityGroupIngressInput) (*ec2.RevokeSecurityGroupIngressOutput, error) + + RunInstances(*ec2.RunInstancesInput) (*ec2.Reservation, error) + + StartInstances(*ec2.StartInstancesInput) (*ec2.StartInstancesOutput, error) + + StopInstances(*ec2.StopInstancesInput) (*ec2.StopInstancesOutput, error) + + TerminateInstances(*ec2.TerminateInstancesInput) (*ec2.TerminateInstancesOutput, error) + + UnassignPrivateIPAddresses(*ec2.UnassignPrivateIPAddressesInput) (*ec2.UnassignPrivateIPAddressesOutput, error) + + UnmonitorInstances(*ec2.UnmonitorInstancesInput) (*ec2.UnmonitorInstancesOutput, error) +} diff --git a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/service/ec2/examples_test.go b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/service/ec2/examples_test.go new file mode 100644 index 00000000000..4b61c1fa403 --- /dev/null +++ b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/service/ec2/examples_test.go @@ -0,0 +1,4774 @@ +package ec2_test + +import ( + "bytes" + "fmt" + "time" + + "github.com/awslabs/aws-sdk-go/aws" + "github.com/awslabs/aws-sdk-go/aws/awsutil" + "github.com/awslabs/aws-sdk-go/service/ec2" +) + +var _ time.Duration +var _ bytes.Buffer + +func ExampleEC2_AcceptVPCPeeringConnection() { + svc := ec2.New(nil) + + params := &ec2.AcceptVPCPeeringConnectionInput{ + DryRun: aws.Boolean(true), + VPCPeeringConnectionID: aws.String("String"), + } + resp, err := svc.AcceptVPCPeeringConnection(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_AllocateAddress() { + svc := ec2.New(nil) + + params := &ec2.AllocateAddressInput{ + Domain: aws.String("DomainType"), + DryRun: aws.Boolean(true), + } + resp, err := svc.AllocateAddress(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_AssignPrivateIPAddresses() { + svc := ec2.New(nil) + + params := &ec2.AssignPrivateIPAddressesInput{ + NetworkInterfaceID: aws.String("String"), // Required + AllowReassignment: aws.Boolean(true), + PrivateIPAddresses: []*string{ + aws.String("String"), // Required + // More values... + }, + SecondaryPrivateIPAddressCount: aws.Long(1), + } + resp, err := svc.AssignPrivateIPAddresses(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_AssociateAddress() { + svc := ec2.New(nil) + + params := &ec2.AssociateAddressInput{ + AllocationID: aws.String("String"), + AllowReassociation: aws.Boolean(true), + DryRun: aws.Boolean(true), + InstanceID: aws.String("String"), + NetworkInterfaceID: aws.String("String"), + PrivateIPAddress: aws.String("String"), + PublicIP: aws.String("String"), + } + resp, err := svc.AssociateAddress(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_AssociateDHCPOptions() { + svc := ec2.New(nil) + + params := &ec2.AssociateDHCPOptionsInput{ + DHCPOptionsID: aws.String("String"), // Required + VPCID: aws.String("String"), // Required + DryRun: aws.Boolean(true), + } + resp, err := svc.AssociateDHCPOptions(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_AssociateRouteTable() { + svc := ec2.New(nil) + + params := &ec2.AssociateRouteTableInput{ + RouteTableID: aws.String("String"), // Required + SubnetID: aws.String("String"), // Required + DryRun: aws.Boolean(true), + } + resp, err := svc.AssociateRouteTable(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_AttachClassicLinkVPC() { + svc := ec2.New(nil) + + params := &ec2.AttachClassicLinkVPCInput{ + Groups: []*string{ // Required + aws.String("String"), // Required + // More values... + }, + InstanceID: aws.String("String"), // Required + VPCID: aws.String("String"), // Required + DryRun: aws.Boolean(true), + } + resp, err := svc.AttachClassicLinkVPC(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_AttachInternetGateway() { + svc := ec2.New(nil) + + params := &ec2.AttachInternetGatewayInput{ + InternetGatewayID: aws.String("String"), // Required + VPCID: aws.String("String"), // Required + DryRun: aws.Boolean(true), + } + resp, err := svc.AttachInternetGateway(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_AttachNetworkInterface() { + svc := ec2.New(nil) + + params := &ec2.AttachNetworkInterfaceInput{ + DeviceIndex: aws.Long(1), // Required + InstanceID: aws.String("String"), // Required + NetworkInterfaceID: aws.String("String"), // Required + DryRun: aws.Boolean(true), + } + resp, err := svc.AttachNetworkInterface(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_AttachVPNGateway() { + svc := ec2.New(nil) + + params := &ec2.AttachVPNGatewayInput{ + VPCID: aws.String("String"), // Required + VPNGatewayID: aws.String("String"), // Required + DryRun: aws.Boolean(true), + } + resp, err := svc.AttachVPNGateway(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_AttachVolume() { + svc := ec2.New(nil) + + params := &ec2.AttachVolumeInput{ + Device: aws.String("String"), // Required + InstanceID: aws.String("String"), // Required + VolumeID: aws.String("String"), // Required + DryRun: aws.Boolean(true), + } + resp, err := svc.AttachVolume(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_AuthorizeSecurityGroupEgress() { + svc := ec2.New(nil) + + params := &ec2.AuthorizeSecurityGroupEgressInput{ + GroupID: aws.String("String"), // Required + CIDRIP: aws.String("String"), + DryRun: aws.Boolean(true), + FromPort: aws.Long(1), + IPPermissions: []*ec2.IPPermission{ + &ec2.IPPermission{ // Required + FromPort: aws.Long(1), + IPProtocol: aws.String("String"), + IPRanges: []*ec2.IPRange{ + &ec2.IPRange{ // Required + CIDRIP: aws.String("String"), + }, + // More values... + }, + ToPort: aws.Long(1), + UserIDGroupPairs: []*ec2.UserIDGroupPair{ + &ec2.UserIDGroupPair{ // Required + GroupID: aws.String("String"), + GroupName: aws.String("String"), + UserID: aws.String("String"), + }, + // More values... + }, + }, + // More values... + }, + IPProtocol: aws.String("String"), + SourceSecurityGroupName: aws.String("String"), + SourceSecurityGroupOwnerID: aws.String("String"), + ToPort: aws.Long(1), + } + resp, err := svc.AuthorizeSecurityGroupEgress(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_AuthorizeSecurityGroupIngress() { + svc := ec2.New(nil) + + params := &ec2.AuthorizeSecurityGroupIngressInput{ + CIDRIP: aws.String("String"), + DryRun: aws.Boolean(true), + FromPort: aws.Long(1), + GroupID: aws.String("String"), + GroupName: aws.String("String"), + IPPermissions: []*ec2.IPPermission{ + &ec2.IPPermission{ // Required + FromPort: aws.Long(1), + IPProtocol: aws.String("String"), + IPRanges: []*ec2.IPRange{ + &ec2.IPRange{ // Required + CIDRIP: aws.String("String"), + }, + // More values... + }, + ToPort: aws.Long(1), + UserIDGroupPairs: []*ec2.UserIDGroupPair{ + &ec2.UserIDGroupPair{ // Required + GroupID: aws.String("String"), + GroupName: aws.String("String"), + UserID: aws.String("String"), + }, + // More values... + }, + }, + // More values... + }, + IPProtocol: aws.String("String"), + SourceSecurityGroupName: aws.String("String"), + SourceSecurityGroupOwnerID: aws.String("String"), + ToPort: aws.Long(1), + } + resp, err := svc.AuthorizeSecurityGroupIngress(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_BundleInstance() { + svc := ec2.New(nil) + + params := &ec2.BundleInstanceInput{ + InstanceID: aws.String("String"), // Required + Storage: &ec2.Storage{ // Required + S3: &ec2.S3Storage{ + AWSAccessKeyID: aws.String("String"), + Bucket: aws.String("String"), + Prefix: aws.String("String"), + UploadPolicy: []byte("PAYLOAD"), + UploadPolicySignature: aws.String("String"), + }, + }, + DryRun: aws.Boolean(true), + } + resp, err := svc.BundleInstance(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_CancelBundleTask() { + svc := ec2.New(nil) + + params := &ec2.CancelBundleTaskInput{ + BundleID: aws.String("String"), // Required + DryRun: aws.Boolean(true), + } + resp, err := svc.CancelBundleTask(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_CancelConversionTask() { + svc := ec2.New(nil) + + params := &ec2.CancelConversionTaskInput{ + ConversionTaskID: aws.String("String"), // Required + DryRun: aws.Boolean(true), + ReasonMessage: aws.String("String"), + } + resp, err := svc.CancelConversionTask(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_CancelExportTask() { + svc := ec2.New(nil) + + params := &ec2.CancelExportTaskInput{ + ExportTaskID: aws.String("String"), // Required + } + resp, err := svc.CancelExportTask(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_CancelImportTask() { + svc := ec2.New(nil) + + params := &ec2.CancelImportTaskInput{ + CancelReason: aws.String("String"), + DryRun: aws.Boolean(true), + ImportTaskID: aws.String("String"), + } + resp, err := svc.CancelImportTask(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_CancelReservedInstancesListing() { + svc := ec2.New(nil) + + params := &ec2.CancelReservedInstancesListingInput{ + ReservedInstancesListingID: aws.String("String"), // Required + } + resp, err := svc.CancelReservedInstancesListing(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_CancelSpotInstanceRequests() { + svc := ec2.New(nil) + + params := &ec2.CancelSpotInstanceRequestsInput{ + SpotInstanceRequestIDs: []*string{ // Required + aws.String("String"), // Required + // More values... + }, + DryRun: aws.Boolean(true), + } + resp, err := svc.CancelSpotInstanceRequests(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_ConfirmProductInstance() { + svc := ec2.New(nil) + + params := &ec2.ConfirmProductInstanceInput{ + InstanceID: aws.String("String"), // Required + ProductCode: aws.String("String"), // Required + DryRun: aws.Boolean(true), + } + resp, err := svc.ConfirmProductInstance(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_CopyImage() { + svc := ec2.New(nil) + + params := &ec2.CopyImageInput{ + Name: aws.String("String"), // Required + SourceImageID: aws.String("String"), // Required + SourceRegion: aws.String("String"), // Required + ClientToken: aws.String("String"), + Description: aws.String("String"), + DryRun: aws.Boolean(true), + } + resp, err := svc.CopyImage(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_CopySnapshot() { + svc := ec2.New(nil) + + params := &ec2.CopySnapshotInput{ + SourceRegion: aws.String("String"), // Required + SourceSnapshotID: aws.String("String"), // Required + Description: aws.String("String"), + DestinationRegion: aws.String("String"), + DryRun: aws.Boolean(true), + PresignedURL: aws.String("String"), + } + resp, err := svc.CopySnapshot(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_CreateCustomerGateway() { + svc := ec2.New(nil) + + params := &ec2.CreateCustomerGatewayInput{ + BGPASN: aws.Long(1), // Required + PublicIP: aws.String("String"), // Required + Type: aws.String("GatewayType"), // Required + DryRun: aws.Boolean(true), + } + resp, err := svc.CreateCustomerGateway(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_CreateDHCPOptions() { + svc := ec2.New(nil) + + params := &ec2.CreateDHCPOptionsInput{ + DHCPConfigurations: []*ec2.NewDHCPConfiguration{ // Required + &ec2.NewDHCPConfiguration{ // Required + Key: aws.String("String"), + Values: []*string{ + aws.String("String"), // Required + // More values... + }, + }, + // More values... + }, + DryRun: aws.Boolean(true), + } + resp, err := svc.CreateDHCPOptions(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_CreateImage() { + svc := ec2.New(nil) + + params := &ec2.CreateImageInput{ + InstanceID: aws.String("String"), // Required + Name: aws.String("String"), // Required + BlockDeviceMappings: []*ec2.BlockDeviceMapping{ + &ec2.BlockDeviceMapping{ // Required + DeviceName: aws.String("String"), + EBS: &ec2.EBSBlockDevice{ + DeleteOnTermination: aws.Boolean(true), + Encrypted: aws.Boolean(true), + IOPS: aws.Long(1), + SnapshotID: aws.String("String"), + VolumeSize: aws.Long(1), + VolumeType: aws.String("VolumeType"), + }, + NoDevice: aws.String("String"), + VirtualName: aws.String("String"), + }, + // More values... + }, + Description: aws.String("String"), + DryRun: aws.Boolean(true), + NoReboot: aws.Boolean(true), + } + resp, err := svc.CreateImage(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_CreateInstanceExportTask() { + svc := ec2.New(nil) + + params := &ec2.CreateInstanceExportTaskInput{ + InstanceID: aws.String("String"), // Required + Description: aws.String("String"), + ExportToS3Task: &ec2.ExportToS3TaskSpecification{ + ContainerFormat: aws.String("ContainerFormat"), + DiskImageFormat: aws.String("DiskImageFormat"), + S3Bucket: aws.String("String"), + S3Prefix: aws.String("String"), + }, + TargetEnvironment: aws.String("ExportEnvironment"), + } + resp, err := svc.CreateInstanceExportTask(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_CreateInternetGateway() { + svc := ec2.New(nil) + + params := &ec2.CreateInternetGatewayInput{ + DryRun: aws.Boolean(true), + } + resp, err := svc.CreateInternetGateway(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_CreateKeyPair() { + svc := ec2.New(nil) + + params := &ec2.CreateKeyPairInput{ + KeyName: aws.String("String"), // Required + DryRun: aws.Boolean(true), + } + resp, err := svc.CreateKeyPair(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_CreateNetworkACL() { + svc := ec2.New(nil) + + params := &ec2.CreateNetworkACLInput{ + VPCID: aws.String("String"), // Required + DryRun: aws.Boolean(true), + } + resp, err := svc.CreateNetworkACL(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_CreateNetworkACLEntry() { + svc := ec2.New(nil) + + params := &ec2.CreateNetworkACLEntryInput{ + CIDRBlock: aws.String("String"), // Required + Egress: aws.Boolean(true), // Required + NetworkACLID: aws.String("String"), // Required + Protocol: aws.String("String"), // Required + RuleAction: aws.String("RuleAction"), // Required + RuleNumber: aws.Long(1), // Required + DryRun: aws.Boolean(true), + ICMPTypeCode: &ec2.ICMPTypeCode{ + Code: aws.Long(1), + Type: aws.Long(1), + }, + PortRange: &ec2.PortRange{ + From: aws.Long(1), + To: aws.Long(1), + }, + } + resp, err := svc.CreateNetworkACLEntry(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_CreateNetworkInterface() { + svc := ec2.New(nil) + + params := &ec2.CreateNetworkInterfaceInput{ + SubnetID: aws.String("String"), // Required + Description: aws.String("String"), + DryRun: aws.Boolean(true), + Groups: []*string{ + aws.String("String"), // Required + // More values... + }, + PrivateIPAddress: aws.String("String"), + PrivateIPAddresses: []*ec2.PrivateIPAddressSpecification{ + &ec2.PrivateIPAddressSpecification{ // Required + PrivateIPAddress: aws.String("String"), // Required + Primary: aws.Boolean(true), + }, + // More values... + }, + SecondaryPrivateIPAddressCount: aws.Long(1), + } + resp, err := svc.CreateNetworkInterface(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_CreatePlacementGroup() { + svc := ec2.New(nil) + + params := &ec2.CreatePlacementGroupInput{ + GroupName: aws.String("String"), // Required + Strategy: aws.String("PlacementStrategy"), // Required + DryRun: aws.Boolean(true), + } + resp, err := svc.CreatePlacementGroup(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_CreateReservedInstancesListing() { + svc := ec2.New(nil) + + params := &ec2.CreateReservedInstancesListingInput{ + ClientToken: aws.String("String"), // Required + InstanceCount: aws.Long(1), // Required + PriceSchedules: []*ec2.PriceScheduleSpecification{ // Required + &ec2.PriceScheduleSpecification{ // Required + CurrencyCode: aws.String("CurrencyCodeValues"), + Price: aws.Double(1.0), + Term: aws.Long(1), + }, + // More values... + }, + ReservedInstancesID: aws.String("String"), // Required + } + resp, err := svc.CreateReservedInstancesListing(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_CreateRoute() { + svc := ec2.New(nil) + + params := &ec2.CreateRouteInput{ + DestinationCIDRBlock: aws.String("String"), // Required + RouteTableID: aws.String("String"), // Required + DryRun: aws.Boolean(true), + GatewayID: aws.String("String"), + InstanceID: aws.String("String"), + NetworkInterfaceID: aws.String("String"), + VPCPeeringConnectionID: aws.String("String"), + } + resp, err := svc.CreateRoute(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_CreateRouteTable() { + svc := ec2.New(nil) + + params := &ec2.CreateRouteTableInput{ + VPCID: aws.String("String"), // Required + DryRun: aws.Boolean(true), + } + resp, err := svc.CreateRouteTable(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_CreateSecurityGroup() { + svc := ec2.New(nil) + + params := &ec2.CreateSecurityGroupInput{ + Description: aws.String("String"), // Required + GroupName: aws.String("String"), // Required + DryRun: aws.Boolean(true), + VPCID: aws.String("String"), + } + resp, err := svc.CreateSecurityGroup(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_CreateSnapshot() { + svc := ec2.New(nil) + + params := &ec2.CreateSnapshotInput{ + VolumeID: aws.String("String"), // Required + Description: aws.String("String"), + DryRun: aws.Boolean(true), + } + resp, err := svc.CreateSnapshot(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_CreateSpotDatafeedSubscription() { + svc := ec2.New(nil) + + params := &ec2.CreateSpotDatafeedSubscriptionInput{ + Bucket: aws.String("String"), // Required + DryRun: aws.Boolean(true), + Prefix: aws.String("String"), + } + resp, err := svc.CreateSpotDatafeedSubscription(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_CreateSubnet() { + svc := ec2.New(nil) + + params := &ec2.CreateSubnetInput{ + CIDRBlock: aws.String("String"), // Required + VPCID: aws.String("String"), // Required + AvailabilityZone: aws.String("String"), + DryRun: aws.Boolean(true), + } + resp, err := svc.CreateSubnet(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_CreateTags() { + svc := ec2.New(nil) + + params := &ec2.CreateTagsInput{ + Resources: []*string{ // Required + aws.String("String"), // Required + // More values... + }, + Tags: []*ec2.Tag{ // Required + &ec2.Tag{ // Required + Key: aws.String("String"), + Value: aws.String("String"), + }, + // More values... + }, + DryRun: aws.Boolean(true), + } + resp, err := svc.CreateTags(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_CreateVPC() { + svc := ec2.New(nil) + + params := &ec2.CreateVPCInput{ + CIDRBlock: aws.String("String"), // Required + DryRun: aws.Boolean(true), + InstanceTenancy: aws.String("Tenancy"), + } + resp, err := svc.CreateVPC(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_CreateVPCPeeringConnection() { + svc := ec2.New(nil) + + params := &ec2.CreateVPCPeeringConnectionInput{ + DryRun: aws.Boolean(true), + PeerOwnerID: aws.String("String"), + PeerVPCID: aws.String("String"), + VPCID: aws.String("String"), + } + resp, err := svc.CreateVPCPeeringConnection(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_CreateVPNConnection() { + svc := ec2.New(nil) + + params := &ec2.CreateVPNConnectionInput{ + CustomerGatewayID: aws.String("String"), // Required + Type: aws.String("String"), // Required + VPNGatewayID: aws.String("String"), // Required + DryRun: aws.Boolean(true), + Options: &ec2.VPNConnectionOptionsSpecification{ + StaticRoutesOnly: aws.Boolean(true), + }, + } + resp, err := svc.CreateVPNConnection(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_CreateVPNConnectionRoute() { + svc := ec2.New(nil) + + params := &ec2.CreateVPNConnectionRouteInput{ + DestinationCIDRBlock: aws.String("String"), // Required + VPNConnectionID: aws.String("String"), // Required + } + resp, err := svc.CreateVPNConnectionRoute(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_CreateVPNGateway() { + svc := ec2.New(nil) + + params := &ec2.CreateVPNGatewayInput{ + Type: aws.String("GatewayType"), // Required + AvailabilityZone: aws.String("String"), + DryRun: aws.Boolean(true), + } + resp, err := svc.CreateVPNGateway(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_CreateVolume() { + svc := ec2.New(nil) + + params := &ec2.CreateVolumeInput{ + AvailabilityZone: aws.String("String"), // Required + DryRun: aws.Boolean(true), + Encrypted: aws.Boolean(true), + IOPS: aws.Long(1), + KMSKeyID: aws.String("String"), + Size: aws.Long(1), + SnapshotID: aws.String("String"), + VolumeType: aws.String("VolumeType"), + } + resp, err := svc.CreateVolume(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_DeleteCustomerGateway() { + svc := ec2.New(nil) + + params := &ec2.DeleteCustomerGatewayInput{ + CustomerGatewayID: aws.String("String"), // Required + DryRun: aws.Boolean(true), + } + resp, err := svc.DeleteCustomerGateway(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_DeleteDHCPOptions() { + svc := ec2.New(nil) + + params := &ec2.DeleteDHCPOptionsInput{ + DHCPOptionsID: aws.String("String"), // Required + DryRun: aws.Boolean(true), + } + resp, err := svc.DeleteDHCPOptions(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_DeleteInternetGateway() { + svc := ec2.New(nil) + + params := &ec2.DeleteInternetGatewayInput{ + InternetGatewayID: aws.String("String"), // Required + DryRun: aws.Boolean(true), + } + resp, err := svc.DeleteInternetGateway(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_DeleteKeyPair() { + svc := ec2.New(nil) + + params := &ec2.DeleteKeyPairInput{ + KeyName: aws.String("String"), // Required + DryRun: aws.Boolean(true), + } + resp, err := svc.DeleteKeyPair(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_DeleteNetworkACL() { + svc := ec2.New(nil) + + params := &ec2.DeleteNetworkACLInput{ + NetworkACLID: aws.String("String"), // Required + DryRun: aws.Boolean(true), + } + resp, err := svc.DeleteNetworkACL(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_DeleteNetworkACLEntry() { + svc := ec2.New(nil) + + params := &ec2.DeleteNetworkACLEntryInput{ + Egress: aws.Boolean(true), // Required + NetworkACLID: aws.String("String"), // Required + RuleNumber: aws.Long(1), // Required + DryRun: aws.Boolean(true), + } + resp, err := svc.DeleteNetworkACLEntry(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_DeleteNetworkInterface() { + svc := ec2.New(nil) + + params := &ec2.DeleteNetworkInterfaceInput{ + NetworkInterfaceID: aws.String("String"), // Required + DryRun: aws.Boolean(true), + } + resp, err := svc.DeleteNetworkInterface(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_DeletePlacementGroup() { + svc := ec2.New(nil) + + params := &ec2.DeletePlacementGroupInput{ + GroupName: aws.String("String"), // Required + DryRun: aws.Boolean(true), + } + resp, err := svc.DeletePlacementGroup(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_DeleteRoute() { + svc := ec2.New(nil) + + params := &ec2.DeleteRouteInput{ + DestinationCIDRBlock: aws.String("String"), // Required + RouteTableID: aws.String("String"), // Required + DryRun: aws.Boolean(true), + } + resp, err := svc.DeleteRoute(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_DeleteRouteTable() { + svc := ec2.New(nil) + + params := &ec2.DeleteRouteTableInput{ + RouteTableID: aws.String("String"), // Required + DryRun: aws.Boolean(true), + } + resp, err := svc.DeleteRouteTable(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_DeleteSecurityGroup() { + svc := ec2.New(nil) + + params := &ec2.DeleteSecurityGroupInput{ + DryRun: aws.Boolean(true), + GroupID: aws.String("String"), + GroupName: aws.String("String"), + } + resp, err := svc.DeleteSecurityGroup(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_DeleteSnapshot() { + svc := ec2.New(nil) + + params := &ec2.DeleteSnapshotInput{ + SnapshotID: aws.String("String"), // Required + DryRun: aws.Boolean(true), + } + resp, err := svc.DeleteSnapshot(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_DeleteSpotDatafeedSubscription() { + svc := ec2.New(nil) + + params := &ec2.DeleteSpotDatafeedSubscriptionInput{ + DryRun: aws.Boolean(true), + } + resp, err := svc.DeleteSpotDatafeedSubscription(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_DeleteSubnet() { + svc := ec2.New(nil) + + params := &ec2.DeleteSubnetInput{ + SubnetID: aws.String("String"), // Required + DryRun: aws.Boolean(true), + } + resp, err := svc.DeleteSubnet(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_DeleteTags() { + svc := ec2.New(nil) + + params := &ec2.DeleteTagsInput{ + Resources: []*string{ // Required + aws.String("String"), // Required + // More values... + }, + DryRun: aws.Boolean(true), + Tags: []*ec2.Tag{ + &ec2.Tag{ // Required + Key: aws.String("String"), + Value: aws.String("String"), + }, + // More values... + }, + } + resp, err := svc.DeleteTags(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_DeleteVPC() { + svc := ec2.New(nil) + + params := &ec2.DeleteVPCInput{ + VPCID: aws.String("String"), // Required + DryRun: aws.Boolean(true), + } + resp, err := svc.DeleteVPC(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_DeleteVPCPeeringConnection() { + svc := ec2.New(nil) + + params := &ec2.DeleteVPCPeeringConnectionInput{ + VPCPeeringConnectionID: aws.String("String"), // Required + DryRun: aws.Boolean(true), + } + resp, err := svc.DeleteVPCPeeringConnection(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_DeleteVPNConnection() { + svc := ec2.New(nil) + + params := &ec2.DeleteVPNConnectionInput{ + VPNConnectionID: aws.String("String"), // Required + DryRun: aws.Boolean(true), + } + resp, err := svc.DeleteVPNConnection(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_DeleteVPNConnectionRoute() { + svc := ec2.New(nil) + + params := &ec2.DeleteVPNConnectionRouteInput{ + DestinationCIDRBlock: aws.String("String"), // Required + VPNConnectionID: aws.String("String"), // Required + } + resp, err := svc.DeleteVPNConnectionRoute(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_DeleteVPNGateway() { + svc := ec2.New(nil) + + params := &ec2.DeleteVPNGatewayInput{ + VPNGatewayID: aws.String("String"), // Required + DryRun: aws.Boolean(true), + } + resp, err := svc.DeleteVPNGateway(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_DeleteVolume() { + svc := ec2.New(nil) + + params := &ec2.DeleteVolumeInput{ + VolumeID: aws.String("String"), // Required + DryRun: aws.Boolean(true), + } + resp, err := svc.DeleteVolume(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_DeregisterImage() { + svc := ec2.New(nil) + + params := &ec2.DeregisterImageInput{ + ImageID: aws.String("String"), // Required + DryRun: aws.Boolean(true), + } + resp, err := svc.DeregisterImage(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_DescribeAccountAttributes() { + svc := ec2.New(nil) + + params := &ec2.DescribeAccountAttributesInput{ + AttributeNames: []*string{ + aws.String("AccountAttributeName"), // Required + // More values... + }, + DryRun: aws.Boolean(true), + } + resp, err := svc.DescribeAccountAttributes(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_DescribeAddresses() { + svc := ec2.New(nil) + + params := &ec2.DescribeAddressesInput{ + AllocationIDs: []*string{ + aws.String("String"), // Required + // More values... + }, + DryRun: aws.Boolean(true), + Filters: []*ec2.Filter{ + &ec2.Filter{ // Required + Name: aws.String("String"), + Values: []*string{ + aws.String("String"), // Required + // More values... + }, + }, + // More values... + }, + PublicIPs: []*string{ + aws.String("String"), // Required + // More values... + }, + } + resp, err := svc.DescribeAddresses(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_DescribeAvailabilityZones() { + svc := ec2.New(nil) + + params := &ec2.DescribeAvailabilityZonesInput{ + DryRun: aws.Boolean(true), + Filters: []*ec2.Filter{ + &ec2.Filter{ // Required + Name: aws.String("String"), + Values: []*string{ + aws.String("String"), // Required + // More values... + }, + }, + // More values... + }, + ZoneNames: []*string{ + aws.String("String"), // Required + // More values... + }, + } + resp, err := svc.DescribeAvailabilityZones(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_DescribeBundleTasks() { + svc := ec2.New(nil) + + params := &ec2.DescribeBundleTasksInput{ + BundleIDs: []*string{ + aws.String("String"), // Required + // More values... + }, + DryRun: aws.Boolean(true), + Filters: []*ec2.Filter{ + &ec2.Filter{ // Required + Name: aws.String("String"), + Values: []*string{ + aws.String("String"), // Required + // More values... + }, + }, + // More values... + }, + } + resp, err := svc.DescribeBundleTasks(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_DescribeClassicLinkInstances() { + svc := ec2.New(nil) + + params := &ec2.DescribeClassicLinkInstancesInput{ + DryRun: aws.Boolean(true), + Filters: []*ec2.Filter{ + &ec2.Filter{ // Required + Name: aws.String("String"), + Values: []*string{ + aws.String("String"), // Required + // More values... + }, + }, + // More values... + }, + InstanceIDs: []*string{ + aws.String("String"), // Required + // More values... + }, + MaxResults: aws.Long(1), + NextToken: aws.String("String"), + } + resp, err := svc.DescribeClassicLinkInstances(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_DescribeConversionTasks() { + svc := ec2.New(nil) + + params := &ec2.DescribeConversionTasksInput{ + ConversionTaskIDs: []*string{ + aws.String("String"), // Required + // More values... + }, + DryRun: aws.Boolean(true), + Filters: []*ec2.Filter{ + &ec2.Filter{ // Required + Name: aws.String("String"), + Values: []*string{ + aws.String("String"), // Required + // More values... + }, + }, + // More values... + }, + } + resp, err := svc.DescribeConversionTasks(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_DescribeCustomerGateways() { + svc := ec2.New(nil) + + params := &ec2.DescribeCustomerGatewaysInput{ + CustomerGatewayIDs: []*string{ + aws.String("String"), // Required + // More values... + }, + DryRun: aws.Boolean(true), + Filters: []*ec2.Filter{ + &ec2.Filter{ // Required + Name: aws.String("String"), + Values: []*string{ + aws.String("String"), // Required + // More values... + }, + }, + // More values... + }, + } + resp, err := svc.DescribeCustomerGateways(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_DescribeDHCPOptions() { + svc := ec2.New(nil) + + params := &ec2.DescribeDHCPOptionsInput{ + DHCPOptionsIDs: []*string{ + aws.String("String"), // Required + // More values... + }, + DryRun: aws.Boolean(true), + Filters: []*ec2.Filter{ + &ec2.Filter{ // Required + Name: aws.String("String"), + Values: []*string{ + aws.String("String"), // Required + // More values... + }, + }, + // More values... + }, + } + resp, err := svc.DescribeDHCPOptions(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_DescribeExportTasks() { + svc := ec2.New(nil) + + params := &ec2.DescribeExportTasksInput{ + ExportTaskIDs: []*string{ + aws.String("String"), // Required + // More values... + }, + } + resp, err := svc.DescribeExportTasks(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_DescribeImageAttribute() { + svc := ec2.New(nil) + + params := &ec2.DescribeImageAttributeInput{ + Attribute: aws.String("ImageAttributeName"), // Required + ImageID: aws.String("String"), // Required + DryRun: aws.Boolean(true), + } + resp, err := svc.DescribeImageAttribute(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_DescribeImages() { + svc := ec2.New(nil) + + params := &ec2.DescribeImagesInput{ + DryRun: aws.Boolean(true), + ExecutableUsers: []*string{ + aws.String("String"), // Required + // More values... + }, + Filters: []*ec2.Filter{ + &ec2.Filter{ // Required + Name: aws.String("String"), + Values: []*string{ + aws.String("String"), // Required + // More values... + }, + }, + // More values... + }, + ImageIDs: []*string{ + aws.String("String"), // Required + // More values... + }, + Owners: []*string{ + aws.String("String"), // Required + // More values... + }, + } + resp, err := svc.DescribeImages(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_DescribeImportImageTasks() { + svc := ec2.New(nil) + + params := &ec2.DescribeImportImageTasksInput{ + DryRun: aws.Boolean(true), + Filters: []*ec2.Filter{ + &ec2.Filter{ // Required + Name: aws.String("String"), + Values: []*string{ + aws.String("String"), // Required + // More values... + }, + }, + // More values... + }, + ImportTaskIDs: []*string{ + aws.String("String"), // Required + // More values... + }, + MaxResults: aws.Long(1), + NextToken: aws.String("String"), + } + resp, err := svc.DescribeImportImageTasks(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_DescribeImportSnapshotTasks() { + svc := ec2.New(nil) + + params := &ec2.DescribeImportSnapshotTasksInput{ + DryRun: aws.Boolean(true), + Filters: []*ec2.Filter{ + &ec2.Filter{ // Required + Name: aws.String("String"), + Values: []*string{ + aws.String("String"), // Required + // More values... + }, + }, + // More values... + }, + ImportTaskIDs: []*string{ + aws.String("String"), // Required + // More values... + }, + MaxResults: aws.Long(1), + NextToken: aws.String("String"), + } + resp, err := svc.DescribeImportSnapshotTasks(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_DescribeInstanceAttribute() { + svc := ec2.New(nil) + + params := &ec2.DescribeInstanceAttributeInput{ + Attribute: aws.String("InstanceAttributeName"), // Required + InstanceID: aws.String("String"), // Required + DryRun: aws.Boolean(true), + } + resp, err := svc.DescribeInstanceAttribute(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_DescribeInstanceStatus() { + svc := ec2.New(nil) + + params := &ec2.DescribeInstanceStatusInput{ + DryRun: aws.Boolean(true), + Filters: []*ec2.Filter{ + &ec2.Filter{ // Required + Name: aws.String("String"), + Values: []*string{ + aws.String("String"), // Required + // More values... + }, + }, + // More values... + }, + IncludeAllInstances: aws.Boolean(true), + InstanceIDs: []*string{ + aws.String("String"), // Required + // More values... + }, + MaxResults: aws.Long(1), + NextToken: aws.String("String"), + } + resp, err := svc.DescribeInstanceStatus(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_DescribeInstances() { + svc := ec2.New(nil) + + params := &ec2.DescribeInstancesInput{ + DryRun: aws.Boolean(true), + Filters: []*ec2.Filter{ + &ec2.Filter{ // Required + Name: aws.String("String"), + Values: []*string{ + aws.String("String"), // Required + // More values... + }, + }, + // More values... + }, + InstanceIDs: []*string{ + aws.String("String"), // Required + // More values... + }, + MaxResults: aws.Long(1), + NextToken: aws.String("String"), + } + resp, err := svc.DescribeInstances(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_DescribeInternetGateways() { + svc := ec2.New(nil) + + params := &ec2.DescribeInternetGatewaysInput{ + DryRun: aws.Boolean(true), + Filters: []*ec2.Filter{ + &ec2.Filter{ // Required + Name: aws.String("String"), + Values: []*string{ + aws.String("String"), // Required + // More values... + }, + }, + // More values... + }, + InternetGatewayIDs: []*string{ + aws.String("String"), // Required + // More values... + }, + } + resp, err := svc.DescribeInternetGateways(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_DescribeKeyPairs() { + svc := ec2.New(nil) + + params := &ec2.DescribeKeyPairsInput{ + DryRun: aws.Boolean(true), + Filters: []*ec2.Filter{ + &ec2.Filter{ // Required + Name: aws.String("String"), + Values: []*string{ + aws.String("String"), // Required + // More values... + }, + }, + // More values... + }, + KeyNames: []*string{ + aws.String("String"), // Required + // More values... + }, + } + resp, err := svc.DescribeKeyPairs(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_DescribeNetworkACLs() { + svc := ec2.New(nil) + + params := &ec2.DescribeNetworkACLsInput{ + DryRun: aws.Boolean(true), + Filters: []*ec2.Filter{ + &ec2.Filter{ // Required + Name: aws.String("String"), + Values: []*string{ + aws.String("String"), // Required + // More values... + }, + }, + // More values... + }, + NetworkACLIDs: []*string{ + aws.String("String"), // Required + // More values... + }, + } + resp, err := svc.DescribeNetworkACLs(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_DescribeNetworkInterfaceAttribute() { + svc := ec2.New(nil) + + params := &ec2.DescribeNetworkInterfaceAttributeInput{ + NetworkInterfaceID: aws.String("String"), // Required + Attribute: aws.String("NetworkInterfaceAttribute"), + DryRun: aws.Boolean(true), + } + resp, err := svc.DescribeNetworkInterfaceAttribute(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_DescribeNetworkInterfaces() { + svc := ec2.New(nil) + + params := &ec2.DescribeNetworkInterfacesInput{ + DryRun: aws.Boolean(true), + Filters: []*ec2.Filter{ + &ec2.Filter{ // Required + Name: aws.String("String"), + Values: []*string{ + aws.String("String"), // Required + // More values... + }, + }, + // More values... + }, + NetworkInterfaceIDs: []*string{ + aws.String("String"), // Required + // More values... + }, + } + resp, err := svc.DescribeNetworkInterfaces(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_DescribePlacementGroups() { + svc := ec2.New(nil) + + params := &ec2.DescribePlacementGroupsInput{ + DryRun: aws.Boolean(true), + Filters: []*ec2.Filter{ + &ec2.Filter{ // Required + Name: aws.String("String"), + Values: []*string{ + aws.String("String"), // Required + // More values... + }, + }, + // More values... + }, + GroupNames: []*string{ + aws.String("String"), // Required + // More values... + }, + } + resp, err := svc.DescribePlacementGroups(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_DescribeRegions() { + svc := ec2.New(nil) + + params := &ec2.DescribeRegionsInput{ + DryRun: aws.Boolean(true), + Filters: []*ec2.Filter{ + &ec2.Filter{ // Required + Name: aws.String("String"), + Values: []*string{ + aws.String("String"), // Required + // More values... + }, + }, + // More values... + }, + RegionNames: []*string{ + aws.String("String"), // Required + // More values... + }, + } + resp, err := svc.DescribeRegions(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_DescribeReservedInstances() { + svc := ec2.New(nil) + + params := &ec2.DescribeReservedInstancesInput{ + DryRun: aws.Boolean(true), + Filters: []*ec2.Filter{ + &ec2.Filter{ // Required + Name: aws.String("String"), + Values: []*string{ + aws.String("String"), // Required + // More values... + }, + }, + // More values... + }, + OfferingType: aws.String("OfferingTypeValues"), + ReservedInstancesIDs: []*string{ + aws.String("String"), // Required + // More values... + }, + } + resp, err := svc.DescribeReservedInstances(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_DescribeReservedInstancesListings() { + svc := ec2.New(nil) + + params := &ec2.DescribeReservedInstancesListingsInput{ + Filters: []*ec2.Filter{ + &ec2.Filter{ // Required + Name: aws.String("String"), + Values: []*string{ + aws.String("String"), // Required + // More values... + }, + }, + // More values... + }, + ReservedInstancesID: aws.String("String"), + ReservedInstancesListingID: aws.String("String"), + } + resp, err := svc.DescribeReservedInstancesListings(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_DescribeReservedInstancesModifications() { + svc := ec2.New(nil) + + params := &ec2.DescribeReservedInstancesModificationsInput{ + Filters: []*ec2.Filter{ + &ec2.Filter{ // Required + Name: aws.String("String"), + Values: []*string{ + aws.String("String"), // Required + // More values... + }, + }, + // More values... + }, + NextToken: aws.String("String"), + ReservedInstancesModificationIDs: []*string{ + aws.String("String"), // Required + // More values... + }, + } + resp, err := svc.DescribeReservedInstancesModifications(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_DescribeReservedInstancesOfferings() { + svc := ec2.New(nil) + + params := &ec2.DescribeReservedInstancesOfferingsInput{ + AvailabilityZone: aws.String("String"), + DryRun: aws.Boolean(true), + Filters: []*ec2.Filter{ + &ec2.Filter{ // Required + Name: aws.String("String"), + Values: []*string{ + aws.String("String"), // Required + // More values... + }, + }, + // More values... + }, + IncludeMarketplace: aws.Boolean(true), + InstanceTenancy: aws.String("Tenancy"), + InstanceType: aws.String("InstanceType"), + MaxDuration: aws.Long(1), + MaxInstanceCount: aws.Long(1), + MaxResults: aws.Long(1), + MinDuration: aws.Long(1), + NextToken: aws.String("String"), + OfferingType: aws.String("OfferingTypeValues"), + ProductDescription: aws.String("RIProductDescription"), + ReservedInstancesOfferingIDs: []*string{ + aws.String("String"), // Required + // More values... + }, + } + resp, err := svc.DescribeReservedInstancesOfferings(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_DescribeRouteTables() { + svc := ec2.New(nil) + + params := &ec2.DescribeRouteTablesInput{ + DryRun: aws.Boolean(true), + Filters: []*ec2.Filter{ + &ec2.Filter{ // Required + Name: aws.String("String"), + Values: []*string{ + aws.String("String"), // Required + // More values... + }, + }, + // More values... + }, + RouteTableIDs: []*string{ + aws.String("String"), // Required + // More values... + }, + } + resp, err := svc.DescribeRouteTables(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_DescribeSecurityGroups() { + svc := ec2.New(nil) + + params := &ec2.DescribeSecurityGroupsInput{ + DryRun: aws.Boolean(true), + Filters: []*ec2.Filter{ + &ec2.Filter{ // Required + Name: aws.String("String"), + Values: []*string{ + aws.String("String"), // Required + // More values... + }, + }, + // More values... + }, + GroupIDs: []*string{ + aws.String("String"), // Required + // More values... + }, + GroupNames: []*string{ + aws.String("String"), // Required + // More values... + }, + } + resp, err := svc.DescribeSecurityGroups(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_DescribeSnapshotAttribute() { + svc := ec2.New(nil) + + params := &ec2.DescribeSnapshotAttributeInput{ + Attribute: aws.String("SnapshotAttributeName"), // Required + SnapshotID: aws.String("String"), // Required + DryRun: aws.Boolean(true), + } + resp, err := svc.DescribeSnapshotAttribute(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_DescribeSnapshots() { + svc := ec2.New(nil) + + params := &ec2.DescribeSnapshotsInput{ + DryRun: aws.Boolean(true), + Filters: []*ec2.Filter{ + &ec2.Filter{ // Required + Name: aws.String("String"), + Values: []*string{ + aws.String("String"), // Required + // More values... + }, + }, + // More values... + }, + MaxResults: aws.Long(1), + NextToken: aws.String("String"), + OwnerIDs: []*string{ + aws.String("String"), // Required + // More values... + }, + RestorableByUserIDs: []*string{ + aws.String("String"), // Required + // More values... + }, + SnapshotIDs: []*string{ + aws.String("String"), // Required + // More values... + }, + } + resp, err := svc.DescribeSnapshots(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_DescribeSpotDatafeedSubscription() { + svc := ec2.New(nil) + + params := &ec2.DescribeSpotDatafeedSubscriptionInput{ + DryRun: aws.Boolean(true), + } + resp, err := svc.DescribeSpotDatafeedSubscription(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_DescribeSpotInstanceRequests() { + svc := ec2.New(nil) + + params := &ec2.DescribeSpotInstanceRequestsInput{ + DryRun: aws.Boolean(true), + Filters: []*ec2.Filter{ + &ec2.Filter{ // Required + Name: aws.String("String"), + Values: []*string{ + aws.String("String"), // Required + // More values... + }, + }, + // More values... + }, + SpotInstanceRequestIDs: []*string{ + aws.String("String"), // Required + // More values... + }, + } + resp, err := svc.DescribeSpotInstanceRequests(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_DescribeSpotPriceHistory() { + svc := ec2.New(nil) + + params := &ec2.DescribeSpotPriceHistoryInput{ + AvailabilityZone: aws.String("String"), + DryRun: aws.Boolean(true), + EndTime: aws.Time(time.Now()), + Filters: []*ec2.Filter{ + &ec2.Filter{ // Required + Name: aws.String("String"), + Values: []*string{ + aws.String("String"), // Required + // More values... + }, + }, + // More values... + }, + InstanceTypes: []*string{ + aws.String("InstanceType"), // Required + // More values... + }, + MaxResults: aws.Long(1), + NextToken: aws.String("String"), + ProductDescriptions: []*string{ + aws.String("String"), // Required + // More values... + }, + StartTime: aws.Time(time.Now()), + } + resp, err := svc.DescribeSpotPriceHistory(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_DescribeSubnets() { + svc := ec2.New(nil) + + params := &ec2.DescribeSubnetsInput{ + DryRun: aws.Boolean(true), + Filters: []*ec2.Filter{ + &ec2.Filter{ // Required + Name: aws.String("String"), + Values: []*string{ + aws.String("String"), // Required + // More values... + }, + }, + // More values... + }, + SubnetIDs: []*string{ + aws.String("String"), // Required + // More values... + }, + } + resp, err := svc.DescribeSubnets(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_DescribeTags() { + svc := ec2.New(nil) + + params := &ec2.DescribeTagsInput{ + DryRun: aws.Boolean(true), + Filters: []*ec2.Filter{ + &ec2.Filter{ // Required + Name: aws.String("String"), + Values: []*string{ + aws.String("String"), // Required + // More values... + }, + }, + // More values... + }, + MaxResults: aws.Long(1), + NextToken: aws.String("String"), + } + resp, err := svc.DescribeTags(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_DescribeVPCAttribute() { + svc := ec2.New(nil) + + params := &ec2.DescribeVPCAttributeInput{ + VPCID: aws.String("String"), // Required + Attribute: aws.String("VpcAttributeName"), + DryRun: aws.Boolean(true), + } + resp, err := svc.DescribeVPCAttribute(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_DescribeVPCClassicLink() { + svc := ec2.New(nil) + + params := &ec2.DescribeVPCClassicLinkInput{ + DryRun: aws.Boolean(true), + Filters: []*ec2.Filter{ + &ec2.Filter{ // Required + Name: aws.String("String"), + Values: []*string{ + aws.String("String"), // Required + // More values... + }, + }, + // More values... + }, + VPCIDs: []*string{ + aws.String("String"), // Required + // More values... + }, + } + resp, err := svc.DescribeVPCClassicLink(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_DescribeVPCPeeringConnections() { + svc := ec2.New(nil) + + params := &ec2.DescribeVPCPeeringConnectionsInput{ + DryRun: aws.Boolean(true), + Filters: []*ec2.Filter{ + &ec2.Filter{ // Required + Name: aws.String("String"), + Values: []*string{ + aws.String("String"), // Required + // More values... + }, + }, + // More values... + }, + VPCPeeringConnectionIDs: []*string{ + aws.String("String"), // Required + // More values... + }, + } + resp, err := svc.DescribeVPCPeeringConnections(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_DescribeVPCs() { + svc := ec2.New(nil) + + params := &ec2.DescribeVPCsInput{ + DryRun: aws.Boolean(true), + Filters: []*ec2.Filter{ + &ec2.Filter{ // Required + Name: aws.String("String"), + Values: []*string{ + aws.String("String"), // Required + // More values... + }, + }, + // More values... + }, + VPCIDs: []*string{ + aws.String("String"), // Required + // More values... + }, + } + resp, err := svc.DescribeVPCs(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_DescribeVPNConnections() { + svc := ec2.New(nil) + + params := &ec2.DescribeVPNConnectionsInput{ + DryRun: aws.Boolean(true), + Filters: []*ec2.Filter{ + &ec2.Filter{ // Required + Name: aws.String("String"), + Values: []*string{ + aws.String("String"), // Required + // More values... + }, + }, + // More values... + }, + VPNConnectionIDs: []*string{ + aws.String("String"), // Required + // More values... + }, + } + resp, err := svc.DescribeVPNConnections(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_DescribeVPNGateways() { + svc := ec2.New(nil) + + params := &ec2.DescribeVPNGatewaysInput{ + DryRun: aws.Boolean(true), + Filters: []*ec2.Filter{ + &ec2.Filter{ // Required + Name: aws.String("String"), + Values: []*string{ + aws.String("String"), // Required + // More values... + }, + }, + // More values... + }, + VPNGatewayIDs: []*string{ + aws.String("String"), // Required + // More values... + }, + } + resp, err := svc.DescribeVPNGateways(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_DescribeVolumeAttribute() { + svc := ec2.New(nil) + + params := &ec2.DescribeVolumeAttributeInput{ + VolumeID: aws.String("String"), // Required + Attribute: aws.String("VolumeAttributeName"), + DryRun: aws.Boolean(true), + } + resp, err := svc.DescribeVolumeAttribute(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_DescribeVolumeStatus() { + svc := ec2.New(nil) + + params := &ec2.DescribeVolumeStatusInput{ + DryRun: aws.Boolean(true), + Filters: []*ec2.Filter{ + &ec2.Filter{ // Required + Name: aws.String("String"), + Values: []*string{ + aws.String("String"), // Required + // More values... + }, + }, + // More values... + }, + MaxResults: aws.Long(1), + NextToken: aws.String("String"), + VolumeIDs: []*string{ + aws.String("String"), // Required + // More values... + }, + } + resp, err := svc.DescribeVolumeStatus(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_DescribeVolumes() { + svc := ec2.New(nil) + + params := &ec2.DescribeVolumesInput{ + DryRun: aws.Boolean(true), + Filters: []*ec2.Filter{ + &ec2.Filter{ // Required + Name: aws.String("String"), + Values: []*string{ + aws.String("String"), // Required + // More values... + }, + }, + // More values... + }, + MaxResults: aws.Long(1), + NextToken: aws.String("String"), + VolumeIDs: []*string{ + aws.String("String"), // Required + // More values... + }, + } + resp, err := svc.DescribeVolumes(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_DetachClassicLinkVPC() { + svc := ec2.New(nil) + + params := &ec2.DetachClassicLinkVPCInput{ + InstanceID: aws.String("String"), // Required + VPCID: aws.String("String"), // Required + DryRun: aws.Boolean(true), + } + resp, err := svc.DetachClassicLinkVPC(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_DetachInternetGateway() { + svc := ec2.New(nil) + + params := &ec2.DetachInternetGatewayInput{ + InternetGatewayID: aws.String("String"), // Required + VPCID: aws.String("String"), // Required + DryRun: aws.Boolean(true), + } + resp, err := svc.DetachInternetGateway(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_DetachNetworkInterface() { + svc := ec2.New(nil) + + params := &ec2.DetachNetworkInterfaceInput{ + AttachmentID: aws.String("String"), // Required + DryRun: aws.Boolean(true), + Force: aws.Boolean(true), + } + resp, err := svc.DetachNetworkInterface(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_DetachVPNGateway() { + svc := ec2.New(nil) + + params := &ec2.DetachVPNGatewayInput{ + VPCID: aws.String("String"), // Required + VPNGatewayID: aws.String("String"), // Required + DryRun: aws.Boolean(true), + } + resp, err := svc.DetachVPNGateway(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_DetachVolume() { + svc := ec2.New(nil) + + params := &ec2.DetachVolumeInput{ + VolumeID: aws.String("String"), // Required + Device: aws.String("String"), + DryRun: aws.Boolean(true), + Force: aws.Boolean(true), + InstanceID: aws.String("String"), + } + resp, err := svc.DetachVolume(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_DisableVGWRoutePropagation() { + svc := ec2.New(nil) + + params := &ec2.DisableVGWRoutePropagationInput{ + GatewayID: aws.String("String"), // Required + RouteTableID: aws.String("String"), // Required + } + resp, err := svc.DisableVGWRoutePropagation(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_DisableVPCClassicLink() { + svc := ec2.New(nil) + + params := &ec2.DisableVPCClassicLinkInput{ + VPCID: aws.String("String"), // Required + DryRun: aws.Boolean(true), + } + resp, err := svc.DisableVPCClassicLink(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_DisassociateAddress() { + svc := ec2.New(nil) + + params := &ec2.DisassociateAddressInput{ + AssociationID: aws.String("String"), + DryRun: aws.Boolean(true), + PublicIP: aws.String("String"), + } + resp, err := svc.DisassociateAddress(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_DisassociateRouteTable() { + svc := ec2.New(nil) + + params := &ec2.DisassociateRouteTableInput{ + AssociationID: aws.String("String"), // Required + DryRun: aws.Boolean(true), + } + resp, err := svc.DisassociateRouteTable(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_EnableVGWRoutePropagation() { + svc := ec2.New(nil) + + params := &ec2.EnableVGWRoutePropagationInput{ + GatewayID: aws.String("String"), // Required + RouteTableID: aws.String("String"), // Required + } + resp, err := svc.EnableVGWRoutePropagation(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_EnableVPCClassicLink() { + svc := ec2.New(nil) + + params := &ec2.EnableVPCClassicLinkInput{ + VPCID: aws.String("String"), // Required + DryRun: aws.Boolean(true), + } + resp, err := svc.EnableVPCClassicLink(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_EnableVolumeIO() { + svc := ec2.New(nil) + + params := &ec2.EnableVolumeIOInput{ + VolumeID: aws.String("String"), // Required + DryRun: aws.Boolean(true), + } + resp, err := svc.EnableVolumeIO(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_GetConsoleOutput() { + svc := ec2.New(nil) + + params := &ec2.GetConsoleOutputInput{ + InstanceID: aws.String("String"), // Required + DryRun: aws.Boolean(true), + } + resp, err := svc.GetConsoleOutput(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_GetPasswordData() { + svc := ec2.New(nil) + + params := &ec2.GetPasswordDataInput{ + InstanceID: aws.String("String"), // Required + DryRun: aws.Boolean(true), + } + resp, err := svc.GetPasswordData(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_ImportImage() { + svc := ec2.New(nil) + + params := &ec2.ImportImageInput{ + Architecture: aws.String("String"), + ClientData: &ec2.ClientData{ + Comment: aws.String("String"), + UploadEnd: aws.Time(time.Now()), + UploadSize: aws.Double(1.0), + UploadStart: aws.Time(time.Now()), + }, + ClientToken: aws.String("String"), + Description: aws.String("String"), + DiskContainers: []*ec2.ImageDiskContainer{ + &ec2.ImageDiskContainer{ // Required + Description: aws.String("String"), + DeviceName: aws.String("String"), + Format: aws.String("String"), + SnapshotID: aws.String("String"), + URL: aws.String("String"), + UserBucket: &ec2.UserBucket{ + S3Bucket: aws.String("String"), + S3Key: aws.String("String"), + }, + }, + // More values... + }, + DryRun: aws.Boolean(true), + Hypervisor: aws.String("String"), + LicenseType: aws.String("String"), + Platform: aws.String("String"), + RoleName: aws.String("String"), + } + resp, err := svc.ImportImage(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_ImportInstance() { + svc := ec2.New(nil) + + params := &ec2.ImportInstanceInput{ + Platform: aws.String("PlatformValues"), // Required + Description: aws.String("String"), + DiskImages: []*ec2.DiskImage{ + &ec2.DiskImage{ // Required + Description: aws.String("String"), + Image: &ec2.DiskImageDetail{ + Bytes: aws.Long(1), // Required + Format: aws.String("DiskImageFormat"), // Required + ImportManifestURL: aws.String("String"), // Required + }, + Volume: &ec2.VolumeDetail{ + Size: aws.Long(1), // Required + }, + }, + // More values... + }, + DryRun: aws.Boolean(true), + LaunchSpecification: &ec2.ImportInstanceLaunchSpecification{ + AdditionalInfo: aws.String("String"), + Architecture: aws.String("ArchitectureValues"), + GroupIDs: []*string{ + aws.String("String"), // Required + // More values... + }, + GroupNames: []*string{ + aws.String("String"), // Required + // More values... + }, + InstanceInitiatedShutdownBehavior: aws.String("ShutdownBehavior"), + InstanceType: aws.String("InstanceType"), + Monitoring: aws.Boolean(true), + Placement: &ec2.Placement{ + AvailabilityZone: aws.String("String"), + GroupName: aws.String("String"), + Tenancy: aws.String("Tenancy"), + }, + PrivateIPAddress: aws.String("String"), + SubnetID: aws.String("String"), + UserData: &ec2.UserData{ + Data: aws.String("String"), + }, + }, + } + resp, err := svc.ImportInstance(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_ImportKeyPair() { + svc := ec2.New(nil) + + params := &ec2.ImportKeyPairInput{ + KeyName: aws.String("String"), // Required + PublicKeyMaterial: []byte("PAYLOAD"), // Required + DryRun: aws.Boolean(true), + } + resp, err := svc.ImportKeyPair(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_ImportSnapshot() { + svc := ec2.New(nil) + + params := &ec2.ImportSnapshotInput{ + ClientData: &ec2.ClientData{ + Comment: aws.String("String"), + UploadEnd: aws.Time(time.Now()), + UploadSize: aws.Double(1.0), + UploadStart: aws.Time(time.Now()), + }, + ClientToken: aws.String("String"), + Description: aws.String("String"), + DiskContainer: &ec2.SnapshotDiskContainer{ + Description: aws.String("String"), + Format: aws.String("String"), + URL: aws.String("String"), + UserBucket: &ec2.UserBucket{ + S3Bucket: aws.String("String"), + S3Key: aws.String("String"), + }, + }, + DryRun: aws.Boolean(true), + RoleName: aws.String("String"), + } + resp, err := svc.ImportSnapshot(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_ImportVolume() { + svc := ec2.New(nil) + + params := &ec2.ImportVolumeInput{ + AvailabilityZone: aws.String("String"), // Required + Image: &ec2.DiskImageDetail{ // Required + Bytes: aws.Long(1), // Required + Format: aws.String("DiskImageFormat"), // Required + ImportManifestURL: aws.String("String"), // Required + }, + Volume: &ec2.VolumeDetail{ // Required + Size: aws.Long(1), // Required + }, + Description: aws.String("String"), + DryRun: aws.Boolean(true), + } + resp, err := svc.ImportVolume(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_ModifyImageAttribute() { + svc := ec2.New(nil) + + params := &ec2.ModifyImageAttributeInput{ + ImageID: aws.String("String"), // Required + Attribute: aws.String("String"), + Description: &ec2.AttributeValue{ + Value: aws.String("String"), + }, + DryRun: aws.Boolean(true), + LaunchPermission: &ec2.LaunchPermissionModifications{ + Add: []*ec2.LaunchPermission{ + &ec2.LaunchPermission{ // Required + Group: aws.String("PermissionGroup"), + UserID: aws.String("String"), + }, + // More values... + }, + Remove: []*ec2.LaunchPermission{ + &ec2.LaunchPermission{ // Required + Group: aws.String("PermissionGroup"), + UserID: aws.String("String"), + }, + // More values... + }, + }, + OperationType: aws.String("String"), + ProductCodes: []*string{ + aws.String("String"), // Required + // More values... + }, + UserGroups: []*string{ + aws.String("String"), // Required + // More values... + }, + UserIDs: []*string{ + aws.String("String"), // Required + // More values... + }, + Value: aws.String("String"), + } + resp, err := svc.ModifyImageAttribute(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_ModifyInstanceAttribute() { + svc := ec2.New(nil) + + params := &ec2.ModifyInstanceAttributeInput{ + InstanceID: aws.String("String"), // Required + Attribute: aws.String("InstanceAttributeName"), + BlockDeviceMappings: []*ec2.InstanceBlockDeviceMappingSpecification{ + &ec2.InstanceBlockDeviceMappingSpecification{ // Required + DeviceName: aws.String("String"), + EBS: &ec2.EBSInstanceBlockDeviceSpecification{ + DeleteOnTermination: aws.Boolean(true), + VolumeID: aws.String("String"), + }, + NoDevice: aws.String("String"), + VirtualName: aws.String("String"), + }, + // More values... + }, + DisableAPITermination: &ec2.AttributeBooleanValue{ + Value: aws.Boolean(true), + }, + DryRun: aws.Boolean(true), + EBSOptimized: &ec2.AttributeBooleanValue{ + Value: aws.Boolean(true), + }, + Groups: []*string{ + aws.String("String"), // Required + // More values... + }, + InstanceInitiatedShutdownBehavior: &ec2.AttributeValue{ + Value: aws.String("String"), + }, + InstanceType: &ec2.AttributeValue{ + Value: aws.String("String"), + }, + Kernel: &ec2.AttributeValue{ + Value: aws.String("String"), + }, + RAMDisk: &ec2.AttributeValue{ + Value: aws.String("String"), + }, + SRIOVNetSupport: &ec2.AttributeValue{ + Value: aws.String("String"), + }, + SourceDestCheck: &ec2.AttributeBooleanValue{ + Value: aws.Boolean(true), + }, + UserData: &ec2.BlobAttributeValue{ + Value: []byte("PAYLOAD"), + }, + Value: aws.String("String"), + } + resp, err := svc.ModifyInstanceAttribute(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_ModifyNetworkInterfaceAttribute() { + svc := ec2.New(nil) + + params := &ec2.ModifyNetworkInterfaceAttributeInput{ + NetworkInterfaceID: aws.String("String"), // Required + Attachment: &ec2.NetworkInterfaceAttachmentChanges{ + AttachmentID: aws.String("String"), + DeleteOnTermination: aws.Boolean(true), + }, + Description: &ec2.AttributeValue{ + Value: aws.String("String"), + }, + DryRun: aws.Boolean(true), + Groups: []*string{ + aws.String("String"), // Required + // More values... + }, + SourceDestCheck: &ec2.AttributeBooleanValue{ + Value: aws.Boolean(true), + }, + } + resp, err := svc.ModifyNetworkInterfaceAttribute(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_ModifyReservedInstances() { + svc := ec2.New(nil) + + params := &ec2.ModifyReservedInstancesInput{ + ReservedInstancesIDs: []*string{ // Required + aws.String("String"), // Required + // More values... + }, + TargetConfigurations: []*ec2.ReservedInstancesConfiguration{ // Required + &ec2.ReservedInstancesConfiguration{ // Required + AvailabilityZone: aws.String("String"), + InstanceCount: aws.Long(1), + InstanceType: aws.String("InstanceType"), + Platform: aws.String("String"), + }, + // More values... + }, + ClientToken: aws.String("String"), + } + resp, err := svc.ModifyReservedInstances(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_ModifySnapshotAttribute() { + svc := ec2.New(nil) + + params := &ec2.ModifySnapshotAttributeInput{ + SnapshotID: aws.String("String"), // Required + Attribute: aws.String("SnapshotAttributeName"), + CreateVolumePermission: &ec2.CreateVolumePermissionModifications{ + Add: []*ec2.CreateVolumePermission{ + &ec2.CreateVolumePermission{ // Required + Group: aws.String("PermissionGroup"), + UserID: aws.String("String"), + }, + // More values... + }, + Remove: []*ec2.CreateVolumePermission{ + &ec2.CreateVolumePermission{ // Required + Group: aws.String("PermissionGroup"), + UserID: aws.String("String"), + }, + // More values... + }, + }, + DryRun: aws.Boolean(true), + GroupNames: []*string{ + aws.String("String"), // Required + // More values... + }, + OperationType: aws.String("String"), + UserIDs: []*string{ + aws.String("String"), // Required + // More values... + }, + } + resp, err := svc.ModifySnapshotAttribute(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_ModifySubnetAttribute() { + svc := ec2.New(nil) + + params := &ec2.ModifySubnetAttributeInput{ + SubnetID: aws.String("String"), // Required + MapPublicIPOnLaunch: &ec2.AttributeBooleanValue{ + Value: aws.Boolean(true), + }, + } + resp, err := svc.ModifySubnetAttribute(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_ModifyVPCAttribute() { + svc := ec2.New(nil) + + params := &ec2.ModifyVPCAttributeInput{ + VPCID: aws.String("String"), // Required + EnableDNSHostnames: &ec2.AttributeBooleanValue{ + Value: aws.Boolean(true), + }, + EnableDNSSupport: &ec2.AttributeBooleanValue{ + Value: aws.Boolean(true), + }, + } + resp, err := svc.ModifyVPCAttribute(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_ModifyVolumeAttribute() { + svc := ec2.New(nil) + + params := &ec2.ModifyVolumeAttributeInput{ + VolumeID: aws.String("String"), // Required + AutoEnableIO: &ec2.AttributeBooleanValue{ + Value: aws.Boolean(true), + }, + DryRun: aws.Boolean(true), + } + resp, err := svc.ModifyVolumeAttribute(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_MonitorInstances() { + svc := ec2.New(nil) + + params := &ec2.MonitorInstancesInput{ + InstanceIDs: []*string{ // Required + aws.String("String"), // Required + // More values... + }, + DryRun: aws.Boolean(true), + } + resp, err := svc.MonitorInstances(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_PurchaseReservedInstancesOffering() { + svc := ec2.New(nil) + + params := &ec2.PurchaseReservedInstancesOfferingInput{ + InstanceCount: aws.Long(1), // Required + ReservedInstancesOfferingID: aws.String("String"), // Required + DryRun: aws.Boolean(true), + LimitPrice: &ec2.ReservedInstanceLimitPrice{ + Amount: aws.Double(1.0), + CurrencyCode: aws.String("CurrencyCodeValues"), + }, + } + resp, err := svc.PurchaseReservedInstancesOffering(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_RebootInstances() { + svc := ec2.New(nil) + + params := &ec2.RebootInstancesInput{ + InstanceIDs: []*string{ // Required + aws.String("String"), // Required + // More values... + }, + DryRun: aws.Boolean(true), + } + resp, err := svc.RebootInstances(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_RegisterImage() { + svc := ec2.New(nil) + + params := &ec2.RegisterImageInput{ + Name: aws.String("String"), // Required + Architecture: aws.String("ArchitectureValues"), + BlockDeviceMappings: []*ec2.BlockDeviceMapping{ + &ec2.BlockDeviceMapping{ // Required + DeviceName: aws.String("String"), + EBS: &ec2.EBSBlockDevice{ + DeleteOnTermination: aws.Boolean(true), + Encrypted: aws.Boolean(true), + IOPS: aws.Long(1), + SnapshotID: aws.String("String"), + VolumeSize: aws.Long(1), + VolumeType: aws.String("VolumeType"), + }, + NoDevice: aws.String("String"), + VirtualName: aws.String("String"), + }, + // More values... + }, + Description: aws.String("String"), + DryRun: aws.Boolean(true), + ImageLocation: aws.String("String"), + KernelID: aws.String("String"), + RAMDiskID: aws.String("String"), + RootDeviceName: aws.String("String"), + SRIOVNetSupport: aws.String("String"), + VirtualizationType: aws.String("String"), + } + resp, err := svc.RegisterImage(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_RejectVPCPeeringConnection() { + svc := ec2.New(nil) + + params := &ec2.RejectVPCPeeringConnectionInput{ + VPCPeeringConnectionID: aws.String("String"), // Required + DryRun: aws.Boolean(true), + } + resp, err := svc.RejectVPCPeeringConnection(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_ReleaseAddress() { + svc := ec2.New(nil) + + params := &ec2.ReleaseAddressInput{ + AllocationID: aws.String("String"), + DryRun: aws.Boolean(true), + PublicIP: aws.String("String"), + } + resp, err := svc.ReleaseAddress(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_ReplaceNetworkACLAssociation() { + svc := ec2.New(nil) + + params := &ec2.ReplaceNetworkACLAssociationInput{ + AssociationID: aws.String("String"), // Required + NetworkACLID: aws.String("String"), // Required + DryRun: aws.Boolean(true), + } + resp, err := svc.ReplaceNetworkACLAssociation(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_ReplaceNetworkACLEntry() { + svc := ec2.New(nil) + + params := &ec2.ReplaceNetworkACLEntryInput{ + CIDRBlock: aws.String("String"), // Required + Egress: aws.Boolean(true), // Required + NetworkACLID: aws.String("String"), // Required + Protocol: aws.String("String"), // Required + RuleAction: aws.String("RuleAction"), // Required + RuleNumber: aws.Long(1), // Required + DryRun: aws.Boolean(true), + ICMPTypeCode: &ec2.ICMPTypeCode{ + Code: aws.Long(1), + Type: aws.Long(1), + }, + PortRange: &ec2.PortRange{ + From: aws.Long(1), + To: aws.Long(1), + }, + } + resp, err := svc.ReplaceNetworkACLEntry(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_ReplaceRoute() { + svc := ec2.New(nil) + + params := &ec2.ReplaceRouteInput{ + DestinationCIDRBlock: aws.String("String"), // Required + RouteTableID: aws.String("String"), // Required + DryRun: aws.Boolean(true), + GatewayID: aws.String("String"), + InstanceID: aws.String("String"), + NetworkInterfaceID: aws.String("String"), + VPCPeeringConnectionID: aws.String("String"), + } + resp, err := svc.ReplaceRoute(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_ReplaceRouteTableAssociation() { + svc := ec2.New(nil) + + params := &ec2.ReplaceRouteTableAssociationInput{ + AssociationID: aws.String("String"), // Required + RouteTableID: aws.String("String"), // Required + DryRun: aws.Boolean(true), + } + resp, err := svc.ReplaceRouteTableAssociation(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_ReportInstanceStatus() { + svc := ec2.New(nil) + + params := &ec2.ReportInstanceStatusInput{ + Instances: []*string{ // Required + aws.String("String"), // Required + // More values... + }, + ReasonCodes: []*string{ // Required + aws.String("ReportInstanceReasonCodes"), // Required + // More values... + }, + Status: aws.String("ReportStatusType"), // Required + Description: aws.String("String"), + DryRun: aws.Boolean(true), + EndTime: aws.Time(time.Now()), + StartTime: aws.Time(time.Now()), + } + resp, err := svc.ReportInstanceStatus(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_RequestSpotInstances() { + svc := ec2.New(nil) + + params := &ec2.RequestSpotInstancesInput{ + SpotPrice: aws.String("String"), // Required + AvailabilityZoneGroup: aws.String("String"), + DryRun: aws.Boolean(true), + InstanceCount: aws.Long(1), + LaunchGroup: aws.String("String"), + LaunchSpecification: &ec2.RequestSpotLaunchSpecification{ + AddressingType: aws.String("String"), + BlockDeviceMappings: []*ec2.BlockDeviceMapping{ + &ec2.BlockDeviceMapping{ // Required + DeviceName: aws.String("String"), + EBS: &ec2.EBSBlockDevice{ + DeleteOnTermination: aws.Boolean(true), + Encrypted: aws.Boolean(true), + IOPS: aws.Long(1), + SnapshotID: aws.String("String"), + VolumeSize: aws.Long(1), + VolumeType: aws.String("VolumeType"), + }, + NoDevice: aws.String("String"), + VirtualName: aws.String("String"), + }, + // More values... + }, + EBSOptimized: aws.Boolean(true), + IAMInstanceProfile: &ec2.IAMInstanceProfileSpecification{ + ARN: aws.String("String"), + Name: aws.String("String"), + }, + ImageID: aws.String("String"), + InstanceType: aws.String("InstanceType"), + KernelID: aws.String("String"), + KeyName: aws.String("String"), + Monitoring: &ec2.RunInstancesMonitoringEnabled{ + Enabled: aws.Boolean(true), // Required + }, + NetworkInterfaces: []*ec2.InstanceNetworkInterfaceSpecification{ + &ec2.InstanceNetworkInterfaceSpecification{ // Required + AssociatePublicIPAddress: aws.Boolean(true), + DeleteOnTermination: aws.Boolean(true), + Description: aws.String("String"), + DeviceIndex: aws.Long(1), + Groups: []*string{ + aws.String("String"), // Required + // More values... + }, + NetworkInterfaceID: aws.String("String"), + PrivateIPAddress: aws.String("String"), + PrivateIPAddresses: []*ec2.PrivateIPAddressSpecification{ + &ec2.PrivateIPAddressSpecification{ // Required + PrivateIPAddress: aws.String("String"), // Required + Primary: aws.Boolean(true), + }, + // More values... + }, + SecondaryPrivateIPAddressCount: aws.Long(1), + SubnetID: aws.String("String"), + }, + // More values... + }, + Placement: &ec2.SpotPlacement{ + AvailabilityZone: aws.String("String"), + GroupName: aws.String("String"), + }, + RAMDiskID: aws.String("String"), + SecurityGroupIDs: []*string{ + aws.String("String"), // Required + // More values... + }, + SecurityGroups: []*string{ + aws.String("String"), // Required + // More values... + }, + SubnetID: aws.String("String"), + UserData: aws.String("String"), + }, + Type: aws.String("SpotInstanceType"), + ValidFrom: aws.Time(time.Now()), + ValidUntil: aws.Time(time.Now()), + } + resp, err := svc.RequestSpotInstances(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_ResetImageAttribute() { + svc := ec2.New(nil) + + params := &ec2.ResetImageAttributeInput{ + Attribute: aws.String("ResetImageAttributeName"), // Required + ImageID: aws.String("String"), // Required + DryRun: aws.Boolean(true), + } + resp, err := svc.ResetImageAttribute(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_ResetInstanceAttribute() { + svc := ec2.New(nil) + + params := &ec2.ResetInstanceAttributeInput{ + Attribute: aws.String("InstanceAttributeName"), // Required + InstanceID: aws.String("String"), // Required + DryRun: aws.Boolean(true), + } + resp, err := svc.ResetInstanceAttribute(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_ResetNetworkInterfaceAttribute() { + svc := ec2.New(nil) + + params := &ec2.ResetNetworkInterfaceAttributeInput{ + NetworkInterfaceID: aws.String("String"), // Required + DryRun: aws.Boolean(true), + SourceDestCheck: aws.String("String"), + } + resp, err := svc.ResetNetworkInterfaceAttribute(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_ResetSnapshotAttribute() { + svc := ec2.New(nil) + + params := &ec2.ResetSnapshotAttributeInput{ + Attribute: aws.String("SnapshotAttributeName"), // Required + SnapshotID: aws.String("String"), // Required + DryRun: aws.Boolean(true), + } + resp, err := svc.ResetSnapshotAttribute(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_RevokeSecurityGroupEgress() { + svc := ec2.New(nil) + + params := &ec2.RevokeSecurityGroupEgressInput{ + GroupID: aws.String("String"), // Required + CIDRIP: aws.String("String"), + DryRun: aws.Boolean(true), + FromPort: aws.Long(1), + IPPermissions: []*ec2.IPPermission{ + &ec2.IPPermission{ // Required + FromPort: aws.Long(1), + IPProtocol: aws.String("String"), + IPRanges: []*ec2.IPRange{ + &ec2.IPRange{ // Required + CIDRIP: aws.String("String"), + }, + // More values... + }, + ToPort: aws.Long(1), + UserIDGroupPairs: []*ec2.UserIDGroupPair{ + &ec2.UserIDGroupPair{ // Required + GroupID: aws.String("String"), + GroupName: aws.String("String"), + UserID: aws.String("String"), + }, + // More values... + }, + }, + // More values... + }, + IPProtocol: aws.String("String"), + SourceSecurityGroupName: aws.String("String"), + SourceSecurityGroupOwnerID: aws.String("String"), + ToPort: aws.Long(1), + } + resp, err := svc.RevokeSecurityGroupEgress(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_RevokeSecurityGroupIngress() { + svc := ec2.New(nil) + + params := &ec2.RevokeSecurityGroupIngressInput{ + CIDRIP: aws.String("String"), + DryRun: aws.Boolean(true), + FromPort: aws.Long(1), + GroupID: aws.String("String"), + GroupName: aws.String("String"), + IPPermissions: []*ec2.IPPermission{ + &ec2.IPPermission{ // Required + FromPort: aws.Long(1), + IPProtocol: aws.String("String"), + IPRanges: []*ec2.IPRange{ + &ec2.IPRange{ // Required + CIDRIP: aws.String("String"), + }, + // More values... + }, + ToPort: aws.Long(1), + UserIDGroupPairs: []*ec2.UserIDGroupPair{ + &ec2.UserIDGroupPair{ // Required + GroupID: aws.String("String"), + GroupName: aws.String("String"), + UserID: aws.String("String"), + }, + // More values... + }, + }, + // More values... + }, + IPProtocol: aws.String("String"), + SourceSecurityGroupName: aws.String("String"), + SourceSecurityGroupOwnerID: aws.String("String"), + ToPort: aws.Long(1), + } + resp, err := svc.RevokeSecurityGroupIngress(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_RunInstances() { + svc := ec2.New(nil) + + params := &ec2.RunInstancesInput{ + ImageID: aws.String("String"), // Required + MaxCount: aws.Long(1), // Required + MinCount: aws.Long(1), // Required + AdditionalInfo: aws.String("String"), + BlockDeviceMappings: []*ec2.BlockDeviceMapping{ + &ec2.BlockDeviceMapping{ // Required + DeviceName: aws.String("String"), + EBS: &ec2.EBSBlockDevice{ + DeleteOnTermination: aws.Boolean(true), + Encrypted: aws.Boolean(true), + IOPS: aws.Long(1), + SnapshotID: aws.String("String"), + VolumeSize: aws.Long(1), + VolumeType: aws.String("VolumeType"), + }, + NoDevice: aws.String("String"), + VirtualName: aws.String("String"), + }, + // More values... + }, + ClientToken: aws.String("String"), + DisableAPITermination: aws.Boolean(true), + DryRun: aws.Boolean(true), + EBSOptimized: aws.Boolean(true), + IAMInstanceProfile: &ec2.IAMInstanceProfileSpecification{ + ARN: aws.String("String"), + Name: aws.String("String"), + }, + InstanceInitiatedShutdownBehavior: aws.String("ShutdownBehavior"), + InstanceType: aws.String("InstanceType"), + KernelID: aws.String("String"), + KeyName: aws.String("String"), + Monitoring: &ec2.RunInstancesMonitoringEnabled{ + Enabled: aws.Boolean(true), // Required + }, + NetworkInterfaces: []*ec2.InstanceNetworkInterfaceSpecification{ + &ec2.InstanceNetworkInterfaceSpecification{ // Required + AssociatePublicIPAddress: aws.Boolean(true), + DeleteOnTermination: aws.Boolean(true), + Description: aws.String("String"), + DeviceIndex: aws.Long(1), + Groups: []*string{ + aws.String("String"), // Required + // More values... + }, + NetworkInterfaceID: aws.String("String"), + PrivateIPAddress: aws.String("String"), + PrivateIPAddresses: []*ec2.PrivateIPAddressSpecification{ + &ec2.PrivateIPAddressSpecification{ // Required + PrivateIPAddress: aws.String("String"), // Required + Primary: aws.Boolean(true), + }, + // More values... + }, + SecondaryPrivateIPAddressCount: aws.Long(1), + SubnetID: aws.String("String"), + }, + // More values... + }, + Placement: &ec2.Placement{ + AvailabilityZone: aws.String("String"), + GroupName: aws.String("String"), + Tenancy: aws.String("Tenancy"), + }, + PrivateIPAddress: aws.String("String"), + RAMDiskID: aws.String("String"), + SecurityGroupIDs: []*string{ + aws.String("String"), // Required + // More values... + }, + SecurityGroups: []*string{ + aws.String("String"), // Required + // More values... + }, + SubnetID: aws.String("String"), + UserData: aws.String("String"), + } + resp, err := svc.RunInstances(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_StartInstances() { + svc := ec2.New(nil) + + params := &ec2.StartInstancesInput{ + InstanceIDs: []*string{ // Required + aws.String("String"), // Required + // More values... + }, + AdditionalInfo: aws.String("String"), + DryRun: aws.Boolean(true), + } + resp, err := svc.StartInstances(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_StopInstances() { + svc := ec2.New(nil) + + params := &ec2.StopInstancesInput{ + InstanceIDs: []*string{ // Required + aws.String("String"), // Required + // More values... + }, + DryRun: aws.Boolean(true), + Force: aws.Boolean(true), + } + resp, err := svc.StopInstances(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_TerminateInstances() { + svc := ec2.New(nil) + + params := &ec2.TerminateInstancesInput{ + InstanceIDs: []*string{ // Required + aws.String("String"), // Required + // More values... + }, + DryRun: aws.Boolean(true), + } + resp, err := svc.TerminateInstances(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_UnassignPrivateIPAddresses() { + svc := ec2.New(nil) + + params := &ec2.UnassignPrivateIPAddressesInput{ + NetworkInterfaceID: aws.String("String"), // Required + PrivateIPAddresses: []*string{ // Required + aws.String("String"), // Required + // More values... + }, + } + resp, err := svc.UnassignPrivateIPAddresses(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} + +func ExampleEC2_UnmonitorInstances() { + svc := ec2.New(nil) + + params := &ec2.UnmonitorInstancesInput{ + InstanceIDs: []*string{ // Required + aws.String("String"), // Required + // More values... + }, + DryRun: aws.Boolean(true), + } + resp, err := svc.UnmonitorInstances(params) + + if awserr := aws.Error(err); awserr != nil { + // A service error occurred. + fmt.Println("Error:", awserr.Code, awserr.Message) + } else if err != nil { + // A non-service error occurred. + panic(err) + } + + // Pretty-print the response data. + fmt.Println(awsutil.StringValue(resp)) +} diff --git a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/service/ec2/integration_test.go b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/service/ec2/integration_test.go new file mode 100644 index 00000000000..01808b8fa30 --- /dev/null +++ b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/service/ec2/integration_test.go @@ -0,0 +1,45 @@ +// +build integration + +package ec2_test + +import ( + "testing" + + "github.com/awslabs/aws-sdk-go/aws" + "github.com/awslabs/aws-sdk-go/internal/test/integration" + "github.com/awslabs/aws-sdk-go/internal/util/utilassert" + "github.com/awslabs/aws-sdk-go/service/ec2" + "github.com/stretchr/testify/assert" +) + +var ( + _ = assert.Equal + _ = utilassert.Match + _ = integration.Imported +) + +func TestMakingABasicRequest(t *testing.T) { + client := ec2.New(nil) + resp, e := client.DescribeRegions(&ec2.DescribeRegionsInput{}) + err := aws.Error(e) + _, _, _ = resp, e, err // avoid unused warnings + + assert.NoError(t, nil, err) + +} + +func TestErrorHandling(t *testing.T) { + client := ec2.New(nil) + resp, e := client.DescribeInstances(&ec2.DescribeInstancesInput{ + InstanceIDs: []*string{ + aws.String("i-12345678"), + }, + }) + err := aws.Error(e) + _, _, _ = resp, e, err // avoid unused warnings + + assert.NotEqual(t, nil, err) + assert.Equal(t, "InvalidInstanceID.NotFound", err.Code) + utilassert.Match(t, "The instance ID 'i-12345678' does not exist", err.Message) + +} diff --git a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/service/ec2/service.go b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/service/ec2/service.go new file mode 100644 index 00000000000..9556c45d75e --- /dev/null +++ b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/service/ec2/service.go @@ -0,0 +1,59 @@ +package ec2 + +import ( + "github.com/awslabs/aws-sdk-go/aws" + "github.com/awslabs/aws-sdk-go/internal/protocol/ec2query" + "github.com/awslabs/aws-sdk-go/internal/signer/v4" +) + +// EC2 is a client for Amazon EC2. +type EC2 struct { + *aws.Service +} + +// Used for custom service initialization logic +var initService func(*aws.Service) + +// Used for custom request initialization logic +var initRequest func(*aws.Request) + +// New returns a new EC2 client. +func New(config *aws.Config) *EC2 { + if config == nil { + config = &aws.Config{} + } + + service := &aws.Service{ + Config: aws.DefaultConfig.Merge(config), + ServiceName: "ec2", + APIVersion: "2015-03-01", + } + service.Initialize() + + // Handlers + service.Handlers.Sign.PushBack(v4.Sign) + service.Handlers.Build.PushBack(ec2query.Build) + service.Handlers.Unmarshal.PushBack(ec2query.Unmarshal) + service.Handlers.UnmarshalMeta.PushBack(ec2query.UnmarshalMeta) + service.Handlers.UnmarshalError.PushBack(ec2query.UnmarshalError) + + // Run custom service initialization if present + if initService != nil { + initService(service) + } + + return &EC2{service} +} + +// newRequest creates a new request for a EC2 operation and runs any +// custom request initialization. +func (c *EC2) newRequest(op *aws.Operation, params, data interface{}) *aws.Request { + req := aws.NewRequest(c.Service, op, params, data) + + // Run custom request initialization if present + if initRequest != nil { + initRequest(req) + } + + return req +} diff --git a/Godeps/_workspace/src/github.com/mitchellh/goamz/aws/attempt.go b/Godeps/_workspace/src/github.com/mitchellh/goamz/aws/attempt.go deleted file mode 100644 index c0654f5d851..00000000000 --- a/Godeps/_workspace/src/github.com/mitchellh/goamz/aws/attempt.go +++ /dev/null @@ -1,74 +0,0 @@ -package aws - -import ( - "time" -) - -// AttemptStrategy represents a strategy for waiting for an action -// to complete successfully. This is an internal type used by the -// implementation of other goamz packages. -type AttemptStrategy struct { - Total time.Duration // total duration of attempt. - Delay time.Duration // interval between each try in the burst. - Min int // minimum number of retries; overrides Total -} - -type Attempt struct { - strategy AttemptStrategy - last time.Time - end time.Time - force bool - count int -} - -// Start begins a new sequence of attempts for the given strategy. -func (s AttemptStrategy) Start() *Attempt { - now := time.Now() - return &Attempt{ - strategy: s, - last: now, - end: now.Add(s.Total), - force: true, - } -} - -// Next waits until it is time to perform the next attempt or returns -// false if it is time to stop trying. -func (a *Attempt) Next() bool { - now := time.Now() - sleep := a.nextSleep(now) - if !a.force && !now.Add(sleep).Before(a.end) && a.strategy.Min <= a.count { - return false - } - a.force = false - if sleep > 0 && a.count > 0 { - time.Sleep(sleep) - now = time.Now() - } - a.count++ - a.last = now - return true -} - -func (a *Attempt) nextSleep(now time.Time) time.Duration { - sleep := a.strategy.Delay - now.Sub(a.last) - if sleep < 0 { - return 0 - } - return sleep -} - -// HasNext returns whether another attempt will be made if the current -// one fails. If it returns true, the following call to Next is -// guaranteed to return true. -func (a *Attempt) HasNext() bool { - if a.force || a.strategy.Min > a.count { - return true - } - now := time.Now() - if now.Add(a.nextSleep(now)).Before(a.end) { - a.force = true - return true - } - return false -} diff --git a/Godeps/_workspace/src/github.com/mitchellh/goamz/aws/attempt_test.go b/Godeps/_workspace/src/github.com/mitchellh/goamz/aws/attempt_test.go deleted file mode 100644 index 1fda5bf3c51..00000000000 --- a/Godeps/_workspace/src/github.com/mitchellh/goamz/aws/attempt_test.go +++ /dev/null @@ -1,57 +0,0 @@ -package aws_test - -import ( - "github.com/mitchellh/goamz/aws" - . "github.com/motain/gocheck" - "time" -) - -func (S) TestAttemptTiming(c *C) { - testAttempt := aws.AttemptStrategy{ - Total: 0.25e9, - Delay: 0.1e9, - } - want := []time.Duration{0, 0.1e9, 0.2e9, 0.2e9} - got := make([]time.Duration, 0, len(want)) // avoid allocation when testing timing - t0 := time.Now() - for a := testAttempt.Start(); a.Next(); { - got = append(got, time.Now().Sub(t0)) - } - got = append(got, time.Now().Sub(t0)) - c.Assert(got, HasLen, len(want)) - const margin = 0.01e9 - for i, got := range want { - lo := want[i] - margin - hi := want[i] + margin - if got < lo || got > hi { - c.Errorf("attempt %d want %g got %g", i, want[i].Seconds(), got.Seconds()) - } - } -} - -func (S) TestAttemptNextHasNext(c *C) { - a := aws.AttemptStrategy{}.Start() - c.Assert(a.Next(), Equals, true) - c.Assert(a.Next(), Equals, false) - - a = aws.AttemptStrategy{}.Start() - c.Assert(a.Next(), Equals, true) - c.Assert(a.HasNext(), Equals, false) - c.Assert(a.Next(), Equals, false) - - a = aws.AttemptStrategy{Total: 2e8}.Start() - c.Assert(a.Next(), Equals, true) - c.Assert(a.HasNext(), Equals, true) - time.Sleep(2e8) - c.Assert(a.HasNext(), Equals, true) - c.Assert(a.Next(), Equals, true) - c.Assert(a.Next(), Equals, false) - - a = aws.AttemptStrategy{Total: 1e8, Min: 2}.Start() - time.Sleep(1e8) - c.Assert(a.Next(), Equals, true) - c.Assert(a.HasNext(), Equals, true) - c.Assert(a.Next(), Equals, true) - c.Assert(a.HasNext(), Equals, false) - c.Assert(a.Next(), Equals, false) -} diff --git a/Godeps/_workspace/src/github.com/mitchellh/goamz/aws/aws.go b/Godeps/_workspace/src/github.com/mitchellh/goamz/aws/aws.go deleted file mode 100644 index cfc42c03ab4..00000000000 --- a/Godeps/_workspace/src/github.com/mitchellh/goamz/aws/aws.go +++ /dev/null @@ -1,445 +0,0 @@ -// -// goamz - Go packages to interact with the Amazon Web Services. -// -// https://wiki.ubuntu.com/goamz -// -// Copyright (c) 2011 Canonical Ltd. -// -// Written by Gustavo Niemeyer -// -package aws - -import ( - "encoding/json" - "errors" - "fmt" - "io/ioutil" - "os" - - "github.com/vaughan0/go-ini" -) - -// Region defines the URLs where AWS services may be accessed. -// -// See http://goo.gl/d8BP1 for more details. -type Region struct { - Name string // the canonical name of this region. - EC2Endpoint string - S3Endpoint string - S3BucketEndpoint string // Not needed by AWS S3. Use ${bucket} for bucket name. - S3LocationConstraint bool // true if this region requires a LocationConstraint declaration. - S3LowercaseBucket bool // true if the region requires bucket names to be lower case. - SDBEndpoint string - SNSEndpoint string - SQSEndpoint string - IAMEndpoint string - ELBEndpoint string - AutoScalingEndpoint string - RdsEndpoint string - Route53Endpoint string -} - -var USGovWest = Region{ - "us-gov-west-1", - "https://ec2.us-gov-west-1.amazonaws.com", - "https://s3-fips-us-gov-west-1.amazonaws.com", - "", - true, - true, - "", - "https://sns.us-gov-west-1.amazonaws.com", - "https://sqs.us-gov-west-1.amazonaws.com", - "https://iam.us-gov.amazonaws.com", - "https://elasticloadbalancing.us-gov-west-1.amazonaws.com", - "https://autoscaling.us-gov-west-1.amazonaws.com", - "https://rds.us-gov-west-1.amazonaws.com", - "https://route53.amazonaws.com", -} - -var USEast = Region{ - "us-east-1", - "https://ec2.us-east-1.amazonaws.com", - "https://s3.amazonaws.com", - "", - false, - false, - "https://sdb.amazonaws.com", - "https://sns.us-east-1.amazonaws.com", - "https://sqs.us-east-1.amazonaws.com", - "https://iam.amazonaws.com", - "https://elasticloadbalancing.us-east-1.amazonaws.com", - "https://autoscaling.us-east-1.amazonaws.com", - "https://rds.us-east-1.amazonaws.com", - "https://route53.amazonaws.com", -} - -var USWest = Region{ - "us-west-1", - "https://ec2.us-west-1.amazonaws.com", - "https://s3-us-west-1.amazonaws.com", - "", - true, - true, - "https://sdb.us-west-1.amazonaws.com", - "https://sns.us-west-1.amazonaws.com", - "https://sqs.us-west-1.amazonaws.com", - "https://iam.amazonaws.com", - "https://elasticloadbalancing.us-west-1.amazonaws.com", - "https://autoscaling.us-west-1.amazonaws.com", - "https://rds.us-west-1.amazonaws.com", - "https://route53.amazonaws.com", -} - -var USWest2 = Region{ - "us-west-2", - "https://ec2.us-west-2.amazonaws.com", - "https://s3-us-west-2.amazonaws.com", - "", - true, - true, - "https://sdb.us-west-2.amazonaws.com", - "https://sns.us-west-2.amazonaws.com", - "https://sqs.us-west-2.amazonaws.com", - "https://iam.amazonaws.com", - "https://elasticloadbalancing.us-west-2.amazonaws.com", - "https://autoscaling.us-west-2.amazonaws.com", - "https://rds.us-west-2.amazonaws.com", - "https://route53.amazonaws.com", -} - -var EUWest = Region{ - "eu-west-1", - "https://ec2.eu-west-1.amazonaws.com", - "https://s3-eu-west-1.amazonaws.com", - "", - true, - true, - "https://sdb.eu-west-1.amazonaws.com", - "https://sns.eu-west-1.amazonaws.com", - "https://sqs.eu-west-1.amazonaws.com", - "https://iam.amazonaws.com", - "https://elasticloadbalancing.eu-west-1.amazonaws.com", - "https://autoscaling.eu-west-1.amazonaws.com", - "https://rds.eu-west-1.amazonaws.com", - "https://route53.amazonaws.com", -} - -var EUCentral = Region{ - "eu-central-1", - "https://ec2.eu-central-1.amazonaws.com", - "https://s3-eu-central-1.amazonaws.com", - "", - true, - true, - "", - "https://sns.eu-central-1.amazonaws.com", - "https://sqs.eu-central-1.amazonaws.com", - "https://iam.amazonaws.com", - "https://elasticloadbalancing.eu-central-1.amazonaws.com", - "https://autoscaling.eu-central-1.amazonaws.com", - "https://rds.eu-central-1.amazonaws.com", - "https://route53.amazonaws.com", -} - -var APSoutheast = Region{ - "ap-southeast-1", - "https://ec2.ap-southeast-1.amazonaws.com", - "https://s3-ap-southeast-1.amazonaws.com", - "", - true, - true, - "https://sdb.ap-southeast-1.amazonaws.com", - "https://sns.ap-southeast-1.amazonaws.com", - "https://sqs.ap-southeast-1.amazonaws.com", - "https://iam.amazonaws.com", - "https://elasticloadbalancing.ap-southeast-1.amazonaws.com", - "https://autoscaling.ap-southeast-1.amazonaws.com", - "https://rds.ap-southeast-1.amazonaws.com", - "https://route53.amazonaws.com", -} - -var APSoutheast2 = Region{ - "ap-southeast-2", - "https://ec2.ap-southeast-2.amazonaws.com", - "https://s3-ap-southeast-2.amazonaws.com", - "", - true, - true, - "https://sdb.ap-southeast-2.amazonaws.com", - "https://sns.ap-southeast-2.amazonaws.com", - "https://sqs.ap-southeast-2.amazonaws.com", - "https://iam.amazonaws.com", - "https://elasticloadbalancing.ap-southeast-2.amazonaws.com", - "https://autoscaling.ap-southeast-2.amazonaws.com", - "https://rds.ap-southeast-2.amazonaws.com", - "https://route53.amazonaws.com", -} - -var APNortheast = Region{ - "ap-northeast-1", - "https://ec2.ap-northeast-1.amazonaws.com", - "https://s3-ap-northeast-1.amazonaws.com", - "", - true, - true, - "https://sdb.ap-northeast-1.amazonaws.com", - "https://sns.ap-northeast-1.amazonaws.com", - "https://sqs.ap-northeast-1.amazonaws.com", - "https://iam.amazonaws.com", - "https://elasticloadbalancing.ap-northeast-1.amazonaws.com", - "https://autoscaling.ap-northeast-1.amazonaws.com", - "https://rds.ap-northeast-1.amazonaws.com", - "https://route53.amazonaws.com", -} - -var SAEast = Region{ - "sa-east-1", - "https://ec2.sa-east-1.amazonaws.com", - "https://s3-sa-east-1.amazonaws.com", - "", - true, - true, - "https://sdb.sa-east-1.amazonaws.com", - "https://sns.sa-east-1.amazonaws.com", - "https://sqs.sa-east-1.amazonaws.com", - "https://iam.amazonaws.com", - "https://elasticloadbalancing.sa-east-1.amazonaws.com", - "https://autoscaling.sa-east-1.amazonaws.com", - "https://rds.sa-east-1.amazonaws.com", - "https://route53.amazonaws.com", -} - -var CNNorth = Region{ - "cn-north-1", - "https://ec2.cn-north-1.amazonaws.com.cn", - "https://s3.cn-north-1.amazonaws.com.cn", - "", - true, - true, - "", - "https://sns.cn-north-1.amazonaws.com.cn", - "https://sqs.cn-north-1.amazonaws.com.cn", - "https://iam.cn-north-1.amazonaws.com.cn", - "https://elasticloadbalancing.cn-north-1.amazonaws.com.cn", - "https://autoscaling.cn-north-1.amazonaws.com.cn", - "https://rds.cn-north-1.amazonaws.com.cn", - "https://route53.amazonaws.com", -} - -var Regions = map[string]Region{ - APNortheast.Name: APNortheast, - APSoutheast.Name: APSoutheast, - APSoutheast2.Name: APSoutheast2, - EUWest.Name: EUWest, - EUCentral.Name: EUCentral, - USEast.Name: USEast, - USWest.Name: USWest, - USWest2.Name: USWest2, - SAEast.Name: SAEast, - USGovWest.Name: USGovWest, - CNNorth.Name: CNNorth, -} - -type Auth struct { - AccessKey, SecretKey, Token string -} - -var unreserved = make([]bool, 128) -var hex = "0123456789ABCDEF" - -func init() { - // RFC3986 - u := "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz01234567890-_.~" - for _, c := range u { - unreserved[c] = true - } -} - -type credentials struct { - Code string - LastUpdated string - Type string - AccessKeyId string - SecretAccessKey string - Token string - Expiration string -} - -// GetMetaData retrieves instance metadata about the current machine. -// -// See http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/AESDG-chapter-instancedata.html for more details. -func GetMetaData(path string) (contents []byte, err error) { - url := "http://169.254.169.254/latest/meta-data/" + path - - resp, err := RetryingClient.Get(url) - if err != nil { - return - } - defer resp.Body.Close() - - if resp.StatusCode != 200 { - err = fmt.Errorf("Code %d returned for url %s", resp.StatusCode, url) - return - } - - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - return []byte(body), err -} - -func getInstanceCredentials() (cred credentials, err error) { - credentialPath := "iam/security-credentials/" - - // Get the instance role - role, err := GetMetaData(credentialPath) - if err != nil { - return - } - - // Get the instance role credentials - credentialJSON, err := GetMetaData(credentialPath + string(role)) - if err != nil { - return - } - - err = json.Unmarshal([]byte(credentialJSON), &cred) - return -} - -// GetAuth creates an Auth based on either passed in credentials, -// environment information or instance based role credentials. -func GetAuth(accessKey string, secretKey string) (auth Auth, err error) { - // First try passed in credentials - if accessKey != "" && secretKey != "" { - return Auth{accessKey, secretKey, ""}, nil - } - - // Next try to get auth from the environment - auth, err = SharedAuth() - if err == nil { - // Found auth, return - return - } - - // Next try to get auth from the environment - auth, err = EnvAuth() - if err == nil { - // Found auth, return - return - } - - // Next try getting auth from the instance role - cred, err := getInstanceCredentials() - if err == nil { - // Found auth, return - auth.AccessKey = cred.AccessKeyId - auth.SecretKey = cred.SecretAccessKey - auth.Token = cred.Token - return - } - err = errors.New("No valid AWS authentication found") - return -} - -// SharedAuth creates an Auth based on shared credentials stored in -// $HOME/.aws/credentials. The AWS_PROFILE environment variables is used to -// select the profile. -func SharedAuth() (auth Auth, err error) { - var profileName = os.Getenv("AWS_PROFILE") - - if profileName == "" { - profileName = "default" - } - - var credentialsFile = os.Getenv("AWS_CREDENTIAL_FILE") - if credentialsFile == "" { - var homeDir = os.Getenv("HOME") - if homeDir == "" { - err = errors.New("Could not get HOME") - return - } - credentialsFile = homeDir + "/.aws/credentials" - } - - file, err := ini.LoadFile(credentialsFile) - if err != nil { - err = errors.New("Couldn't parse AWS credentials file") - return - } - - var profile = file[profileName] - if profile == nil { - err = errors.New("Couldn't find profile in AWS credentials file") - return - } - - auth.AccessKey = profile["aws_access_key_id"] - auth.SecretKey = profile["aws_secret_access_key"] - - if auth.AccessKey == "" { - err = errors.New("AWS_ACCESS_KEY_ID not found in environment in credentials file") - } - if auth.SecretKey == "" { - err = errors.New("AWS_SECRET_ACCESS_KEY not found in credentials file") - } - return -} - -// EnvAuth creates an Auth based on environment information. -// The AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY environment -// For accounts that require a security token, it is read from AWS_SECURITY_TOKEN -// variables are used. -func EnvAuth() (auth Auth, err error) { - auth.AccessKey = os.Getenv("AWS_ACCESS_KEY_ID") - if auth.AccessKey == "" { - auth.AccessKey = os.Getenv("AWS_ACCESS_KEY") - } - - auth.SecretKey = os.Getenv("AWS_SECRET_ACCESS_KEY") - if auth.SecretKey == "" { - auth.SecretKey = os.Getenv("AWS_SECRET_KEY") - } - - auth.Token = os.Getenv("AWS_SECURITY_TOKEN") - - if auth.AccessKey == "" { - err = errors.New("AWS_ACCESS_KEY_ID or AWS_ACCESS_KEY not found in environment") - } - if auth.SecretKey == "" { - err = errors.New("AWS_SECRET_ACCESS_KEY or AWS_SECRET_KEY not found in environment") - } - return -} - -// Encode takes a string and URI-encodes it in a way suitable -// to be used in AWS signatures. -func Encode(s string) string { - encode := false - for i := 0; i != len(s); i++ { - c := s[i] - if c > 127 || !unreserved[c] { - encode = true - break - } - } - if !encode { - return s - } - e := make([]byte, len(s)*3) - ei := 0 - for i := 0; i != len(s); i++ { - c := s[i] - if c > 127 || !unreserved[c] { - e[ei] = '%' - e[ei+1] = hex[c>>4] - e[ei+2] = hex[c&0xF] - ei += 3 - } else { - e[ei] = c - ei += 1 - } - } - return string(e[:ei]) -} diff --git a/Godeps/_workspace/src/github.com/mitchellh/goamz/aws/aws_test.go b/Godeps/_workspace/src/github.com/mitchellh/goamz/aws/aws_test.go deleted file mode 100644 index 78cbbaf03c5..00000000000 --- a/Godeps/_workspace/src/github.com/mitchellh/goamz/aws/aws_test.go +++ /dev/null @@ -1,203 +0,0 @@ -package aws_test - -import ( - "github.com/mitchellh/goamz/aws" - . "github.com/motain/gocheck" - "io/ioutil" - "os" - "strings" - "testing" -) - -func Test(t *testing.T) { - TestingT(t) -} - -var _ = Suite(&S{}) - -type S struct { - environ []string -} - -func (s *S) SetUpSuite(c *C) { - s.environ = os.Environ() -} - -func (s *S) TearDownTest(c *C) { - os.Clearenv() - for _, kv := range s.environ { - l := strings.SplitN(kv, "=", 2) - os.Setenv(l[0], l[1]) - } -} - -func (s *S) TestSharedAuthNoHome(c *C) { - os.Clearenv() - os.Setenv("AWS_PROFILE", "foo") - _, err := aws.SharedAuth() - c.Assert(err, ErrorMatches, "Could not get HOME") -} - -func (s *S) TestSharedAuthNoCredentialsFile(c *C) { - os.Clearenv() - os.Setenv("AWS_PROFILE", "foo") - os.Setenv("HOME", "/tmp") - _, err := aws.SharedAuth() - c.Assert(err, ErrorMatches, "Couldn't parse AWS credentials file") -} - -func (s *S) TestSharedAuthNoProfileInFile(c *C) { - os.Clearenv() - os.Setenv("AWS_PROFILE", "foo") - - d, err := ioutil.TempDir("", "") - if err != nil { - panic(err) - } - defer os.RemoveAll(d) - - err = os.Mkdir(d+"/.aws", 0755) - if err != nil { - panic(err) - } - - ioutil.WriteFile(d+"/.aws/credentials", []byte("[bar]\n"), 0644) - os.Setenv("HOME", d) - - _, err = aws.SharedAuth() - c.Assert(err, ErrorMatches, "Couldn't find profile in AWS credentials file") -} - -func (s *S) TestSharedAuthNoKeysInProfile(c *C) { - os.Clearenv() - os.Setenv("AWS_PROFILE", "bar") - - d, err := ioutil.TempDir("", "") - if err != nil { - panic(err) - } - defer os.RemoveAll(d) - - err = os.Mkdir(d+"/.aws", 0755) - if err != nil { - panic(err) - } - - ioutil.WriteFile(d+"/.aws/credentials", []byte("[bar]\nawsaccesskeyid = AK.."), 0644) - os.Setenv("HOME", d) - - _, err = aws.SharedAuth() - c.Assert(err, ErrorMatches, "AWS_SECRET_ACCESS_KEY not found in credentials file") -} - -func (s *S) TestSharedAuthDefaultCredentials(c *C) { - os.Clearenv() - - d, err := ioutil.TempDir("", "") - if err != nil { - panic(err) - } - defer os.RemoveAll(d) - - err = os.Mkdir(d+"/.aws", 0755) - if err != nil { - panic(err) - } - - ioutil.WriteFile(d+"/.aws/credentials", []byte("[default]\naws_access_key_id = access\naws_secret_access_key = secret\n"), 0644) - os.Setenv("HOME", d) - - auth, err := aws.SharedAuth() - c.Assert(err, IsNil) - c.Assert(auth, Equals, aws.Auth{SecretKey: "secret", AccessKey: "access"}) -} - -func (s *S) TestSharedAuth(c *C) { - os.Clearenv() - os.Setenv("AWS_PROFILE", "bar") - - d, err := ioutil.TempDir("", "") - if err != nil { - panic(err) - } - defer os.RemoveAll(d) - - err = os.Mkdir(d+"/.aws", 0755) - if err != nil { - panic(err) - } - - ioutil.WriteFile(d+"/.aws/credentials", []byte("[bar]\naws_access_key_id = access\naws_secret_access_key = secret\n"), 0644) - os.Setenv("HOME", d) - - auth, err := aws.SharedAuth() - c.Assert(err, IsNil) - c.Assert(auth, Equals, aws.Auth{SecretKey: "secret", AccessKey: "access"}) -} - -func (s *S) TestEnvAuthNoSecret(c *C) { - os.Clearenv() - _, err := aws.EnvAuth() - c.Assert(err, ErrorMatches, "AWS_SECRET_ACCESS_KEY or AWS_SECRET_KEY not found in environment") -} - -func (s *S) TestEnvAuthNoAccess(c *C) { - os.Clearenv() - os.Setenv("AWS_SECRET_ACCESS_KEY", "foo") - _, err := aws.EnvAuth() - c.Assert(err, ErrorMatches, "AWS_ACCESS_KEY_ID or AWS_ACCESS_KEY not found in environment") -} - -func (s *S) TestEnvAuth(c *C) { - os.Clearenv() - os.Setenv("AWS_SECRET_ACCESS_KEY", "secret") - os.Setenv("AWS_ACCESS_KEY_ID", "access") - auth, err := aws.EnvAuth() - c.Assert(err, IsNil) - c.Assert(auth, Equals, aws.Auth{SecretKey: "secret", AccessKey: "access"}) -} - -func (s *S) TestEnvAuthWithToken(c *C) { - os.Clearenv() - os.Setenv("AWS_SECRET_ACCESS_KEY", "secret") - os.Setenv("AWS_ACCESS_KEY_ID", "access") - os.Setenv("AWS_SECURITY_TOKEN", "token") - auth, err := aws.EnvAuth() - c.Assert(err, IsNil) - c.Assert(auth, Equals, aws.Auth{SecretKey: "secret", AccessKey: "access", Token: "token"}) -} - -func (s *S) TestEnvAuthAlt(c *C) { - os.Clearenv() - os.Setenv("AWS_SECRET_KEY", "secret") - os.Setenv("AWS_ACCESS_KEY", "access") - auth, err := aws.EnvAuth() - c.Assert(err, IsNil) - c.Assert(auth, Equals, aws.Auth{SecretKey: "secret", AccessKey: "access"}) -} - -func (s *S) TestGetAuthStatic(c *C) { - auth, err := aws.GetAuth("access", "secret") - c.Assert(err, IsNil) - c.Assert(auth, Equals, aws.Auth{SecretKey: "secret", AccessKey: "access"}) -} - -func (s *S) TestGetAuthEnv(c *C) { - os.Clearenv() - os.Setenv("AWS_SECRET_ACCESS_KEY", "secret") - os.Setenv("AWS_ACCESS_KEY_ID", "access") - auth, err := aws.GetAuth("", "") - c.Assert(err, IsNil) - c.Assert(auth, Equals, aws.Auth{SecretKey: "secret", AccessKey: "access"}) -} - -func (s *S) TestEncode(c *C) { - c.Assert(aws.Encode("foo"), Equals, "foo") - c.Assert(aws.Encode("/"), Equals, "%2F") -} - -func (s *S) TestRegionsAreNamed(c *C) { - for n, r := range aws.Regions { - c.Assert(n, Equals, r.Name) - } -} diff --git a/Godeps/_workspace/src/github.com/mitchellh/goamz/aws/client.go b/Godeps/_workspace/src/github.com/mitchellh/goamz/aws/client.go deleted file mode 100644 index ee53238f7b3..00000000000 --- a/Godeps/_workspace/src/github.com/mitchellh/goamz/aws/client.go +++ /dev/null @@ -1,125 +0,0 @@ -package aws - -import ( - "math" - "net" - "net/http" - "time" -) - -type RetryableFunc func(*http.Request, *http.Response, error) bool -type WaitFunc func(try int) -type DeadlineFunc func() time.Time - -type ResilientTransport struct { - // Timeout is the maximum amount of time a dial will wait for - // a connect to complete. - // - // The default is no timeout. - // - // With or without a timeout, the operating system may impose - // its own earlier timeout. For instance, TCP timeouts are - // often around 3 minutes. - DialTimeout time.Duration - - // MaxTries, if non-zero, specifies the number of times we will retry on - // failure. Retries are only attempted for temporary network errors or known - // safe failures. - MaxTries int - Deadline DeadlineFunc - ShouldRetry RetryableFunc - Wait WaitFunc - transport *http.Transport -} - -// Convenience method for creating an http client -func NewClient(rt *ResilientTransport) *http.Client { - rt.transport = &http.Transport{ - Dial: func(netw, addr string) (net.Conn, error) { - c, err := net.DialTimeout(netw, addr, rt.DialTimeout) - if err != nil { - return nil, err - } - c.SetDeadline(rt.Deadline()) - return c, nil - }, - DisableKeepAlives: true, - Proxy: http.ProxyFromEnvironment, - } - // TODO: Would be nice is ResilientTransport allowed clients to initialize - // with http.Transport attributes. - return &http.Client{ - Transport: rt, - } -} - -var retryingTransport = &ResilientTransport{ - Deadline: func() time.Time { - return time.Now().Add(5 * time.Second) - }, - DialTimeout: 10 * time.Second, - MaxTries: 3, - ShouldRetry: awsRetry, - Wait: ExpBackoff, -} - -// Exported default client -var RetryingClient = NewClient(retryingTransport) - -func (t *ResilientTransport) RoundTrip(req *http.Request) (*http.Response, error) { - return t.tries(req) -} - -// Retry a request a maximum of t.MaxTries times. -// We'll only retry if the proper criteria are met. -// If a wait function is specified, wait that amount of time -// In between requests. -func (t *ResilientTransport) tries(req *http.Request) (res *http.Response, err error) { - for try := 0; try < t.MaxTries; try += 1 { - res, err = t.transport.RoundTrip(req) - - if !t.ShouldRetry(req, res, err) { - break - } - if res != nil { - res.Body.Close() - } - if t.Wait != nil { - t.Wait(try) - } - } - - return -} - -func ExpBackoff(try int) { - time.Sleep(100 * time.Millisecond * - time.Duration(math.Exp2(float64(try)))) -} - -func LinearBackoff(try int) { - time.Sleep(time.Duration(try*100) * time.Millisecond) -} - -// Decide if we should retry a request. -// In general, the criteria for retrying a request is described here -// http://docs.aws.amazon.com/general/latest/gr/api-retries.html -func awsRetry(req *http.Request, res *http.Response, err error) bool { - retry := false - - // Retry if there's a temporary network error. - if neterr, ok := err.(net.Error); ok { - if neterr.Temporary() { - retry = true - } - } - - // Retry if we get a 5xx series error. - if res != nil { - if res.StatusCode >= 500 && res.StatusCode < 600 { - retry = true - } - } - - return retry -} diff --git a/Godeps/_workspace/src/github.com/mitchellh/goamz/aws/client_test.go b/Godeps/_workspace/src/github.com/mitchellh/goamz/aws/client_test.go deleted file mode 100644 index 2f6b39cf3af..00000000000 --- a/Godeps/_workspace/src/github.com/mitchellh/goamz/aws/client_test.go +++ /dev/null @@ -1,121 +0,0 @@ -package aws_test - -import ( - "fmt" - "github.com/mitchellh/goamz/aws" - "io/ioutil" - "net/http" - "net/http/httptest" - "strings" - "testing" - "time" -) - -// Retrieve the response from handler using aws.RetryingClient -func serveAndGet(handler http.HandlerFunc) (body string, err error) { - ts := httptest.NewServer(handler) - defer ts.Close() - resp, err := aws.RetryingClient.Get(ts.URL) - if err != nil { - return - } - if resp.StatusCode != 200 { - return "", fmt.Errorf("Bad status code: %d", resp.StatusCode) - } - greeting, err := ioutil.ReadAll(resp.Body) - resp.Body.Close() - if err != nil { - return - } - return strings.TrimSpace(string(greeting)), nil -} - -func TestClient_expected(t *testing.T) { - body := "foo bar" - - resp, err := serveAndGet(func(w http.ResponseWriter, r *http.Request) { - fmt.Fprintln(w, body) - }) - if err != nil { - t.Fatal(err) - } - if resp != body { - t.Fatal("Body not as expected.") - } -} - -func TestClient_delay(t *testing.T) { - body := "baz" - wait := 4 - resp, err := serveAndGet(func(w http.ResponseWriter, r *http.Request) { - if wait < 0 { - // If we dipped to zero delay and still failed. - t.Fatal("Never succeeded.") - } - wait -= 1 - time.Sleep(time.Second * time.Duration(wait)) - fmt.Fprintln(w, body) - }) - if err != nil { - t.Fatal(err) - } - if resp != body { - t.Fatal("Body not as expected.", resp) - } -} - -func TestClient_no4xxRetry(t *testing.T) { - tries := 0 - - // Fail once before succeeding. - _, err := serveAndGet(func(w http.ResponseWriter, r *http.Request) { - tries += 1 - http.Error(w, "error", 404) - }) - - if err == nil { - t.Fatal("should have error") - } - - if tries != 1 { - t.Fatalf("should only try once: %d", tries) - } -} - -func TestClient_retries(t *testing.T) { - body := "biz" - failed := false - // Fail once before succeeding. - resp, err := serveAndGet(func(w http.ResponseWriter, r *http.Request) { - if !failed { - http.Error(w, "error", 500) - failed = true - } else { - fmt.Fprintln(w, body) - } - }) - if failed != true { - t.Error("We didn't retry!") - } - if err != nil { - t.Fatal(err) - } - if resp != body { - t.Fatal("Body not as expected.") - } -} - -func TestClient_fails(t *testing.T) { - tries := 0 - // Fail 3 times and return the last error. - _, err := serveAndGet(func(w http.ResponseWriter, r *http.Request) { - tries += 1 - http.Error(w, "error", 500) - }) - if err == nil { - t.Fatal(err) - } - if tries != 3 { - t.Fatal("Didn't retry enough") - } -} diff --git a/Godeps/_workspace/src/github.com/mitchellh/goamz/ec2/ec2.go b/Godeps/_workspace/src/github.com/mitchellh/goamz/ec2/ec2.go deleted file mode 100644 index c0c9b6712bf..00000000000 --- a/Godeps/_workspace/src/github.com/mitchellh/goamz/ec2/ec2.go +++ /dev/null @@ -1,3087 +0,0 @@ -// -// goamz - Go packages to interact with the Amazon Web Services. -// -// https://wiki.ubuntu.com/goamz -// -// Copyright (c) 2011 Canonical Ltd. -// -// Written by Gustavo Niemeyer -// - -package ec2 - -import ( - "crypto/rand" - "encoding/base64" - "encoding/hex" - "encoding/xml" - "fmt" - "log" - "net/http" - "net/http/httputil" - "net/url" - "sort" - "strconv" - "strings" - "time" - - "github.com/mitchellh/goamz/aws" -) - -const debug = false - -// The EC2 type encapsulates operations with a specific EC2 region. -type EC2 struct { - aws.Auth - aws.Region - httpClient *http.Client - private byte // Reserve the right of using private data. -} - -// New creates a new EC2. -func NewWithClient(auth aws.Auth, region aws.Region, client *http.Client) *EC2 { - return &EC2{auth, region, client, 0} -} - -func New(auth aws.Auth, region aws.Region) *EC2 { - return NewWithClient(auth, region, aws.RetryingClient) -} - -// ---------------------------------------------------------------------------- -// Filtering helper. - -// Filter builds filtering parameters to be used in an EC2 query which supports -// filtering. For example: -// -// filter := NewFilter() -// filter.Add("architecture", "i386") -// filter.Add("launch-index", "0") -// resp, err := ec2.Instances(nil, filter) -// -type Filter struct { - m map[string][]string -} - -// NewFilter creates a new Filter. -func NewFilter() *Filter { - return &Filter{make(map[string][]string)} -} - -// Add appends a filtering parameter with the given name and value(s). -func (f *Filter) Add(name string, value ...string) { - f.m[name] = append(f.m[name], value...) -} - -func (f *Filter) addParams(params map[string]string) { - if f != nil { - a := make([]string, len(f.m)) - i := 0 - for k := range f.m { - a[i] = k - i++ - } - sort.StringSlice(a).Sort() - for i, k := range a { - prefix := "Filter." + strconv.Itoa(i+1) - params[prefix+".Name"] = k - for j, v := range f.m[k] { - params[prefix+".Value."+strconv.Itoa(j+1)] = v - } - } - } -} - -// ---------------------------------------------------------------------------- -// Request dispatching logic. - -// Error encapsulates an error returned by EC2. -// -// See http://goo.gl/VZGuC for more details. -type Error struct { - // HTTP status code (200, 403, ...) - StatusCode int - // EC2 error code ("UnsupportedOperation", ...) - Code string - // The human-oriented error message - Message string - RequestId string `xml:"RequestID"` -} - -func (err *Error) Error() string { - if err.Code == "" { - return err.Message - } - - return fmt.Sprintf("%s (%s)", err.Message, err.Code) -} - -// For now a single error inst is being exposed. In the future it may be useful -// to provide access to all of them, but rather than doing it as an array/slice, -// use a *next pointer, so that it's backward compatible and it continues to be -// easy to handle the first error, which is what most people will want. -type xmlErrors struct { - RequestId string `xml:"RequestID"` - Errors []Error `xml:"Errors>Error"` -} - -var timeNow = time.Now - -func (ec2 *EC2) query(params map[string]string, resp interface{}) error { - params["Version"] = "2014-06-15" - params["Timestamp"] = timeNow().In(time.UTC).Format(time.RFC3339) - endpoint, err := url.Parse(ec2.Region.EC2Endpoint) - if err != nil { - return err - } - if endpoint.Path == "" { - endpoint.Path = "/" - } - sign(ec2.Auth, "GET", endpoint.Path, params, endpoint.Host) - endpoint.RawQuery = multimap(params).Encode() - if debug { - log.Printf("get { %v } -> {\n", endpoint.String()) - } - - r, err := ec2.httpClient.Get(endpoint.String()) - if err != nil { - return err - } - defer r.Body.Close() - - if debug { - dump, _ := httputil.DumpResponse(r, true) - log.Printf("response:\n") - log.Printf("%v\n}\n", string(dump)) - } - if r.StatusCode != 200 { - return buildError(r) - } - err = xml.NewDecoder(r.Body).Decode(resp) - return err -} - -func multimap(p map[string]string) url.Values { - q := make(url.Values, len(p)) - for k, v := range p { - q[k] = []string{v} - } - return q -} - -func buildError(r *http.Response) error { - errors := xmlErrors{} - xml.NewDecoder(r.Body).Decode(&errors) - var err Error - if len(errors.Errors) > 0 { - err = errors.Errors[0] - } - err.RequestId = errors.RequestId - err.StatusCode = r.StatusCode - if err.Message == "" { - err.Message = err.Code - } - return &err -} - -func makeParams(action string) map[string]string { - params := make(map[string]string) - params["Action"] = action - return params -} - -func addParamsList(params map[string]string, label string, ids []string) { - for i, id := range ids { - params[label+"."+strconv.Itoa(i+1)] = id - } -} - -func addBlockDeviceParams(prename string, params map[string]string, blockdevices []BlockDeviceMapping) { - for i, k := range blockdevices { - // Fixup index since Amazon counts these from 1 - prefix := prename + "BlockDeviceMapping." + strconv.Itoa(i+1) + "." - - if k.DeviceName != "" { - params[prefix+"DeviceName"] = k.DeviceName - } - - if k.VirtualName != "" { - params[prefix+"VirtualName"] = k.VirtualName - } else if k.NoDevice { - params[prefix+"NoDevice"] = "" - } else { - if k.SnapshotId != "" { - params[prefix+"Ebs.SnapshotId"] = k.SnapshotId - } - if k.VolumeType != "" { - params[prefix+"Ebs.VolumeType"] = k.VolumeType - } - if k.IOPS != 0 { - params[prefix+"Ebs.Iops"] = strconv.FormatInt(k.IOPS, 10) - } - if k.VolumeSize != 0 { - params[prefix+"Ebs.VolumeSize"] = strconv.FormatInt(k.VolumeSize, 10) - } - if k.DeleteOnTermination { - params[prefix+"Ebs.DeleteOnTermination"] = "true" - } else { - params[prefix+"Ebs.DeleteOnTermination"] = "false" - } - if k.Encrypted { - params[prefix+"Ebs.Encrypted"] = "true" - } - } - } -} - -// ---------------------------------------------------------------------------- -// Instance management functions and types. - -// The RunInstances type encapsulates options for the respective request in EC2. -// -// See http://goo.gl/Mcm3b for more details. -type RunInstances struct { - ImageId string - MinCount int - MaxCount int - KeyName string - InstanceType string - SecurityGroups []SecurityGroup - IamInstanceProfile string - KernelId string - RamdiskId string - UserData []byte - AvailZone string - PlacementGroupName string - Monitoring bool - SubnetId string - AssociatePublicIpAddress bool - DisableAPITermination bool - EbsOptimized bool - ShutdownBehavior string - PrivateIPAddress string - BlockDevices []BlockDeviceMapping - Tenancy string -} - -// Response to a RunInstances request. -// -// See http://goo.gl/Mcm3b for more details. -type RunInstancesResp struct { - RequestId string `xml:"requestId"` - ReservationId string `xml:"reservationId"` - OwnerId string `xml:"ownerId"` - SecurityGroups []SecurityGroup `xml:"groupSet>item"` - Instances []Instance `xml:"instancesSet>item"` -} - -// BlockDevice represents the association of a block device with an instance. -type BlockDevice struct { - DeviceName string `xml:"deviceName"` - VolumeId string `xml:"ebs>volumeId"` - Status string `xml:"ebs>status"` - AttachTime string `xml:"ebs>attachTime"` - DeleteOnTermination bool `xml:"ebs>deleteOnTermination"` -} - -// Instance encapsulates a running instance in EC2. -// -// See http://goo.gl/OCH8a for more details. -type Instance struct { - InstanceId string `xml:"instanceId"` - InstanceType string `xml:"instanceType"` - ImageId string `xml:"imageId"` - PrivateDNSName string `xml:"privateDnsName"` - DNSName string `xml:"dnsName"` - KeyName string `xml:"keyName"` - AMILaunchIndex int `xml:"amiLaunchIndex"` - Hypervisor string `xml:"hypervisor"` - VirtType string `xml:"virtualizationType"` - Monitoring string `xml:"monitoring>state"` - AvailZone string `xml:"placement>availabilityZone"` - Tenancy string `xml:"placement>tenancy"` - PlacementGroupName string `xml:"placement>groupName"` - State InstanceState `xml:"instanceState"` - Tags []Tag `xml:"tagSet>item"` - VpcId string `xml:"vpcId"` - SubnetId string `xml:"subnetId"` - IamInstanceProfile string `xml:"iamInstanceProfile"` - PrivateIpAddress string `xml:"privateIpAddress"` - PublicIpAddress string `xml:"ipAddress"` - Architecture string `xml:"architecture"` - LaunchTime time.Time `xml:"launchTime"` - SourceDestCheck bool `xml:"sourceDestCheck"` - SecurityGroups []SecurityGroup `xml:"groupSet>item"` - EbsOptimized string `xml:"ebsOptimized"` - BlockDevices []BlockDevice `xml:"blockDeviceMapping>item"` -} - -// RunInstances starts new instances in EC2. -// If options.MinCount and options.MaxCount are both zero, a single instance -// will be started; otherwise if options.MaxCount is zero, options.MinCount -// will be used insteead. -// -// See http://goo.gl/Mcm3b for more details. -func (ec2 *EC2) RunInstances(options *RunInstances) (resp *RunInstancesResp, err error) { - params := makeParams("RunInstances") - params["ImageId"] = options.ImageId - params["InstanceType"] = options.InstanceType - var min, max int - if options.MinCount == 0 && options.MaxCount == 0 { - min = 1 - max = 1 - } else if options.MaxCount == 0 { - min = options.MinCount - max = min - } else { - min = options.MinCount - max = options.MaxCount - } - params["MinCount"] = strconv.Itoa(min) - params["MaxCount"] = strconv.Itoa(max) - token, err := clientToken() - if err != nil { - return nil, err - } - params["ClientToken"] = token - - if options.KeyName != "" { - params["KeyName"] = options.KeyName - } - if options.KernelId != "" { - params["KernelId"] = options.KernelId - } - if options.RamdiskId != "" { - params["RamdiskId"] = options.RamdiskId - } - if options.UserData != nil { - userData := make([]byte, b64.EncodedLen(len(options.UserData))) - b64.Encode(userData, options.UserData) - params["UserData"] = string(userData) - } - if options.AvailZone != "" { - params["Placement.AvailabilityZone"] = options.AvailZone - } - if options.PlacementGroupName != "" { - params["Placement.GroupName"] = options.PlacementGroupName - } - if options.Monitoring { - params["Monitoring.Enabled"] = "true" - } - if options.Tenancy != "" { - params["Placement.Tenancy"] = options.Tenancy - } - if options.SubnetId != "" && options.AssociatePublicIpAddress { - // If we have a non-default VPC / Subnet specified, we can flag - // AssociatePublicIpAddress to get a Public IP assigned. By default these are not provided. - // You cannot specify both SubnetId and the NetworkInterface.0.* parameters though, otherwise - // you get: Network interfaces and an instance-level subnet ID may not be specified on the same request - // You also need to attach Security Groups to the NetworkInterface instead of the instance, - // to avoid: Network interfaces and an instance-level security groups may not be specified on - // the same request - params["NetworkInterface.0.DeviceIndex"] = "0" - params["NetworkInterface.0.AssociatePublicIpAddress"] = "true" - params["NetworkInterface.0.SubnetId"] = options.SubnetId - - if options.PrivateIPAddress != "" { - params["NetworkInterface.0.PrivateIpAddress"] = options.PrivateIPAddress - } - - i := 1 - for _, g := range options.SecurityGroups { - // We only have SecurityGroupId's on NetworkInterface's, no SecurityGroup params. - if g.Id != "" { - params["NetworkInterface.0.SecurityGroupId."+strconv.Itoa(i)] = g.Id - i++ - } - } - } else { - if options.SubnetId != "" { - params["SubnetId"] = options.SubnetId - } - - if options.PrivateIPAddress != "" { - params["PrivateIpAddress"] = options.PrivateIPAddress - } - - i, j := 1, 1 - for _, g := range options.SecurityGroups { - if g.Id != "" { - params["SecurityGroupId."+strconv.Itoa(i)] = g.Id - i++ - } else { - params["SecurityGroup."+strconv.Itoa(j)] = g.Name - j++ - } - } - } - if options.IamInstanceProfile != "" { - params["IamInstanceProfile.Name"] = options.IamInstanceProfile - } - if options.DisableAPITermination { - params["DisableApiTermination"] = "true" - } - if options.EbsOptimized { - params["EbsOptimized"] = "true" - } - if options.ShutdownBehavior != "" { - params["InstanceInitiatedShutdownBehavior"] = options.ShutdownBehavior - } - addBlockDeviceParams("", params, options.BlockDevices) - - resp = &RunInstancesResp{} - err = ec2.query(params, resp) - if err != nil { - return nil, err - } - return -} - -func clientToken() (string, error) { - // Maximum EC2 client token size is 64 bytes. - // Each byte expands to two when hex encoded. - buf := make([]byte, 32) - _, err := rand.Read(buf) - if err != nil { - return "", err - } - return hex.EncodeToString(buf), nil -} - -// The GetConsoleOutput type encapsulates options for the respective request in EC2. -// -// See http://goo.gl/EY70zb for more details. -type GetConsoleOutput struct { - InstanceId string -} - -// Response to a GetConsoleOutput request. Note that Output is base64-encoded, -// as in the underlying AWS API. -// -// See http://goo.gl/EY70zb for more details. -type GetConsoleOutputResp struct { - RequestId string `xml:"requestId"` - InstanceId string `xml:"instanceId"` - Timestamp time.Time `xml:"timestamp"` - Output string `xml:"output"` -} - -// GetConsoleOutput returns the console output for the sepcified instance. Note -// that console output is base64-encoded, as in the underlying AWS API. -// -// See http://goo.gl/EY70zb for more details. -func (ec2 *EC2) GetConsoleOutput(options *GetConsoleOutput) (resp *GetConsoleOutputResp, err error) { - params := makeParams("GetConsoleOutput") - params["InstanceId"] = options.InstanceId - resp = &GetConsoleOutputResp{} - err = ec2.query(params, resp) - if err != nil { - return nil, err - } - return -} - -// ---------------------------------------------------------------------------- -// Instance events and status functions and types. - -// The DescribeInstanceStatus type encapsulates options for the respective request in EC2. -// -// See http://goo.gl/DFySJY for more details. -type EventsSet struct { - Code string `xml:"code"` - Description string `xml:"description"` - NotBefore string `xml:"notBefore"` - NotAfter string `xml:"notAfter"` -} - -type StatusDetails struct { - Name string `xml:"name"` - Status string `xml:"status"` - ImpairedSince string `xml:"impairedSince"` -} - -type Status struct { - Status string `xml:"status"` - Details []StatusDetails `xml:"details>item"` -} - -type InstanceStatusSet struct { - InstanceId string `xml:"instanceId"` - AvailabilityZone string `xml:"availabilityZone"` - InstanceState InstanceState `xml:"instanceState"` - SystemStatus Status `xml:"systemStatus"` - InstanceStatus Status `xml:"instanceStatus"` - Events []EventsSet `xml:"eventsSet>item"` -} - -type DescribeInstanceStatusResp struct { - RequestId string `xml:"requestId"` - InstanceStatus []InstanceStatusSet `xml:"instanceStatusSet>item"` -} - -type DescribeInstanceStatus struct { - InstanceIds []string - IncludeAllInstances bool - MaxResults int64 - NextToken string -} - -func (ec2 *EC2) DescribeInstanceStatus(options *DescribeInstanceStatus, filter *Filter) (resp *DescribeInstanceStatusResp, err error) { - params := makeParams("DescribeInstanceStatus") - if options.IncludeAllInstances { - params["IncludeAllInstances"] = "true" - } - if len(options.InstanceIds) > 0 { - addParamsList(params, "InstanceId", options.InstanceIds) - } - if options.MaxResults > 0 { - params["MaxResults"] = strconv.FormatInt(options.MaxResults, 10) - } - if options.NextToken != "" { - params["NextToken"] = options.NextToken - } - if filter != nil { - filter.addParams(params) - } - - resp = &DescribeInstanceStatusResp{} - err = ec2.query(params, resp) - if err != nil { - return nil, err - } - - return -} - -// ---------------------------------------------------------------------------- -// Spot Instance management functions and types. - -// The RequestSpotInstances type encapsulates options for the respective request in EC2. -// -// See http://goo.gl/GRZgCD for more details. -type RequestSpotInstances struct { - SpotPrice string - InstanceCount int - Type string - ImageId string - KeyName string - InstanceType string - SecurityGroups []SecurityGroup - IamInstanceProfile string - KernelId string - RamdiskId string - UserData []byte - AvailZone string - PlacementGroupName string - Monitoring bool - SubnetId string - AssociatePublicIpAddress bool - PrivateIPAddress string - BlockDevices []BlockDeviceMapping -} - -type SpotInstanceSpec struct { - ImageId string - KeyName string - InstanceType string - SecurityGroups []SecurityGroup - IamInstanceProfile string - KernelId string - RamdiskId string - UserData []byte - AvailZone string - PlacementGroupName string - Monitoring bool - SubnetId string - AssociatePublicIpAddress bool - PrivateIPAddress string - BlockDevices []BlockDeviceMapping -} - -type SpotLaunchSpec struct { - ImageId string `xml:"imageId"` - KeyName string `xml:"keyName"` - InstanceType string `xml:"instanceType"` - SecurityGroups []SecurityGroup `xml:"groupSet>item"` - IamInstanceProfile string `xml:"iamInstanceProfile"` - KernelId string `xml:"kernelId"` - RamdiskId string `xml:"ramdiskId"` - PlacementGroupName string `xml:"placement>groupName"` - Monitoring bool `xml:"monitoring>enabled"` - SubnetId string `xml:"subnetId"` - BlockDevices []BlockDeviceMapping `xml:"blockDeviceMapping>item"` -} - -type SpotStatus struct { - Code string `xml:"code"` - UpdateTime string `xml:"updateTime"` - Message string `xml:"message"` -} - -type SpotRequestResult struct { - SpotRequestId string `xml:"spotInstanceRequestId"` - SpotPrice string `xml:"spotPrice"` - Type string `xml:"type"` - AvailZone string `xml:"launchedAvailabilityZone"` - InstanceId string `xml:"instanceId"` - State string `xml:"state"` - Status SpotStatus `xml:"status"` - SpotLaunchSpec SpotLaunchSpec `xml:"launchSpecification"` - CreateTime string `xml:"createTime"` - Tags []Tag `xml:"tagSet>item"` -} - -// Response to a RequestSpotInstances request. -// -// See http://goo.gl/GRZgCD for more details. -type RequestSpotInstancesResp struct { - RequestId string `xml:"requestId"` - SpotRequestResults []SpotRequestResult `xml:"spotInstanceRequestSet>item"` -} - -// RequestSpotInstances requests a new spot instances in EC2. -func (ec2 *EC2) RequestSpotInstances(options *RequestSpotInstances) (resp *RequestSpotInstancesResp, err error) { - params := makeParams("RequestSpotInstances") - prefix := "LaunchSpecification" + "." - - params["SpotPrice"] = options.SpotPrice - params[prefix+"ImageId"] = options.ImageId - params[prefix+"InstanceType"] = options.InstanceType - - if options.InstanceCount != 0 { - params["InstanceCount"] = strconv.Itoa(options.InstanceCount) - } - if options.KeyName != "" { - params[prefix+"KeyName"] = options.KeyName - } - if options.KernelId != "" { - params[prefix+"KernelId"] = options.KernelId - } - if options.RamdiskId != "" { - params[prefix+"RamdiskId"] = options.RamdiskId - } - if options.UserData != nil { - userData := make([]byte, b64.EncodedLen(len(options.UserData))) - b64.Encode(userData, options.UserData) - params[prefix+"UserData"] = string(userData) - } - if options.AvailZone != "" { - params[prefix+"Placement.AvailabilityZone"] = options.AvailZone - } - if options.PlacementGroupName != "" { - params[prefix+"Placement.GroupName"] = options.PlacementGroupName - } - if options.Monitoring { - params[prefix+"Monitoring.Enabled"] = "true" - } - if options.SubnetId != "" && options.AssociatePublicIpAddress { - // If we have a non-default VPC / Subnet specified, we can flag - // AssociatePublicIpAddress to get a Public IP assigned. By default these are not provided. - // You cannot specify both SubnetId and the NetworkInterface.0.* parameters though, otherwise - // you get: Network interfaces and an instance-level subnet ID may not be specified on the same request - // You also need to attach Security Groups to the NetworkInterface instead of the instance, - // to avoid: Network interfaces and an instance-level security groups may not be specified on - // the same request - params[prefix+"NetworkInterface.0.DeviceIndex"] = "0" - params[prefix+"NetworkInterface.0.AssociatePublicIpAddress"] = "true" - params[prefix+"NetworkInterface.0.SubnetId"] = options.SubnetId - - i := 1 - for _, g := range options.SecurityGroups { - // We only have SecurityGroupId's on NetworkInterface's, no SecurityGroup params. - if g.Id != "" { - params[prefix+"NetworkInterface.0.SecurityGroupId."+strconv.Itoa(i)] = g.Id - i++ - } - } - } else { - if options.SubnetId != "" { - params[prefix+"SubnetId"] = options.SubnetId - } - - i, j := 1, 1 - for _, g := range options.SecurityGroups { - if g.Id != "" { - params[prefix+"SecurityGroupId."+strconv.Itoa(i)] = g.Id - i++ - } else { - params[prefix+"SecurityGroup."+strconv.Itoa(j)] = g.Name - j++ - } - } - } - if options.IamInstanceProfile != "" { - params[prefix+"IamInstanceProfile.Name"] = options.IamInstanceProfile - } - if options.PrivateIPAddress != "" { - params[prefix+"PrivateIpAddress"] = options.PrivateIPAddress - } - addBlockDeviceParams(prefix, params, options.BlockDevices) - - resp = &RequestSpotInstancesResp{} - err = ec2.query(params, resp) - if err != nil { - return nil, err - } - return -} - -// Response to a DescribeSpotInstanceRequests request. -// -// See http://goo.gl/KsKJJk for more details. -type SpotRequestsResp struct { - RequestId string `xml:"requestId"` - SpotRequestResults []SpotRequestResult `xml:"spotInstanceRequestSet>item"` -} - -// DescribeSpotInstanceRequests returns details about spot requests in EC2. Both parameters -// are optional, and if provided will limit the spot requests returned to those -// matching the given spot request ids or filtering rules. -// -// See http://goo.gl/KsKJJk for more details. -func (ec2 *EC2) DescribeSpotRequests(spotrequestIds []string, filter *Filter) (resp *SpotRequestsResp, err error) { - params := makeParams("DescribeSpotInstanceRequests") - addParamsList(params, "SpotInstanceRequestId", spotrequestIds) - filter.addParams(params) - resp = &SpotRequestsResp{} - err = ec2.query(params, resp) - if err != nil { - return nil, err - } - return -} - -// Response to a CancelSpotInstanceRequests request. -// -// See http://goo.gl/3BKHj for more details. -type CancelSpotRequestResult struct { - SpotRequestId string `xml:"spotInstanceRequestId"` - State string `xml:"state"` -} -type CancelSpotRequestsResp struct { - RequestId string `xml:"requestId"` - CancelSpotRequestResults []CancelSpotRequestResult `xml:"spotInstanceRequestSet>item"` -} - -// CancelSpotRequests requests the cancellation of spot requests when the given ids. -// -// See http://goo.gl/3BKHj for more details. -func (ec2 *EC2) CancelSpotRequests(spotrequestIds []string) (resp *CancelSpotRequestsResp, err error) { - params := makeParams("CancelSpotInstanceRequests") - addParamsList(params, "SpotInstanceRequestId", spotrequestIds) - resp = &CancelSpotRequestsResp{} - err = ec2.query(params, resp) - if err != nil { - return nil, err - } - return -} - -type DescribeSpotPriceHistory struct { - InstanceType []string - ProductDescription []string - AvailabilityZone string - StartTime, EndTime time.Time -} - -// Response to a DescribeSpotPriceHisotyr request. -// -// See http://goo.gl/3BKHj for more details. -type DescribeSpotPriceHistoryResp struct { - RequestId string `xml:"requestId"` - History []SpotPriceHistory `xml:"spotPriceHistorySet>item"` -} - -type SpotPriceHistory struct { - InstanceType string `xml:"instanceType"` - ProductDescription string `xml:"productDescription"` - SpotPrice string `xml:"spotPrice"` - Timestamp time.Time `xml:"timestamp"` - AvailabilityZone string `xml:"availabilityZone"` -} - -// DescribeSpotPriceHistory gets the spot pricing history. -// -// See http://goo.gl/3BKHj for more details. -func (ec2 *EC2) DescribeSpotPriceHistory(o *DescribeSpotPriceHistory) (resp *DescribeSpotPriceHistoryResp, err error) { - params := makeParams("DescribeSpotPriceHistory") - if o.AvailabilityZone != "" { - params["AvailabilityZone"] = o.AvailabilityZone - } - - if !o.StartTime.IsZero() { - params["StartTime"] = o.StartTime.In(time.UTC).Format(time.RFC3339) - } - if !o.EndTime.IsZero() { - params["EndTime"] = o.EndTime.In(time.UTC).Format(time.RFC3339) - } - - if len(o.InstanceType) > 0 { - addParamsList(params, "InstanceType", o.InstanceType) - } - if len(o.ProductDescription) > 0 { - addParamsList(params, "ProductDescription", o.ProductDescription) - } - - resp = &DescribeSpotPriceHistoryResp{} - err = ec2.query(params, resp) - if err != nil { - return nil, err - } - - return -} - -// Response to a TerminateInstances request. -// -// See http://goo.gl/3BKHj for more details. -type TerminateInstancesResp struct { - RequestId string `xml:"requestId"` - StateChanges []InstanceStateChange `xml:"instancesSet>item"` -} - -// InstanceState encapsulates the state of an instance in EC2. -// -// See http://goo.gl/y3ZBq for more details. -type InstanceState struct { - Code int `xml:"code"` // Watch out, bits 15-8 have unpublished meaning. - Name string `xml:"name"` -} - -// InstanceStateChange informs of the previous and current states -// for an instance when a state change is requested. -type InstanceStateChange struct { - InstanceId string `xml:"instanceId"` - CurrentState InstanceState `xml:"currentState"` - PreviousState InstanceState `xml:"previousState"` -} - -// TerminateInstances requests the termination of instances when the given ids. -// -// See http://goo.gl/3BKHj for more details. -func (ec2 *EC2) TerminateInstances(instIds []string) (resp *TerminateInstancesResp, err error) { - params := makeParams("TerminateInstances") - addParamsList(params, "InstanceId", instIds) - resp = &TerminateInstancesResp{} - err = ec2.query(params, resp) - if err != nil { - return nil, err - } - return -} - -// Response to a DescribeInstances request. -// -// See http://goo.gl/mLbmw for more details. -type InstancesResp struct { - RequestId string `xml:"requestId"` - Reservations []Reservation `xml:"reservationSet>item"` -} - -// Reservation represents details about a reservation in EC2. -// -// See http://goo.gl/0ItPT for more details. -type Reservation struct { - ReservationId string `xml:"reservationId"` - OwnerId string `xml:"ownerId"` - RequesterId string `xml:"requesterId"` - SecurityGroups []SecurityGroup `xml:"groupSet>item"` - Instances []Instance `xml:"instancesSet>item"` -} - -// Instances returns details about instances in EC2. Both parameters -// are optional, and if provided will limit the instances returned to those -// matching the given instance ids or filtering rules. -// -// See http://goo.gl/4No7c for more details. -func (ec2 *EC2) Instances(instIds []string, filter *Filter) (resp *InstancesResp, err error) { - params := makeParams("DescribeInstances") - addParamsList(params, "InstanceId", instIds) - filter.addParams(params) - resp = &InstancesResp{} - err = ec2.query(params, resp) - if err != nil { - return nil, err - } - return -} - -// ---------------------------------------------------------------------------- -// Volume management - -// The CreateVolume request parameters -// -// See http://docs.aws.amazon.com/AWSEC2/latest/APIReference/ApiReference-query-CreateVolume.html -type CreateVolume struct { - AvailZone string - Size int64 - SnapshotId string - VolumeType string - IOPS int64 - Encrypted bool -} - -// Response to an AttachVolume request -type AttachVolumeResp struct { - RequestId string `xml:"requestId"` - VolumeId string `xml:"volumeId"` - InstanceId string `xml:"instanceId"` - Device string `xml:"device"` - Status string `xml:"status"` - AttachTime string `xml:"attachTime"` -} - -// Response to a CreateVolume request -type CreateVolumeResp struct { - RequestId string `xml:"requestId"` - VolumeId string `xml:"volumeId"` - Size int64 `xml:"size"` - SnapshotId string `xml:"snapshotId"` - AvailZone string `xml:"availabilityZone"` - Status string `xml:"status"` - CreateTime string `xml:"createTime"` - VolumeType string `xml:"volumeType"` - IOPS int64 `xml:"iops"` - Encrypted bool `xml:"encrypted"` -} - -// Volume is a single volume. -type Volume struct { - VolumeId string `xml:"volumeId"` - Size string `xml:"size"` - SnapshotId string `xml:"snapshotId"` - AvailZone string `xml:"availabilityZone"` - Status string `xml:"status"` - Attachments []VolumeAttachment `xml:"attachmentSet>item"` - VolumeType string `xml:"volumeType"` - IOPS int64 `xml:"iops"` - Encrypted bool `xml:"encrypted"` - Tags []Tag `xml:"tagSet>item"` -} - -type VolumeAttachment struct { - VolumeId string `xml:"volumeId"` - InstanceId string `xml:"instanceId"` - Device string `xml:"device"` - Status string `xml:"status"` -} - -// Response to a DescribeVolumes request -type VolumesResp struct { - RequestId string `xml:"requestId"` - Volumes []Volume `xml:"volumeSet>item"` -} - -// Attach a volume. -func (ec2 *EC2) AttachVolume(volumeId string, instanceId string, device string) (resp *AttachVolumeResp, err error) { - params := makeParams("AttachVolume") - params["VolumeId"] = volumeId - params["InstanceId"] = instanceId - params["Device"] = device - - resp = &AttachVolumeResp{} - err = ec2.query(params, resp) - if err != nil { - return nil, err - } - - return -} - -// Create a new volume. -func (ec2 *EC2) CreateVolume(options *CreateVolume) (resp *CreateVolumeResp, err error) { - params := makeParams("CreateVolume") - params["AvailabilityZone"] = options.AvailZone - if options.Size > 0 { - params["Size"] = strconv.FormatInt(options.Size, 10) - } - - if options.SnapshotId != "" { - params["SnapshotId"] = options.SnapshotId - } - - if options.VolumeType != "" { - params["VolumeType"] = options.VolumeType - } - - if options.IOPS > 0 { - params["Iops"] = strconv.FormatInt(options.IOPS, 10) - } - - if options.Encrypted { - params["Encrypted"] = "true" - } - - resp = &CreateVolumeResp{} - err = ec2.query(params, resp) - if err != nil { - return nil, err - } - - return -} - -// Delete an EBS volume. -func (ec2 *EC2) DeleteVolume(id string) (resp *SimpleResp, err error) { - params := makeParams("DeleteVolume") - params["VolumeId"] = id - - resp = &SimpleResp{} - err = ec2.query(params, resp) - if err != nil { - return nil, err - } - return -} - -// Detaches an EBS volume. -func (ec2 *EC2) DetachVolume(id string) (resp *SimpleResp, err error) { - params := makeParams("DetachVolume") - params["VolumeId"] = id - - resp = &SimpleResp{} - err = ec2.query(params, resp) - if err != nil { - return nil, err - } - return -} - -// Finds or lists all volumes. -func (ec2 *EC2) Volumes(volIds []string, filter *Filter) (resp *VolumesResp, err error) { - params := makeParams("DescribeVolumes") - addParamsList(params, "VolumeId", volIds) - filter.addParams(params) - resp = &VolumesResp{} - err = ec2.query(params, resp) - if err != nil { - return nil, err - } - return -} - -// ---------------------------------------------------------------------------- -// Availability zone management functions and types. -// See http://goo.gl/ylxT4R for more details. - -// DescribeAvailabilityZonesResp represents a response to a DescribeAvailabilityZones -// request in EC2. -type DescribeAvailabilityZonesResp struct { - RequestId string `xml:"requestId"` - Zones []AvailabilityZoneInfo `xml:"availabilityZoneInfo>item"` -} - -// AvailabilityZoneInfo encapsulates details for an availability zone in EC2. -type AvailabilityZoneInfo struct { - AvailabilityZone - State string `xml:"zoneState"` - MessageSet []string `xml:"messageSet>item"` -} - -// AvailabilityZone represents an EC2 availability zone. -type AvailabilityZone struct { - Name string `xml:"zoneName"` - Region string `xml:"regionName"` -} - -// DescribeAvailabilityZones returns details about availability zones in EC2. -// The filter parameter is optional, and if provided will limit the -// availability zones returned to those matching the given filtering -// rules. -// -// See http://goo.gl/ylxT4R for more details. -func (ec2 *EC2) DescribeAvailabilityZones(filter *Filter) (resp *DescribeAvailabilityZonesResp, err error) { - params := makeParams("DescribeAvailabilityZones") - filter.addParams(params) - resp = &DescribeAvailabilityZonesResp{} - err = ec2.query(params, resp) - if err != nil { - return nil, err - } - return -} - -// ---------------------------------------------------------------------------- -// ElasticIp management (for VPC) - -// The AllocateAddress request parameters -// -// see http://docs.aws.amazon.com/AWSEC2/latest/APIReference/ApiReference-query-AllocateAddress.html -type AllocateAddress struct { - Domain string -} - -// Response to an AllocateAddress request -type AllocateAddressResp struct { - RequestId string `xml:"requestId"` - PublicIp string `xml:"publicIp"` - Domain string `xml:"domain"` - AllocationId string `xml:"allocationId"` -} - -// The AssociateAddress request parameters -// -// http://docs.aws.amazon.com/AWSEC2/latest/APIReference/ApiReference-query-AssociateAddress.html -type AssociateAddress struct { - InstanceId string - PublicIp string - AllocationId string - AllowReassociation bool -} - -// Response to an AssociateAddress request -type AssociateAddressResp struct { - RequestId string `xml:"requestId"` - Return bool `xml:"return"` - AssociationId string `xml:"associationId"` -} - -// Address represents an Elastic IP Address -// See http://goo.gl/uxCjp7 for more details -type Address struct { - PublicIp string `xml:"publicIp"` - AllocationId string `xml:"allocationId"` - Domain string `xml:"domain"` - InstanceId string `xml:"instanceId"` - AssociationId string `xml:"associationId"` - NetworkInterfaceId string `xml:"networkInterfaceId"` - NetworkInterfaceOwnerId string `xml:"networkInterfaceOwnerId"` - PrivateIpAddress string `xml:"privateIpAddress"` -} - -type DescribeAddressesResp struct { - RequestId string `xml:"requestId"` - Addresses []Address `xml:"addressesSet>item"` -} - -// Allocate a new Elastic IP. -func (ec2 *EC2) AllocateAddress(options *AllocateAddress) (resp *AllocateAddressResp, err error) { - params := makeParams("AllocateAddress") - params["Domain"] = options.Domain - - resp = &AllocateAddressResp{} - err = ec2.query(params, resp) - if err != nil { - return nil, err - } - - return -} - -// Release an Elastic IP (VPC). -func (ec2 *EC2) ReleaseAddress(id string) (resp *SimpleResp, err error) { - params := makeParams("ReleaseAddress") - params["AllocationId"] = id - - resp = &SimpleResp{} - err = ec2.query(params, resp) - if err != nil { - return nil, err - } - - return -} - -// Release an Elastic IP (Public) -func (ec2 *EC2) ReleasePublicAddress(publicIp string) (resp *SimpleResp, err error) { - params := makeParams("ReleaseAddress") - params["PublicIp"] = publicIp - - resp = &SimpleResp{} - err = ec2.query(params, resp) - if err != nil { - return nil, err - } - - return -} - -// Associate an address with a VPC instance. -func (ec2 *EC2) AssociateAddress(options *AssociateAddress) (resp *AssociateAddressResp, err error) { - params := makeParams("AssociateAddress") - params["InstanceId"] = options.InstanceId - if options.PublicIp != "" { - params["PublicIp"] = options.PublicIp - } - if options.AllocationId != "" { - params["AllocationId"] = options.AllocationId - } - if options.AllowReassociation { - params["AllowReassociation"] = "true" - } - - resp = &AssociateAddressResp{} - err = ec2.query(params, resp) - if err != nil { - return nil, err - } - - return -} - -// Disassociate an address from a VPC instance. -func (ec2 *EC2) DisassociateAddress(id string) (resp *SimpleResp, err error) { - params := makeParams("DisassociateAddress") - params["AssociationId"] = id - - resp = &SimpleResp{} - err = ec2.query(params, resp) - if err != nil { - return nil, err - } - - return -} - -// Disassociate an address from a VPC instance. -func (ec2 *EC2) DisassociateAddressClassic(ip string) (resp *SimpleResp, err error) { - params := makeParams("DisassociateAddress") - params["PublicIp"] = ip - - resp = &SimpleResp{} - err = ec2.query(params, resp) - if err != nil { - return nil, err - } - - return -} - -// DescribeAddresses returns details about one or more -// Elastic IP Addresses. Returned addresses can be -// filtered by Public IP, Allocation ID or multiple filters -// -// See http://goo.gl/zW7J4p for more details. -func (ec2 *EC2) Addresses(publicIps []string, allocationIds []string, filter *Filter) (resp *DescribeAddressesResp, err error) { - params := makeParams("DescribeAddresses") - addParamsList(params, "PublicIp", publicIps) - addParamsList(params, "AllocationId", allocationIds) - filter.addParams(params) - resp = &DescribeAddressesResp{} - err = ec2.query(params, resp) - if err != nil { - return nil, err - } - return -} - -// ---------------------------------------------------------------------------- -// Image and snapshot management functions and types. - -// The CreateImage request parameters. -// -// See http://goo.gl/cxU41 for more details. -type CreateImage struct { - InstanceId string - Name string - Description string - NoReboot bool - BlockDevices []BlockDeviceMapping -} - -// Response to a CreateImage request. -// -// See http://goo.gl/cxU41 for more details. -type CreateImageResp struct { - RequestId string `xml:"requestId"` - ImageId string `xml:"imageId"` -} - -// Response to a DescribeImages request. -// -// See http://goo.gl/hLnyg for more details. -type ImagesResp struct { - RequestId string `xml:"requestId"` - Images []Image `xml:"imagesSet>item"` -} - -// Response to a DescribeImageAttribute request. -// -// See http://goo.gl/bHO3zT for more details. -type ImageAttributeResp struct { - RequestId string `xml:"requestId"` - ImageId string `xml:"imageId"` - Kernel string `xml:"kernel>value"` - RamDisk string `xml:"ramdisk>value"` - Description string `xml:"description>value"` - Group string `xml:"launchPermission>item>group"` - UserIds []string `xml:"launchPermission>item>userId"` - ProductCodes []string `xml:"productCodes>item>productCode"` - BlockDevices []BlockDeviceMapping `xml:"blockDeviceMapping>item"` -} - -// The RegisterImage request parameters. -type RegisterImage struct { - ImageLocation string - Name string - Description string - Architecture string - KernelId string - RamdiskId string - RootDeviceName string - VirtType string - SriovNetSupport string - BlockDevices []BlockDeviceMapping -} - -// Response to a RegisterImage request. -type RegisterImageResp struct { - RequestId string `xml:"requestId"` - ImageId string `xml:"imageId"` -} - -// Response to a DegisterImage request. -// -// See http://docs.aws.amazon.com/AWSEC2/latest/APIReference/ApiReference-query-DeregisterImage.html -type DeregisterImageResp struct { - RequestId string `xml:"requestId"` - Return bool `xml:"return"` -} - -// BlockDeviceMapping represents the association of a block device with an image. -// -// See http://goo.gl/wnDBf for more details. -type BlockDeviceMapping struct { - DeviceName string `xml:"deviceName"` - VirtualName string `xml:"virtualName"` - SnapshotId string `xml:"ebs>snapshotId"` - VolumeType string `xml:"ebs>volumeType"` - VolumeSize int64 `xml:"ebs>volumeSize"` - DeleteOnTermination bool `xml:"ebs>deleteOnTermination"` - Encrypted bool `xml:"ebs>encrypted"` - NoDevice bool `xml:"noDevice"` - - // The number of I/O operations per second (IOPS) that the volume supports. - IOPS int64 `xml:"ebs>iops"` -} - -// Image represents details about an image. -// -// See http://goo.gl/iSqJG for more details. -type Image struct { - Id string `xml:"imageId"` - Name string `xml:"name"` - Description string `xml:"description"` - Type string `xml:"imageType"` - State string `xml:"imageState"` - Location string `xml:"imageLocation"` - Public bool `xml:"isPublic"` - Architecture string `xml:"architecture"` - Platform string `xml:"platform"` - ProductCodes []string `xml:"productCode>item>productCode"` - KernelId string `xml:"kernelId"` - RamdiskId string `xml:"ramdiskId"` - StateReason string `xml:"stateReason"` - OwnerId string `xml:"imageOwnerId"` - OwnerAlias string `xml:"imageOwnerAlias"` - RootDeviceType string `xml:"rootDeviceType"` - RootDeviceName string `xml:"rootDeviceName"` - VirtualizationType string `xml:"virtualizationType"` - Hypervisor string `xml:"hypervisor"` - BlockDevices []BlockDeviceMapping `xml:"blockDeviceMapping>item"` - Tags []Tag `xml:"tagSet>item"` -} - -// The ModifyImageAttribute request parameters. -type ModifyImageAttribute struct { - AddUsers []string - RemoveUsers []string - AddGroups []string - RemoveGroups []string - ProductCodes []string - Description string -} - -// The CopyImage request parameters. -// -// See http://goo.gl/hQwPCK for more details. -type CopyImage struct { - SourceRegion string - SourceImageId string - Name string - Description string - ClientToken string -} - -// Response to a CopyImage request. -// -// See http://goo.gl/hQwPCK for more details. -type CopyImageResp struct { - RequestId string `xml:"requestId"` - ImageId string `xml:"imageId"` -} - -// Creates an Amazon EBS-backed AMI from an Amazon EBS-backed instance -// that is either running or stopped. -// -// See http://goo.gl/cxU41 for more details. -func (ec2 *EC2) CreateImage(options *CreateImage) (resp *CreateImageResp, err error) { - params := makeParams("CreateImage") - params["InstanceId"] = options.InstanceId - params["Name"] = options.Name - if options.Description != "" { - params["Description"] = options.Description - } - if options.NoReboot { - params["NoReboot"] = "true" - } - addBlockDeviceParams("", params, options.BlockDevices) - - resp = &CreateImageResp{} - err = ec2.query(params, resp) - if err != nil { - return nil, err - } - - return -} - -// Images returns details about available images. -// The ids and filter parameters, if provided, will limit the images returned. -// For example, to get all the private images associated with this account set -// the boolean filter "is-public" to 0. -// For list of filters: http://docs.aws.amazon.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeImages.html -// -// Note: calling this function with nil ids and filter parameters will result in -// a very large number of images being returned. -// -// See http://goo.gl/SRBhW for more details. -func (ec2 *EC2) Images(ids []string, filter *Filter) (resp *ImagesResp, err error) { - params := makeParams("DescribeImages") - for i, id := range ids { - params["ImageId."+strconv.Itoa(i+1)] = id - } - filter.addParams(params) - - resp = &ImagesResp{} - err = ec2.query(params, resp) - if err != nil { - return nil, err - } - return -} - -// ImagesByOwners returns details about available images. -// The ids, owners, and filter parameters, if provided, will limit the images returned. -// For example, to get all the private images associated with this account set -// the boolean filter "is-public" to 0. -// For list of filters: http://docs.aws.amazon.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeImages.html -// -// Note: calling this function with nil ids and filter parameters will result in -// a very large number of images being returned. -// -// See http://goo.gl/SRBhW for more details. -func (ec2 *EC2) ImagesByOwners(ids []string, owners []string, filter *Filter) (resp *ImagesResp, err error) { - params := makeParams("DescribeImages") - for i, id := range ids { - params["ImageId."+strconv.Itoa(i+1)] = id - } - for i, owner := range owners { - params[fmt.Sprintf("Owner.%d", i+1)] = owner - } - - filter.addParams(params) - - resp = &ImagesResp{} - err = ec2.query(params, resp) - if err != nil { - return nil, err - } - return -} - -// ImageAttribute describes an attribute of an AMI. -// You can specify only one attribute at a time. -// Valid attributes are: -// description | kernel | ramdisk | launchPermission | productCodes | blockDeviceMapping -// -// See http://goo.gl/bHO3zT for more details. -func (ec2 *EC2) ImageAttribute(imageId, attribute string) (resp *ImageAttributeResp, err error) { - params := makeParams("DescribeImageAttribute") - params["ImageId"] = imageId - params["Attribute"] = attribute - - resp = &ImageAttributeResp{} - err = ec2.query(params, resp) - if err != nil { - return nil, err - } - return -} - -// ModifyImageAttribute sets attributes for an image. -// -// See http://goo.gl/YUjO4G for more details. -func (ec2 *EC2) ModifyImageAttribute(imageId string, options *ModifyImageAttribute) (resp *SimpleResp, err error) { - params := makeParams("ModifyImageAttribute") - params["ImageId"] = imageId - if options.Description != "" { - params["Description.Value"] = options.Description - } - - if options.AddUsers != nil { - for i, user := range options.AddUsers { - p := fmt.Sprintf("LaunchPermission.Add.%d.UserId", i+1) - params[p] = user - } - } - - if options.RemoveUsers != nil { - for i, user := range options.RemoveUsers { - p := fmt.Sprintf("LaunchPermission.Remove.%d.UserId", i+1) - params[p] = user - } - } - - if options.AddGroups != nil { - for i, group := range options.AddGroups { - p := fmt.Sprintf("LaunchPermission.Add.%d.Group", i+1) - params[p] = group - } - } - - if options.RemoveGroups != nil { - for i, group := range options.RemoveGroups { - p := fmt.Sprintf("LaunchPermission.Remove.%d.Group", i+1) - params[p] = group - } - } - - if options.ProductCodes != nil { - addParamsList(params, "ProductCode", options.ProductCodes) - } - - resp = &SimpleResp{} - err = ec2.query(params, resp) - if err != nil { - resp = nil - } - - return -} - -// Registers a new AMI with EC2. -// -// See: http://docs.aws.amazon.com/AWSEC2/latest/APIReference/ApiReference-query-RegisterImage.html -func (ec2 *EC2) RegisterImage(options *RegisterImage) (resp *RegisterImageResp, err error) { - params := makeParams("RegisterImage") - params["Name"] = options.Name - if options.ImageLocation != "" { - params["ImageLocation"] = options.ImageLocation - } - - if options.Description != "" { - params["Description"] = options.Description - } - - if options.Architecture != "" { - params["Architecture"] = options.Architecture - } - - if options.KernelId != "" { - params["KernelId"] = options.KernelId - } - - if options.RamdiskId != "" { - params["RamdiskId"] = options.RamdiskId - } - - if options.RootDeviceName != "" { - params["RootDeviceName"] = options.RootDeviceName - } - - if options.VirtType != "" { - params["VirtualizationType"] = options.VirtType - } - - if options.SriovNetSupport != "" { - params["SriovNetSupport"] = "simple" - } - - addBlockDeviceParams("", params, options.BlockDevices) - - resp = &RegisterImageResp{} - err = ec2.query(params, resp) - if err != nil { - return nil, err - } - - return -} - -// Degisters an image. Note that this does not delete the backing stores of the AMI. -// -// See http://docs.aws.amazon.com/AWSEC2/latest/APIReference/ApiReference-query-DeregisterImage.html -func (ec2 *EC2) DeregisterImage(imageId string) (resp *DeregisterImageResp, err error) { - params := makeParams("DeregisterImage") - params["ImageId"] = imageId - - resp = &DeregisterImageResp{} - err = ec2.query(params, resp) - if err != nil { - return nil, err - } - - return -} - -// Copy and Image from one region to another. -// -// See http://goo.gl/hQwPCK for more details. -func (ec2 *EC2) CopyImage(options *CopyImage) (resp *CopyImageResp, err error) { - params := makeParams("CopyImage") - - if options.SourceRegion != "" { - params["SourceRegion"] = options.SourceRegion - } - - if options.SourceImageId != "" { - params["SourceImageId"] = options.SourceImageId - } - - if options.Name != "" { - params["Name"] = options.Name - } - - if options.Description != "" { - params["Description"] = options.Description - } - - if options.ClientToken != "" { - params["ClientToken"] = options.ClientToken - } - - resp = &CopyImageResp{} - err = ec2.query(params, resp) - if err != nil { - return nil, err - } - - return -} - -// Response to a CreateSnapshot request. -// -// See http://goo.gl/ttcda for more details. -type CreateSnapshotResp struct { - RequestId string `xml:"requestId"` - Snapshot -} - -// CreateSnapshot creates a volume snapshot and stores it in S3. -// -// See http://goo.gl/ttcda for more details. -func (ec2 *EC2) CreateSnapshot(volumeId, description string) (resp *CreateSnapshotResp, err error) { - params := makeParams("CreateSnapshot") - params["VolumeId"] = volumeId - params["Description"] = description - - resp = &CreateSnapshotResp{} - err = ec2.query(params, resp) - if err != nil { - return nil, err - } - return -} - -// DeleteSnapshots deletes the volume snapshots with the given ids. -// -// Note: If you make periodic snapshots of a volume, the snapshots are -// incremental so that only the blocks on the device that have changed -// since your last snapshot are incrementally saved in the new snapshot. -// Even though snapshots are saved incrementally, the snapshot deletion -// process is designed so that you need to retain only the most recent -// snapshot in order to restore the volume. -// -// See http://goo.gl/vwU1y for more details. -func (ec2 *EC2) DeleteSnapshots(ids []string) (resp *SimpleResp, err error) { - params := makeParams("DeleteSnapshot") - for i, id := range ids { - params["SnapshotId."+strconv.Itoa(i+1)] = id - } - - resp = &SimpleResp{} - err = ec2.query(params, resp) - if err != nil { - return nil, err - } - return -} - -// Response to a DescribeSnapshots request. -// -// See http://goo.gl/nClDT for more details. -type SnapshotsResp struct { - RequestId string `xml:"requestId"` - Snapshots []Snapshot `xml:"snapshotSet>item"` -} - -// Snapshot represents details about a volume snapshot. -// -// See http://goo.gl/nkovs for more details. -type Snapshot struct { - Id string `xml:"snapshotId"` - VolumeId string `xml:"volumeId"` - VolumeSize string `xml:"volumeSize"` - Status string `xml:"status"` - StartTime string `xml:"startTime"` - Description string `xml:"description"` - Progress string `xml:"progress"` - OwnerId string `xml:"ownerId"` - OwnerAlias string `xml:"ownerAlias"` - Encrypted bool `xml:"encrypted"` - Tags []Tag `xml:"tagSet>item"` -} - -// Snapshots returns details about volume snapshots available to the user. -// The ids and filter parameters, if provided, limit the snapshots returned. -// -// See http://goo.gl/ogJL4 for more details. -func (ec2 *EC2) Snapshots(ids []string, filter *Filter) (resp *SnapshotsResp, err error) { - params := makeParams("DescribeSnapshots") - for i, id := range ids { - params["SnapshotId."+strconv.Itoa(i+1)] = id - } - filter.addParams(params) - - resp = &SnapshotsResp{} - err = ec2.query(params, resp) - if err != nil { - return nil, err - } - return -} - -// ---------------------------------------------------------------------------- -// KeyPair management functions and types. - -type KeyPair struct { - Name string `xml:"keyName"` - Fingerprint string `xml:"keyFingerprint"` -} - -type KeyPairsResp struct { - RequestId string `xml:"requestId"` - Keys []KeyPair `xml:"keySet>item"` -} - -type CreateKeyPairResp struct { - RequestId string `xml:"requestId"` - KeyName string `xml:"keyName"` - KeyFingerprint string `xml:"keyFingerprint"` - KeyMaterial string `xml:"keyMaterial"` -} - -type ImportKeyPairResponse struct { - RequestId string `xml:"requestId"` - KeyName string `xml:"keyName"` - KeyFingerprint string `xml:"keyFingerprint"` -} - -// CreateKeyPair creates a new key pair and returns the private key contents. -// -// See http://goo.gl/0S6hV -func (ec2 *EC2) CreateKeyPair(keyName string) (resp *CreateKeyPairResp, err error) { - params := makeParams("CreateKeyPair") - params["KeyName"] = keyName - - resp = &CreateKeyPairResp{} - err = ec2.query(params, resp) - if err == nil { - resp.KeyFingerprint = strings.TrimSpace(resp.KeyFingerprint) - } - return -} - -// DeleteKeyPair deletes a key pair. -// -// See http://goo.gl/0bqok -func (ec2 *EC2) DeleteKeyPair(name string) (resp *SimpleResp, err error) { - params := makeParams("DeleteKeyPair") - params["KeyName"] = name - - resp = &SimpleResp{} - err = ec2.query(params, resp) - return -} - -// KeyPairs returns list of key pairs for this account -// -// See http://goo.gl/Apzsfz -func (ec2 *EC2) KeyPairs(keynames []string, filter *Filter) (resp *KeyPairsResp, err error) { - params := makeParams("DescribeKeyPairs") - for i, name := range keynames { - params["KeyName."+strconv.Itoa(i)] = name - } - filter.addParams(params) - - resp = &KeyPairsResp{} - err = ec2.query(params, resp) - if err != nil { - return nil, err - } - - return resp, nil -} - -// ImportKeyPair imports a key into AWS -// -// See http://goo.gl/NbZUvw -func (ec2 *EC2) ImportKeyPair(keyname string, key string) (resp *ImportKeyPairResponse, err error) { - params := makeParams("ImportKeyPair") - params["KeyName"] = keyname - - // Oddly, AWS requires the key material to be base64-encoded, even if it was - // already encoded. So, we force another round of encoding... - // c.f. https://groups.google.com/forum/?fromgroups#!topic/boto-dev/IczrStO9Q8M - params["PublicKeyMaterial"] = base64.StdEncoding.EncodeToString([]byte(key)) - - resp = &ImportKeyPairResponse{} - err = ec2.query(params, resp) - if err != nil { - return nil, err - } - return resp, nil -} - -// ---------------------------------------------------------------------------- -// Security group management functions and types. - -// SimpleResp represents a response to an EC2 request which on success will -// return no other information besides a request id. -type SimpleResp struct { - XMLName xml.Name - RequestId string `xml:"requestId"` -} - -// CreateSecurityGroupResp represents a response to a CreateSecurityGroup request. -type CreateSecurityGroupResp struct { - SecurityGroup - RequestId string `xml:"requestId"` -} - -// CreateSecurityGroup run a CreateSecurityGroup request in EC2, with the provided -// name and description. -// -// See http://goo.gl/Eo7Yl for more details. -func (ec2 *EC2) CreateSecurityGroup(group SecurityGroup) (resp *CreateSecurityGroupResp, err error) { - params := makeParams("CreateSecurityGroup") - params["GroupName"] = group.Name - params["GroupDescription"] = group.Description - if group.VpcId != "" { - params["VpcId"] = group.VpcId - } - - resp = &CreateSecurityGroupResp{} - err = ec2.query(params, resp) - if err != nil { - return nil, err - } - resp.Name = group.Name - return resp, nil -} - -// SecurityGroupsResp represents a response to a DescribeSecurityGroups -// request in EC2. -// -// See http://goo.gl/k12Uy for more details. -type SecurityGroupsResp struct { - RequestId string `xml:"requestId"` - Groups []SecurityGroupInfo `xml:"securityGroupInfo>item"` -} - -// SecurityGroup encapsulates details for a security group in EC2. -// -// See http://goo.gl/CIdyP for more details. -type SecurityGroupInfo struct { - SecurityGroup - OwnerId string `xml:"ownerId"` - Description string `xml:"groupDescription"` - IPPerms []IPPerm `xml:"ipPermissions>item"` -} - -// IPPerm represents an allowance within an EC2 security group. -// -// See http://goo.gl/4oTxv for more details. -type IPPerm struct { - Protocol string `xml:"ipProtocol"` - FromPort int `xml:"fromPort"` - ToPort int `xml:"toPort"` - SourceIPs []string `xml:"ipRanges>item>cidrIp"` - SourceGroups []UserSecurityGroup `xml:"groups>item"` -} - -// UserSecurityGroup holds a security group and the owner -// of that group. -type UserSecurityGroup struct { - Id string `xml:"groupId"` - Name string `xml:"groupName"` - OwnerId string `xml:"userId"` -} - -// SecurityGroup represents an EC2 security group. -// If SecurityGroup is used as a parameter, then one of Id or Name -// may be empty. If both are set, then Id is used. -type SecurityGroup struct { - Id string `xml:"groupId"` - Name string `xml:"groupName"` - Description string `xml:"groupDescription"` - VpcId string `xml:"vpcId"` - Tags []Tag `xml:"tagSet>item"` -} - -// SecurityGroupNames is a convenience function that -// returns a slice of security groups with the given names. -func SecurityGroupNames(names ...string) []SecurityGroup { - g := make([]SecurityGroup, len(names)) - for i, name := range names { - g[i] = SecurityGroup{Name: name} - } - return g -} - -// SecurityGroupNames is a convenience function that -// returns a slice of security groups with the given ids. -func SecurityGroupIds(ids ...string) []SecurityGroup { - g := make([]SecurityGroup, len(ids)) - for i, id := range ids { - g[i] = SecurityGroup{Id: id} - } - return g -} - -// SecurityGroups returns details about security groups in EC2. Both parameters -// are optional, and if provided will limit the security groups returned to those -// matching the given groups or filtering rules. -// -// See http://goo.gl/k12Uy for more details. -func (ec2 *EC2) SecurityGroups(groups []SecurityGroup, filter *Filter) (resp *SecurityGroupsResp, err error) { - params := makeParams("DescribeSecurityGroups") - i, j := 1, 1 - for _, g := range groups { - if g.Id != "" { - params["GroupId."+strconv.Itoa(i)] = g.Id - i++ - } else { - params["GroupName."+strconv.Itoa(j)] = g.Name - j++ - } - } - filter.addParams(params) - - resp = &SecurityGroupsResp{} - err = ec2.query(params, resp) - if err != nil { - return nil, err - } - return resp, nil -} - -// DeleteSecurityGroup removes the given security group in EC2. -// -// See http://goo.gl/QJJDO for more details. -func (ec2 *EC2) DeleteSecurityGroup(group SecurityGroup) (resp *SimpleResp, err error) { - params := makeParams("DeleteSecurityGroup") - if group.Id != "" { - params["GroupId"] = group.Id - } else { - params["GroupName"] = group.Name - } - - resp = &SimpleResp{} - err = ec2.query(params, resp) - if err != nil { - return nil, err - } - return resp, nil -} - -// AuthorizeSecurityGroup creates an allowance for clients matching the provided -// rules to access instances within the given security group. -// -// See http://goo.gl/u2sDJ for more details. -func (ec2 *EC2) AuthorizeSecurityGroup(group SecurityGroup, perms []IPPerm) (resp *SimpleResp, err error) { - return ec2.authOrRevoke("AuthorizeSecurityGroupIngress", group, perms) -} - -// AuthorizeSecurityGroupEgress creates an allowance for clients matching the provided -// rules for egress access. -// -// See http://goo.gl/UHnH4L for more details. -func (ec2 *EC2) AuthorizeSecurityGroupEgress(group SecurityGroup, perms []IPPerm) (resp *SimpleResp, err error) { - return ec2.authOrRevoke("AuthorizeSecurityGroupEgress", group, perms) -} - -// RevokeSecurityGroup revokes permissions from a group. -// -// See http://goo.gl/ZgdxA for more details. -func (ec2 *EC2) RevokeSecurityGroup(group SecurityGroup, perms []IPPerm) (resp *SimpleResp, err error) { - return ec2.authOrRevoke("RevokeSecurityGroupIngress", group, perms) -} - -func (ec2 *EC2) authOrRevoke(op string, group SecurityGroup, perms []IPPerm) (resp *SimpleResp, err error) { - params := makeParams(op) - if group.Id != "" { - params["GroupId"] = group.Id - } else { - params["GroupName"] = group.Name - } - - for i, perm := range perms { - prefix := "IpPermissions." + strconv.Itoa(i+1) - params[prefix+".IpProtocol"] = perm.Protocol - params[prefix+".FromPort"] = strconv.Itoa(perm.FromPort) - params[prefix+".ToPort"] = strconv.Itoa(perm.ToPort) - for j, ip := range perm.SourceIPs { - params[prefix+".IpRanges."+strconv.Itoa(j+1)+".CidrIp"] = ip - } - for j, g := range perm.SourceGroups { - subprefix := prefix + ".Groups." + strconv.Itoa(j+1) - if g.OwnerId != "" { - params[subprefix+".UserId"] = g.OwnerId - } - if g.Id != "" { - params[subprefix+".GroupId"] = g.Id - } else { - params[subprefix+".GroupName"] = g.Name - } - } - } - - resp = &SimpleResp{} - err = ec2.query(params, resp) - if err != nil { - return nil, err - } - return resp, nil -} - -// ResourceTag represents key-value metadata used to classify and organize -// EC2 instances. -// -// See http://goo.gl/bncl3 for more details -type Tag struct { - Key string `xml:"key"` - Value string `xml:"value"` -} - -// CreateTags adds or overwrites one or more tags for the specified taggable resources. -// For a list of tagable resources, see: http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Using_Tags.html -// -// See http://goo.gl/Vmkqc for more details -func (ec2 *EC2) CreateTags(resourceIds []string, tags []Tag) (resp *SimpleResp, err error) { - params := makeParams("CreateTags") - addParamsList(params, "ResourceId", resourceIds) - - for j, tag := range tags { - params["Tag."+strconv.Itoa(j+1)+".Key"] = tag.Key - params["Tag."+strconv.Itoa(j+1)+".Value"] = tag.Value - } - - resp = &SimpleResp{} - err = ec2.query(params, resp) - if err != nil { - return nil, err - } - return resp, nil -} - -// DeleteTags deletes tags. -func (ec2 *EC2) DeleteTags(resourceIds []string, tags []Tag) (resp *SimpleResp, err error) { - params := makeParams("DeleteTags") - addParamsList(params, "ResourceId", resourceIds) - - for j, tag := range tags { - params["Tag."+strconv.Itoa(j+1)+".Key"] = tag.Key - - if tag.Value != "" { - params["Tag."+strconv.Itoa(j+1)+".Value"] = tag.Value - } - } - - resp = &SimpleResp{} - err = ec2.query(params, resp) - if err != nil { - return nil, err - } - - return resp, nil -} - -type TagsResp struct { - RequestId string `xml:"requestId"` - Tags []ResourceTag `xml:"tagSet>item"` -} - -type ResourceTag struct { - Tag - ResourceId string `xml:"resourceId"` - ResourceType string `xml:"resourceType"` -} - -func (ec2 *EC2) Tags(filter *Filter) (*TagsResp, error) { - params := makeParams("DescribeTags") - filter.addParams(params) - - resp := &TagsResp{} - if err := ec2.query(params, resp); err != nil { - return nil, err - } - - return resp, nil -} - -// Response to a StartInstances request. -// -// See http://goo.gl/awKeF for more details. -type StartInstanceResp struct { - RequestId string `xml:"requestId"` - StateChanges []InstanceStateChange `xml:"instancesSet>item"` -} - -// Response to a StopInstances request. -// -// See http://goo.gl/436dJ for more details. -type StopInstanceResp struct { - RequestId string `xml:"requestId"` - StateChanges []InstanceStateChange `xml:"instancesSet>item"` -} - -// StartInstances starts an Amazon EBS-backed AMI that you've previously stopped. -// -// See http://goo.gl/awKeF for more details. -func (ec2 *EC2) StartInstances(ids ...string) (resp *StartInstanceResp, err error) { - params := makeParams("StartInstances") - addParamsList(params, "InstanceId", ids) - resp = &StartInstanceResp{} - err = ec2.query(params, resp) - if err != nil { - return nil, err - } - return resp, nil -} - -// StopInstances requests stopping one or more Amazon EBS-backed instances. -// -// See http://goo.gl/436dJ for more details. -func (ec2 *EC2) StopInstances(ids ...string) (resp *StopInstanceResp, err error) { - params := makeParams("StopInstances") - addParamsList(params, "InstanceId", ids) - resp = &StopInstanceResp{} - err = ec2.query(params, resp) - if err != nil { - return nil, err - } - return resp, nil -} - -// RebootInstance requests a reboot of one or more instances. This operation is asynchronous; -// it only queues a request to reboot the specified instance(s). The operation will succeed -// if the instances are valid and belong to you. -// -// Requests to reboot terminated instances are ignored. -// -// See http://goo.gl/baoUf for more details. -func (ec2 *EC2) RebootInstances(ids ...string) (resp *SimpleResp, err error) { - params := makeParams("RebootInstances") - addParamsList(params, "InstanceId", ids) - resp = &SimpleResp{} - err = ec2.query(params, resp) - if err != nil { - return nil, err - } - return resp, nil -} - -// The ModifyInstanceAttribute request parameters. -type ModifyInstance struct { - InstanceType string - BlockDevices []BlockDeviceMapping - DisableAPITermination bool - EbsOptimized bool - SecurityGroups []SecurityGroup - ShutdownBehavior string - KernelId string - RamdiskId string - SourceDestCheck bool - SriovNetSupport bool - UserData []byte - - SetSourceDestCheck bool -} - -// Response to a ModifyInstanceAttribute request. -// -// http://goo.gl/icuXh5 for more details. -type ModifyInstanceResp struct { - RequestId string `xml:"requestId"` - Return bool `xml:"return"` -} - -// ModifyImageAttribute modifies the specified attribute of the specified instance. -// You can specify only one attribute at a time. To modify some attributes, the -// instance must be stopped. -// -// See http://goo.gl/icuXh5 for more details. -func (ec2 *EC2) ModifyInstance(instId string, options *ModifyInstance) (resp *ModifyInstanceResp, err error) { - params := makeParams("ModifyInstanceAttribute") - params["InstanceId"] = instId - addBlockDeviceParams("", params, options.BlockDevices) - - if options.InstanceType != "" { - params["InstanceType.Value"] = options.InstanceType - } - - if options.DisableAPITermination { - params["DisableApiTermination.Value"] = "true" - } - - if options.EbsOptimized { - params["EbsOptimized"] = "true" - } - - if options.ShutdownBehavior != "" { - params["InstanceInitiatedShutdownBehavior.Value"] = options.ShutdownBehavior - } - - if options.KernelId != "" { - params["Kernel.Value"] = options.KernelId - } - - if options.RamdiskId != "" { - params["Ramdisk.Value"] = options.RamdiskId - } - - if options.SourceDestCheck || options.SetSourceDestCheck { - if options.SourceDestCheck { - params["SourceDestCheck.Value"] = "true" - } else { - params["SourceDestCheck.Value"] = "false" - } - } - - if options.SriovNetSupport { - params["SriovNetSupport.Value"] = "simple" - } - - if options.UserData != nil { - userData := make([]byte, b64.EncodedLen(len(options.UserData))) - b64.Encode(userData, options.UserData) - params["UserData"] = string(userData) - } - - i := 1 - for _, g := range options.SecurityGroups { - if g.Id != "" { - params["GroupId."+strconv.Itoa(i)] = g.Id - i++ - } - } - - resp = &ModifyInstanceResp{} - err = ec2.query(params, resp) - if err != nil { - resp = nil - } - return -} - -// ---------------------------------------------------------------------------- -// VPC management functions and types. - -// The CreateVpc request parameters -// -// See http://docs.aws.amazon.com/AWSEC2/latest/APIReference/ApiReference-query-CreateVpc.html -type CreateVpc struct { - CidrBlock string - InstanceTenancy string -} - -// Response to a CreateVpc request -type CreateVpcResp struct { - RequestId string `xml:"requestId"` - VPC VPC `xml:"vpc"` -} - -// The ModifyVpcAttribute request parameters. -// -// See http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/index.html?ApiReference-query-DescribeVpcAttribute.html for more details. -type ModifyVpcAttribute struct { - EnableDnsSupport bool - EnableDnsHostnames bool - - SetEnableDnsSupport bool - SetEnableDnsHostnames bool -} - -// Response to a DescribeVpcAttribute request. -// -// See http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/index.html?ApiReference-query-DescribeVpcAttribute.html for more details. -type VpcAttributeResp struct { - RequestId string `xml:"requestId"` - VpcId string `xml:"vpcId"` - EnableDnsSupport bool `xml:"enableDnsSupport>value"` - EnableDnsHostnames bool `xml:"enableDnsHostnames>value"` -} - -// CreateInternetGateway request parameters. -// -// http://docs.aws.amazon.com/AWSEC2/latest/APIReference/ApiReference-query-CreateInternetGateway.html -type CreateInternetGateway struct{} - -// CreateInternetGateway response -type CreateInternetGatewayResp struct { - RequestId string `xml:"requestId"` - InternetGateway InternetGateway `xml:"internetGateway"` -} - -// The CreateRouteTable request parameters. -// -// http://docs.aws.amazon.com/AWSEC2/latest/APIReference/ApiReference-query-CreateRouteTable.html -type CreateRouteTable struct { - VpcId string -} - -// Response to a CreateRouteTable request. -type CreateRouteTableResp struct { - RequestId string `xml:"requestId"` - RouteTable RouteTable `xml:"routeTable"` -} - -// CreateRoute request parameters -// -// http://docs.aws.amazon.com/AWSEC2/latest/APIReference/ApiReference-query-CreateRoute.html -type CreateRoute struct { - RouteTableId string - DestinationCidrBlock string - GatewayId string - InstanceId string - NetworkInterfaceId string - VpcPeeringConnectionId string -} -type ReplaceRoute struct { - RouteTableId string - DestinationCidrBlock string - GatewayId string - InstanceId string - NetworkInterfaceId string - VpcPeeringConnectionId string -} - -type AssociateRouteTableResp struct { - RequestId string `xml:"requestId"` - AssociationId string `xml:"associationId"` -} -type ReassociateRouteTableResp struct { - RequestId string `xml:"requestId"` - AssociationId string `xml:"newAssociationId"` -} - -// The CreateSubnet request parameters -// -// http://docs.aws.amazon.com/AWSEC2/latest/APIReference/ApiReference-query-CreateSubnet.html -type CreateSubnet struct { - VpcId string - CidrBlock string - AvailabilityZone string -} - -// Response to a CreateSubnet request -type CreateSubnetResp struct { - RequestId string `xml:"requestId"` - Subnet Subnet `xml:"subnet"` -} - -// The ModifySubnetAttribute request parameters -// -// http://docs.aws.amazon.com/AWSEC2/latest/APIReference/ApiReference-query-ModifySubnetAttribute.html -type ModifySubnetAttribute struct { - SubnetId string - MapPublicIpOnLaunch bool -} - -type ModifySubnetAttributeResp struct { - RequestId string `xml:"requestId"` - Return bool `xml:"return"` -} - -// The CreateNetworkAcl request parameters -// -// http://goo.gl/BZmCRF -type CreateNetworkAcl struct { - VpcId string -} - -// Response to a CreateNetworkAcl request -type CreateNetworkAclResp struct { - RequestId string `xml:"requestId"` - NetworkAcl NetworkAcl `xml:"networkAcl"` -} - -// Response to CreateNetworkAclEntry request -type CreateNetworkAclEntryResp struct { - RequestId string `xml:"requestId"` - Return bool `xml:"return"` -} - -// Response to a DescribeInternetGateways request. -type InternetGatewaysResp struct { - RequestId string `xml:"requestId"` - InternetGateways []InternetGateway `xml:"internetGatewaySet>item"` -} - -// Response to a DescribeRouteTables request. -type RouteTablesResp struct { - RequestId string `xml:"requestId"` - RouteTables []RouteTable `xml:"routeTableSet>item"` -} - -// Response to a DescribeVpcs request. -type VpcsResp struct { - RequestId string `xml:"requestId"` - VPCs []VPC `xml:"vpcSet>item"` -} - -// Internet Gateway -type InternetGateway struct { - InternetGatewayId string `xml:"internetGatewayId"` - Attachments []InternetGatewayAttachment `xml:"attachmentSet>item"` - Tags []Tag `xml:"tagSet>item"` -} - -type InternetGatewayAttachment struct { - VpcId string `xml:"vpcId"` - State string `xml:"state"` -} - -// Routing Table -type RouteTable struct { - RouteTableId string `xml:"routeTableId"` - VpcId string `xml:"vpcId"` - Associations []RouteTableAssociation `xml:"associationSet>item"` - Routes []Route `xml:"routeSet>item"` - Tags []Tag `xml:"tagSet>item"` -} - -type RouteTableAssociation struct { - AssociationId string `xml:"routeTableAssociationId"` - RouteTableId string `xml:"routeTableId"` - SubnetId string `xml:"subnetId"` - Main bool `xml:"main"` -} - -type Route struct { - DestinationCidrBlock string `xml:"destinationCidrBlock"` - GatewayId string `xml:"gatewayId"` - InstanceId string `xml:"instanceId"` - InstanceOwnerId string `xml:"instanceOwnerId"` - NetworkInterfaceId string `xml:"networkInterfaceId"` - State string `xml:"state"` - Origin string `xml:"origin"` - VpcPeeringConnectionId string `xml:"vpcPeeringConnectionId"` -} - -// Subnet -type Subnet struct { - SubnetId string `xml:"subnetId"` - State string `xml:"state"` - VpcId string `xml:"vpcId"` - CidrBlock string `xml:"cidrBlock"` - AvailableIpAddressCount int `xml:"availableIpAddressCount"` - AvailabilityZone string `xml:"availabilityZone"` - DefaultForAZ bool `xml:"defaultForAz"` - MapPublicIpOnLaunch bool `xml:"mapPublicIpOnLaunch"` - Tags []Tag `xml:"tagSet>item"` -} - -// NetworkAcl represent network acl -type NetworkAcl struct { - NetworkAclId string `xml:"networkAclId"` - VpcId string `xml:"vpcId"` - Default string `xml:"default"` - EntrySet []NetworkAclEntry `xml:"entrySet>item"` - AssociationSet []NetworkAclAssociation `xml:"associationSet>item"` - Tags []Tag `xml:"tagSet>item"` -} - -// NetworkAclAssociation -type NetworkAclAssociation struct { - NetworkAclAssociationId string `xml:"networkAclAssociationId"` - NetworkAclId string `xml:"networkAclId"` - SubnetId string `xml:"subnetId"` -} - -// NetworkAclEntry represent a rule within NetworkAcl -type NetworkAclEntry struct { - RuleNumber int `xml:"ruleNumber"` - Protocol int `xml:"protocol"` - RuleAction string `xml:"ruleAction"` - Egress bool `xml:"egress"` - CidrBlock string `xml:"cidrBlock"` - IcmpCode IcmpCode `xml:"icmpTypeCode"` - PortRange PortRange `xml:"portRange"` -} - -// IcmpCode -type IcmpCode struct { - Code int `xml:"code"` - Type int `xml:"type"` -} - -// PortRange -type PortRange struct { - From int `xml:"from"` - To int `xml:"to"` -} - -// Response to describe NetworkAcls -type NetworkAclsResp struct { - RequestId string `xml:"requestId"` - NetworkAcls []NetworkAcl `xml:"networkAclSet>item"` -} - -// VPC represents a single VPC. -type VPC struct { - VpcId string `xml:"vpcId"` - State string `xml:"state"` - CidrBlock string `xml:"cidrBlock"` - DHCPOptionsID string `xml:"dhcpOptionsId"` - InstanceTenancy string `xml:"instanceTenancy"` - IsDefault bool `xml:"isDefault"` - Tags []Tag `xml:"tagSet>item"` -} - -// Response to a DescribeSubnets request. -type SubnetsResp struct { - RequestId string `xml:"requestId"` - Subnets []Subnet `xml:"subnetSet>item"` -} - -// Create a new VPC. -func (ec2 *EC2) CreateVpc(options *CreateVpc) (resp *CreateVpcResp, err error) { - params := makeParams("CreateVpc") - params["CidrBlock"] = options.CidrBlock - - if options.InstanceTenancy != "" { - params["InstanceTenancy"] = options.InstanceTenancy - } - - resp = &CreateVpcResp{} - err = ec2.query(params, resp) - if err != nil { - return nil, err - } - - return -} - -// Delete a VPC. -func (ec2 *EC2) DeleteVpc(id string) (resp *SimpleResp, err error) { - params := makeParams("DeleteVpc") - params["VpcId"] = id - - resp = &SimpleResp{} - err = ec2.query(params, resp) - if err != nil { - return nil, err - } - return -} - -// DescribeVpcs -// -// See http://docs.aws.amazon.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeVpcs.html -func (ec2 *EC2) DescribeVpcs(ids []string, filter *Filter) (resp *VpcsResp, err error) { - params := makeParams("DescribeVpcs") - addParamsList(params, "VpcId", ids) - filter.addParams(params) - resp = &VpcsResp{} - err = ec2.query(params, resp) - if err != nil { - return nil, err - } - - return -} - -// VpcAttribute describes an attribute of a VPC. -// You can specify only one attribute at a time. -// Valid attributes are: -// enableDnsSupport | enableDnsHostnames -// -// See http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/index.html?ApiReference-query-DescribeVpcAttribute.html for more details. -func (ec2 *EC2) VpcAttribute(vpcId, attribute string) (resp *VpcAttributeResp, err error) { - params := makeParams("DescribeVpcAttribute") - params["VpcId"] = vpcId - params["Attribute"] = attribute - - resp = &VpcAttributeResp{} - err = ec2.query(params, resp) - if err != nil { - return nil, err - } - return -} - -// ModifyVpcAttribute modifies the specified attribute of the specified VPC. -// -// See http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/index.html?ApiReference-query-ModifyVpcAttribute.html for more details. -func (ec2 *EC2) ModifyVpcAttribute(vpcId string, options *ModifyVpcAttribute) (*SimpleResp, error) { - params := makeParams("ModifyVpcAttribute") - - params["VpcId"] = vpcId - - if options.SetEnableDnsSupport { - params["EnableDnsSupport.Value"] = strconv.FormatBool(options.EnableDnsSupport) - } - - if options.SetEnableDnsHostnames { - params["EnableDnsHostnames.Value"] = strconv.FormatBool(options.EnableDnsHostnames) - } - - resp := &SimpleResp{} - if err := ec2.query(params, resp); err != nil { - return nil, err - } - - return resp, nil -} - -// Create a new subnet. -func (ec2 *EC2) CreateSubnet(options *CreateSubnet) (resp *CreateSubnetResp, err error) { - params := makeParams("CreateSubnet") - params["AvailabilityZone"] = options.AvailabilityZone - params["CidrBlock"] = options.CidrBlock - params["VpcId"] = options.VpcId - - resp = &CreateSubnetResp{} - err = ec2.query(params, resp) - if err != nil { - return nil, err - } - - return -} - -// Delete a Subnet. -func (ec2 *EC2) DeleteSubnet(id string) (resp *SimpleResp, err error) { - params := makeParams("DeleteSubnet") - params["SubnetId"] = id - - resp = &SimpleResp{} - err = ec2.query(params, resp) - if err != nil { - return nil, err - } - return -} - -// ModifySubnetAttribute -// -// http://docs.aws.amazon.com/AWSEC2/latest/APIReference/ApiReference-query-ModifySubnetAttribute.html -func (ec2 *EC2) ModifySubnetAttribute(options *ModifySubnetAttribute) (resp *ModifySubnetAttributeResp, err error) { - params := makeParams("ModifySubnetAttribute") - params["SubnetId"] = options.SubnetId - if options.MapPublicIpOnLaunch { - params["MapPublicIpOnLaunch.Value"] = "true" - } else { - params["MapPublicIpOnLaunch.Value"] = "false" - } - - resp = &ModifySubnetAttributeResp{} - err = ec2.query(params, resp) - if err != nil { - return nil, err - } - return -} - -// DescribeSubnets -// -// http://docs.aws.amazon.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeSubnets.html -func (ec2 *EC2) DescribeSubnets(ids []string, filter *Filter) (resp *SubnetsResp, err error) { - params := makeParams("DescribeSubnets") - addParamsList(params, "SubnetId", ids) - filter.addParams(params) - - resp = &SubnetsResp{} - err = ec2.query(params, resp) - if err != nil { - return nil, err - } - - return -} - -// CreateNetworkAcl creates a network ACL in a VPC. -// -// http://goo.gl/51X7db -func (ec2 *EC2) CreateNetworkAcl(options *CreateNetworkAcl) (resp *CreateNetworkAclResp, err error) { - params := makeParams("CreateNetworkAcl") - params["VpcId"] = options.VpcId - - resp = &CreateNetworkAclResp{} - err = ec2.query(params, resp) - if err != nil { - return nil, err - } - - return -} - -// CreateNetworkAclEntry creates an entry (a rule) in a network ACL with the specified rule number. -// -// http://goo.gl/BtXhtj -func (ec2 *EC2) CreateNetworkAclEntry(networkAclId string, options *NetworkAclEntry) (resp *CreateNetworkAclEntryResp, err error) { - - params := makeParams("CreateNetworkAclEntry") - params["NetworkAclId"] = networkAclId - params["RuleNumber"] = strconv.Itoa(options.RuleNumber) - params["Protocol"] = strconv.Itoa(options.Protocol) - params["RuleAction"] = options.RuleAction - params["Egress"] = strconv.FormatBool(options.Egress) - params["CidrBlock"] = options.CidrBlock - if params["Protocol"] == "-1" { - params["Icmp.Type"] = strconv.Itoa(options.IcmpCode.Type) - params["Icmp.Code"] = strconv.Itoa(options.IcmpCode.Code) - } - params["PortRange.From"] = strconv.Itoa(options.PortRange.From) - params["PortRange.To"] = strconv.Itoa(options.PortRange.To) - - resp = &CreateNetworkAclEntryResp{} - err = ec2.query(params, resp) - if err != nil { - return nil, err - } - - return resp, nil -} - -// NetworkAcls describes one or more of your network ACLs for given filter. -// -// http://goo.gl/mk9RsV -func (ec2 *EC2) NetworkAcls(networkAclIds []string, filter *Filter) (resp *NetworkAclsResp, err error) { - params := makeParams("DescribeNetworkAcls") - addParamsList(params, "NetworkAclId", networkAclIds) - filter.addParams(params) - resp = &NetworkAclsResp{} - if err = ec2.query(params, resp); err != nil { - return nil, err - } - - return resp, nil -} - -// Response to a DeleteNetworkAcl request. -type DeleteNetworkAclResp struct { - RequestId string `xml:"requestId"` - Return bool `xml:"return"` -} - -// DeleteNetworkAcl deletes the network ACL with specified id. -// -// http://goo.gl/nC78Wx -func (ec2 *EC2) DeleteNetworkAcl(id string) (resp *DeleteNetworkAclResp, err error) { - params := makeParams("DeleteNetworkAcl") - params["NetworkAclId"] = id - - resp = &DeleteNetworkAclResp{} - err = ec2.query(params, resp) - if err != nil { - return nil, err - } - return resp, nil -} - -// Response to a DeleteNetworkAclEntry request. -type DeleteNetworkAclEntryResp struct { - RequestId string `xml:"requestId"` - Return bool `xml:"return"` -} - -// DeleteNetworkAclEntry deletes the specified ingress or egress entry (rule) from the specified network ACL. -// -// http://goo.gl/moQbE2 -func (ec2 *EC2) DeleteNetworkAclEntry(id string, ruleNumber int, egress bool) (resp *DeleteNetworkAclEntryResp, err error) { - params := makeParams("DeleteNetworkAclEntry") - params["NetworkAclId"] = id - params["RuleNumber"] = strconv.Itoa(ruleNumber) - params["Egress"] = strconv.FormatBool(egress) - - resp = &DeleteNetworkAclEntryResp{} - err = ec2.query(params, resp) - if err != nil { - return nil, err - } - return resp, nil -} - -type ReplaceNetworkAclAssociationResponse struct { - RequestId string `xml:"requestId"` - NewAssociationId string `xml:"newAssociationId"` -} - -// ReplaceNetworkAclAssociation changes which network ACL a subnet is associated with. -// -// http://goo.gl/ar0MH5 -func (ec2 *EC2) ReplaceNetworkAclAssociation(associationId string, networkAclId string) (resp *ReplaceNetworkAclAssociationResponse, err error) { - params := makeParams("ReplaceNetworkAclAssociation") - params["NetworkAclId"] = networkAclId - params["AssociationId"] = associationId - - resp = &ReplaceNetworkAclAssociationResponse{} - err = ec2.query(params, resp) - if err != nil { - return nil, err - } - return resp, nil -} - -// Create a new internet gateway. -func (ec2 *EC2) CreateInternetGateway( - options *CreateInternetGateway) (resp *CreateInternetGatewayResp, err error) { - params := makeParams("CreateInternetGateway") - - resp = &CreateInternetGatewayResp{} - err = ec2.query(params, resp) - if err != nil { - return nil, err - } - - return -} - -// Attach an InternetGateway. -func (ec2 *EC2) AttachInternetGateway(id, vpcId string) (resp *SimpleResp, err error) { - params := makeParams("AttachInternetGateway") - params["InternetGatewayId"] = id - params["VpcId"] = vpcId - - resp = &SimpleResp{} - err = ec2.query(params, resp) - if err != nil { - return nil, err - } - return -} - -// Detach an InternetGateway. -func (ec2 *EC2) DetachInternetGateway(id, vpcId string) (resp *SimpleResp, err error) { - params := makeParams("DetachInternetGateway") - params["InternetGatewayId"] = id - params["VpcId"] = vpcId - - resp = &SimpleResp{} - err = ec2.query(params, resp) - if err != nil { - return nil, err - } - return -} - -// Delete an InternetGateway. -func (ec2 *EC2) DeleteInternetGateway(id string) (resp *SimpleResp, err error) { - params := makeParams("DeleteInternetGateway") - params["InternetGatewayId"] = id - - resp = &SimpleResp{} - err = ec2.query(params, resp) - if err != nil { - return nil, err - } - return -} - -// DescribeInternetGateways -// -// http://docs.aws.amazon.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeInternetGateways.html -func (ec2 *EC2) DescribeInternetGateways(ids []string, filter *Filter) (resp *InternetGatewaysResp, err error) { - params := makeParams("DescribeInternetGateways") - addParamsList(params, "InternetGatewayId", ids) - filter.addParams(params) - - resp = &InternetGatewaysResp{} - err = ec2.query(params, resp) - if err != nil { - return nil, err - } - - return -} - -// Create a new routing table. -func (ec2 *EC2) CreateRouteTable( - options *CreateRouteTable) (resp *CreateRouteTableResp, err error) { - params := makeParams("CreateRouteTable") - params["VpcId"] = options.VpcId - - resp = &CreateRouteTableResp{} - err = ec2.query(params, resp) - if err != nil { - return nil, err - } - - return -} - -// Delete a RouteTable. -func (ec2 *EC2) DeleteRouteTable(id string) (resp *SimpleResp, err error) { - params := makeParams("DeleteRouteTable") - params["RouteTableId"] = id - - resp = &SimpleResp{} - err = ec2.query(params, resp) - if err != nil { - return nil, err - } - return -} - -// DescribeRouteTables -// -// http://docs.aws.amazon.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeRouteTables.html -func (ec2 *EC2) DescribeRouteTables(ids []string, filter *Filter) (resp *RouteTablesResp, err error) { - params := makeParams("DescribeRouteTables") - addParamsList(params, "RouteTableId", ids) - filter.addParams(params) - - resp = &RouteTablesResp{} - err = ec2.query(params, resp) - if err != nil { - return nil, err - } - - return -} - -// Associate a routing table. -func (ec2 *EC2) AssociateRouteTable(id, subnetId string) (*AssociateRouteTableResp, error) { - params := makeParams("AssociateRouteTable") - params["RouteTableId"] = id - params["SubnetId"] = subnetId - - resp := &AssociateRouteTableResp{} - err := ec2.query(params, resp) - if err != nil { - return nil, err - } - return resp, nil -} - -// Disassociate a routing table. -func (ec2 *EC2) DisassociateRouteTable(id string) (*SimpleResp, error) { - params := makeParams("DisassociateRouteTable") - params["AssociationId"] = id - - resp := &SimpleResp{} - err := ec2.query(params, resp) - if err != nil { - return nil, err - } - return resp, nil -} - -// Re-associate a routing table. -func (ec2 *EC2) ReassociateRouteTable(id, routeTableId string) (*ReassociateRouteTableResp, error) { - params := makeParams("ReplaceRouteTableAssociation") - params["AssociationId"] = id - params["RouteTableId"] = routeTableId - - resp := &ReassociateRouteTableResp{} - err := ec2.query(params, resp) - if err != nil { - return nil, err - } - return resp, nil -} - -// Create a new route. -func (ec2 *EC2) CreateRoute(options *CreateRoute) (resp *SimpleResp, err error) { - params := makeParams("CreateRoute") - params["RouteTableId"] = options.RouteTableId - params["DestinationCidrBlock"] = options.DestinationCidrBlock - - if v := options.GatewayId; v != "" { - params["GatewayId"] = v - } - if v := options.InstanceId; v != "" { - params["InstanceId"] = v - } - if v := options.NetworkInterfaceId; v != "" { - params["NetworkInterfaceId"] = v - } - if v := options.VpcPeeringConnectionId; v != "" { - params["VpcPeeringConnectionId"] = v - } - - resp = &SimpleResp{} - err = ec2.query(params, resp) - if err != nil { - return nil, err - } - return -} - -// Delete a Route. -func (ec2 *EC2) DeleteRoute(routeTableId, cidr string) (resp *SimpleResp, err error) { - params := makeParams("DeleteRoute") - params["RouteTableId"] = routeTableId - params["DestinationCidrBlock"] = cidr - - resp = &SimpleResp{} - err = ec2.query(params, resp) - if err != nil { - return nil, err - } - return -} - -// Replace a new route. -func (ec2 *EC2) ReplaceRoute(options *ReplaceRoute) (resp *SimpleResp, err error) { - params := makeParams("ReplaceRoute") - params["RouteTableId"] = options.RouteTableId - params["DestinationCidrBlock"] = options.DestinationCidrBlock - - if v := options.GatewayId; v != "" { - params["GatewayId"] = v - } - if v := options.InstanceId; v != "" { - params["InstanceId"] = v - } - if v := options.NetworkInterfaceId; v != "" { - params["NetworkInterfaceId"] = v - } - if v := options.VpcPeeringConnectionId; v != "" { - params["VpcPeeringConnectionId"] = v - } - - resp = &SimpleResp{} - err = ec2.query(params, resp) - if err != nil { - return nil, err - } - return -} - -// The ResetImageAttribute request parameters. -type ResetImageAttribute struct { - Attribute string -} - -// ResetImageAttribute resets an attribute of an AMI to its default value. -// -// http://goo.gl/r6ZCPm for more details. -func (ec2 *EC2) ResetImageAttribute(imageId string, options *ResetImageAttribute) (resp *SimpleResp, err error) { - params := makeParams("ResetImageAttribute") - params["ImageId"] = imageId - - if options.Attribute != "" { - params["Attribute"] = options.Attribute - } - - resp = &SimpleResp{} - err = ec2.query(params, resp) - if err != nil { - return nil, err - } - return -} diff --git a/Godeps/_workspace/src/github.com/mitchellh/goamz/ec2/ec2_test.go b/Godeps/_workspace/src/github.com/mitchellh/goamz/ec2/ec2_test.go deleted file mode 100644 index 3ea2bdc75ed..00000000000 --- a/Godeps/_workspace/src/github.com/mitchellh/goamz/ec2/ec2_test.go +++ /dev/null @@ -1,1438 +0,0 @@ -package ec2_test - -import ( - "github.com/mitchellh/goamz/aws" - "github.com/mitchellh/goamz/ec2" - "github.com/mitchellh/goamz/testutil" - . "github.com/motain/gocheck" - "testing" -) - -func Test(t *testing.T) { - TestingT(t) -} - -var _ = Suite(&S{}) - -type S struct { - ec2 *ec2.EC2 -} - -var testServer = testutil.NewHTTPServer() - -func (s *S) SetUpSuite(c *C) { - testServer.Start() - auth := aws.Auth{"abc", "123", ""} - s.ec2 = ec2.NewWithClient( - auth, - aws.Region{EC2Endpoint: testServer.URL}, - testutil.DefaultClient, - ) -} - -func (s *S) TearDownTest(c *C) { - testServer.Flush() -} - -func (s *S) TestRunInstancesErrorDump(c *C) { - testServer.Response(400, nil, ErrorDump) - - options := ec2.RunInstances{ - ImageId: "ami-a6f504cf", // Ubuntu Maverick, i386, instance store - InstanceType: "t1.micro", // Doesn't work with micro, results in 400. - } - - msg := `AMIs with an instance-store root device are not supported for the instance type 't1\.micro'\.` - - resp, err := s.ec2.RunInstances(&options) - - testServer.WaitRequest() - - c.Assert(resp, IsNil) - c.Assert(err, ErrorMatches, msg+` \(UnsupportedOperation\)`) - - ec2err, ok := err.(*ec2.Error) - c.Assert(ok, Equals, true) - c.Assert(ec2err.StatusCode, Equals, 400) - c.Assert(ec2err.Code, Equals, "UnsupportedOperation") - c.Assert(ec2err.Message, Matches, msg) - c.Assert(ec2err.RequestId, Equals, "0503f4e9-bbd6-483c-b54f-c4ae9f3b30f4") -} - -func (s *S) TestRequestSpotInstancesErrorDump(c *C) { - testServer.Response(400, nil, ErrorDump) - - options := ec2.RequestSpotInstances{ - SpotPrice: "0.01", - ImageId: "ami-a6f504cf", // Ubuntu Maverick, i386, instance store - InstanceType: "t1.micro", // Doesn't work with micro, results in 400. - } - - msg := `AMIs with an instance-store root device are not supported for the instance type 't1\.micro'\.` - - resp, err := s.ec2.RequestSpotInstances(&options) - - testServer.WaitRequest() - - c.Assert(resp, IsNil) - c.Assert(err, ErrorMatches, msg+` \(UnsupportedOperation\)`) - - ec2err, ok := err.(*ec2.Error) - c.Assert(ok, Equals, true) - c.Assert(ec2err.StatusCode, Equals, 400) - c.Assert(ec2err.Code, Equals, "UnsupportedOperation") - c.Assert(ec2err.Message, Matches, msg) - c.Assert(ec2err.RequestId, Equals, "0503f4e9-bbd6-483c-b54f-c4ae9f3b30f4") -} - -func (s *S) TestRunInstancesErrorWithoutXML(c *C) { - testServer.Responses(5, 500, nil, "") - options := ec2.RunInstances{ImageId: "image-id"} - - resp, err := s.ec2.RunInstances(&options) - - testServer.WaitRequest() - - c.Assert(resp, IsNil) - c.Assert(err, ErrorMatches, "") - - ec2err, ok := err.(*ec2.Error) - c.Assert(ok, Equals, true) - c.Assert(ec2err.StatusCode, Equals, 500) - c.Assert(ec2err.Code, Equals, "") - c.Assert(ec2err.Message, Equals, "") - c.Assert(ec2err.RequestId, Equals, "") -} - -func (s *S) TestRequestSpotInstancesErrorWithoutXML(c *C) { - testServer.Responses(5, 500, nil, "") - options := ec2.RequestSpotInstances{SpotPrice: "spot-price", ImageId: "image-id"} - - resp, err := s.ec2.RequestSpotInstances(&options) - - testServer.WaitRequest() - - c.Assert(resp, IsNil) - c.Assert(err, ErrorMatches, "") - - ec2err, ok := err.(*ec2.Error) - c.Assert(ok, Equals, true) - c.Assert(ec2err.StatusCode, Equals, 500) - c.Assert(ec2err.Code, Equals, "") - c.Assert(ec2err.Message, Equals, "") - c.Assert(ec2err.RequestId, Equals, "") -} - -func (s *S) TestRunInstancesExample(c *C) { - testServer.Response(200, nil, RunInstancesExample) - - options := ec2.RunInstances{ - KeyName: "my-keys", - ImageId: "image-id", - InstanceType: "inst-type", - SecurityGroups: []ec2.SecurityGroup{{Name: "g1"}, {Id: "g2"}, {Name: "g3"}, {Id: "g4"}}, - UserData: []byte("1234"), - KernelId: "kernel-id", - RamdiskId: "ramdisk-id", - AvailZone: "zone", - Tenancy: "dedicated", - PlacementGroupName: "group", - Monitoring: true, - SubnetId: "subnet-id", - DisableAPITermination: true, - EbsOptimized: true, - ShutdownBehavior: "terminate", - PrivateIPAddress: "10.0.0.25", - BlockDevices: []ec2.BlockDeviceMapping{ - {DeviceName: "/dev/sdb", VirtualName: "ephemeral0"}, - {DeviceName: "/dev/sdc", SnapshotId: "snap-a08912c9", DeleteOnTermination: true}, - }, - } - resp, err := s.ec2.RunInstances(&options) - - req := testServer.WaitRequest() - c.Assert(req.Form["Action"], DeepEquals, []string{"RunInstances"}) - c.Assert(req.Form["ImageId"], DeepEquals, []string{"image-id"}) - c.Assert(req.Form["MinCount"], DeepEquals, []string{"1"}) - c.Assert(req.Form["MaxCount"], DeepEquals, []string{"1"}) - c.Assert(req.Form["KeyName"], DeepEquals, []string{"my-keys"}) - c.Assert(req.Form["InstanceType"], DeepEquals, []string{"inst-type"}) - c.Assert(req.Form["SecurityGroup.1"], DeepEquals, []string{"g1"}) - c.Assert(req.Form["SecurityGroup.2"], DeepEquals, []string{"g3"}) - c.Assert(req.Form["SecurityGroupId.1"], DeepEquals, []string{"g2"}) - c.Assert(req.Form["SecurityGroupId.2"], DeepEquals, []string{"g4"}) - c.Assert(req.Form["UserData"], DeepEquals, []string{"MTIzNA=="}) - c.Assert(req.Form["KernelId"], DeepEquals, []string{"kernel-id"}) - c.Assert(req.Form["RamdiskId"], DeepEquals, []string{"ramdisk-id"}) - c.Assert(req.Form["Placement.AvailabilityZone"], DeepEquals, []string{"zone"}) - c.Assert(req.Form["Placement.GroupName"], DeepEquals, []string{"group"}) - c.Assert(req.Form["Monitoring.Enabled"], DeepEquals, []string{"true"}) - c.Assert(req.Form["SubnetId"], DeepEquals, []string{"subnet-id"}) - c.Assert(req.Form["DisableApiTermination"], DeepEquals, []string{"true"}) - c.Assert(req.Form["EbsOptimized"], DeepEquals, []string{"true"}) - c.Assert(req.Form["InstanceInitiatedShutdownBehavior"], DeepEquals, []string{"terminate"}) - c.Assert(req.Form["PrivateIpAddress"], DeepEquals, []string{"10.0.0.25"}) - c.Assert(req.Form["BlockDeviceMapping.1.DeviceName"], DeepEquals, []string{"/dev/sdb"}) - c.Assert(req.Form["BlockDeviceMapping.1.VirtualName"], DeepEquals, []string{"ephemeral0"}) - c.Assert(req.Form["BlockDeviceMapping.2.Ebs.SnapshotId"], DeepEquals, []string{"snap-a08912c9"}) - c.Assert(req.Form["BlockDeviceMapping.2.Ebs.DeleteOnTermination"], DeepEquals, []string{"true"}) - - c.Assert(err, IsNil) - c.Assert(resp.RequestId, Equals, "59dbff89-35bd-4eac-99ed-be587EXAMPLE") - c.Assert(resp.ReservationId, Equals, "r-47a5402e") - c.Assert(resp.OwnerId, Equals, "999988887777") - c.Assert(resp.SecurityGroups, DeepEquals, []ec2.SecurityGroup{{Name: "default", Id: "sg-67ad940e"}}) - c.Assert(resp.Instances, HasLen, 3) - - i0 := resp.Instances[0] - c.Assert(i0.InstanceId, Equals, "i-2ba64342") - c.Assert(i0.InstanceType, Equals, "m1.small") - c.Assert(i0.ImageId, Equals, "ami-60a54009") - c.Assert(i0.Monitoring, Equals, "enabled") - c.Assert(i0.KeyName, Equals, "example-key-name") - c.Assert(i0.AMILaunchIndex, Equals, 0) - c.Assert(i0.VirtType, Equals, "paravirtual") - c.Assert(i0.Hypervisor, Equals, "xen") - - i1 := resp.Instances[1] - c.Assert(i1.InstanceId, Equals, "i-2bc64242") - c.Assert(i1.InstanceType, Equals, "m1.small") - c.Assert(i1.ImageId, Equals, "ami-60a54009") - c.Assert(i1.Monitoring, Equals, "enabled") - c.Assert(i1.KeyName, Equals, "example-key-name") - c.Assert(i1.AMILaunchIndex, Equals, 1) - c.Assert(i1.VirtType, Equals, "paravirtual") - c.Assert(i1.Hypervisor, Equals, "xen") - - i2 := resp.Instances[2] - c.Assert(i2.InstanceId, Equals, "i-2be64332") - c.Assert(i2.InstanceType, Equals, "m1.small") - c.Assert(i2.ImageId, Equals, "ami-60a54009") - c.Assert(i2.Monitoring, Equals, "enabled") - c.Assert(i2.KeyName, Equals, "example-key-name") - c.Assert(i2.AMILaunchIndex, Equals, 2) - c.Assert(i2.VirtType, Equals, "paravirtual") - c.Assert(i2.Hypervisor, Equals, "xen") -} - -func (s *S) TestRequestSpotInstancesExample(c *C) { - testServer.Response(200, nil, RequestSpotInstancesExample) - - options := ec2.RequestSpotInstances{ - SpotPrice: "0.5", - KeyName: "my-keys", - ImageId: "image-id", - InstanceType: "inst-type", - SecurityGroups: []ec2.SecurityGroup{{Name: "g1"}, {Id: "g2"}, {Name: "g3"}, {Id: "g4"}}, - UserData: []byte("1234"), - KernelId: "kernel-id", - RamdiskId: "ramdisk-id", - AvailZone: "zone", - PlacementGroupName: "group", - Monitoring: true, - SubnetId: "subnet-id", - PrivateIPAddress: "10.0.0.25", - BlockDevices: []ec2.BlockDeviceMapping{ - {DeviceName: "/dev/sdb", VirtualName: "ephemeral0"}, - {DeviceName: "/dev/sdc", SnapshotId: "snap-a08912c9", DeleteOnTermination: true}, - }, - } - resp, err := s.ec2.RequestSpotInstances(&options) - - req := testServer.WaitRequest() - c.Assert(req.Form["Action"], DeepEquals, []string{"RequestSpotInstances"}) - c.Assert(req.Form["SpotPrice"], DeepEquals, []string{"0.5"}) - c.Assert(req.Form["LaunchSpecification.ImageId"], DeepEquals, []string{"image-id"}) - c.Assert(req.Form["LaunchSpecification.KeyName"], DeepEquals, []string{"my-keys"}) - c.Assert(req.Form["LaunchSpecification.InstanceType"], DeepEquals, []string{"inst-type"}) - c.Assert(req.Form["LaunchSpecification.SecurityGroup.1"], DeepEquals, []string{"g1"}) - c.Assert(req.Form["LaunchSpecification.SecurityGroup.2"], DeepEquals, []string{"g3"}) - c.Assert(req.Form["LaunchSpecification.SecurityGroupId.1"], DeepEquals, []string{"g2"}) - c.Assert(req.Form["LaunchSpecification.SecurityGroupId.2"], DeepEquals, []string{"g4"}) - c.Assert(req.Form["LaunchSpecification.UserData"], DeepEquals, []string{"MTIzNA=="}) - c.Assert(req.Form["LaunchSpecification.KernelId"], DeepEquals, []string{"kernel-id"}) - c.Assert(req.Form["LaunchSpecification.RamdiskId"], DeepEquals, []string{"ramdisk-id"}) - c.Assert(req.Form["LaunchSpecification.Placement.AvailabilityZone"], DeepEquals, []string{"zone"}) - c.Assert(req.Form["LaunchSpecification.Placement.GroupName"], DeepEquals, []string{"group"}) - c.Assert(req.Form["LaunchSpecification.Monitoring.Enabled"], DeepEquals, []string{"true"}) - c.Assert(req.Form["LaunchSpecification.SubnetId"], DeepEquals, []string{"subnet-id"}) - c.Assert(req.Form["LaunchSpecification.PrivateIpAddress"], DeepEquals, []string{"10.0.0.25"}) - c.Assert(req.Form["LaunchSpecification.BlockDeviceMapping.1.DeviceName"], DeepEquals, []string{"/dev/sdb"}) - c.Assert(req.Form["LaunchSpecification.BlockDeviceMapping.1.VirtualName"], DeepEquals, []string{"ephemeral0"}) - c.Assert(req.Form["LaunchSpecification.BlockDeviceMapping.2.Ebs.SnapshotId"], DeepEquals, []string{"snap-a08912c9"}) - c.Assert(req.Form["LaunchSpecification.BlockDeviceMapping.2.Ebs.DeleteOnTermination"], DeepEquals, []string{"true"}) - - c.Assert(err, IsNil) - c.Assert(resp.RequestId, Equals, "59dbff89-35bd-4eac-99ed-be587EXAMPLE") - c.Assert(resp.SpotRequestResults[0].SpotRequestId, Equals, "sir-1a2b3c4d") - c.Assert(resp.SpotRequestResults[0].SpotPrice, Equals, "0.5") - c.Assert(resp.SpotRequestResults[0].State, Equals, "open") - c.Assert(resp.SpotRequestResults[0].SpotLaunchSpec.ImageId, Equals, "ami-1a2b3c4d") - c.Assert(resp.SpotRequestResults[0].Status.Code, Equals, "pending-evaluation") - c.Assert(resp.SpotRequestResults[0].Status.UpdateTime, Equals, "2008-05-07T12:51:50.000Z") - c.Assert(resp.SpotRequestResults[0].Status.Message, Equals, "Your Spot request has been submitted for review, and is pending evaluation.") -} - -func (s *S) TestCancelSpotRequestsExample(c *C) { - testServer.Response(200, nil, CancelSpotRequestsExample) - - resp, err := s.ec2.CancelSpotRequests([]string{"s-1", "s-2"}) - - req := testServer.WaitRequest() - c.Assert(req.Form["Action"], DeepEquals, []string{"CancelSpotInstanceRequests"}) - c.Assert(req.Form["SpotInstanceRequestId.1"], DeepEquals, []string{"s-1"}) - c.Assert(req.Form["SpotInstanceRequestId.2"], DeepEquals, []string{"s-2"}) - - c.Assert(err, IsNil) - c.Assert(resp.RequestId, Equals, "59dbff89-35bd-4eac-99ed-be587EXAMPLE") - c.Assert(resp.CancelSpotRequestResults[0].SpotRequestId, Equals, "sir-1a2b3c4d") - c.Assert(resp.CancelSpotRequestResults[0].State, Equals, "cancelled") -} - -func (s *S) TestTerminateInstancesExample(c *C) { - testServer.Response(200, nil, TerminateInstancesExample) - - resp, err := s.ec2.TerminateInstances([]string{"i-1", "i-2"}) - - req := testServer.WaitRequest() - c.Assert(req.Form["Action"], DeepEquals, []string{"TerminateInstances"}) - c.Assert(req.Form["InstanceId.1"], DeepEquals, []string{"i-1"}) - c.Assert(req.Form["InstanceId.2"], DeepEquals, []string{"i-2"}) - c.Assert(req.Form["UserData"], IsNil) - c.Assert(req.Form["KernelId"], IsNil) - c.Assert(req.Form["RamdiskId"], IsNil) - c.Assert(req.Form["Placement.AvailabilityZone"], IsNil) - c.Assert(req.Form["Placement.GroupName"], IsNil) - c.Assert(req.Form["Monitoring.Enabled"], IsNil) - c.Assert(req.Form["SubnetId"], IsNil) - c.Assert(req.Form["DisableApiTermination"], IsNil) - c.Assert(req.Form["EbsOptimized"], IsNil) - c.Assert(req.Form["InstanceInitiatedShutdownBehavior"], IsNil) - c.Assert(req.Form["PrivateIpAddress"], IsNil) - - c.Assert(err, IsNil) - c.Assert(resp.RequestId, Equals, "59dbff89-35bd-4eac-99ed-be587EXAMPLE") - c.Assert(resp.StateChanges, HasLen, 1) - c.Assert(resp.StateChanges[0].InstanceId, Equals, "i-3ea74257") - c.Assert(resp.StateChanges[0].CurrentState.Code, Equals, 32) - c.Assert(resp.StateChanges[0].CurrentState.Name, Equals, "shutting-down") - c.Assert(resp.StateChanges[0].PreviousState.Code, Equals, 16) - c.Assert(resp.StateChanges[0].PreviousState.Name, Equals, "running") -} - -func (s *S) TestDescribeSpotRequestsExample(c *C) { - testServer.Response(200, nil, DescribeSpotRequestsExample) - - filter := ec2.NewFilter() - filter.Add("key1", "value1") - filter.Add("key2", "value2", "value3") - - resp, err := s.ec2.DescribeSpotRequests([]string{"s-1", "s-2"}, filter) - - req := testServer.WaitRequest() - c.Assert(req.Form["Action"], DeepEquals, []string{"DescribeSpotInstanceRequests"}) - c.Assert(req.Form["SpotInstanceRequestId.1"], DeepEquals, []string{"s-1"}) - c.Assert(req.Form["SpotInstanceRequestId.2"], DeepEquals, []string{"s-2"}) - - c.Assert(err, IsNil) - c.Assert(resp.RequestId, Equals, "b1719f2a-5334-4479-b2f1-26926EXAMPLE") - c.Assert(resp.SpotRequestResults[0].SpotRequestId, Equals, "sir-1a2b3c4d") - c.Assert(resp.SpotRequestResults[0].State, Equals, "active") - c.Assert(resp.SpotRequestResults[0].SpotPrice, Equals, "0.5") - c.Assert(resp.SpotRequestResults[0].SpotLaunchSpec.ImageId, Equals, "ami-1a2b3c4d") - c.Assert(resp.SpotRequestResults[0].Status.Code, Equals, "fulfilled") - c.Assert(resp.SpotRequestResults[0].Status.UpdateTime, Equals, "2008-05-07T12:51:50.000Z") - c.Assert(resp.SpotRequestResults[0].Status.Message, Equals, "Your Spot request is fulfilled.") -} - -func (s *S) TestDescribeInstancesExample1(c *C) { - testServer.Response(200, nil, DescribeInstancesExample1) - - filter := ec2.NewFilter() - filter.Add("key1", "value1") - filter.Add("key2", "value2", "value3") - - resp, err := s.ec2.Instances([]string{"i-1", "i-2"}, nil) - - req := testServer.WaitRequest() - c.Assert(req.Form["Action"], DeepEquals, []string{"DescribeInstances"}) - c.Assert(req.Form["InstanceId.1"], DeepEquals, []string{"i-1"}) - c.Assert(req.Form["InstanceId.2"], DeepEquals, []string{"i-2"}) - - c.Assert(err, IsNil) - c.Assert(resp.RequestId, Equals, "98e3c9a4-848c-4d6d-8e8a-b1bdEXAMPLE") - c.Assert(resp.Reservations, HasLen, 2) - - r0 := resp.Reservations[0] - c.Assert(r0.ReservationId, Equals, "r-b27e30d9") - c.Assert(r0.OwnerId, Equals, "999988887777") - c.Assert(r0.RequesterId, Equals, "854251627541") - c.Assert(r0.SecurityGroups, DeepEquals, []ec2.SecurityGroup{{Name: "default", Id: "sg-67ad940e"}}) - c.Assert(r0.Instances, HasLen, 1) - - r0i := r0.Instances[0] - c.Assert(r0i.InstanceId, Equals, "i-c5cd56af") - c.Assert(r0i.PrivateDNSName, Equals, "domU-12-31-39-10-56-34.compute-1.internal") - c.Assert(r0i.DNSName, Equals, "ec2-174-129-165-232.compute-1.amazonaws.com") - c.Assert(r0i.AvailZone, Equals, "us-east-1b") - - b0 := r0i.BlockDevices[0] - c.Assert(b0.DeviceName, Equals, "/dev/sda1") - c.Assert(b0.VolumeId, Equals, "vol-a082c1c9") - c.Assert(b0.Status, Equals, "attached") - c.Assert(b0.AttachTime, Equals, "2010-08-17T01:15:21.000Z") - c.Assert(b0.DeleteOnTermination, Equals, false) -} - -func (s *S) TestDescribeInstancesExample2(c *C) { - testServer.Response(200, nil, DescribeInstancesExample2) - - filter := ec2.NewFilter() - filter.Add("key1", "value1") - filter.Add("key2", "value2", "value3") - - resp, err := s.ec2.Instances([]string{"i-1", "i-2"}, filter) - - req := testServer.WaitRequest() - c.Assert(req.Form["Action"], DeepEquals, []string{"DescribeInstances"}) - c.Assert(req.Form["InstanceId.1"], DeepEquals, []string{"i-1"}) - c.Assert(req.Form["InstanceId.2"], DeepEquals, []string{"i-2"}) - c.Assert(req.Form["Filter.1.Name"], DeepEquals, []string{"key1"}) - c.Assert(req.Form["Filter.1.Value.1"], DeepEquals, []string{"value1"}) - c.Assert(req.Form["Filter.1.Value.2"], IsNil) - c.Assert(req.Form["Filter.2.Name"], DeepEquals, []string{"key2"}) - c.Assert(req.Form["Filter.2.Value.1"], DeepEquals, []string{"value2"}) - c.Assert(req.Form["Filter.2.Value.2"], DeepEquals, []string{"value3"}) - - c.Assert(err, IsNil) - c.Assert(resp.RequestId, Equals, "59dbff89-35bd-4eac-99ed-be587EXAMPLE") - c.Assert(resp.Reservations, HasLen, 1) - - r0 := resp.Reservations[0] - r0i := r0.Instances[0] - c.Assert(r0i.State.Code, Equals, 16) - c.Assert(r0i.State.Name, Equals, "running") - - r0t0 := r0i.Tags[0] - r0t1 := r0i.Tags[1] - c.Assert(r0t0.Key, Equals, "webserver") - c.Assert(r0t0.Value, Equals, "") - c.Assert(r0t1.Key, Equals, "stack") - c.Assert(r0t1.Value, Equals, "Production") -} - -func (s *S) TestCreateImageExample(c *C) { - testServer.Response(200, nil, CreateImageExample) - - options := &ec2.CreateImage{ - InstanceId: "i-123456", - Name: "foo", - Description: "Test CreateImage", - NoReboot: true, - BlockDevices: []ec2.BlockDeviceMapping{ - {DeviceName: "/dev/sdb", VirtualName: "ephemeral0"}, - {DeviceName: "/dev/sdc", SnapshotId: "snap-a08912c9", DeleteOnTermination: true}, - }, - } - - resp, err := s.ec2.CreateImage(options) - - req := testServer.WaitRequest() - c.Assert(req.Form["Action"], DeepEquals, []string{"CreateImage"}) - c.Assert(req.Form["InstanceId"], DeepEquals, []string{options.InstanceId}) - c.Assert(req.Form["Name"], DeepEquals, []string{options.Name}) - c.Assert(req.Form["Description"], DeepEquals, []string{options.Description}) - c.Assert(req.Form["NoReboot"], DeepEquals, []string{"true"}) - c.Assert(req.Form["BlockDeviceMapping.1.DeviceName"], DeepEquals, []string{"/dev/sdb"}) - c.Assert(req.Form["BlockDeviceMapping.1.VirtualName"], DeepEquals, []string{"ephemeral0"}) - c.Assert(req.Form["BlockDeviceMapping.2.DeviceName"], DeepEquals, []string{"/dev/sdc"}) - c.Assert(req.Form["BlockDeviceMapping.2.Ebs.SnapshotId"], DeepEquals, []string{"snap-a08912c9"}) - c.Assert(req.Form["BlockDeviceMapping.2.Ebs.DeleteOnTermination"], DeepEquals, []string{"true"}) - - c.Assert(err, IsNil) - c.Assert(resp.RequestId, Equals, "59dbff89-35bd-4eac-99ed-be587EXAMPLE") - c.Assert(resp.ImageId, Equals, "ami-4fa54026") -} - -func (s *S) TestDescribeImagesExample(c *C) { - testServer.Response(200, nil, DescribeImagesExample) - - filter := ec2.NewFilter() - filter.Add("key1", "value1") - filter.Add("key2", "value2", "value3") - - resp, err := s.ec2.Images([]string{"ami-1", "ami-2"}, filter) - - req := testServer.WaitRequest() - c.Assert(req.Form["Action"], DeepEquals, []string{"DescribeImages"}) - c.Assert(req.Form["ImageId.1"], DeepEquals, []string{"ami-1"}) - c.Assert(req.Form["ImageId.2"], DeepEquals, []string{"ami-2"}) - c.Assert(req.Form["Filter.1.Name"], DeepEquals, []string{"key1"}) - c.Assert(req.Form["Filter.1.Value.1"], DeepEquals, []string{"value1"}) - c.Assert(req.Form["Filter.1.Value.2"], IsNil) - c.Assert(req.Form["Filter.2.Name"], DeepEquals, []string{"key2"}) - c.Assert(req.Form["Filter.2.Value.1"], DeepEquals, []string{"value2"}) - c.Assert(req.Form["Filter.2.Value.2"], DeepEquals, []string{"value3"}) - - c.Assert(err, IsNil) - c.Assert(resp.RequestId, Equals, "4a4a27a2-2e7c-475d-b35b-ca822EXAMPLE") - c.Assert(resp.Images, HasLen, 1) - - i0 := resp.Images[0] - c.Assert(i0.Id, Equals, "ami-a2469acf") - c.Assert(i0.Type, Equals, "machine") - c.Assert(i0.Name, Equals, "example-marketplace-amzn-ami.1") - c.Assert(i0.Description, Equals, "Amazon Linux AMI i386 EBS") - c.Assert(i0.Location, Equals, "aws-marketplace/example-marketplace-amzn-ami.1") - c.Assert(i0.State, Equals, "available") - c.Assert(i0.Public, Equals, true) - c.Assert(i0.OwnerId, Equals, "123456789999") - c.Assert(i0.OwnerAlias, Equals, "aws-marketplace") - c.Assert(i0.Architecture, Equals, "i386") - c.Assert(i0.KernelId, Equals, "aki-805ea7e9") - c.Assert(i0.RootDeviceType, Equals, "ebs") - c.Assert(i0.RootDeviceName, Equals, "/dev/sda1") - c.Assert(i0.VirtualizationType, Equals, "paravirtual") - c.Assert(i0.Hypervisor, Equals, "xen") - - c.Assert(i0.BlockDevices, HasLen, 1) - c.Assert(i0.BlockDevices[0].DeviceName, Equals, "/dev/sda1") - c.Assert(i0.BlockDevices[0].SnapshotId, Equals, "snap-787e9403") - c.Assert(i0.BlockDevices[0].VolumeSize, Equals, int64(8)) - c.Assert(i0.BlockDevices[0].DeleteOnTermination, Equals, true) - - testServer.Response(200, nil, DescribeImagesExample) - resp2, err := s.ec2.ImagesByOwners([]string{"ami-1", "ami-2"}, []string{"123456789999", "id2"}, filter) - - req2 := testServer.WaitRequest() - c.Assert(req2.Form["Action"], DeepEquals, []string{"DescribeImages"}) - c.Assert(req2.Form["ImageId.1"], DeepEquals, []string{"ami-1"}) - c.Assert(req2.Form["ImageId.2"], DeepEquals, []string{"ami-2"}) - c.Assert(req2.Form["Owner.1"], DeepEquals, []string{"123456789999"}) - c.Assert(req2.Form["Owner.2"], DeepEquals, []string{"id2"}) - c.Assert(req2.Form["Filter.1.Name"], DeepEquals, []string{"key1"}) - c.Assert(req2.Form["Filter.1.Value.1"], DeepEquals, []string{"value1"}) - c.Assert(req2.Form["Filter.1.Value.2"], IsNil) - c.Assert(req2.Form["Filter.2.Name"], DeepEquals, []string{"key2"}) - c.Assert(req2.Form["Filter.2.Value.1"], DeepEquals, []string{"value2"}) - c.Assert(req2.Form["Filter.2.Value.2"], DeepEquals, []string{"value3"}) - - c.Assert(err, IsNil) - c.Assert(resp2.RequestId, Equals, "4a4a27a2-2e7c-475d-b35b-ca822EXAMPLE") - c.Assert(resp2.Images, HasLen, 1) - - i1 := resp2.Images[0] - c.Assert(i1.Id, Equals, "ami-a2469acf") - c.Assert(i1.Type, Equals, "machine") - c.Assert(i1.Name, Equals, "example-marketplace-amzn-ami.1") - c.Assert(i1.Description, Equals, "Amazon Linux AMI i386 EBS") - c.Assert(i1.Location, Equals, "aws-marketplace/example-marketplace-amzn-ami.1") - c.Assert(i1.State, Equals, "available") - c.Assert(i1.Public, Equals, true) - c.Assert(i1.OwnerId, Equals, "123456789999") - c.Assert(i1.OwnerAlias, Equals, "aws-marketplace") - c.Assert(i1.Architecture, Equals, "i386") - c.Assert(i1.KernelId, Equals, "aki-805ea7e9") - c.Assert(i1.RootDeviceType, Equals, "ebs") - c.Assert(i1.RootDeviceName, Equals, "/dev/sda1") - c.Assert(i1.VirtualizationType, Equals, "paravirtual") - c.Assert(i1.Hypervisor, Equals, "xen") - - c.Assert(i1.BlockDevices, HasLen, 1) - c.Assert(i1.BlockDevices[0].DeviceName, Equals, "/dev/sda1") - c.Assert(i1.BlockDevices[0].SnapshotId, Equals, "snap-787e9403") - c.Assert(i1.BlockDevices[0].VolumeSize, Equals, int64(8)) - c.Assert(i1.BlockDevices[0].DeleteOnTermination, Equals, true) -} - -func (s *S) TestImageAttributeExample(c *C) { - testServer.Response(200, nil, ImageAttributeExample) - - resp, err := s.ec2.ImageAttribute("ami-61a54008", "launchPermission") - - req := testServer.WaitRequest() - c.Assert(req.Form["Action"], DeepEquals, []string{"DescribeImageAttribute"}) - - c.Assert(err, IsNil) - c.Assert(resp.RequestId, Equals, "59dbff89-35bd-4eac-99ed-be587EXAMPLE") - c.Assert(resp.ImageId, Equals, "ami-61a54008") - c.Assert(resp.Group, Equals, "all") - c.Assert(resp.UserIds[0], Equals, "495219933132") -} - -func (s *S) TestCreateSnapshotExample(c *C) { - testServer.Response(200, nil, CreateSnapshotExample) - - resp, err := s.ec2.CreateSnapshot("vol-4d826724", "Daily Backup") - - req := testServer.WaitRequest() - c.Assert(req.Form["Action"], DeepEquals, []string{"CreateSnapshot"}) - c.Assert(req.Form["VolumeId"], DeepEquals, []string{"vol-4d826724"}) - c.Assert(req.Form["Description"], DeepEquals, []string{"Daily Backup"}) - - c.Assert(err, IsNil) - c.Assert(resp.RequestId, Equals, "59dbff89-35bd-4eac-99ed-be587EXAMPLE") - c.Assert(resp.Snapshot.Id, Equals, "snap-78a54011") - c.Assert(resp.Snapshot.VolumeId, Equals, "vol-4d826724") - c.Assert(resp.Snapshot.Status, Equals, "pending") - c.Assert(resp.Snapshot.StartTime, Equals, "2008-05-07T12:51:50.000Z") - c.Assert(resp.Snapshot.Progress, Equals, "60%") - c.Assert(resp.Snapshot.OwnerId, Equals, "111122223333") - c.Assert(resp.Snapshot.VolumeSize, Equals, "10") - c.Assert(resp.Snapshot.Description, Equals, "Daily Backup") -} - -func (s *S) TestDeleteSnapshotsExample(c *C) { - testServer.Response(200, nil, DeleteSnapshotExample) - - resp, err := s.ec2.DeleteSnapshots([]string{"snap-78a54011"}) - - req := testServer.WaitRequest() - c.Assert(req.Form["Action"], DeepEquals, []string{"DeleteSnapshot"}) - c.Assert(req.Form["SnapshotId.1"], DeepEquals, []string{"snap-78a54011"}) - - c.Assert(err, IsNil) - c.Assert(resp.RequestId, Equals, "59dbff89-35bd-4eac-99ed-be587EXAMPLE") -} - -func (s *S) TestDescribeSnapshotsExample(c *C) { - testServer.Response(200, nil, DescribeSnapshotsExample) - - filter := ec2.NewFilter() - filter.Add("key1", "value1") - filter.Add("key2", "value2", "value3") - - resp, err := s.ec2.Snapshots([]string{"snap-1", "snap-2"}, filter) - - req := testServer.WaitRequest() - c.Assert(req.Form["Action"], DeepEquals, []string{"DescribeSnapshots"}) - c.Assert(req.Form["SnapshotId.1"], DeepEquals, []string{"snap-1"}) - c.Assert(req.Form["SnapshotId.2"], DeepEquals, []string{"snap-2"}) - c.Assert(req.Form["Filter.1.Name"], DeepEquals, []string{"key1"}) - c.Assert(req.Form["Filter.1.Value.1"], DeepEquals, []string{"value1"}) - c.Assert(req.Form["Filter.1.Value.2"], IsNil) - c.Assert(req.Form["Filter.2.Name"], DeepEquals, []string{"key2"}) - c.Assert(req.Form["Filter.2.Value.1"], DeepEquals, []string{"value2"}) - c.Assert(req.Form["Filter.2.Value.2"], DeepEquals, []string{"value3"}) - - c.Assert(err, IsNil) - c.Assert(resp.RequestId, Equals, "59dbff89-35bd-4eac-99ed-be587EXAMPLE") - c.Assert(resp.Snapshots, HasLen, 1) - - s0 := resp.Snapshots[0] - c.Assert(s0.Id, Equals, "snap-1a2b3c4d") - c.Assert(s0.VolumeId, Equals, "vol-8875daef") - c.Assert(s0.VolumeSize, Equals, "15") - c.Assert(s0.Status, Equals, "pending") - c.Assert(s0.StartTime, Equals, "2010-07-29T04:12:01.000Z") - c.Assert(s0.Progress, Equals, "30%") - c.Assert(s0.OwnerId, Equals, "111122223333") - c.Assert(s0.Description, Equals, "Daily Backup") - - c.Assert(s0.Tags, HasLen, 1) - c.Assert(s0.Tags[0].Key, Equals, "Purpose") - c.Assert(s0.Tags[0].Value, Equals, "demo_db_14_backup") -} - -func (s *S) TestModifyImageAttributeExample(c *C) { - testServer.Response(200, nil, ModifyImageAttributeExample) - - options := ec2.ModifyImageAttribute{ - Description: "Test Description", - } - - resp, err := s.ec2.ModifyImageAttribute("ami-4fa54026", &options) - - req := testServer.WaitRequest() - c.Assert(req.Form["Action"], DeepEquals, []string{"ModifyImageAttribute"}) - - c.Assert(err, IsNil) - c.Assert(resp.RequestId, Equals, "59dbff89-35bd-4eac-99ed-be587EXAMPLE") -} - -func (s *S) TestModifyImageAttributeExample_complex(c *C) { - testServer.Response(200, nil, ModifyImageAttributeExample) - - options := ec2.ModifyImageAttribute{ - AddUsers: []string{"u1", "u2"}, - RemoveUsers: []string{"u3"}, - AddGroups: []string{"g1", "g3"}, - RemoveGroups: []string{"g2"}, - Description: "Test Description", - } - - resp, err := s.ec2.ModifyImageAttribute("ami-4fa54026", &options) - - req := testServer.WaitRequest() - c.Assert(req.Form["Action"], DeepEquals, []string{"ModifyImageAttribute"}) - c.Assert(req.Form["LaunchPermission.Add.1.UserId"], DeepEquals, []string{"u1"}) - c.Assert(req.Form["LaunchPermission.Add.2.UserId"], DeepEquals, []string{"u2"}) - c.Assert(req.Form["LaunchPermission.Remove.1.UserId"], DeepEquals, []string{"u3"}) - c.Assert(req.Form["LaunchPermission.Add.1.Group"], DeepEquals, []string{"g1"}) - c.Assert(req.Form["LaunchPermission.Add.2.Group"], DeepEquals, []string{"g3"}) - c.Assert(req.Form["LaunchPermission.Remove.1.Group"], DeepEquals, []string{"g2"}) - - c.Assert(err, IsNil) - c.Assert(resp.RequestId, Equals, "59dbff89-35bd-4eac-99ed-be587EXAMPLE") -} - -func (s *S) TestCopyImageExample(c *C) { - testServer.Response(200, nil, CopyImageExample) - - options := ec2.CopyImage{ - SourceRegion: "us-west-2", - SourceImageId: "ami-1a2b3c4d", - Description: "Test Description", - } - - resp, err := s.ec2.CopyImage(&options) - - req := testServer.WaitRequest() - c.Assert(req.Form["Action"], DeepEquals, []string{"CopyImage"}) - - c.Assert(err, IsNil) - c.Assert(resp.RequestId, Equals, "60bc441d-fa2c-494d-b155-5d6a3EXAMPLE") -} - -func (s *S) TestCreateKeyPairExample(c *C) { - testServer.Response(200, nil, CreateKeyPairExample) - - resp, err := s.ec2.CreateKeyPair("foo") - - req := testServer.WaitRequest() - c.Assert(req.Form["Action"], DeepEquals, []string{"CreateKeyPair"}) - c.Assert(req.Form["KeyName"], DeepEquals, []string{"foo"}) - - c.Assert(err, IsNil) - c.Assert(resp.RequestId, Equals, "59dbff89-35bd-4eac-99ed-be587EXAMPLE") - c.Assert(resp.KeyName, Equals, "foo") - c.Assert(resp.KeyFingerprint, Equals, "00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00") -} - -func (s *S) TestDeleteKeyPairExample(c *C) { - testServer.Response(200, nil, DeleteKeyPairExample) - - resp, err := s.ec2.DeleteKeyPair("foo") - - req := testServer.WaitRequest() - c.Assert(req.Form["Action"], DeepEquals, []string{"DeleteKeyPair"}) - c.Assert(req.Form["KeyName"], DeepEquals, []string{"foo"}) - - c.Assert(err, IsNil) - c.Assert(resp.RequestId, Equals, "59dbff89-35bd-4eac-99ed-be587EXAMPLE") -} - -func (s *S) TestCreateSecurityGroupExample(c *C) { - testServer.Response(200, nil, CreateSecurityGroupExample) - - resp, err := s.ec2.CreateSecurityGroup(ec2.SecurityGroup{Name: "websrv", Description: "Web Servers"}) - - req := testServer.WaitRequest() - c.Assert(req.Form["Action"], DeepEquals, []string{"CreateSecurityGroup"}) - c.Assert(req.Form["GroupName"], DeepEquals, []string{"websrv"}) - c.Assert(req.Form["GroupDescription"], DeepEquals, []string{"Web Servers"}) - - c.Assert(err, IsNil) - c.Assert(resp.RequestId, Equals, "59dbff89-35bd-4eac-99ed-be587EXAMPLE") - c.Assert(resp.Name, Equals, "websrv") - c.Assert(resp.Id, Equals, "sg-67ad940e") -} - -func (s *S) TestDescribeSecurityGroupsExample(c *C) { - testServer.Response(200, nil, DescribeSecurityGroupsExample) - - resp, err := s.ec2.SecurityGroups([]ec2.SecurityGroup{{Name: "WebServers"}, {Name: "RangedPortsBySource"}}, nil) - - req := testServer.WaitRequest() - c.Assert(req.Form["Action"], DeepEquals, []string{"DescribeSecurityGroups"}) - c.Assert(req.Form["GroupName.1"], DeepEquals, []string{"WebServers"}) - c.Assert(req.Form["GroupName.2"], DeepEquals, []string{"RangedPortsBySource"}) - - c.Assert(err, IsNil) - c.Assert(resp.RequestId, Equals, "59dbff89-35bd-4eac-99ed-be587EXAMPLE") - c.Assert(resp.Groups, HasLen, 2) - - g0 := resp.Groups[0] - c.Assert(g0.OwnerId, Equals, "999988887777") - c.Assert(g0.Name, Equals, "WebServers") - c.Assert(g0.Id, Equals, "sg-67ad940e") - c.Assert(g0.Description, Equals, "Web Servers") - c.Assert(g0.IPPerms, HasLen, 1) - - g0ipp := g0.IPPerms[0] - c.Assert(g0ipp.Protocol, Equals, "tcp") - c.Assert(g0ipp.FromPort, Equals, 80) - c.Assert(g0ipp.ToPort, Equals, 80) - c.Assert(g0ipp.SourceIPs, DeepEquals, []string{"0.0.0.0/0"}) - - g1 := resp.Groups[1] - c.Assert(g1.OwnerId, Equals, "999988887777") - c.Assert(g1.Name, Equals, "RangedPortsBySource") - c.Assert(g1.Id, Equals, "sg-76abc467") - c.Assert(g1.Description, Equals, "Group A") - c.Assert(g1.IPPerms, HasLen, 1) - - g1ipp := g1.IPPerms[0] - c.Assert(g1ipp.Protocol, Equals, "tcp") - c.Assert(g1ipp.FromPort, Equals, 6000) - c.Assert(g1ipp.ToPort, Equals, 7000) - c.Assert(g1ipp.SourceIPs, IsNil) -} - -func (s *S) TestDescribeSecurityGroupsExampleWithFilter(c *C) { - testServer.Response(200, nil, DescribeSecurityGroupsExample) - - filter := ec2.NewFilter() - filter.Add("ip-permission.protocol", "tcp") - filter.Add("ip-permission.from-port", "22") - filter.Add("ip-permission.to-port", "22") - filter.Add("ip-permission.group-name", "app_server_group", "database_group") - - _, err := s.ec2.SecurityGroups(nil, filter) - - req := testServer.WaitRequest() - c.Assert(req.Form["Action"], DeepEquals, []string{"DescribeSecurityGroups"}) - c.Assert(req.Form["Filter.1.Name"], DeepEquals, []string{"ip-permission.from-port"}) - c.Assert(req.Form["Filter.1.Value.1"], DeepEquals, []string{"22"}) - c.Assert(req.Form["Filter.2.Name"], DeepEquals, []string{"ip-permission.group-name"}) - c.Assert(req.Form["Filter.2.Value.1"], DeepEquals, []string{"app_server_group"}) - c.Assert(req.Form["Filter.2.Value.2"], DeepEquals, []string{"database_group"}) - c.Assert(req.Form["Filter.3.Name"], DeepEquals, []string{"ip-permission.protocol"}) - c.Assert(req.Form["Filter.3.Value.1"], DeepEquals, []string{"tcp"}) - c.Assert(req.Form["Filter.4.Name"], DeepEquals, []string{"ip-permission.to-port"}) - c.Assert(req.Form["Filter.4.Value.1"], DeepEquals, []string{"22"}) - - c.Assert(err, IsNil) -} - -func (s *S) TestDescribeSecurityGroupsDumpWithGroup(c *C) { - testServer.Response(200, nil, DescribeSecurityGroupsDump) - - resp, err := s.ec2.SecurityGroups(nil, nil) - - req := testServer.WaitRequest() - c.Assert(req.Form["Action"], DeepEquals, []string{"DescribeSecurityGroups"}) - c.Assert(err, IsNil) - c.Check(resp.Groups, HasLen, 1) - c.Check(resp.Groups[0].IPPerms, HasLen, 2) - - ipp0 := resp.Groups[0].IPPerms[0] - c.Assert(ipp0.SourceIPs, IsNil) - c.Check(ipp0.Protocol, Equals, "icmp") - c.Assert(ipp0.SourceGroups, HasLen, 1) - c.Check(ipp0.SourceGroups[0].OwnerId, Equals, "12345") - c.Check(ipp0.SourceGroups[0].Name, Equals, "default") - c.Check(ipp0.SourceGroups[0].Id, Equals, "sg-67ad940e") - - ipp1 := resp.Groups[0].IPPerms[1] - c.Check(ipp1.Protocol, Equals, "tcp") - c.Assert(ipp0.SourceIPs, IsNil) - c.Assert(ipp0.SourceGroups, HasLen, 1) - c.Check(ipp1.SourceGroups[0].Id, Equals, "sg-76abc467") - c.Check(ipp1.SourceGroups[0].OwnerId, Equals, "12345") - c.Check(ipp1.SourceGroups[0].Name, Equals, "other") -} - -func (s *S) TestDeleteSecurityGroupExample(c *C) { - testServer.Response(200, nil, DeleteSecurityGroupExample) - - resp, err := s.ec2.DeleteSecurityGroup(ec2.SecurityGroup{Name: "websrv"}) - req := testServer.WaitRequest() - - c.Assert(req.Form["Action"], DeepEquals, []string{"DeleteSecurityGroup"}) - c.Assert(req.Form["GroupName"], DeepEquals, []string{"websrv"}) - c.Assert(req.Form["GroupId"], IsNil) - c.Assert(err, IsNil) - c.Assert(resp.RequestId, Equals, "59dbff89-35bd-4eac-99ed-be587EXAMPLE") -} - -func (s *S) TestDeleteSecurityGroupExampleWithId(c *C) { - testServer.Response(200, nil, DeleteSecurityGroupExample) - - // ignore return and error - we're only want to check the parameter handling. - s.ec2.DeleteSecurityGroup(ec2.SecurityGroup{Id: "sg-67ad940e", Name: "ignored"}) - req := testServer.WaitRequest() - - c.Assert(req.Form["GroupName"], IsNil) - c.Assert(req.Form["GroupId"], DeepEquals, []string{"sg-67ad940e"}) -} - -func (s *S) TestAuthorizeSecurityGroupExample1(c *C) { - testServer.Response(200, nil, AuthorizeSecurityGroupIngressExample) - - perms := []ec2.IPPerm{{ - Protocol: "tcp", - FromPort: 80, - ToPort: 80, - SourceIPs: []string{"205.192.0.0/16", "205.159.0.0/16"}, - }} - resp, err := s.ec2.AuthorizeSecurityGroup(ec2.SecurityGroup{Name: "websrv"}, perms) - - req := testServer.WaitRequest() - - c.Assert(req.Form["Action"], DeepEquals, []string{"AuthorizeSecurityGroupIngress"}) - c.Assert(req.Form["GroupName"], DeepEquals, []string{"websrv"}) - c.Assert(req.Form["IpPermissions.1.IpProtocol"], DeepEquals, []string{"tcp"}) - c.Assert(req.Form["IpPermissions.1.FromPort"], DeepEquals, []string{"80"}) - c.Assert(req.Form["IpPermissions.1.ToPort"], DeepEquals, []string{"80"}) - c.Assert(req.Form["IpPermissions.1.IpRanges.1.CidrIp"], DeepEquals, []string{"205.192.0.0/16"}) - c.Assert(req.Form["IpPermissions.1.IpRanges.2.CidrIp"], DeepEquals, []string{"205.159.0.0/16"}) - - c.Assert(err, IsNil) - c.Assert(resp.RequestId, Equals, "59dbff89-35bd-4eac-99ed-be587EXAMPLE") -} - -func (s *S) TestAuthorizeSecurityGroupEgress(c *C) { - testServer.Response(200, nil, AuthorizeSecurityGroupEgressExample) - - perms := []ec2.IPPerm{{ - Protocol: "tcp", - FromPort: 80, - ToPort: 80, - SourceIPs: []string{"205.192.0.0/16", "205.159.0.0/16"}, - }} - resp, err := s.ec2.AuthorizeSecurityGroupEgress(ec2.SecurityGroup{Name: "websrv"}, perms) - - req := testServer.WaitRequest() - - c.Assert(req.Form["Action"], DeepEquals, []string{"AuthorizeSecurityGroupEgress"}) - c.Assert(req.Form["GroupName"], DeepEquals, []string{"websrv"}) - c.Assert(req.Form["IpPermissions.1.IpProtocol"], DeepEquals, []string{"tcp"}) - c.Assert(req.Form["IpPermissions.1.FromPort"], DeepEquals, []string{"80"}) - c.Assert(req.Form["IpPermissions.1.ToPort"], DeepEquals, []string{"80"}) - c.Assert(req.Form["IpPermissions.1.IpRanges.1.CidrIp"], DeepEquals, []string{"205.192.0.0/16"}) - c.Assert(req.Form["IpPermissions.1.IpRanges.2.CidrIp"], DeepEquals, []string{"205.159.0.0/16"}) - - c.Assert(err, IsNil) - c.Assert(resp.RequestId, Equals, "59dbff89-35bd-4eac-99ed-be587EXAMPLE") -} - -func (s *S) TestAuthorizeSecurityGroupExample1WithId(c *C) { - testServer.Response(200, nil, AuthorizeSecurityGroupIngressExample) - - perms := []ec2.IPPerm{{ - Protocol: "tcp", - FromPort: 80, - ToPort: 80, - SourceIPs: []string{"205.192.0.0/16", "205.159.0.0/16"}, - }} - // ignore return and error - we're only want to check the parameter handling. - s.ec2.AuthorizeSecurityGroup(ec2.SecurityGroup{Id: "sg-67ad940e", Name: "ignored"}, perms) - - req := testServer.WaitRequest() - - c.Assert(req.Form["GroupName"], IsNil) - c.Assert(req.Form["GroupId"], DeepEquals, []string{"sg-67ad940e"}) -} - -func (s *S) TestAuthorizeSecurityGroupExample2(c *C) { - testServer.Response(200, nil, AuthorizeSecurityGroupIngressExample) - - perms := []ec2.IPPerm{{ - Protocol: "tcp", - FromPort: 80, - ToPort: 81, - SourceGroups: []ec2.UserSecurityGroup{ - {OwnerId: "999988887777", Name: "OtherAccountGroup"}, - {Id: "sg-67ad940e"}, - }, - }} - resp, err := s.ec2.AuthorizeSecurityGroup(ec2.SecurityGroup{Name: "websrv"}, perms) - - req := testServer.WaitRequest() - - c.Assert(req.Form["Action"], DeepEquals, []string{"AuthorizeSecurityGroupIngress"}) - c.Assert(req.Form["GroupName"], DeepEquals, []string{"websrv"}) - c.Assert(req.Form["IpPermissions.1.IpProtocol"], DeepEquals, []string{"tcp"}) - c.Assert(req.Form["IpPermissions.1.FromPort"], DeepEquals, []string{"80"}) - c.Assert(req.Form["IpPermissions.1.ToPort"], DeepEquals, []string{"81"}) - c.Assert(req.Form["IpPermissions.1.Groups.1.UserId"], DeepEquals, []string{"999988887777"}) - c.Assert(req.Form["IpPermissions.1.Groups.1.GroupName"], DeepEquals, []string{"OtherAccountGroup"}) - c.Assert(req.Form["IpPermissions.1.Groups.2.UserId"], IsNil) - c.Assert(req.Form["IpPermissions.1.Groups.2.GroupName"], IsNil) - c.Assert(req.Form["IpPermissions.1.Groups.2.GroupId"], DeepEquals, []string{"sg-67ad940e"}) - - c.Assert(err, IsNil) - c.Assert(resp.RequestId, Equals, "59dbff89-35bd-4eac-99ed-be587EXAMPLE") -} - -func (s *S) TestRevokeSecurityGroupExample(c *C) { - // RevokeSecurityGroup is implemented by the same code as AuthorizeSecurityGroup - // so there's no need to duplicate all the tests. - testServer.Response(200, nil, RevokeSecurityGroupIngressExample) - - resp, err := s.ec2.RevokeSecurityGroup(ec2.SecurityGroup{Name: "websrv"}, nil) - - req := testServer.WaitRequest() - - c.Assert(req.Form["Action"], DeepEquals, []string{"RevokeSecurityGroupIngress"}) - c.Assert(req.Form["GroupName"], DeepEquals, []string{"websrv"}) - c.Assert(err, IsNil) - c.Assert(resp.RequestId, Equals, "59dbff89-35bd-4eac-99ed-be587EXAMPLE") -} - -func (s *S) TestCreateTags(c *C) { - testServer.Response(200, nil, CreateTagsExample) - - resp, err := s.ec2.CreateTags([]string{"ami-1a2b3c4d", "i-7f4d3a2b"}, []ec2.Tag{{"webserver", ""}, {"stack", "Production"}}) - - req := testServer.WaitRequest() - c.Assert(req.Form["ResourceId.1"], DeepEquals, []string{"ami-1a2b3c4d"}) - c.Assert(req.Form["ResourceId.2"], DeepEquals, []string{"i-7f4d3a2b"}) - c.Assert(req.Form["Tag.1.Key"], DeepEquals, []string{"webserver"}) - c.Assert(req.Form["Tag.1.Value"], DeepEquals, []string{""}) - c.Assert(req.Form["Tag.2.Key"], DeepEquals, []string{"stack"}) - c.Assert(req.Form["Tag.2.Value"], DeepEquals, []string{"Production"}) - - c.Assert(err, IsNil) - c.Assert(resp.RequestId, Equals, "59dbff89-35bd-4eac-99ed-be587EXAMPLE") -} - -func (s *S) TestStartInstances(c *C) { - testServer.Response(200, nil, StartInstancesExample) - - resp, err := s.ec2.StartInstances("i-10a64379") - req := testServer.WaitRequest() - - c.Assert(req.Form["Action"], DeepEquals, []string{"StartInstances"}) - c.Assert(req.Form["InstanceId.1"], DeepEquals, []string{"i-10a64379"}) - - c.Assert(err, IsNil) - c.Assert(resp.RequestId, Equals, "59dbff89-35bd-4eac-99ed-be587EXAMPLE") - - s0 := resp.StateChanges[0] - c.Assert(s0.InstanceId, Equals, "i-10a64379") - c.Assert(s0.CurrentState.Code, Equals, 0) - c.Assert(s0.CurrentState.Name, Equals, "pending") - c.Assert(s0.PreviousState.Code, Equals, 80) - c.Assert(s0.PreviousState.Name, Equals, "stopped") -} - -func (s *S) TestStopInstances(c *C) { - testServer.Response(200, nil, StopInstancesExample) - - resp, err := s.ec2.StopInstances("i-10a64379") - req := testServer.WaitRequest() - - c.Assert(req.Form["Action"], DeepEquals, []string{"StopInstances"}) - c.Assert(req.Form["InstanceId.1"], DeepEquals, []string{"i-10a64379"}) - - c.Assert(err, IsNil) - c.Assert(resp.RequestId, Equals, "59dbff89-35bd-4eac-99ed-be587EXAMPLE") - - s0 := resp.StateChanges[0] - c.Assert(s0.InstanceId, Equals, "i-10a64379") - c.Assert(s0.CurrentState.Code, Equals, 64) - c.Assert(s0.CurrentState.Name, Equals, "stopping") - c.Assert(s0.PreviousState.Code, Equals, 16) - c.Assert(s0.PreviousState.Name, Equals, "running") -} - -func (s *S) TestRebootInstances(c *C) { - testServer.Response(200, nil, RebootInstancesExample) - - resp, err := s.ec2.RebootInstances("i-10a64379") - req := testServer.WaitRequest() - - c.Assert(req.Form["Action"], DeepEquals, []string{"RebootInstances"}) - c.Assert(req.Form["InstanceId.1"], DeepEquals, []string{"i-10a64379"}) - - c.Assert(err, IsNil) - c.Assert(resp.RequestId, Equals, "59dbff89-35bd-4eac-99ed-be587EXAMPLE") -} - -func (s *S) TestSignatureWithEndpointPath(c *C) { - ec2.FakeTime(true) - defer ec2.FakeTime(false) - - testServer.Response(200, nil, RebootInstancesExample) - - // https://bugs.launchpad.net/goamz/+bug/1022749 - ec2 := ec2.NewWithClient(s.ec2.Auth, aws.Region{EC2Endpoint: testServer.URL + "/services/Cloud"}, testutil.DefaultClient) - - _, err := ec2.RebootInstances("i-10a64379") - c.Assert(err, IsNil) - - req := testServer.WaitRequest() - c.Assert(req.Form["Signature"], DeepEquals, []string{"tyOTQ0c0T5ujskCPTWa5ATMtv7UyErgT339cU8O2+Q8="}) -} - -func (s *S) TestDescribeInstanceStatusExample(c *C) { - testServer.Response(200, nil, DescribeInstanceStatusExample) - options := &ec2.DescribeInstanceStatus{} - resp, err := s.ec2.DescribeInstanceStatus(options, nil) - - req := testServer.WaitRequest() - c.Assert(req.Form["Action"], DeepEquals, []string{"DescribeInstanceStatus"}) - - c.Assert(err, IsNil) - c.Assert(resp.RequestId, Equals, "3be1508e-c444-4fef-89cc-0b1223c4f02fEXAMPLE") - c.Assert(resp.InstanceStatus[0].InstanceId, Equals, "i-1a2b3c4d") - c.Assert(resp.InstanceStatus[0].InstanceState.Code, Equals, 16) - c.Assert(resp.InstanceStatus[0].SystemStatus.Status, Equals, "impaired") - c.Assert(resp.InstanceStatus[0].SystemStatus.Details[0].Name, Equals, "reachability") - c.Assert(resp.InstanceStatus[0].SystemStatus.Details[0].Status, Equals, "failed") - c.Assert(resp.InstanceStatus[0].SystemStatus.Details[0].ImpairedSince, Equals, "YYYY-MM-DDTHH:MM:SS.000Z") - c.Assert(resp.InstanceStatus[0].InstanceStatus.Details[0].Name, Equals, "reachability") - c.Assert(resp.InstanceStatus[0].InstanceStatus.Details[0].Status, Equals, "failed") - c.Assert(resp.InstanceStatus[0].InstanceStatus.Details[0].ImpairedSince, Equals, "YYYY-MM-DDTHH:MM:SS.000Z") - c.Assert(resp.InstanceStatus[0].Events[0].Code, Equals, "instance-retirement") - c.Assert(resp.InstanceStatus[0].Events[0].Description, Equals, "The instance is running on degraded hardware") - c.Assert(resp.InstanceStatus[0].Events[0].NotBefore, Equals, "YYYY-MM-DDTHH:MM:SS+0000") - c.Assert(resp.InstanceStatus[0].Events[0].NotAfter, Equals, "YYYY-MM-DDTHH:MM:SS+0000") -} - -func (s *S) TestAllocateAddressExample(c *C) { - testServer.Response(200, nil, AllocateAddressExample) - - options := &ec2.AllocateAddress{ - Domain: "vpc", - } - - resp, err := s.ec2.AllocateAddress(options) - - req := testServer.WaitRequest() - c.Assert(req.Form["Action"], DeepEquals, []string{"AllocateAddress"}) - c.Assert(req.Form["Domain"], DeepEquals, []string{"vpc"}) - - c.Assert(err, IsNil) - c.Assert(resp.RequestId, Equals, "59dbff89-35bd-4eac-99ed-be587EXAMPLE") - c.Assert(resp.PublicIp, Equals, "198.51.100.1") - c.Assert(resp.Domain, Equals, "vpc") - c.Assert(resp.AllocationId, Equals, "eipalloc-5723d13e") -} - -func (s *S) TestReleaseAddressExample(c *C) { - testServer.Response(200, nil, ReleaseAddressExample) - - resp, err := s.ec2.ReleaseAddress("eipalloc-5723d13e") - - req := testServer.WaitRequest() - c.Assert(req.Form["Action"], DeepEquals, []string{"ReleaseAddress"}) - c.Assert(req.Form["AllocationId"], DeepEquals, []string{"eipalloc-5723d13e"}) - - c.Assert(err, IsNil) - c.Assert(resp.RequestId, Equals, "59dbff89-35bd-4eac-99ed-be587EXAMPLE") -} - -func (s *S) TestAssociateAddressExample(c *C) { - testServer.Response(200, nil, AssociateAddressExample) - - options := &ec2.AssociateAddress{ - InstanceId: "i-4fd2431a", - AllocationId: "eipalloc-5723d13e", - AllowReassociation: true, - } - - resp, err := s.ec2.AssociateAddress(options) - - req := testServer.WaitRequest() - c.Assert(req.Form["Action"], DeepEquals, []string{"AssociateAddress"}) - c.Assert(req.Form["InstanceId"], DeepEquals, []string{"i-4fd2431a"}) - c.Assert(req.Form["AllocationId"], DeepEquals, []string{"eipalloc-5723d13e"}) - c.Assert(req.Form["AllowReassociation"], DeepEquals, []string{"true"}) - - c.Assert(err, IsNil) - c.Assert(resp.RequestId, Equals, "59dbff89-35bd-4eac-99ed-be587EXAMPLE") - c.Assert(resp.AssociationId, Equals, "eipassoc-fc5ca095") -} - -func (s *S) TestDisassociateAddressExample(c *C) { - testServer.Response(200, nil, DisassociateAddressExample) - - resp, err := s.ec2.DisassociateAddress("eipassoc-aa7486c3") - - req := testServer.WaitRequest() - c.Assert(req.Form["Action"], DeepEquals, []string{"DisassociateAddress"}) - c.Assert(req.Form["AssociationId"], DeepEquals, []string{"eipassoc-aa7486c3"}) - - c.Assert(err, IsNil) - c.Assert(resp.RequestId, Equals, "59dbff89-35bd-4eac-99ed-be587EXAMPLE") -} - -func (s *S) TestModifyInstance(c *C) { - testServer.Response(200, nil, ModifyInstanceExample) - - options := ec2.ModifyInstance{ - InstanceType: "m1.small", - DisableAPITermination: true, - EbsOptimized: true, - SecurityGroups: []ec2.SecurityGroup{{Id: "g1"}, {Id: "g2"}}, - ShutdownBehavior: "terminate", - KernelId: "kernel-id", - RamdiskId: "ramdisk-id", - SourceDestCheck: true, - SriovNetSupport: true, - UserData: []byte("1234"), - BlockDevices: []ec2.BlockDeviceMapping{ - {DeviceName: "/dev/sda1", SnapshotId: "snap-a08912c9", DeleteOnTermination: true}, - }, - } - - resp, err := s.ec2.ModifyInstance("i-2ba64342", &options) - req := testServer.WaitRequest() - - c.Assert(req.Form["Action"], DeepEquals, []string{"ModifyInstanceAttribute"}) - c.Assert(req.Form["InstanceId"], DeepEquals, []string{"i-2ba64342"}) - c.Assert(req.Form["InstanceType.Value"], DeepEquals, []string{"m1.small"}) - c.Assert(req.Form["BlockDeviceMapping.1.DeviceName"], DeepEquals, []string{"/dev/sda1"}) - c.Assert(req.Form["BlockDeviceMapping.1.Ebs.SnapshotId"], DeepEquals, []string{"snap-a08912c9"}) - c.Assert(req.Form["BlockDeviceMapping.1.Ebs.DeleteOnTermination"], DeepEquals, []string{"true"}) - c.Assert(req.Form["DisableApiTermination.Value"], DeepEquals, []string{"true"}) - c.Assert(req.Form["EbsOptimized"], DeepEquals, []string{"true"}) - c.Assert(req.Form["GroupId.1"], DeepEquals, []string{"g1"}) - c.Assert(req.Form["GroupId.2"], DeepEquals, []string{"g2"}) - c.Assert(req.Form["InstanceInitiatedShutdownBehavior.Value"], DeepEquals, []string{"terminate"}) - c.Assert(req.Form["Kernel.Value"], DeepEquals, []string{"kernel-id"}) - c.Assert(req.Form["Ramdisk.Value"], DeepEquals, []string{"ramdisk-id"}) - c.Assert(req.Form["SourceDestCheck.Value"], DeepEquals, []string{"true"}) - c.Assert(req.Form["SriovNetSupport.Value"], DeepEquals, []string{"simple"}) - c.Assert(req.Form["UserData"], DeepEquals, []string{"MTIzNA=="}) - - c.Assert(err, IsNil) - c.Assert(resp.RequestId, Equals, "59dbff89-35bd-4eac-99ed-be587EXAMPLE") -} - -func (s *S) TestCreateVpc(c *C) { - testServer.Response(200, nil, CreateVpcExample) - - options := &ec2.CreateVpc{ - CidrBlock: "foo", - } - - resp, err := s.ec2.CreateVpc(options) - - req := testServer.WaitRequest() - c.Assert(req.Form["CidrBlock"], DeepEquals, []string{"foo"}) - - c.Assert(err, IsNil) - c.Assert(resp.RequestId, Equals, "7a62c49f-347e-4fc4-9331-6e8eEXAMPLE") - c.Assert(resp.VPC.VpcId, Equals, "vpc-1a2b3c4d") - c.Assert(resp.VPC.State, Equals, "pending") - c.Assert(resp.VPC.CidrBlock, Equals, "10.0.0.0/16") - c.Assert(resp.VPC.DHCPOptionsID, Equals, "dopt-1a2b3c4d2") - c.Assert(resp.VPC.InstanceTenancy, Equals, "default") -} - -func (s *S) TestDescribeVpcs(c *C) { - testServer.Response(200, nil, DescribeVpcsExample) - - filter := ec2.NewFilter() - filter.Add("key1", "value1") - filter.Add("key2", "value2", "value3") - - resp, err := s.ec2.DescribeVpcs([]string{"id1", "id2"}, filter) - - req := testServer.WaitRequest() - c.Assert(req.Form["Action"], DeepEquals, []string{"DescribeVpcs"}) - c.Assert(req.Form["VpcId.1"], DeepEquals, []string{"id1"}) - c.Assert(req.Form["VpcId.2"], DeepEquals, []string{"id2"}) - c.Assert(req.Form["Filter.1.Name"], DeepEquals, []string{"key1"}) - c.Assert(req.Form["Filter.1.Value.1"], DeepEquals, []string{"value1"}) - c.Assert(req.Form["Filter.1.Value.2"], IsNil) - c.Assert(req.Form["Filter.2.Name"], DeepEquals, []string{"key2"}) - c.Assert(req.Form["Filter.2.Value.1"], DeepEquals, []string{"value2"}) - c.Assert(req.Form["Filter.2.Value.2"], DeepEquals, []string{"value3"}) - - c.Assert(err, IsNil) - c.Assert(resp.RequestId, Equals, "7a62c49f-347e-4fc4-9331-6e8eEXAMPLE") - c.Assert(resp.VPCs, HasLen, 1) -} - -func (s *S) TestCreateSubnet(c *C) { - testServer.Response(200, nil, CreateSubnetExample) - - options := &ec2.CreateSubnet{ - AvailabilityZone: "baz", - CidrBlock: "foo", - VpcId: "bar", - } - - resp, err := s.ec2.CreateSubnet(options) - - req := testServer.WaitRequest() - c.Assert(req.Form["VpcId"], DeepEquals, []string{"bar"}) - c.Assert(req.Form["CidrBlock"], DeepEquals, []string{"foo"}) - c.Assert(req.Form["AvailabilityZone"], DeepEquals, []string{"baz"}) - - c.Assert(err, IsNil) - c.Assert(resp.RequestId, Equals, "7a62c49f-347e-4fc4-9331-6e8eEXAMPLE") - c.Assert(resp.Subnet.SubnetId, Equals, "subnet-9d4a7b6c") - c.Assert(resp.Subnet.State, Equals, "pending") - c.Assert(resp.Subnet.VpcId, Equals, "vpc-1a2b3c4d") - c.Assert(resp.Subnet.CidrBlock, Equals, "10.0.1.0/24") - c.Assert(resp.Subnet.AvailableIpAddressCount, Equals, 251) -} - -func (s *S) TestModifySubnetAttribute(c *C) { - testServer.Response(200, nil, ModifySubnetAttributeExample) - - options := &ec2.ModifySubnetAttribute{ - SubnetId: "foo", - MapPublicIpOnLaunch: true, - } - - resp, err := s.ec2.ModifySubnetAttribute(options) - - req := testServer.WaitRequest() - c.Assert(req.Form["SubnetId"], DeepEquals, []string{"foo"}) - c.Assert(req.Form["MapPublicIpOnLaunch.Value"], DeepEquals, []string{"true"}) - - c.Assert(err, IsNil) - c.Assert(resp.RequestId, Equals, "59dbff89-35bd-4eac-99ed-be587EXAMPLE") -} - -func (s *S) TestResetImageAttribute(c *C) { - testServer.Response(200, nil, ResetImageAttributeExample) - - options := ec2.ResetImageAttribute{Attribute: "launchPermission"} - resp, err := s.ec2.ResetImageAttribute("i-2ba64342", &options) - - req := testServer.WaitRequest() - c.Assert(req.Form["Action"], DeepEquals, []string{"ResetImageAttribute"}) - - c.Assert(err, IsNil) - c.Assert(resp.RequestId, Equals, "59dbff89-35bd-4eac-99ed-be587EXAMPLE") -} - -func (s *S) TestDescribeAvailabilityZonesExample1(c *C) { - testServer.Response(200, nil, DescribeAvailabilityZonesExample1) - - resp, err := s.ec2.DescribeAvailabilityZones(nil) - - req := testServer.WaitRequest() - c.Assert(req.Form["Action"], DeepEquals, []string{"DescribeAvailabilityZones"}) - - c.Assert(err, IsNil) - c.Assert(resp.RequestId, Equals, "59dbff89-35bd-4eac-99ed-be587EXAMPLE") - c.Assert(resp.Zones, HasLen, 4) - - z0 := resp.Zones[0] - c.Assert(z0.Name, Equals, "us-east-1a") - c.Assert(z0.Region, Equals, "us-east-1") - c.Assert(z0.State, Equals, "available") - c.Assert(z0.MessageSet, HasLen, 0) - - z1 := resp.Zones[1] - c.Assert(z1.Name, Equals, "us-east-1b") - c.Assert(z1.Region, Equals, "us-east-1") - c.Assert(z1.State, Equals, "available") - c.Assert(z1.MessageSet, HasLen, 0) - - z2 := resp.Zones[2] - c.Assert(z2.Name, Equals, "us-east-1c") - c.Assert(z2.Region, Equals, "us-east-1") - c.Assert(z2.State, Equals, "available") - c.Assert(z2.MessageSet, HasLen, 0) - - z3 := resp.Zones[3] - c.Assert(z3.Name, Equals, "us-east-1d") - c.Assert(z3.Region, Equals, "us-east-1") - c.Assert(z3.State, Equals, "available") - c.Assert(z3.MessageSet, HasLen, 0) -} - -func (s *S) TestDescribeAvailabilityZonesExample2(c *C) { - testServer.Response(200, nil, DescribeAvailabilityZonesExample2) - - resp, err := s.ec2.DescribeAvailabilityZones(nil) - - req := testServer.WaitRequest() - c.Assert(req.Form["Action"], DeepEquals, []string{"DescribeAvailabilityZones"}) - - c.Assert(err, IsNil) - c.Assert(resp.RequestId, Equals, "59dbff89-35bd-4eac-99ed-be587EXAMPLE") - c.Assert(resp.Zones, HasLen, 2) - - z0 := resp.Zones[0] - c.Assert(z0.Name, Equals, "us-east-1a") - c.Assert(z0.Region, Equals, "us-east-1") - c.Assert(z0.State, Equals, "impaired") - c.Assert(z0.MessageSet, HasLen, 0) - - z1 := resp.Zones[1] - c.Assert(z1.Name, Equals, "us-east-1b") - c.Assert(z1.Region, Equals, "us-east-1") - c.Assert(z1.State, Equals, "unavailable") - c.Assert(z1.MessageSet, DeepEquals, []string{"us-east-1b is currently down for maintenance."}) -} - -func (s *S) TestCreateNetworkAcl(c *C) { - testServer.Response(200, nil, CreateNetworkAclExample) - - options := &ec2.CreateNetworkAcl{ - VpcId: "vpc-11ad4878", - } - - resp, err := s.ec2.CreateNetworkAcl(options) - - req := testServer.WaitRequest() - c.Assert(req.Form["VpcId"], DeepEquals, []string{"vpc-11ad4878"}) - - c.Assert(err, IsNil) - c.Assert(resp.RequestId, Equals, "59dbff89-35bd-4eac-99ed-be587EXAMPLE") - c.Assert(resp.NetworkAcl.VpcId, Equals, "vpc-11ad4878") - c.Assert(resp.NetworkAcl.NetworkAclId, Equals, "acl-5fb85d36") - c.Assert(resp.NetworkAcl.Default, Equals, "false") - c.Assert(resp.NetworkAcl.EntrySet, HasLen, 2) - c.Assert(resp.NetworkAcl.EntrySet[0].RuleNumber, Equals, 32767) - c.Assert(resp.NetworkAcl.EntrySet[0].Protocol, Equals, -1) - c.Assert(resp.NetworkAcl.EntrySet[0].RuleAction, Equals, "deny") - c.Assert(resp.NetworkAcl.EntrySet[0].Egress, Equals, true) - c.Assert(resp.NetworkAcl.EntrySet[0].CidrBlock, Equals, "0.0.0.0/0") -} - -func (s *S) TestCreateNetworkAclEntry(c *C) { - testServer.Response(200, nil, CreateNetworkAclEntryRespExample) - - options := &ec2.NetworkAclEntry{ - RuleNumber: 32767, - Protocol: 6, - RuleAction: "deny", - Egress: true, - CidrBlock: "0.0.0.0/0", - PortRange: ec2.PortRange{ - To: 22, - From: 22, - }, - } - - resp, err := s.ec2.CreateNetworkAclEntry("acl-11ad4878", options) - - req := testServer.WaitRequest() - - c.Assert(req.Form["NetworkAclId"], DeepEquals, []string{"acl-11ad4878"}) - c.Assert(req.Form["RuleNumber"], DeepEquals, []string{"32767"}) - c.Assert(req.Form["Protocol"], DeepEquals, []string{"6"}) - c.Assert(req.Form["RuleAction"], DeepEquals, []string{"deny"}) - c.Assert(req.Form["Egress"], DeepEquals, []string{"true"}) - c.Assert(req.Form["CidrBlock"], DeepEquals, []string{"0.0.0.0/0"}) - c.Assert(err, IsNil) - c.Assert(resp.RequestId, Equals, "59dbff89-35bd-4eac-99ed-be587EXAMPLE") -} - -func (s *S) TestDescribeNetworkAcls(c *C) { - testServer.Response(200, nil, DescribeNetworkAclsExample) - - filter := ec2.NewFilter() - filter.Add("vpc-id", "vpc-5266953b") - - resp, err := s.ec2.NetworkAcls([]string{"acl-5566953c", "acl-5d659634"}, filter) - - c.Assert(err, IsNil) - c.Assert(resp.RequestId, Equals, "59dbff89-35bd-4eac-99ed-be587EXAMPLE") - c.Assert(resp.NetworkAcls, HasLen, 2) - c.Assert(resp.NetworkAcls[1].AssociationSet, HasLen, 2) - c.Assert(resp.NetworkAcls[1].AssociationSet[0].NetworkAclAssociationId, Equals, "aclassoc-5c659635") - c.Assert(resp.NetworkAcls[1].AssociationSet[0].NetworkAclId, Equals, "acl-5d659634") - c.Assert(resp.NetworkAcls[1].AssociationSet[0].SubnetId, Equals, "subnet-ff669596") -} - -func (s *S) TestReplaceNetworkAclAssociation(c *C) { - testServer.Response(200, nil, ReplaceNetworkAclAssociationResponseExample) - - resp, err := s.ec2.ReplaceNetworkAclAssociation("aclassoc-e5b95c8c", "acl-5fb85d36") - c.Assert(err, IsNil) - c.Assert(resp.RequestId, Equals, "59dbff89-35bd-4eac-99ed-be587EXAMPLE") - c.Assert(resp.NewAssociationId, Equals, "aclassoc-17b85d7e") -} diff --git a/Godeps/_workspace/src/github.com/mitchellh/goamz/ec2/ec2i_test.go b/Godeps/_workspace/src/github.com/mitchellh/goamz/ec2/ec2i_test.go deleted file mode 100644 index 8b025dfb408..00000000000 --- a/Godeps/_workspace/src/github.com/mitchellh/goamz/ec2/ec2i_test.go +++ /dev/null @@ -1,204 +0,0 @@ -package ec2_test - -import ( - "crypto/rand" - "fmt" - "github.com/mitchellh/goamz/aws" - "github.com/mitchellh/goamz/ec2" - "github.com/mitchellh/goamz/testutil" - . "github.com/motain/gocheck" -) - -// AmazonServer represents an Amazon EC2 server. -type AmazonServer struct { - auth aws.Auth -} - -func (s *AmazonServer) SetUp(c *C) { - auth, err := aws.EnvAuth() - if err != nil { - c.Fatal(err.Error()) - } - s.auth = auth -} - -// Suite cost per run: 0.02 USD -var _ = Suite(&AmazonClientSuite{}) - -// AmazonClientSuite tests the client against a live EC2 server. -type AmazonClientSuite struct { - srv AmazonServer - ClientTests -} - -func (s *AmazonClientSuite) SetUpSuite(c *C) { - if !testutil.Amazon { - c.Skip("AmazonClientSuite tests not enabled") - } - s.srv.SetUp(c) - s.ec2 = ec2.NewWithClient(s.srv.auth, aws.USEast, testutil.DefaultClient) -} - -// ClientTests defines integration tests designed to test the client. -// It is not used as a test suite in itself, but embedded within -// another type. -type ClientTests struct { - ec2 *ec2.EC2 -} - -var imageId = "ami-ccf405a5" // Ubuntu Maverick, i386, EBS store - -// Cost: 0.00 USD -func (s *ClientTests) TestRunInstancesError(c *C) { - options := ec2.RunInstances{ - ImageId: "ami-a6f504cf", // Ubuntu Maverick, i386, instance store - InstanceType: "t1.micro", // Doesn't work with micro, results in 400. - } - - resp, err := s.ec2.RunInstances(&options) - - c.Assert(resp, IsNil) - c.Assert(err, ErrorMatches, "AMI.*root device.*not supported.*") - - ec2err, ok := err.(*ec2.Error) - c.Assert(ok, Equals, true) - c.Assert(ec2err.StatusCode, Equals, 400) - c.Assert(ec2err.Code, Equals, "UnsupportedOperation") - c.Assert(ec2err.Message, Matches, "AMI.*root device.*not supported.*") - c.Assert(ec2err.RequestId, Matches, ".+") -} - -// Cost: 0.02 USD -func (s *ClientTests) TestRunAndTerminate(c *C) { - options := ec2.RunInstances{ - ImageId: imageId, - InstanceType: "t1.micro", - } - resp1, err := s.ec2.RunInstances(&options) - c.Assert(err, IsNil) - c.Check(resp1.ReservationId, Matches, "r-[0-9a-f]*") - c.Check(resp1.OwnerId, Matches, "[0-9]+") - c.Check(resp1.Instances, HasLen, 1) - c.Check(resp1.Instances[0].InstanceType, Equals, "t1.micro") - - instId := resp1.Instances[0].InstanceId - - resp2, err := s.ec2.Instances([]string{instId}, nil) - c.Assert(err, IsNil) - if c.Check(resp2.Reservations, HasLen, 1) && c.Check(len(resp2.Reservations[0].Instances), Equals, 1) { - inst := resp2.Reservations[0].Instances[0] - c.Check(inst.InstanceId, Equals, instId) - } - - resp3, err := s.ec2.TerminateInstances([]string{instId}) - c.Assert(err, IsNil) - c.Check(resp3.StateChanges, HasLen, 1) - c.Check(resp3.StateChanges[0].InstanceId, Equals, instId) - c.Check(resp3.StateChanges[0].CurrentState.Name, Equals, "shutting-down") - c.Check(resp3.StateChanges[0].CurrentState.Code, Equals, 32) -} - -// Cost: 0.00 USD -func (s *ClientTests) TestSecurityGroups(c *C) { - name := "goamz-test" - descr := "goamz security group for tests" - - // Clean it up, if a previous test left it around and avoid leaving it around. - s.ec2.DeleteSecurityGroup(ec2.SecurityGroup{Name: name}) - defer s.ec2.DeleteSecurityGroup(ec2.SecurityGroup{Name: name}) - - resp1, err := s.ec2.CreateSecurityGroup(ec2.SecurityGroup{Name: name, Description: descr}) - c.Assert(err, IsNil) - c.Assert(resp1.RequestId, Matches, ".+") - c.Assert(resp1.Name, Equals, name) - c.Assert(resp1.Id, Matches, ".+") - - resp1, err = s.ec2.CreateSecurityGroup(ec2.SecurityGroup{Name: name, Description: descr}) - ec2err, _ := err.(*ec2.Error) - c.Assert(resp1, IsNil) - c.Assert(ec2err, NotNil) - c.Assert(ec2err.Code, Equals, "InvalidGroup.Duplicate") - - perms := []ec2.IPPerm{{ - Protocol: "tcp", - FromPort: 0, - ToPort: 1024, - SourceIPs: []string{"127.0.0.1/24"}, - }} - - resp2, err := s.ec2.AuthorizeSecurityGroup(ec2.SecurityGroup{Name: name}, perms) - c.Assert(err, IsNil) - c.Assert(resp2.RequestId, Matches, ".+") - - resp3, err := s.ec2.SecurityGroups(ec2.SecurityGroupNames(name), nil) - c.Assert(err, IsNil) - c.Assert(resp3.RequestId, Matches, ".+") - c.Assert(resp3.Groups, HasLen, 1) - - g0 := resp3.Groups[0] - c.Assert(g0.Name, Equals, name) - c.Assert(g0.Description, Equals, descr) - c.Assert(g0.IPPerms, HasLen, 1) - c.Assert(g0.IPPerms[0].Protocol, Equals, "tcp") - c.Assert(g0.IPPerms[0].FromPort, Equals, 0) - c.Assert(g0.IPPerms[0].ToPort, Equals, 1024) - c.Assert(g0.IPPerms[0].SourceIPs, DeepEquals, []string{"127.0.0.1/24"}) - - resp2, err = s.ec2.DeleteSecurityGroup(ec2.SecurityGroup{Name: name}) - c.Assert(err, IsNil) - c.Assert(resp2.RequestId, Matches, ".+") -} - -var sessionId = func() string { - buf := make([]byte, 8) - // if we have no randomness, we'll just make do, so ignore the error. - rand.Read(buf) - return fmt.Sprintf("%x", buf) -}() - -// sessionName reutrns a name that is probably -// unique to this test session. -func sessionName(prefix string) string { - return prefix + "-" + sessionId -} - -var allRegions = []aws.Region{ - aws.USEast, - aws.USWest, - aws.EUWest, - aws.EUCentral, - aws.APSoutheast, - aws.APNortheast, -} - -// Communicate with all EC2 endpoints to see if they are alive. -func (s *ClientTests) TestRegions(c *C) { - name := sessionName("goamz-region-test") - perms := []ec2.IPPerm{{ - Protocol: "tcp", - FromPort: 80, - ToPort: 80, - SourceIPs: []string{"127.0.0.1/32"}, - }} - errs := make(chan error, len(allRegions)) - for _, region := range allRegions { - go func(r aws.Region) { - e := ec2.NewWithClient(s.ec2.Auth, r, testutil.DefaultClient) - _, err := e.AuthorizeSecurityGroup(ec2.SecurityGroup{Name: name}, perms) - errs <- err - }(region) - } - for _ = range allRegions { - err := <-errs - if err != nil { - ec2_err, ok := err.(*ec2.Error) - if ok { - c.Check(ec2_err.Code, Matches, "InvalidGroup.NotFound") - } else { - c.Errorf("Non-EC2 error: %s", err) - } - } else { - c.Errorf("Test should have errored but it seems to have succeeded") - } - } -} diff --git a/Godeps/_workspace/src/github.com/mitchellh/goamz/ec2/ec2t_test.go b/Godeps/_workspace/src/github.com/mitchellh/goamz/ec2/ec2t_test.go deleted file mode 100644 index fe50356f908..00000000000 --- a/Godeps/_workspace/src/github.com/mitchellh/goamz/ec2/ec2t_test.go +++ /dev/null @@ -1,580 +0,0 @@ -package ec2_test - -import ( - "fmt" - "github.com/mitchellh/goamz/aws" - "github.com/mitchellh/goamz/ec2" - "github.com/mitchellh/goamz/ec2/ec2test" - "github.com/mitchellh/goamz/testutil" - . "github.com/motain/gocheck" - "regexp" - "sort" -) - -// LocalServer represents a local ec2test fake server. -type LocalServer struct { - auth aws.Auth - region aws.Region - srv *ec2test.Server -} - -func (s *LocalServer) SetUp(c *C) { - srv, err := ec2test.NewServer() - c.Assert(err, IsNil) - c.Assert(srv, NotNil) - - s.srv = srv - s.region = aws.Region{EC2Endpoint: srv.URL()} -} - -// LocalServerSuite defines tests that will run -// against the local ec2test server. It includes -// selected tests from ClientTests; -// when the ec2test functionality is sufficient, it should -// include all of them, and ClientTests can be simply embedded. -type LocalServerSuite struct { - srv LocalServer - ServerTests - clientTests ClientTests -} - -var _ = Suite(&LocalServerSuite{}) - -func (s *LocalServerSuite) SetUpSuite(c *C) { - s.srv.SetUp(c) - s.ServerTests.ec2 = ec2.NewWithClient(s.srv.auth, s.srv.region, testutil.DefaultClient) - s.clientTests.ec2 = ec2.NewWithClient(s.srv.auth, s.srv.region, testutil.DefaultClient) -} - -func (s *LocalServerSuite) TestRunAndTerminate(c *C) { - s.clientTests.TestRunAndTerminate(c) -} - -func (s *LocalServerSuite) TestSecurityGroups(c *C) { - s.clientTests.TestSecurityGroups(c) -} - -// TestUserData is not defined on ServerTests because it -// requires the ec2test server to function. -func (s *LocalServerSuite) TestUserData(c *C) { - data := make([]byte, 256) - for i := range data { - data[i] = byte(i) - } - inst, err := s.ec2.RunInstances(&ec2.RunInstances{ - ImageId: imageId, - InstanceType: "t1.micro", - UserData: data, - }) - c.Assert(err, IsNil) - c.Assert(inst, NotNil) - c.Assert(inst.Instances[0].DNSName, Equals, inst.Instances[0].InstanceId+".example.com") - - id := inst.Instances[0].InstanceId - - defer s.ec2.TerminateInstances([]string{id}) - - tinst := s.srv.srv.Instance(id) - c.Assert(tinst, NotNil) - c.Assert(tinst.UserData, DeepEquals, data) -} - -// AmazonServerSuite runs the ec2test server tests against a live EC2 server. -// It will only be activated if the -all flag is specified. -type AmazonServerSuite struct { - srv AmazonServer - ServerTests -} - -var _ = Suite(&AmazonServerSuite{}) - -func (s *AmazonServerSuite) SetUpSuite(c *C) { - if !testutil.Amazon { - c.Skip("AmazonServerSuite tests not enabled") - } - s.srv.SetUp(c) - s.ServerTests.ec2 = ec2.NewWithClient(s.srv.auth, aws.USEast, testutil.DefaultClient) -} - -// ServerTests defines a set of tests designed to test -// the ec2test local fake ec2 server. -// It is not used as a test suite in itself, but embedded within -// another type. -type ServerTests struct { - ec2 *ec2.EC2 -} - -func terminateInstances(c *C, e *ec2.EC2, insts []*ec2.Instance) { - var ids []string - for _, inst := range insts { - if inst != nil { - ids = append(ids, inst.InstanceId) - } - } - _, err := e.TerminateInstances(ids) - c.Check(err, IsNil, Commentf("%d INSTANCES LEFT RUNNING!!!", len(ids))) -} - -func (s *ServerTests) makeTestGroup(c *C, name, descr string) ec2.SecurityGroup { - // Clean it up if a previous test left it around. - _, err := s.ec2.DeleteSecurityGroup(ec2.SecurityGroup{Name: name}) - if err != nil && err.(*ec2.Error).Code != "InvalidGroup.NotFound" { - c.Fatalf("delete security group: %v", err) - } - - resp, err := s.ec2.CreateSecurityGroup(ec2.SecurityGroup{Name: name, Description: descr}) - c.Assert(err, IsNil) - c.Assert(resp.Name, Equals, name) - return resp.SecurityGroup -} - -func (s *ServerTests) TestIPPerms(c *C) { - g0 := s.makeTestGroup(c, "goamz-test0", "ec2test group 0") - defer s.ec2.DeleteSecurityGroup(g0) - - g1 := s.makeTestGroup(c, "goamz-test1", "ec2test group 1") - defer s.ec2.DeleteSecurityGroup(g1) - - resp, err := s.ec2.SecurityGroups([]ec2.SecurityGroup{g0, g1}, nil) - c.Assert(err, IsNil) - c.Assert(resp.Groups, HasLen, 2) - c.Assert(resp.Groups[0].IPPerms, HasLen, 0) - c.Assert(resp.Groups[1].IPPerms, HasLen, 0) - - ownerId := resp.Groups[0].OwnerId - - // test some invalid parameters - // TODO more - _, err = s.ec2.AuthorizeSecurityGroup(g0, []ec2.IPPerm{{ - Protocol: "tcp", - FromPort: 0, - ToPort: 1024, - SourceIPs: []string{"z127.0.0.1/24"}, - }}) - c.Assert(err, NotNil) - c.Check(err.(*ec2.Error).Code, Equals, "InvalidPermission.Malformed") - - // Check that AuthorizeSecurityGroup adds the correct authorizations. - _, err = s.ec2.AuthorizeSecurityGroup(g0, []ec2.IPPerm{{ - Protocol: "tcp", - FromPort: 2000, - ToPort: 2001, - SourceIPs: []string{"127.0.0.0/24"}, - SourceGroups: []ec2.UserSecurityGroup{{ - Name: g1.Name, - }, { - Id: g0.Id, - }}, - }, { - Protocol: "tcp", - FromPort: 2000, - ToPort: 2001, - SourceIPs: []string{"200.1.1.34/32"}, - }}) - c.Assert(err, IsNil) - - resp, err = s.ec2.SecurityGroups([]ec2.SecurityGroup{g0}, nil) - c.Assert(err, IsNil) - c.Assert(resp.Groups, HasLen, 1) - c.Assert(resp.Groups[0].IPPerms, HasLen, 1) - - perm := resp.Groups[0].IPPerms[0] - srcg := perm.SourceGroups - c.Assert(srcg, HasLen, 2) - - // Normalize so we don't care about returned order. - if srcg[0].Name == g1.Name { - srcg[0], srcg[1] = srcg[1], srcg[0] - } - c.Check(srcg[0].Name, Equals, g0.Name) - c.Check(srcg[0].Id, Equals, g0.Id) - c.Check(srcg[0].OwnerId, Equals, ownerId) - c.Check(srcg[1].Name, Equals, g1.Name) - c.Check(srcg[1].Id, Equals, g1.Id) - c.Check(srcg[1].OwnerId, Equals, ownerId) - - sort.Strings(perm.SourceIPs) - c.Check(perm.SourceIPs, DeepEquals, []string{"127.0.0.0/24", "200.1.1.34/32"}) - - // Check that we can't delete g1 (because g0 is using it) - _, err = s.ec2.DeleteSecurityGroup(g1) - c.Assert(err, NotNil) - c.Check(err.(*ec2.Error).Code, Equals, "InvalidGroup.InUse") - - _, err = s.ec2.RevokeSecurityGroup(g0, []ec2.IPPerm{{ - Protocol: "tcp", - FromPort: 2000, - ToPort: 2001, - SourceGroups: []ec2.UserSecurityGroup{{Id: g1.Id}}, - }, { - Protocol: "tcp", - FromPort: 2000, - ToPort: 2001, - SourceIPs: []string{"200.1.1.34/32"}, - }}) - c.Assert(err, IsNil) - - resp, err = s.ec2.SecurityGroups([]ec2.SecurityGroup{g0}, nil) - c.Assert(err, IsNil) - c.Assert(resp.Groups, HasLen, 1) - c.Assert(resp.Groups[0].IPPerms, HasLen, 1) - - perm = resp.Groups[0].IPPerms[0] - srcg = perm.SourceGroups - c.Assert(srcg, HasLen, 1) - c.Check(srcg[0].Name, Equals, g0.Name) - c.Check(srcg[0].Id, Equals, g0.Id) - c.Check(srcg[0].OwnerId, Equals, ownerId) - - c.Check(perm.SourceIPs, DeepEquals, []string{"127.0.0.0/24"}) - - // We should be able to delete g1 now because we've removed its only use. - _, err = s.ec2.DeleteSecurityGroup(g1) - c.Assert(err, IsNil) - - _, err = s.ec2.DeleteSecurityGroup(g0) - c.Assert(err, IsNil) - - f := ec2.NewFilter() - f.Add("group-id", g0.Id, g1.Id) - resp, err = s.ec2.SecurityGroups(nil, f) - c.Assert(err, IsNil) - c.Assert(resp.Groups, HasLen, 0) -} - -func (s *ServerTests) TestDuplicateIPPerm(c *C) { - name := "goamz-test" - descr := "goamz security group for tests" - - // Clean it up, if a previous test left it around and avoid leaving it around. - s.ec2.DeleteSecurityGroup(ec2.SecurityGroup{Name: name}) - defer s.ec2.DeleteSecurityGroup(ec2.SecurityGroup{Name: name}) - - resp1, err := s.ec2.CreateSecurityGroup(ec2.SecurityGroup{Name: name, Description: descr}) - c.Assert(err, IsNil) - c.Assert(resp1.Name, Equals, name) - - perms := []ec2.IPPerm{{ - Protocol: "tcp", - FromPort: 200, - ToPort: 1024, - SourceIPs: []string{"127.0.0.1/24"}, - }, { - Protocol: "tcp", - FromPort: 0, - ToPort: 100, - SourceIPs: []string{"127.0.0.1/24"}, - }} - - _, err = s.ec2.AuthorizeSecurityGroup(ec2.SecurityGroup{Name: name}, perms[0:1]) - c.Assert(err, IsNil) - - _, err = s.ec2.AuthorizeSecurityGroup(ec2.SecurityGroup{Name: name}, perms[0:2]) - c.Assert(err, ErrorMatches, `.*\(InvalidPermission.Duplicate\)`) -} - -type filterSpec struct { - name string - values []string -} - -func (s *ServerTests) TestInstanceFiltering(c *C) { - groupResp, err := s.ec2.CreateSecurityGroup(ec2.SecurityGroup{Name: sessionName("testgroup1"), Description: "testgroup one description"}) - c.Assert(err, IsNil) - group1 := groupResp.SecurityGroup - defer s.ec2.DeleteSecurityGroup(group1) - - groupResp, err = s.ec2.CreateSecurityGroup(ec2.SecurityGroup{Name: sessionName("testgroup2"), Description: "testgroup two description"}) - c.Assert(err, IsNil) - group2 := groupResp.SecurityGroup - defer s.ec2.DeleteSecurityGroup(group2) - - insts := make([]*ec2.Instance, 3) - inst, err := s.ec2.RunInstances(&ec2.RunInstances{ - MinCount: 2, - ImageId: imageId, - InstanceType: "t1.micro", - SecurityGroups: []ec2.SecurityGroup{group1}, - }) - c.Assert(err, IsNil) - insts[0] = &inst.Instances[0] - insts[1] = &inst.Instances[1] - defer terminateInstances(c, s.ec2, insts) - - imageId2 := "ami-e358958a" // Natty server, i386, EBS store - inst, err = s.ec2.RunInstances(&ec2.RunInstances{ - ImageId: imageId2, - InstanceType: "t1.micro", - SecurityGroups: []ec2.SecurityGroup{group2}, - }) - c.Assert(err, IsNil) - insts[2] = &inst.Instances[0] - - ids := func(indices ...int) (instIds []string) { - for _, index := range indices { - instIds = append(instIds, insts[index].InstanceId) - } - return - } - - tests := []struct { - about string - instanceIds []string // instanceIds argument to Instances method. - filters []filterSpec // filters argument to Instances method. - resultIds []string // set of instance ids of expected results. - allowExtra bool // resultIds may be incomplete. - err string // expected error. - }{ - { - about: "check that Instances returns all instances", - resultIds: ids(0, 1, 2), - allowExtra: true, - }, { - about: "check that specifying two instance ids returns them", - instanceIds: ids(0, 2), - resultIds: ids(0, 2), - }, { - about: "check that specifying a non-existent instance id gives an error", - instanceIds: append(ids(0), "i-deadbeef"), - err: `.*\(InvalidInstanceID\.NotFound\)`, - }, { - about: "check that a filter allowed both instances returns both of them", - filters: []filterSpec{ - {"instance-id", ids(0, 2)}, - }, - resultIds: ids(0, 2), - }, { - about: "check that a filter allowing only one instance returns it", - filters: []filterSpec{ - {"instance-id", ids(1)}, - }, - resultIds: ids(1), - }, { - about: "check that a filter allowing no instances returns none", - filters: []filterSpec{ - {"instance-id", []string{"i-deadbeef12345"}}, - }, - }, { - about: "check that filtering on group id works", - filters: []filterSpec{ - {"group-id", []string{group1.Id}}, - }, - resultIds: ids(0, 1), - }, { - about: "check that filtering on group name works", - filters: []filterSpec{ - {"group-name", []string{group1.Name}}, - }, - resultIds: ids(0, 1), - }, { - about: "check that filtering on image id works", - filters: []filterSpec{ - {"image-id", []string{imageId}}, - }, - resultIds: ids(0, 1), - allowExtra: true, - }, { - about: "combination filters 1", - filters: []filterSpec{ - {"image-id", []string{imageId, imageId2}}, - {"group-name", []string{group1.Name}}, - }, - resultIds: ids(0, 1), - }, { - about: "combination filters 2", - filters: []filterSpec{ - {"image-id", []string{imageId2}}, - {"group-name", []string{group1.Name}}, - }, - }, - } - for i, t := range tests { - c.Logf("%d. %s", i, t.about) - var f *ec2.Filter - if t.filters != nil { - f = ec2.NewFilter() - for _, spec := range t.filters { - f.Add(spec.name, spec.values...) - } - } - resp, err := s.ec2.Instances(t.instanceIds, f) - if t.err != "" { - c.Check(err, ErrorMatches, t.err) - continue - } - c.Assert(err, IsNil) - insts := make(map[string]*ec2.Instance) - for _, r := range resp.Reservations { - for j := range r.Instances { - inst := &r.Instances[j] - c.Check(insts[inst.InstanceId], IsNil, Commentf("duplicate instance id: %q", inst.InstanceId)) - insts[inst.InstanceId] = inst - } - } - if !t.allowExtra { - c.Check(insts, HasLen, len(t.resultIds), Commentf("expected %d instances got %#v", len(t.resultIds), insts)) - } - for j, id := range t.resultIds { - c.Check(insts[id], NotNil, Commentf("instance id %d (%q) not found; got %#v", j, id, insts)) - } - } -} - -func idsOnly(gs []ec2.SecurityGroup) []ec2.SecurityGroup { - for i := range gs { - gs[i].Name = "" - } - return gs -} - -func namesOnly(gs []ec2.SecurityGroup) []ec2.SecurityGroup { - for i := range gs { - gs[i].Id = "" - } - return gs -} - -func (s *ServerTests) TestGroupFiltering(c *C) { - g := make([]ec2.SecurityGroup, 4) - for i := range g { - resp, err := s.ec2.CreateSecurityGroup(ec2.SecurityGroup{Name: sessionName(fmt.Sprintf("testgroup%d", i)), Description: fmt.Sprintf("testdescription%d", i)}) - c.Assert(err, IsNil) - g[i] = resp.SecurityGroup - c.Logf("group %d: %v", i, g[i]) - defer s.ec2.DeleteSecurityGroup(g[i]) - } - - perms := [][]ec2.IPPerm{ - {{ - Protocol: "tcp", - FromPort: 100, - ToPort: 200, - SourceIPs: []string{"1.2.3.4/32"}, - }}, - {{ - Protocol: "tcp", - FromPort: 200, - ToPort: 300, - SourceGroups: []ec2.UserSecurityGroup{{Id: g[1].Id}}, - }}, - {{ - Protocol: "udp", - FromPort: 200, - ToPort: 400, - SourceGroups: []ec2.UserSecurityGroup{{Id: g[1].Id}}, - }}, - } - for i, ps := range perms { - _, err := s.ec2.AuthorizeSecurityGroup(g[i], ps) - c.Assert(err, IsNil) - } - - groups := func(indices ...int) (gs []ec2.SecurityGroup) { - for _, index := range indices { - gs = append(gs, g[index]) - } - return - } - - type groupTest struct { - about string - groups []ec2.SecurityGroup // groupIds argument to SecurityGroups method. - filters []filterSpec // filters argument to SecurityGroups method. - results []ec2.SecurityGroup // set of expected result groups. - allowExtra bool // specified results may be incomplete. - err string // expected error. - } - filterCheck := func(name, val string, gs []ec2.SecurityGroup) groupTest { - return groupTest{ - about: "filter check " + name, - filters: []filterSpec{{name, []string{val}}}, - results: gs, - allowExtra: true, - } - } - tests := []groupTest{ - { - about: "check that SecurityGroups returns all groups", - results: groups(0, 1, 2, 3), - allowExtra: true, - }, { - about: "check that specifying two group ids returns them", - groups: idsOnly(groups(0, 2)), - results: groups(0, 2), - }, { - about: "check that specifying names only works", - groups: namesOnly(groups(0, 2)), - results: groups(0, 2), - }, { - about: "check that specifying a non-existent group id gives an error", - groups: append(groups(0), ec2.SecurityGroup{Id: "sg-eeeeeeeee"}), - err: `.*\(InvalidGroup\.NotFound\)`, - }, { - about: "check that a filter allowed two groups returns both of them", - filters: []filterSpec{ - {"group-id", []string{g[0].Id, g[2].Id}}, - }, - results: groups(0, 2), - }, - { - about: "check that the previous filter works when specifying a list of ids", - groups: groups(1, 2), - filters: []filterSpec{ - {"group-id", []string{g[0].Id, g[2].Id}}, - }, - results: groups(2), - }, { - about: "check that a filter allowing no groups returns none", - filters: []filterSpec{ - {"group-id", []string{"sg-eeeeeeeee"}}, - }, - }, - filterCheck("description", "testdescription1", groups(1)), - filterCheck("group-name", g[2].Name, groups(2)), - filterCheck("ip-permission.cidr", "1.2.3.4/32", groups(0)), - filterCheck("ip-permission.group-name", g[1].Name, groups(1, 2)), - filterCheck("ip-permission.protocol", "udp", groups(2)), - filterCheck("ip-permission.from-port", "200", groups(1, 2)), - filterCheck("ip-permission.to-port", "200", groups(0)), - // TODO owner-id - } - for i, t := range tests { - c.Logf("%d. %s", i, t.about) - var f *ec2.Filter - if t.filters != nil { - f = ec2.NewFilter() - for _, spec := range t.filters { - f.Add(spec.name, spec.values...) - } - } - resp, err := s.ec2.SecurityGroups(t.groups, f) - if t.err != "" { - c.Check(err, ErrorMatches, t.err) - continue - } - c.Assert(err, IsNil) - groups := make(map[string]*ec2.SecurityGroup) - for j := range resp.Groups { - group := &resp.Groups[j].SecurityGroup - c.Check(groups[group.Id], IsNil, Commentf("duplicate group id: %q", group.Id)) - - groups[group.Id] = group - } - // If extra groups may be returned, eliminate all groups that - // we did not create in this session apart from the default group. - if t.allowExtra { - namePat := regexp.MustCompile(sessionName("testgroup[0-9]")) - for id, g := range groups { - if !namePat.MatchString(g.Name) { - delete(groups, id) - } - } - } - c.Check(groups, HasLen, len(t.results)) - for j, g := range t.results { - rg := groups[g.Id] - c.Assert(rg, NotNil, Commentf("group %d (%v) not found; got %#v", j, g, groups)) - c.Check(rg.Name, Equals, g.Name, Commentf("group %d (%v)", j, g)) - } - } -} diff --git a/Godeps/_workspace/src/github.com/mitchellh/goamz/ec2/ec2test/filter.go b/Godeps/_workspace/src/github.com/mitchellh/goamz/ec2/ec2test/filter.go deleted file mode 100644 index 1a0c0461937..00000000000 --- a/Godeps/_workspace/src/github.com/mitchellh/goamz/ec2/ec2test/filter.go +++ /dev/null @@ -1,84 +0,0 @@ -package ec2test - -import ( - "fmt" - "net/url" - "strings" -) - -// filter holds an ec2 filter. A filter maps an attribute to a set of -// possible values for that attribute. For an item to pass through the -// filter, every attribute of the item mentioned in the filter must match -// at least one of its given values. -type filter map[string][]string - -// newFilter creates a new filter from the Filter fields in the url form. -// -// The filtering is specified through a map of name=>values, where the -// name is a well-defined key identifying the data to be matched, -// and the list of values holds the possible values the filtered -// item can take for the key to be included in the -// result set. For example: -// -// Filter.1.Name=instance-type -// Filter.1.Value.1=m1.small -// Filter.1.Value.2=m1.large -// -func newFilter(form url.Values) filter { - // TODO return an error if the fields are not well formed? - names := make(map[int]string) - values := make(map[int][]string) - maxId := 0 - for name, fvalues := range form { - var rest string - var id int - if x, _ := fmt.Sscanf(name, "Filter.%d.%s", &id, &rest); x != 2 { - continue - } - if id > maxId { - maxId = id - } - if rest == "Name" { - names[id] = fvalues[0] - continue - } - if !strings.HasPrefix(rest, "Value.") { - continue - } - values[id] = append(values[id], fvalues[0]) - } - - f := make(filter) - for id, name := range names { - f[name] = values[id] - } - return f -} - -func notDigit(r rune) bool { - return r < '0' || r > '9' -} - -// filterable represents an object that can be passed through a filter. -type filterable interface { - // matchAttr returns true if given attribute of the - // object matches value. It returns an error if the - // attribute is not recognised or the value is malformed. - matchAttr(attr, value string) (bool, error) -} - -// ok returns true if x passes through the filter. -func (f filter) ok(x filterable) (bool, error) { -next: - for a, vs := range f { - for _, v := range vs { - if ok, err := x.matchAttr(a, v); ok { - continue next - } else if err != nil { - return false, fmt.Errorf("bad attribute or value %q=%q for type %T: %v", a, v, x, err) - } - } - return false, nil - } - return true, nil -} diff --git a/Godeps/_workspace/src/github.com/mitchellh/goamz/ec2/ec2test/server.go b/Godeps/_workspace/src/github.com/mitchellh/goamz/ec2/ec2test/server.go deleted file mode 100644 index 2f24cb2a244..00000000000 --- a/Godeps/_workspace/src/github.com/mitchellh/goamz/ec2/ec2test/server.go +++ /dev/null @@ -1,993 +0,0 @@ -// The ec2test package implements a fake EC2 provider with -// the capability of inducing errors on any given operation, -// and retrospectively determining what operations have been -// carried out. -package ec2test - -import ( - "encoding/base64" - "encoding/xml" - "fmt" - "github.com/mitchellh/goamz/ec2" - "io" - "net" - "net/http" - "net/url" - "regexp" - "strconv" - "strings" - "sync" -) - -var b64 = base64.StdEncoding - -// Action represents a request that changes the ec2 state. -type Action struct { - RequestId string - - // Request holds the requested action as a url.Values instance - Request url.Values - - // If the action succeeded, Response holds the value that - // was marshalled to build the XML response for the request. - Response interface{} - - // If the action failed, Err holds an error giving details of the failure. - Err *ec2.Error -} - -// TODO possible other things: -// - some virtual time stamp interface, so a client -// can ask for all actions after a certain virtual time. - -// Server implements an EC2 simulator for use in testing. -type Server struct { - url string - listener net.Listener - mu sync.Mutex - reqs []*Action - - instances map[string]*Instance // id -> instance - reservations map[string]*reservation // id -> reservation - groups map[string]*securityGroup // id -> group - maxId counter - reqId counter - reservationId counter - groupId counter - initialInstanceState ec2.InstanceState -} - -// reservation holds a simulated ec2 reservation. -type reservation struct { - id string - instances map[string]*Instance - groups []*securityGroup -} - -// instance holds a simulated ec2 instance -type Instance struct { - // UserData holds the data that was passed to the RunInstances request - // when the instance was started. - UserData []byte - id string - imageId string - reservation *reservation - instType string - state ec2.InstanceState -} - -// permKey represents permission for a given security -// group or IP address (but not both) to access a given range of -// ports. Equality of permKeys is used in the implementation of -// permission sets, relying on the uniqueness of securityGroup -// instances. -type permKey struct { - protocol string - fromPort int - toPort int - group *securityGroup - ipAddr string -} - -// securityGroup holds a simulated ec2 security group. -// Instances of securityGroup should only be created through -// Server.createSecurityGroup to ensure that groups can be -// compared by pointer value. -type securityGroup struct { - id string - name string - description string - - perms map[permKey]bool -} - -func (g *securityGroup) ec2SecurityGroup() ec2.SecurityGroup { - return ec2.SecurityGroup{ - Name: g.name, - Id: g.id, - } -} - -func (g *securityGroup) matchAttr(attr, value string) (ok bool, err error) { - switch attr { - case "description": - return g.description == value, nil - case "group-id": - return g.id == value, nil - case "group-name": - return g.name == value, nil - case "ip-permission.cidr": - return g.hasPerm(func(k permKey) bool { return k.ipAddr == value }), nil - case "ip-permission.group-name": - return g.hasPerm(func(k permKey) bool { - return k.group != nil && k.group.name == value - }), nil - case "ip-permission.from-port": - port, err := strconv.Atoi(value) - if err != nil { - return false, err - } - return g.hasPerm(func(k permKey) bool { return k.fromPort == port }), nil - case "ip-permission.to-port": - port, err := strconv.Atoi(value) - if err != nil { - return false, err - } - return g.hasPerm(func(k permKey) bool { return k.toPort == port }), nil - case "ip-permission.protocol": - return g.hasPerm(func(k permKey) bool { return k.protocol == value }), nil - case "owner-id": - return value == ownerId, nil - } - return false, fmt.Errorf("unknown attribute %q", attr) -} - -func (g *securityGroup) hasPerm(test func(k permKey) bool) bool { - for k := range g.perms { - if test(k) { - return true - } - } - return false -} - -// ec2Perms returns the list of EC2 permissions granted -// to g. It groups permissions by port range and protocol. -func (g *securityGroup) ec2Perms() (perms []ec2.IPPerm) { - // The grouping is held in result. We use permKey for convenience, - // (ensuring that the group and ipAddr of each key is zero). For - // each protocol/port range combination, we build up the permission - // set in the associated value. - result := make(map[permKey]*ec2.IPPerm) - for k := range g.perms { - groupKey := k - groupKey.group = nil - groupKey.ipAddr = "" - - ec2p := result[groupKey] - if ec2p == nil { - ec2p = &ec2.IPPerm{ - Protocol: k.protocol, - FromPort: k.fromPort, - ToPort: k.toPort, - } - result[groupKey] = ec2p - } - if k.group != nil { - ec2p.SourceGroups = append(ec2p.SourceGroups, - ec2.UserSecurityGroup{ - Id: k.group.id, - Name: k.group.name, - OwnerId: ownerId, - }) - } else { - ec2p.SourceIPs = append(ec2p.SourceIPs, k.ipAddr) - } - } - for _, ec2p := range result { - perms = append(perms, *ec2p) - } - return -} - -var actions = map[string]func(*Server, http.ResponseWriter, *http.Request, string) interface{}{ - "RunInstances": (*Server).runInstances, - "TerminateInstances": (*Server).terminateInstances, - "DescribeInstances": (*Server).describeInstances, - "CreateSecurityGroup": (*Server).createSecurityGroup, - "DescribeSecurityGroups": (*Server).describeSecurityGroups, - "DeleteSecurityGroup": (*Server).deleteSecurityGroup, - "AuthorizeSecurityGroupIngress": (*Server).authorizeSecurityGroupIngress, - "RevokeSecurityGroupIngress": (*Server).revokeSecurityGroupIngress, -} - -const ownerId = "9876" - -// newAction allocates a new action and adds it to the -// recorded list of server actions. -func (srv *Server) newAction() *Action { - srv.mu.Lock() - defer srv.mu.Unlock() - - a := new(Action) - srv.reqs = append(srv.reqs, a) - return a -} - -// NewServer returns a new server. -func NewServer() (*Server, error) { - srv := &Server{ - instances: make(map[string]*Instance), - groups: make(map[string]*securityGroup), - reservations: make(map[string]*reservation), - initialInstanceState: Pending, - } - - // Add default security group. - g := &securityGroup{ - name: "default", - description: "default group", - id: fmt.Sprintf("sg-%d", srv.groupId.next()), - } - g.perms = map[permKey]bool{ - permKey{ - protocol: "icmp", - fromPort: -1, - toPort: -1, - group: g, - }: true, - permKey{ - protocol: "tcp", - fromPort: 0, - toPort: 65535, - group: g, - }: true, - permKey{ - protocol: "udp", - fromPort: 0, - toPort: 65535, - group: g, - }: true, - } - srv.groups[g.id] = g - - l, err := net.Listen("tcp", "localhost:0") - if err != nil { - return nil, fmt.Errorf("cannot listen on localhost: %v", err) - } - srv.listener = l - - srv.url = "http://" + l.Addr().String() - - // we use HandlerFunc rather than *Server directly so that we - // can avoid exporting HandlerFunc from *Server. - go http.Serve(l, http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) { - srv.serveHTTP(w, req) - })) - return srv, nil -} - -// Quit closes down the server. -func (srv *Server) Quit() { - srv.listener.Close() -} - -// SetInitialInstanceState sets the state that any new instances will be started in. -func (srv *Server) SetInitialInstanceState(state ec2.InstanceState) { - srv.mu.Lock() - srv.initialInstanceState = state - srv.mu.Unlock() -} - -// URL returns the URL of the server. -func (srv *Server) URL() string { - return srv.url -} - -// serveHTTP serves the EC2 protocol. -func (srv *Server) serveHTTP(w http.ResponseWriter, req *http.Request) { - req.ParseForm() - - a := srv.newAction() - a.RequestId = fmt.Sprintf("req%d", srv.reqId.next()) - a.Request = req.Form - - // Methods on Server that deal with parsing user data - // may fail. To save on error handling code, we allow these - // methods to call fatalf, which will panic with an *ec2.Error - // which will be caught here and returned - // to the client as a properly formed EC2 error. - defer func() { - switch err := recover().(type) { - case *ec2.Error: - a.Err = err - err.RequestId = a.RequestId - writeError(w, err) - case nil: - default: - panic(err) - } - }() - - f := actions[req.Form.Get("Action")] - if f == nil { - fatalf(400, "InvalidParameterValue", "Unrecognized Action") - } - - response := f(srv, w, req, a.RequestId) - a.Response = response - - w.Header().Set("Content-Type", `xml version="1.0" encoding="UTF-8"`) - xmlMarshal(w, response) -} - -// Instance returns the instance for the given instance id. -// It returns nil if there is no such instance. -func (srv *Server) Instance(id string) *Instance { - srv.mu.Lock() - defer srv.mu.Unlock() - return srv.instances[id] -} - -// writeError writes an appropriate error response. -// TODO how should we deal with errors when the -// error itself is potentially generated by backend-agnostic -// code? -func writeError(w http.ResponseWriter, err *ec2.Error) { - // Error encapsulates an error returned by EC2. - // TODO merge with ec2.Error when xml supports ignoring a field. - type ec2error struct { - Code string // EC2 error code ("UnsupportedOperation", ...) - Message string // The human-oriented error message - RequestId string - } - - type Response struct { - RequestId string - Errors []ec2error `xml:"Errors>Error"` - } - - w.Header().Set("Content-Type", `xml version="1.0" encoding="UTF-8"`) - w.WriteHeader(err.StatusCode) - xmlMarshal(w, Response{ - RequestId: err.RequestId, - Errors: []ec2error{{ - Code: err.Code, - Message: err.Message, - }}, - }) -} - -// xmlMarshal is the same as xml.Marshal except that -// it panics on error. The marshalling should not fail, -// but we want to know if it does. -func xmlMarshal(w io.Writer, x interface{}) { - if err := xml.NewEncoder(w).Encode(x); err != nil { - panic(fmt.Errorf("error marshalling %#v: %v", x, err)) - } -} - -// formToGroups parses a set of SecurityGroup form values -// as found in a RunInstances request, and returns the resulting -// slice of security groups. -// It calls fatalf if a group is not found. -func (srv *Server) formToGroups(form url.Values) []*securityGroup { - var groups []*securityGroup - for name, values := range form { - switch { - case strings.HasPrefix(name, "SecurityGroupId."): - if g := srv.groups[values[0]]; g != nil { - groups = append(groups, g) - } else { - fatalf(400, "InvalidGroup.NotFound", "unknown group id %q", values[0]) - } - case strings.HasPrefix(name, "SecurityGroup."): - var found *securityGroup - for _, g := range srv.groups { - if g.name == values[0] { - found = g - } - } - if found == nil { - fatalf(400, "InvalidGroup.NotFound", "unknown group name %q", values[0]) - } - groups = append(groups, found) - } - } - return groups -} - -// runInstances implements the EC2 RunInstances entry point. -func (srv *Server) runInstances(w http.ResponseWriter, req *http.Request, reqId string) interface{} { - min := atoi(req.Form.Get("MinCount")) - max := atoi(req.Form.Get("MaxCount")) - if min < 0 || max < 1 { - fatalf(400, "InvalidParameterValue", "bad values for MinCount or MaxCount") - } - if min > max { - fatalf(400, "InvalidParameterCombination", "MinCount is greater than MaxCount") - } - var userData []byte - if data := req.Form.Get("UserData"); data != "" { - var err error - userData, err = b64.DecodeString(data) - if err != nil { - fatalf(400, "InvalidParameterValue", "bad UserData value: %v", err) - } - } - - // TODO attributes still to consider: - // ImageId: accept anything, we can verify later - // KeyName ? - // InstanceType ? - // KernelId ? - // RamdiskId ? - // AvailZone ? - // GroupName tag - // Monitoring ignore? - // SubnetId ? - // DisableAPITermination bool - // ShutdownBehavior string - // PrivateIPAddress string - - srv.mu.Lock() - defer srv.mu.Unlock() - - // make sure that form fields are correct before creating the reservation. - instType := req.Form.Get("InstanceType") - imageId := req.Form.Get("ImageId") - - r := srv.newReservation(srv.formToGroups(req.Form)) - - var resp ec2.RunInstancesResp - resp.RequestId = reqId - resp.ReservationId = r.id - resp.OwnerId = ownerId - - for i := 0; i < max; i++ { - inst := srv.newInstance(r, instType, imageId, srv.initialInstanceState) - inst.UserData = userData - resp.Instances = append(resp.Instances, inst.ec2instance()) - } - return &resp -} - -func (srv *Server) group(group ec2.SecurityGroup) *securityGroup { - if group.Id != "" { - return srv.groups[group.Id] - } - for _, g := range srv.groups { - if g.name == group.Name { - return g - } - } - return nil -} - -// NewInstances creates n new instances in srv with the given instance type, -// image ID, initial state and security groups. If any group does not already -// exist, it will be created. NewInstances returns the ids of the new instances. -func (srv *Server) NewInstances(n int, instType string, imageId string, state ec2.InstanceState, groups []ec2.SecurityGroup) []string { - srv.mu.Lock() - defer srv.mu.Unlock() - - rgroups := make([]*securityGroup, len(groups)) - for i, group := range groups { - g := srv.group(group) - if g == nil { - fatalf(400, "InvalidGroup.NotFound", "no such group %v", g) - } - rgroups[i] = g - } - r := srv.newReservation(rgroups) - - ids := make([]string, n) - for i := 0; i < n; i++ { - inst := srv.newInstance(r, instType, imageId, state) - ids[i] = inst.id - } - return ids -} - -func (srv *Server) newInstance(r *reservation, instType string, imageId string, state ec2.InstanceState) *Instance { - inst := &Instance{ - id: fmt.Sprintf("i-%d", srv.maxId.next()), - instType: instType, - imageId: imageId, - state: state, - reservation: r, - } - srv.instances[inst.id] = inst - r.instances[inst.id] = inst - return inst -} - -func (srv *Server) newReservation(groups []*securityGroup) *reservation { - r := &reservation{ - id: fmt.Sprintf("r-%d", srv.reservationId.next()), - instances: make(map[string]*Instance), - groups: groups, - } - - srv.reservations[r.id] = r - return r -} - -func (srv *Server) terminateInstances(w http.ResponseWriter, req *http.Request, reqId string) interface{} { - srv.mu.Lock() - defer srv.mu.Unlock() - var resp ec2.TerminateInstancesResp - resp.RequestId = reqId - var insts []*Instance - for attr, vals := range req.Form { - if strings.HasPrefix(attr, "InstanceId.") { - id := vals[0] - inst := srv.instances[id] - if inst == nil { - fatalf(400, "InvalidInstanceID.NotFound", "no such instance id %q", id) - } - insts = append(insts, inst) - } - } - for _, inst := range insts { - resp.StateChanges = append(resp.StateChanges, inst.terminate()) - } - return &resp -} - -func (inst *Instance) terminate() (d ec2.InstanceStateChange) { - d.PreviousState = inst.state - inst.state = ShuttingDown - d.CurrentState = inst.state - d.InstanceId = inst.id - return d -} - -func (inst *Instance) ec2instance() ec2.Instance { - return ec2.Instance{ - InstanceId: inst.id, - InstanceType: inst.instType, - ImageId: inst.imageId, - DNSName: fmt.Sprintf("%s.example.com", inst.id), - // TODO the rest - } -} - -func (inst *Instance) matchAttr(attr, value string) (ok bool, err error) { - switch attr { - case "architecture": - return value == "i386", nil - case "instance-id": - return inst.id == value, nil - case "group-id": - for _, g := range inst.reservation.groups { - if g.id == value { - return true, nil - } - } - return false, nil - case "group-name": - for _, g := range inst.reservation.groups { - if g.name == value { - return true, nil - } - } - return false, nil - case "image-id": - return value == inst.imageId, nil - case "instance-state-code": - code, err := strconv.Atoi(value) - if err != nil { - return false, err - } - return code&0xff == inst.state.Code, nil - case "instance-state-name": - return value == inst.state.Name, nil - } - return false, fmt.Errorf("unknown attribute %q", attr) -} - -var ( - Pending = ec2.InstanceState{0, "pending"} - Running = ec2.InstanceState{16, "running"} - ShuttingDown = ec2.InstanceState{32, "shutting-down"} - Terminated = ec2.InstanceState{16, "terminated"} - Stopped = ec2.InstanceState{16, "stopped"} -) - -func (srv *Server) createSecurityGroup(w http.ResponseWriter, req *http.Request, reqId string) interface{} { - name := req.Form.Get("GroupName") - if name == "" { - fatalf(400, "InvalidParameterValue", "empty security group name") - } - srv.mu.Lock() - defer srv.mu.Unlock() - if srv.group(ec2.SecurityGroup{Name: name}) != nil { - fatalf(400, "InvalidGroup.Duplicate", "group %q already exists", name) - } - g := &securityGroup{ - name: name, - description: req.Form.Get("GroupDescription"), - id: fmt.Sprintf("sg-%d", srv.groupId.next()), - perms: make(map[permKey]bool), - } - srv.groups[g.id] = g - // we define a local type for this because ec2.CreateSecurityGroupResp - // contains SecurityGroup, but the response to this request - // should not contain the security group name. - type CreateSecurityGroupResponse struct { - RequestId string `xml:"requestId"` - Return bool `xml:"return"` - GroupId string `xml:"groupId"` - } - r := &CreateSecurityGroupResponse{ - RequestId: reqId, - Return: true, - GroupId: g.id, - } - return r -} - -func (srv *Server) notImplemented(w http.ResponseWriter, req *http.Request, reqId string) interface{} { - fatalf(500, "InternalError", "not implemented") - panic("not reached") -} - -func (srv *Server) describeInstances(w http.ResponseWriter, req *http.Request, reqId string) interface{} { - srv.mu.Lock() - defer srv.mu.Unlock() - insts := make(map[*Instance]bool) - for name, vals := range req.Form { - if !strings.HasPrefix(name, "InstanceId.") { - continue - } - inst := srv.instances[vals[0]] - if inst == nil { - fatalf(400, "InvalidInstanceID.NotFound", "instance %q not found", vals[0]) - } - insts[inst] = true - } - - f := newFilter(req.Form) - - var resp ec2.InstancesResp - resp.RequestId = reqId - for _, r := range srv.reservations { - var instances []ec2.Instance - for _, inst := range r.instances { - if len(insts) > 0 && !insts[inst] { - continue - } - ok, err := f.ok(inst) - if ok { - instances = append(instances, inst.ec2instance()) - } else if err != nil { - fatalf(400, "InvalidParameterValue", "describe instances: %v", err) - } - } - if len(instances) > 0 { - var groups []ec2.SecurityGroup - for _, g := range r.groups { - groups = append(groups, g.ec2SecurityGroup()) - } - resp.Reservations = append(resp.Reservations, ec2.Reservation{ - ReservationId: r.id, - OwnerId: ownerId, - Instances: instances, - SecurityGroups: groups, - }) - } - } - return &resp -} - -func (srv *Server) describeSecurityGroups(w http.ResponseWriter, req *http.Request, reqId string) interface{} { - // BUG similar bug to describeInstances, but for GroupName and GroupId - srv.mu.Lock() - defer srv.mu.Unlock() - - var groups []*securityGroup - for name, vals := range req.Form { - var g ec2.SecurityGroup - switch { - case strings.HasPrefix(name, "GroupName."): - g.Name = vals[0] - case strings.HasPrefix(name, "GroupId."): - g.Id = vals[0] - default: - continue - } - sg := srv.group(g) - if sg == nil { - fatalf(400, "InvalidGroup.NotFound", "no such group %v", g) - } - groups = append(groups, sg) - } - if len(groups) == 0 { - for _, g := range srv.groups { - groups = append(groups, g) - } - } - - f := newFilter(req.Form) - var resp ec2.SecurityGroupsResp - resp.RequestId = reqId - for _, group := range groups { - ok, err := f.ok(group) - if ok { - resp.Groups = append(resp.Groups, ec2.SecurityGroupInfo{ - OwnerId: ownerId, - SecurityGroup: group.ec2SecurityGroup(), - Description: group.description, - IPPerms: group.ec2Perms(), - }) - } else if err != nil { - fatalf(400, "InvalidParameterValue", "describe security groups: %v", err) - } - } - return &resp -} - -func (srv *Server) authorizeSecurityGroupIngress(w http.ResponseWriter, req *http.Request, reqId string) interface{} { - srv.mu.Lock() - defer srv.mu.Unlock() - g := srv.group(ec2.SecurityGroup{ - Name: req.Form.Get("GroupName"), - Id: req.Form.Get("GroupId"), - }) - if g == nil { - fatalf(400, "InvalidGroup.NotFound", "group not found") - } - perms := srv.parsePerms(req) - - for _, p := range perms { - if g.perms[p] { - fatalf(400, "InvalidPermission.Duplicate", "Permission has already been authorized on the specified group") - } - } - for _, p := range perms { - g.perms[p] = true - } - return &ec2.SimpleResp{ - XMLName: xml.Name{"", "AuthorizeSecurityGroupIngressResponse"}, - RequestId: reqId, - } -} - -func (srv *Server) revokeSecurityGroupIngress(w http.ResponseWriter, req *http.Request, reqId string) interface{} { - srv.mu.Lock() - defer srv.mu.Unlock() - g := srv.group(ec2.SecurityGroup{ - Name: req.Form.Get("GroupName"), - Id: req.Form.Get("GroupId"), - }) - if g == nil { - fatalf(400, "InvalidGroup.NotFound", "group not found") - } - perms := srv.parsePerms(req) - - // Note EC2 does not give an error if asked to revoke an authorization - // that does not exist. - for _, p := range perms { - delete(g.perms, p) - } - return &ec2.SimpleResp{ - XMLName: xml.Name{"", "RevokeSecurityGroupIngressResponse"}, - RequestId: reqId, - } -} - -var secGroupPat = regexp.MustCompile(`^sg-[a-z0-9]+$`) -var ipPat = regexp.MustCompile(`^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+/[0-9]+$`) -var ownerIdPat = regexp.MustCompile(`^[0-9]+$`) - -// parsePerms returns a slice of permKey values extracted -// from the permission fields in req. -func (srv *Server) parsePerms(req *http.Request) []permKey { - // perms maps an index found in the form to its associated - // IPPerm. For instance, the form value with key - // "IpPermissions.3.FromPort" will be stored in perms[3].FromPort - perms := make(map[int]ec2.IPPerm) - - type subgroupKey struct { - id1, id2 int - } - // Each IPPerm can have many source security groups. The form key - // for a source security group contains two indices: the index - // of the IPPerm and the sub-index of the security group. The - // sourceGroups map maps from a subgroupKey containing these - // two indices to the associated security group. For instance, - // the form value with key "IPPermissions.3.Groups.2.GroupName" - // will be stored in sourceGroups[subgroupKey{3, 2}].Name. - sourceGroups := make(map[subgroupKey]ec2.UserSecurityGroup) - - // For each value in the form we store its associated information in the - // above maps. The maps are necessary because the form keys may - // arrive in any order, and the indices are not - // necessarily sequential or even small. - for name, vals := range req.Form { - val := vals[0] - var id1 int - var rest string - if x, _ := fmt.Sscanf(name, "IpPermissions.%d.%s", &id1, &rest); x != 2 { - continue - } - ec2p := perms[id1] - switch { - case rest == "FromPort": - ec2p.FromPort = atoi(val) - case rest == "ToPort": - ec2p.ToPort = atoi(val) - case rest == "IpProtocol": - switch val { - case "tcp", "udp", "icmp": - ec2p.Protocol = val - default: - // check it's a well formed number - atoi(val) - ec2p.Protocol = val - } - case strings.HasPrefix(rest, "Groups."): - k := subgroupKey{id1: id1} - if x, _ := fmt.Sscanf(rest[len("Groups."):], "%d.%s", &k.id2, &rest); x != 2 { - continue - } - g := sourceGroups[k] - switch rest { - case "UserId": - // BUG if the user id is blank, this does not conform to the - // way that EC2 handles it - a specified but blank owner id - // can cause RevokeSecurityGroupIngress to fail with - // "group not found" even if the security group id has been - // correctly specified. - // By failing here, we ensure that we fail early in this case. - if !ownerIdPat.MatchString(val) { - fatalf(400, "InvalidUserID.Malformed", "Invalid user ID: %q", val) - } - g.OwnerId = val - case "GroupName": - g.Name = val - case "GroupId": - if !secGroupPat.MatchString(val) { - fatalf(400, "InvalidGroupId.Malformed", "Invalid group ID: %q", val) - } - g.Id = val - default: - fatalf(400, "UnknownParameter", "unknown parameter %q", name) - } - sourceGroups[k] = g - case strings.HasPrefix(rest, "IpRanges."): - var id2 int - if x, _ := fmt.Sscanf(rest[len("IpRanges."):], "%d.%s", &id2, &rest); x != 2 { - continue - } - switch rest { - case "CidrIp": - if !ipPat.MatchString(val) { - fatalf(400, "InvalidPermission.Malformed", "Invalid IP range: %q", val) - } - ec2p.SourceIPs = append(ec2p.SourceIPs, val) - default: - fatalf(400, "UnknownParameter", "unknown parameter %q", name) - } - default: - fatalf(400, "UnknownParameter", "unknown parameter %q", name) - } - perms[id1] = ec2p - } - // Associate each set of source groups with its IPPerm. - for k, g := range sourceGroups { - p := perms[k.id1] - p.SourceGroups = append(p.SourceGroups, g) - perms[k.id1] = p - } - - // Now that we have built up the IPPerms we need, we check for - // parameter errors and build up a permKey for each permission, - // looking up security groups from srv as we do so. - var result []permKey - for _, p := range perms { - if p.FromPort > p.ToPort { - fatalf(400, "InvalidParameterValue", "invalid port range") - } - k := permKey{ - protocol: p.Protocol, - fromPort: p.FromPort, - toPort: p.ToPort, - } - for _, g := range p.SourceGroups { - if g.OwnerId != "" && g.OwnerId != ownerId { - fatalf(400, "InvalidGroup.NotFound", "group %q not found", g.Name) - } - var ec2g ec2.SecurityGroup - switch { - case g.Id != "": - ec2g.Id = g.Id - case g.Name != "": - ec2g.Name = g.Name - } - k.group = srv.group(ec2g) - if k.group == nil { - fatalf(400, "InvalidGroup.NotFound", "group %v not found", g) - } - result = append(result, k) - } - k.group = nil - for _, ip := range p.SourceIPs { - k.ipAddr = ip - result = append(result, k) - } - } - return result -} - -func (srv *Server) deleteSecurityGroup(w http.ResponseWriter, req *http.Request, reqId string) interface{} { - srv.mu.Lock() - defer srv.mu.Unlock() - g := srv.group(ec2.SecurityGroup{ - Name: req.Form.Get("GroupName"), - Id: req.Form.Get("GroupId"), - }) - if g == nil { - fatalf(400, "InvalidGroup.NotFound", "group not found") - } - for _, r := range srv.reservations { - for _, h := range r.groups { - if h == g && r.hasRunningMachine() { - fatalf(500, "InvalidGroup.InUse", "group is currently in use by a running instance") - } - } - } - for _, sg := range srv.groups { - // If a group refers to itself, it's ok to delete it. - if sg == g { - continue - } - for k := range sg.perms { - if k.group == g { - fatalf(500, "InvalidGroup.InUse", "group is currently in use by group %q", sg.id) - } - } - } - - delete(srv.groups, g.id) - return &ec2.SimpleResp{ - XMLName: xml.Name{"", "DeleteSecurityGroupResponse"}, - RequestId: reqId, - } -} - -func (r *reservation) hasRunningMachine() bool { - for _, inst := range r.instances { - if inst.state.Code != ShuttingDown.Code && inst.state.Code != Terminated.Code { - return true - } - } - return false -} - -type counter int - -func (c *counter) next() (i int) { - i = int(*c) - (*c)++ - return -} - -// atoi is like strconv.Atoi but is fatal if the -// string is not well formed. -func atoi(s string) int { - i, err := strconv.Atoi(s) - if err != nil { - fatalf(400, "InvalidParameterValue", "bad number: %v", err) - } - return i -} - -func fatalf(statusCode int, code string, f string, a ...interface{}) { - panic(&ec2.Error{ - StatusCode: statusCode, - Code: code, - Message: fmt.Sprintf(f, a...), - }) -} diff --git a/Godeps/_workspace/src/github.com/mitchellh/goamz/ec2/export_test.go b/Godeps/_workspace/src/github.com/mitchellh/goamz/ec2/export_test.go deleted file mode 100644 index 1c24422129b..00000000000 --- a/Godeps/_workspace/src/github.com/mitchellh/goamz/ec2/export_test.go +++ /dev/null @@ -1,22 +0,0 @@ -package ec2 - -import ( - "github.com/mitchellh/goamz/aws" - "time" -) - -func Sign(auth aws.Auth, method, path string, params map[string]string, host string) { - sign(auth, method, path, params, host) -} - -func fixedTime() time.Time { - return time.Date(2012, 1, 1, 0, 0, 0, 0, time.UTC) -} - -func FakeTime(fakeIt bool) { - if fakeIt { - timeNow = fixedTime - } else { - timeNow = time.Now - } -} diff --git a/Godeps/_workspace/src/github.com/mitchellh/goamz/ec2/responses_test.go b/Godeps/_workspace/src/github.com/mitchellh/goamz/ec2/responses_test.go deleted file mode 100644 index 94a681c72fd..00000000000 --- a/Godeps/_workspace/src/github.com/mitchellh/goamz/ec2/responses_test.go +++ /dev/null @@ -1,1207 +0,0 @@ -package ec2_test - -var ErrorDump = ` - -UnsupportedOperation -AMIs with an instance-store root device are not supported for the instance type 't1.micro'. -0503f4e9-bbd6-483c-b54f-c4ae9f3b30f4 -` - -// http://goo.gl/Mcm3b -var RunInstancesExample = ` - - 59dbff89-35bd-4eac-99ed-be587EXAMPLE - r-47a5402e - 999988887777 - - - sg-67ad940e - default - - - - - i-2ba64342 - ami-60a54009 - - 0 - pending - - - - example-key-name - 0 - m1.small - 2007-08-07T11:51:50.000Z - - us-east-1b - - - enabled - - paravirtual - - - xen - - - i-2bc64242 - ami-60a54009 - - 0 - pending - - - - example-key-name - 1 - m1.small - 2007-08-07T11:51:50.000Z - - us-east-1b - - - enabled - - paravirtual - - - xen - - - i-2be64332 - ami-60a54009 - - 0 - pending - - - - example-key-name - 2 - m1.small - 2007-08-07T11:51:50.000Z - - us-east-1b - - - enabled - - paravirtual - - - xen - - - -` - -// http://goo.gl/GRZgCD -var RequestSpotInstancesExample = ` - - 59dbff89-35bd-4eac-99ed-be587EXAMPLE - - - sir-1a2b3c4d - 0.5 - one-time - open - - pending-evaluation - 2008-05-07T12:51:50.000Z - Your Spot request has been submitted for review, and is pending evaluation. - - MyAzGroup - - ami-1a2b3c4d - gsg-keypair - - - sg-1a2b3c4d - websrv - - - m1.small - - - false - - false - - YYYY-MM-DDTHH:MM:SS.000Z - Linux/UNIX - - - -` - -// http://goo.gl/KsKJJk -var DescribeSpotRequestsExample = ` - - b1719f2a-5334-4479-b2f1-26926EXAMPLE - - - sir-1a2b3c4d - 0.5 - one-time - active - - fulfilled - 2008-05-07T12:51:50.000Z - Your Spot request is fulfilled. - - - ami-1a2b3c4d - gsg-keypair - - - sg-1a2b3c4d - websrv - - - m1.small - - false - - false - - i-1a2b3c4d - YYYY-MM-DDTHH:MM:SS.000Z - Linux/UNIX - us-east-1a - - - -` - -// http://goo.gl/DcfFgJ -var CancelSpotRequestsExample = ` - - 59dbff89-35bd-4eac-99ed-be587EXAMPLE - - - sir-1a2b3c4d - cancelled - - - -` - -// http://goo.gl/3BKHj -var TerminateInstancesExample = ` - - 59dbff89-35bd-4eac-99ed-be587EXAMPLE - - - i-3ea74257 - - 32 - shutting-down - - - 16 - running - - - - -` - -// http://goo.gl/mLbmw -var DescribeInstancesExample1 = ` - - 98e3c9a4-848c-4d6d-8e8a-b1bdEXAMPLE - - - r-b27e30d9 - 999988887777 - - - sg-67ad940e - default - - - - - i-c5cd56af - ami-1a2b3c4d - - 16 - running - - domU-12-31-39-10-56-34.compute-1.internal - ec2-174-129-165-232.compute-1.amazonaws.com - - GSG_Keypair - 0 - - m1.small - 2010-08-17T01:15:18.000Z - - us-east-1b - - - aki-94c527fd - ari-96c527ff - - disabled - - 10.198.85.190 - 174.129.165.232 - i386 - ebs - /dev/sda1 - - - /dev/sda1 - - vol-a082c1c9 - attached - 2010-08-17T01:15:21.000Z - false - - - - spot - sir-7a688402 - paravirtual - - - xen - - - 854251627541 - - - r-b67e30dd - 999988887777 - - - sg-67ad940e - default - - - - - i-d9cd56b3 - ami-1a2b3c4d - - 16 - running - - domU-12-31-39-10-54-E5.compute-1.internal - ec2-184-73-58-78.compute-1.amazonaws.com - - GSG_Keypair - 0 - - m1.large - 2010-08-17T01:15:19.000Z - - us-east-1b - - - aki-94c527fd - ari-96c527ff - - disabled - - 10.198.87.19 - 184.73.58.78 - i386 - ebs - /dev/sda1 - - - /dev/sda1 - - vol-a282c1cb - attached - 2010-08-17T01:15:23.000Z - false - - - - spot - sir-55a3aa02 - paravirtual - - - xen - - - 854251627541 - - - -` - -// http://goo.gl/mLbmw -var DescribeInstancesExample2 = ` - - 59dbff89-35bd-4eac-99ed-be587EXAMPLE - - - r-bc7e30d7 - 999988887777 - - - sg-67ad940e - default - - - - - i-c7cd56ad - ami-b232d0db - - 16 - running - - domU-12-31-39-01-76-06.compute-1.internal - ec2-72-44-52-124.compute-1.amazonaws.com - GSG_Keypair - 0 - - m1.small - 2010-08-17T01:15:16.000Z - - us-east-1b - - aki-94c527fd - ari-96c527ff - - disabled - - 10.255.121.240 - 72.44.52.124 - i386 - ebs - /dev/sda1 - - - /dev/sda1 - - vol-a482c1cd - attached - 2010-08-17T01:15:26.000Z - true - - - - paravirtual - - - - webserver - - - - stack - Production - - - xen - - - - - -` - -// http://goo.gl/cxU41 -var CreateImageExample = ` - - 59dbff89-35bd-4eac-99ed-be587EXAMPLE - ami-4fa54026 - -` - -// http://goo.gl/V0U25 -var DescribeImagesExample = ` - - 4a4a27a2-2e7c-475d-b35b-ca822EXAMPLE - - - ami-a2469acf - aws-marketplace/example-marketplace-amzn-ami.1 - available - 123456789999 - true - - - a1b2c3d4e5f6g7h8i9j10k11 - marketplace - - - i386 - machine - aki-805ea7e9 - aws-marketplace - example-marketplace-amzn-ami.1 - Amazon Linux AMI i386 EBS - ebs - /dev/sda1 - - - /dev/sda1 - - snap-787e9403 - 8 - true - - - - paravirtual - xen - - - -` - -// http://goo.gl/bHO3z -var ImageAttributeExample = ` - - 59dbff89-35bd-4eac-99ed-be587EXAMPLE - ami-61a54008 - - - all - - - 495219933132 - - - -` - -// http://goo.gl/ttcda -var CreateSnapshotExample = ` - - 59dbff89-35bd-4eac-99ed-be587EXAMPLE - snap-78a54011 - vol-4d826724 - pending - 2008-05-07T12:51:50.000Z - 60% - 111122223333 - 10 - Daily Backup - -` - -// http://goo.gl/vwU1y -var DeleteSnapshotExample = ` - - 59dbff89-35bd-4eac-99ed-be587EXAMPLE - true - -` - -// http://goo.gl/nkovs -var DescribeSnapshotsExample = ` - - 59dbff89-35bd-4eac-99ed-be587EXAMPLE - - - snap-1a2b3c4d - vol-8875daef - pending - 2010-07-29T04:12:01.000Z - 30% - 111122223333 - 15 - Daily Backup - - - Purpose - demo_db_14_backup - - - - - -` - -// http://goo.gl/YUjO4G -var ModifyImageAttributeExample = ` - - 59dbff89-35bd-4eac-99ed-be587EXAMPLE - true - -` - -// http://goo.gl/hQwPCK -var CopyImageExample = ` - - 60bc441d-fa2c-494d-b155-5d6a3EXAMPLE - ami-4d3c2b1a - -` - -var CreateKeyPairExample = ` - - 59dbff89-35bd-4eac-99ed-be587EXAMPLE - foo - - 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00 - - ---- BEGIN RSA PRIVATE KEY ---- -MIICiTCCAfICCQD6m7oRw0uXOjANBgkqhkiG9w0BAQUFADCBiDELMAkGA1UEBhMC -VVMxCzAJBgNVBAgTAldBMRAwDgYDVQQHEwdTZWF0dGxlMQ8wDQYDVQQKEwZBbWF6 -b24xFDASBgNVBAsTC0lBTSBDb25zb2xlMRIwEAYDVQQDEwlUZXN0Q2lsYWMxHzAd -BgkqhkiG9w0BCQEWEG5vb25lQGFtYXpvbi5jb20wHhcNMTEwNDI1MjA0NTIxWhcN -MTIwNDI0MjA0NTIxWjCBiDELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAldBMRAwDgYD -VQQHEwdTZWF0dGxlMQ8wDQYDVQQKEwZBbWF6b24xFDASBgNVBAsTC0lBTSBDb25z -b2xlMRIwEAYDVQQDEwlUZXN0Q2lsYWMxHzAdBgkqhkiG9w0BCQEWEG5vb25lQGFt -YXpvbi5jb20wgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAMaK0dn+a4GmWIWJ -21uUSfwfEvySWtC2XADZ4nB+BLYgVIk60CpiwsZ3G93vUEIO3IyNoH/f0wYK8m9T -rDHudUZg3qX4waLG5M43q7Wgc/MbQITxOUSQv7c7ugFFDzQGBzZswY6786m86gpE -Ibb3OhjZnzcvQAaRHhdlQWIMm2nrAgMBAAEwDQYJKoZIhvcNAQEFBQADgYEAtCu4 -nUhVVxYUntneD9+h8Mg9q6q+auNKyExzyLwaxlAoo7TJHidbtS4J5iNmZgXL0Fkb -FFBjvSfpJIlJ00zbhNYS5f6GuoEDmFJl0ZxBHjJnyp378OD8uTs7fLvjx79LjSTb -NYiytVbZPQUQ5Yaxu2jXnimvw3rrszlaEXAMPLE= ------END RSA PRIVATE KEY----- - - -` - -var DeleteKeyPairExample = ` - - 59dbff89-35bd-4eac-99ed-be587EXAMPLE - true - -` - -// http://goo.gl/Eo7Yl -var CreateSecurityGroupExample = ` - - 59dbff89-35bd-4eac-99ed-be587EXAMPLE - true - sg-67ad940e - -` - -// http://goo.gl/k12Uy -var DescribeSecurityGroupsExample = ` - - 59dbff89-35bd-4eac-99ed-be587EXAMPLE - - - 999988887777 - WebServers - sg-67ad940e - Web Servers - - - tcp - 80 - 80 - - - - 0.0.0.0/0 - - - - - - - 999988887777 - RangedPortsBySource - sg-76abc467 - Group A - - - tcp - 6000 - 7000 - - - - - - - -` - -// A dump which includes groups within ip permissions. -var DescribeSecurityGroupsDump = ` - - - 87b92b57-cc6e-48b2-943f-f6f0e5c9f46c - - - 12345 - default - default group - - - icmp - -1 - -1 - - - 12345 - default - sg-67ad940e - - - - - - tcp - 0 - 65535 - - - 12345 - other - sg-76abc467 - - - - - - - - -` - -// http://goo.gl/QJJDO -var DeleteSecurityGroupExample = ` - - 59dbff89-35bd-4eac-99ed-be587EXAMPLE - true - -` - -// http://goo.gl/u2sDJ -var AuthorizeSecurityGroupIngressExample = ` - - 59dbff89-35bd-4eac-99ed-be587EXAMPLE - true - -` - -// http://goo.gl/u2sDJ -var AuthorizeSecurityGroupEgressExample = ` - - 59dbff89-35bd-4eac-99ed-be587EXAMPLE - true - -` - -// http://goo.gl/Mz7xr -var RevokeSecurityGroupIngressExample = ` - - 59dbff89-35bd-4eac-99ed-be587EXAMPLE - true - -` - -// http://goo.gl/Vmkqc -var CreateTagsExample = ` - - 59dbff89-35bd-4eac-99ed-be587EXAMPLE - true - -` - -// http://goo.gl/awKeF -var StartInstancesExample = ` - - 59dbff89-35bd-4eac-99ed-be587EXAMPLE - - - i-10a64379 - - 0 - pending - - - 80 - stopped - - - - -` - -// http://goo.gl/436dJ -var StopInstancesExample = ` - - 59dbff89-35bd-4eac-99ed-be587EXAMPLE - - - i-10a64379 - - 64 - stopping - - - 16 - running - - - - -` - -// http://goo.gl/baoUf -var RebootInstancesExample = ` - - 59dbff89-35bd-4eac-99ed-be587EXAMPLE - true - -` - -// http://goo.gl/9rprDN -var AllocateAddressExample = ` - - 59dbff89-35bd-4eac-99ed-be587EXAMPLE - 198.51.100.1 - vpc - eipalloc-5723d13e - -` - -// http://goo.gl/DFySJY -var DescribeInstanceStatusExample = ` - - 3be1508e-c444-4fef-89cc-0b1223c4f02fEXAMPLE - - - i-1a2b3c4d - us-east-1d - - 16 - running - - - impaired -
- - reachability - failed - YYYY-MM-DDTHH:MM:SS.000Z - -
-
- - impaired -
- - reachability - failed - YYYY-MM-DDTHH:MM:SS.000Z - -
-
- - - instance-retirement - The instance is running on degraded hardware - YYYY-MM-DDTHH:MM:SS+0000 - YYYY-MM-DDTHH:MM:SS+0000 - - -
- - i-2a2b3c4d - us-east-1d - - 16 - running - - - ok -
- - reachability - passed - -
-
- - ok -
- - reachability - passed - -
-
- - - instance-reboot - The instance is scheduled for a reboot - YYYY-MM-DDTHH:MM:SS+0000 - YYYY-MM-DDTHH:MM:SS+0000 - - -
- - i-3a2b3c4d - us-east-1c - - 16 - running - - - ok -
- - reachability - passed - -
-
- - ok -
- - reachability - passed - -
-
-
- - i-4a2b3c4d - us-east-1c - - 16 - running - - - ok -
- - reachability - passed - -
-
- - insufficient-data -
- - reachability - insufficient-data - -
-
-
-
-
-` - -// http://goo.gl/3Q0oCc -var ReleaseAddressExample = ` - - 59dbff89-35bd-4eac-99ed-be587EXAMPLE - true - -` - -// http://goo.gl/uOSQE -var AssociateAddressExample = ` - - 59dbff89-35bd-4eac-99ed-be587EXAMPLE - true - eipassoc-fc5ca095 - -` - -// http://goo.gl/LrOa0 -var DisassociateAddressExample = ` - - 59dbff89-35bd-4eac-99ed-be587EXAMPLE - true - -` - -// http://goo.gl/icuXh5 -var ModifyInstanceExample = ` - - 59dbff89-35bd-4eac-99ed-be587EXAMPLE - true - -` - -var CreateVpcExample = ` - - 7a62c49f-347e-4fc4-9331-6e8eEXAMPLE - - vpc-1a2b3c4d - pending - 10.0.0.0/16 - dopt-1a2b3c4d2 - default - - - -` - -var DescribeVpcsExample = ` - - 7a62c49f-347e-4fc4-9331-6e8eEXAMPLE - - - vpc-1a2b3c4d - available - 10.0.0.0/23 - dopt-7a8b9c2d - default - false - - - - -` - -var CreateSubnetExample = ` - - 7a62c49f-347e-4fc4-9331-6e8eEXAMPLE - - subnet-9d4a7b6c - pending - vpc-1a2b3c4d - 10.0.1.0/24 - 251 - us-east-1a - - - -` - -// http://goo.gl/tu2Kxm -var ModifySubnetAttributeExample = ` - - 59dbff89-35bd-4eac-99ed-be587EXAMPLE - true - -` - -// http://goo.gl/r6ZCPm -var ResetImageAttributeExample = ` - - 59dbff89-35bd-4eac-99ed-be587EXAMPLE - true - -` - -// http://goo.gl/ylxT4R -var DescribeAvailabilityZonesExample1 = ` - - 59dbff89-35bd-4eac-99ed-be587EXAMPLE - - - us-east-1a - available - us-east-1 - - - - us-east-1b - available - us-east-1 - - - - us-east-1c - available - us-east-1 - - - - us-east-1d - available - us-east-1 - - - - -` - -// http://goo.gl/ylxT4R -var DescribeAvailabilityZonesExample2 = ` - - 59dbff89-35bd-4eac-99ed-be587EXAMPLE - - - us-east-1a - impaired - us-east-1 - - - - us-east-1b - unavailable - us-east-1 - - us-east-1b is currently down for maintenance. - - - - -` - -// http://goo.gl/sdomyE -var CreateNetworkAclExample = ` - - 59dbff89-35bd-4eac-99ed-be587EXAMPLE - - acl-5fb85d36 - vpc-11ad4878 - false - - - 32767 - -1 - deny - true - 0.0.0.0/0 - - - 32767 - -1 - deny - false - 0.0.0.0/0 - - - - - - -` - -// http://goo.gl/6sYloC -var CreateNetworkAclEntryRespExample = ` - - 59dbff89-35bd-4eac-99ed-be587EXAMPLE - true - -` - -// http://goo.gl/5tqceF -var DescribeNetworkAclsExample = ` - - 59dbff89-35bd-4eac-99ed-be587EXAMPLE - - - acl-5566953c - vpc-5266953b - true - - - 100 - -1 - allow - true - 0.0.0.0/0 - - - 32767 - -1 - deny - true - 0.0.0.0/0 - - - 100 - -1 - allow - false - 0.0.0.0/0 - - - 32767 - -1 - deny - false - 0.0.0.0/0 - - - - - - - acl-5d659634 - vpc-5266953b - false - - - 110 - 6 - allow - true - 0.0.0.0/0 - - 49152 - 65535 - - - - 32767 - -1 - deny - true - 0.0.0.0/0 - - - 110 - 6 - allow - false - 0.0.0.0/0 - - 80 - 80 - - - - 120 - 6 - allow - false - 0.0.0.0/0 - - 443 - 443 - - - - 32767 - -1 - deny - false - 0.0.0.0/0 - - - - - aclassoc-5c659635 - acl-5d659634 - subnet-ff669596 - - - aclassoc-c26596ab - acl-5d659634 - subnet-f0669599 - - - - - - -` - -var ReplaceNetworkAclAssociationResponseExample = ` - - 59dbff89-35bd-4eac-99ed-be587EXAMPLE - aclassoc-17b85d7e - -` diff --git a/Godeps/_workspace/src/github.com/mitchellh/goamz/ec2/sign.go b/Godeps/_workspace/src/github.com/mitchellh/goamz/ec2/sign.go deleted file mode 100644 index bffc3c7e930..00000000000 --- a/Godeps/_workspace/src/github.com/mitchellh/goamz/ec2/sign.go +++ /dev/null @@ -1,45 +0,0 @@ -package ec2 - -import ( - "crypto/hmac" - "crypto/sha256" - "encoding/base64" - "github.com/mitchellh/goamz/aws" - "sort" - "strings" -) - -// ---------------------------------------------------------------------------- -// EC2 signing (http://goo.gl/fQmAN) - -var b64 = base64.StdEncoding - -func sign(auth aws.Auth, method, path string, params map[string]string, host string) { - params["AWSAccessKeyId"] = auth.AccessKey - params["SignatureVersion"] = "2" - params["SignatureMethod"] = "HmacSHA256" - if auth.Token != "" { - params["SecurityToken"] = auth.Token - } - - // AWS specifies that the parameters in a signed request must - // be provided in the natural order of the keys. This is distinct - // from the natural order of the encoded value of key=value. - // Percent and equals affect the sorting order. - var keys, sarray []string - for k, _ := range params { - keys = append(keys, k) - } - sort.Strings(keys) - for _, k := range keys { - sarray = append(sarray, aws.Encode(k)+"="+aws.Encode(params[k])) - } - joined := strings.Join(sarray, "&") - payload := method + "\n" + host + "\n" + path + "\n" + joined - hash := hmac.New(sha256.New, []byte(auth.SecretKey)) - hash.Write([]byte(payload)) - signature := make([]byte, b64.EncodedLen(hash.Size())) - b64.Encode(signature, hash.Sum(nil)) - - params["Signature"] = string(signature) -} diff --git a/Godeps/_workspace/src/github.com/mitchellh/goamz/ec2/sign_test.go b/Godeps/_workspace/src/github.com/mitchellh/goamz/ec2/sign_test.go deleted file mode 100644 index 86d203e78c6..00000000000 --- a/Godeps/_workspace/src/github.com/mitchellh/goamz/ec2/sign_test.go +++ /dev/null @@ -1,68 +0,0 @@ -package ec2_test - -import ( - "github.com/mitchellh/goamz/aws" - "github.com/mitchellh/goamz/ec2" - . "github.com/motain/gocheck" -) - -// EC2 ReST authentication docs: http://goo.gl/fQmAN - -var testAuth = aws.Auth{"user", "secret", ""} - -func (s *S) TestBasicSignature(c *C) { - params := map[string]string{} - ec2.Sign(testAuth, "GET", "/path", params, "localhost") - c.Assert(params["SignatureVersion"], Equals, "2") - c.Assert(params["SignatureMethod"], Equals, "HmacSHA256") - expected := "6lSe5QyXum0jMVc7cOUz32/52ZnL7N5RyKRk/09yiK4=" - c.Assert(params["Signature"], Equals, expected) -} - -func (s *S) TestParamSignature(c *C) { - params := map[string]string{ - "param1": "value1", - "param2": "value2", - "param3": "value3", - } - ec2.Sign(testAuth, "GET", "/path", params, "localhost") - expected := "XWOR4+0lmK8bD8CGDGZ4kfuSPbb2JibLJiCl/OPu1oU=" - c.Assert(params["Signature"], Equals, expected) -} - -func (s *S) TestManyParams(c *C) { - params := map[string]string{ - "param1": "value10", - "param2": "value2", - "param3": "value3", - "param4": "value4", - "param5": "value5", - "param6": "value6", - "param7": "value7", - "param8": "value8", - "param9": "value9", - "param10": "value1", - } - ec2.Sign(testAuth, "GET", "/path", params, "localhost") - expected := "di0sjxIvezUgQ1SIL6i+C/H8lL+U0CQ9frLIak8jkVg=" - c.Assert(params["Signature"], Equals, expected) -} - -func (s *S) TestEscaping(c *C) { - params := map[string]string{"Nonce": "+ +"} - ec2.Sign(testAuth, "GET", "/path", params, "localhost") - c.Assert(params["Nonce"], Equals, "+ +") - expected := "bqffDELReIqwjg/W0DnsnVUmfLK4wXVLO4/LuG+1VFA=" - c.Assert(params["Signature"], Equals, expected) -} - -func (s *S) TestSignatureExample1(c *C) { - params := map[string]string{ - "Timestamp": "2009-02-01T12:53:20+00:00", - "Version": "2007-11-07", - "Action": "ListDomains", - } - ec2.Sign(aws.Auth{"access", "secret", ""}, "GET", "/", params, "sdb.amazonaws.com") - expected := "okj96/5ucWBSc1uR2zXVfm6mDHtgfNv657rRtt/aunQ=" - c.Assert(params["Signature"], Equals, expected) -}