diff --git a/CHANGELOG.md b/CHANGELOG.md index 47cfe8c36..197263ddc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,19 +5,26 @@ BACKWARDS INCOMPATIBILITIES: * VNC and VRDP-like features in VirtualBox, VMware, and QEMU now configurable but bind to 127.0.0.1 by default to improve security. See the relevant builder docs for more info. + * Docker builder requires Docker > 1.3 FEATURES: - * **New Checksum post-processor**: Create a checksum file from your build artifacts as part of your build. [GH-3492] + * **New Checksum post-processor**: Create a checksum file from your build artifacts as part of your build. [GH-3492] + [GH-3790] + * **New build flag** `-on-error` to allow inspection and keeping artifacts on builder errors. [GH-3885] + IMPROVEMENTS: + * core: Test floppy disk files actually exist [GH-3756] * builder/amazon: Added `disable_stop_instance` option to prevent automatic shutdown when the build is complete [GH-3352] * builder/amazon: Added `skip_region_validation` option to allow newer or custom AWS regions [GH-3598] * builder/amazon: Added `shutdown_behavior` option to support `stop` or `terminate` at the end of the build [GH-3556] + * builder/amazon: Support building from scratch with amazon-chroot builder. + [GH-3855] [GH-3895] * builder/azure: Now pre-validates `capture_container_name` and `capture_name_prefix` [GH-3537] * builder/azure: Support for custom images [GH-3575] @@ -25,51 +32,90 @@ IMPROVEMENTS: * builder/azure: Made `tenant_id` optional [GH-3643] * builder/digitalocean: Use `state_timeout` for unlock and off transitions. [GH-3444] + * builder/digitalocean: Fixes timeout waiting for snapshot [GH-3868] + * builder/digitalocean: Added `user_data_file` support. [GH-3933] + * builder/docker: Improved support for Docker pull from Amazon ECR. [GH-3856] * builder/google: Added support for `image_family` [GH-3503] * builder/google: Use gcloud application default credentials. [GH-3655] + * builder/google: Signal that startup script fished via metadata. [GH-3873] + * builder/google: Add image license metadata. [GH-3873] + * builder/google: Enable to select NVMe images. [GH-3338] + * builder/google: Create passwords for Windows instances. [GH-3932] * builder/null: Can now be used with WinRM [GH-2525] * builder/parallels: Now pauses between `boot_command` entries when running with `-debug` [GH-3547] * builder/parallels: Support future versions of Parallels by using the latest driver [GH-3673] + * builder/parallels: Add support for ctrl, shift and alt keys in `boot_command`. + [GH-3767] * builder/qemu: Added `vnc_bind_address` option [GH-3574] + * builder/qemu: Specify disk format when starting qemu [GH-3888] + * builder/qemu: Now pauses between `boot_command` entries when running with + `-debug` [GH-3547] + * builder/qemu: Add support for ctrl, shift and alt keys in `boot_command`. + [GH-3767] * builder/virtualbox: Now pauses between `boot_command` entries when running with `-debug` [GH-3542] * builder/virtualbox: Added `vrdp_bind_address` option [GH-3566] + * builder/virtualbox: Add support for ctrl, shift and alt keys in `boot_command`. + [GH-3767] * builder/vmware: Now paused between `boot_command` entries when running with `-debug` [GH-3542] * builder/vmware: Added `vnc_bind_address` option [GH-3565] * builder/vmware: Adds passwords for VNC [GH-2325] * builder/vmware: Handle connection to VM with more than one NIC on ESXi [GH-3347] - * builder/qemu: Now pauses between `boot_command` entries when running with - `-debug` [GH-3547] + * builder/vmware: Add support for ctrl, shift and alt keys in `boot_command`. + [GH-3767] * provisioner/ansible: Improved logging and error handling [GH-3477] + * provisioner/ansible: Support scp [GH-3861] * provisioner/ansible-local: Support for ansible-galaxy [GH-3350] [GH-3836] * provisioner/chef: Added `knife_command` option and added a correct default value for Windows [GH-3622] + * provisioner/chef: Installs 64bit chef on Windows if available [GH-3848] * provisioner/puppet: Added `execute_command` option [GH-3614] + * post-processor/amazon-import: Support `ami_name` for naming imported AMI. + [GH-3941] * post-processor/compress: Added support for bgzf compression [GH-3501] * post-processor/docker: Preserve tags when running docker push [GH-3631] + * post-processor/docker: Improved support for Docker push to Amazon ECR [GH-3856] * scripts: Added `help` target to Makefile [GH-3290] + * builder/googlecompute: Add `-force` option to delete old image before + creating new one. [GH-3918] BUG FIXES: - * post-processor/shell-local: Do not set execute bit on artifact file [GH-3505] - * post-processor/vsphere: Fix upload failures with vsphere [GH-3321] - * provisioner/ansible: Properly set host key checking even when a custom ENV - is specified [GH-3568] * builder/amazon: Use `temporary_key_pair_name` when specified. [GH-3739] * builder/amazon: Add 0.5 cents to discovered spot price. [GH-3662] + * builder/amazon: Fix packer crash when waiting for SSH. [GH-3865] + * builder/amazon: Honor ssh_private_ip flag in EC2-Classic. [GH-3752] * builder/azure: check for empty resource group [GH-3606] * builder/azure: fix token validity test [GH-3609] + * builder/docker: fix docker builder with ansible provisioner. [GH-3476] + * builder/docker: Fix file provisioner dotfile matching. [GH-3800] * builder/virtualbox: Respect `ssh_host` [GH-3617] + * builder/virtualbox: Make `ssh_host_port_max` an inclusive bound. [GH-2784] * builder/vmware: Re-introduce case sensitive VMX keys [GH-2707] * builder/vmware: Don't check for poweron errors on ESXi [GH-3195] * builder/vmware: Respect `ssh_host`/`winrm_host` on ESXi [GH-3738] * builder/vmware: Do not add remotedisplay.vnc.ip to VMX data on ESXi [GH-3740] + * builder/qemu: Don't fail on communicator set to `none`. [GH-3681] + * builder/qemu: Make `ssh_host_port_max` an inclusive bound. [GH-2784] + * post-processor/shell-local: Do not set execute bit on artifact file [GH-3505] + * post-processor/vsphere: Fix upload failures with vsphere [GH-3321] + * provisioner/ansible: Properly set host key checking even when a custom ENV + is specified [GH-3568] * website: improved rendering on iPad [GH-3780] + * provisioner/file: Fix directory download. [GH-3899] + * command/push: Allows dot (`.`) in image names. [GH-3937] + * builder/amazon: add retry logic when creating tags. + +## 0.10.2 (September 20, 2016) + +BUG FIXES: + + * Rebuilding with OS X Sierra and go 1.7.1 to fix bug in Sierra ## 0.10.1 (May 7, 2016) diff --git a/Godeps/Godeps.json b/Godeps/Godeps.json index 40b348dd1..9309054dd 100644 --- a/Godeps/Godeps.json +++ b/Godeps/Godeps.json @@ -80,138 +80,163 @@ }, { "ImportPath": "github.com/aws/aws-sdk-go/aws", - "Comment": "v1.1.2", - "Rev": "8041be5461786460d86b4358305fbdf32d37cfb2" + "Comment": "v1.4.6", + "Rev": "6ac30507cca29249f4d49af45a8efc98b84088ee" }, { "ImportPath": "github.com/aws/aws-sdk-go/aws/awserr", - "Comment": "v1.1.2", - "Rev": "8041be5461786460d86b4358305fbdf32d37cfb2" + "Comment": "v1.4.6", + "Rev": "6ac30507cca29249f4d49af45a8efc98b84088ee" }, { "ImportPath": "github.com/aws/aws-sdk-go/aws/awsutil", - "Comment": "v1.1.2", - "Rev": "8041be5461786460d86b4358305fbdf32d37cfb2" + "Comment": "v1.4.6", + "Rev": "6ac30507cca29249f4d49af45a8efc98b84088ee" }, { "ImportPath": "github.com/aws/aws-sdk-go/aws/client", - "Comment": "v1.1.2", - "Rev": "8041be5461786460d86b4358305fbdf32d37cfb2" + "Comment": "v1.4.6", + "Rev": "6ac30507cca29249f4d49af45a8efc98b84088ee" }, { "ImportPath": "github.com/aws/aws-sdk-go/aws/client/metadata", - "Comment": "v1.1.2", - "Rev": "8041be5461786460d86b4358305fbdf32d37cfb2" + "Comment": "v1.4.6", + "Rev": "6ac30507cca29249f4d49af45a8efc98b84088ee" }, { "ImportPath": "github.com/aws/aws-sdk-go/aws/corehandlers", - "Comment": "v1.1.2", - "Rev": "8041be5461786460d86b4358305fbdf32d37cfb2" + "Comment": "v1.4.6", + "Rev": "6ac30507cca29249f4d49af45a8efc98b84088ee" }, { "ImportPath": "github.com/aws/aws-sdk-go/aws/credentials", - "Comment": "v1.1.2", - "Rev": "8041be5461786460d86b4358305fbdf32d37cfb2" + "Comment": "v1.4.6", + "Rev": "6ac30507cca29249f4d49af45a8efc98b84088ee" }, { "ImportPath": "github.com/aws/aws-sdk-go/aws/credentials/ec2rolecreds", - "Comment": "v1.1.2", - "Rev": "8041be5461786460d86b4358305fbdf32d37cfb2" + "Comment": "v1.4.6", + "Rev": "6ac30507cca29249f4d49af45a8efc98b84088ee" + }, + { + "ImportPath": "github.com/aws/aws-sdk-go/aws/credentials/endpointcreds", + "Comment": "v1.4.6", + "Rev": "6ac30507cca29249f4d49af45a8efc98b84088ee" + }, + { + "ImportPath": "github.com/aws/aws-sdk-go/aws/credentials/stscreds", + "Comment": "v1.4.6", + "Rev": "6ac30507cca29249f4d49af45a8efc98b84088ee" }, { "ImportPath": "github.com/aws/aws-sdk-go/aws/defaults", - "Comment": "v1.1.2", - "Rev": "8041be5461786460d86b4358305fbdf32d37cfb2" + "Comment": "v1.4.6", + "Rev": "6ac30507cca29249f4d49af45a8efc98b84088ee" }, { "ImportPath": "github.com/aws/aws-sdk-go/aws/ec2metadata", - "Comment": "v1.1.2", - "Rev": "8041be5461786460d86b4358305fbdf32d37cfb2" + "Comment": "v1.4.6", + "Rev": "6ac30507cca29249f4d49af45a8efc98b84088ee" }, { "ImportPath": "github.com/aws/aws-sdk-go/aws/request", - "Comment": "v1.1.2", - "Rev": "8041be5461786460d86b4358305fbdf32d37cfb2" + "Comment": "v1.4.6", + "Rev": "6ac30507cca29249f4d49af45a8efc98b84088ee" }, { "ImportPath": "github.com/aws/aws-sdk-go/aws/session", - "Comment": "v1.1.2", - "Rev": "8041be5461786460d86b4358305fbdf32d37cfb2" + "Comment": "v1.4.6", + "Rev": "6ac30507cca29249f4d49af45a8efc98b84088ee" + }, + { + "ImportPath": "github.com/aws/aws-sdk-go/aws/signer/v4", + "Comment": "v1.4.6", + "Rev": "6ac30507cca29249f4d49af45a8efc98b84088ee" }, { "ImportPath": "github.com/aws/aws-sdk-go/private/endpoints", - "Comment": "v1.1.2", - "Rev": "8041be5461786460d86b4358305fbdf32d37cfb2" + "Comment": "v1.4.6", + "Rev": "6ac30507cca29249f4d49af45a8efc98b84088ee" }, { "ImportPath": "github.com/aws/aws-sdk-go/private/protocol", - "Comment": "v1.1.2", - "Rev": "8041be5461786460d86b4358305fbdf32d37cfb2" + "Comment": "v1.4.6", + "Rev": "6ac30507cca29249f4d49af45a8efc98b84088ee" }, { "ImportPath": "github.com/aws/aws-sdk-go/private/protocol/ec2query", - "Comment": "v1.1.2", - "Rev": "8041be5461786460d86b4358305fbdf32d37cfb2" + "Comment": "v1.4.6", + "Rev": "6ac30507cca29249f4d49af45a8efc98b84088ee" + }, + { + "ImportPath": "github.com/aws/aws-sdk-go/private/protocol/json/jsonutil", + "Comment": "v1.4.6", + "Rev": "6ac30507cca29249f4d49af45a8efc98b84088ee" + }, + { + "ImportPath": "github.com/aws/aws-sdk-go/private/protocol/jsonrpc", + "Comment": "v1.4.6", + "Rev": "6ac30507cca29249f4d49af45a8efc98b84088ee" }, { "ImportPath": "github.com/aws/aws-sdk-go/private/protocol/query", - "Comment": "v1.1.2", - "Rev": "8041be5461786460d86b4358305fbdf32d37cfb2" + "Comment": "v1.4.6", + "Rev": "6ac30507cca29249f4d49af45a8efc98b84088ee" }, { "ImportPath": "github.com/aws/aws-sdk-go/private/protocol/query/queryutil", - "Comment": "v1.1.2", - "Rev": "8041be5461786460d86b4358305fbdf32d37cfb2" + "Comment": "v1.4.6", + "Rev": "6ac30507cca29249f4d49af45a8efc98b84088ee" }, { "ImportPath": "github.com/aws/aws-sdk-go/private/protocol/rest", - "Comment": "v1.1.2", - "Rev": "8041be5461786460d86b4358305fbdf32d37cfb2" + "Comment": "v1.4.6", + "Rev": "6ac30507cca29249f4d49af45a8efc98b84088ee" }, { "ImportPath": "github.com/aws/aws-sdk-go/private/protocol/restxml", - "Comment": "v1.1.2", - "Rev": "8041be5461786460d86b4358305fbdf32d37cfb2" + "Comment": "v1.4.6", + "Rev": "6ac30507cca29249f4d49af45a8efc98b84088ee" }, { "ImportPath": "github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil", - "Comment": "v1.1.2", - "Rev": "8041be5461786460d86b4358305fbdf32d37cfb2" - }, - { - "ImportPath": "github.com/aws/aws-sdk-go/private/signer/v4", - "Comment": "v1.1.2", - "Rev": "8041be5461786460d86b4358305fbdf32d37cfb2" + "Comment": "v1.4.6", + "Rev": "6ac30507cca29249f4d49af45a8efc98b84088ee" }, { "ImportPath": "github.com/aws/aws-sdk-go/private/waiter", - "Comment": "v1.1.2", - "Rev": "8041be5461786460d86b4358305fbdf32d37cfb2" + "Comment": "v1.4.6", + "Rev": "6ac30507cca29249f4d49af45a8efc98b84088ee" }, { "ImportPath": "github.com/aws/aws-sdk-go/service/ec2", - "Comment": "v1.1.2", - "Rev": "8041be5461786460d86b4358305fbdf32d37cfb2" + "Comment": "v1.4.6", + "Rev": "6ac30507cca29249f4d49af45a8efc98b84088ee" + }, + { + "ImportPath": "github.com/aws/aws-sdk-go/service/ecr", + "Comment": "v1.4.6", + "Rev": "6ac30507cca29249f4d49af45a8efc98b84088ee" }, { "ImportPath": "github.com/aws/aws-sdk-go/service/s3", - "Comment": "v1.1.2", - "Rev": "8041be5461786460d86b4358305fbdf32d37cfb2" + "Comment": "v1.4.6", + "Rev": "6ac30507cca29249f4d49af45a8efc98b84088ee" }, { "ImportPath": "github.com/aws/aws-sdk-go/service/s3/s3iface", - "Comment": "v1.1.2", - "Rev": "8041be5461786460d86b4358305fbdf32d37cfb2" + "Comment": "v1.4.6", + "Rev": "6ac30507cca29249f4d49af45a8efc98b84088ee" }, { "ImportPath": "github.com/aws/aws-sdk-go/service/s3/s3manager", - "Comment": "v1.1.2", - "Rev": "8041be5461786460d86b4358305fbdf32d37cfb2" + "Comment": "v1.4.6", + "Rev": "6ac30507cca29249f4d49af45a8efc98b84088ee" }, { "ImportPath": "github.com/aws/aws-sdk-go/service/sts", - "Comment": "v1.1.2", - "Rev": "8041be5461786460d86b4358305fbdf32d37cfb2" + "Comment": "v1.4.6", + "Rev": "6ac30507cca29249f4d49af45a8efc98b84088ee" }, { "ImportPath": "github.com/bgentry/speakeasy", @@ -221,6 +246,10 @@ "ImportPath": "github.com/biogo/hts/bgzf", "Rev": "50da7d4131a3b5c9d063932461cab4d1fafb20b0" }, + { + "ImportPath": "github.com/davecgh/go-spew/spew", + "Rev": "5215b55f46b2b919f50a1df0eaa5886afe4e3b3d" + }, { "ImportPath": "github.com/dgrijalva/jwt-go", "Comment": "v3.0.0", @@ -427,6 +456,11 @@ "ImportPath": "github.com/pkg/sftp", "Rev": "e84cc8c755ca39b7b64f510fe1fffc1b51f210a5" }, + { + "ImportPath": "github.com/pmezard/go-difflib/difflib", + "Comment": "v1.0.0", + "Rev": "792786c7400a136282c1664665ae0a8db921c6c2" + }, { "ImportPath": "github.com/rackspace/gophercloud", "Comment": "v1.0.0-810-g53d1dc4", @@ -516,6 +550,11 @@ "ImportPath": "github.com/satori/go.uuid", "Rev": "d41af8bb6a7704f00bc3b7cba9355ae6a5a80048" }, + { + "ImportPath": "github.com/stretchr/testify/assert", + "Comment": "v1.1.3-19-gd77da35", + "Rev": "d77da356e56a7428ad25149ca77381849a6a5232" + }, { "ImportPath": "github.com/tent/http-link-go", "Rev": "ac974c61c2f990f4115b119354b5e0b47550e888" @@ -648,31 +687,6 @@ { "ImportPath": "gopkg.in/xmlpath.v2", "Rev": "860cbeca3ebcc600db0b213c0e83ad6ce91f5739" - }, - { - "ImportPath": "github.com/Azure/azure-sdk-for-go/vendor/github.com/Azure/go-autorest/autorest", - "Comment": "v7.0.5-4-g0a0ee7d", - "Rev": "0a0ee7d5b9b1b3d980434cbb0afff33e9ca9e907" - }, - { - "ImportPath": "github.com/Azure/azure-sdk-for-go/vendor/github.com/Azure/go-autorest/autorest/azure", - "Comment": "v7.0.5-4-g0a0ee7d", - "Rev": "0a0ee7d5b9b1b3d980434cbb0afff33e9ca9e907" - }, - { - "ImportPath": "github.com/Azure/azure-sdk-for-go/vendor/github.com/Azure/go-autorest/autorest/date", - "Comment": "v7.0.5-4-g0a0ee7d", - "Rev": "0a0ee7d5b9b1b3d980434cbb0afff33e9ca9e907" - }, - { - "ImportPath": "github.com/Azure/azure-sdk-for-go/vendor/github.com/Azure/go-autorest/autorest/to", - "Comment": "v7.0.5-4-g0a0ee7d", - "Rev": "0a0ee7d5b9b1b3d980434cbb0afff33e9ca9e907" - }, - { - "ImportPath": "github.com/Azure/azure-sdk-for-go/vendor/github.com/dgrijalva/jwt-go", - "Comment": "v3.0.0-2-gf077707", - "Rev": "f0777076321ab64f6efc15a82d9d23b98539b943" } ] } diff --git a/Makefile b/Makefile index c49e005c8..622fed1df 100644 --- a/Makefile +++ b/Makefile @@ -53,7 +53,7 @@ fmt-examples: # source files. generate: deps ## Generate dynamically generated code go generate . - go fmt command/plugin.go + gofmt -w command/plugin.go test: deps ## Run unit tests @go test $(TEST) $(TESTARGS) -timeout=2m diff --git a/builder/amazon/chroot/builder.go b/builder/amazon/chroot/builder.go index e0173dadb..dcfd7bc41 100644 --- a/builder/amazon/chroot/builder.go +++ b/builder/amazon/chroot/builder.go @@ -25,19 +25,24 @@ const BuilderId = "mitchellh.amazon.chroot" // Config is the configuration that is chained through the steps and // settable from the template. type Config struct { - common.PackerConfig `mapstructure:",squash"` - awscommon.AccessConfig `mapstructure:",squash"` - awscommon.AMIConfig `mapstructure:",squash"` + common.PackerConfig `mapstructure:",squash"` + awscommon.AMIBlockDevices `mapstructure:",squash"` + awscommon.AMIConfig `mapstructure:",squash"` + awscommon.AccessConfig `mapstructure:",squash"` - ChrootMounts [][]string `mapstructure:"chroot_mounts"` - CommandWrapper string `mapstructure:"command_wrapper"` - CopyFiles []string `mapstructure:"copy_files"` - DevicePath string `mapstructure:"device_path"` - MountPath string `mapstructure:"mount_path"` - SourceAmi string `mapstructure:"source_ami"` - RootVolumeSize int64 `mapstructure:"root_volume_size"` - MountOptions []string `mapstructure:"mount_options"` - MountPartition int `mapstructure:"mount_partition"` + ChrootMounts [][]string `mapstructure:"chroot_mounts"` + CommandWrapper string `mapstructure:"command_wrapper"` + CopyFiles []string `mapstructure:"copy_files"` + DevicePath string `mapstructure:"device_path"` + FromScratch bool `mapstructure:"from_scratch"` + MountOptions []string `mapstructure:"mount_options"` + MountPartition int `mapstructure:"mount_partition"` + MountPath string `mapstructure:"mount_path"` + PostMountCommands []string `mapstructure:"post_mount_commands"` + PreMountCommands []string `mapstructure:"pre_mount_commands"` + RootDeviceName string `mapstructure:"root_device_name"` + RootVolumeSize int64 `mapstructure:"root_volume_size"` + SourceAmi string `mapstructure:"source_ami"` ctx interpolate.Context } @@ -59,6 +64,8 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, error) { InterpolateFilter: &interpolate.RenderFilter{ Exclude: []string{ "command_wrapper", + "post_mount_commands", + "pre_mount_commands", "mount_path", }, }, @@ -86,7 +93,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, error) { } } - if len(b.config.CopyFiles) == 0 { + if len(b.config.CopyFiles) == 0 && !b.config.FromScratch { b.config.CopyFiles = []string{"/etc/resolv.conf"} } @@ -102,8 +109,10 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, error) { b.config.MountPartition = 1 } - // Accumulate any errors + // Accumulate any errors or warnings var errs *packer.MultiError + var warns []string + errs = packer.MultiErrorAppend(errs, b.config.AccessConfig.Prepare(&b.config.ctx)...) errs = packer.MultiErrorAppend(errs, b.config.AMIConfig.Prepare(&b.config.ctx)...) @@ -115,16 +124,49 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, error) { } } - if b.config.SourceAmi == "" { - errs = packer.MultiErrorAppend(errs, errors.New("source_ami is required.")) + if b.config.FromScratch { + if b.config.SourceAmi != "" { + warns = append(warns, "source_ami is unused when from_scratch is true") + } + if b.config.RootVolumeSize == 0 { + errs = packer.MultiErrorAppend( + errs, errors.New("root_volume_size is required with from_scratch.")) + } + if len(b.config.PreMountCommands) == 0 { + errs = packer.MultiErrorAppend( + errs, errors.New("pre_mount_commands is required with from_scratch.")) + } + if b.config.AMIVirtType == "" { + errs = packer.MultiErrorAppend( + errs, errors.New("ami_virtualization_type is required with from_scratch.")) + } + if b.config.RootDeviceName == "" { + errs = packer.MultiErrorAppend( + errs, errors.New("root_device_name is required with from_scratch.")) + } + if len(b.config.AMIMappings) == 0 { + errs = packer.MultiErrorAppend( + errs, errors.New("ami_block_device_mappings is required with from_scratch.")) + } + } else { + if b.config.SourceAmi == "" { + errs = packer.MultiErrorAppend( + errs, errors.New("source_ami is required.")) + } + if len(b.config.AMIMappings) != 0 { + warns = append(warns, "ami_block_device_mappings are unused when from_scratch is false") + } + if b.config.RootDeviceName != "" { + warns = append(warns, "root_device_name is unused when from_scratch is false") + } } if errs != nil && len(errs.Errors) > 0 { - return nil, errs + return warns, errs } log.Println(common.ScrubConfig(b.config, b.config.AccessKey, b.config.SecretKey)) - return nil, nil + return warns, nil } func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packer.Artifact, error) { @@ -161,11 +203,19 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe ForceDeregister: b.config.AMIForceDeregister, }, &StepInstanceInfo{}, - &awscommon.StepSourceAMIInfo{ - SourceAmi: b.config.SourceAmi, - EnhancedNetworking: b.config.AMIEnhancedNetworking, - }, - &StepCheckRootDevice{}, + } + + if !b.config.FromScratch { + steps = append(steps, + &awscommon.StepSourceAMIInfo{ + SourceAmi: b.config.SourceAmi, + EnhancedNetworking: b.config.AMIEnhancedNetworking, + }, + &StepCheckRootDevice{}, + ) + } + + steps = append(steps, &StepFlock{}, &StepPrepareDevice{}, &StepCreateVolume{ @@ -173,10 +223,16 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe }, &StepAttachVolume{}, &StepEarlyUnflock{}, + &StepPreMountCommands{ + Commands: b.config.PreMountCommands, + }, &StepMountDevice{ MountOptions: b.config.MountOptions, MountPartition: b.config.MountPartition, }, + &StepPostMountCommands{ + Commands: b.config.PostMountCommands, + }, &StepMountExtra{}, &StepCopyFiles{}, &StepChrootProvision{}, @@ -203,18 +259,10 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe &awscommon.StepCreateTags{ Tags: b.config.AMITags, }, - } + ) // Run! - if b.config.PackerDebug { - b.runner = &multistep.DebugRunner{ - Steps: steps, - PauseFn: common.MultistepDebugFn(ui), - } - } else { - b.runner = &multistep.BasicRunner{Steps: steps} - } - + b.runner = common.NewRunner(steps, b.config.PackerConfig, ui) b.runner.Run(state) // If there was an error, return that diff --git a/builder/amazon/chroot/run_local_commands.go b/builder/amazon/chroot/run_local_commands.go new file mode 100644 index 000000000..bc339ed11 --- /dev/null +++ b/builder/amazon/chroot/run_local_commands.go @@ -0,0 +1,37 @@ +package chroot + +import ( + "fmt" + + "github.com/mitchellh/packer/packer" + "github.com/mitchellh/packer/post-processor/shell-local" + "github.com/mitchellh/packer/template/interpolate" +) + +func RunLocalCommands(commands []string, wrappedCommand CommandWrapper, ctx interpolate.Context, ui packer.Ui) error { + for _, rawCmd := range commands { + intCmd, err := interpolate.Render(rawCmd, &ctx) + if err != nil { + return fmt.Errorf("Error interpolating: %s", err) + } + + command, err := wrappedCommand(intCmd) + if err != nil { + return fmt.Errorf("Error wrapping command: %s", err) + } + + ui.Say(fmt.Sprintf("Executing command: %s", command)) + comm := &shell_local.Communicator{} + cmd := &packer.RemoteCmd{Command: command} + if err := cmd.StartWithUi(comm, ui); err != nil { + return fmt.Errorf("Error executing command: %s", err) + } + if cmd.ExitStatus != 0 { + return fmt.Errorf( + "Received non-zero exit code %d from command: %s", + cmd.ExitStatus, + command) + } + } + return nil +} diff --git a/builder/amazon/chroot/step_create_volume.go b/builder/amazon/chroot/step_create_volume.go index b190fbed1..a527d86dd 100644 --- a/builder/amazon/chroot/step_create_volume.go +++ b/builder/amazon/chroot/step_create_volume.go @@ -22,40 +22,52 @@ type StepCreateVolume struct { } func (s *StepCreateVolume) Run(state multistep.StateBag) multistep.StepAction { + config := state.Get("config").(*Config) ec2conn := state.Get("ec2").(*ec2.EC2) - image := state.Get("source_image").(*ec2.Image) instance := state.Get("instance").(*ec2.Instance) ui := state.Get("ui").(packer.Ui) - // Determine the root device snapshot - log.Printf("Searching for root device of the image (%s)", *image.RootDeviceName) - var rootDevice *ec2.BlockDeviceMapping - for _, device := range image.BlockDeviceMappings { - if *device.DeviceName == *image.RootDeviceName { - rootDevice = device - break + var createVolume *ec2.CreateVolumeInput + if config.FromScratch { + createVolume = &ec2.CreateVolumeInput{ + AvailabilityZone: instance.Placement.AvailabilityZone, + Size: aws.Int64(s.RootVolumeSize), + VolumeType: aws.String(ec2.VolumeTypeGp2), + } + } else { + // Determine the root device snapshot + image := state.Get("source_image").(*ec2.Image) + log.Printf("Searching for root device of the image (%s)", *image.RootDeviceName) + var rootDevice *ec2.BlockDeviceMapping + for _, device := range image.BlockDeviceMappings { + if *device.DeviceName == *image.RootDeviceName { + rootDevice = device + break + } + } + + if rootDevice == nil { + err := fmt.Errorf("Couldn't find root device!") + state.Put("error", err) + ui.Error(err.Error()) + return multistep.ActionHalt + } + + ui.Say("Creating the root volume...") + vs := *rootDevice.Ebs.VolumeSize + if s.RootVolumeSize > *rootDevice.Ebs.VolumeSize { + vs = s.RootVolumeSize + } + + createVolume = &ec2.CreateVolumeInput{ + AvailabilityZone: instance.Placement.AvailabilityZone, + Size: aws.Int64(vs), + SnapshotId: rootDevice.Ebs.SnapshotId, + VolumeType: rootDevice.Ebs.VolumeType, + Iops: rootDevice.Ebs.Iops, } } - if rootDevice == nil { - err := fmt.Errorf("Couldn't find root device!") - state.Put("error", err) - ui.Error(err.Error()) - return multistep.ActionHalt - } - - ui.Say("Creating the root volume...") - vs := *rootDevice.Ebs.VolumeSize - if s.RootVolumeSize > *rootDevice.Ebs.VolumeSize { - vs = s.RootVolumeSize - } - createVolume := &ec2.CreateVolumeInput{ - AvailabilityZone: instance.Placement.AvailabilityZone, - Size: aws.Int64(vs), - SnapshotId: rootDevice.Ebs.SnapshotId, - VolumeType: rootDevice.Ebs.VolumeType, - Iops: rootDevice.Ebs.Iops, - } log.Printf("Create args: %+v", createVolume) createVolumeResp, err := ec2conn.CreateVolume(createVolume) diff --git a/builder/amazon/chroot/step_mount_device.go b/builder/amazon/chroot/step_mount_device.go index 69878b2d3..c7b74b9e6 100644 --- a/builder/amazon/chroot/step_mount_device.go +++ b/builder/amazon/chroot/step_mount_device.go @@ -33,10 +33,18 @@ type StepMountDevice struct { func (s *StepMountDevice) Run(state multistep.StateBag) multistep.StepAction { config := state.Get("config").(*Config) ui := state.Get("ui").(packer.Ui) - image := state.Get("source_image").(*ec2.Image) device := state.Get("device").(string) wrappedCommand := state.Get("wrappedCommand").(CommandWrapper) + var virtualizationType string + if config.FromScratch { + virtualizationType = config.AMIVirtType + } else { + image := state.Get("source_image").(*ec2.Image) + virtualizationType = *image.VirtualizationType + log.Printf("Source image virtualization type is: %s", virtualizationType) + } + ctx := config.ctx ctx.Data = &mountPathData{Device: filepath.Base(device)} mountPath, err := interpolate.Render(config.MountPath, &ctx) @@ -65,9 +73,8 @@ func (s *StepMountDevice) Run(state multistep.StateBag) multistep.StepAction { return multistep.ActionHalt } - log.Printf("Source image virtualization type is: %s", *image.VirtualizationType) deviceMount := device - if *image.VirtualizationType == "hvm" { + if virtualizationType == "hvm" { deviceMount = fmt.Sprintf("%s%d", device, s.MountPartition) } state.Put("deviceMount", deviceMount) diff --git a/builder/amazon/chroot/step_post_mount_commands.go b/builder/amazon/chroot/step_post_mount_commands.go new file mode 100644 index 000000000..2eb50926c --- /dev/null +++ b/builder/amazon/chroot/step_post_mount_commands.go @@ -0,0 +1,45 @@ +package chroot + +import ( + "github.com/mitchellh/multistep" + "github.com/mitchellh/packer/packer" +) + +type postMountCommandsData struct { + Device string + MountPath string +} + +// StepPostMountCommands allows running arbitrary commands after mounting the +// device, but prior to the bind mount and copy steps. +type StepPostMountCommands struct { + Commands []string +} + +func (s *StepPostMountCommands) Run(state multistep.StateBag) multistep.StepAction { + config := state.Get("config").(*Config) + device := state.Get("device").(string) + mountPath := state.Get("mount_path").(string) + ui := state.Get("ui").(packer.Ui) + wrappedCommand := state.Get("wrappedCommand").(CommandWrapper) + + if len(s.Commands) == 0 { + return multistep.ActionContinue + } + + ctx := config.ctx + ctx.Data = &postMountCommandsData{ + Device: device, + MountPath: mountPath, + } + + ui.Say("Running post-mount commands...") + if err := RunLocalCommands(s.Commands, wrappedCommand, ctx, ui); err != nil { + state.Put("error", err) + ui.Error(err.Error()) + return multistep.ActionHalt + } + return multistep.ActionContinue +} + +func (s *StepPostMountCommands) Cleanup(state multistep.StateBag) {} diff --git a/builder/amazon/chroot/step_pre_mount_commands.go b/builder/amazon/chroot/step_pre_mount_commands.go new file mode 100644 index 000000000..e4561c2d7 --- /dev/null +++ b/builder/amazon/chroot/step_pre_mount_commands.go @@ -0,0 +1,39 @@ +package chroot + +import ( + "github.com/mitchellh/multistep" + "github.com/mitchellh/packer/packer" +) + +type preMountCommandsData struct { + Device string +} + +// StepPreMountCommands sets up the a new block device when building from scratch +type StepPreMountCommands struct { + Commands []string +} + +func (s *StepPreMountCommands) Run(state multistep.StateBag) multistep.StepAction { + config := state.Get("config").(*Config) + device := state.Get("device").(string) + ui := state.Get("ui").(packer.Ui) + wrappedCommand := state.Get("wrappedCommand").(CommandWrapper) + + if len(s.Commands) == 0 { + return multistep.ActionContinue + } + + ctx := config.ctx + ctx.Data = &preMountCommandsData{Device: device} + + ui.Say("Running device setup commands...") + if err := RunLocalCommands(s.Commands, wrappedCommand, ctx, ui); err != nil { + state.Put("error", err) + ui.Error(err.Error()) + return multistep.ActionHalt + } + return multistep.ActionContinue +} + +func (s *StepPreMountCommands) Cleanup(state multistep.StateBag) {} diff --git a/builder/amazon/chroot/step_register_ami.go b/builder/amazon/chroot/step_register_ami.go index f2a59ae01..9b83f941e 100644 --- a/builder/amazon/chroot/step_register_ami.go +++ b/builder/amazon/chroot/step_register_ami.go @@ -18,22 +18,38 @@ type StepRegisterAMI struct { func (s *StepRegisterAMI) Run(state multistep.StateBag) multistep.StepAction { config := state.Get("config").(*Config) ec2conn := state.Get("ec2").(*ec2.EC2) - image := state.Get("source_image").(*ec2.Image) snapshotId := state.Get("snapshot_id").(string) ui := state.Get("ui").(packer.Ui) ui.Say("Registering the AMI...") - blockDevices := make([]*ec2.BlockDeviceMapping, len(image.BlockDeviceMappings)) - for i, device := range image.BlockDeviceMappings { + + var ( + registerOpts *ec2.RegisterImageInput + mappings []*ec2.BlockDeviceMapping + image *ec2.Image + rootDeviceName string + ) + + if config.FromScratch { + mappings = config.AMIBlockDevices.BuildAMIDevices() + rootDeviceName = config.RootDeviceName + } else { + image = state.Get("source_image").(*ec2.Image) + mappings = image.BlockDeviceMappings + rootDeviceName = *image.RootDeviceName + } + + newMappings := make([]*ec2.BlockDeviceMapping, len(mappings)) + for i, device := range mappings { newDevice := device - if *newDevice.DeviceName == *image.RootDeviceName { + if *newDevice.DeviceName == rootDeviceName { if newDevice.Ebs != nil { newDevice.Ebs.SnapshotId = aws.String(snapshotId) } else { newDevice.Ebs = &ec2.EbsBlockDevice{SnapshotId: aws.String(snapshotId)} } - if s.RootVolumeSize > *newDevice.Ebs.VolumeSize { + if config.FromScratch || s.RootVolumeSize > *newDevice.Ebs.VolumeSize { newDevice.Ebs.VolumeSize = aws.Int64(s.RootVolumeSize) } } @@ -44,10 +60,20 @@ func (s *StepRegisterAMI) Run(state multistep.StateBag) multistep.StepAction { newDevice.Ebs.Encrypted = nil } - blockDevices[i] = newDevice + newMappings[i] = newDevice } - registerOpts := buildRegisterOpts(config, image, blockDevices) + if config.FromScratch { + registerOpts = &ec2.RegisterImageInput{ + Name: &config.AMIName, + Architecture: aws.String(ec2.ArchitectureValuesX8664), + RootDeviceName: aws.String(rootDeviceName), + VirtualizationType: aws.String(config.AMIVirtType), + BlockDeviceMappings: newMappings, + } + } else { + registerOpts = buildRegisterOpts(config, image, newMappings) + } // Set SriovNetSupport to "simple". See http://goo.gl/icuXh5 if config.AMIEnhancedNetworking { @@ -88,12 +114,12 @@ func (s *StepRegisterAMI) Run(state multistep.StateBag) multistep.StepAction { func (s *StepRegisterAMI) Cleanup(state multistep.StateBag) {} -func buildRegisterOpts(config *Config, image *ec2.Image, blockDevices []*ec2.BlockDeviceMapping) *ec2.RegisterImageInput { +func buildRegisterOpts(config *Config, image *ec2.Image, mappings []*ec2.BlockDeviceMapping) *ec2.RegisterImageInput { registerOpts := &ec2.RegisterImageInput{ Name: &config.AMIName, Architecture: image.Architecture, RootDeviceName: image.RootDeviceName, - BlockDeviceMappings: blockDevices, + BlockDeviceMappings: mappings, VirtualizationType: image.VirtualizationType, } @@ -105,6 +131,5 @@ func buildRegisterOpts(config *Config, image *ec2.Image, blockDevices []*ec2.Blo registerOpts.KernelId = image.KernelId registerOpts.RamdiskId = image.RamdiskId } - return registerOpts } diff --git a/builder/amazon/common/block_device.go b/builder/amazon/common/block_device.go index 985c582ea..949241463 100644 --- a/builder/amazon/common/block_device.go +++ b/builder/amazon/common/block_device.go @@ -22,7 +22,15 @@ type BlockDevice struct { } type BlockDevices struct { - AMIMappings []BlockDevice `mapstructure:"ami_block_device_mappings"` + AMIBlockDevices `mapstructure:",squash"` + LaunchBlockDevices `mapstructure:",squash"` +} + +type AMIBlockDevices struct { + AMIMappings []BlockDevice `mapstructure:"ami_block_device_mappings"` +} + +type LaunchBlockDevices struct { LaunchMappings []BlockDevice `mapstructure:"launch_block_device_mappings"` } @@ -77,10 +85,10 @@ func (b *BlockDevices) Prepare(ctx *interpolate.Context) []error { return nil } -func (b *BlockDevices) BuildAMIDevices() []*ec2.BlockDeviceMapping { +func (b *AMIBlockDevices) BuildAMIDevices() []*ec2.BlockDeviceMapping { return buildBlockDevices(b.AMIMappings) } -func (b *BlockDevices) BuildLaunchDevices() []*ec2.BlockDeviceMapping { +func (b *LaunchBlockDevices) BuildLaunchDevices() []*ec2.BlockDeviceMapping { return buildBlockDevices(b.LaunchMappings) } diff --git a/builder/amazon/common/block_device_test.go b/builder/amazon/common/block_device_test.go index acdba6fbd..5fc25f243 100644 --- a/builder/amazon/common/block_device_test.go +++ b/builder/amazon/common/block_device_test.go @@ -124,22 +124,26 @@ func TestBlockDevice(t *testing.T) { } for _, tc := range cases { - blockDevices := BlockDevices{ - AMIMappings: []BlockDevice{*tc.Config}, + amiBlockDevices := AMIBlockDevices{ + AMIMappings: []BlockDevice{*tc.Config}, + } + + launchBlockDevices := LaunchBlockDevices{ LaunchMappings: []BlockDevice{*tc.Config}, } expected := []*ec2.BlockDeviceMapping{tc.Result} - got := blockDevices.BuildAMIDevices() - if !reflect.DeepEqual(expected, got) { + + amiResults := amiBlockDevices.BuildAMIDevices() + if !reflect.DeepEqual(expected, amiResults) { t.Fatalf("Bad block device, \nexpected: %#v\n\ngot: %#v", - expected, got) + expected, amiResults) } - if !reflect.DeepEqual(expected, blockDevices.BuildLaunchDevices()) { + launchResults := launchBlockDevices.BuildLaunchDevices() + if !reflect.DeepEqual(expected, launchResults) { t.Fatalf("Bad block device, \nexpected: %#v\n\ngot: %#v", - expected, - blockDevices.BuildLaunchDevices()) + expected, launchResults) } } } diff --git a/builder/amazon/common/ssh.go b/builder/amazon/common/ssh.go index d689d5990..6c38ad97c 100644 --- a/builder/amazon/common/ssh.go +++ b/builder/amazon/common/ssh.go @@ -10,19 +10,32 @@ import ( "golang.org/x/crypto/ssh" ) +type ec2Describer interface { + DescribeInstances(*ec2.DescribeInstancesInput) (*ec2.DescribeInstancesOutput, error) +} + +var ( + // modified in tests + sshHostSleepDuration = time.Second +) + // SSHHost returns a function that can be given to the SSH communicator // for determining the SSH address based on the instance DNS name. -func SSHHost(e *ec2.EC2, private bool) func(multistep.StateBag) (string, error) { +func SSHHost(e ec2Describer, private bool) func(multistep.StateBag) (string, error) { return func(state multistep.StateBag) (string, error) { - for j := 0; j < 2; j++ { + const tries = 2 + // <= with current structure to check result of describing `tries` times + for j := 0; j <= tries; j++ { var host string i := state.Get("instance").(*ec2.Instance) if i.VpcId != nil && *i.VpcId != "" { if i.PublicIpAddress != nil && *i.PublicIpAddress != "" && !private { host = *i.PublicIpAddress - } else { + } else if i.PrivateIpAddress != nil && *i.PrivateIpAddress != "" { host = *i.PrivateIpAddress } + } else if private && i.PrivateIpAddress != nil && *i.PrivateIpAddress != "" { + host = *i.PrivateIpAddress } else if i.PublicDnsName != nil && *i.PublicDnsName != "" { host = *i.PublicDnsName } @@ -42,8 +55,8 @@ func SSHHost(e *ec2.EC2, private bool) func(multistep.StateBag) (string, error) return "", fmt.Errorf("instance not found: %s", *i.InstanceId) } - state.Put("instance", &r.Reservations[0].Instances[0]) - time.Sleep(1 * time.Second) + state.Put("instance", r.Reservations[0].Instances[0]) + time.Sleep(sshHostSleepDuration) } return "", errors.New("couldn't determine IP address for instance") diff --git a/builder/amazon/common/ssh_test.go b/builder/amazon/common/ssh_test.go new file mode 100644 index 000000000..9f1d4a53e --- /dev/null +++ b/builder/amazon/common/ssh_test.go @@ -0,0 +1,118 @@ +package common + +import ( + "testing" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/service/ec2" + "github.com/mitchellh/multistep" +) + +const ( + privateIP = "10.0.0.1" + publicIP = "192.168.1.1" + publicDNS = "public.dns.test" +) + +func TestSSHHost(t *testing.T) { + origSshHostSleepDuration := sshHostSleepDuration + defer func() { sshHostSleepDuration = origSshHostSleepDuration }() + sshHostSleepDuration = 0 + + var cases = []struct { + allowTries int + vpcId string + private bool + + ok bool + wantHost string + }{ + {1, "", false, true, publicDNS}, + {1, "", true, true, privateIP}, + {1, "vpc-id", false, true, publicIP}, + {1, "vpc-id", true, true, privateIP}, + {2, "", false, true, publicDNS}, + {2, "", true, true, privateIP}, + {2, "vpc-id", false, true, publicIP}, + {2, "vpc-id", true, true, privateIP}, + {3, "", false, false, ""}, + {3, "", true, false, ""}, + {3, "vpc-id", false, false, ""}, + {3, "vpc-id", true, false, ""}, + } + + for _, c := range cases { + testSSHHost(t, c.allowTries, c.vpcId, c.private, c.ok, c.wantHost) + } +} + +func testSSHHost(t *testing.T, allowTries int, vpcId string, private, ok bool, wantHost string) { + t.Logf("allowTries=%d vpcId=%s private=%t ok=%t wantHost=%q", allowTries, vpcId, private, ok, wantHost) + + e := &fakeEC2Describer{ + allowTries: allowTries, + vpcId: vpcId, + privateIP: privateIP, + publicIP: publicIP, + publicDNS: publicDNS, + } + + f := SSHHost(e, private) + st := &multistep.BasicStateBag{} + st.Put("instance", &ec2.Instance{ + InstanceId: aws.String("instance-id"), + }) + + host, err := f(st) + + if e.tries > allowTries { + t.Fatalf("got %d ec2 DescribeInstances tries, want %d", e.tries, allowTries) + } + + switch { + case ok && err != nil: + t.Fatalf("expected no error, got %+v", err) + case !ok && err == nil: + t.Fatalf("expected error, got none and host %s", host) + } + + if host != wantHost { + t.Fatalf("got host %s, want %s", host, wantHost) + } +} + +type fakeEC2Describer struct { + allowTries int + tries int + + vpcId string + privateIP, publicIP, publicDNS string +} + +func (d *fakeEC2Describer) DescribeInstances(in *ec2.DescribeInstancesInput) (*ec2.DescribeInstancesOutput, error) { + d.tries++ + + instance := &ec2.Instance{ + InstanceId: aws.String("instance-id"), + } + + if d.vpcId != "" { + instance.VpcId = aws.String(d.vpcId) + } + + if d.tries >= d.allowTries { + instance.PublicIpAddress = aws.String(d.publicIP) + instance.PrivateIpAddress = aws.String(d.privateIP) + instance.PublicDnsName = aws.String(d.publicDNS) + } + + out := &ec2.DescribeInstancesOutput{ + Reservations: []*ec2.Reservation{ + { + Instances: []*ec2.Instance{instance}, + }, + }, + } + + return out, nil +} diff --git a/builder/amazon/common/step_create_tags.go b/builder/amazon/common/step_create_tags.go index 2ac39dc02..0eb98d9a0 100644 --- a/builder/amazon/common/step_create_tags.go +++ b/builder/amazon/common/step_create_tags.go @@ -4,9 +4,11 @@ import ( "fmt" "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/awserr" "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/ec2" "github.com/mitchellh/multistep" + retry "github.com/mitchellh/packer/common" "github.com/mitchellh/packer/packer" ) @@ -71,9 +73,22 @@ func (s *StepCreateTags) Run(state multistep.StateBag) multistep.StepAction { } } - _, err = regionconn.CreateTags(&ec2.CreateTagsInput{ - Resources: resourceIds, - Tags: ec2Tags, + // Retry creating tags for about 2.5 minutes + err = retry.Retry(0.2, 30, 11, func() (bool, error) { + _, err := regionconn.CreateTags(&ec2.CreateTagsInput{ + Resources: resourceIds, + Tags: ec2Tags, + }) + if err == nil { + return true, nil + } + if awsErr, ok := err.(awserr.Error); ok { + if awsErr.Code() == "InvalidAMIID.NotFound" || + awsErr.Code() == "InvalidSnapshot.NotFound" { + return false, nil + } + } + return true, err }) if err != nil { diff --git a/builder/amazon/ebs/builder.go b/builder/amazon/ebs/builder.go index 57b726d84..9ac1ca796 100644 --- a/builder/amazon/ebs/builder.go +++ b/builder/amazon/ebs/builder.go @@ -180,15 +180,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe } // Run! - if b.config.PackerDebug { - b.runner = &multistep.DebugRunner{ - Steps: steps, - PauseFn: common.MultistepDebugFn(ui), - } - } else { - b.runner = &multistep.BasicRunner{Steps: steps} - } - + b.runner = common.NewRunner(steps, b.config.PackerConfig, ui) b.runner.Run(state) // If there was an error, return that diff --git a/builder/amazon/instance/builder.go b/builder/amazon/instance/builder.go index 96b8fa9cc..a900aef9b 100644 --- a/builder/amazon/instance/builder.go +++ b/builder/amazon/instance/builder.go @@ -262,15 +262,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe } // Run! - if b.config.PackerDebug { - b.runner = &multistep.DebugRunner{ - Steps: steps, - PauseFn: common.MultistepDebugFn(ui), - } - } else { - b.runner = &multistep.BasicRunner{Steps: steps} - } - + b.runner = common.NewRunner(steps, b.config.PackerConfig, ui) b.runner.Run(state) // If there was an error, return that diff --git a/builder/azure/arm/builder.go b/builder/azure/arm/builder.go index db344acb3..30029be52 100644 --- a/builder/azure/arm/builder.go +++ b/builder/azure/arm/builder.go @@ -157,7 +157,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe ui.Message(fmt.Sprintf("temp admin password: '%s'", b.config.Password)) } - b.runner = b.createRunner(&steps, ui) + b.runner = packerCommon.NewRunner(steps, b.config.PackerConfig, ui) b.runner.Run(b.stateBag) // Report any errors. @@ -198,19 +198,6 @@ func (b *Builder) Cancel() { } } -func (b *Builder) createRunner(steps *[]multistep.Step, ui packer.Ui) multistep.Runner { - if b.config.PackerDebug { - return &multistep.DebugRunner{ - Steps: *steps, - PauseFn: packerCommon.MultistepDebugFn(ui), - } - } - - return &multistep.BasicRunner{ - Steps: *steps, - } -} - func (b *Builder) getBlobEndpoint(client *AzureClient, resourceGroupName string, storageAccountName string) (string, error) { account, err := client.AccountsClient.GetProperties(resourceGroupName, storageAccountName) if err != nil { diff --git a/builder/azure/arm/resource_resolver.go b/builder/azure/arm/resource_resolver.go index 0dc278b25..d2198fb97 100644 --- a/builder/azure/arm/resource_resolver.go +++ b/builder/azure/arm/resource_resolver.go @@ -76,7 +76,7 @@ func findVirtualNetworkResourceGroup(client *AzureClient, name string) (string, } if len(resourceGroupNames) > 1 { - return "", fmt.Errorf("Found multiple resource groups with a virtual network called %q, please use virtual_network_resource_group_name to disambiguate", name) + return "", fmt.Errorf("Found multiple resource groups with a virtual network called %q, please use virtual_network_subnet_name and virtual_network_resource_group_name to disambiguate", name) } return resourceGroupNames[0], nil @@ -93,7 +93,7 @@ func findVirtualNetworkSubnet(client *AzureClient, resourceGroupName string, nam } if len(*subnets.Value) > 1 { - return "", fmt.Errorf("Found multiple subnets in the resource group %q associated with the virtual network called %q, please use virtual_network_subnet_name to disambiguate", resourceGroupName, name) + return "", fmt.Errorf("Found multiple subnets in the resource group %q associated with the virtual network called %q, please use virtual_network_subnet_name and virtual_network_resource_group_name to disambiguate", resourceGroupName, name) } subnet := (*subnets.Value)[0] diff --git a/builder/digitalocean/builder.go b/builder/digitalocean/builder.go index 0c2cf9686..bafad7522 100644 --- a/builder/digitalocean/builder.go +++ b/builder/digitalocean/builder.go @@ -73,15 +73,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe } // Run the steps - if b.config.PackerDebug { - b.runner = &multistep.DebugRunner{ - Steps: steps, - PauseFn: common.MultistepDebugFn(ui), - } - } else { - b.runner = &multistep.BasicRunner{Steps: steps} - } - + b.runner = common.NewRunner(steps, b.config.PackerConfig, ui) b.runner.Run(state) // If there was an error, return that diff --git a/builder/digitalocean/builder_acc_test.go b/builder/digitalocean/builder_acc_test.go index f9df863cb..4e7931ade 100644 --- a/builder/digitalocean/builder_acc_test.go +++ b/builder/digitalocean/builder_acc_test.go @@ -27,7 +27,9 @@ const testBuilderAccBasic = ` "type": "test", "region": "nyc2", "size": "512mb", - "image": "ubuntu-12-04-x64" + "image": "ubuntu-12-04-x64", + "user_date": "", + "user_date_file": "" }] } ` diff --git a/builder/digitalocean/config.go b/builder/digitalocean/config.go index a32970f40..0474c8b13 100644 --- a/builder/digitalocean/config.go +++ b/builder/digitalocean/config.go @@ -31,6 +31,7 @@ type Config struct { StateTimeout time.Duration `mapstructure:"state_timeout"` DropletName string `mapstructure:"droplet_name"` UserData string `mapstructure:"user_data"` + UserDataFile string `mapstructure:"user_data_file"` ctx interpolate.Context } @@ -113,6 +114,16 @@ func NewConfig(raws ...interface{}) (*Config, []string, error) { errs, errors.New("image is required")) } + if c.UserData != "" && c.UserDataFile != "" { + errs = packer.MultiErrorAppend( + errs, errors.New("only one of user_data or user_data_file can be specified")) + } else if c.UserDataFile != "" { + if _, err := os.Stat(c.UserDataFile); err != nil { + errs = packer.MultiErrorAppend( + errs, errors.New(fmt.Sprintf("user_data_file not found: %s", c.UserDataFile))) + } + } + if errs != nil && len(errs.Errors) > 0 { return nil, nil, errs } diff --git a/builder/digitalocean/step_create_droplet.go b/builder/digitalocean/step_create_droplet.go index aafd53622..45d6db9da 100644 --- a/builder/digitalocean/step_create_droplet.go +++ b/builder/digitalocean/step_create_droplet.go @@ -6,6 +6,7 @@ import ( "github.com/digitalocean/godo" "github.com/mitchellh/multistep" "github.com/mitchellh/packer/packer" + "io/ioutil" ) type stepCreateDroplet struct { @@ -20,6 +21,18 @@ func (s *stepCreateDroplet) Run(state multistep.StateBag) multistep.StepAction { // Create the droplet based on configuration ui.Say("Creating droplet...") + + userData := c.UserData + if c.UserDataFile != "" { + contents, err := ioutil.ReadFile(c.UserDataFile) + if err != nil { + state.Put("error", fmt.Errorf("Problem reading user data file: %s", err)) + return multistep.ActionHalt + } + + userData = string(contents) + } + droplet, _, err := client.Droplets.Create(&godo.DropletCreateRequest{ Name: c.DropletName, Region: c.Region, @@ -31,7 +44,7 @@ func (s *stepCreateDroplet) Run(state multistep.StateBag) multistep.StepAction { godo.DropletCreateSSHKey{ID: int(sshKeyId)}, }, PrivateNetworking: c.PrivateNetworking, - UserData: c.UserData, + UserData: userData, }) if err != nil { err := fmt.Errorf("Error creating droplet: %s", err) diff --git a/builder/digitalocean/step_snapshot.go b/builder/digitalocean/step_snapshot.go index 8974ad23f..129a0d5b1 100644 --- a/builder/digitalocean/step_snapshot.go +++ b/builder/digitalocean/step_snapshot.go @@ -20,7 +20,7 @@ func (s *stepSnapshot) Run(state multistep.StateBag) multistep.StepAction { dropletId := state.Get("droplet_id").(int) ui.Say(fmt.Sprintf("Creating snapshot: %v", c.SnapshotName)) - _, _, err := client.DropletActions.Snapshot(dropletId, c.SnapshotName) + action, _, err := client.DropletActions.Snapshot(dropletId, c.SnapshotName) if err != nil { err := fmt.Errorf("Error creating snapshot: %s", err) state.Put("error", err) @@ -28,6 +28,17 @@ func (s *stepSnapshot) Run(state multistep.StateBag) multistep.StepAction { return multistep.ActionHalt } + // With the pending state over, verify that we're in the active state + ui.Say("Waiting for snapshot to complete...") + if err := waitForActionState(godo.ActionCompleted, dropletId, action.ID, + client, 20*time.Minute); err != nil { + // If we get an error the first time, actually report it + err := fmt.Errorf("Error waiting for snapshot: %s", err) + state.Put("error", err) + ui.Error(err.Error()) + return multistep.ActionHalt + } + // Wait for the droplet to become unlocked first. For snapshots // this can end up taking quite a long time, so we hardcode this to // 20 minutes. @@ -39,16 +50,6 @@ func (s *stepSnapshot) Run(state multistep.StateBag) multistep.StepAction { return multistep.ActionHalt } - // With the pending state over, verify that we're in the active state - ui.Say("Waiting for snapshot to complete...") - err = waitForDropletState("active", dropletId, client, c.StateTimeout) - if err != nil { - err := fmt.Errorf("Error waiting for snapshot to complete: %s", err) - state.Put("error", err) - ui.Error(err.Error()) - return multistep.ActionHalt - } - log.Printf("Looking up snapshot ID for snapshot: %s", c.SnapshotName) images, _, err := client.Droplets.Snapshots(dropletId, nil) if err != nil { diff --git a/builder/digitalocean/wait.go b/builder/digitalocean/wait.go index a41bbb3ed..35446674c 100644 --- a/builder/digitalocean/wait.go +++ b/builder/digitalocean/wait.go @@ -57,7 +57,7 @@ func waitForDropletUnlocked( } } -// waitForState simply blocks until the droplet is in +// waitForDropletState simply blocks until the droplet is in // a state we expect, while eventually timing out. func waitForDropletState( desiredState string, dropletId int, @@ -106,3 +106,53 @@ func waitForDropletState( return err } } + +// waitForActionState simply blocks until the droplet action is in +// a state we expect, while eventually timing out. +func waitForActionState( + desiredState string, dropletId, actionId int, + client *godo.Client, timeout time.Duration) error { + done := make(chan struct{}) + defer close(done) + + result := make(chan error, 1) + go func() { + attempts := 0 + for { + attempts += 1 + + log.Printf("Checking action status... (attempt: %d)", attempts) + action, _, err := client.DropletActions.Get(dropletId, actionId) + if err != nil { + result <- err + return + } + + if action.Status == desiredState { + result <- nil + return + } + + // Wait 3 seconds in between + time.Sleep(3 * time.Second) + + // Verify we shouldn't exit + select { + case <-done: + // We finished, so just exit the goroutine + return + default: + // Keep going + } + } + }() + + log.Printf("Waiting for up to %d seconds for action to become %s", timeout/time.Second, desiredState) + select { + case err := <-result: + return err + case <-time.After(timeout): + err := fmt.Errorf("Timeout while waiting to for action to become '%s'", desiredState) + return err + } +} diff --git a/builder/docker/builder.go b/builder/docker/builder.go index cfc5bf423..8e7e2cf19 100644 --- a/builder/docker/builder.go +++ b/builder/docker/builder.go @@ -78,15 +78,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe state.Put("driver", driver) // Run! - if b.config.PackerDebug { - b.runner = &multistep.DebugRunner{ - Steps: steps, - PauseFn: common.MultistepDebugFn(ui), - } - } else { - b.runner = &multistep.BasicRunner{Steps: steps} - } - + b.runner = common.NewRunner(steps, b.config.PackerConfig, ui) b.runner.Run(state) // If there was an error, return that diff --git a/builder/docker/communicator.go b/builder/docker/communicator.go index c10327344..9fadaa5c2 100644 --- a/builder/docker/communicator.go +++ b/builder/docker/communicator.go @@ -2,7 +2,6 @@ package docker import ( "archive/tar" - "bytes" "fmt" "io" "io/ioutil" @@ -10,12 +9,10 @@ import ( "os" "os/exec" "path/filepath" - "strconv" + "strings" "sync" "syscall" - "time" - "github.com/ActiveState/tail" "github.com/hashicorp/go-version" "github.com/mitchellh/packer/packer" ) @@ -30,42 +27,35 @@ type Communicator struct { } func (c *Communicator) Start(remote *packer.RemoteCmd) error { - // Create a temporary file to store the output. Because of a bug in - // Docker, sometimes all the output doesn't properly show up. This - // file will capture ALL of the output, and we'll read that. - // - // https://github.com/dotcloud/docker/issues/2625 - outputFile, err := ioutil.TempFile(c.HostDir, "cmd") + var cmd *exec.Cmd + if c.Config.Pty { + cmd = exec.Command("docker", "exec", "-i", "-t", c.ContainerId, "/bin/sh", "-c", fmt.Sprintf("(%s)", remote.Command)) + } else { + cmd = exec.Command("docker", "exec", "-i", c.ContainerId, "/bin/sh", "-c", fmt.Sprintf("(%s)", remote.Command)) + } + + var ( + stdin_w io.WriteCloser + err error + ) + + stdin_w, err = cmd.StdinPipe() if err != nil { return err } - outputFile.Close() - // This file will store the exit code of the command once it is complete. - exitCodePath := outputFile.Name() + "-exit" - - var cmd *exec.Cmd - if c.canExec() { - if c.Config.Pty { - cmd = exec.Command("docker", "exec", "-i", "-t", c.ContainerId, "/bin/sh") - } else { - cmd = exec.Command("docker", "exec", "-i", c.ContainerId, "/bin/sh") - } - } else { - cmd = exec.Command("docker", "attach", c.ContainerId) + stderr_r, err := cmd.StderrPipe() + if err != nil { + return err } - stdin_w, err := cmd.StdinPipe() + stdout_r, err := cmd.StdoutPipe() if err != nil { - // We have to do some cleanup since run was never called - os.Remove(outputFile.Name()) - os.Remove(exitCodePath) - return err } // Run the actual command in a goroutine so that Start doesn't block - go c.run(cmd, remote, stdin_w, outputFile, exitCodePath) + go c.run(cmd, remote, stdin_w, stdout_r, stderr_r) return nil } @@ -179,7 +169,7 @@ func (c *Communicator) UploadDir(dst string, src string, exclude []string) error // Make the directory, then copy into it cmd := &packer.RemoteCmd{ - Command: fmt.Sprintf("set -e; mkdir -p %s; command cp -R %s/* %s", + Command: fmt.Sprintf("set -e; mkdir -p %s; cd %s; command cp -R `ls -A .` %s", containerDst, containerSrc, containerDst), } if err := c.Start(cmd); err != nil { @@ -237,105 +227,51 @@ func (c *Communicator) DownloadDir(src string, dst string, exclude []string) err return fmt.Errorf("DownloadDir is not implemented for docker") } -// canExec tells us whether `docker exec` is supported -func (c *Communicator) canExec() bool { - execConstraint, err := version.NewConstraint(">= 1.4.0") - if err != nil { - panic(err) - } - return execConstraint.Check(c.Version) -} - // Runs the given command and blocks until completion -func (c *Communicator) run(cmd *exec.Cmd, remote *packer.RemoteCmd, stdin_w io.WriteCloser, outputFile *os.File, exitCodePath string) { +func (c *Communicator) run(cmd *exec.Cmd, remote *packer.RemoteCmd, stdin io.WriteCloser, stdout, stderr io.ReadCloser) { // For Docker, remote communication must be serialized since it // only supports single execution. c.lock.Lock() defer c.lock.Unlock() - // Clean up after ourselves by removing our temporary files - defer os.Remove(outputFile.Name()) - defer os.Remove(exitCodePath) - - // Tail the output file and send the data to the stdout listener - tail, err := tail.TailFile(outputFile.Name(), tail.Config{ - Poll: true, - ReOpen: true, - Follow: true, - }) - if err != nil { - log.Printf("Error tailing output file: %s", err) - remote.SetExited(254) - return + wg := sync.WaitGroup{} + repeat := func(w io.Writer, r io.ReadCloser) { + io.Copy(w, r) + r.Close() + wg.Done() } - defer tail.Stop() - // Modify the remote command so that all the output of the commands - // go to a single file and so that the exit code is redirected to - // a single file. This lets us determine both when the command - // is truly complete (because the file will have data), what the - // exit status is (because Docker loses it because of the pty, not - // Docker's fault), and get the output (Docker bug). - remoteCmd := fmt.Sprintf("(%s) >%s 2>&1; echo $? >%s", - remote.Command, - filepath.Join(c.ContainerDir, filepath.Base(outputFile.Name())), - filepath.Join(c.ContainerDir, filepath.Base(exitCodePath))) + if remote.Stdout != nil { + wg.Add(1) + go repeat(remote.Stdout, stdout) + } + + if remote.Stderr != nil { + wg.Add(1) + go repeat(remote.Stderr, stderr) + } // Start the command - log.Printf("Executing in container %s: %#v", c.ContainerId, remoteCmd) + log.Printf("Executing %s:", strings.Join(cmd.Args, " ")) if err := cmd.Start(); err != nil { log.Printf("Error executing: %s", err) remote.SetExited(254) return } - go func() { - defer stdin_w.Close() - - // This sleep needs to be here because of the issue linked to below. - // Basically, without it, Docker will hang on reading stdin forever, - // and won't see what we write, for some reason. - // - // https://github.com/dotcloud/docker/issues/2628 - time.Sleep(2 * time.Second) - - stdin_w.Write([]byte(remoteCmd + "\n")) - }() - - // Start a goroutine to read all the lines out of the logs. These channels - // allow us to stop the go-routine and wait for it to be stopped. - stopTailCh := make(chan struct{}) - doneCh := make(chan struct{}) - go func() { - defer close(doneCh) - - for { - select { - case <-tail.Dead(): - return - case line := <-tail.Lines: - if remote.Stdout != nil { - remote.Stdout.Write([]byte(line.Text + "\n")) - } else { - log.Printf("Command stdout: %#v", line.Text) - } - case <-time.After(2 * time.Second): - // If we're done, then return. Otherwise, keep grabbing - // data. This gives us a chance to flush all the lines - // out of the tailed file. - select { - case <-stopTailCh: - return - default: - } - } - } - }() - - var exitRaw []byte var exitStatus int - var exitStatusRaw int64 - err = cmd.Wait() + + if remote.Stdin != nil { + go func() { + io.Copy(stdin, remote.Stdin) + // close stdin to support commands that wait for stdin to be closed before exiting. + stdin.Close() + }() + } + + wg.Wait() + err := cmd.Wait() + if exitErr, ok := err.(*exec.ExitError); ok { exitStatus = 1 @@ -344,45 +280,8 @@ func (c *Communicator) run(cmd *exec.Cmd, remote *packer.RemoteCmd, stdin_w io.W if status, ok := exitErr.Sys().(syscall.WaitStatus); ok { exitStatus = status.ExitStatus() } - - // Say that we ended, since if Docker itself failed, then - // the command must've not run, or so we assume - goto REMOTE_EXIT } - // Wait for the exit code to appear in our file... - log.Println("Waiting for exit code to appear for remote command...") - for { - fi, err := os.Stat(exitCodePath) - if err == nil && fi.Size() > 0 { - break - } - - time.Sleep(1 * time.Second) - } - - // Read the exit code - exitRaw, err = ioutil.ReadFile(exitCodePath) - if err != nil { - log.Printf("Error executing: %s", err) - exitStatus = 254 - goto REMOTE_EXIT - } - - exitStatusRaw, err = strconv.ParseInt(string(bytes.TrimSpace(exitRaw)), 10, 0) - if err != nil { - log.Printf("Error executing: %s", err) - exitStatus = 254 - goto REMOTE_EXIT - } - exitStatus = int(exitStatusRaw) - log.Printf("Executed command exit status: %d", exitStatus) - -REMOTE_EXIT: - // Wait for the tail to finish - close(stopTailCh) - <-doneCh - // Set the exit status which triggers waiters remote.SetExited(exitStatus) } diff --git a/builder/docker/config.go b/builder/docker/config.go index 159c3a138..236a3060d 100644 --- a/builder/docker/config.go +++ b/builder/docker/config.go @@ -35,11 +35,13 @@ type Config struct { // This is used to login to dockerhub to pull a private base container. For // pushing to dockerhub, see the docker post-processors - Login bool - LoginEmail string `mapstructure:"login_email"` - LoginPassword string `mapstructure:"login_password"` - LoginServer string `mapstructure:"login_server"` - LoginUsername string `mapstructure:"login_username"` + Login bool + LoginEmail string `mapstructure:"login_email"` + LoginPassword string `mapstructure:"login_password"` + LoginServer string `mapstructure:"login_server"` + LoginUsername string `mapstructure:"login_username"` + EcrLogin bool `mapstructure:"ecr_login"` + AwsAccessConfig `mapstructure:",squash"` ctx interpolate.Context } @@ -107,6 +109,10 @@ func NewConfig(raws ...interface{}) (*Config, []string, error) { } } + if c.EcrLogin && c.LoginServer == "" { + errs = packer.MultiErrorAppend(errs, fmt.Errorf("ECR login requires login server to be provided.")) + } + if errs != nil && len(errs.Errors) > 0 { return nil, nil, errs } diff --git a/builder/docker/ecr_login.go b/builder/docker/ecr_login.go new file mode 100644 index 000000000..6b0b5c1a3 --- /dev/null +++ b/builder/docker/ecr_login.go @@ -0,0 +1,88 @@ +package docker + +import ( + "encoding/base64" + "fmt" + "log" + "regexp" + "strings" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/credentials" + "github.com/aws/aws-sdk-go/aws/credentials/ec2rolecreds" + "github.com/aws/aws-sdk-go/aws/ec2metadata" + "github.com/aws/aws-sdk-go/aws/session" + "github.com/aws/aws-sdk-go/service/ecr" +) + +type AwsAccessConfig struct { + AccessKey string `mapstructure:"aws_access_key"` + SecretKey string `mapstructure:"aws_secret_key"` + Token string `mapstructure:"aws_token"` +} + +// Config returns a valid aws.Config object for access to AWS services, or +// an error if the authentication and region couldn't be resolved +func (c *AwsAccessConfig) config(region string) (*aws.Config, error) { + var creds *credentials.Credentials + + config := aws.NewConfig().WithRegion(region).WithMaxRetries(11) + sess := session.New(config) + creds = credentials.NewChainCredentials([]credentials.Provider{ + &credentials.StaticProvider{Value: credentials.Value{ + AccessKeyID: c.AccessKey, + SecretAccessKey: c.SecretKey, + SessionToken: c.Token, + }}, + &credentials.EnvProvider{}, + &credentials.SharedCredentialsProvider{Filename: "", Profile: ""}, + &ec2rolecreds.EC2RoleProvider{ + Client: ec2metadata.New(sess), + }, + }) + return config.WithCredentials(creds), nil +} + +// Get a login token for Amazon AWS ECR. Returns username and password +// or an error. +func (c *AwsAccessConfig) EcrGetLogin(ecrUrl string) (string, string, error) { + + exp := regexp.MustCompile("(?:http://|https://|)([0-9]*)\\.dkr\\.ecr\\.(.*)\\.amazonaws\\.com.*") + splitUrl := exp.FindStringSubmatch(ecrUrl) + accountId := splitUrl[1] + region := splitUrl[2] + + log.Println(fmt.Sprintf("Getting ECR token for account: %s in %s..", accountId, region)) + + awsConfig, err := c.config(region) + if err != nil { + return "", "", err + } + + session, err := session.NewSession(awsConfig) + if err != nil { + return "", "", fmt.Errorf("failed to create session: %s", err) + } + + service := ecr.New(session) + + params := &ecr.GetAuthorizationTokenInput{ + RegistryIds: []*string{ + aws.String(accountId), + }, + } + resp, err := service.GetAuthorizationToken(params) + if err != nil { + return "", "", fmt.Errorf(err.Error()) + } + + auth, err := base64.StdEncoding.DecodeString(*resp.AuthorizationData[0].AuthorizationToken) + if err != nil { + return "", "", fmt.Errorf("Error decoding ECR AuthorizationToken: %s", err) + } + + authParts := strings.SplitN(string(auth), ":", 2) + log.Printf("Successfully got login for ECR: %s", ecrUrl) + + return authParts[0], authParts[1], nil +} diff --git a/builder/docker/step_pull.go b/builder/docker/step_pull.go index 346334e1e..3f5b1b62a 100644 --- a/builder/docker/step_pull.go +++ b/builder/docker/step_pull.go @@ -21,7 +21,22 @@ func (s *StepPull) Run(state multistep.StateBag) multistep.StepAction { ui.Say(fmt.Sprintf("Pulling Docker image: %s", config.Image)) - if config.Login { + if config.EcrLogin { + ui.Message("Fetching ECR credentials...") + + username, password, err := config.EcrGetLogin(config.LoginServer) + if err != nil { + err := fmt.Errorf("Error fetching ECR credentials: %s", err) + state.Put("error", err) + ui.Error(err.Error()) + return multistep.ActionHalt + } + + config.LoginUsername = username + config.LoginPassword = password + } + + if config.Login || config.EcrLogin { ui.Message("Logging in...") err := driver.Login( config.LoginServer, diff --git a/builder/googlecompute/artifact.go b/builder/googlecompute/artifact.go index 86d8aa9e1..9d98d6566 100644 --- a/builder/googlecompute/artifact.go +++ b/builder/googlecompute/artifact.go @@ -7,7 +7,7 @@ import ( // Artifact represents a GCE image as the result of a Packer build. type Artifact struct { - image Image + image *Image driver Driver config *Config } @@ -41,16 +41,16 @@ func (a *Artifact) String() string { func (a *Artifact) State(name string) interface{} { switch name { - case "ImageName": - return a.image.Name - case "ImageSizeGb": - return a.image.SizeGb - case "AccountFilePath": - return a.config.AccountFile - case "ProjectId": - return a.config.ProjectId - case "BuildZone": - return a.config.Zone + case "ImageName": + return a.image.Name + case "ImageSizeGb": + return a.image.SizeGb + case "AccountFilePath": + return a.config.AccountFile + case "ProjectId": + return a.config.ProjectId + case "BuildZone": + return a.config.Zone } return nil } diff --git a/builder/googlecompute/builder.go b/builder/googlecompute/builder.go index d4930e033..7be284b50 100644 --- a/builder/googlecompute/builder.go +++ b/builder/googlecompute/builder.go @@ -58,13 +58,18 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe &StepCreateInstance{ Debug: b.config.PackerDebug, }, + &StepCreateWindowsPassword{ + Debug: b.config.PackerDebug, + DebugKeyPath: fmt.Sprintf("gce_windows_%s.pem", b.config.PackerBuildName), + }, &StepInstanceInfo{ Debug: b.config.PackerDebug, }, &communicator.StepConnect{ - Config: &b.config.Comm, - Host: commHost, - SSHConfig: sshConfig, + Config: &b.config.Comm, + Host: commHost, + SSHConfig: sshConfig, + WinRMConfig: winrmConfig, }, new(common.StepProvision), new(StepWaitInstanceStartup), @@ -73,14 +78,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe } // Run the steps. - if b.config.PackerDebug { - b.runner = &multistep.DebugRunner{ - Steps: steps, - PauseFn: common.MultistepDebugFn(ui), - } - } else { - b.runner = &multistep.BasicRunner{Steps: steps} - } + b.runner = common.NewRunner(steps, b.config.PackerConfig, ui) b.runner.Run(state) // Report any errors. @@ -93,7 +91,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe } artifact := &Artifact{ - image: state.Get("image").(Image), + image: state.Get("image").(*Image), driver: driver, config: b.config, } diff --git a/builder/googlecompute/config.go b/builder/googlecompute/config.go index 7c5eb6956..9c80b7271 100644 --- a/builder/googlecompute/config.go +++ b/builder/googlecompute/config.go @@ -49,10 +49,11 @@ type Config struct { UseInternalIP bool `mapstructure:"use_internal_ip"` Zone string `mapstructure:"zone"` - Account AccountFile - privateKeyBytes []byte - stateTimeout time.Duration - ctx interpolate.Context + Account AccountFile + privateKeyBytes []byte + stateTimeout time.Duration + imageAlreadyExists bool + ctx interpolate.Context } func NewConfig(raws ...interface{}) (*Config, []string, error) { @@ -191,4 +192,4 @@ func (c *Config) CalcTimeout() error { } c.stateTimeout = stateTimeout return nil -} \ No newline at end of file +} diff --git a/builder/googlecompute/driver.go b/builder/googlecompute/driver.go index 8c0e53aef..0ccf17aa5 100644 --- a/builder/googlecompute/driver.go +++ b/builder/googlecompute/driver.go @@ -1,16 +1,17 @@ package googlecompute +import ( + "crypto/rsa" + "time" +) + // Driver is the interface that has to be implemented to communicate // with GCE. The Driver interface exists mostly to allow a mock implementation // to be used to test the steps. type Driver interface { - // ImageExists returns true if the specified image exists. If an error - // occurs calling the API, this method returns false. - ImageExists(name string) bool - // CreateImage creates an image from the given disk in Google Compute // Engine. - CreateImage(name, description, family, zone, disk string) (<-chan Image, <-chan error) + CreateImage(name, description, family, zone, disk string) (<-chan *Image, <-chan error) // DeleteImage deletes the image with the given name. DeleteImage(name string) <-chan error @@ -21,26 +22,36 @@ type Driver interface { // DeleteDisk deletes the disk with the given name. DeleteDisk(zone, name string) (<-chan error, error) + // GetImage gets an image; tries the default and public projects. + GetImage(name string) (*Image, error) + + // GetImageFromProject gets an image from a specific project. + GetImageFromProject(project, name string) (*Image, error) + + // GetInstanceMetadata gets a metadata variable for the instance, name. + GetInstanceMetadata(zone, name, key string) (string, error) + // GetInternalIP gets the GCE-internal IP address for the instance. GetInternalIP(zone, name string) (string, error) // GetNatIP gets the NAT IP address for the instance. GetNatIP(zone, name string) (string, error) - + // GetSerialPortOutput gets the Serial Port contents for the instance. GetSerialPortOutput(zone, name string) (string, error) + // ImageExists returns true if the specified image exists. If an error + // occurs calling the API, this method returns false. + ImageExists(name string) bool + // RunInstance takes the given config and launches an instance. RunInstance(*InstanceConfig) (<-chan error, error) // WaitForInstance waits for an instance to reach the given state. WaitForInstance(state, zone, name string) <-chan error -} -type Image struct { - Name string - ProjectId string - SizeGb int64 + // CreateOrResetWindowsPassword creates or resets the password for a user on an Windows instance. + CreateOrResetWindowsPassword(zone, name string, config *WindowsPasswordConfig) (<-chan error, error) } type InstanceConfig struct { @@ -48,7 +59,7 @@ type InstanceConfig struct { Description string DiskSizeGb int64 DiskType string - Image Image + Image *Image MachineType string Metadata map[string]string Name string @@ -61,3 +72,24 @@ type InstanceConfig struct { Tags []string Zone string } + +// WindowsPasswordConfig is the data structue that GCE needs to encrypt the created +// windows password. +type WindowsPasswordConfig struct { + key *rsa.PrivateKey + password string + UserName string `json:"userName"` + Modulus string `json:"modulus"` + Exponent string `json:"exponent"` + Email string `json:"email"` + ExpireOn time.Time `json:"expireOn"` +} + +type windowsPasswordResponse struct { + UserName string `json:"userName"` + PasswordFound bool `json:"passwordFound"` + EncryptedPassword string `json:"encryptedPassword"` + Modulus string `json:"modulus"` + Exponent string `json:"exponent"` + ErrorMessage string `json:"errorMessage"` +} diff --git a/builder/googlecompute/driver_gce.go b/builder/googlecompute/driver_gce.go index 1c0292e07..2da03157e 100644 --- a/builder/googlecompute/driver_gce.go +++ b/builder/googlecompute/driver_gce.go @@ -1,11 +1,20 @@ package googlecompute import ( + "crypto/rand" + "crypto/rsa" + "crypto/sha1" + "encoding/base64" + "encoding/json" + "errors" "fmt" "log" "net/http" "runtime" + "strings" + "time" + "github.com/mitchellh/packer/common" "github.com/mitchellh/packer/packer" "github.com/mitchellh/packer/version" @@ -13,7 +22,6 @@ import ( "golang.org/x/oauth2/google" "golang.org/x/oauth2/jwt" "google.golang.org/api/compute/v1" - "strings" ) // driverGCE is a Driver implementation that actually talks to GCE. @@ -88,15 +96,8 @@ func NewDriverGCE(ui packer.Ui, p string, a *AccountFile) (Driver, error) { }, nil } -func (d *driverGCE) ImageExists(name string) bool { - _, err := d.service.Images.Get(d.projectId, name).Do() - // The API may return an error for reasons other than the image not - // existing, but this heuristic is sufficient for now. - return err == nil -} - -func (d *driverGCE) CreateImage(name, description, family, zone, disk string) (<-chan Image, <-chan error) { - image := &compute.Image{ +func (d *driverGCE) CreateImage(name, description, family, zone, disk string) (<-chan *Image, <-chan error) { + gce_image := &compute.Image{ Description: description, Name: name, Family: family, @@ -104,9 +105,9 @@ func (d *driverGCE) CreateImage(name, description, family, zone, disk string) (< SourceType: "RAW", } - imageCh := make(chan Image, 1) + imageCh := make(chan *Image, 1) errCh := make(chan error, 1) - op, err := d.service.Images.Insert(d.projectId, image).Do() + op, err := d.service.Images.Insert(d.projectId, gce_image).Do() if err != nil { errCh <- err } else { @@ -114,17 +115,17 @@ func (d *driverGCE) CreateImage(name, description, family, zone, disk string) (< err = waitForState(errCh, "DONE", d.refreshGlobalOp(op)) if err != nil { close(imageCh) + errCh <- err + return } - image, err = d.getImage(name, d.projectId) + var image *Image + image, err = d.GetImageFromProject(d.projectId, name) if err != nil { close(imageCh) errCh <- err + return } - imageCh <- Image{ - Name: name, - ProjectId: d.projectId, - SizeGb: image.DiskSizeGb, - } + imageCh <- image close(imageCh) }() } @@ -166,6 +167,57 @@ func (d *driverGCE) DeleteDisk(zone, name string) (<-chan error, error) { return errCh, nil } +func (d *driverGCE) GetImage(name string) (*Image, error) { + projects := []string{d.projectId, "centos-cloud", "coreos-cloud", "debian-cloud", "google-containers", "opensuse-cloud", "rhel-cloud", "suse-cloud", "ubuntu-os-cloud", "windows-cloud", "gce-nvme"} + var errs error + for _, project := range projects { + image, err := d.GetImageFromProject(project, name) + if err != nil { + errs = packer.MultiErrorAppend(errs, err) + } + if image != nil { + return image, nil + } + } + + return nil, fmt.Errorf( + "Could not find image, %s, in projects, %s: %s", name, + projects, errs) +} + +func (d *driverGCE) GetImageFromProject(project, name string) (*Image, error) { + image, err := d.service.Images.Get(project, name).Do() + + if err != nil { + return nil, err + } else if image == nil || image.SelfLink == "" { + return nil, fmt.Errorf("Image, %s, could not be found in project: %s", name, project) + } else { + return &Image{ + Licenses: image.Licenses, + Name: image.Name, + ProjectId: project, + SelfLink: image.SelfLink, + SizeGb: image.DiskSizeGb, + }, nil + } +} + +func (d *driverGCE) GetInstanceMetadata(zone, name, key string) (string, error) { + instance, err := d.service.Instances.Get(d.projectId, zone, name).Do() + if err != nil { + return "", err + } + + for _, item := range instance.Metadata.Items { + if item.Key == key { + return *item.Value, nil + } + } + + return "", fmt.Errorf("Instance metadata key, %s, not found.", key) +} + func (d *driverGCE) GetNatIP(zone, name string) (string, error) { instance, err := d.service.Instances.Get(d.projectId, zone, name).Do() if err != nil { @@ -207,10 +259,17 @@ func (d *driverGCE) GetSerialPortOutput(zone, name string) (string, error) { if err != nil { return "", err } - + return output.Contents, nil } +func (d *driverGCE) ImageExists(name string) bool { + _, err := d.GetImageFromProject(d.projectId, name) + // The API may return an error for reasons other than the image not + // existing, but this heuristic is sufficient for now. + return err == nil +} + func (d *driverGCE) RunInstance(c *InstanceConfig) (<-chan error, error) { // Get the zone d.ui.Message(fmt.Sprintf("Loading zone: %s", c.Zone)) @@ -219,13 +278,6 @@ func (d *driverGCE) RunInstance(c *InstanceConfig) (<-chan error, error) { return nil, err } - // Get the image - d.ui.Message(fmt.Sprintf("Loading image: %s in project %s", c.Image.Name, c.Image.ProjectId)) - image, err := d.getImage(c.Image.Name, c.Image.ProjectId) - if err != nil { - return nil, err - } - // Get the machine type d.ui.Message(fmt.Sprintf("Loading machine type: %s", c.MachineType)) machineType, err := d.service.MachineTypes.Get( @@ -302,7 +354,7 @@ func (d *driverGCE) RunInstance(c *InstanceConfig) (<-chan error, error) { Boot: true, AutoDelete: false, InitializeParams: &compute.AttachedDiskInitializeParams{ - SourceImage: image.SelfLink, + SourceImage: c.Image.SelfLink, DiskSizeGb: c.DiskSizeGb, DiskType: fmt.Sprintf("zones/%s/diskTypes/%s", zone.Name, c.DiskType), }, @@ -349,26 +401,118 @@ func (d *driverGCE) RunInstance(c *InstanceConfig) (<-chan error, error) { return errCh, nil } +func (d *driverGCE) CreateOrResetWindowsPassword(instance, zone string, c *WindowsPasswordConfig) (<-chan error, error) { + + errCh := make(chan error, 1) + go d.createWindowsPassword(errCh, instance, zone, c) + + return errCh, nil +} + +func (d *driverGCE) createWindowsPassword(errCh chan<- error, name, zone string, c *WindowsPasswordConfig) { + + data, err := json.Marshal(c) + + if err != nil { + errCh <- err + return + } + dCopy := string(data) + + instance, err := d.service.Instances.Get(d.projectId, zone, name).Do() + instance.Metadata.Items = append(instance.Metadata.Items, &compute.MetadataItems{Key: "windows-keys", Value: &dCopy}) + + op, err := d.service.Instances.SetMetadata(d.projectId, zone, name, &compute.Metadata{ + Fingerprint: instance.Metadata.Fingerprint, + Items: instance.Metadata.Items, + }).Do() + + if err != nil { + errCh <- err + return + } + + newErrCh := make(chan error, 1) + go waitForState(newErrCh, "DONE", d.refreshZoneOp(zone, op)) + + select { + case err = <-newErrCh: + case <-time.After(time.Second * 30): + err = errors.New("time out while waiting for instance to create") + } + + if err != nil { + errCh <- err + return + } + + timeout := time.Now().Add(time.Minute * 3) + hash := sha1.New() + random := rand.Reader + + for time.Now().Before(timeout) { + if passwordResponses, err := d.getPasswordResponses(zone, name); err == nil { + for _, response := range passwordResponses { + if response.Modulus == c.Modulus { + + decodedPassword, err := base64.StdEncoding.DecodeString(response.EncryptedPassword) + + if err != nil { + errCh <- err + return + } + password, err := rsa.DecryptOAEP(hash, random, c.key, decodedPassword, nil) + + if err != nil { + errCh <- err + return + } + + c.password = string(password) + errCh <- nil + return + } + } + } + + time.Sleep(2 * time.Second) + } + err = errors.New("Could not retrieve password. Timed out.") + + errCh <- err + return + +} + +func (d *driverGCE) getPasswordResponses(zone, instance string) ([]windowsPasswordResponse, error) { + output, err := d.service.Instances.GetSerialPortOutput(d.projectId, zone, instance).Port(4).Do() + + if err != nil { + return nil, err + } + + responses := strings.Split(output.Contents, "\n") + + passwordResponses := make([]windowsPasswordResponse, 0, len(responses)) + + for _, response := range responses { + var passwordResponse windowsPasswordResponse + if err := json.Unmarshal([]byte(response), &passwordResponse); err != nil { + continue + } + + passwordResponses = append(passwordResponses, passwordResponse) + } + + return passwordResponses, nil +} + func (d *driverGCE) WaitForInstance(state, zone, name string) <-chan error { errCh := make(chan error, 1) go waitForState(errCh, state, d.refreshInstanceState(zone, name)) return errCh } -func (d *driverGCE) getImage(name, projectId string) (image *compute.Image, err error) { - projects := []string{projectId, "centos-cloud", "coreos-cloud", "debian-cloud", "google-containers", "opensuse-cloud", "rhel-cloud", "suse-cloud", "ubuntu-os-cloud", "windows-cloud"} - for _, project := range projects { - image, err = d.service.Images.Get(project, name).Do() - if err == nil && image != nil && image.SelfLink != "" { - return - } - image = nil - } - - err = fmt.Errorf("Image %s could not be found in any of these projects: %s", name, projects) - return -} - func (d *driverGCE) refreshInstanceState(zone, name string) stateRefreshFunc { return func() (string, error) { instance, err := d.service.Instances.Get(d.projectId, zone, name).Do() @@ -428,7 +572,7 @@ type stateRefreshFunc func() (string, error) // waitForState will spin in a loop forever waiting for state to // reach a certain target. func waitForState(errCh chan<- error, target string, refresh stateRefreshFunc) error { - err := Retry(2, 2, 0, func() (bool, error) { + err := common.Retry(2, 2, 0, func() (bool, error) { state, err := refresh() if err != nil { return false, err diff --git a/builder/googlecompute/driver_mock.go b/builder/googlecompute/driver_mock.go index 90ab726c5..0c3e72a00 100644 --- a/builder/googlecompute/driver_mock.go +++ b/builder/googlecompute/driver_mock.go @@ -1,20 +1,21 @@ package googlecompute +import "fmt" + // DriverMock is a Driver implementation that is a mocked out so that // it can be used for tests. type DriverMock struct { - ImageExistsName string - ImageExistsResult bool - - CreateImageName string - CreateImageDesc string - CreateImageFamily string - CreateImageZone string - CreateImageDisk string - CreateImageProjectId string - CreateImageSizeGb int64 - CreateImageErrCh <-chan error - CreateImageResultCh <-chan Image + CreateImageName string + CreateImageDesc string + CreateImageFamily string + CreateImageZone string + CreateImageDisk string + CreateImageResultLicenses []string + CreateImageResultProjectId string + CreateImageResultSelfLink string + CreateImageResultSizeGb int64 + CreateImageErrCh <-chan error + CreateImageResultCh <-chan *Image DeleteImageName string DeleteImageErrCh <-chan error @@ -29,6 +30,21 @@ type DriverMock struct { DeleteDiskErrCh <-chan error DeleteDiskErr error + GetImageName string + GetImageResult *Image + GetImageErr error + + GetImageFromProjectProject string + GetImageFromProjectName string + GetImageFromProjectResult *Image + GetImageFromProjectErr error + + GetInstanceMetadataZone string + GetInstanceMetadataName string + GetInstanceMetadataKey string + GetInstanceMetadataResult string + GetInstanceMetadataErr error + GetNatIPZone string GetNatIPName string GetNatIPResult string @@ -38,47 +54,58 @@ type DriverMock struct { GetInternalIPName string GetInternalIPResult string GetInternalIPErr error - + GetSerialPortOutputZone string GetSerialPortOutputName string GetSerialPortOutputResult string GetSerialPortOutputErr error + ImageExistsName string + ImageExistsResult bool + RunInstanceConfig *InstanceConfig RunInstanceErrCh <-chan error RunInstanceErr error + CreateOrResetWindowsPasswordZone string + CreateOrResetWindowsPasswordInstance string + CreateOrResetWindowsPasswordConfig *WindowsPasswordConfig + CreateOrResetWindowsPasswordErr error + CreateOrResetWindowsPasswordErrCh <-chan error + WaitForInstanceState string WaitForInstanceZone string WaitForInstanceName string WaitForInstanceErrCh <-chan error } -func (d *DriverMock) ImageExists(name string) bool { - d.ImageExistsName = name - return d.ImageExistsResult -} - -func (d *DriverMock) CreateImage(name, description, family, zone, disk string) (<-chan Image, <-chan error) { +func (d *DriverMock) CreateImage(name, description, family, zone, disk string) (<-chan *Image, <-chan error) { d.CreateImageName = name d.CreateImageDesc = description d.CreateImageFamily = family d.CreateImageZone = zone d.CreateImageDisk = disk - if d.CreateImageSizeGb == 0 { - d.CreateImageSizeGb = 10 + if d.CreateImageResultProjectId == "" { + d.CreateImageResultProjectId = "test" } - if d.CreateImageProjectId == "" { - d.CreateImageProjectId = "test" + if d.CreateImageResultSelfLink == "" { + d.CreateImageResultSelfLink = fmt.Sprintf( + "http://content.googleapis.com/compute/v1/%s/global/licenses/test", + d.CreateImageResultProjectId) + } + if d.CreateImageResultSizeGb == 0 { + d.CreateImageResultSizeGb = 10 } resultCh := d.CreateImageResultCh if resultCh == nil { - ch := make(chan Image, 1) - ch <- Image{ + ch := make(chan *Image, 1) + ch <- &Image{ + Licenses: d.CreateImageResultLicenses, Name: name, - ProjectId: d.CreateImageProjectId, - SizeGb: d.CreateImageSizeGb, + ProjectId: d.CreateImageResultProjectId, + SelfLink: d.CreateImageResultSelfLink, + SizeGb: d.CreateImageResultSizeGb, } close(ch) resultCh = ch @@ -135,6 +162,24 @@ func (d *DriverMock) DeleteDisk(zone, name string) (<-chan error, error) { return resultCh, d.DeleteDiskErr } +func (d *DriverMock) GetImage(name string) (*Image, error) { + d.GetImageName = name + return d.GetImageResult, d.GetImageErr +} + +func (d *DriverMock) GetImageFromProject(project, name string) (*Image, error) { + d.GetImageFromProjectProject = project + d.GetImageFromProjectName = name + return d.GetImageFromProjectResult, d.GetImageFromProjectErr +} + +func (d *DriverMock) GetInstanceMetadata(zone, name, key string) (string, error) { + d.GetInstanceMetadataZone = zone + d.GetInstanceMetadataName = name + d.GetInstanceMetadataKey = key + return d.GetInstanceMetadataResult, d.GetInstanceMetadataErr +} + func (d *DriverMock) GetNatIP(zone, name string) (string, error) { d.GetNatIPZone = zone d.GetNatIPName = name @@ -153,6 +198,11 @@ func (d *DriverMock) GetSerialPortOutput(zone, name string) (string, error) { return d.GetSerialPortOutputResult, d.GetSerialPortOutputErr } +func (d *DriverMock) ImageExists(name string) bool { + d.ImageExistsName = name + return d.ImageExistsResult +} + func (d *DriverMock) RunInstance(c *InstanceConfig) (<-chan error, error) { d.RunInstanceConfig = c @@ -180,3 +230,25 @@ func (d *DriverMock) WaitForInstance(state, zone, name string) <-chan error { return resultCh } + +func (d *DriverMock) GetWindowsPassword() (string, error) { + return "", nil +} + +func (d *DriverMock) CreateOrResetWindowsPassword(instance, zone string, c *WindowsPasswordConfig) (<-chan error, error) { + + d.CreateOrResetWindowsPasswordInstance = instance + d.CreateOrResetWindowsPasswordZone = zone + d.CreateOrResetWindowsPasswordConfig = c + + c.password = "MOCK_PASSWORD" + + resultCh := d.CreateOrResetWindowsPasswordErrCh + if resultCh == nil { + ch := make(chan error) + close(ch) + resultCh = ch + } + + return resultCh, d.CreateOrResetWindowsPasswordErr +} diff --git a/builder/googlecompute/image.go b/builder/googlecompute/image.go new file mode 100644 index 000000000..11fe7df55 --- /dev/null +++ b/builder/googlecompute/image.go @@ -0,0 +1,22 @@ +package googlecompute + +import ( + "strings" +) + +type Image struct { + Licenses []string + Name string + ProjectId string + SelfLink string + SizeGb int64 +} + +func (i *Image) IsWindows() bool { + for _, license := range i.Licenses { + if strings.Contains(license, "windows") { + return true + } + } + return false +} diff --git a/builder/googlecompute/image_test.go b/builder/googlecompute/image_test.go new file mode 100644 index 000000000..d6ac8e99f --- /dev/null +++ b/builder/googlecompute/image_test.go @@ -0,0 +1,26 @@ +package googlecompute + +import ( + "fmt" + "testing" + + "github.com/stretchr/testify/assert" +) + +func StubImage(name, project string, licenses []string, sizeGb int64) *Image { + return &Image{ + Licenses: licenses, + Name: name, + ProjectId: project, + SelfLink: fmt.Sprintf("https://www.googleapis.com/compute/v1/projects/%s/global/images/%s", project, name), + SizeGb: sizeGb, + } +} + +func TestImage_IsWindows(t *testing.T) { + i := StubImage("foo", "foo-project", []string{"license-foo", "license-bar"}, 100) + assert.False(t, i.IsWindows()) + + i = StubImage("foo", "foo-project", []string{"license-foo", "windows-license"}, 100) + assert.True(t, i.IsWindows()) +} diff --git a/builder/googlecompute/startup.go b/builder/googlecompute/startup.go index 308e33e18..5b550fe39 100644 --- a/builder/googlecompute/startup.go +++ b/builder/googlecompute/startup.go @@ -1,37 +1,40 @@ package googlecompute import ( - "encoding/base64" "fmt" ) -const StartupScriptStartLog string = "Packer startup script starting." -const StartupScriptDoneLog string = "Packer startup script done." const StartupScriptKey string = "startup-script" +const StartupScriptStatusKey string = "startup-script-status" const StartupWrappedScriptKey string = "packer-wrapped-startup-script" -// We have to encode StartupScriptDoneLog because we use it as a sentinel value to indicate -// that the user-provided startup script is done. If we pass StartupScriptDoneLog as-is, it -// will be printed early in the instance console log (before the startup script even runs; -// we print out instance creation metadata which contains this wrapper script). -var StartupScriptDoneLogBase64 string = base64.StdEncoding.EncodeToString([]byte(StartupScriptDoneLog)) +const StartupScriptStatusDone string = "done" +const StartupScriptStatusError string = "error" +const StartupScriptStatusNotDone string = "notdone" -var StartupScript string = fmt.Sprintf(`#!/bin/bash -echo %s +var StartupScriptLinux string = fmt.Sprintf(`#!/bin/bash +echo "Packer startup script starting." RETVAL=0 +BASEMETADATAURL=http://metadata/computeMetadata/v1/instance/ GetMetadata () { - echo "$(curl -f -H "Metadata-Flavor: Google" http://metadata/computeMetadata/v1/instance/attributes/$1 2> /dev/null)" + echo "$(curl -f -H "Metadata-Flavor: Google" ${BASEMETADATAURL}/${1} 2> /dev/null)" } -STARTUPSCRIPT=$(GetMetadata %s) +ZONE=$(GetMetadata zone | grep -oP "[^/]*$") + +SetMetadata () { + gcloud compute instances add-metadata ${HOSTNAME} --metadata ${1}=${2} --zone ${ZONE} +} + +STARTUPSCRIPT=$(GetMetadata attributes/%s) STARTUPSCRIPTPATH=/packer-wrapped-startup-script if [ -f "/var/log/startupscript.log" ]; then STARTUPSCRIPTLOGPATH=/var/log/startupscript.log else STARTUPSCRIPTLOGPATH=/var/log/daemon.log fi -STARTUPSCRIPTLOGDEST=$(GetMetadata startup-script-log-dest) +STARTUPSCRIPTLOGDEST=$(GetMetadata attributes/startup-script-log-dest) if [[ ! -z $STARTUPSCRIPT ]]; then echo "Executing user-provided startup script..." @@ -48,6 +51,9 @@ if [[ ! -z $STARTUPSCRIPT ]]; then rm ${STARTUPSCRIPTPATH} fi -echo $(echo %s | base64 --decode) +echo "Packer startup script done." +SetMetadata %s %s exit $RETVAL -`, StartupScriptStartLog, StartupWrappedScriptKey, StartupScriptDoneLogBase64) +`, StartupWrappedScriptKey, StartupScriptStatusKey, StartupScriptStatusDone) + +var StartupScriptWindows string = "" diff --git a/builder/googlecompute/step_check_existing_image.go b/builder/googlecompute/step_check_existing_image.go index 2a3365739..dbad5cf1c 100644 --- a/builder/googlecompute/step_check_existing_image.go +++ b/builder/googlecompute/step_check_existing_image.go @@ -13,19 +13,19 @@ type StepCheckExistingImage int // Run executes the Packer build step that checks if the image already exists. func (s *StepCheckExistingImage) Run(state multistep.StateBag) multistep.StepAction { - config := state.Get("config").(*Config) - driver := state.Get("driver").(Driver) + c := state.Get("config").(*Config) + d := state.Get("driver").(Driver) ui := state.Get("ui").(packer.Ui) ui.Say("Checking image does not exist...") - exists := driver.ImageExists(config.ImageName) - if exists { - err := fmt.Errorf("Image %s already exists", config.ImageName) + c.imageAlreadyExists = d.ImageExists(c.ImageName) + if !c.PackerForce && c.imageAlreadyExists { + err := fmt.Errorf("Image %s already exists.\n"+ + "Use the force flag to delete it prior to building.", c.ImageName) state.Put("error", err) ui.Error(err.Error()) return multistep.ActionHalt } - return multistep.ActionContinue } diff --git a/builder/googlecompute/step_create_image.go b/builder/googlecompute/step_create_image.go index f7e531d43..79d0c3df6 100644 --- a/builder/googlecompute/step_create_image.go +++ b/builder/googlecompute/step_create_image.go @@ -22,9 +22,24 @@ func (s *StepCreateImage) Run(state multistep.StateBag) multistep.StepAction { driver := state.Get("driver").(Driver) ui := state.Get("ui").(packer.Ui) + if config.PackerForce && config.imageAlreadyExists { + ui.Say("Deleting previous image...") + + errCh := driver.DeleteImage(config.ImageName) + err := <-errCh + if err != nil { + err := fmt.Errorf("Error deleting image: %s", err) + state.Put("error", err) + ui.Error(err.Error()) + return multistep.ActionHalt + } + } + ui.Say("Creating image...") - imageCh, errCh := driver.CreateImage(config.ImageName, config.ImageDescription, config.ImageFamily, config.Zone, config.DiskName) + imageCh, errCh := driver.CreateImage( + config.ImageName, config.ImageDescription, config.ImageFamily, config.Zone, + config.DiskName) var err error select { case err = <-errCh: diff --git a/builder/googlecompute/step_create_image_test.go b/builder/googlecompute/step_create_image_test.go index c956ec5e3..63c962904 100644 --- a/builder/googlecompute/step_create_image_test.go +++ b/builder/googlecompute/step_create_image_test.go @@ -5,6 +5,7 @@ import ( "testing" "github.com/mitchellh/multistep" + "github.com/stretchr/testify/assert" ) func TestStepCreateImage_impl(t *testing.T) { @@ -16,52 +17,35 @@ func TestStepCreateImage(t *testing.T) { step := new(StepCreateImage) defer step.Cleanup(state) - config := state.Get("config").(*Config) - driver := state.Get("driver").(*DriverMock) - driver.CreateImageProjectId = "createimage-project" - driver.CreateImageSizeGb = 100 + c := state.Get("config").(*Config) + d := state.Get("driver").(*DriverMock) + + // These are the values of the image the driver will return. + d.CreateImageResultLicenses = []string{"test-license"} + d.CreateImageResultProjectId = "test-project" + d.CreateImageResultSizeGb = 100 // run the step - if action := step.Run(state); action != multistep.ActionContinue { - t.Fatalf("bad action: %#v", action) - } - + action := step.Run(state) + assert.Equal(t, action, multistep.ActionContinue, "Step did not pass.") + uncastImage, ok := state.GetOk("image") - if !ok { - t.Fatal("should have image") - } - image, ok := uncastImage.(Image) - if !ok { - t.Fatal("image is not an Image") - } - + assert.True(t, ok, "State does not have resulting image.") + image, ok := uncastImage.(*Image) + assert.True(t, ok, "Image in state is not an Image.") + // Verify created Image results. - if image.Name != config.ImageName { - t.Fatalf("Created image name, %s, does not match config name, %s.", image.Name, config.ImageName) - } - if driver.CreateImageProjectId != image.ProjectId { - t.Fatalf("Created image project ID, %s, does not match driver project ID, %s.", image.ProjectId, driver.CreateImageProjectId) - } - if driver.CreateImageSizeGb != image.SizeGb { - t.Fatalf("Created image size, %d, does not match the expected test value, %d.", image.SizeGb, driver.CreateImageSizeGb) - } + assert.Equal(t, image.Licenses, d.CreateImageResultLicenses, "Created image licenses don't match the licenses returned by the driver.") + assert.Equal(t, image.Name, c.ImageName, "Created image does not match config name.") + assert.Equal(t, image.ProjectId, d.CreateImageResultProjectId, "Created image project does not match driver project.") + assert.Equal(t, image.SizeGb, d.CreateImageResultSizeGb, "Created image size does not match the size returned by the driver.") // Verify proper args passed to driver.CreateImage. - if driver.CreateImageName != config.ImageName { - t.Fatalf("bad: %#v", driver.CreateImageName) - } - if driver.CreateImageDesc != config.ImageDescription { - t.Fatalf("bad: %#v", driver.CreateImageDesc) - } - if driver.CreateImageFamily != config.ImageFamily { - t.Fatalf("bad: %#v", driver.CreateImageFamily) - } - if driver.CreateImageZone != config.Zone { - t.Fatalf("bad: %#v", driver.CreateImageZone) - } - if driver.CreateImageDisk != config.DiskName { - t.Fatalf("bad: %#v", driver.CreateImageDisk) - } + assert.Equal(t, d.CreateImageName, c.ImageName, "Incorrect image name passed to driver.") + assert.Equal(t, d.CreateImageDesc, c.ImageDescription, "Incorrect image description passed to driver.") + assert.Equal(t, d.CreateImageFamily, c.ImageFamily, "Incorrect image family passed to driver.") + assert.Equal(t, d.CreateImageZone, c.Zone, "Incorrect image zone passed to driver.") + assert.Equal(t, d.CreateImageDisk, c.DiskName, "Incorrect disk passed to driver.") } func TestStepCreateImage_errorOnChannel(t *testing.T) { @@ -76,14 +60,10 @@ func TestStepCreateImage_errorOnChannel(t *testing.T) { driver.CreateImageErrCh = errCh // run the step - if action := step.Run(state); action != multistep.ActionHalt { - t.Fatalf("bad action: %#v", action) - } - - if _, ok := state.GetOk("error"); !ok { - t.Fatal("should have error") - } - if _, ok := state.GetOk("image_name"); ok { - t.Fatal("should NOT have image") - } + action := step.Run(state) + assert.Equal(t, action, multistep.ActionHalt, "Step should not have passed.") + _, ok := state.GetOk("error") + assert.True(t, ok, "State should have an error.") + _, ok = state.GetOk("image_name") + assert.False(t, ok, "State should not have a resulting image.") } diff --git a/builder/googlecompute/step_create_instance.go b/builder/googlecompute/step_create_instance.go index bf4a013e8..f4a2c8eb8 100644 --- a/builder/googlecompute/step_create_instance.go +++ b/builder/googlecompute/step_create_instance.go @@ -15,82 +15,101 @@ type StepCreateInstance struct { Debug bool } -func (config *Config) getImage() Image { - project := config.ProjectId - if config.SourceImageProjectId != "" { - project = config.SourceImageProjectId - } - return Image{Name: config.SourceImage, ProjectId: project} -} - -func (config *Config) getInstanceMetadata(sshPublicKey string) (map[string]string, error) { +func (c *Config) createInstanceMetadata(sourceImage *Image, sshPublicKey string) (map[string]string, error) { instanceMetadata := make(map[string]string) var err error // Copy metadata from config. - for k, v := range config.Metadata { + for k, v := range c.Metadata { instanceMetadata[k] = v } // Merge any existing ssh keys with our public key. sshMetaKey := "sshKeys" - sshKeys := fmt.Sprintf("%s:%s", config.Comm.SSHUsername, sshPublicKey) + sshKeys := fmt.Sprintf("%s:%s", c.Comm.SSHUsername, sshPublicKey) if confSshKeys, exists := instanceMetadata[sshMetaKey]; exists { sshKeys = fmt.Sprintf("%s\n%s", sshKeys, confSshKeys) } instanceMetadata[sshMetaKey] = sshKeys - + // Wrap any startup script with our own startup script. - if config.StartupScriptFile != "" { + if c.StartupScriptFile != "" { var content []byte - content, err = ioutil.ReadFile(config.StartupScriptFile) + content, err = ioutil.ReadFile(c.StartupScriptFile) instanceMetadata[StartupWrappedScriptKey] = string(content) } else if wrappedStartupScript, exists := instanceMetadata[StartupScriptKey]; exists { instanceMetadata[StartupWrappedScriptKey] = wrappedStartupScript } - instanceMetadata[StartupScriptKey] = StartupScript + if sourceImage.IsWindows() { + // Windows startup script support is not yet implemented. + // Mark the startup script as done. + instanceMetadata[StartupScriptKey] = StartupScriptWindows + instanceMetadata[StartupScriptStatusKey] = StartupScriptStatusDone + } else { + instanceMetadata[StartupScriptKey] = StartupScriptLinux + instanceMetadata[StartupScriptStatusKey] = StartupScriptStatusNotDone + } return instanceMetadata, err } +func getImage(c *Config, d Driver) (*Image, error) { + if c.SourceImageProjectId == "" { + return d.GetImage(c.SourceImage) + } else { + return d.GetImageFromProject(c.SourceImageProjectId, c.SourceImage) + } +} + // Run executes the Packer build step that creates a GCE instance. func (s *StepCreateInstance) Run(state multistep.StateBag) multistep.StepAction { - config := state.Get("config").(*Config) - driver := state.Get("driver").(Driver) + c := state.Get("config").(*Config) + d := state.Get("driver").(Driver) sshPublicKey := state.Get("ssh_public_key").(string) ui := state.Get("ui").(packer.Ui) + sourceImage, err := getImage(c, d) + if err != nil { + err := fmt.Errorf("Error getting source image for instance creation: %s", err) + state.Put("error", err) + ui.Error(err.Error()) + return multistep.ActionHalt + } + + if sourceImage.IsWindows() && c.Comm.Type == "winrm" && c.Comm.WinRMPassword == "" { + state.Put("create_windows_password", true) + } + ui.Say("Creating instance...") - name := config.InstanceName + name := c.InstanceName var errCh <-chan error - var err error var metadata map[string]string - metadata, err = config.getInstanceMetadata(sshPublicKey) - errCh, err = driver.RunInstance(&InstanceConfig{ - Address: config.Address, + metadata, err = c.createInstanceMetadata(sourceImage, sshPublicKey) + errCh, err = d.RunInstance(&InstanceConfig{ + Address: c.Address, Description: "New instance created by Packer", - DiskSizeGb: config.DiskSizeGb, - DiskType: config.DiskType, - Image: config.getImage(), - MachineType: config.MachineType, + DiskSizeGb: c.DiskSizeGb, + DiskType: c.DiskType, + Image: sourceImage, + MachineType: c.MachineType, Metadata: metadata, Name: name, - Network: config.Network, - OmitExternalIP: config.OmitExternalIP, - Preemptible: config.Preemptible, - Region: config.Region, - ServiceAccountEmail: config.Account.ClientEmail, - Subnetwork: config.Subnetwork, - Tags: config.Tags, - Zone: config.Zone, + Network: c.Network, + OmitExternalIP: c.OmitExternalIP, + Preemptible: c.Preemptible, + Region: c.Region, + ServiceAccountEmail: c.Account.ClientEmail, + Subnetwork: c.Subnetwork, + Tags: c.Tags, + Zone: c.Zone, }) if err == nil { ui.Message("Waiting for creation operation to complete...") select { case err = <-errCh: - case <-time.After(config.stateTimeout): + case <-time.After(c.stateTimeout): err = errors.New("time out while waiting for instance to create") } } @@ -106,7 +125,7 @@ func (s *StepCreateInstance) Run(state multistep.StateBag) multistep.StepAction if s.Debug { if name != "" { - ui.Message(fmt.Sprintf("Instance: %s started in %s", name, config.Zone)) + ui.Message(fmt.Sprintf("Instance: %s started in %s", name, c.Zone)) } } diff --git a/builder/googlecompute/step_create_instance_test.go b/builder/googlecompute/step_create_instance_test.go index f2ccbf57c..8c567479b 100644 --- a/builder/googlecompute/step_create_instance_test.go +++ b/builder/googlecompute/step_create_instance_test.go @@ -2,9 +2,11 @@ package googlecompute import ( "errors" - "github.com/mitchellh/multistep" "testing" "time" + + "github.com/mitchellh/multistep" + "github.com/stretchr/testify/assert" ) func TestStepCreateInstance_impl(t *testing.T) { @@ -18,8 +20,86 @@ func TestStepCreateInstance(t *testing.T) { state.Put("ssh_public_key", "key") + c := state.Get("config").(*Config) + d := state.Get("driver").(*DriverMock) + d.GetImageResult = StubImage("test-image", "test-project", []string{}, 100) + + // run the step + assert.Equal(t, step.Run(state), multistep.ActionContinue, "Step should have passed and continued.") + + // Verify state + nameRaw, ok := state.GetOk("instance_name") + assert.True(t, ok, "State should have an instance name.") + + // cleanup + step.Cleanup(state) + + // Check args passed to the driver. + assert.Equal(t, d.DeleteInstanceName, nameRaw.(string), "Incorrect instance name passed to driver.") + assert.Equal(t, d.DeleteInstanceZone, c.Zone, "Incorrect instance zone passed to driver.") + assert.Equal(t, d.DeleteDiskName, c.InstanceName, "Incorrect disk name passed to driver.") + assert.Equal(t, d.DeleteDiskZone, c.Zone, "Incorrect disk zone passed to driver.") +} + +func TestStepCreateInstance_windowsNeedsPassword(t *testing.T) { + + state := testState(t) + step := new(StepCreateInstance) + defer step.Cleanup(state) + + state.Put("ssh_public_key", "key") + c := state.Get("config").(*Config) + d := state.Get("driver").(*DriverMock) + d.GetImageResult = StubImage("test-image", "test-project", []string{"windows"}, 100) + c.Comm.Type = "winrm" + // run the step + if action := step.Run(state); action != multistep.ActionContinue { + t.Fatalf("bad action: %#v", action) + } + + // Verify state + nameRaw, ok := state.GetOk("instance_name") + if !ok { + t.Fatal("should have instance name") + } + + createPassword, ok := state.GetOk("create_windows_password") + + if !ok || !createPassword.(bool) { + t.Fatal("should need to create a windows password") + } + + // cleanup + step.Cleanup(state) + + if d.DeleteInstanceName != nameRaw.(string) { + t.Fatal("should've deleted instance") + } + if d.DeleteInstanceZone != c.Zone { + t.Fatalf("bad instance zone: %#v", d.DeleteInstanceZone) + } + + if d.DeleteDiskName != c.InstanceName { + t.Fatal("should've deleted disk") + } + if d.DeleteDiskZone != c.Zone { + t.Fatalf("bad disk zone: %#v", d.DeleteDiskZone) + } +} + +func TestStepCreateInstance_windowsPasswordSet(t *testing.T) { + + state := testState(t) + step := new(StepCreateInstance) + defer step.Cleanup(state) + + state.Put("ssh_public_key", "key") + config := state.Get("config").(*Config) driver := state.Get("driver").(*DriverMock) + driver.GetImageResult = StubImage("test-image", "test-project", []string{"windows"}, 100) + config.Comm.Type = "winrm" + config.Comm.WinRMPassword = "password" // run the step if action := step.Run(state); action != multistep.ActionContinue { @@ -32,6 +112,12 @@ func TestStepCreateInstance(t *testing.T) { t.Fatal("should have instance name") } + _, ok = state.GetOk("create_windows_password") + + if ok { + t.Fatal("should not need to create windows password") + } + // cleanup step.Cleanup(state) @@ -57,21 +143,18 @@ func TestStepCreateInstance_error(t *testing.T) { state.Put("ssh_public_key", "key") - driver := state.Get("driver").(*DriverMock) - driver.RunInstanceErr = errors.New("error") + d := state.Get("driver").(*DriverMock) + d.RunInstanceErr = errors.New("error") + d.GetImageResult = StubImage("test-image", "test-project", []string{}, 100) // run the step - if action := step.Run(state); action != multistep.ActionHalt { - t.Fatalf("bad action: %#v", action) - } + assert.Equal(t, step.Run(state), multistep.ActionHalt, "Step should have failed and halted.") // Verify state - if _, ok := state.GetOk("error"); !ok { - t.Fatal("should have error") - } - if _, ok := state.GetOk("instance_name"); ok { - t.Fatal("should NOT have instance name") - } + _, ok := state.GetOk("error") + assert.True(t, ok, "State should have an error.") + _, ok = state.GetOk("instance_name") + assert.False(t, ok, "State should not have an instance name.") } func TestStepCreateInstance_errorOnChannel(t *testing.T) { @@ -79,26 +162,23 @@ func TestStepCreateInstance_errorOnChannel(t *testing.T) { step := new(StepCreateInstance) defer step.Cleanup(state) + state.Put("ssh_public_key", "key") + errCh := make(chan error, 1) errCh <- errors.New("error") - state.Put("ssh_public_key", "key") - - driver := state.Get("driver").(*DriverMock) - driver.RunInstanceErrCh = errCh + d := state.Get("driver").(*DriverMock) + d.RunInstanceErrCh = errCh + d.GetImageResult = StubImage("test-image", "test-project", []string{}, 100) // run the step - if action := step.Run(state); action != multistep.ActionHalt { - t.Fatalf("bad action: %#v", action) - } + assert.Equal(t, step.Run(state), multistep.ActionHalt, "Step should have failed and halted.") // Verify state - if _, ok := state.GetOk("error"); !ok { - t.Fatal("should have error") - } - if _, ok := state.GetOk("instance_name"); ok { - t.Fatal("should NOT have instance name") - } + _, ok := state.GetOk("error") + assert.True(t, ok, "State should have an error.") + _, ok = state.GetOk("instance_name") + assert.False(t, ok, "State should not have an instance name.") } func TestStepCreateInstance_errorTimeout(t *testing.T) { @@ -106,30 +186,27 @@ func TestStepCreateInstance_errorTimeout(t *testing.T) { step := new(StepCreateInstance) defer step.Cleanup(state) + state.Put("ssh_public_key", "key") + errCh := make(chan error, 1) go func() { <-time.After(10 * time.Millisecond) errCh <- nil }() - state.Put("ssh_public_key", "key") - config := state.Get("config").(*Config) config.stateTimeout = 1 * time.Microsecond - driver := state.Get("driver").(*DriverMock) - driver.RunInstanceErrCh = errCh + d := state.Get("driver").(*DriverMock) + d.RunInstanceErrCh = errCh + d.GetImageResult = StubImage("test-image", "test-project", []string{}, 100) // run the step - if action := step.Run(state); action != multistep.ActionHalt { - t.Fatalf("bad action: %#v", action) - } + assert.Equal(t, step.Run(state), multistep.ActionHalt, "Step should have failed and halted.") // Verify state - if _, ok := state.GetOk("error"); !ok { - t.Fatal("should have error") - } - if _, ok := state.GetOk("instance_name"); ok { - t.Fatal("should NOT have instance name") - } + _, ok := state.GetOk("error") + assert.True(t, ok, "State should have an error.") + _, ok = state.GetOk("instance_name") + assert.False(t, ok, "State should not have an instance name.") } diff --git a/builder/googlecompute/step_create_windows_password.go b/builder/googlecompute/step_create_windows_password.go new file mode 100644 index 000000000..4c16cb604 --- /dev/null +++ b/builder/googlecompute/step_create_windows_password.go @@ -0,0 +1,119 @@ +package googlecompute + +import ( + "crypto/rand" + "crypto/rsa" + "crypto/x509" + "encoding/base64" + "encoding/binary" + "encoding/pem" + "errors" + "fmt" + "os" + "time" + + "github.com/mitchellh/multistep" + "github.com/mitchellh/packer/packer" +) + +// StepCreateWindowsPassword represents a Packer build step that sets the windows password on a Windows GCE instance. +type StepCreateWindowsPassword struct { + Debug bool + DebugKeyPath string +} + +// Run executes the Packer build step that sets the windows password on a Windows GCE instance. +func (s *StepCreateWindowsPassword) Run(state multistep.StateBag) multistep.StepAction { + ui := state.Get("ui").(packer.Ui) + d := state.Get("driver").(Driver) + c := state.Get("config").(*Config) + name := state.Get("instance_name").(string) + + if c.Comm.WinRMPassword != "" { + state.Put("winrm_password", c.Comm.WinRMPassword) + return multistep.ActionContinue + } + + create, ok := state.GetOk("create_windows_password") + + if !ok || !create.(bool) { + return multistep.ActionContinue + + } + ui.Say("Creating windows user for instance...") + priv, err := rsa.GenerateKey(rand.Reader, 2048) + if err != nil { + err := fmt.Errorf("Error creating temporary key: %s", err) + state.Put("error", err) + ui.Error(err.Error()) + return multistep.ActionHalt + } + + buf := make([]byte, 4) + binary.BigEndian.PutUint32(buf, uint32(priv.E)) + + data := WindowsPasswordConfig{ + key: priv, + UserName: c.Comm.WinRMUser, + Modulus: base64.StdEncoding.EncodeToString(priv.N.Bytes()), + Exponent: base64.StdEncoding.EncodeToString(buf[1:]), + Email: c.Account.ClientEmail, + ExpireOn: time.Now().Add(time.Minute * 5), + } + + if s.Debug { + + priv_blk := pem.Block{ + Type: "RSA PRIVATE KEY", + Headers: nil, + Bytes: x509.MarshalPKCS1PrivateKey(priv), + } + + ui.Message(fmt.Sprintf("Saving key for debug purposes: %s", s.DebugKeyPath)) + f, err := os.Create(s.DebugKeyPath) + if err != nil { + state.Put("error", fmt.Errorf("Error saving debug key: %s", err)) + return multistep.ActionHalt + } + + // Write out the key + err = pem.Encode(f, &priv_blk) + f.Close() + if err != nil { + state.Put("error", fmt.Errorf("Error saving debug key: %s", err)) + return multistep.ActionHalt + } + } + + errCh, err := d.CreateOrResetWindowsPassword(name, c.Zone, &data) + + if err == nil { + ui.Message("Waiting for windows password to complete...") + select { + case err = <-errCh: + case <-time.After(c.stateTimeout): + err = errors.New("time out while waiting for the password to be created") + } + } + + if err != nil { + err := fmt.Errorf("Error creating windows password: %s", err) + state.Put("error", err) + ui.Error(err.Error()) + return multistep.ActionHalt + } + + ui.Message("Created password.") + + if s.Debug { + ui.Message(fmt.Sprintf( + "Password (since debug is enabled): %s", data.password)) + } + + state.Put("winrm_password", data.password) + + return multistep.ActionContinue +} + +// Nothing to clean up. The windows password is only created on the single instance. +func (s *StepCreateWindowsPassword) Cleanup(state multistep.StateBag) {} diff --git a/builder/googlecompute/step_create_windows_password_test.go b/builder/googlecompute/step_create_windows_password_test.go new file mode 100644 index 000000000..58fc8ee83 --- /dev/null +++ b/builder/googlecompute/step_create_windows_password_test.go @@ -0,0 +1,162 @@ +package googlecompute + +import ( + "errors" + "io/ioutil" + "os" + + "github.com/mitchellh/multistep" + + "testing" +) + +func TestStepCreateOrResetWindowsPassword(t *testing.T) { + state := testState(t) + + // Step is run after the instance is created so we will have an instance name set + state.Put("instance_name", "mock_instance") + state.Put("create_windows_password", true) + + step := new(StepCreateWindowsPassword) + defer step.Cleanup(state) + + // run the step + if action := step.Run(state); action != multistep.ActionContinue { + t.Fatalf("bad action: %#v", action) + } + + if password, ok := state.GetOk("winrm_password"); !ok || password.(string) != "MOCK_PASSWORD" { + t.Fatal("should have a password", password, ok) + } +} + +func TestStepCreateOrResetWindowsPassword_passwordSet(t *testing.T) { + state := testState(t) + + // Step is run after the instance is created so we will have an instance name set + state.Put("instance_name", "mock_instance") + + c := state.Get("config").(*Config) + + c.Comm.WinRMPassword = "password" + + step := new(StepCreateWindowsPassword) + defer step.Cleanup(state) + + // run the step + if action := step.Run(state); action != multistep.ActionContinue { + t.Fatalf("bad action: %#v", action) + } + + if password, ok := state.GetOk("winrm_password"); !ok || password.(string) != "password" { + t.Fatal("should have used existing password", password, ok) + } +} + +func TestStepCreateOrResetWindowsPassword_dontNeedPassword(t *testing.T) { + state := testState(t) + + // Step is run after the instance is created so we will have an instance name set + state.Put("instance_name", "mock_instance") + + step := new(StepCreateWindowsPassword) + defer step.Cleanup(state) + + // run the step + if action := step.Run(state); action != multistep.ActionContinue { + t.Fatalf("bad action: %#v", action) + } + +} + +func TestStepCreateOrResetWindowsPassword_debug(t *testing.T) { + tf, err := ioutil.TempFile("", "packer") + if err != nil { + t.Fatalf("err: %s", err) + } + tf.Close() + + state := testState(t) + // Step is run after the instance is created so we will have an instance name set + state.Put("instance_name", "mock_instance") + state.Put("create_windows_password", true) + + step := new(StepCreateWindowsPassword) + + step.Debug = true + step.DebugKeyPath = tf.Name() + + defer step.Cleanup(state) + + // run the step + if action := step.Run(state); action != multistep.ActionContinue { + t.Fatalf("bad action: %#v", action) + } + + if password, ok := state.GetOk("winrm_password"); !ok || password.(string) != "MOCK_PASSWORD" { + t.Fatal("should have a password", password, ok) + } + + if _, err := os.Stat(tf.Name()); err != nil { + t.Fatalf("err: %s", err) + } +} + +func TestStepCreateOrResetWindowsPassword_error(t *testing.T) { + state := testState(t) + + // Step is run after the instance is created so we will have an instance name set + state.Put("instance_name", "mock_instance") + state.Put("create_windows_password", true) + + step := new(StepCreateWindowsPassword) + defer step.Cleanup(state) + + driver := state.Get("driver").(*DriverMock) + driver.CreateOrResetWindowsPasswordErr = errors.New("error") + + // run the step + if action := step.Run(state); action != multistep.ActionHalt { + t.Fatalf("bad action: %#v", action) + } + + // Verify state + if _, ok := state.GetOk("error"); !ok { + t.Fatal("should have error") + } + + if _, ok := state.GetOk("winrm_password"); ok { + t.Fatal("should NOT have instance name") + } +} + +func TestStepCreateOrResetWindowsPassword_errorOnChannel(t *testing.T) { + state := testState(t) + + // Step is run after the instance is created so we will have an instance name set + state.Put("instance_name", "mock_instance") + state.Put("create_windows_password", true) + + step := new(StepCreateWindowsPassword) + defer step.Cleanup(state) + + driver := state.Get("driver").(*DriverMock) + + errCh := make(chan error, 1) + errCh <- errors.New("error") + + driver.CreateOrResetWindowsPasswordErrCh = errCh + + // run the step + if action := step.Run(state); action != multistep.ActionHalt { + t.Fatalf("bad action: %#v", action) + } + + // Verify state + if _, ok := state.GetOk("error"); !ok { + t.Fatal("should have error") + } + if _, ok := state.GetOk("winrm_password"); ok { + t.Fatal("should NOT have instance name") + } +} diff --git a/builder/googlecompute/step_teardown_instance.go b/builder/googlecompute/step_teardown_instance.go index 1af2be8a4..9f998a059 100644 --- a/builder/googlecompute/step_teardown_instance.go +++ b/builder/googlecompute/step_teardown_instance.go @@ -71,8 +71,8 @@ func (s *StepTeardownInstance) Cleanup(state multistep.StateBag) { if err != nil { ui.Error(fmt.Sprintf( "Error deleting disk. Please delete it manually.\n\n"+ - "DiskName: %s\n" + - "Zone: %s\n" + + "DiskName: %s\n"+ + "Zone: %s\n"+ "Error: %s", config.DiskName, config.Zone, err)) } diff --git a/builder/googlecompute/step_test.go b/builder/googlecompute/step_test.go index cba0dbac9..4c1ceff55 100644 --- a/builder/googlecompute/step_test.go +++ b/builder/googlecompute/step_test.go @@ -2,9 +2,10 @@ package googlecompute import ( "bytes" + "testing" + "github.com/mitchellh/multistep" "github.com/mitchellh/packer/packer" - "testing" ) func testState(t *testing.T) multistep.StateBag { diff --git a/builder/googlecompute/step_wait_instance_startup.go b/builder/googlecompute/step_wait_instance_startup.go index 3fa162732..d81dfabea 100644 --- a/builder/googlecompute/step_wait_instance_startup.go +++ b/builder/googlecompute/step_wait_instance_startup.go @@ -1,34 +1,42 @@ package googlecompute -import( +import ( + "errors" "fmt" - "strings" "github.com/mitchellh/multistep" + "github.com/mitchellh/packer/common" "github.com/mitchellh/packer/packer" ) type StepWaitInstanceStartup int -// Run reads the instance serial port output and looks for the log entry indicating the startup script finished. +// Run reads the instance metadata and looks for the log entry +// indicating the startup script finished. func (s *StepWaitInstanceStartup) Run(state multistep.StateBag) multistep.StepAction { config := state.Get("config").(*Config) driver := state.Get("driver").(Driver) ui := state.Get("ui").(packer.Ui) instanceName := state.Get("instance_name").(string) - + ui.Say("Waiting for any running startup script to finish...") // Keep checking the serial port output to see if the startup script is done. - err := Retry(10, 60, 0, func() (bool, error) { - output, err := driver.GetSerialPortOutput(config.Zone, instanceName) + err := common.Retry(10, 60, 0, func() (bool, error) { + status, err := driver.GetInstanceMetadata(config.Zone, + instanceName, StartupScriptStatusKey) if err != nil { - err := fmt.Errorf("Error getting serial port output: %s", err) + err := fmt.Errorf("Error getting startup script status: %s", err) return false, err } - - done := strings.Contains(output, StartupScriptDoneLog) + + if status == StartupScriptStatusError { + err = errors.New("Startup script error.") + return false, err + } + + done := status == StartupScriptStatusDone if !done { ui.Say("Startup script not finished yet. Waiting...") } diff --git a/builder/googlecompute/step_wait_instance_startup_test.go b/builder/googlecompute/step_wait_instance_startup_test.go index da6d896d3..404fd8012 100644 --- a/builder/googlecompute/step_wait_instance_startup_test.go +++ b/builder/googlecompute/step_wait_instance_startup_test.go @@ -2,37 +2,29 @@ package googlecompute import ( "github.com/mitchellh/multistep" + "github.com/stretchr/testify/assert" "testing" ) func TestStepWaitInstanceStartup(t *testing.T) { state := testState(t) step := new(StepWaitInstanceStartup) - config := state.Get("config").(*Config) - driver := state.Get("driver").(*DriverMock) - + c := state.Get("config").(*Config) + d := state.Get("driver").(*DriverMock) + testZone := "test-zone" testInstanceName := "test-instance-name" - config.Zone = testZone + c.Zone = testZone state.Put("instance_name", testInstanceName) - // The done log triggers step completion. - driver.GetSerialPortOutputResult = StartupScriptDoneLog - + + // This step stops when it gets Done back from the metadata. + d.GetInstanceMetadataResult = StartupScriptStatusDone + // Run the step. - if action := step.Run(state); action != multistep.ActionContinue { - t.Fatalf("StepWaitInstanceStartup did not return a Continue action: %#v", action) - } - - // Check that GetSerialPortOutput was called properly. - if driver.GetSerialPortOutputZone != testZone { - t.Fatalf( - "GetSerialPortOutput wrong zone. Expected: %s, Actual: %s", driver.GetSerialPortOutputZone, - testZone) - } - if driver.GetSerialPortOutputName != testInstanceName { - t.Fatalf( - "GetSerialPortOutput wrong instance name. Expected: %s, Actual: %s", driver.GetSerialPortOutputName, - testInstanceName) - } -} \ No newline at end of file + assert.Equal(t, step.Run(state), multistep.ActionContinue, "Step should have passed and continued.") + + // Check that GetInstanceMetadata was called properly. + assert.Equal(t, d.GetInstanceMetadataZone, testZone, "Incorrect zone passed to GetInstanceMetadata.") + assert.Equal(t, d.GetInstanceMetadataName, testInstanceName, "Incorrect instance name passed to GetInstanceMetadata.") +} diff --git a/builder/googlecompute/winrm.go b/builder/googlecompute/winrm.go new file mode 100644 index 000000000..8f744f9aa --- /dev/null +++ b/builder/googlecompute/winrm.go @@ -0,0 +1,17 @@ +package googlecompute + +import ( + "github.com/mitchellh/multistep" + "github.com/mitchellh/packer/helper/communicator" +) + +// winrmConfig returns the WinRM configuration. +func winrmConfig(state multistep.StateBag) (*communicator.WinRMConfig, error) { + config := state.Get("config").(*Config) + password := state.Get("winrm_password").(string) + + return &communicator.WinRMConfig{ + Username: config.Comm.WinRMUser, + Password: password, + }, nil +} diff --git a/builder/null/builder.go b/builder/null/builder.go index 949c01c2b..cce9227d6 100644 --- a/builder/null/builder.go +++ b/builder/null/builder.go @@ -46,15 +46,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe state.Put("ui", ui) // Run! - if b.config.PackerDebug { - b.runner = &multistep.DebugRunner{ - Steps: steps, - PauseFn: common.MultistepDebugFn(ui), - } - } else { - b.runner = &multistep.BasicRunner{Steps: steps} - } - + b.runner = common.NewRunner(steps, b.config.PackerConfig, ui) b.runner.Run(state) // If there was an error, return that diff --git a/builder/openstack/builder.go b/builder/openstack/builder.go index d83086182..2e7f00e7f 100644 --- a/builder/openstack/builder.go +++ b/builder/openstack/builder.go @@ -116,15 +116,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe } // Run! - if b.config.PackerDebug { - b.runner = &multistep.DebugRunner{ - Steps: steps, - PauseFn: common.MultistepDebugFn(ui), - } - } else { - b.runner = &multistep.BasicRunner{Steps: steps} - } - + b.runner = common.NewRunner(steps, b.config.PackerConfig, ui) b.runner.Run(state) // If there was an error, return that diff --git a/builder/parallels/common/floppy_config.go b/builder/parallels/common/floppy_config.go deleted file mode 100644 index d656e103a..000000000 --- a/builder/parallels/common/floppy_config.go +++ /dev/null @@ -1,19 +0,0 @@ -package common - -import ( - "github.com/mitchellh/packer/template/interpolate" -) - -// FloppyConfig is configuration related to created floppy disks and attaching -// them to a Parallels virtual machine. -type FloppyConfig struct { - FloppyFiles []string `mapstructure:"floppy_files"` -} - -func (c *FloppyConfig) Prepare(ctx *interpolate.Context) []error { - if c.FloppyFiles == nil { - c.FloppyFiles = make([]string, 0) - } - - return nil -} diff --git a/builder/parallels/common/floppy_config_test.go b/builder/parallels/common/floppy_config_test.go deleted file mode 100644 index 3e4fc55db..000000000 --- a/builder/parallels/common/floppy_config_test.go +++ /dev/null @@ -1,18 +0,0 @@ -package common - -import ( - "testing" -) - -func TestFloppyConfigPrepare(t *testing.T) { - c := new(FloppyConfig) - - errs := c.Prepare(testConfigTemplate(t)) - if len(errs) > 0 { - t.Fatalf("err: %#v", errs) - } - - if len(c.FloppyFiles) > 0 { - t.Fatal("should not have floppy files") - } -} diff --git a/builder/parallels/common/step_type_boot_command.go b/builder/parallels/common/step_type_boot_command.go index a1b3d562d..37637fc65 100644 --- a/builder/parallels/common/step_type_boot_command.go +++ b/builder/parallels/common/step_type_boot_command.go @@ -186,6 +186,13 @@ func scancodes(message string) []string { special[""] = []string{"49", "c9"} special[""] = []string{"51", "d1"} + special[""] = []string{"38", "b8"} + special[""] = []string{"1d", "9d"} + special[""] = []string{"2a", "aa"} + special[""] = []string{"e038", "e0b8"} + special[""] = []string{"e01d", "e09d"} + special[""] = []string{"36", "b6"} + shiftedChars := "!@#$%^&*()_+{}:\"~|<>?" scancodeIndex := make(map[string]uint) @@ -214,6 +221,78 @@ func scancodes(message string) []string { for len(message) > 0 { var scancode []string + if strings.HasPrefix(message, "") { + scancode = []string{"38"} + message = message[len(""):] + log.Printf("Special code '' found, replacing with: 38") + } + + if strings.HasPrefix(message, "") { + scancode = []string{"1d"} + message = message[len(""):] + log.Printf("Special code '' found, replacing with: 1d") + } + + if strings.HasPrefix(message, "") { + scancode = []string{"2a"} + message = message[len(""):] + log.Printf("Special code '' found, replacing with: 2a") + } + + if strings.HasPrefix(message, "") { + scancode = []string{"b8"} + message = message[len(""):] + log.Printf("Special code '' found, replacing with: b8") + } + + if strings.HasPrefix(message, "") { + scancode = []string{"9d"} + message = message[len(""):] + log.Printf("Special code '' found, replacing with: 9d") + } + + if strings.HasPrefix(message, "") { + scancode = []string{"aa"} + message = message[len(""):] + log.Printf("Special code '' found, replacing with: aa") + } + + if strings.HasPrefix(message, "") { + scancode = []string{"e038"} + message = message[len(""):] + log.Printf("Special code '' found, replacing with: e038") + } + + if strings.HasPrefix(message, "") { + scancode = []string{"e01d"} + message = message[len(""):] + log.Printf("Special code '' found, replacing with: e01d") + } + + if strings.HasPrefix(message, "") { + scancode = []string{"36"} + message = message[len(""):] + log.Printf("Special code '' found, replacing with: 36") + } + + if strings.HasPrefix(message, "") { + scancode = []string{"e0b8"} + message = message[len(""):] + log.Printf("Special code '' found, replacing with: e0b8") + } + + if strings.HasPrefix(message, "") { + scancode = []string{"e09d"} + message = message[len(""):] + log.Printf("Special code '' found, replacing with: e09d") + } + + if strings.HasPrefix(message, "") { + scancode = []string{"b6"} + message = message[len(""):] + log.Printf("Special code '' found, replacing with: b6") + } + if strings.HasPrefix(message, "") { log.Printf("Special code found, will sleep 1 second at this point.") scancode = []string{"wait"} diff --git a/builder/parallels/iso/builder.go b/builder/parallels/iso/builder.go index 546ff8890..359a439b5 100644 --- a/builder/parallels/iso/builder.go +++ b/builder/parallels/iso/builder.go @@ -25,7 +25,7 @@ type Config struct { common.PackerConfig `mapstructure:",squash"` common.HTTPConfig `mapstructure:",squash"` common.ISOConfig `mapstructure:",squash"` - parallelscommon.FloppyConfig `mapstructure:",squash"` + common.FloppyConfig `mapstructure:",squash"` parallelscommon.OutputConfig `mapstructure:",squash"` parallelscommon.PrlctlConfig `mapstructure:",squash"` parallelscommon.PrlctlPostConfig `mapstructure:",squash"` @@ -215,17 +215,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe state.Put("ui", ui) // Run - if b.config.PackerDebug { - pauseFn := common.MultistepDebugFn(ui) - state.Put("pauseFn", pauseFn) - b.runner = &multistep.DebugRunner{ - Steps: steps, - PauseFn: pauseFn, - } - } else { - b.runner = &multistep.BasicRunner{Steps: steps} - } - + b.runner = common.NewRunnerWithPauseFn(steps, b.config.PackerConfig, ui, state) b.runner.Run(state) // If there was an error, return that diff --git a/builder/parallels/iso/builder_test.go b/builder/parallels/iso/builder_test.go index 43e5b091d..7be21bd59 100644 --- a/builder/parallels/iso/builder_test.go +++ b/builder/parallels/iso/builder_test.go @@ -1,8 +1,11 @@ package iso import ( - "github.com/mitchellh/packer/packer" + "fmt" + "reflect" "testing" + + "github.com/mitchellh/packer/packer" ) func testConfig() map[string]interface{} { @@ -46,6 +49,55 @@ func TestBuilderPrepare_Defaults(t *testing.T) { } } +func TestBuilderPrepare_FloppyFiles(t *testing.T) { + var b Builder + config := testConfig() + + delete(config, "floppy_files") + warns, err := b.Prepare(config) + if len(warns) > 0 { + t.Fatalf("bad: %#v", warns) + } + if err != nil { + t.Fatalf("bad err: %s", err) + } + + if len(b.config.FloppyFiles) != 0 { + t.Fatalf("bad: %#v", b.config.FloppyFiles) + } + + floppies_path := "../../../common/test-fixtures/floppies" + config["floppy_files"] = []string{fmt.Sprintf("%s/bar.bat", floppies_path), fmt.Sprintf("%s/foo.ps1", floppies_path)} + b = Builder{} + warns, err = b.Prepare(config) + if len(warns) > 0 { + t.Fatalf("bad: %#v", warns) + } + if err != nil { + t.Fatalf("should not have error: %s", err) + } + + expected := []string{fmt.Sprintf("%s/bar.bat", floppies_path), fmt.Sprintf("%s/foo.ps1", floppies_path)} + if !reflect.DeepEqual(b.config.FloppyFiles, expected) { + t.Fatalf("bad: %#v", b.config.FloppyFiles) + } +} + +func TestBuilderPrepare_InvalidFloppies(t *testing.T) { + var b Builder + config := testConfig() + config["floppy_files"] = []string{"nonexistant.bat", "nonexistant.ps1"} + b = Builder{} + _, errs := b.Prepare(config) + if errs == nil { + t.Fatalf("Non existant floppies should trigger multierror") + } + + if len(errs.(*packer.MultiError).Errors) != 2 { + t.Fatalf("Multierror should work and report 2 errors") + } +} + func TestBuilderPrepare_DiskSize(t *testing.T) { var b Builder config := testConfig() diff --git a/builder/parallels/pvm/builder.go b/builder/parallels/pvm/builder.go index b62181b06..45aed55bf 100644 --- a/builder/parallels/pvm/builder.go +++ b/builder/parallels/pvm/builder.go @@ -108,16 +108,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe } // Run the steps. - if b.config.PackerDebug { - pauseFn := common.MultistepDebugFn(ui) - state.Put("pauseFn", pauseFn) - b.runner = &multistep.DebugRunner{ - Steps: steps, - PauseFn: pauseFn, - } - } else { - b.runner = &multistep.BasicRunner{Steps: steps} - } + b.runner = common.NewRunnerWithPauseFn(steps, b.config.PackerConfig, ui, state) b.runner.Run(state) // Report any errors. diff --git a/builder/parallels/pvm/config.go b/builder/parallels/pvm/config.go index f3f27d314..47e90d7a6 100644 --- a/builder/parallels/pvm/config.go +++ b/builder/parallels/pvm/config.go @@ -14,7 +14,7 @@ import ( // Config is the configuration structure for the builder. type Config struct { common.PackerConfig `mapstructure:",squash"` - parallelscommon.FloppyConfig `mapstructure:",squash"` + common.FloppyConfig `mapstructure:",squash"` parallelscommon.OutputConfig `mapstructure:",squash"` parallelscommon.PrlctlConfig `mapstructure:",squash"` parallelscommon.PrlctlPostConfig `mapstructure:",squash"` diff --git a/builder/parallels/pvm/config_test.go b/builder/parallels/pvm/config_test.go index c4270c366..9334e9136 100644 --- a/builder/parallels/pvm/config_test.go +++ b/builder/parallels/pvm/config_test.go @@ -1,9 +1,12 @@ package pvm import ( + "fmt" "io/ioutil" "os" "testing" + + "github.com/mitchellh/packer/packer" ) func testConfig(t *testing.T) map[string]interface{} { @@ -11,6 +14,7 @@ func testConfig(t *testing.T) map[string]interface{} { "ssh_username": "foo", "shutdown_command": "foo", "parallels_tools_flavor": "lin", + "source_path": "config_test.go", } } @@ -68,6 +72,29 @@ func TestNewConfig_sourcePath(t *testing.T) { testConfigOk(t, warns, errs) } +func TestNewConfig_FloppyFiles(t *testing.T) { + c := testConfig(t) + floppies_path := "../../../common/test-fixtures/floppies" + c["floppy_files"] = []string{fmt.Sprintf("%s/bar.bat", floppies_path), fmt.Sprintf("%s/foo.ps1", floppies_path)} + _, _, err := NewConfig(c) + if err != nil { + t.Fatalf("should not have error: %s", err) + } +} + +func TestNewConfig_InvalidFloppies(t *testing.T) { + c := testConfig(t) + c["floppy_files"] = []string{"nonexistant.bat", "nonexistant.ps1"} + _, _, errs := NewConfig(c) + if errs == nil { + t.Fatalf("Non existant floppies should trigger multierror") + } + + if len(errs.(*packer.MultiError).Errors) != 2 { + t.Fatalf("Multierror should work and report 2 errors") + } +} + func TestNewConfig_shutdown_timeout(t *testing.T) { c := testConfig(t) tf := getTempFile(t) diff --git a/builder/qemu/builder.go b/builder/qemu/builder.go index f151bf68c..82bff8d74 100644 --- a/builder/qemu/builder.go +++ b/builder/qemu/builder.go @@ -82,6 +82,7 @@ type Config struct { common.HTTPConfig `mapstructure:",squash"` common.ISOConfig `mapstructure:",squash"` Comm communicator.Config `mapstructure:",squash"` + common.FloppyConfig `mapstructure:",squash"` ISOSkipCache bool `mapstructure:"iso_skip_cache"` Accelerator string `mapstructure:"accelerator"` @@ -139,6 +140,9 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, error) { return nil, err } + var errs *packer.MultiError + warnings := make([]string, 0) + if b.config.DiskSize == 0 { b.config.DiskSize = 40000 } @@ -215,9 +219,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, error) { b.config.Format = "qcow2" } - if b.config.FloppyFiles == nil { - b.config.FloppyFiles = make([]string, 0) - } + errs = packer.MultiErrorAppend(errs, b.config.FloppyConfig.Prepare(&b.config.ctx)...) if b.config.NetDevice == "" { b.config.NetDevice = "virtio-net" @@ -232,9 +234,6 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, error) { b.config.Comm.SSHTimeout = b.config.SSHWaitTimeout } - var errs *packer.MultiError - warnings := make([]string, 0) - if b.config.ISOSkipCache { b.config.ISOChecksumType = "none" } @@ -376,19 +375,40 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe HTTPPortMin: b.config.HTTPPortMin, HTTPPortMax: b.config.HTTPPortMax, }, - new(stepForwardSSH), + ) + + if b.config.Comm.Type != "none" { + steps = append(steps, + new(stepForwardSSH), + ) + } + + steps = append(steps, new(stepConfigureVNC), steprun, &stepBootWait{}, &stepTypeBootCommand{}, - &communicator.StepConnect{ - Config: &b.config.Comm, - Host: commHost, - SSHConfig: sshConfig, - SSHPort: commPort, - }, + ) + + if b.config.Comm.Type != "none" { + steps = append(steps, + &communicator.StepConnect{ + Config: &b.config.Comm, + Host: commHost, + SSHConfig: sshConfig, + SSHPort: commPort, + }, + ) + } + + steps = append(steps, new(common.StepProvision), + ) + steps = append(steps, new(stepShutdown), + ) + + steps = append(steps, new(stepConvertDisk), ) @@ -402,17 +422,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe state.Put("ui", ui) // Run - if b.config.PackerDebug { - pauseFn := common.MultistepDebugFn(ui) - state.Put("pauseFn", pauseFn) - b.runner = &multistep.DebugRunner{ - Steps: steps, - PauseFn: pauseFn, - } - } else { - b.runner = &multistep.BasicRunner{Steps: steps} - } - + b.runner = common.NewRunnerWithPauseFn(steps, b.config.PackerConfig, ui, state) b.runner.Run(state) // If there was an error, return that diff --git a/builder/qemu/builder_test.go b/builder/qemu/builder_test.go index 5c68a9316..1f28bbac6 100644 --- a/builder/qemu/builder_test.go +++ b/builder/qemu/builder_test.go @@ -1,11 +1,13 @@ package qemu import ( - "github.com/mitchellh/packer/packer" + "fmt" "io/ioutil" "os" "reflect" "testing" + + "github.com/mitchellh/packer/packer" ) var testPem = ` @@ -262,6 +264,55 @@ func TestBuilderPrepare_Format(t *testing.T) { } } +func TestBuilderPrepare_FloppyFiles(t *testing.T) { + var b Builder + config := testConfig() + + delete(config, "floppy_files") + warns, err := b.Prepare(config) + if len(warns) > 0 { + t.Fatalf("bad: %#v", warns) + } + if err != nil { + t.Fatalf("bad err: %s", err) + } + + if len(b.config.FloppyFiles) != 0 { + t.Fatalf("bad: %#v", b.config.FloppyFiles) + } + + floppies_path := "../../common/test-fixtures/floppies" + config["floppy_files"] = []string{fmt.Sprintf("%s/bar.bat", floppies_path), fmt.Sprintf("%s/foo.ps1", floppies_path)} + b = Builder{} + warns, err = b.Prepare(config) + if len(warns) > 0 { + t.Fatalf("bad: %#v", warns) + } + if err != nil { + t.Fatalf("should not have error: %s", err) + } + + expected := []string{fmt.Sprintf("%s/bar.bat", floppies_path), fmt.Sprintf("%s/foo.ps1", floppies_path)} + if !reflect.DeepEqual(b.config.FloppyFiles, expected) { + t.Fatalf("bad: %#v", b.config.FloppyFiles) + } +} + +func TestBuilderPrepare_InvalidFloppies(t *testing.T) { + var b Builder + config := testConfig() + config["floppy_files"] = []string{"nonexistant.bat", "nonexistant.ps1"} + b = Builder{} + _, errs := b.Prepare(config) + if errs == nil { + t.Fatalf("Non existant floppies should trigger multierror") + } + + if len(errs.(*packer.MultiError).Errors) != 2 { + t.Fatalf("Multierror should work and report 2 errors") + } +} + func TestBuilderPrepare_InvalidKey(t *testing.T) { var b Builder config := testConfig() diff --git a/builder/qemu/step_forward_ssh.go b/builder/qemu/step_forward_ssh.go index dbd6646ea..c0653171b 100644 --- a/builder/qemu/step_forward_ssh.go +++ b/builder/qemu/step_forward_ssh.go @@ -24,20 +24,12 @@ func (s *stepForwardSSH) Run(state multistep.StateBag) multistep.StepAction { log.Printf("Looking for available communicator (SSH, WinRM, etc) port between %d and %d", config.SSHHostPortMin, config.SSHHostPortMax) var sshHostPort uint - var offset uint = 0 - portRange := int(config.SSHHostPortMax - config.SSHHostPortMin) - if portRange > 0 { - // Have to check if > 0 to avoid a panic - offset = uint(rand.Intn(portRange)) - } + portRange := config.SSHHostPortMax - config.SSHHostPortMin + 1 + offset := uint(rand.Intn(int(portRange))) for { sshHostPort = offset + config.SSHHostPortMin - if sshHostPort >= config.SSHHostPortMax { - offset = 0 - sshHostPort = config.SSHHostPortMin - } log.Printf("Trying port: %d", sshHostPort) l, err := net.Listen("tcp", fmt.Sprintf(":%d", sshHostPort)) if err == nil { @@ -45,6 +37,9 @@ func (s *stepForwardSSH) Run(state multistep.StateBag) multistep.StepAction { break } offset++ + if offset == portRange { + offset = 0 + } } ui.Say(fmt.Sprintf("Found port for communicator (SSH, WinRM, etc): %d.", sshHostPort)) diff --git a/builder/qemu/step_run.go b/builder/qemu/step_run.go index 82bcbe7c0..3d1c37c66 100644 --- a/builder/qemu/step_run.go +++ b/builder/qemu/step_run.go @@ -35,7 +35,7 @@ func (s *stepRun) Run(state multistep.StateBag) multistep.StepAction { command, err := getCommandArgs(s.BootDrive, state) if err != nil { - err := fmt.Errorf("Error processing QemuArggs: %s", err) + err := fmt.Errorf("Error processing QemuArgs: %s", err) ui.Error(err.Error()) return multistep.ActionHalt } @@ -63,7 +63,6 @@ func getCommandArgs(bootDrive string, state multistep.StateBag) ([]string, error isoPath := state.Get("iso_path").(string) vncIP := state.Get("vnc_ip").(string) vncPort := state.Get("vnc_port").(uint) - sshHostPort := state.Get("sshHostPort").(uint) ui := state.Get("ui").(packer.Ui) driver := state.Get("driver").(Driver) @@ -74,10 +73,16 @@ func getCommandArgs(bootDrive string, state multistep.StateBag) ([]string, error defaultArgs := make(map[string]interface{}) var deviceArgs []string var driveArgs []string + var sshHostPort uint defaultArgs["-name"] = vmName defaultArgs["-machine"] = fmt.Sprintf("type=%s", config.MachineType) - defaultArgs["-netdev"] = fmt.Sprintf("user,id=user.0,hostfwd=tcp::%v-:%d", sshHostPort, config.Comm.Port()) + if config.Comm.Type != "none" { + sshHostPort = state.Get("sshHostPort").(uint) + defaultArgs["-netdev"] = fmt.Sprintf("user,id=user.0,hostfwd=tcp::%v-:%d", sshHostPort, config.Comm.Port()) + } else { + defaultArgs["-netdev"] = fmt.Sprintf("user,id=user.0") + } qemuVersion, err := driver.Version() if err != nil { @@ -91,12 +96,12 @@ func getCommandArgs(bootDrive string, state multistep.StateBag) ([]string, error if qemuMajor >= 2 { if config.DiskInterface == "virtio-scsi" { deviceArgs = append(deviceArgs, "virtio-scsi-pci,id=scsi0", "scsi-hd,bus=scsi0.0,drive=drive0") - driveArgs = append(driveArgs, fmt.Sprintf("if=none,file=%s,id=drive0,cache=%s,discard=%s", imgPath, config.DiskCache, config.DiskDiscard)) + driveArgs = append(driveArgs, fmt.Sprintf("if=none,file=%s,id=drive0,cache=%s,discard=%s,format=%s", imgPath, config.DiskCache, config.DiskDiscard, config.Format)) } else { - driveArgs = append(driveArgs, fmt.Sprintf("file=%s,if=%s,cache=%s,discard=%s", imgPath, config.DiskInterface, config.DiskCache, config.DiskDiscard)) + driveArgs = append(driveArgs, fmt.Sprintf("file=%s,if=%s,cache=%s,discard=%s,format=%s", imgPath, config.DiskInterface, config.DiskCache, config.DiskDiscard, config.Format)) } } else { - driveArgs = append(driveArgs, fmt.Sprintf("file=%s,if=%s,cache=%s", imgPath, config.DiskInterface, config.DiskCache)) + driveArgs = append(driveArgs, fmt.Sprintf("file=%s,if=%s,cache=%s,format=%s", imgPath, config.DiskInterface, config.DiskCache, config.Format)) } deviceArgs = append(deviceArgs, fmt.Sprintf("%s,netdev=user.0", config.NetDevice)) @@ -157,13 +162,23 @@ func getCommandArgs(bootDrive string, state multistep.StateBag) ([]string, error httpPort := state.Get("http_port").(uint) ctx := config.ctx - ctx.Data = qemuArgsTemplateData{ - "10.0.2.2", - httpPort, - config.HTTPDir, - config.OutputDir, - config.VMName, - sshHostPort, + if config.Comm.Type != "none" { + ctx.Data = qemuArgsTemplateData{ + "10.0.2.2", + httpPort, + config.HTTPDir, + config.OutputDir, + config.VMName, + sshHostPort, + } + } else { + ctx.Data = qemuArgsTemplateData{ + HTTPIP: "10.0.2.2", + HTTPPort: httpPort, + HTTPDir: config.HTTPDir, + OutputDir: config.OutputDir, + Name: config.VMName, + } } newQemuArgs, err := processArgs(config.QemuArgs, &ctx) if err != nil { diff --git a/builder/qemu/step_shutdown.go b/builder/qemu/step_shutdown.go index 127dcff12..2bca7a09e 100644 --- a/builder/qemu/step_shutdown.go +++ b/builder/qemu/step_shutdown.go @@ -3,10 +3,11 @@ package qemu import ( "errors" "fmt" - "github.com/mitchellh/multistep" - "github.com/mitchellh/packer/packer" "log" "time" + + "github.com/mitchellh/multistep" + "github.com/mitchellh/packer/packer" ) // This step shuts down the machine. It first attempts to do so gracefully, @@ -23,11 +24,29 @@ import ( type stepShutdown struct{} func (s *stepShutdown) Run(state multistep.StateBag) multistep.StepAction { - comm := state.Get("communicator").(packer.Communicator) config := state.Get("config").(*Config) driver := state.Get("driver").(Driver) ui := state.Get("ui").(packer.Ui) + if state.Get("communicator") == nil { + cancelCh := make(chan struct{}, 1) + go func() { + defer close(cancelCh) + <-time.After(config.shutdownTimeout) + }() + ui.Say("Waiting for shutdown...") + if ok := driver.WaitForShutdown(cancelCh); ok { + log.Println("VM shut down.") + return multistep.ActionContinue + } else { + err := fmt.Errorf("Failed to shutdown") + state.Put("error", err) + ui.Error(err.Error()) + return multistep.ActionHalt + } + } + + comm := state.Get("communicator").(packer.Communicator) if config.ShutdownCommand != "" { ui.Say("Gracefully halting virtual machine...") log.Printf("Executing shutdown command: %s", config.ShutdownCommand) diff --git a/builder/qemu/step_type_boot_command.go b/builder/qemu/step_type_boot_command.go index f720d6f12..6138f6cdd 100644 --- a/builder/qemu/step_type_boot_command.go +++ b/builder/qemu/step_type_boot_command.go @@ -136,6 +136,12 @@ func vncSendString(c *vnc.ClientConn, original string) { special[""] = 0xFF57 special[""] = 0xFF55 special[""] = 0xFF56 + special[""] = 0xFFE9 + special[""] = 0xFFE3 + special[""] = 0xFFE1 + special[""] = 0xFFEA + special[""] = 0xFFE4 + special[""] = 0xFFE2 shiftedChars := "~!@#$%^&*()_+{}|:\"<>?" @@ -144,6 +150,174 @@ func vncSendString(c *vnc.ClientConn, original string) { var keyCode uint32 keyShift := false + if strings.HasPrefix(original, "") { + keyCode = special[""] + original = original[len(""):] + log.Printf("Special code '' found, replacing with: %d", keyCode) + + c.KeyEvent(keyCode, true) + time.Sleep(time.Second / 10) + + // qemu is picky, so no matter what, wait a small period + time.Sleep(100 * time.Millisecond) + + continue + } + + if strings.HasPrefix(original, "") { + keyCode = special[""] + original = original[len(""):] + log.Printf("Special code '' found, replacing with: %d", keyCode) + + c.KeyEvent(keyCode, true) + time.Sleep(time.Second / 10) + + // qemu is picky, so no matter what, wait a small period + time.Sleep(100 * time.Millisecond) + + continue + } + + if strings.HasPrefix(original, "") { + keyCode = special[""] + original = original[len(""):] + log.Printf("Special code '' found, replacing with: %d", keyCode) + + c.KeyEvent(keyCode, true) + time.Sleep(time.Second / 10) + + // qemu is picky, so no matter what, wait a small period + time.Sleep(100 * time.Millisecond) + + continue + } + + if strings.HasPrefix(original, "") { + keyCode = special[""] + original = original[len(""):] + log.Printf("Special code '' found, replacing with: %d", keyCode) + + c.KeyEvent(keyCode, false) + time.Sleep(time.Second / 10) + + // qemu is picky, so no matter what, wait a small period + time.Sleep(100 * time.Millisecond) + + continue + } + + if strings.HasPrefix(original, "") { + keyCode = special[""] + original = original[len(""):] + log.Printf("Special code '' found, replacing with: %d", keyCode) + + c.KeyEvent(keyCode, false) + time.Sleep(time.Second / 10) + + // qemu is picky, so no matter what, wait a small period + time.Sleep(100 * time.Millisecond) + + continue + } + + if strings.HasPrefix(original, "") { + keyCode = special[""] + original = original[len(""):] + log.Printf("Special code '' found, replacing with: %d", keyCode) + + c.KeyEvent(keyCode, false) + time.Sleep(time.Second / 10) + + // qemu is picky, so no matter what, wait a small period + time.Sleep(100 * time.Millisecond) + + continue + } + + if strings.HasPrefix(original, "") { + keyCode = special[""] + original = original[len(""):] + log.Printf("Special code '' found, replacing with: %d", keyCode) + + c.KeyEvent(keyCode, true) + time.Sleep(time.Second / 10) + + // qemu is picky, so no matter what, wait a small period + time.Sleep(100 * time.Millisecond) + + continue + } + + if strings.HasPrefix(original, "") { + keyCode = special[""] + original = original[len(""):] + log.Printf("Special code '' found, replacing with: %d", keyCode) + + c.KeyEvent(keyCode, true) + time.Sleep(time.Second / 10) + + // qemu is picky, so no matter what, wait a small period + time.Sleep(100 * time.Millisecond) + + continue + } + + if strings.HasPrefix(original, "") { + keyCode = special[""] + original = original[len(""):] + log.Printf("Special code '' found, replacing with: %d", keyCode) + + c.KeyEvent(keyCode, true) + time.Sleep(time.Second / 10) + + // qemu is picky, so no matter what, wait a small period + time.Sleep(100 * time.Millisecond) + + continue + } + + if strings.HasPrefix(original, "") { + keyCode = special[""] + original = original[len(""):] + log.Printf("Special code '' found, replacing with: %d", keyCode) + + c.KeyEvent(keyCode, false) + time.Sleep(time.Second / 10) + + // qemu is picky, so no matter what, wait a small period + time.Sleep(100 * time.Millisecond) + + continue + } + + if strings.HasPrefix(original, "") { + keyCode = special[""] + original = original[len(""):] + log.Printf("Special code '' found, replacing with: %d", keyCode) + + c.KeyEvent(keyCode, false) + time.Sleep(time.Second / 10) + + // qemu is picky, so no matter what, wait a small period + time.Sleep(100 * time.Millisecond) + + continue + } + + if strings.HasPrefix(original, "") { + keyCode = special[""] + original = original[len(""):] + log.Printf("Special code '' found, replacing with: %d", keyCode) + + c.KeyEvent(keyCode, false) + time.Sleep(time.Second / 10) + + // qemu is picky, so no matter what, wait a small period + time.Sleep(100 * time.Millisecond) + + continue + } + if strings.HasPrefix(original, "") { log.Printf("Special code '' found, sleeping one second") time.Sleep(1 * time.Second) diff --git a/builder/virtualbox/common/floppy_config_test.go b/builder/virtualbox/common/floppy_config_test.go deleted file mode 100644 index 3e4fc55db..000000000 --- a/builder/virtualbox/common/floppy_config_test.go +++ /dev/null @@ -1,18 +0,0 @@ -package common - -import ( - "testing" -) - -func TestFloppyConfigPrepare(t *testing.T) { - c := new(FloppyConfig) - - errs := c.Prepare(testConfigTemplate(t)) - if len(errs) > 0 { - t.Fatalf("err: %#v", errs) - } - - if len(c.FloppyFiles) > 0 { - t.Fatal("should not have floppy files") - } -} diff --git a/builder/virtualbox/common/step_forward_ssh.go b/builder/virtualbox/common/step_forward_ssh.go index 4d77449cc..0f514a843 100644 --- a/builder/virtualbox/common/step_forward_ssh.go +++ b/builder/virtualbox/common/step_forward_ssh.go @@ -37,20 +37,12 @@ func (s *StepForwardSSH) Run(state multistep.StateBag) multistep.StepAction { if !s.SkipNatMapping { log.Printf("Looking for available communicator (SSH, WinRM, etc) port between %d and %d", s.HostPortMin, s.HostPortMax) - offset := 0 - portRange := int(s.HostPortMax - s.HostPortMin) - if portRange > 0 { - // Have to check if > 0 to avoid a panic - offset = rand.Intn(portRange) - } + portRange := int(s.HostPortMax - s.HostPortMin + 1) + offset := rand.Intn(portRange) for { sshHostPort = offset + int(s.HostPortMin) - if sshHostPort >= int(s.HostPortMax) { - offset = 0 - sshHostPort = int(s.HostPortMin) - } log.Printf("Trying port: %d", sshHostPort) l, err := net.Listen("tcp", fmt.Sprintf("127.0.0.1:%d", sshHostPort)) if err == nil { @@ -58,6 +50,9 @@ func (s *StepForwardSSH) Run(state multistep.StateBag) multistep.StepAction { break } offset++ + if offset == portRange { + offset = 0 + } } // Create a forwarded port mapping to the VM diff --git a/builder/virtualbox/common/step_type_boot_command.go b/builder/virtualbox/common/step_type_boot_command.go index d227cf760..ab9cd5c70 100644 --- a/builder/virtualbox/common/step_type_boot_command.go +++ b/builder/virtualbox/common/step_type_boot_command.go @@ -141,6 +141,12 @@ func scancodes(message string) []string { special[""] = []string{"4f", "cf"} special[""] = []string{"49", "c9"} special[""] = []string{"51", "d1"} + special[""] = []string{"38", "b8"} + special[""] = []string{"1d", "9d"} + special[""] = []string{"2a", "aa"} + special[""] = []string{"e038", "e0b8"} + special[""] = []string{"e01d", "e09d"} + special[""] = []string{"36", "b6"} shiftedChars := "~!@#$%^&*()_+{}|:\"<>?" @@ -170,6 +176,78 @@ func scancodes(message string) []string { for len(message) > 0 { var scancode []string + if strings.HasPrefix(message, "") { + scancode = []string{"38"} + message = message[len(""):] + log.Printf("Special code '' found, replacing with: 38") + } + + if strings.HasPrefix(message, "") { + scancode = []string{"1d"} + message = message[len(""):] + log.Printf("Special code '' found, replacing with: 1d") + } + + if strings.HasPrefix(message, "") { + scancode = []string{"2a"} + message = message[len(""):] + log.Printf("Special code '' found, replacing with: 2a") + } + + if strings.HasPrefix(message, "") { + scancode = []string{"b8"} + message = message[len(""):] + log.Printf("Special code '' found, replacing with: b8") + } + + if strings.HasPrefix(message, "") { + scancode = []string{"9d"} + message = message[len(""):] + log.Printf("Special code '' found, replacing with: 9d") + } + + if strings.HasPrefix(message, "") { + scancode = []string{"aa"} + message = message[len(""):] + log.Printf("Special code '' found, replacing with: aa") + } + + if strings.HasPrefix(message, "") { + scancode = []string{"e038"} + message = message[len(""):] + log.Printf("Special code '' found, replacing with: e038") + } + + if strings.HasPrefix(message, "") { + scancode = []string{"e01d"} + message = message[len(""):] + log.Printf("Special code '' found, replacing with: e01d") + } + + if strings.HasPrefix(message, "") { + scancode = []string{"36"} + message = message[len(""):] + log.Printf("Special code '' found, replacing with: 36") + } + + if strings.HasPrefix(message, "") { + scancode = []string{"e0b8"} + message = message[len(""):] + log.Printf("Special code '' found, replacing with: e0b8") + } + + if strings.HasPrefix(message, "") { + scancode = []string{"e09d"} + message = message[len(""):] + log.Printf("Special code '' found, replacing with: e09d") + } + + if strings.HasPrefix(message, "") { + scancode = []string{"b6"} + message = message[len(""):] + log.Printf("Special code '' found, replacing with: b6") + } + if strings.HasPrefix(message, "") { log.Printf("Special code found, will sleep 1 second at this point.") scancode = []string{"wait"} diff --git a/builder/virtualbox/iso/builder.go b/builder/virtualbox/iso/builder.go index 13a2c9eaa..a69ad83ea 100644 --- a/builder/virtualbox/iso/builder.go +++ b/builder/virtualbox/iso/builder.go @@ -26,9 +26,9 @@ type Config struct { common.PackerConfig `mapstructure:",squash"` common.HTTPConfig `mapstructure:",squash"` common.ISOConfig `mapstructure:",squash"` + common.FloppyConfig `mapstructure:",squash"` vboxcommon.ExportConfig `mapstructure:",squash"` vboxcommon.ExportOpts `mapstructure:",squash"` - vboxcommon.FloppyConfig `mapstructure:",squash"` vboxcommon.OutputConfig `mapstructure:",squash"` vboxcommon.RunConfig `mapstructure:",squash"` vboxcommon.ShutdownConfig `mapstructure:",squash"` @@ -275,17 +275,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe state.Put("ui", ui) // Run - if b.config.PackerDebug { - pauseFn := common.MultistepDebugFn(ui) - state.Put("pauseFn", pauseFn) - b.runner = &multistep.DebugRunner{ - Steps: steps, - PauseFn: pauseFn, - } - } else { - b.runner = &multistep.BasicRunner{Steps: steps} - } - + b.runner = common.NewRunnerWithPauseFn(steps, b.config.PackerConfig, ui, state) b.runner.Run(state) // If there was an error, return that diff --git a/builder/virtualbox/iso/builder_test.go b/builder/virtualbox/iso/builder_test.go index e4e3e6a53..cc15072de 100644 --- a/builder/virtualbox/iso/builder_test.go +++ b/builder/virtualbox/iso/builder_test.go @@ -1,9 +1,12 @@ package iso import ( + "fmt" + "reflect" + "testing" + "github.com/mitchellh/packer/builder/virtualbox/common" "github.com/mitchellh/packer/packer" - "testing" ) func testConfig() map[string]interface{} { @@ -86,6 +89,55 @@ func TestBuilderPrepare_DiskSize(t *testing.T) { } } +func TestBuilderPrepare_FloppyFiles(t *testing.T) { + var b Builder + config := testConfig() + + delete(config, "floppy_files") + warns, err := b.Prepare(config) + if len(warns) > 0 { + t.Fatalf("bad: %#v", warns) + } + if err != nil { + t.Fatalf("bad err: %s", err) + } + + if len(b.config.FloppyFiles) != 0 { + t.Fatalf("bad: %#v", b.config.FloppyFiles) + } + + floppies_path := "../../../common/test-fixtures/floppies" + config["floppy_files"] = []string{fmt.Sprintf("%s/bar.bat", floppies_path), fmt.Sprintf("%s/foo.ps1", floppies_path)} + b = Builder{} + warns, err = b.Prepare(config) + if len(warns) > 0 { + t.Fatalf("bad: %#v", warns) + } + if err != nil { + t.Fatalf("should not have error: %s", err) + } + + expected := []string{fmt.Sprintf("%s/bar.bat", floppies_path), fmt.Sprintf("%s/foo.ps1", floppies_path)} + if !reflect.DeepEqual(b.config.FloppyFiles, expected) { + t.Fatalf("bad: %#v", b.config.FloppyFiles) + } +} + +func TestBuilderPrepare_InvalidFloppies(t *testing.T) { + var b Builder + config := testConfig() + config["floppy_files"] = []string{"nonexistant.bat", "nonexistant.ps1"} + b = Builder{} + _, errs := b.Prepare(config) + if errs == nil { + t.Fatalf("Non existant floppies should trigger multierror") + } + + if len(errs.(*packer.MultiError).Errors) != 2 { + t.Fatalf("Multierror should work and report 2 errors") + } +} + func TestBuilderPrepare_GuestAdditionsMode(t *testing.T) { var b Builder config := testConfig() diff --git a/builder/virtualbox/ovf/builder.go b/builder/virtualbox/ovf/builder.go index 502f66734..56e349b83 100644 --- a/builder/virtualbox/ovf/builder.go +++ b/builder/virtualbox/ovf/builder.go @@ -135,16 +135,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe } // Run the steps. - if b.config.PackerDebug { - pauseFn := common.MultistepDebugFn(ui) - state.Put("pauseFn", pauseFn) - b.runner = &multistep.DebugRunner{ - Steps: steps, - PauseFn: pauseFn, - } - } else { - b.runner = &multistep.BasicRunner{Steps: steps} - } + b.runner = common.NewRunnerWithPauseFn(steps, b.config.PackerConfig, ui, state) b.runner.Run(state) // Report any errors. diff --git a/builder/virtualbox/ovf/config.go b/builder/virtualbox/ovf/config.go index 0aab0871d..0866a6205 100644 --- a/builder/virtualbox/ovf/config.go +++ b/builder/virtualbox/ovf/config.go @@ -16,9 +16,9 @@ import ( type Config struct { common.PackerConfig `mapstructure:",squash"` common.HTTPConfig `mapstructure:",squash"` + common.FloppyConfig `mapstructure:",squash"` vboxcommon.ExportConfig `mapstructure:",squash"` vboxcommon.ExportOpts `mapstructure:",squash"` - vboxcommon.FloppyConfig `mapstructure:",squash"` vboxcommon.OutputConfig `mapstructure:",squash"` vboxcommon.RunConfig `mapstructure:",squash"` vboxcommon.SSHConfig `mapstructure:",squash"` diff --git a/builder/virtualbox/ovf/config_test.go b/builder/virtualbox/ovf/config_test.go index a94c26bf9..04c5c71d4 100644 --- a/builder/virtualbox/ovf/config_test.go +++ b/builder/virtualbox/ovf/config_test.go @@ -1,15 +1,19 @@ package ovf import ( + "fmt" "io/ioutil" "os" "testing" + + "github.com/mitchellh/packer/packer" ) func testConfig(t *testing.T) map[string]interface{} { return map[string]interface{}{ "ssh_username": "foo", "shutdown_command": "foo", + "source_path": "config_test.go", } } @@ -44,6 +48,29 @@ func testConfigOk(t *testing.T, warns []string, err error) { } } +func TestNewConfig_FloppyFiles(t *testing.T) { + c := testConfig(t) + floppies_path := "../../../common/test-fixtures/floppies" + c["floppy_files"] = []string{fmt.Sprintf("%s/bar.bat", floppies_path), fmt.Sprintf("%s/foo.ps1", floppies_path)} + _, _, err := NewConfig(c) + if err != nil { + t.Fatalf("should not have error: %s", err) + } +} + +func TestNewConfig_InvalidFloppies(t *testing.T) { + c := testConfig(t) + c["floppy_files"] = []string{"nonexistant.bat", "nonexistant.ps1"} + _, _, errs := NewConfig(c) + if errs == nil { + t.Fatalf("Non existant floppies should trigger multierror") + } + + if len(errs.(*packer.MultiError).Errors) != 2 { + t.Fatalf("Multierror should work and report 2 errors") + } +} + func TestNewConfig_sourcePath(t *testing.T) { // Bad c := testConfig(t) diff --git a/builder/vmware/common/step_type_boot_command.go b/builder/vmware/common/step_type_boot_command.go index 6923adf5b..96bccf2c4 100644 --- a/builder/vmware/common/step_type_boot_command.go +++ b/builder/vmware/common/step_type_boot_command.go @@ -168,6 +168,12 @@ func vncSendString(c *vnc.ClientConn, original string) { special[""] = 0xFF57 special[""] = 0xFF55 special[""] = 0xFF56 + special[""] = 0xFFE9 + special[""] = 0xFFE3 + special[""] = 0xFFE1 + special[""] = 0xFFEA + special[""] = 0xFFE4 + special[""] = 0xFFE2 shiftedChars := "~!@#$%^&*()_+{}|:\"<>?" @@ -176,6 +182,138 @@ func vncSendString(c *vnc.ClientConn, original string) { var keyCode uint32 keyShift := false + if strings.HasPrefix(original, "") { + keyCode = special[""] + original = original[len(""):] + log.Printf("Special code '' found, replacing with: %d", keyCode) + + c.KeyEvent(keyCode, true) + time.Sleep(time.Second / 10) + + continue + } + + if strings.HasPrefix(original, "") { + keyCode = special[""] + original = original[len(""):] + log.Printf("Special code '' found, replacing with: %d", keyCode) + + c.KeyEvent(keyCode, true) + time.Sleep(time.Second / 10) + + continue + } + + if strings.HasPrefix(original, "") { + keyCode = special[""] + original = original[len(""):] + log.Printf("Special code '' found, replacing with: %d", keyCode) + + c.KeyEvent(keyCode, true) + time.Sleep(time.Second / 10) + + continue + } + + if strings.HasPrefix(original, "") { + keyCode = special[""] + original = original[len(""):] + log.Printf("Special code '' found, replacing with: %d", keyCode) + + c.KeyEvent(keyCode, false) + time.Sleep(time.Second / 10) + + continue + } + + if strings.HasPrefix(original, "") { + keyCode = special[""] + original = original[len(""):] + log.Printf("Special code '' found, replacing with: %d", keyCode) + + c.KeyEvent(keyCode, false) + time.Sleep(time.Second / 10) + + continue + } + + if strings.HasPrefix(original, "") { + keyCode = special[""] + original = original[len(""):] + log.Printf("Special code '' found, replacing with: %d", keyCode) + + c.KeyEvent(keyCode, false) + time.Sleep(time.Second / 10) + + continue + } + + if strings.HasPrefix(original, "") { + keyCode = special[""] + original = original[len(""):] + log.Printf("Special code '' found, replacing with: %d", keyCode) + + c.KeyEvent(keyCode, true) + time.Sleep(time.Second / 10) + + continue + } + + if strings.HasPrefix(original, "") { + keyCode = special[""] + original = original[len(""):] + log.Printf("Special code '' found, replacing with: %d", keyCode) + + c.KeyEvent(keyCode, true) + time.Sleep(time.Second / 10) + + continue + } + + if strings.HasPrefix(original, "") { + keyCode = special[""] + original = original[len(""):] + log.Printf("Special code '' found, replacing with: %d", keyCode) + + c.KeyEvent(keyCode, true) + time.Sleep(time.Second / 10) + + continue + } + + if strings.HasPrefix(original, "") { + keyCode = special[""] + original = original[len(""):] + log.Printf("Special code '' found, replacing with: %d", keyCode) + + c.KeyEvent(keyCode, false) + time.Sleep(time.Second / 10) + + continue + } + + if strings.HasPrefix(original, "") { + keyCode = special[""] + original = original[len(""):] + log.Printf("Special code '' found, replacing with: %d", keyCode) + + c.KeyEvent(keyCode, false) + time.Sleep(time.Second / 10) + + continue + } + + if strings.HasPrefix(original, "") { + keyCode = special[""] + original = original[len(""):] + log.Printf("Special code '' found, replacing with: %d", keyCode) + + c.KeyEvent(keyCode, false) + time.Sleep(time.Second / 10) + + continue + } + if strings.HasPrefix(original, "") { log.Printf("Special code '' found, sleeping one second") time.Sleep(1 * time.Second) diff --git a/builder/vmware/common/vmx.go b/builder/vmware/common/vmx.go index e531e4341..1735bfb53 100755 --- a/builder/vmware/common/vmx.go +++ b/builder/vmware/common/vmx.go @@ -46,13 +46,13 @@ func EncodeVMX(contents map[string]string) string { // a list of VMX key fragments that the value must not be quoted // fragments are used to cover multliples (i.e. multiple disks) // keys are still lowercase at this point, use lower fragments - noQuotes := []string { + noQuotes := []string{ ".virtualssd", } // a list of VMX key fragments that are case sensitive // fragments are used to cover multliples (i.e. multiple disks) - caseSensitive := []string { + caseSensitive := []string{ ".virtualSSD", } @@ -63,7 +63,7 @@ func EncodeVMX(contents map[string]string) string { for _, q := range noQuotes { if strings.Contains(k, q) { pat = "%s = %s\n" - break; + break } } key := k diff --git a/builder/vmware/common/vmx_test.go b/builder/vmware/common/vmx_test.go index 715a6a6ee..967f01259 100755 --- a/builder/vmware/common/vmx_test.go +++ b/builder/vmware/common/vmx_test.go @@ -29,8 +29,8 @@ scsi0:0.virtualSSD = 1 func TestEncodeVMX(t *testing.T) { contents := map[string]string{ - ".encoding": "UTF-8", - "config.version": "8", + ".encoding": "UTF-8", + "config.version": "8", "scsi0:0.virtualssd": "1", } diff --git a/builder/vmware/iso/builder.go b/builder/vmware/iso/builder.go index 8cf82baf1..4d43b3685 100755 --- a/builder/vmware/iso/builder.go +++ b/builder/vmware/iso/builder.go @@ -28,6 +28,7 @@ type Config struct { common.PackerConfig `mapstructure:",squash"` common.HTTPConfig `mapstructure:",squash"` common.ISOConfig `mapstructure:",squash"` + common.FloppyConfig `mapstructure:",squash"` vmwcommon.DriverConfig `mapstructure:",squash"` vmwcommon.OutputConfig `mapstructure:",squash"` vmwcommon.RunConfig `mapstructure:",squash"` @@ -40,7 +41,6 @@ type Config struct { DiskName string `mapstructure:"vmdk_name"` DiskSize uint `mapstructure:"disk_size"` DiskTypeId string `mapstructure:"disk_type_id"` - FloppyFiles []string `mapstructure:"floppy_files"` Format string `mapstructure:"format"` GuestOSType string `mapstructure:"guest_os_type"` Version string `mapstructure:"version"` @@ -97,6 +97,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, error) { errs = packer.MultiErrorAppend(errs, b.config.SSHConfig.Prepare(&b.config.ctx)...) errs = packer.MultiErrorAppend(errs, b.config.ToolsConfig.Prepare(&b.config.ctx)...) errs = packer.MultiErrorAppend(errs, b.config.VMXConfig.Prepare(&b.config.ctx)...) + errs = packer.MultiErrorAppend(errs, b.config.FloppyConfig.Prepare(&b.config.ctx)...) if b.config.DiskName == "" { b.config.DiskName = "disk" @@ -115,10 +116,6 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, error) { } } - if b.config.FloppyFiles == nil { - b.config.FloppyFiles = make([]string, 0) - } - if b.config.GuestOSType == "" { b.config.GuestOSType = "other" } @@ -308,17 +305,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe } // Run! - if b.config.PackerDebug { - pauseFn := common.MultistepDebugFn(ui) - state.Put("pauseFn", pauseFn) - b.runner = &multistep.DebugRunner{ - Steps: steps, - PauseFn: pauseFn, - } - } else { - b.runner = &multistep.BasicRunner{Steps: steps} - } - + b.runner = common.NewRunnerWithPauseFn(steps, b.config.PackerConfig, ui, state) b.runner.Run(state) // If there was an error, return that diff --git a/builder/vmware/iso/builder_test.go b/builder/vmware/iso/builder_test.go index 022dee961..5c1ca5d11 100644 --- a/builder/vmware/iso/builder_test.go +++ b/builder/vmware/iso/builder_test.go @@ -1,6 +1,7 @@ package iso import ( + "fmt" "io/ioutil" "os" "reflect" @@ -106,7 +107,8 @@ func TestBuilderPrepare_FloppyFiles(t *testing.T) { t.Fatalf("bad: %#v", b.config.FloppyFiles) } - config["floppy_files"] = []string{"foo", "bar"} + floppies_path := "../../../common/test-fixtures/floppies" + config["floppy_files"] = []string{fmt.Sprintf("%s/bar.bat", floppies_path), fmt.Sprintf("%s/foo.ps1", floppies_path)} b = Builder{} warns, err = b.Prepare(config) if len(warns) > 0 { @@ -116,12 +118,27 @@ func TestBuilderPrepare_FloppyFiles(t *testing.T) { t.Fatalf("should not have error: %s", err) } - expected := []string{"foo", "bar"} + expected := []string{fmt.Sprintf("%s/bar.bat", floppies_path), fmt.Sprintf("%s/foo.ps1", floppies_path)} if !reflect.DeepEqual(b.config.FloppyFiles, expected) { t.Fatalf("bad: %#v", b.config.FloppyFiles) } } +func TestBuilderPrepare_InvalidFloppies(t *testing.T) { + var b Builder + config := testConfig() + config["floppy_files"] = []string{"nonexistant.bat", "nonexistant.ps1"} + b = Builder{} + _, errs := b.Prepare(config) + if errs == nil { + t.Fatalf("Non existant floppies should trigger multierror") + } + + if len(errs.(*packer.MultiError).Errors) != 2 { + t.Fatalf("Multierror should work and report 2 errors") + } +} + func TestBuilderPrepare_Format(t *testing.T) { var b Builder config := testConfig() diff --git a/builder/vmware/vmx/builder.go b/builder/vmware/vmx/builder.go index d82f03f1c..cf2df99ea 100644 --- a/builder/vmware/vmx/builder.go +++ b/builder/vmware/vmx/builder.go @@ -122,16 +122,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe } // Run the steps. - if b.config.PackerDebug { - pauseFn := common.MultistepDebugFn(ui) - state.Put("pauseFn", pauseFn) - b.runner = &multistep.DebugRunner{ - Steps: steps, - PauseFn: pauseFn, - } - } else { - b.runner = &multistep.BasicRunner{Steps: steps} - } + b.runner = common.NewRunnerWithPauseFn(steps, b.config.PackerConfig, ui, state) b.runner.Run(state) // Report any errors. diff --git a/builder/vmware/vmx/builder_test.go b/builder/vmware/vmx/builder_test.go index f23f2f2e5..1c7f795f0 100644 --- a/builder/vmware/vmx/builder_test.go +++ b/builder/vmware/vmx/builder_test.go @@ -1,10 +1,13 @@ package vmx import ( + "fmt" "io/ioutil" "os" "reflect" "testing" + + "github.com/mitchellh/packer/packer" ) func TestBuilderPrepare_FloppyFiles(t *testing.T) { @@ -33,7 +36,8 @@ func TestBuilderPrepare_FloppyFiles(t *testing.T) { t.Fatalf("bad: %#v", b.config.FloppyFiles) } - config["floppy_files"] = []string{"foo", "bar"} + floppies_path := "../../../common/test-fixtures/floppies" + config["floppy_files"] = []string{fmt.Sprintf("%s/bar.bat", floppies_path), fmt.Sprintf("%s/foo.ps1", floppies_path)} b = Builder{} warns, err = b.Prepare(config) if len(warns) > 0 { @@ -43,8 +47,23 @@ func TestBuilderPrepare_FloppyFiles(t *testing.T) { t.Fatalf("should not have error: %s", err) } - expected := []string{"foo", "bar"} + expected := []string{fmt.Sprintf("%s/bar.bat", floppies_path), fmt.Sprintf("%s/foo.ps1", floppies_path)} if !reflect.DeepEqual(b.config.FloppyFiles, expected) { t.Fatalf("bad: %#v", b.config.FloppyFiles) } } + +func TestBuilderPrepare_InvalidFloppies(t *testing.T) { + var b Builder + config := testConfig(t) + config["floppy_files"] = []string{"nonexistant.bat", "nonexistant.ps1"} + b = Builder{} + _, errs := b.Prepare(config) + if errs == nil { + t.Fatalf("Non existant floppies should trigger multierror") + } + + if len(errs.(*packer.MultiError).Errors) != 2 { + t.Fatalf("Multierror should work and report 2 errors") + } +} diff --git a/builder/vmware/vmx/config.go b/builder/vmware/vmx/config.go index 4f93db9f3..52ba61582 100644 --- a/builder/vmware/vmx/config.go +++ b/builder/vmware/vmx/config.go @@ -15,6 +15,7 @@ import ( type Config struct { common.PackerConfig `mapstructure:",squash"` common.HTTPConfig `mapstructure:",squash"` + common.FloppyConfig `mapstructure:",squash"` vmwcommon.DriverConfig `mapstructure:",squash"` vmwcommon.OutputConfig `mapstructure:",squash"` vmwcommon.RunConfig `mapstructure:",squash"` @@ -24,7 +25,6 @@ type Config struct { vmwcommon.VMXConfig `mapstructure:",squash"` BootCommand []string `mapstructure:"boot_command"` - FloppyFiles []string `mapstructure:"floppy_files"` RemoteType string `mapstructure:"remote_type"` SkipCompaction bool `mapstructure:"skip_compaction"` SourcePath string `mapstructure:"source_path"` @@ -64,6 +64,7 @@ func NewConfig(raws ...interface{}) (*Config, []string, error) { errs = packer.MultiErrorAppend(errs, c.SSHConfig.Prepare(&c.ctx)...) errs = packer.MultiErrorAppend(errs, c.ToolsConfig.Prepare(&c.ctx)...) errs = packer.MultiErrorAppend(errs, c.VMXConfig.Prepare(&c.ctx)...) + errs = packer.MultiErrorAppend(errs, c.FloppyConfig.Prepare(&c.ctx)...) if c.SourcePath == "" { errs = packer.MultiErrorAppend(errs, fmt.Errorf("source_path is blank, but is required")) diff --git a/builder/vmware/vmx/config_test.go b/builder/vmware/vmx/config_test.go index ac49957e3..4ee0b9426 100644 --- a/builder/vmware/vmx/config_test.go +++ b/builder/vmware/vmx/config_test.go @@ -10,6 +10,7 @@ func testConfig(t *testing.T) map[string]interface{} { return map[string]interface{}{ "ssh_username": "foo", "shutdown_command": "foo", + "source_path": "config_test.go", } } diff --git a/command/build.go b/command/build.go index 5d683d4b0..8f7b3d8ad 100644 --- a/command/build.go +++ b/command/build.go @@ -10,6 +10,7 @@ import ( "strings" "sync" + "github.com/mitchellh/packer/helper/enumflag" "github.com/mitchellh/packer/packer" "github.com/mitchellh/packer/template" ) @@ -20,11 +21,14 @@ type BuildCommand struct { func (c BuildCommand) Run(args []string) int { var cfgColor, cfgDebug, cfgForce, cfgParallel bool + var cfgOnError string flags := c.Meta.FlagSet("build", FlagSetBuildFilter|FlagSetVars) flags.Usage = func() { c.Ui.Say(c.Help()) } flags.BoolVar(&cfgColor, "color", true, "") flags.BoolVar(&cfgDebug, "debug", false, "") flags.BoolVar(&cfgForce, "force", false, "") + flagOnError := enumflag.New(&cfgOnError, "cleanup", "abort", "ask") + flags.Var(flagOnError, "on-error", "") flags.BoolVar(&cfgParallel, "parallel", true, "") if err := flags.Parse(args); err != nil { return 1 @@ -99,12 +103,14 @@ func (c BuildCommand) Run(args []string) int { log.Printf("Build debug mode: %v", cfgDebug) log.Printf("Force build: %v", cfgForce) + log.Printf("On error: %v", cfgOnError) // Set the debug and force mode and prepare all the builds for _, b := range builds { log.Printf("Preparing build: %s", b.Name()) b.SetDebug(cfgDebug) b.SetForce(cfgForce) + b.SetOnError(cfgOnError) warnings, err := b.Prepare() if err != nil { @@ -284,7 +290,7 @@ Options: -except=foo,bar,baz Build all builds other than these -force Force a build to continue if artifacts exist, deletes existing artifacts -machine-readable Machine-readable output - -only=foo,bar,baz Only build the given builds by name + -on-error=[cleanup|abort|ask] If the build fails do: clean up (default), abort, or ask -parallel=false Disable parallelization (on by default) -var 'key=value' Variable for templates, can be used multiple times. -var-file=path JSON file containing user variables. diff --git a/command/plugin.go b/command/plugin.go index 4def4582b..3c6715f9a 100644 --- a/command/plugin.go +++ b/command/plugin.go @@ -15,50 +15,49 @@ import ( amazonchrootbuilder "github.com/mitchellh/packer/builder/amazon/chroot" amazonebsbuilder "github.com/mitchellh/packer/builder/amazon/ebs" - amazonimportpostprocessor "github.com/mitchellh/packer/post-processor/amazon-import" amazoninstancebuilder "github.com/mitchellh/packer/builder/amazon/instance" - ansiblelocalprovisioner "github.com/mitchellh/packer/provisioner/ansible-local" - ansibleprovisioner "github.com/mitchellh/packer/provisioner/ansible" - artificepostprocessor "github.com/mitchellh/packer/post-processor/artifice" - atlaspostprocessor "github.com/mitchellh/packer/post-processor/atlas" azurearmbuilder "github.com/mitchellh/packer/builder/azure/arm" - checksumpostprocessor "github.com/mitchellh/packer/post-processor/checksum" - chefclientprovisioner "github.com/mitchellh/packer/provisioner/chef-client" - chefsoloprovisioner "github.com/mitchellh/packer/provisioner/chef-solo" - compresspostprocessor "github.com/mitchellh/packer/post-processor/compress" digitaloceanbuilder "github.com/mitchellh/packer/builder/digitalocean" dockerbuilder "github.com/mitchellh/packer/builder/docker" - dockerimportpostprocessor "github.com/mitchellh/packer/post-processor/docker-import" - dockerpushpostprocessor "github.com/mitchellh/packer/post-processor/docker-push" - dockersavepostprocessor "github.com/mitchellh/packer/post-processor/docker-save" - dockertagpostprocessor "github.com/mitchellh/packer/post-processor/docker-tag" filebuilder "github.com/mitchellh/packer/builder/file" - fileprovisioner "github.com/mitchellh/packer/provisioner/file" googlecomputebuilder "github.com/mitchellh/packer/builder/googlecompute" - googlecomputeexportpostprocessor "github.com/mitchellh/packer/post-processor/googlecompute-export" - manifestpostprocessor "github.com/mitchellh/packer/post-processor/manifest" nullbuilder "github.com/mitchellh/packer/builder/null" openstackbuilder "github.com/mitchellh/packer/builder/openstack" parallelsisobuilder "github.com/mitchellh/packer/builder/parallels/iso" parallelspvmbuilder "github.com/mitchellh/packer/builder/parallels/pvm" - powershellprovisioner "github.com/mitchellh/packer/provisioner/powershell" - puppetmasterlessprovisioner "github.com/mitchellh/packer/provisioner/puppet-masterless" - puppetserverprovisioner "github.com/mitchellh/packer/provisioner/puppet-server" qemubuilder "github.com/mitchellh/packer/builder/qemu" - saltmasterlessprovisioner "github.com/mitchellh/packer/provisioner/salt-masterless" - shelllocalpostprocessor "github.com/mitchellh/packer/post-processor/shell-local" - shelllocalprovisioner "github.com/mitchellh/packer/provisioner/shell-local" - shellprovisioner "github.com/mitchellh/packer/provisioner/shell" - vagrantcloudpostprocessor "github.com/mitchellh/packer/post-processor/vagrant-cloud" - vagrantpostprocessor "github.com/mitchellh/packer/post-processor/vagrant" virtualboxisobuilder "github.com/mitchellh/packer/builder/virtualbox/iso" virtualboxovfbuilder "github.com/mitchellh/packer/builder/virtualbox/ovf" vmwareisobuilder "github.com/mitchellh/packer/builder/vmware/iso" vmwarevmxbuilder "github.com/mitchellh/packer/builder/vmware/vmx" + amazonimportpostprocessor "github.com/mitchellh/packer/post-processor/amazon-import" + artificepostprocessor "github.com/mitchellh/packer/post-processor/artifice" + atlaspostprocessor "github.com/mitchellh/packer/post-processor/atlas" + checksumpostprocessor "github.com/mitchellh/packer/post-processor/checksum" + compresspostprocessor "github.com/mitchellh/packer/post-processor/compress" + dockerimportpostprocessor "github.com/mitchellh/packer/post-processor/docker-import" + dockerpushpostprocessor "github.com/mitchellh/packer/post-processor/docker-push" + dockersavepostprocessor "github.com/mitchellh/packer/post-processor/docker-save" + dockertagpostprocessor "github.com/mitchellh/packer/post-processor/docker-tag" + googlecomputeexportpostprocessor "github.com/mitchellh/packer/post-processor/googlecompute-export" + manifestpostprocessor "github.com/mitchellh/packer/post-processor/manifest" + shelllocalpostprocessor "github.com/mitchellh/packer/post-processor/shell-local" + vagrantpostprocessor "github.com/mitchellh/packer/post-processor/vagrant" + vagrantcloudpostprocessor "github.com/mitchellh/packer/post-processor/vagrant-cloud" vspherepostprocessor "github.com/mitchellh/packer/post-processor/vsphere" + ansibleprovisioner "github.com/mitchellh/packer/provisioner/ansible" + ansiblelocalprovisioner "github.com/mitchellh/packer/provisioner/ansible-local" + chefclientprovisioner "github.com/mitchellh/packer/provisioner/chef-client" + chefsoloprovisioner "github.com/mitchellh/packer/provisioner/chef-solo" + fileprovisioner "github.com/mitchellh/packer/provisioner/file" + powershellprovisioner "github.com/mitchellh/packer/provisioner/powershell" + puppetmasterlessprovisioner "github.com/mitchellh/packer/provisioner/puppet-masterless" + puppetserverprovisioner "github.com/mitchellh/packer/provisioner/puppet-server" + saltmasterlessprovisioner "github.com/mitchellh/packer/provisioner/salt-masterless" + shellprovisioner "github.com/mitchellh/packer/provisioner/shell" + shelllocalprovisioner "github.com/mitchellh/packer/provisioner/shell-local" windowsrestartprovisioner "github.com/mitchellh/packer/provisioner/windows-restart" windowsshellprovisioner "github.com/mitchellh/packer/provisioner/windows-shell" - ) type PluginCommand struct { @@ -67,61 +66,58 @@ type PluginCommand struct { var Builders = map[string]packer.Builder{ "amazon-chroot": new(amazonchrootbuilder.Builder), - "amazon-ebs": new(amazonebsbuilder.Builder), - "amazon-instance": new(amazoninstancebuilder.Builder), - "azure-arm": new(azurearmbuilder.Builder), - "digitalocean": new(digitaloceanbuilder.Builder), - "docker": new(dockerbuilder.Builder), - "file": new(filebuilder.Builder), + "amazon-ebs": new(amazonebsbuilder.Builder), + "amazon-instance": new(amazoninstancebuilder.Builder), + "azure-arm": new(azurearmbuilder.Builder), + "digitalocean": new(digitaloceanbuilder.Builder), + "docker": new(dockerbuilder.Builder), + "file": new(filebuilder.Builder), "googlecompute": new(googlecomputebuilder.Builder), - "null": new(nullbuilder.Builder), - "openstack": new(openstackbuilder.Builder), + "null": new(nullbuilder.Builder), + "openstack": new(openstackbuilder.Builder), "parallels-iso": new(parallelsisobuilder.Builder), "parallels-pvm": new(parallelspvmbuilder.Builder), - "qemu": new(qemubuilder.Builder), - "virtualbox-iso": new(virtualboxisobuilder.Builder), - "virtualbox-ovf": new(virtualboxovfbuilder.Builder), - "vmware-iso": new(vmwareisobuilder.Builder), - "vmware-vmx": new(vmwarevmxbuilder.Builder), + "qemu": new(qemubuilder.Builder), + "virtualbox-iso": new(virtualboxisobuilder.Builder), + "virtualbox-ovf": new(virtualboxovfbuilder.Builder), + "vmware-iso": new(vmwareisobuilder.Builder), + "vmware-vmx": new(vmwarevmxbuilder.Builder), } - var Provisioners = map[string]packer.Provisioner{ - "ansible": new(ansibleprovisioner.Provisioner), - "ansible-local": new(ansiblelocalprovisioner.Provisioner), - "chef-client": new(chefclientprovisioner.Provisioner), - "chef-solo": new(chefsoloprovisioner.Provisioner), - "file": new(fileprovisioner.Provisioner), - "powershell": new(powershellprovisioner.Provisioner), - "puppet-masterless": new(puppetmasterlessprovisioner.Provisioner), - "puppet-server": new(puppetserverprovisioner.Provisioner), + "ansible": new(ansibleprovisioner.Provisioner), + "ansible-local": new(ansiblelocalprovisioner.Provisioner), + "chef-client": new(chefclientprovisioner.Provisioner), + "chef-solo": new(chefsoloprovisioner.Provisioner), + "file": new(fileprovisioner.Provisioner), + "powershell": new(powershellprovisioner.Provisioner), + "puppet-masterless": new(puppetmasterlessprovisioner.Provisioner), + "puppet-server": new(puppetserverprovisioner.Provisioner), "salt-masterless": new(saltmasterlessprovisioner.Provisioner), - "shell": new(shellprovisioner.Provisioner), - "shell-local": new(shelllocalprovisioner.Provisioner), + "shell": new(shellprovisioner.Provisioner), + "shell-local": new(shelllocalprovisioner.Provisioner), "windows-restart": new(windowsrestartprovisioner.Provisioner), - "windows-shell": new(windowsshellprovisioner.Provisioner), + "windows-shell": new(windowsshellprovisioner.Provisioner), } - var PostProcessors = map[string]packer.PostProcessor{ - "amazon-import": new(amazonimportpostprocessor.PostProcessor), - "artifice": new(artificepostprocessor.PostProcessor), - "atlas": new(atlaspostprocessor.PostProcessor), - "checksum": new(checksumpostprocessor.PostProcessor), - "compress": new(compresspostprocessor.PostProcessor), - "docker-import": new(dockerimportpostprocessor.PostProcessor), - "docker-push": new(dockerpushpostprocessor.PostProcessor), - "docker-save": new(dockersavepostprocessor.PostProcessor), - "docker-tag": new(dockertagpostprocessor.PostProcessor), - "googlecompute-export": new(googlecomputeexportpostprocessor.PostProcessor), - "manifest": new(manifestpostprocessor.PostProcessor), - "shell-local": new(shelllocalpostprocessor.PostProcessor), - "vagrant": new(vagrantpostprocessor.PostProcessor), - "vagrant-cloud": new(vagrantcloudpostprocessor.PostProcessor), - "vsphere": new(vspherepostprocessor.PostProcessor), + "amazon-import": new(amazonimportpostprocessor.PostProcessor), + "artifice": new(artificepostprocessor.PostProcessor), + "atlas": new(atlaspostprocessor.PostProcessor), + "checksum": new(checksumpostprocessor.PostProcessor), + "compress": new(compresspostprocessor.PostProcessor), + "docker-import": new(dockerimportpostprocessor.PostProcessor), + "docker-push": new(dockerpushpostprocessor.PostProcessor), + "docker-save": new(dockersavepostprocessor.PostProcessor), + "docker-tag": new(dockertagpostprocessor.PostProcessor), + "googlecompute-export": new(googlecomputeexportpostprocessor.PostProcessor), + "manifest": new(manifestpostprocessor.PostProcessor), + "shell-local": new(shelllocalpostprocessor.PostProcessor), + "vagrant": new(vagrantpostprocessor.PostProcessor), + "vagrant-cloud": new(vagrantcloudpostprocessor.PostProcessor), + "vsphere": new(vspherepostprocessor.PostProcessor), } - var pluginRegexp = regexp.MustCompile("packer-(builder|post-processor|provisioner)-(.+)") func (c *PluginCommand) Run(args []string) int { diff --git a/command/push.go b/command/push.go index e935ff83e..55c76e1ab 100644 --- a/command/push.go +++ b/command/push.go @@ -18,7 +18,7 @@ import ( const archiveTemplateEntry = ".packer-template" var ( - reName = regexp.MustCompile("^[a-zA-Z0-9-_/]+$") + reName = regexp.MustCompile("^[a-zA-Z0-9-_./]+$") errInvalidName = fmt.Errorf("Your build name can only contain these characters: %s", reName.String()) ) diff --git a/builder/virtualbox/common/floppy_config.go b/common/floppy_config.go similarity index 58% rename from builder/virtualbox/common/floppy_config.go rename to common/floppy_config.go index 0e3f5e669..bd5c5f8c7 100644 --- a/builder/virtualbox/common/floppy_config.go +++ b/common/floppy_config.go @@ -1,19 +1,28 @@ package common import ( + "fmt" + "os" + "github.com/mitchellh/packer/template/interpolate" ) -// FloppyConfig is configuration related to created floppy disks and attaching -// them to a VirtualBox machine. type FloppyConfig struct { FloppyFiles []string `mapstructure:"floppy_files"` } func (c *FloppyConfig) Prepare(ctx *interpolate.Context) []error { + var errs []error + if c.FloppyFiles == nil { c.FloppyFiles = make([]string, 0) } - return nil + for _, path := range c.FloppyFiles { + if _, err := os.Stat(path); err != nil { + errs = append(errs, fmt.Errorf("Bad Floppy disk file '%s': %s", path, err)) + } + } + + return errs } diff --git a/common/floppy_config_test.go b/common/floppy_config_test.go new file mode 100644 index 000000000..ee9c742ff --- /dev/null +++ b/common/floppy_config_test.go @@ -0,0 +1,70 @@ +package common + +import ( + "testing" +) + +func TestNilFloppies(t *testing.T) { + c := FloppyConfig{} + errs := c.Prepare(nil) + if len(errs) != 0 { + t.Fatal("nil floppies array should not fail") + } + + if len(c.FloppyFiles) > 0 { + t.Fatal("struct should not have floppy files") + } +} + +func TestEmptyArrayFloppies(t *testing.T) { + c := FloppyConfig{ + FloppyFiles: make([]string, 0), + } + + errs := c.Prepare(nil) + if len(errs) != 0 { + t.Fatal("empty floppies array should never fail") + } + + if len(c.FloppyFiles) > 0 { + t.Fatal("struct should not have floppy files") + } +} + +func TestExistingFloppyFile(t *testing.T) { + c := FloppyConfig{ + FloppyFiles: []string{"floppy_config.go"}, + } + + errs := c.Prepare(nil) + if len(errs) != 0 { + t.Fatal("array with existing floppies should not fail") + } +} + +func TestNonExistingFloppyFile(t *testing.T) { + c := FloppyConfig{ + FloppyFiles: []string{"floppy_config.foo"}, + } + + errs := c.Prepare(nil) + if len(errs) == 0 { + t.Fatal("array with non existing floppies should return errors") + } +} + +func TestMultiErrorFloppyFiles(t *testing.T) { + c := FloppyConfig{ + FloppyFiles: []string{"floppy_config.foo", "floppy_config.go", "floppy_config.bar", "floppy_config_test.go", "floppy_config.baz"}, + } + + errs := c.Prepare(nil) + if len(errs) == 0 { + t.Fatal("array with non existing floppies should return errors") + } + + expectedErrors := 3 + if count := len(errs); count != expectedErrors { + t.Fatalf("array with %v non existing floppy should return %v errors but it is returning %v", expectedErrors, expectedErrors, count) + } +} diff --git a/common/multistep_runner.go b/common/multistep_runner.go new file mode 100644 index 000000000..a9b155086 --- /dev/null +++ b/common/multistep_runner.go @@ -0,0 +1,154 @@ +package common + +import ( + "fmt" + "log" + "os" + "reflect" + "strings" + "time" + + "github.com/mitchellh/multistep" + "github.com/mitchellh/packer/packer" +) + +func newRunner(steps []multistep.Step, config PackerConfig, ui packer.Ui) (multistep.Runner, multistep.DebugPauseFn) { + switch config.PackerOnError { + case "", "cleanup": + case "abort": + for i, step := range steps { + steps[i] = abortStep{step, ui} + } + case "ask": + for i, step := range steps { + steps[i] = askStep{step, ui} + } + } + + if config.PackerDebug { + pauseFn := MultistepDebugFn(ui) + return &multistep.DebugRunner{Steps: steps, PauseFn: pauseFn}, pauseFn + } else { + return &multistep.BasicRunner{Steps: steps}, nil + } +} + +// NewRunner returns a multistep.Runner that runs steps augmented with support +// for -debug and -on-error command line arguments. +func NewRunner(steps []multistep.Step, config PackerConfig, ui packer.Ui) multistep.Runner { + runner, _ := newRunner(steps, config, ui) + return runner +} + +// NewRunnerWithPauseFn returns a multistep.Runner that runs steps augmented +// with support for -debug and -on-error command line arguments. With -debug it +// puts the multistep.DebugPauseFn that will pause execution between steps into +// the state under the key "pauseFn". +func NewRunnerWithPauseFn(steps []multistep.Step, config PackerConfig, ui packer.Ui, state multistep.StateBag) multistep.Runner { + runner, pauseFn := newRunner(steps, config, ui) + if pauseFn != nil { + state.Put("pauseFn", pauseFn) + } + return runner +} + +func typeName(i interface{}) string { + return reflect.Indirect(reflect.ValueOf(i)).Type().Name() +} + +type abortStep struct { + step multistep.Step + ui packer.Ui +} + +func (s abortStep) Run(state multistep.StateBag) multistep.StepAction { + return s.step.Run(state) +} + +func (s abortStep) Cleanup(state multistep.StateBag) { + if _, ok := state.GetOk(multistep.StateCancelled); ok { + s.ui.Error("Interrupted, aborting...") + os.Exit(1) + } + if _, ok := state.GetOk(multistep.StateHalted); ok { + s.ui.Error(fmt.Sprintf("Step %q failed, aborting...", typeName(s.step))) + os.Exit(1) + } + s.step.Cleanup(state) +} + +type askStep struct { + step multistep.Step + ui packer.Ui +} + +func (s askStep) Run(state multistep.StateBag) (action multistep.StepAction) { + for { + action = s.step.Run(state) + + if action != multistep.ActionHalt { + return + } + + switch ask(s.ui, typeName(s.step), state) { + case askCleanup: + return + case askAbort: + os.Exit(1) + case askRetry: + continue + } + } +} + +func (s askStep) Cleanup(state multistep.StateBag) { + s.step.Cleanup(state) +} + +type askResponse int + +const ( + askCleanup askResponse = iota + askAbort + askRetry +) + +func ask(ui packer.Ui, name string, state multistep.StateBag) askResponse { + ui.Say(fmt.Sprintf("Step %q failed", name)) + + result := make(chan askResponse) + go func() { + result <- askPrompt(ui) + }() + + for { + select { + case response := <-result: + return response + case <-time.After(100 * time.Millisecond): + if _, ok := state.GetOk(multistep.StateCancelled); ok { + return askCleanup + } + } + } +} + +func askPrompt(ui packer.Ui) askResponse { + for { + line, err := ui.Ask("[c] Clean up and exit, [a] abort without cleanup, or [r] retry step (build may fail even if retry succeeds)?") + if err != nil { + log.Printf("Error asking for input: %s", err) + } + + input := strings.ToLower(line) + "c" + switch input[0] { + case 'c': + return askCleanup + case 'a': + return askAbort + case 'r': + return askRetry + } + ui.Say(fmt.Sprintf("Incorrect input: %#v", line)) + } +} diff --git a/common/packer_config.go b/common/packer_config.go index 2ef86e582..3a14f64b5 100644 --- a/common/packer_config.go +++ b/common/packer_config.go @@ -8,5 +8,6 @@ type PackerConfig struct { PackerBuilderType string `mapstructure:"packer_builder_type"` PackerDebug bool `mapstructure:"packer_debug"` PackerForce bool `mapstructure:"packer_force"` + PackerOnError string `mapstructure:"packer_on_error"` PackerUserVars map[string]string `mapstructure:"packer_user_variables"` } diff --git a/builder/googlecompute/common.go b/common/retry.go similarity index 90% rename from builder/googlecompute/common.go rename to common/retry.go index 8f5520c16..a7aa74594 100644 --- a/builder/googlecompute/common.go +++ b/common/retry.go @@ -1,4 +1,4 @@ -package googlecompute +package common import ( "fmt" @@ -25,20 +25,20 @@ func Retry(initialInterval float64, maxInterval float64, numTries uint, function done := false interval := initialInterval for i := uint(0); !done && (numTries == 0 || i < numTries); i++ { - done, err = function() + done, err = function() if err != nil { return err } - + if !done { // Retry after delay. Calculate next delay. time.Sleep(time.Duration(interval) * time.Second) - interval = math.Min(interval * 2, maxInterval) + interval = math.Min(interval*2, maxInterval) } } if !done { - return RetryExhaustedError + return RetryExhaustedError } return nil } diff --git a/builder/googlecompute/common_test.go b/common/retry_test.go similarity index 98% rename from builder/googlecompute/common_test.go rename to common/retry_test.go index caf9c2436..4940dbc67 100644 --- a/builder/googlecompute/common_test.go +++ b/common/retry_test.go @@ -1,4 +1,4 @@ -package googlecompute +package common import ( "fmt" @@ -18,7 +18,7 @@ func TestRetry(t *testing.T) { if err != nil { t.Fatalf("Passing function should not have returned a retry error. Error: %s", err) } - + // Test that a failing function gets retried (once in this example). numTries = 0 results := []bool{false, true} @@ -33,7 +33,7 @@ func TestRetry(t *testing.T) { if err != nil { t.Fatalf("Successful retried function should not have returned a retry error. Error: %s", err) } - + // Test that a function error gets returned, and the function does not get called again. numTries = 0 funcErr := fmt.Errorf("This function had an error!") @@ -47,7 +47,7 @@ func TestRetry(t *testing.T) { if err != funcErr { t.Fatalf("Errant function did not return the right error %s. Error: %s", funcErr, err) } - + // Test when a function exhausts its retries. numTries = 0 expectedTries := uint(3) @@ -61,4 +61,4 @@ func TestRetry(t *testing.T) { if err != RetryExhaustedError { t.Fatalf("Unsuccessful retry function should have returned a retry exhausted error. Actual error: %s", err) } -} \ No newline at end of file +} diff --git a/common/test-fixtures/floppies/bar.bat b/common/test-fixtures/floppies/bar.bat new file mode 100644 index 000000000..0d6a4f32d --- /dev/null +++ b/common/test-fixtures/floppies/bar.bat @@ -0,0 +1 @@ +Echo I am a floppy with a batch file \ No newline at end of file diff --git a/common/test-fixtures/floppies/foo.ps1 b/common/test-fixtures/floppies/foo.ps1 new file mode 100644 index 000000000..672daeb89 --- /dev/null +++ b/common/test-fixtures/floppies/foo.ps1 @@ -0,0 +1 @@ +Write-Host "I am a floppy with some Powershell" \ No newline at end of file diff --git a/communicator/none/communicator_test.go b/communicator/none/communicator_test.go index fd5c6b13c..1153afb5c 100644 --- a/communicator/none/communicator_test.go +++ b/communicator/none/communicator_test.go @@ -13,4 +13,3 @@ func TestCommIsCommunicator(t *testing.T) { t.Fatalf("comm must be a communicator") } } - diff --git a/communicator/ssh/communicator.go b/communicator/ssh/communicator.go index 4427d45aa..faeb412cb 100644 --- a/communicator/ssh/communicator.go +++ b/communicator/ssh/communicator.go @@ -160,6 +160,7 @@ func (c *comm) UploadDir(dst string, src string, excl []string) error { func (c *comm) DownloadDir(src string, dst string, excl []string) error { log.Printf("Download dir '%s' to '%s'", src, dst) scpFunc := func(w io.Writer, stdoutR *bufio.Reader) error { + dirStack := []string{dst} for { fmt.Fprint(w, "\x00") @@ -178,6 +179,13 @@ func (c *comm) DownloadDir(src string, dst string, excl []string) error { return fmt.Errorf("%s", fi[1:len(fi)]) case 'C', 'D': break + case 'E': + dirStack = dirStack[:len(dirStack)-1] + if len(dirStack) == 1 { + fmt.Fprint(w, "\x00") + return nil + } + continue default: return fmt.Errorf("unexpected server response (%x)", fi[0]) } @@ -195,14 +203,16 @@ func (c *comm) DownloadDir(src string, dst string, excl []string) error { } log.Printf("Download dir mode:%s size:%d name:%s", mode, size, name) + + dst = filepath.Join(dirStack...) switch fi[0] { case 'D': err = os.MkdirAll(filepath.Join(dst, name), os.FileMode(0755)) if err != nil { return err } - fmt.Fprint(w, "\x00") - return nil + dirStack = append(dirStack, name) + continue case 'C': fmt.Fprint(w, "\x00") err = scpDownloadFile(filepath.Join(dst, name), stdoutR, size, os.FileMode(0644)) diff --git a/examples/azure/linux_custom_image.json b/examples/azure/linux_custom_image.json new file mode 100644 index 000000000..4f4be6ca4 --- /dev/null +++ b/examples/azure/linux_custom_image.json @@ -0,0 +1,44 @@ +{ + "variables": { + "client_id": "{{env `ARM_CLIENT_ID`}}", + "client_secret": "{{env `ARM_CLIENT_SECRET`}}", + "resource_group": "{{env `ARM_RESOURCE_GROUP`}}", + "storage_account": "{{env `ARM_STORAGE_ACCOUNT`}}", + "subscription_id": "{{env `ARM_SUBSCRIPTION_ID`}}" + }, + "builders": [ + { + "type": "azure-arm", + + "client_id": "{{user `client_id`}}", + "client_secret": "{{user `client_secret`}}", + "resource_group_name": "{{user `resource_group`}}", + "storage_account": "{{user `storage_account`}}", + "subscription_id": "{{user `subscription_id`}}", + + "capture_container_name": "images", + "capture_name_prefix": "packer", + + "os_type": "Linux", + "image_url": "https://my-storage-account.blob.core.windows.net/path/to/your/custom/image.vhd", + + "azure_tags": { + "dept": "engineering", + "task": "image deployment" + }, + + "location": "West US", + "vm_size": "Standard_A2" + } + ], + "provisioners": [{ + "execute_command": "chmod +x {{ .Path }}; {{ .Vars }} sudo -E sh '{{ .Path }}'", + "inline": [ + "apt-get update", + "apt-get upgrade -y", + "/usr/sbin/waagent -force -deprovision+user && export HISTSIZE=0 && sync" + ], + "inline_shebang": "/bin/sh -x", + "type": "shell" + }] +} diff --git a/examples/azure/windows_custom_image.json b/examples/azure/windows_custom_image.json new file mode 100644 index 000000000..394df6791 --- /dev/null +++ b/examples/azure/windows_custom_image.json @@ -0,0 +1,40 @@ +{ + "variables": { + "client_id": "{{env `ARM_CLIENT_ID`}}", + "client_secret": "{{env `ARM_CLIENT_SECRET`}}", + "resource_group": "{{env `ARM_RESOURCE_GROUP`}}", + "storage_account": "{{env `ARM_STORAGE_ACCOUNT`}}", + "subscription_id": "{{env `ARM_SUBSCRIPTION_ID`}}" + }, + "builders": [ + { + "type": "azure-arm", + + "client_id": "{{user `client_id`}}", + "client_secret": "{{user `client_secret`}}", + "resource_group_name": "{{user `resource_group`}}", + "storage_account": "{{user `storage_account`}}", + "subscription_id": "{{user `subscription_id`}}", + + "capture_container_name": "images", + "capture_name_prefix": "packer", + + "os_type": "Windows", + "image_url": "https://my-storage-account.blob.core.windows.net/path/to/your/custom/image.vhd", + + "azure_tags": { + "dept": "engineering", + "task": "image deployment" + }, + + "location": "West US", + "vm_size": "Standard_A2" + } + ], + "provisioners": [{ + "type": "powershell", + "inline": [ + "dir c:\\" + ] + }] +} diff --git a/helper/enumflag/flag.go b/helper/enumflag/flag.go new file mode 100644 index 000000000..ab6dce29b --- /dev/null +++ b/helper/enumflag/flag.go @@ -0,0 +1,28 @@ +package enumflag + +import "fmt" + +type enumFlag struct { + target *string + options []string +} + +// New returns a flag.Value implementation for parsing flags with a one-of-a-set value +func New(target *string, options ...string) *enumFlag { + return &enumFlag{target: target, options: options} +} + +func (f *enumFlag) String() string { + return *f.target +} + +func (f *enumFlag) Set(value string) error { + for _, v := range f.options { + if v == value { + *f.target = value + return nil + } + } + + return fmt.Errorf("expected one of %q", f.options) +} diff --git a/packer/build.go b/packer/build.go index 757ef89eb..a7aa5973a 100644 --- a/packer/build.go +++ b/packer/build.go @@ -24,6 +24,12 @@ const ( // force build is enabled. ForceConfigKey = "packer_force" + // This key determines what to do when a normal multistep step fails + // - "cleanup" - run cleanup steps + // - "abort" - exit without cleanup + // - "ask" - ask the user + OnErrorConfigKey = "packer_on_error" + // TemplatePathKey is the path to the template that configured this build TemplatePathKey = "packer_template_path" @@ -67,6 +73,12 @@ type Build interface { // When SetForce is set to true, existing artifacts from the build are // deleted prior to the build. SetForce(bool) + + // SetOnError will determine what to do when a normal multistep step fails + // - "cleanup" - run cleanup steps + // - "abort" - exit without cleanup + // - "ask" - ask the user + SetOnError(string) } // A build struct represents a single build job, the result of which should @@ -86,6 +98,7 @@ type coreBuild struct { debug bool force bool + onError string l sync.Mutex prepareCalled bool } @@ -129,6 +142,7 @@ func (b *coreBuild) Prepare() (warn []string, err error) { BuilderTypeConfigKey: b.builderType, DebugConfigKey: b.debug, ForceConfigKey: b.force, + OnErrorConfigKey: b.onError, TemplatePathKey: b.templatePath, UserVariablesConfigKey: b.variables, } @@ -306,6 +320,14 @@ func (b *coreBuild) SetForce(val bool) { b.force = val } +func (b *coreBuild) SetOnError(val string) { + if b.prepareCalled { + panic("prepare has already been called") + } + + b.onError = val +} + // Cancels the build if it is running. func (b *coreBuild) Cancel() { b.builder.Cancel() diff --git a/packer/build_test.go b/packer/build_test.go index e29318972..804ecbaf4 100644 --- a/packer/build_test.go +++ b/packer/build_test.go @@ -23,6 +23,7 @@ func testBuild() *coreBuild { }, }, variables: make(map[string]string), + onError: "cleanup", } } @@ -32,6 +33,7 @@ func testDefaultPackerConfig() map[string]interface{} { BuilderTypeConfigKey: "foo", DebugConfigKey: false, ForceConfigKey: false, + OnErrorConfigKey: "cleanup", TemplatePathKey: "", UserVariablesConfigKey: make(map[string]string), } diff --git a/packer/rpc/build.go b/packer/rpc/build.go index 4d0b7edf4..7a99a54a4 100644 --- a/packer/rpc/build.go +++ b/packer/rpc/build.go @@ -1,8 +1,9 @@ package rpc import ( - "github.com/mitchellh/packer/packer" "net/rpc" + + "github.com/mitchellh/packer/packer" ) // An implementation of packer.Build where the build is actually executed @@ -79,6 +80,12 @@ func (b *build) SetForce(val bool) { } } +func (b *build) SetOnError(val string) { + if err := b.client.Call("Build.SetOnError", val, new(interface{})); err != nil { + panic(err) + } +} + func (b *build) Cancel() { if err := b.client.Call("Build.Cancel", new(interface{}), new(interface{})); err != nil { panic(err) @@ -134,6 +141,11 @@ func (b *BuildServer) SetForce(val *bool, reply *interface{}) error { return nil } +func (b *BuildServer) SetOnError(val *string, reply *interface{}) error { + b.build.SetOnError(*val) + return nil +} + func (b *BuildServer) Cancel(args *interface{}, reply *interface{}) error { b.build.Cancel() return nil diff --git a/packer/rpc/build_test.go b/packer/rpc/build_test.go index d2f058e7d..57a4b8dc2 100644 --- a/packer/rpc/build_test.go +++ b/packer/rpc/build_test.go @@ -2,23 +2,25 @@ package rpc import ( "errors" - "github.com/mitchellh/packer/packer" "reflect" "testing" + + "github.com/mitchellh/packer/packer" ) var testBuildArtifact = &packer.MockArtifact{} type testBuild struct { - nameCalled bool - prepareCalled bool - prepareWarnings []string - runCalled bool - runCache packer.Cache - runUi packer.Ui - setDebugCalled bool - setForceCalled bool - cancelCalled bool + nameCalled bool + prepareCalled bool + prepareWarnings []string + runCalled bool + runCache packer.Cache + runUi packer.Ui + setDebugCalled bool + setForceCalled bool + setOnErrorCalled bool + cancelCalled bool errRunResult bool } @@ -53,6 +55,10 @@ func (b *testBuild) SetForce(bool) { b.setForceCalled = true } +func (b *testBuild) SetOnError(string) { + b.setOnErrorCalled = true +} + func (b *testBuild) Cancel() { b.cancelCalled = true } @@ -116,6 +122,12 @@ func TestBuild(t *testing.T) { t.Fatal("should be called") } + // Test SetOnError + bClient.SetOnError("ask") + if !b.setOnErrorCalled { + t.Fatal("should be called") + } + // Test Cancel bClient.Cancel() if !b.cancelCalled { diff --git a/post-processor/amazon-import/post-processor.go b/post-processor/amazon-import/post-processor.go index 7176c28e5..45019ffaf 100644 --- a/post-processor/amazon-import/post-processor.go +++ b/post-processor/amazon-import/post-processor.go @@ -30,8 +30,9 @@ type Config struct { S3Key string `mapstructure:"s3_key_name"` SkipClean bool `mapstructure:"skip_clean"` Tags map[string]string `mapstructure:"tags"` + Name string `mapstructure:"ami_name"` - ctx interpolate.Context + ctx interpolate.Context } type PostProcessor struct { @@ -206,6 +207,45 @@ func (p *PostProcessor) PostProcess(ui packer.Ui, artifact packer.Artifact) (pac // Pull AMI ID out of the completed job createdami := *import_result.ImportImageTasks[0].ImageId + if p.config.Name != "" { + + ui.Message(fmt.Sprintf("Starting rename of AMI (%s)", createdami)) + + resp, err := ec2conn.CopyImage(&ec2.CopyImageInput{ + Name: &p.config.Name, + SourceImageId: &createdami, + SourceRegion: config.Region, + }) + + if err != nil { + return nil, false, fmt.Errorf("Error Copying AMI (%s): %s", createdami, err) + } + + ui.Message(fmt.Sprintf("Waiting for AMI rename to complete (may take a while)")) + + stateChange := awscommon.StateChangeConf{ + Pending: []string{"pending"}, + Target: "available", + Refresh: awscommon.AMIStateRefreshFunc(ec2conn, *resp.ImageId), + } + + if _, err := awscommon.WaitForState(&stateChange); err != nil { + return nil, false, fmt.Errorf("Error waiting for AMI (%s): %s", *resp.ImageId, err) + } + + ec2conn.DeregisterImage(&ec2.DeregisterImageInput{ + ImageId: &createdami, + }) + + if err != nil { + return nil, false, fmt.Errorf("Error deregistering existing AMI: %s", err) + } + + ui.Message(fmt.Sprintf("AMI rename completed")) + + createdami = *resp.ImageId + } + // If we have tags, then apply them now to both the AMI and snaps // created by the import if len(p.config.Tags) > 0 { diff --git a/post-processor/docker-push/post-processor.go b/post-processor/docker-push/post-processor.go index ca8e1a84e..17a0f617c 100644 --- a/post-processor/docker-push/post-processor.go +++ b/post-processor/docker-push/post-processor.go @@ -15,11 +15,13 @@ import ( type Config struct { common.PackerConfig `mapstructure:",squash"` - Login bool - LoginEmail string `mapstructure:"login_email"` - LoginUsername string `mapstructure:"login_username"` - LoginPassword string `mapstructure:"login_password"` - LoginServer string `mapstructure:"login_server"` + Login bool + LoginEmail string `mapstructure:"login_email"` + LoginUsername string `mapstructure:"login_username"` + LoginPassword string `mapstructure:"login_password"` + LoginServer string `mapstructure:"login_server"` + EcrLogin bool `mapstructure:"ecr_login"` + docker.AwsAccessConfig `mapstructure:",squash"` ctx interpolate.Context } @@ -42,6 +44,9 @@ func (p *PostProcessor) Configure(raws ...interface{}) error { return err } + if p.config.EcrLogin && p.config.LoginServer == "" { + return fmt.Errorf("ECR login requires login server to be provided.") + } return nil } @@ -60,7 +65,19 @@ func (p *PostProcessor) PostProcess(ui packer.Ui, artifact packer.Artifact) (pac driver = &docker.DockerDriver{Ctx: &p.config.ctx, Ui: ui} } - if p.config.Login { + if p.config.EcrLogin { + ui.Message("Fetching ECR credentials...") + + username, password, err := p.config.EcrGetLogin(p.config.LoginServer) + if err != nil { + return nil, false, err + } + + p.config.LoginUsername = username + p.config.LoginPassword = password + } + + if p.config.Login || p.config.EcrLogin { ui.Message("Logging in...") err := driver.Login( p.config.LoginServer, diff --git a/post-processor/googlecompute-export/post-processor.go b/post-processor/googlecompute-export/post-processor.go index e835f30a9..c45a6f67d 100644 --- a/post-processor/googlecompute-export/post-processor.go +++ b/post-processor/googlecompute-export/post-processor.go @@ -81,7 +81,7 @@ func (p *PostProcessor) PostProcess(ui packer.Ui, artifact packer.Artifact) (pac RawStateTimeout: "5m", } exporterConfig.CalcTimeout() - + // Set up credentials and GCE driver. b, err := ioutil.ReadFile(accountKeyFilePath) if err != nil { diff --git a/post-processor/manifest/artifact.go b/post-processor/manifest/artifact.go index 781a54266..50ecc15a0 100644 --- a/post-processor/manifest/artifact.go +++ b/post-processor/manifest/artifact.go @@ -4,13 +4,18 @@ import "fmt" const BuilderId = "packer.post-processor.manifest" +type ArtifactFile struct { + Name string `json:"name"` + Size int64 `json:"size"` +} + type Artifact struct { - BuildName string `json:"name"` - BuilderType string `json:"builder_type"` - BuildTime int64 `json:"build_time"` - ArtifactFiles []string `json:"files"` - ArtifactId string `json:"artifact_id"` - PackerRunUUID string `json:"packer_run_uuid"` + BuildName string `json:"name"` + BuilderType string `json:"builder_type"` + BuildTime int64 `json:"build_time"` + ArtifactFiles []ArtifactFile `json:"files"` + ArtifactId string `json:"artifact_id"` + PackerRunUUID string `json:"packer_run_uuid"` } func (a *Artifact) BuilderId() string { @@ -18,7 +23,11 @@ func (a *Artifact) BuilderId() string { } func (a *Artifact) Files() []string { - return a.ArtifactFiles + var files []string + for _, af := range a.ArtifactFiles { + files = append(files, af.Name) + } + return files } func (a *Artifact) Id() string { diff --git a/post-processor/manifest/post-processor.go b/post-processor/manifest/post-processor.go index bd6648523..7b4507cf6 100644 --- a/post-processor/manifest/post-processor.go +++ b/post-processor/manifest/post-processor.go @@ -6,6 +6,7 @@ import ( "io/ioutil" "log" "os" + "path/filepath" "time" "github.com/mitchellh/packer/common" @@ -17,9 +18,9 @@ import ( type Config struct { common.PackerConfig `mapstructure:",squash"` - Filename string `mapstructure:"filename"` - - ctx interpolate.Context + Filename string `mapstructure:"filename"` + StripPath bool `mapstructure:"strip_path"` + ctx interpolate.Context } type PostProcessor struct { @@ -54,9 +55,21 @@ func (p *PostProcessor) PostProcess(ui packer.Ui, source packer.Artifact) (packe artifact := &Artifact{} var err error + var fi os.FileInfo // Create the current artifact. - artifact.ArtifactFiles = source.Files() + for _, name := range source.Files() { + af := ArtifactFile{} + if fi, err = os.Stat(name); err == nil { + af.Size = fi.Size() + } + if p.config.StripPath { + af.Name = filepath.Base(name) + } else { + af.Name = name + } + artifact.ArtifactFiles = append(artifact.ArtifactFiles, af) + } artifact.ArtifactId = source.Id() artifact.BuilderType = p.config.PackerBuilderType artifact.BuildName = p.config.PackerBuildName diff --git a/provisioner/ansible/adapter.go b/provisioner/ansible/adapter.go index 8dc0f72f4..0eb6bcda4 100644 --- a/provisioner/ansible/adapter.go +++ b/provisioner/ansible/adapter.go @@ -8,11 +8,14 @@ import ( "io" "log" "net" + "strings" "github.com/mitchellh/packer/packer" "golang.org/x/crypto/ssh" ) +// An adapter satisfies SSH requests (from an Ansible client) by delegating SSH +// exec and subsystem commands to a packer.Communicator. type adapter struct { done <-chan struct{} l net.Listener @@ -132,29 +135,15 @@ func (c *adapter) handleSession(newChannel ssh.NewChannel) error { return } - cmd := &packer.RemoteCmd{ - Stdin: channel, - Stdout: channel, - Stderr: channel.Stderr(), - Command: string(req.Payload), - } + go func(channel ssh.Channel) { + exit := c.exec(string(req.Payload), channel, channel, channel.Stderr()) - if err := c.comm.Start(cmd); err != nil { - c.ui.Error(err.Error()) - req.Reply(false, nil) - close(done) - return - } - - go func(cmd *packer.RemoteCmd, channel ssh.Channel) { - cmd.Wait() exitStatus := make([]byte, 4) - binary.BigEndian.PutUint32(exitStatus, uint32(cmd.ExitStatus)) + binary.BigEndian.PutUint32(exitStatus, uint32(exit)) channel.SendRequest("exit-status", false, exitStatus) close(done) - }(cmd, channel) + }(channel) req.Reply(true, nil) - case "subsystem": req, err := newSubsystemRequest(req) if err != nil { @@ -170,31 +159,16 @@ func (c *adapter) handleSession(newChannel ssh.NewChannel) error { if len(sftpCmd) == 0 { sftpCmd = "/usr/lib/sftp-server -e" } - cmd := &packer.RemoteCmd{ - Stdin: channel, - Stdout: channel, - Stderr: channel.Stderr(), - Command: sftpCmd, - } c.ui.Say("starting sftp subsystem") - if err := c.comm.Start(cmd); err != nil { - c.ui.Error(err.Error()) - req.Reply(false, nil) - close(done) - return - } - - req.Reply(true, nil) go func() { - cmd.Wait() + _ = c.remoteExec(sftpCmd, channel, channel, channel.Stderr()) close(done) }() - + req.Reply(true, nil) default: c.ui.Error(fmt.Sprintf("unsupported subsystem requested: %s", req.Payload)) req.Reply(false, nil) - } default: c.ui.Message(fmt.Sprintf("rejecting %s request", req.Type)) @@ -211,6 +185,57 @@ func (c *adapter) Shutdown() { c.l.Close() } +func (c *adapter) exec(command string, in io.Reader, out io.Writer, err io.Writer) int { + var exitStatus int + switch { + case strings.HasPrefix(command, "scp ") && serveSCP(command[4:]): + err := c.scpExec(command[4:], in, out, err) + if err != nil { + log.Println(err) + exitStatus = 1 + } + default: + exitStatus = c.remoteExec(command, in, out, err) + } + return exitStatus +} + +func serveSCP(args string) bool { + opts, _ := scpOptions(args) + return bytes.IndexAny(opts, "tf") >= 0 +} + +func (c *adapter) scpExec(args string, in io.Reader, out io.Writer, err io.Writer) error { + opts, rest := scpOptions(args) + + if i := bytes.IndexByte(opts, 't'); i >= 0 { + return scpUploadSession(opts, rest, in, out, c.comm) + } + + if i := bytes.IndexByte(opts, 'f'); i >= 0 { + return scpDownloadSession(opts, rest, in, out, c.comm) + } + return errors.New("no scp mode specified") +} + +func (c *adapter) remoteExec(command string, in io.Reader, out io.Writer, err io.Writer) int { + cmd := &packer.RemoteCmd{ + Stdin: in, + Stdout: out, + Stderr: err, + Command: command, + } + + if err := c.comm.Start(cmd); err != nil { + c.ui.Error(err.Error()) + return cmd.ExitStatus + } + + cmd.Wait() + + return cmd.ExitStatus +} + type envRequest struct { *ssh.Request Payload envRequestPayload diff --git a/provisioner/ansible/provisioner.go b/provisioner/ansible/provisioner.go index 74e1acc53..97623dda7 100644 --- a/provisioner/ansible/provisioner.go +++ b/provisioner/ansible/provisioner.go @@ -52,6 +52,7 @@ type Config struct { SSHHostKeyFile string `mapstructure:"ssh_host_key_file"` SSHAuthorizedKeyFile string `mapstructure:"ssh_authorized_key_file"` SFTPCmd string `mapstructure:"sftp_command"` + UseSFTP bool `mapstructure:"use_sftp"` inventoryFile string } @@ -106,6 +107,12 @@ func (p *Provisioner) Prepare(raws ...interface{}) error { log.Println(p.config.SSHHostKeyFile, "does not exist") errs = packer.MultiErrorAppend(errs, err) } + } else { + p.config.AnsibleEnvVars = append(p.config.AnsibleEnvVars, "ANSIBLE_HOST_KEY_CHECKING=False") + } + + if !p.config.UseSFTP { + p.config.AnsibleEnvVars = append(p.config.AnsibleEnvVars, "ANSIBLE_SCP_IF_SSH=True") } if len(p.config.LocalPort) > 0 { @@ -277,7 +284,7 @@ func (p *Provisioner) Provision(ui packer.Ui, comm packer.Communicator) error { }() } - if err := p.executeAnsible(ui, comm, k.privKeyFile, !hostSigner.generated); err != nil { + if err := p.executeAnsible(ui, comm, k.privKeyFile); err != nil { return fmt.Errorf("Error executing Ansible: %s", err) } @@ -294,7 +301,7 @@ func (p *Provisioner) Cancel() { os.Exit(0) } -func (p *Provisioner) executeAnsible(ui packer.Ui, comm packer.Communicator, privKeyFile string, checkHostKey bool) error { +func (p *Provisioner) executeAnsible(ui packer.Ui, comm packer.Communicator, privKeyFile string) error { playbook, _ := filepath.Abs(p.config.PlaybookFile) inventory := p.config.inventoryFile var envvars []string @@ -315,10 +322,6 @@ func (p *Provisioner) executeAnsible(ui packer.Ui, comm packer.Communicator, pri cmd.Env = append(cmd.Env, envvars...) } - if !checkHostKey { - cmd.Env = append(cmd.Env, "ANSIBLE_HOST_KEY_CHECKING=False") - } - stdout, err := cmd.StdoutPipe() if err != nil { return err @@ -435,7 +438,6 @@ func newUserKey(pubKeyFile string) (*userKey, error) { type signer struct { ssh.Signer - generated bool } func newSigner(privKeyFile string) (*signer, error) { @@ -464,7 +466,6 @@ func newSigner(privKeyFile string) (*signer, error) { if err != nil { return nil, errors.New("Failed to extract private key from generated key pair") } - signer.generated = true return signer, nil } diff --git a/provisioner/ansible/scp.go b/provisioner/ansible/scp.go new file mode 100644 index 000000000..21ccf1896 --- /dev/null +++ b/provisioner/ansible/scp.go @@ -0,0 +1,338 @@ +package ansible + +import ( + "bufio" + "bytes" + "errors" + "fmt" + "io" + "io/ioutil" + "log" + "os" + "path/filepath" + "strings" + "time" + + "github.com/mitchellh/packer/packer" +) + +const ( + scpOK = "\x00" + scpEmptyError = "\x02\n" +) + +/* +scp is a simple, but poorly documented, protocol. Thankfully, its source is +freely available, and there is at least one page that describes it reasonably +well. + +* https://raw.githubusercontent.com/openssh/openssh-portable/master/scp.c +* https://opensource.apple.com/source/OpenSSH/OpenSSH-7.1/openssh/scp.c +* https://blogs.oracle.com/janp/entry/how_the_scp_protocol_works is a great + resource, but has some bad information. Its first problem is that it doesn't + correctly describe why the producer has to read more responses than messages + it sends (because it has to read the 0 sent by the sink to start the + transfer). The second problem is that it omits that the producer needs to + send a 0 byte after file contents. +*/ + +func scpUploadSession(opts []byte, rest string, in io.Reader, out io.Writer, comm packer.Communicator) error { + rest = strings.TrimSpace(rest) + if len(rest) == 0 { + fmt.Fprintf(out, scpEmptyError) + return errors.New("no scp target specified") + } + + d, err := ioutil.TempDir("", "packer-ansible-upload") + if err != nil { + fmt.Fprintf(out, scpEmptyError) + return err + } + defer os.RemoveAll(d) + + state := &scpUploadState{destRoot: rest, srcRoot: d, comm: comm} + + fmt.Fprintf(out, scpOK) // signal the client to start the transfer. + return state.Protocol(bufio.NewReader(in), out) +} + +func scpDownloadSession(opts []byte, rest string, in io.Reader, out io.Writer, comm packer.Communicator) error { + rest = strings.TrimSpace(rest) + if len(rest) == 0 { + fmt.Fprintf(out, scpEmptyError) + return errors.New("no scp source specified") + } + + d, err := ioutil.TempDir("", "packer-ansible-download") + if err != nil { + fmt.Fprintf(out, scpEmptyError) + return err + } + defer os.RemoveAll(d) + + if bytes.Contains([]byte{'d'}, opts) { + // the only ansible module that supports downloading via scp is fetch, + // fetch only supports file downloads as of Ansible 2.1. + fmt.Fprintf(out, scpEmptyError) + return errors.New("directory downloads not supported") + } + + f, err := os.Create(filepath.Join(d, filepath.Base(rest))) + if err != nil { + fmt.Fprintf(out, scpEmptyError) + return err + } + defer f.Close() + + err = comm.Download(rest, f) + if err != nil { + fmt.Fprintf(out, scpEmptyError) + return err + } + + state := &scpDownloadState{srcRoot: d} + + return state.Protocol(bufio.NewReader(in), out) +} + +func (state *scpDownloadState) FileProtocol(path string, info os.FileInfo, in *bufio.Reader, out io.Writer) error { + size := info.Size() + perms := fmt.Sprintf("C%04o", info.Mode().Perm()) + fmt.Fprintln(out, perms, size, info.Name()) + err := scpResponse(in) + if err != nil { + return err + } + + f, err := os.Open(path) + if err != nil { + return err + } + defer f.Close() + + io.CopyN(out, f, size) + fmt.Fprintf(out, scpOK) + + return scpResponse(in) +} + +type scpUploadState struct { + comm packer.Communicator + destRoot string // destRoot is the directory on the target + srcRoot string // srcRoot is the directory on the host + mtime time.Time + atime time.Time + dir string // dir is a path relative to the roots +} + +func (scp scpUploadState) DestPath() string { + return filepath.Join(scp.destRoot, scp.dir) +} + +func (scp scpUploadState) SrcPath() string { + return filepath.Join(scp.srcRoot, scp.dir) +} + +func (state *scpUploadState) Protocol(in *bufio.Reader, out io.Writer) error { + for { + b, err := in.ReadByte() + if err != nil { + return err + } + switch b { + case 'T': + err := state.TimeProtocol(in, out) + if err != nil { + return err + } + case 'C': + return state.FileProtocol(in, out) + case 'E': + state.dir = filepath.Dir(state.dir) + fmt.Fprintf(out, scpOK) + return nil + case 'D': + return state.DirProtocol(in, out) + default: + fmt.Fprintf(out, scpEmptyError) + return fmt.Errorf("unexpected message: %c", b) + } + } +} + +func (state *scpUploadState) FileProtocol(in *bufio.Reader, out io.Writer) error { + defer func() { + state.mtime = time.Time{} + }() + + var mode os.FileMode + var size int64 + var name string + _, err := fmt.Fscanf(in, "%04o %d %s\n", &mode, &size, &name) + if err != nil { + fmt.Fprintf(out, scpEmptyError) + return fmt.Errorf("invalid file message: %v", err) + } + fmt.Fprintf(out, scpOK) + + var fi os.FileInfo = fileInfo{name: name, size: size, mode: mode, mtime: state.mtime} + + err = state.comm.Upload(filepath.Join(state.DestPath(), fi.Name()), io.LimitReader(in, fi.Size()), &fi) + if err != nil { + fmt.Fprintf(out, scpEmptyError) + return err + } + + err = scpResponse(in) + if err != nil { + return err + } + + fmt.Fprintf(out, scpOK) + return nil +} + +func (state *scpUploadState) TimeProtocol(in *bufio.Reader, out io.Writer) error { + var m, a int64 + if _, err := fmt.Fscanf(in, "%d 0 %d 0\n", &m, &a); err != nil { + fmt.Fprintf(out, scpEmptyError) + return err + } + fmt.Fprintf(out, scpOK) + + state.atime = time.Unix(a, 0) + state.mtime = time.Unix(m, 0) + return nil +} + +func (state *scpUploadState) DirProtocol(in *bufio.Reader, out io.Writer) error { + var mode os.FileMode + var length uint + var name string + + if _, err := fmt.Fscanf(in, "%04o %d %s\n", &mode, &length, &name); err != nil { + fmt.Fprintf(out, scpEmptyError) + return fmt.Errorf("invalid directory message: %v", err) + } + fmt.Fprintf(out, scpOK) + + path := filepath.Join(state.dir, name) + if err := os.Mkdir(path, mode); err != nil { + return err + } + state.dir = path + + if state.atime.IsZero() { + state.atime = time.Now() + } + if state.mtime.IsZero() { + state.mtime = time.Now() + } + + if err := os.Chtimes(path, state.atime, state.mtime); err != nil { + return err + } + + if err := state.comm.UploadDir(filepath.Dir(state.DestPath()), state.SrcPath(), nil); err != nil { + return err + } + + state.mtime = time.Time{} + state.atime = time.Time{} + return state.Protocol(in, out) +} + +type scpDownloadState struct { + srcRoot string // srcRoot is the directory on the host +} + +func (state *scpDownloadState) Protocol(in *bufio.Reader, out io.Writer) error { + r := bufio.NewReader(in) + // read the byte sent by the other side to start the transfer + scpResponse(r) + + return filepath.Walk(state.srcRoot, func(path string, info os.FileInfo, err error) error { + if err != nil { + return err + } + + if path == state.srcRoot { + return nil + } + + if info.IsDir() { + // no need to get fancy; srcRoot should only contain one file, because + // Ansible only allows fetching a single file. + return errors.New("unexpected directory") + } + + return state.FileProtocol(path, info, r, out) + }) +} + +func scpOptions(s string) (opts []byte, rest string) { + end := 0 + opt := false + +Loop: + for i := 0; i < len(s); i++ { + b := s[i] + switch { + case b == ' ': + opt = false + end++ + case b == '-': + opt = true + end++ + case opt: + opts = append(opts, b) + end++ + default: + break Loop + } + } + + rest = s[end:] + return +} + +func scpResponse(r *bufio.Reader) error { + code, err := r.ReadByte() + if err != nil { + return err + } + + if code != 0 { + message, err := r.ReadString('\n') + if err != nil { + return fmt.Errorf("Error reading error message: %s", err) + } + + // 1 is a warning. Anything higher (really just 2) is an error. + if code > 1 { + return errors.New(string(message)) + } + + log.Println("WARNING:", err) + } + return nil +} + +type fileInfo struct { + name string + size int64 + mode os.FileMode + mtime time.Time +} + +func (fi fileInfo) Name() string { return fi.name } +func (fi fileInfo) Size() int64 { return fi.size } +func (fi fileInfo) Mode() os.FileMode { return fi.mode } +func (fi fileInfo) ModTime() time.Time { + if fi.mtime.IsZero() { + return time.Now() + } + return fi.mtime +} +func (fi fileInfo) IsDir() bool { return fi.mode.IsDir() } +func (fi fileInfo) Sys() interface{} { return nil } diff --git a/provisioner/chef-client/provisioner.go b/provisioner/chef-client/provisioner.go index b85388b6b..33304d983 100644 --- a/provisioner/chef-client/provisioner.go +++ b/provisioner/chef-client/provisioner.go @@ -98,9 +98,9 @@ type InstallChefTemplate struct { } type KnifeTemplate struct { - Sudo bool - Flags string - Args string + Sudo bool + Flags string + Args string } func (p *Provisioner) Prepare(raws ...interface{}) error { @@ -500,7 +500,7 @@ func (p *Provisioner) knifeExec(ui packer.Ui, comm packer.Communicator, node str } p.config.ctx.Data = &KnifeTemplate{ - Sudo: !p.config.PreventSudo, + Sudo: !p.config.PreventSudo, Flags: strings.Join(flags, " "), Args: strings.Join(args, " "), } diff --git a/provisioner/chef-solo/provisioner.go b/provisioner/chef-solo/provisioner.go index 318ce9d72..27bdcd743 100644 --- a/provisioner/chef-solo/provisioner.go +++ b/provisioner/chef-solo/provisioner.go @@ -28,12 +28,12 @@ type guestOSTypeConfig struct { var guestOSTypeConfigs = map[string]guestOSTypeConfig{ provisioner.UnixOSType: guestOSTypeConfig{ executeCommand: "{{if .Sudo}}sudo {{end}}chef-solo --no-color -c {{.ConfigPath}} -j {{.JsonPath}}", - installCommand: "curl -L https://www.chef.io/chef/install.sh | {{if .Sudo}}sudo {{end}}bash", + installCommand: "curl -L https://omnitruck.chef.io/install.sh | {{if .Sudo}}sudo {{end}}bash", stagingDir: "/tmp/packer-chef-client", }, provisioner.WindowsOSType: guestOSTypeConfig{ executeCommand: "c:/opscode/chef/bin/chef-solo.bat --no-color -c {{.ConfigPath}} -j {{.JsonPath}}", - installCommand: "powershell.exe -Command \"(New-Object System.Net.WebClient).DownloadFile('http://chef.io/chef/install.msi', 'C:\\Windows\\Temp\\chef.msi');Start-Process 'msiexec' -ArgumentList '/qb /i C:\\Windows\\Temp\\chef.msi' -NoNewWindow -Wait\"", + installCommand: "powershell.exe -Command \". { iwr -useb https://omnitruck.chef.io/install.ps1 } | iex; install\"", stagingDir: "C:/Windows/Temp/packer-chef-client", }, } diff --git a/provisioner/file/provisioner.go b/provisioner/file/provisioner.go index 2b9a6b5fe..49498d08d 100644 --- a/provisioner/file/provisioner.go +++ b/provisioner/file/provisioner.go @@ -109,7 +109,7 @@ func (p *Provisioner) ProvisionDownload(ui packer.Ui, comm packer.Communicator) } } // if the config.Destination was a dir, download the dir - if !strings.HasSuffix(p.config.Destination, "/") { + if strings.HasSuffix(p.config.Destination, "/") { return comm.DownloadDir(src, p.config.Destination, nil) } diff --git a/provisioner/file/provisioner_test.go b/provisioner/file/provisioner_test.go index 53dc315d4..2169c96a3 100644 --- a/provisioner/file/provisioner_test.go +++ b/provisioner/file/provisioner_test.go @@ -192,5 +192,9 @@ func TestProvisionDownloadMkdirAll(t *testing.T) { if _, err := os.Stat(path); err != nil { t.Fatalf("stat of download dir should not error: %s", err) } + + if _, err := os.Stat(config["destination"].(string)); err != nil { + t.Fatalf("stat of destination file should not error: %s", err) + } } } diff --git a/provisioner/puppet-server/provisioner.go b/provisioner/puppet-server/provisioner.go index d0f49aa19..a15936a1c 100644 --- a/provisioner/puppet-server/provisioner.go +++ b/provisioner/puppet-server/provisioner.go @@ -16,7 +16,7 @@ import ( type Config struct { common.PackerConfig `mapstructure:",squash"` ctx interpolate.Context - + // The command used to execute Puppet. ExecuteCommand string `mapstructure:"execute_command"` @@ -76,11 +76,11 @@ func (p *Provisioner) Prepare(raws ...interface{}) error { if err != nil { return err } - + if p.config.ExecuteCommand == "" { p.config.ExecuteCommand = p.commandTemplate() } - + if p.config.StagingDir == "" { p.config.StagingDir = "/tmp/packer-puppet-server" } diff --git a/provisioner/shell/provisioner_test.go b/provisioner/shell/provisioner_test.go index 6f6b5424a..0b87da7bf 100644 --- a/provisioner/shell/provisioner_test.go +++ b/provisioner/shell/provisioner_test.go @@ -4,9 +4,9 @@ import ( "github.com/mitchellh/packer/packer" "io/ioutil" "os" - "testing" - "strings" "regexp" + "strings" + "testing" ) func testConfig() map[string]interface{} { @@ -306,7 +306,7 @@ func TestProvisioner_RemotePathSetViaRemotePathAndRemoteFile(t *testing.T) { t.Fatalf("should not have error: %s", err) } - if p.config.RemotePath != expectedRemoteFolder + "/" + expectedRemoteFile { + if p.config.RemotePath != expectedRemoteFolder+"/"+expectedRemoteFile { t.Fatalf("remote path does not contain remote_file") } } diff --git a/test/builder_googlecompute.bats b/test/builder_googlecompute.bats index d7062a9a8..1051bb99a 100755 --- a/test/builder_googlecompute.bats +++ b/test/builder_googlecompute.bats @@ -7,28 +7,26 @@ load test_helper fixtures builder-googlecompute # Required parameters -: ${GC_BUCKET_NAME:?} : ${GC_ACCOUNT_FILE:?} : ${GC_PROJECT_ID:?} -command -v gcutil >/dev/null 2>&1 || { - echo "'gcutil' must be installed" >&2 +command -v gcloud >/dev/null 2>&1 || { + echo "'gcloud' must be installed" >&2 exit 1 } -USER_VARS="-var bucket_name=${GC_BUCKET_NAME}" USER_VARS="${USER_VARS} -var account_file=${GC_ACCOUNT_FILE}" USER_VARS="${USER_VARS} -var project_id=${GC_PROJECT_ID}" # This tests if GCE has an image that contains the given parameter. gc_has_image() { - gcutil --format=names --project=${GC_PROJECT_ID} listimages \ + gcloud compute --format='table[no-heading](name)' --project=${GC_PROJECT_ID} images list \ | grep $1 | wc -l } teardown() { - gcutil --format=names --project=${GC_PROJECT_ID} listimages \ + gcloud compute --format='table[no-heading](name)' --project=${GC_PROJECT_ID} images list \ | grep packerbats \ - | xargs -n1 gcutil --project=${GC_PROJECT_ID} deleteimage --force + | xargs -n1 gcloud compute --project=${GC_PROJECT_ID} images delete } @test "googlecompute: build minimal.json" { diff --git a/test/fixtures/builder-googlecompute/minimal.json b/test/fixtures/builder-googlecompute/minimal.json index 218e98b9a..95dd99254 100644 --- a/test/fixtures/builder-googlecompute/minimal.json +++ b/test/fixtures/builder-googlecompute/minimal.json @@ -1,13 +1,11 @@ { "variables": { - "bucket_name": null, "account_file": null, "project_id": null }, "builders": [{ "type": "googlecompute", - "bucket_name": "{{user `bucket_name`}}", "account_file": "{{user `account_file`}}", "project_id": "{{user `project_id`}}", diff --git a/test/fixtures/provisioner-ansible/all_options.json b/test/fixtures/provisioner-ansible/all_options.json new file mode 100644 index 000000000..4f7e16255 --- /dev/null +++ b/test/fixtures/provisioner-ansible/all_options.json @@ -0,0 +1,40 @@ +{ + "variables": {}, + "provisioners": [ + { + "type": "shell-local", + "command": "echo 'TODO(bhcleek): write the public key to $HOME/.ssh/known_hosts and stop using ANSIBLE_HOST_KEY_CHECKING=False'" + }, { + "type": "shell", + "inline": [ + "apt-get update", + "apt-get -y install python openssh-sftp-server", + "ls -l /usr/lib" + ] + }, { + "type": "ansible", + "playbook_file": "./playbook.yml", + "extra_arguments": [ + "-vvvv", "--private-key", "ansible-test-id" + ], + "sftp_command": "/usr/lib/sftp-server -e -l INFO", + "use_sftp": true, + "ansible_env_vars": ["PACKER_ANSIBLE_TEST=1", "ANSIBLE_HOST_KEY_CHECKING=False"], + "groups": ["PACKER_TEST"], + "empty_groups": ["PACKER_EMPTY_GROUP"], + "host_alias": "packer-test", + "user": "packer", + "local_port": 2222, + "ssh_host_key_file": "ansible-server.key", + "ssh_authorized_key_file": "ansible-test-id.pub" + } + ], + "builders": [{ + "type": "googlecompute", + "account_file": "{{user `account_file`}}", + "project_id": "{{user `project_id`}}", + "image_name": "packerbats-alloptions-{{timestamp}}", + "source_image": "debian-7-wheezy-v20141108", + "zone": "us-central1-a" + }] +} diff --git a/test/fixtures/provisioner-ansible/dir/file.txt b/test/fixtures/provisioner-ansible/dir/file.txt new file mode 100644 index 000000000..0637880d7 --- /dev/null +++ b/test/fixtures/provisioner-ansible/dir/file.txt @@ -0,0 +1 @@ +This is a file diff --git a/test/fixtures/provisioner-ansible/largish-file.txt b/test/fixtures/provisioner-ansible/largish-file.txt new file mode 100644 index 000000000..4df7b0668 Binary files /dev/null and b/test/fixtures/provisioner-ansible/largish-file.txt differ diff --git a/test/fixtures/provisioner-ansible/minimal.json b/test/fixtures/provisioner-ansible/minimal.json new file mode 100644 index 000000000..0536228d9 --- /dev/null +++ b/test/fixtures/provisioner-ansible/minimal.json @@ -0,0 +1,19 @@ +{ + "variables": {}, + "provisioners": [ + { + "type": "ansible", + "playbook_file": "./playbook.yml" + } + ], + "builders": [ + { + "type": "googlecompute", + "account_file": "{{user `account_file`}}", + "project_id": "{{user `project_id`}}", + "image_name": "packerbats-minimal-{{timestamp}}", + "source_image": "debian-7-wheezy-v20141108", + "zone": "us-central1-a" + } + ] +} diff --git a/test/fixtures/provisioner-ansible/playbook.yml b/test/fixtures/provisioner-ansible/playbook.yml new file mode 100644 index 000000000..b352387c0 --- /dev/null +++ b/test/fixtures/provisioner-ansible/playbook.yml @@ -0,0 +1,13 @@ +--- +- hosts: default:packer-test + gather_facts: no + tasks: + - raw: touch /root/ansible-raw-test + - raw: date + - command: echo "the command module" + - command: mkdir /tmp/remote-dir + args: + creates: /tmp/remote-dir + - copy: src=dir/file.txt dest=/tmp/remote-dir/file.txt + - fetch: src=/tmp/remote-dir/file.txt dest=fetched-dir validate=yes fail_on_missing=yes + - copy: src=largish-file.txt dest=/tmp/largish-file.txt diff --git a/test/fixtures/provisioner-ansible/scp.json b/test/fixtures/provisioner-ansible/scp.json new file mode 100644 index 000000000..b94078f2a --- /dev/null +++ b/test/fixtures/provisioner-ansible/scp.json @@ -0,0 +1,23 @@ +{ + "variables": {}, + "provisioners": [ + { + "type": "ansible", + "playbook_file": "./playbook.yml", + "extra_arguments": [ + "-vvvv" + ], + "sftp_command": "/usr/bin/false" + } + ], + "builders": [ + { + "type": "googlecompute", + "account_file": "{{user `account_file`}}", + "project_id": "{{user `project_id`}}", + "image_name": "packerbats-scp-{{timestamp}}", + "source_image": "debian-7-wheezy-v20141108", + "zone": "us-central1-a" + } + ] +} diff --git a/test/fixtures/provisioner-ansible/sftp.json b/test/fixtures/provisioner-ansible/sftp.json new file mode 100644 index 000000000..bc2e5d731 --- /dev/null +++ b/test/fixtures/provisioner-ansible/sftp.json @@ -0,0 +1,30 @@ +{ + "variables": {}, + "provisioners": [ + { + "type": "shell", + "inline": [ + "apt-get update", + "apt-get -y install python openssh-sftp-server", + "ls -l /usr/lib", + "#/usr/lib/sftp-server -?" + ] + }, { + "type": "ansible", + "playbook_file": "./playbook.yml", + "sftp_command": "/usr/lib/sftp-server -e -l INFO", + "use_sftp": true + } + ], + "builders": [ + { + "type": "googlecompute", + "account_file": "{{user `account_file`}}", + "project_id": "{{user `project_id`}}", + + "image_name": "packerbats-sftp-{{timestamp}}", + "source_image": "debian-7-wheezy-v20141108", + "zone": "us-central1-a" + } + ] +} diff --git a/test/provisioner_ansible.bats b/test/provisioner_ansible.bats new file mode 100755 index 000000000..537435ae6 --- /dev/null +++ b/test/provisioner_ansible.bats @@ -0,0 +1,77 @@ +#!/usr/bin/env bats +# +# This tests the ansible provisioner on Google Cloud Provider (i.e. +# googlecompute). The teardown function will delete any images with the text +# "packerbats" within the name. + +load test_helper +fixtures provisioner-ansible + +# Required parameters +: ${GC_ACCOUNT_FILE:?} +: ${GC_PROJECT_ID:?} +command -v gcloud >/dev/null 2>&1 || { + echo "'gcloud' must be installed" >&2 + exit 1 +} + +USER_VARS="${USER_VARS} -var account_file=${GC_ACCOUNT_FILE}" +USER_VARS="${USER_VARS} -var project_id=${GC_PROJECT_ID}" + +# This tests if GCE has an image that contains the given parameter. +gc_has_image() { + gcloud compute --format='table[no-heading](name)' --project=${GC_PROJECT_ID} images list \ + | grep $1 | wc -l +} + +setup(){ + rm -f $FIXTURE_ROOT/ansible-test-id + rm -f $FIXTURE_ROOT/ansible-server.key + ssh-keygen -N "" -f $FIXTURE_ROOT/ansible-test-id + ssh-keygen -N "" -f $FIXTURE_ROOT/ansible-server.key +} + +teardown() { + gcloud compute --format='table[no-heading](name)' --project=${GC_PROJECT_ID} images list \ + | grep packerbats \ + | xargs -n1 gcloud compute --project=${GC_PROJECT_ID} images delete + + rm -f $FIXTURE_ROOT/ansible-test-id + rm -f $FIXTURE_ROOT/ansible-test-id.pub + rm -f $FIXTURE_ROOT/ansible-server.key + rm -f $FIXTURE_ROOT/ansible-server.key.pub + rm -rf $FIXTURE_ROOT/fetched-dir +} + +@test "ansible provisioner: build minimal.json" { + cd $FIXTURE_ROOT + run packer build ${USER_VARS} $FIXTURE_ROOT/minimal.json + [ "$status" -eq 0 ] + [ "$(gc_has_image "packerbats-minimal")" -eq 1 ] + diff -r dir fetched-dir/default/tmp/remote-dir > /dev/null +} + +@test "ansible provisioner: build all_options.json" { + cd $FIXTURE_ROOT + run packer build ${USER_VARS} $FIXTURE_ROOT/all_options.json + [ "$status" -eq 0 ] + [ "$(gc_has_image "packerbats-alloptions")" -eq 1 ] + diff -r dir fetched-dir/packer-test/tmp/remote-dir > /dev/null +} + +@test "ansible provisioner: build scp.json" { + cd $FIXTURE_ROOT + run packer build ${USER_VARS} $FIXTURE_ROOT/scp.json + [ "$status" -eq 0 ] + [ "$(gc_has_image "packerbats-scp")" -eq 1 ] + diff -r dir fetched-dir/default/tmp/remote-dir > /dev/null +} + +@test "ansible provisioner: build sftp.json" { + cd $FIXTURE_ROOT + run packer build ${USER_VARS} $FIXTURE_ROOT/sftp.json + [ "$status" -eq 0 ] + [ "$(gc_has_image "packerbats-sftp")" -eq 1 ] + diff -r dir fetched-dir/default/tmp/remote-dir > /dev/null +} + diff --git a/vendor/github.com/aws/aws-sdk-go/aws/awserr/error.go b/vendor/github.com/aws/aws-sdk-go/aws/awserr/error.go index 05a179c2c..56fdfc2bf 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/awserr/error.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/awserr/error.go @@ -42,9 +42,12 @@ type Error interface { OrigErr() error } -// BatchError is a batch of errors which also wraps lower level errors with code, message, -// and original errors. Calling Error() will only return the error that is at the end -// of the list. +// BatchError is a batch of errors which also wraps lower level errors with +// code, message, and original errors. Calling Error() will include all errors +// that occurred in the batch. +// +// Deprecated: Replaced with BatchedErrors. Only defined for backwards +// compatibility. type BatchError interface { // Satisfy the generic error interface. error @@ -59,17 +62,35 @@ type BatchError interface { OrigErrs() []error } +// BatchedErrors is a batch of errors which also wraps lower level errors with +// code, message, and original errors. Calling Error() will include all errors +// that occurred in the batch. +// +// Replaces BatchError +type BatchedErrors interface { + // Satisfy the base Error interface. + Error + + // Returns the original error if one was set. Nil is returned if not set. + OrigErrs() []error +} + // New returns an Error object described by the code, message, and origErr. // // If origErr satisfies the Error interface it will not be wrapped within a new // Error object and will instead be returned. func New(code, message string, origErr error) Error { - return newBaseError(code, message, origErr) + var errs []error + if origErr != nil { + errs = append(errs, origErr) + } + return newBaseError(code, message, errs) } -// NewBatchError returns an baseError with an expectation of an array of errors -func NewBatchError(code, message string, errs []error) BatchError { - return newBaseErrors(code, message, errs) +// NewBatchError returns an BatchedErrors with a collection of errors as an +// array of errors. +func NewBatchError(code, message string, errs []error) BatchedErrors { + return newBaseError(code, message, errs) } // A RequestFailure is an interface to extract request failure information from @@ -82,9 +103,9 @@ func NewBatchError(code, message string, errs []error) BatchError { // output, err := s3manage.Upload(svc, input, opts) // if err != nil { // if reqerr, ok := err.(RequestFailure); ok { -// log.Printf("Request failed", reqerr.Code(), reqerr.Message(), reqerr.RequestID()) +// log.Println("Request failed", reqerr.Code(), reqerr.Message(), reqerr.RequestID()) // } else { -// log.Printf("Error:", err.Error() +// log.Println("Error:", err.Error()) // } // } // diff --git a/vendor/github.com/aws/aws-sdk-go/aws/awserr/types.go b/vendor/github.com/aws/aws-sdk-go/aws/awserr/types.go index 605f73c5d..0202a008f 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/awserr/types.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/awserr/types.go @@ -34,36 +34,17 @@ type baseError struct { errs []error } -// newBaseError returns an error object for the code, message, and err. +// newBaseError returns an error object for the code, message, and errors. // // code is a short no whitespace phrase depicting the classification of // the error that is being created. // -// message is the free flow string containing detailed information about the error. +// message is the free flow string containing detailed information about the +// error. // -// origErr is the error object which will be nested under the new error to be returned. -func newBaseError(code, message string, origErr error) *baseError { - b := &baseError{ - code: code, - message: message, - } - - if origErr != nil { - b.errs = append(b.errs, origErr) - } - - return b -} - -// newBaseErrors returns an error object for the code, message, and errors. -// -// code is a short no whitespace phrase depicting the classification of -// the error that is being created. -// -// message is the free flow string containing detailed information about the error. -// -// origErrs is the error objects which will be nested under the new errors to be returned. -func newBaseErrors(code, message string, origErrs []error) *baseError { +// origErrs is the error objects which will be nested under the new errors to +// be returned. +func newBaseError(code, message string, origErrs []error) *baseError { b := &baseError{ code: code, message: message, @@ -103,19 +84,26 @@ func (b baseError) Message() string { return b.message } -// OrigErr returns the original error if one was set. Nil is returned if no error -// was set. This only returns the first element in the list. If the full list is -// needed, use BatchError +// OrigErr returns the original error if one was set. Nil is returned if no +// error was set. This only returns the first element in the list. If the full +// list is needed, use BatchedErrors. func (b baseError) OrigErr() error { - if size := len(b.errs); size > 0 { + switch len(b.errs) { + case 0: + return nil + case 1: return b.errs[0] + default: + if err, ok := b.errs[0].(Error); ok { + return NewBatchError(err.Code(), err.Message(), b.errs[1:]) + } + return NewBatchError("BatchedErrors", + "multiple errors occurred", b.errs) } - - return nil } -// OrigErrs returns the original errors if one was set. An empty slice is returned if -// no error was set:w +// OrigErrs returns the original errors if one was set. An empty slice is +// returned if no error was set. func (b baseError) OrigErrs() []error { return b.errs } @@ -133,8 +121,8 @@ type requestError struct { requestID string } -// newRequestError returns a wrapped error with additional information for request -// status code, and service requestID. +// newRequestError returns a wrapped error with additional information for +// request status code, and service requestID. // // Should be used to wrap all request which involve service requests. Even if // the request failed without a service response, but had an HTTP status code @@ -173,6 +161,15 @@ func (r requestError) RequestID() string { return r.requestID } +// OrigErrs returns the original errors if one was set. An empty slice is +// returned if no error was set. +func (r requestError) OrigErrs() []error { + if b, ok := r.awsError.(BatchedErrors); ok { + return b.OrigErrs() + } + return []error{r.OrigErr()} +} + // An error list that satisfies the golang interface type errorList []error diff --git a/vendor/github.com/aws/aws-sdk-go/aws/awsutil/copy.go b/vendor/github.com/aws/aws-sdk-go/aws/awsutil/copy.go index 8429470b9..1a3d106d5 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/awsutil/copy.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/awsutil/copy.go @@ -3,6 +3,7 @@ package awsutil import ( "io" "reflect" + "time" ) // Copy deeply copies a src structure to dst. Useful for copying request and @@ -49,7 +50,14 @@ func rcopy(dst, src reflect.Value, root bool) { } else { e := src.Type().Elem() if dst.CanSet() && !src.IsNil() { - dst.Set(reflect.New(e)) + if _, ok := src.Interface().(*time.Time); !ok { + dst.Set(reflect.New(e)) + } else { + tempValue := reflect.New(e) + tempValue.Elem().Set(src.Elem()) + // Sets time.Time's unexported values + dst.Set(tempValue) + } } if src.Elem().IsValid() { // Keep the current root state since the depth hasn't changed diff --git a/vendor/github.com/aws/aws-sdk-go/aws/awsutil/prettify.go b/vendor/github.com/aws/aws-sdk-go/aws/awsutil/prettify.go index 0de3eaa0f..fc38172fe 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/awsutil/prettify.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/awsutil/prettify.go @@ -91,6 +91,10 @@ func prettify(v reflect.Value, indent int, buf *bytes.Buffer) { buf.WriteString("\n" + strings.Repeat(" ", indent) + "}") default: + if !v.IsValid() { + fmt.Fprint(buf, "") + return + } format := "%v" switch v.Interface().(type) { case string: diff --git a/vendor/github.com/aws/aws-sdk-go/aws/client/client.go b/vendor/github.com/aws/aws-sdk-go/aws/client/client.go index c8d0564d8..4003c04b0 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/client/client.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/client/client.go @@ -87,9 +87,18 @@ const logReqMsg = `DEBUG: Request %s/%s Details: %s -----------------------------------------------------` +const logReqErrMsg = `DEBUG ERROR: Request %s/%s: +---[ REQUEST DUMP ERROR ]----------------------------- +%s +-----------------------------------------------------` + func logRequest(r *request.Request) { logBody := r.Config.LogLevel.Matches(aws.LogDebugWithHTTPBody) - dumpedBody, _ := httputil.DumpRequestOut(r.HTTPRequest, logBody) + dumpedBody, err := httputil.DumpRequestOut(r.HTTPRequest, logBody) + if err != nil { + r.Config.Logger.Log(fmt.Sprintf(logReqErrMsg, r.ClientInfo.ServiceName, r.Operation.Name, err)) + return + } if logBody { // Reset the request body because dumpRequest will re-wrap the r.HTTPRequest's @@ -107,11 +116,21 @@ const logRespMsg = `DEBUG: Response %s/%s Details: %s -----------------------------------------------------` +const logRespErrMsg = `DEBUG ERROR: Response %s/%s: +---[ RESPONSE DUMP ERROR ]----------------------------- +%s +-----------------------------------------------------` + func logResponse(r *request.Request) { var msg = "no response data" if r.HTTPResponse != nil { logBody := r.Config.LogLevel.Matches(aws.LogDebugWithHTTPBody) - dumpedBody, _ := httputil.DumpResponse(r.HTTPResponse, logBody) + dumpedBody, err := httputil.DumpResponse(r.HTTPResponse, logBody) + if err != nil { + r.Config.Logger.Log(fmt.Sprintf(logRespErrMsg, r.ClientInfo.ServiceName, r.Operation.Name, err)) + return + } + msg = string(dumpedBody) } else if r.Error != nil { msg = r.Error.Error() diff --git a/vendor/github.com/aws/aws-sdk-go/aws/client/default_retryer.go b/vendor/github.com/aws/aws-sdk-go/aws/client/default_retryer.go index 24d39ce56..43a3676b7 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/client/default_retryer.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/client/default_retryer.go @@ -1,8 +1,8 @@ package client import ( - "math" "math/rand" + "sync" "time" "github.com/aws/aws-sdk-go/aws/request" @@ -30,16 +30,61 @@ func (d DefaultRetryer) MaxRetries() int { return d.NumMaxRetries } +var seededRand = rand.New(&lockedSource{src: rand.NewSource(time.Now().UnixNano())}) + // RetryRules returns the delay duration before retrying this request again func (d DefaultRetryer) RetryRules(r *request.Request) time.Duration { - delay := int(math.Pow(2, float64(r.RetryCount))) * (rand.Intn(30) + 30) + // Set the upper limit of delay in retrying at ~five minutes + minTime := 30 + throttle := d.shouldThrottle(r) + if throttle { + minTime = 500 + } + + retryCount := r.RetryCount + if retryCount > 13 { + retryCount = 13 + } else if throttle && retryCount > 8 { + retryCount = 8 + } + + delay := (1 << uint(retryCount)) * (seededRand.Intn(minTime) + minTime) return time.Duration(delay) * time.Millisecond } -// ShouldRetry returns if the request should be retried. +// ShouldRetry returns true if the request should be retried. func (d DefaultRetryer) ShouldRetry(r *request.Request) bool { if r.HTTPResponse.StatusCode >= 500 { return true } - return r.IsErrorRetryable() + return r.IsErrorRetryable() || d.shouldThrottle(r) +} + +// ShouldThrottle returns true if the request should be throttled. +func (d DefaultRetryer) shouldThrottle(r *request.Request) bool { + if r.HTTPResponse.StatusCode == 502 || + r.HTTPResponse.StatusCode == 503 || + r.HTTPResponse.StatusCode == 504 { + return true + } + return r.IsErrorThrottle() +} + +// lockedSource is a thread-safe implementation of rand.Source +type lockedSource struct { + lk sync.Mutex + src rand.Source +} + +func (r *lockedSource) Int63() (n int64) { + r.lk.Lock() + n = r.src.Int63() + r.lk.Unlock() + return +} + +func (r *lockedSource) Seed(seed int64) { + r.lk.Lock() + r.src.Seed(seed) + r.lk.Unlock() } diff --git a/vendor/github.com/aws/aws-sdk-go/aws/config.go b/vendor/github.com/aws/aws-sdk-go/aws/config.go index 9e83e9260..fca922584 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/config.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/config.go @@ -7,24 +7,36 @@ import ( "github.com/aws/aws-sdk-go/aws/credentials" ) -// UseServiceDefaultRetries instructs the config to use the service's own default -// number of retries. This will be the default action if Config.MaxRetries -// is nil also. +// UseServiceDefaultRetries instructs the config to use the service's own +// default number of retries. This will be the default action if +// Config.MaxRetries is nil also. const UseServiceDefaultRetries = -1 -// RequestRetryer is an alias for a type that implements the request.Retryer interface. +// RequestRetryer is an alias for a type that implements the request.Retryer +// interface. type RequestRetryer interface{} // A Config provides service configuration for service clients. By default, -// all clients will use the {defaults.DefaultConfig} structure. +// all clients will use the defaults.DefaultConfig tructure. +// +// // Create Session with MaxRetry configuration to be shared by multiple +// // service clients. +// sess, err := session.NewSession(&aws.Config{ +// MaxRetries: aws.Int(3), +// }) +// +// // Create S3 service client with a specific Region. +// svc := s3.New(sess, &aws.Config{ +// Region: aws.String("us-west-2"), +// }) type Config struct { // Enables verbose error printing of all credential chain errors. - // Should be used when wanting to see all errors while attempting to retreive - // credentials. + // Should be used when wanting to see all errors while attempting to + // retrieve credentials. CredentialsChainVerboseErrors *bool - // The credentials object to use when signing requests. Defaults to - // a chain of credential providers to search for credentials in environment + // The credentials object to use when signing requests. Defaults to a + // chain of credential providers to search for credentials in environment // variables, shared credential file, and EC2 Instance Roles. Credentials *credentials.Credentials @@ -63,11 +75,12 @@ type Config struct { Logger Logger // The maximum number of times that a request will be retried for failures. - // Defaults to -1, which defers the max retry setting to the service specific - // configuration. + // Defaults to -1, which defers the max retry setting to the service + // specific configuration. MaxRetries *int - // Retryer guides how HTTP requests should be retried in case of recoverable failures. + // Retryer guides how HTTP requests should be retried in case of + // recoverable failures. // // When nil or the value does not implement the request.Retryer interface, // the request.DefaultRetryer will be used. @@ -82,8 +95,8 @@ type Config struct { // Retryer RequestRetryer - // Disables semantic parameter validation, which validates input for missing - // required fields and/or other semantic request input errors. + // Disables semantic parameter validation, which validates input for + // missing required fields and/or other semantic request input errors. DisableParamValidation *bool // Disables the computation of request and response checksums, e.g., @@ -91,8 +104,8 @@ type Config struct { DisableComputeChecksums *bool // Set this to `true` to force the request to use path-style addressing, - // i.e., `http://s3.amazonaws.com/BUCKET/KEY`. By default, the S3 client will - // use virtual hosted bucket addressing when possible + // i.e., `http://s3.amazonaws.com/BUCKET/KEY`. By default, the S3 client + // will use virtual hosted bucket addressing when possible // (`http://BUCKET.s3.amazonaws.com/KEY`). // // @note This configuration option is specific to the Amazon S3 service. @@ -100,28 +113,93 @@ type Config struct { // Amazon S3: Virtual Hosting of Buckets S3ForcePathStyle *bool - // Set this to `true` to disable the EC2Metadata client from overriding the - // default http.Client's Timeout. This is helpful if you do not want the EC2Metadata - // client to create a new http.Client. This options is only meaningful if you're not - // already using a custom HTTP client with the SDK. Enabled by default. + // Set this to `true` to disable the SDK adding the `Expect: 100-Continue` + // header to PUT requests over 2MB of content. 100-Continue instructs the + // HTTP client not to send the body until the service responds with a + // `continue` status. This is useful to prevent sending the request body + // until after the request is authenticated, and validated. // - // Must be set and provided to the session.New() in order to disable the EC2Metadata - // overriding the timeout for default credentials chain. + // http://docs.aws.amazon.com/AmazonS3/latest/API/RESTObjectPUT.html + // + // 100-Continue is only enabled for Go 1.6 and above. See `http.Transport`'s + // `ExpectContinueTimeout` for information on adjusting the continue wait + // timeout. https://golang.org/pkg/net/http/#Transport + // + // You should use this flag to disble 100-Continue if you experience issues + // with proxies or third party S3 compatible services. + S3Disable100Continue *bool + + // Set this to `true` to enable S3 Accelerate feature. For all operations + // compatible with S3 Accelerate will use the accelerate endpoint for + // requests. Requests not compatible will fall back to normal S3 requests. + // + // The bucket must be enable for accelerate to be used with S3 client with + // accelerate enabled. If the bucket is not enabled for accelerate an error + // will be returned. The bucket name must be DNS compatible to also work + // with accelerate. + // + // Not compatible with UseDualStack requests will fail if both flags are + // specified. + S3UseAccelerate *bool + + // Set this to `true` to disable the EC2Metadata client from overriding the + // default http.Client's Timeout. This is helpful if you do not want the + // EC2Metadata client to create a new http.Client. This options is only + // meaningful if you're not already using a custom HTTP client with the + // SDK. Enabled by default. + // + // Must be set and provided to the session.NewSession() in order to disable + // the EC2Metadata overriding the timeout for default credentials chain. // // Example: - // sess := session.New(aws.NewConfig().WithEC2MetadataDiableTimeoutOverride(true)) + // sess, err := session.NewSession(aws.NewConfig().WithEC2MetadataDiableTimeoutOverride(true)) + // // svc := s3.New(sess) // EC2MetadataDisableTimeoutOverride *bool + // Instructs the endpiont to be generated for a service client to + // be the dual stack endpoint. The dual stack endpoint will support + // both IPv4 and IPv6 addressing. + // + // Setting this for a service which does not support dual stack will fail + // to make requets. It is not recommended to set this value on the session + // as it will apply to all service clients created with the session. Even + // services which don't support dual stack endpoints. + // + // If the Endpoint config value is also provided the UseDualStack flag + // will be ignored. + // + // Only supported with. + // + // sess, err := session.NewSession() + // + // svc := s3.New(sess, &aws.Config{ + // UseDualStack: aws.Bool(true), + // }) + UseDualStack *bool + + // SleepDelay is an override for the func the SDK will call when sleeping + // during the lifecycle of a request. Specifically this will be used for + // request delays. This value should only be used for testing. To adjust + // the delay of a request see the aws/client.DefaultRetryer and + // aws/request.Retryer. SleepDelay func(time.Duration) } -// NewConfig returns a new Config pointer that can be chained with builder methods to -// set multiple configuration values inline without using pointers. +// NewConfig returns a new Config pointer that can be chained with builder +// methods to set multiple configuration values inline without using pointers. // -// svc := s3.New(aws.NewConfig().WithRegion("us-west-2").WithMaxRetries(10)) +// // Create Session with MaxRetry configuration to be shared by multiple +// // service clients. +// sess, err := session.NewSession(aws.NewConfig(). +// WithMaxRetries(3), +// ) // +// // Create S3 service client with a specific Region. +// svc := s3.New(sess, aws.NewConfig(). +// WithRegion("us-west-2"), +// ) func NewConfig() *Config { return &Config{} } @@ -210,6 +288,27 @@ func (c *Config) WithS3ForcePathStyle(force bool) *Config { return c } +// WithS3Disable100Continue sets a config S3Disable100Continue value returning +// a Config pointer for chaining. +func (c *Config) WithS3Disable100Continue(disable bool) *Config { + c.S3Disable100Continue = &disable + return c +} + +// WithS3UseAccelerate sets a config S3UseAccelerate value returning a Config +// pointer for chaining. +func (c *Config) WithS3UseAccelerate(enable bool) *Config { + c.S3UseAccelerate = &enable + return c +} + +// WithUseDualStack sets a config UseDualStack value returning a Config +// pointer for chaining. +func (c *Config) WithUseDualStack(enable bool) *Config { + c.UseDualStack = &enable + return c +} + // WithEC2MetadataDisableTimeoutOverride sets a config EC2MetadataDisableTimeoutOverride value // returning a Config pointer for chaining. func (c *Config) WithEC2MetadataDisableTimeoutOverride(enable bool) *Config { @@ -288,6 +387,18 @@ func mergeInConfig(dst *Config, other *Config) { dst.S3ForcePathStyle = other.S3ForcePathStyle } + if other.S3Disable100Continue != nil { + dst.S3Disable100Continue = other.S3Disable100Continue + } + + if other.S3UseAccelerate != nil { + dst.S3UseAccelerate = other.S3UseAccelerate + } + + if other.UseDualStack != nil { + dst.UseDualStack = other.UseDualStack + } + if other.EC2MetadataDisableTimeoutOverride != nil { dst.EC2MetadataDisableTimeoutOverride = other.EC2MetadataDisableTimeoutOverride } diff --git a/vendor/github.com/aws/aws-sdk-go/aws/convert_types.go b/vendor/github.com/aws/aws-sdk-go/aws/convert_types.go index d6a7b08df..3b73a7da7 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/convert_types.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/convert_types.go @@ -2,7 +2,7 @@ package aws import "time" -// String returns a pointer to of the string value passed in. +// String returns a pointer to the string value passed in. func String(v string) *string { return &v } @@ -61,7 +61,7 @@ func StringValueMap(src map[string]*string) map[string]string { return dst } -// Bool returns a pointer to of the bool value passed in. +// Bool returns a pointer to the bool value passed in. func Bool(v bool) *bool { return &v } @@ -120,7 +120,7 @@ func BoolValueMap(src map[string]*bool) map[string]bool { return dst } -// Int returns a pointer to of the int value passed in. +// Int returns a pointer to the int value passed in. func Int(v int) *int { return &v } @@ -179,7 +179,7 @@ func IntValueMap(src map[string]*int) map[string]int { return dst } -// Int64 returns a pointer to of the int64 value passed in. +// Int64 returns a pointer to the int64 value passed in. func Int64(v int64) *int64 { return &v } @@ -238,7 +238,7 @@ func Int64ValueMap(src map[string]*int64) map[string]int64 { return dst } -// Float64 returns a pointer to of the float64 value passed in. +// Float64 returns a pointer to the float64 value passed in. func Float64(v float64) *float64 { return &v } @@ -297,7 +297,7 @@ func Float64ValueMap(src map[string]*float64) map[string]float64 { return dst } -// Time returns a pointer to of the time.Time value passed in. +// Time returns a pointer to the time.Time value passed in. func Time(v time.Time) *time.Time { return &v } @@ -311,6 +311,18 @@ func TimeValue(v *time.Time) time.Time { return time.Time{} } +// TimeUnixMilli returns a Unix timestamp in milliseconds from "January 1, 1970 UTC". +// The result is undefined if the Unix time cannot be represented by an int64. +// Which includes calling TimeUnixMilli on a zero Time is undefined. +// +// This utility is useful for service API's such as CloudWatch Logs which require +// their unix time values to be in milliseconds. +// +// See Go stdlib https://golang.org/pkg/time/#Time.UnixNano for more information. +func TimeUnixMilli(t time.Time) int64 { + return t.UnixNano() / int64(time.Millisecond/time.Nanosecond) +} + // TimeSlice converts a slice of time.Time values into a slice of // time.Time pointers func TimeSlice(src []time.Time) []*time.Time { diff --git a/vendor/github.com/aws/aws-sdk-go/aws/corehandlers/handlers.go b/vendor/github.com/aws/aws-sdk-go/aws/corehandlers/handlers.go index 1d3e656fd..8456e29b5 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/corehandlers/handlers.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/corehandlers/handlers.go @@ -24,30 +24,38 @@ type lener interface { // BuildContentLengthHandler 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. +// +// The Content-Length will only be aded to the request if the length of the body +// is greater than 0. If the body is empty or the current `Content-Length` +// header is <= 0, the header will also be stripped. var BuildContentLengthHandler = request.NamedHandler{Name: "core.BuildContentLengthHandler", Fn: func(r *request.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`") + + if slength := r.HTTPRequest.Header.Get("Content-Length"); slength != "" { + length, _ = strconv.ParseInt(slength, 10, 64) + } else { + 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)) + if length > 0 { + r.HTTPRequest.ContentLength = length + r.HTTPRequest.Header.Set("Content-Length", fmt.Sprintf("%d", length)) + } else { + r.HTTPRequest.ContentLength = 0 + r.HTTPRequest.Header.Del("Content-Length") + } }} // SDKVersionUserAgentHandler is a request handler for adding the SDK Version to the user agent. @@ -64,6 +72,11 @@ var SendHandler = request.NamedHandler{Name: "core.SendHandler", Fn: func(r *req var err error r.HTTPResponse, err = r.Config.HTTPClient.Do(r.HTTPRequest) if err != nil { + // Prevent leaking if an HTTPResponse was returned. Clean up + // the body. + if r.HTTPResponse != nil { + r.HTTPResponse.Body.Close() + } // Capture the case where url.Error is returned for error processing // response. e.g. 301 without location header comes back as string // error and r.HTTPResponse is nil. Other url redirect errors will diff --git a/vendor/github.com/aws/aws-sdk-go/aws/corehandlers/param_validator.go b/vendor/github.com/aws/aws-sdk-go/aws/corehandlers/param_validator.go index ea07580a9..7d50b1557 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/corehandlers/param_validator.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/corehandlers/param_validator.go @@ -1,153 +1,17 @@ package corehandlers -import ( - "fmt" - "reflect" - "strconv" - "strings" - - "github.com/aws/aws-sdk-go/aws/awserr" - "github.com/aws/aws-sdk-go/aws/request" -) +import "github.com/aws/aws-sdk-go/aws/request" // ValidateParametersHandler is a request handler to validate the input parameters. // Validating parameters only has meaning if done prior to the request being sent. var ValidateParametersHandler = request.NamedHandler{Name: "core.ValidateParametersHandler", Fn: func(r *request.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 = awserr.New("InvalidParameter", msg, nil) - } - } -}} - -// A validator validates values. Collects validations errors which occurs. -type validator struct { - errors []string -} - -// There's no validation to be done on the contents of []byte values. Prepare -// to check validateAny arguments against that type so we can quickly skip -// them. -var byteSliceType = reflect.TypeOf([]byte(nil)) - -// validateAny will validate any struct, slice or map type. All validations -// are also performed recursively for nested types. -func (v *validator) validateAny(value reflect.Value, path string) { - value = reflect.Indirect(value) - if !value.IsValid() { + if !r.ParamsFilled() { return } - switch value.Kind() { - case reflect.Struct: - v.validateStruct(value, path) - case reflect.Slice: - if value.Type() == byteSliceType { - // We don't need to validate the contents of []byte. - return - } - for i := 0; i < value.Len(); i++ { - v.validateAny(value.Index(i), path+fmt.Sprintf("[%d]", i)) - } - case reflect.Map: - for _, n := range value.MapKeys() { - v.validateAny(value.MapIndex(n), path+fmt.Sprintf("[%q]", n.String())) + if v, ok := r.Params.(request.Validator); ok { + if err := v.Validate(); err != nil { + r.Error = err } } -} - -// 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) - - err := validateField(f, fvalue, validateFieldRequired, validateFieldMin) - if err != nil { - v.errors = append(v.errors, fmt.Sprintf("%s: %s", err.Error(), path+prefix+f.Name)) - continue - } - - v.validateAny(fvalue, path+prefix+f.Name) - } -} - -type validatorFunc func(f reflect.StructField, fvalue reflect.Value) error - -func validateField(f reflect.StructField, fvalue reflect.Value, funcs ...validatorFunc) error { - for _, fn := range funcs { - if err := fn(f, fvalue); err != nil { - return err - } - } - return nil -} - -// Validates that a field has a valid value provided for required fields. -func validateFieldRequired(f reflect.StructField, fvalue reflect.Value) error { - if f.Tag.Get("required") == "" { - return nil - } - - switch fvalue.Kind() { - case reflect.Ptr, reflect.Slice, reflect.Map: - if fvalue.IsNil() { - return fmt.Errorf("missing required parameter") - } - default: - if !fvalue.IsValid() { - return fmt.Errorf("missing required parameter") - } - } - return nil -} - -// Validates that if a value is provided for a field, that value must be at -// least a minimum length. -func validateFieldMin(f reflect.StructField, fvalue reflect.Value) error { - minStr := f.Tag.Get("min") - if minStr == "" { - return nil - } - min, _ := strconv.ParseInt(minStr, 10, 64) - - kind := fvalue.Kind() - if kind == reflect.Ptr { - if fvalue.IsNil() { - return nil - } - fvalue = fvalue.Elem() - } - - switch fvalue.Kind() { - case reflect.String: - if int64(fvalue.Len()) < min { - return fmt.Errorf("field too short, minimum length %d", min) - } - case reflect.Slice, reflect.Map: - if fvalue.IsNil() { - return nil - } - if int64(fvalue.Len()) < min { - return fmt.Errorf("field too short, minimum length %d", min) - } - - // TODO min can also apply to number minimum value. - - } - return nil -} +}} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/credentials/endpointcreds/provider.go b/vendor/github.com/aws/aws-sdk-go/aws/credentials/endpointcreds/provider.go new file mode 100644 index 000000000..a4cec5c55 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/aws/credentials/endpointcreds/provider.go @@ -0,0 +1,191 @@ +// Package endpointcreds provides support for retrieving credentials from an +// arbitrary HTTP endpoint. +// +// The credentials endpoint Provider can receive both static and refreshable +// credentials that will expire. Credentials are static when an "Expiration" +// value is not provided in the endpoint's response. +// +// Static credentials will never expire once they have been retrieved. The format +// of the static credentials response: +// { +// "AccessKeyId" : "MUA...", +// "SecretAccessKey" : "/7PC5om....", +// } +// +// Refreshable credentials will expire within the "ExpiryWindow" of the Expiration +// value in the response. The format of the refreshable credentials response: +// { +// "AccessKeyId" : "MUA...", +// "SecretAccessKey" : "/7PC5om....", +// "Token" : "AQoDY....=", +// "Expiration" : "2016-02-25T06:03:31Z" +// } +// +// Errors should be returned in the following format and only returned with 400 +// or 500 HTTP status codes. +// { +// "code": "ErrorCode", +// "message": "Helpful error message." +// } +package endpointcreds + +import ( + "encoding/json" + "time" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/awserr" + "github.com/aws/aws-sdk-go/aws/client" + "github.com/aws/aws-sdk-go/aws/client/metadata" + "github.com/aws/aws-sdk-go/aws/credentials" + "github.com/aws/aws-sdk-go/aws/request" +) + +// ProviderName is the name of the credentials provider. +const ProviderName = `CredentialsEndpointProvider` + +// Provider satisfies the credentials.Provider interface, and is a client to +// retrieve credentials from an arbitrary endpoint. +type Provider struct { + staticCreds bool + credentials.Expiry + + // Requires a AWS Client to make HTTP requests to the endpoint with. + // the Endpoint the request will be made to is provided by the aws.Config's + // Endpoint value. + Client *client.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 +} + +// NewProviderClient returns a credentials Provider for retrieving AWS credentials +// from arbitrary endpoint. +func NewProviderClient(cfg aws.Config, handlers request.Handlers, endpoint string, options ...func(*Provider)) credentials.Provider { + p := &Provider{ + Client: client.New( + cfg, + metadata.ClientInfo{ + ServiceName: "CredentialsEndpoint", + Endpoint: endpoint, + }, + handlers, + ), + } + + p.Client.Handlers.Unmarshal.PushBack(unmarshalHandler) + p.Client.Handlers.UnmarshalError.PushBack(unmarshalError) + p.Client.Handlers.Validate.Clear() + p.Client.Handlers.Validate.PushBack(validateEndpointHandler) + + for _, option := range options { + option(p) + } + + return p +} + +// NewCredentialsClient returns a Credentials wrapper for retrieving credentials +// from an arbitrary endpoint concurrently. The client will request the +func NewCredentialsClient(cfg aws.Config, handlers request.Handlers, endpoint string, options ...func(*Provider)) *credentials.Credentials { + return credentials.NewCredentials(NewProviderClient(cfg, handlers, endpoint, options...)) +} + +// IsExpired returns true if the credentials retrieved are expired, or not yet +// retrieved. +func (p *Provider) IsExpired() bool { + if p.staticCreds { + return false + } + return p.Expiry.IsExpired() +} + +// Retrieve will attempt to request the credentials from the endpoint the Provider +// was configured for. And error will be returned if the retrieval fails. +func (p *Provider) Retrieve() (credentials.Value, error) { + resp, err := p.getCredentials() + if err != nil { + return credentials.Value{ProviderName: ProviderName}, + awserr.New("CredentialsEndpointError", "failed to load credentials", err) + } + + if resp.Expiration != nil { + p.SetExpiration(*resp.Expiration, p.ExpiryWindow) + } else { + p.staticCreds = true + } + + return credentials.Value{ + AccessKeyID: resp.AccessKeyID, + SecretAccessKey: resp.SecretAccessKey, + SessionToken: resp.Token, + ProviderName: ProviderName, + }, nil +} + +type getCredentialsOutput struct { + Expiration *time.Time + AccessKeyID string + SecretAccessKey string + Token string +} + +type errorOutput struct { + Code string `json:"code"` + Message string `json:"message"` +} + +func (p *Provider) getCredentials() (*getCredentialsOutput, error) { + op := &request.Operation{ + Name: "GetCredentials", + HTTPMethod: "GET", + } + + out := &getCredentialsOutput{} + req := p.Client.NewRequest(op, nil, out) + req.HTTPRequest.Header.Set("Accept", "application/json") + + return out, req.Send() +} + +func validateEndpointHandler(r *request.Request) { + if len(r.ClientInfo.Endpoint) == 0 { + r.Error = aws.ErrMissingEndpoint + } +} + +func unmarshalHandler(r *request.Request) { + defer r.HTTPResponse.Body.Close() + + out := r.Data.(*getCredentialsOutput) + if err := json.NewDecoder(r.HTTPResponse.Body).Decode(&out); err != nil { + r.Error = awserr.New("SerializationError", + "failed to decode endpoint credentials", + err, + ) + } +} + +func unmarshalError(r *request.Request) { + defer r.HTTPResponse.Body.Close() + + var errOut errorOutput + if err := json.NewDecoder(r.HTTPResponse.Body).Decode(&errOut); err != nil { + r.Error = awserr.New("SerializationError", + "failed to decode endpoint credentials", + err, + ) + } + + // Response body format is not consistent between metadata endpoints. + // Grab the error message as a string and include that as the source error + r.Error = awserr.New(errOut.Code, errOut.Message, nil) +} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/credentials/static_provider.go b/vendor/github.com/aws/aws-sdk-go/aws/credentials/static_provider.go index 71189e733..4f5dab3fc 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/credentials/static_provider.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/credentials/static_provider.go @@ -14,7 +14,7 @@ var ( ErrStaticCredentialsEmpty = awserr.New("EmptyStaticCreds", "static credentials are empty", nil) ) -// A StaticProvider is a set of credentials which are set pragmatically, +// A StaticProvider is a set of credentials which are set programmatically, // and will never expire. type StaticProvider struct { Value @@ -30,13 +30,22 @@ func NewStaticCredentials(id, secret, token string) *Credentials { }}) } +// NewStaticCredentialsFromCreds returns a pointer to a new Credentials object +// wrapping the static credentials value provide. Same as NewStaticCredentials +// but takes the creds Value instead of individual fields +func NewStaticCredentialsFromCreds(creds Value) *Credentials { + return NewCredentials(&StaticProvider{Value: creds}) +} + // Retrieve returns the credentials or error if the credentials are invalid. func (s *StaticProvider) Retrieve() (Value, error) { if s.AccessKeyID == "" || s.SecretAccessKey == "" { return Value{ProviderName: StaticProviderName}, ErrStaticCredentialsEmpty } - s.Value.ProviderName = StaticProviderName + if len(s.Value.ProviderName) == 0 { + s.Value.ProviderName = StaticProviderName + } return s.Value, nil } diff --git a/vendor/github.com/aws/aws-sdk-go/aws/credentials/stscreds/assume_role_provider.go b/vendor/github.com/aws/aws-sdk-go/aws/credentials/stscreds/assume_role_provider.go new file mode 100644 index 000000000..30c847ae2 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/aws/credentials/stscreds/assume_role_provider.go @@ -0,0 +1,161 @@ +// Package stscreds are credential Providers to retrieve STS AWS credentials. +// +// STS provides multiple ways to retrieve credentials which can be used when making +// future AWS service API operation calls. +package stscreds + +import ( + "fmt" + "time" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/client" + "github.com/aws/aws-sdk-go/aws/credentials" + "github.com/aws/aws-sdk-go/service/sts" +) + +// ProviderName provides a name of AssumeRole provider +const ProviderName = "AssumeRoleProvider" + +// AssumeRoler represents the minimal subset of the STS client API used by this provider. +type AssumeRoler interface { + AssumeRole(input *sts.AssumeRoleInput) (*sts.AssumeRoleOutput, error) +} + +// DefaultDuration is the default amount of time in minutes that the credentials +// will be valid for. +var DefaultDuration = time.Duration(15) * time.Minute + +// AssumeRoleProvider retrieves temporary credentials from the STS service, and +// keeps track of their expiration time. This provider must be used explicitly, +// as it is not included in the credentials chain. +type AssumeRoleProvider struct { + credentials.Expiry + + // STS client to make assume role request with. + Client AssumeRoler + + // Role to be assumed. + RoleARN string + + // Session name, if you wish to reuse the credentials elsewhere. + RoleSessionName string + + // Expiry duration of the STS credentials. Defaults to 15 minutes if not set. + Duration time.Duration + + // Optional ExternalID to pass along, defaults to nil if not set. + ExternalID *string + + // The policy plain text must be 2048 bytes or shorter. However, an internal + // conversion compresses it into a packed binary format with a separate limit. + // The PackedPolicySize response element indicates by percentage how close to + // the upper size limit the policy is, with 100% equaling the maximum allowed + // size. + Policy *string + + // The identification number of the MFA device that is associated with the user + // who is making the AssumeRole call. Specify this value if the trust policy + // of the role being assumed includes a condition that requires MFA authentication. + // The value is either the serial number for a hardware device (such as GAHT12345678) + // or an Amazon Resource Name (ARN) for a virtual device (such as arn:aws:iam::123456789012:mfa/user). + SerialNumber *string + + // The value provided by the MFA device, if the trust policy of the role being + // assumed requires MFA (that is, if the policy includes a condition that tests + // for MFA). If the role being assumed requires MFA and if the TokenCode value + // is missing or expired, the AssumeRole call returns an "access denied" error. + TokenCode *string + + // 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 +} + +// NewCredentials returns a pointer to a new Credentials object wrapping the +// AssumeRoleProvider. The credentials will expire every 15 minutes and the +// role will be named after a nanosecond timestamp of this operation. +// +// Takes a Config provider to create the STS client. The ConfigProvider is +// satisfied by the session.Session type. +func NewCredentials(c client.ConfigProvider, roleARN string, options ...func(*AssumeRoleProvider)) *credentials.Credentials { + p := &AssumeRoleProvider{ + Client: sts.New(c), + RoleARN: roleARN, + Duration: DefaultDuration, + } + + for _, option := range options { + option(p) + } + + return credentials.NewCredentials(p) +} + +// NewCredentialsWithClient returns a pointer to a new Credentials object wrapping the +// AssumeRoleProvider. The credentials will expire every 15 minutes and the +// role will be named after a nanosecond timestamp of this operation. +// +// Takes an AssumeRoler which can be satisfiede by the STS client. +func NewCredentialsWithClient(svc AssumeRoler, roleARN string, options ...func(*AssumeRoleProvider)) *credentials.Credentials { + p := &AssumeRoleProvider{ + Client: svc, + RoleARN: roleARN, + Duration: DefaultDuration, + } + + for _, option := range options { + option(p) + } + + return credentials.NewCredentials(p) +} + +// Retrieve generates a new set of temporary credentials using STS. +func (p *AssumeRoleProvider) Retrieve() (credentials.Value, error) { + + // Apply defaults where parameters are not set. + if p.RoleSessionName == "" { + // Try to work out a role name that will hopefully end up unique. + p.RoleSessionName = fmt.Sprintf("%d", time.Now().UTC().UnixNano()) + } + if p.Duration == 0 { + // Expire as often as AWS permits. + p.Duration = DefaultDuration + } + input := &sts.AssumeRoleInput{ + DurationSeconds: aws.Int64(int64(p.Duration / time.Second)), + RoleArn: aws.String(p.RoleARN), + RoleSessionName: aws.String(p.RoleSessionName), + ExternalId: p.ExternalID, + } + if p.Policy != nil { + input.Policy = p.Policy + } + if p.SerialNumber != nil && p.TokenCode != nil { + input.SerialNumber = p.SerialNumber + input.TokenCode = p.TokenCode + } + roleOutput, err := p.Client.AssumeRole(input) + + if err != nil { + return credentials.Value{ProviderName: ProviderName}, err + } + + // We will proactively generate new credentials before they expire. + p.SetExpiration(*roleOutput.Credentials.Expiration, p.ExpiryWindow) + + return credentials.Value{ + AccessKeyID: *roleOutput.Credentials.AccessKeyId, + SecretAccessKey: *roleOutput.Credentials.SecretAccessKey, + SessionToken: *roleOutput.Credentials.SessionToken, + ProviderName: ProviderName, + }, nil +} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/defaults/defaults.go b/vendor/github.com/aws/aws-sdk-go/aws/defaults/defaults.go index 42c883aa9..10b7d8649 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/defaults/defaults.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/defaults/defaults.go @@ -8,6 +8,7 @@ package defaults import ( + "fmt" "net/http" "os" "time" @@ -16,6 +17,7 @@ import ( "github.com/aws/aws-sdk-go/aws/corehandlers" "github.com/aws/aws-sdk-go/aws/credentials" "github.com/aws/aws-sdk-go/aws/credentials/ec2rolecreds" + "github.com/aws/aws-sdk-go/aws/credentials/endpointcreds" "github.com/aws/aws-sdk-go/aws/ec2metadata" "github.com/aws/aws-sdk-go/aws/request" "github.com/aws/aws-sdk-go/private/endpoints" @@ -66,7 +68,9 @@ func Handlers() request.Handlers { var handlers request.Handlers handlers.Validate.PushBackNamed(corehandlers.ValidateEndpointHandler) + handlers.Validate.AfterEachFn = request.HandlerListStopOnError handlers.Build.PushBackNamed(corehandlers.SDKVersionUserAgentHandler) + handlers.Build.AfterEachFn = request.HandlerListStopOnError handlers.Sign.PushBackNamed(corehandlers.BuildContentLengthHandler) handlers.Send.PushBackNamed(corehandlers.SendHandler) handlers.AfterRetry.PushBackNamed(corehandlers.AfterRetryHandler) @@ -81,16 +85,45 @@ func Handlers() request.Handlers { // is available if you need to reset the credentials of an // existing service client or session's Config. func CredChain(cfg *aws.Config, handlers request.Handlers) *credentials.Credentials { - endpoint, signingRegion := endpoints.EndpointForRegion(ec2metadata.ServiceName, *cfg.Region, true) - return credentials.NewCredentials(&credentials.ChainProvider{ VerboseErrors: aws.BoolValue(cfg.CredentialsChainVerboseErrors), Providers: []credentials.Provider{ &credentials.EnvProvider{}, &credentials.SharedCredentialsProvider{Filename: "", Profile: ""}, - &ec2rolecreds.EC2RoleProvider{ - Client: ec2metadata.NewClient(*cfg, handlers, endpoint, signingRegion), - ExpiryWindow: 5 * time.Minute, - }, - }}) + RemoteCredProvider(*cfg, handlers), + }, + }) +} + +// RemoteCredProvider returns a credenitials provider for the default remote +// endpoints such as EC2 or ECS Roles. +func RemoteCredProvider(cfg aws.Config, handlers request.Handlers) credentials.Provider { + ecsCredURI := os.Getenv("AWS_CONTAINER_CREDENTIALS_RELATIVE_URI") + + if len(ecsCredURI) > 0 { + return ecsCredProvider(cfg, handlers, ecsCredURI) + } + + return ec2RoleProvider(cfg, handlers) +} + +func ecsCredProvider(cfg aws.Config, handlers request.Handlers, uri string) credentials.Provider { + const host = `169.254.170.2` + + return endpointcreds.NewProviderClient(cfg, handlers, + fmt.Sprintf("http://%s%s", host, uri), + func(p *endpointcreds.Provider) { + p.ExpiryWindow = 5 * time.Minute + }, + ) +} + +func ec2RoleProvider(cfg aws.Config, handlers request.Handlers) credentials.Provider { + endpoint, signingRegion := endpoints.EndpointForRegion(ec2metadata.ServiceName, + aws.StringValue(cfg.Region), true, false) + + return &ec2rolecreds.EC2RoleProvider{ + Client: ec2metadata.NewClient(cfg, handlers, endpoint, signingRegion), + ExpiryWindow: 5 * time.Minute, + } } diff --git a/vendor/github.com/aws/aws-sdk-go/aws/ec2metadata/api.go b/vendor/github.com/aws/aws-sdk-go/aws/ec2metadata/api.go index e5137ca17..669c813a0 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/ec2metadata/api.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/ec2metadata/api.go @@ -1,12 +1,19 @@ package ec2metadata import ( + "encoding/json" + "fmt" "path" + "strings" + "time" + "github.com/aws/aws-sdk-go/aws/awserr" "github.com/aws/aws-sdk-go/aws/request" ) -// GetMetadata uses the path provided to request +// GetMetadata uses the path provided to request information from the EC2 +// instance metdata service. The content will be returned as a string, or +// error if the request failed. func (c *EC2Metadata) GetMetadata(p string) (string, error) { op := &request.Operation{ Name: "GetMetadata", @@ -20,6 +27,68 @@ func (c *EC2Metadata) GetMetadata(p string) (string, error) { return output.Content, req.Send() } +// GetDynamicData uses the path provided to request information from the EC2 +// instance metadata service for dynamic data. The content will be returned +// as a string, or error if the request failed. +func (c *EC2Metadata) GetDynamicData(p string) (string, error) { + op := &request.Operation{ + Name: "GetDynamicData", + HTTPMethod: "GET", + HTTPPath: path.Join("/", "dynamic", p), + } + + output := &metadataOutput{} + req := c.NewRequest(op, nil, output) + + return output.Content, req.Send() +} + +// GetInstanceIdentityDocument retrieves an identity document describing an +// instance. Error is returned if the request fails or is unable to parse +// the response. +func (c *EC2Metadata) GetInstanceIdentityDocument() (EC2InstanceIdentityDocument, error) { + resp, err := c.GetDynamicData("instance-identity/document") + if err != nil { + return EC2InstanceIdentityDocument{}, + awserr.New("EC2MetadataRequestError", + "failed to get EC2 instance identity document", err) + } + + doc := EC2InstanceIdentityDocument{} + if err := json.NewDecoder(strings.NewReader(resp)).Decode(&doc); err != nil { + return EC2InstanceIdentityDocument{}, + awserr.New("SerializationError", + "failed to decode EC2 instance identity document", err) + } + + return doc, nil +} + +// IAMInfo retrieves IAM info from the metadata API +func (c *EC2Metadata) IAMInfo() (EC2IAMInfo, error) { + resp, err := c.GetMetadata("iam/info") + if err != nil { + return EC2IAMInfo{}, + awserr.New("EC2MetadataRequestError", + "failed to get EC2 IAM info", err) + } + + info := EC2IAMInfo{} + if err := json.NewDecoder(strings.NewReader(resp)).Decode(&info); err != nil { + return EC2IAMInfo{}, + awserr.New("SerializationError", + "failed to decode EC2 IAM info", err) + } + + if info.Code != "Success" { + errMsg := fmt.Sprintf("failed to get EC2 IAM Info (%s)", info.Code) + return EC2IAMInfo{}, + awserr.New("EC2MetadataError", errMsg, nil) + } + + return info, nil +} + // Region returns the region the instance is running in. func (c *EC2Metadata) Region() (string, error) { resp, err := c.GetMetadata("placement/availability-zone") @@ -41,3 +110,31 @@ func (c *EC2Metadata) Available() bool { return true } + +// An EC2IAMInfo provides the shape for unmarshalling +// an IAM info from the metadata API +type EC2IAMInfo struct { + Code string + LastUpdated time.Time + InstanceProfileArn string + InstanceProfileID string +} + +// An EC2InstanceIdentityDocument provides the shape for unmarshalling +// an instance identity document +type EC2InstanceIdentityDocument struct { + DevpayProductCodes []string `json:"devpayProductCodes"` + AvailabilityZone string `json:"availabilityZone"` + PrivateIP string `json:"privateIp"` + Version string `json:"version"` + Region string `json:"region"` + InstanceID string `json:"instanceId"` + BillingProducts []string `json:"billingProducts"` + InstanceType string `json:"instanceType"` + AccountID string `json:"accountId"` + PendingTime time.Time `json:"pendingTime"` + ImageID string `json:"imageId"` + KernelID string `json:"kernelId"` + RamdiskID string `json:"ramdiskId"` + Architecture string `json:"architecture"` +} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/logger.go b/vendor/github.com/aws/aws-sdk-go/aws/logger.go index f53694873..db87188e2 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/logger.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/logger.go @@ -79,6 +79,20 @@ type Logger interface { Log(...interface{}) } +// A LoggerFunc is a convenience type to convert a function taking a variadic +// list of arguments and wrap it so the Logger interface can be used. +// +// Example: +// s3.New(sess, &aws.Config{Logger: aws.LoggerFunc(func(args ...interface{}) { +// fmt.Fprintln(os.Stdout, args...) +// })}) +type LoggerFunc func(...interface{}) + +// Log calls the wrapped function with the arguments provided +func (f LoggerFunc) Log(args ...interface{}) { + f(args...) +} + // NewDefaultLogger returns a Logger which will write log messages to stdout, and // use same formatting runes as the stdlib log.Logger func NewDefaultLogger() Logger { diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/handlers.go b/vendor/github.com/aws/aws-sdk-go/aws/request/handlers.go index 3e90a7976..5279c19c0 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/request/handlers.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/request/handlers.go @@ -50,9 +50,28 @@ func (h *Handlers) Clear() { h.AfterRetry.Clear() } +// A HandlerListRunItem represents an entry in the HandlerList which +// is being run. +type HandlerListRunItem struct { + Index int + Handler NamedHandler + Request *Request +} + // A HandlerList manages zero or more handlers in a list. type HandlerList struct { list []NamedHandler + + // Called after each request handler in the list is called. If set + // and the func returns true the HandlerList will continue to iterate + // over the request handlers. If false is returned the HandlerList + // will stop iterating. + // + // Should be used if extra logic to be performed between each handler + // in the list. This can be used to terminate a list's iteration + // based on a condition such as error like, HandlerListStopOnError. + // Or for logging like HandlerListLogItem. + AfterEachFn func(item HandlerListRunItem) bool } // A NamedHandler is a struct that contains a name and function callback. @@ -63,7 +82,9 @@ type NamedHandler struct { // copy creates a copy of the handler list. func (l *HandlerList) copy() HandlerList { - var n HandlerList + n := HandlerList{ + AfterEachFn: l.AfterEachFn, + } n.list = append([]NamedHandler{}, l.list...) return n } @@ -111,11 +132,37 @@ func (l *HandlerList) Remove(n NamedHandler) { // Run executes all handlers in the list with a given request object. func (l *HandlerList) Run(r *Request) { - for _, f := range l.list { - f.Fn(r) + for i, h := range l.list { + h.Fn(r) + item := HandlerListRunItem{ + Index: i, Handler: h, Request: r, + } + if l.AfterEachFn != nil && !l.AfterEachFn(item) { + return + } } } +// HandlerListLogItem logs the request handler and the state of the +// request's Error value. Always returns true to continue iterating +// request handlers in a HandlerList. +func HandlerListLogItem(item HandlerListRunItem) bool { + if item.Request.Config.Logger == nil { + return true + } + item.Request.Config.Logger.Log("DEBUG: RequestHandler", + item.Index, item.Handler.Name, item.Request.Error) + + return true +} + +// HandlerListStopOnError returns false to stop the HandlerList iterating +// over request handlers if Request.Error is not nil. True otherwise +// to continue iterating. +func HandlerListStopOnError(item HandlerListRunItem) bool { + return item.Request.Error == nil +} + // MakeAddToUserAgentHandler will add the name/version pair to the User-Agent request // header. If the extra parameters are provided they will be added as metadata to the // name/version pair resulting in the following format. diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/http_request.go b/vendor/github.com/aws/aws-sdk-go/aws/request/http_request.go new file mode 100644 index 000000000..a4087f20e --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/aws/request/http_request.go @@ -0,0 +1,33 @@ +// +build go1.5 + +package request + +import ( + "io" + "net/http" + "net/url" +) + +func copyHTTPRequest(r *http.Request, body io.ReadCloser) *http.Request { + req := &http.Request{ + URL: &url.URL{}, + Header: http.Header{}, + Close: r.Close, + Body: body, + Host: r.Host, + Method: r.Method, + Proto: r.Proto, + ContentLength: r.ContentLength, + // Cancel will be deprecated in 1.7 and will be replaced with Context + Cancel: r.Cancel, + } + + *req.URL = *r.URL + for k, v := range r.Header { + for _, vv := range v { + req.Header.Add(k, vv) + } + } + + return req +} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/http_request_1_4.go b/vendor/github.com/aws/aws-sdk-go/aws/request/http_request_1_4.go new file mode 100644 index 000000000..75da021ef --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/aws/request/http_request_1_4.go @@ -0,0 +1,31 @@ +// +build !go1.5 + +package request + +import ( + "io" + "net/http" + "net/url" +) + +func copyHTTPRequest(r *http.Request, body io.ReadCloser) *http.Request { + req := &http.Request{ + URL: &url.URL{}, + Header: http.Header{}, + Close: r.Close, + Body: body, + Host: r.Host, + Method: r.Method, + Proto: r.Proto, + ContentLength: r.ContentLength, + } + + *req.URL = *r.URL + for k, v := range r.Header { + for _, vv := range v { + req.Header.Add(k, vv) + } + } + + return req +} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/offset_reader.go b/vendor/github.com/aws/aws-sdk-go/aws/request/offset_reader.go new file mode 100644 index 000000000..da6396d2d --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/aws/request/offset_reader.go @@ -0,0 +1,49 @@ +package request + +import ( + "io" + "sync" +) + +// offsetReader is a thread-safe io.ReadCloser to prevent racing +// with retrying requests +type offsetReader struct { + buf io.ReadSeeker + lock sync.RWMutex + closed bool +} + +func newOffsetReader(buf io.ReadSeeker, offset int64) *offsetReader { + reader := &offsetReader{} + buf.Seek(offset, 0) + + reader.buf = buf + return reader +} + +// Close is a thread-safe close. Uses the write lock. +func (o *offsetReader) Close() error { + o.lock.Lock() + defer o.lock.Unlock() + o.closed = true + return nil +} + +// Read is a thread-safe read using a read lock. +func (o *offsetReader) Read(p []byte) (int, error) { + o.lock.RLock() + defer o.lock.RUnlock() + + if o.closed { + return 0, io.EOF + } + + return o.buf.Read(p) +} + +// CloseAndCopy will return a new offsetReader with a copy of the old buffer +// and close the old buffer. +func (o *offsetReader) CloseAndCopy(offset int64) *offsetReader { + o.Close() + return newOffsetReader(o.buf, offset) +} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/request.go b/vendor/github.com/aws/aws-sdk-go/aws/request/request.go index 61bb4a8ca..2832aaa43 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/request/request.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/request/request.go @@ -12,6 +12,7 @@ import ( "time" "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/awserr" "github.com/aws/aws-sdk-go/aws/client/metadata" ) @@ -38,6 +39,7 @@ type Request struct { RetryDelay time.Duration NotHoist bool SignedHeaderVals http.Header + LastSignedAt time.Time built bool } @@ -71,13 +73,15 @@ func New(cfg aws.Config, clientInfo metadata.ClientInfo, handlers Handlers, if method == "" { method = "POST" } - p := operation.HTTPPath - if p == "" { - p = "/" - } httpReq, _ := http.NewRequest(method, "", nil) - httpReq.URL, _ = url.Parse(clientInfo.Endpoint + p) + + var err error + httpReq.URL, err = url.Parse(clientInfo.Endpoint + operation.HTTPPath) + if err != nil { + httpReq.URL = &url.URL{} + err = awserr.New("InvalidEndpointURL", "invalid endpoint uri", err) + } r := &Request{ Config: cfg, @@ -91,7 +95,7 @@ func New(cfg aws.Config, clientInfo metadata.ClientInfo, handlers Handlers, HTTPRequest: httpReq, Body: nil, Params: params, - Error: nil, + Error: err, Data: data, } r.SetBufferBody([]byte{}) @@ -131,7 +135,7 @@ func (r *Request) SetStringBody(s string) { // SetReaderBody will set the request's body reader. func (r *Request) SetReaderBody(reader io.ReadSeeker) { - r.HTTPRequest.Body = ioutil.NopCloser(reader) + r.HTTPRequest.Body = newOffsetReader(reader, 0) r.Body = reader } @@ -185,20 +189,23 @@ func debugLogReqError(r *Request, stage string, retrying bool, err 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 { debugLogReqError(r, "Validate Request", false, r.Error) return r.Error } r.Handlers.Build.Run(r) + if r.Error != nil { + debugLogReqError(r, "Build Request", false, r.Error) + return r.Error + } r.built = true } return r.Error } -// Sign will sign the request retuning error if errors are encountered. +// Sign will sign the request returning 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. @@ -217,28 +224,53 @@ func (r *Request) Sign() error { // // Send will sign the request prior to sending. All Send Handlers will // be executed in the order they were set. +// +// Canceling a request is non-deterministic. If a request has been canceled, +// then the transport will choose, randomly, one of the state channels during +// reads or getting the connection. +// +// readLoop() and getConn(req *Request, cm connectMethod) +// https://github.com/golang/go/blob/master/src/net/http/transport.go func (r *Request) Send() error { for { - r.Sign() - if r.Error != nil { - return r.Error - } - if aws.BoolValue(r.Retryable) { if r.Config.LogLevel.Matches(aws.LogDebugWithRequestRetries) { r.Config.Logger.Log(fmt.Sprintf("DEBUG: Retrying Request %s/%s, attempt %d", r.ClientInfo.ServiceName, r.Operation.Name, r.RetryCount)) } - // Re-seek the body back to the original point in for a retry so that - // send will send the body's contents again in the upcoming request. - r.Body.Seek(r.BodyStart, 0) - r.HTTPRequest.Body = ioutil.NopCloser(r.Body) + var body io.ReadCloser + if reader, ok := r.HTTPRequest.Body.(*offsetReader); ok { + body = reader.CloseAndCopy(r.BodyStart) + } else { + if r.Config.Logger != nil { + r.Config.Logger.Log("Request body type has been overwritten. May cause race conditions") + } + r.Body.Seek(r.BodyStart, 0) + body = ioutil.NopCloser(r.Body) + } + + r.HTTPRequest = copyHTTPRequest(r.HTTPRequest, body) + if r.HTTPResponse != nil && r.HTTPResponse.Body != nil { + // Closing response body. Since we are setting a new request to send off, this + // response will get squashed and leaked. + r.HTTPResponse.Body.Close() + } } + + r.Sign() + if r.Error != nil { + return r.Error + } + r.Retryable = nil r.Handlers.Send.Run(r) if r.Error != nil { + if strings.Contains(r.Error.Error(), "net/http: request canceled") { + return r.Error + } + err := r.Error r.Handlers.Retry.Run(r) r.Handlers.AfterRetry.Run(r) diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/retryer.go b/vendor/github.com/aws/aws-sdk-go/aws/request/retryer.go index ab6fff5ac..8cc8b015a 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/request/retryer.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/request/retryer.go @@ -26,8 +26,11 @@ func WithRetryer(cfg *aws.Config, retryer Retryer) *aws.Config { // retryableCodes is a collection of service response codes which are retry-able // without any further action. var retryableCodes = map[string]struct{}{ - "RequestError": {}, - "RequestTimeout": {}, + "RequestError": {}, + "RequestTimeout": {}, +} + +var throttleCodes = map[string]struct{}{ "ProvisionedThroughputExceededException": {}, "Throttling": {}, "ThrottlingException": {}, @@ -46,6 +49,11 @@ var credsExpiredCodes = map[string]struct{}{ "RequestExpired": {}, // EC2 Only } +func isCodeThrottle(code string) bool { + _, ok := throttleCodes[code] + return ok +} + func isCodeRetryable(code string) bool { if _, ok := retryableCodes[code]; ok { return true @@ -70,6 +78,17 @@ func (r *Request) IsErrorRetryable() bool { return false } +// IsErrorThrottle returns whether the error is to be throttled based on its code. +// Returns false if the request has no Error set +func (r *Request) IsErrorThrottle() bool { + if r.Error != nil { + if err, ok := r.Error.(awserr.Error); ok { + return isCodeThrottle(err.Code()) + } + } + return false +} + // IsErrorExpired returns whether the error code is a credential expiry error. // Returns false if the request has no Error set. func (r *Request) IsErrorExpired() bool { diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/validation.go b/vendor/github.com/aws/aws-sdk-go/aws/request/validation.go new file mode 100644 index 000000000..2520286b7 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/aws/request/validation.go @@ -0,0 +1,234 @@ +package request + +import ( + "bytes" + "fmt" + + "github.com/aws/aws-sdk-go/aws/awserr" +) + +const ( + // InvalidParameterErrCode is the error code for invalid parameters errors + InvalidParameterErrCode = "InvalidParameter" + // ParamRequiredErrCode is the error code for required parameter errors + ParamRequiredErrCode = "ParamRequiredError" + // ParamMinValueErrCode is the error code for fields with too low of a + // number value. + ParamMinValueErrCode = "ParamMinValueError" + // ParamMinLenErrCode is the error code for fields without enough elements. + ParamMinLenErrCode = "ParamMinLenError" +) + +// Validator provides a way for types to perform validation logic on their +// input values that external code can use to determine if a type's values +// are valid. +type Validator interface { + Validate() error +} + +// An ErrInvalidParams provides wrapping of invalid parameter errors found when +// validating API operation input parameters. +type ErrInvalidParams struct { + // Context is the base context of the invalid parameter group. + Context string + errs []ErrInvalidParam +} + +// Add adds a new invalid parameter error to the collection of invalid +// parameters. The context of the invalid parameter will be updated to reflect +// this collection. +func (e *ErrInvalidParams) Add(err ErrInvalidParam) { + err.SetContext(e.Context) + e.errs = append(e.errs, err) +} + +// AddNested adds the invalid parameter errors from another ErrInvalidParams +// value into this collection. The nested errors will have their nested context +// updated and base context to reflect the merging. +// +// Use for nested validations errors. +func (e *ErrInvalidParams) AddNested(nestedCtx string, nested ErrInvalidParams) { + for _, err := range nested.errs { + err.SetContext(e.Context) + err.AddNestedContext(nestedCtx) + e.errs = append(e.errs, err) + } +} + +// Len returns the number of invalid parameter errors +func (e ErrInvalidParams) Len() int { + return len(e.errs) +} + +// Code returns the code of the error +func (e ErrInvalidParams) Code() string { + return InvalidParameterErrCode +} + +// Message returns the message of the error +func (e ErrInvalidParams) Message() string { + return fmt.Sprintf("%d validation error(s) found.", len(e.errs)) +} + +// Error returns the string formatted form of the invalid parameters. +func (e ErrInvalidParams) Error() string { + w := &bytes.Buffer{} + fmt.Fprintf(w, "%s: %s\n", e.Code(), e.Message()) + + for _, err := range e.errs { + fmt.Fprintf(w, "- %s\n", err.Message()) + } + + return w.String() +} + +// OrigErr returns the invalid parameters as a awserr.BatchedErrors value +func (e ErrInvalidParams) OrigErr() error { + return awserr.NewBatchError( + InvalidParameterErrCode, e.Message(), e.OrigErrs()) +} + +// OrigErrs returns a slice of the invalid parameters +func (e ErrInvalidParams) OrigErrs() []error { + errs := make([]error, len(e.errs)) + for i := 0; i < len(errs); i++ { + errs[i] = e.errs[i] + } + + return errs +} + +// An ErrInvalidParam represents an invalid parameter error type. +type ErrInvalidParam interface { + awserr.Error + + // Field name the error occurred on. + Field() string + + // SetContext updates the context of the error. + SetContext(string) + + // AddNestedContext updates the error's context to include a nested level. + AddNestedContext(string) +} + +type errInvalidParam struct { + context string + nestedContext string + field string + code string + msg string +} + +// Code returns the error code for the type of invalid parameter. +func (e *errInvalidParam) Code() string { + return e.code +} + +// Message returns the reason the parameter was invalid, and its context. +func (e *errInvalidParam) Message() string { + return fmt.Sprintf("%s, %s.", e.msg, e.Field()) +} + +// Error returns the string version of the invalid parameter error. +func (e *errInvalidParam) Error() string { + return fmt.Sprintf("%s: %s", e.code, e.Message()) +} + +// OrigErr returns nil, Implemented for awserr.Error interface. +func (e *errInvalidParam) OrigErr() error { + return nil +} + +// Field Returns the field and context the error occurred. +func (e *errInvalidParam) Field() string { + field := e.context + if len(field) > 0 { + field += "." + } + if len(e.nestedContext) > 0 { + field += fmt.Sprintf("%s.", e.nestedContext) + } + field += e.field + + return field +} + +// SetContext updates the base context of the error. +func (e *errInvalidParam) SetContext(ctx string) { + e.context = ctx +} + +// AddNestedContext prepends a context to the field's path. +func (e *errInvalidParam) AddNestedContext(ctx string) { + if len(e.nestedContext) == 0 { + e.nestedContext = ctx + } else { + e.nestedContext = fmt.Sprintf("%s.%s", ctx, e.nestedContext) + } + +} + +// An ErrParamRequired represents an required parameter error. +type ErrParamRequired struct { + errInvalidParam +} + +// NewErrParamRequired creates a new required parameter error. +func NewErrParamRequired(field string) *ErrParamRequired { + return &ErrParamRequired{ + errInvalidParam{ + code: ParamRequiredErrCode, + field: field, + msg: fmt.Sprintf("missing required field"), + }, + } +} + +// An ErrParamMinValue represents a minimum value parameter error. +type ErrParamMinValue struct { + errInvalidParam + min float64 +} + +// NewErrParamMinValue creates a new minimum value parameter error. +func NewErrParamMinValue(field string, min float64) *ErrParamMinValue { + return &ErrParamMinValue{ + errInvalidParam: errInvalidParam{ + code: ParamMinValueErrCode, + field: field, + msg: fmt.Sprintf("minimum field value of %v", min), + }, + min: min, + } +} + +// MinValue returns the field's require minimum value. +// +// float64 is returned for both int and float min values. +func (e *ErrParamMinValue) MinValue() float64 { + return e.min +} + +// An ErrParamMinLen represents a minimum length parameter error. +type ErrParamMinLen struct { + errInvalidParam + min int +} + +// NewErrParamMinLen creates a new minimum length parameter error. +func NewErrParamMinLen(field string, min int) *ErrParamMinLen { + return &ErrParamMinLen{ + errInvalidParam: errInvalidParam{ + code: ParamMinValueErrCode, + field: field, + msg: fmt.Sprintf("minimum field size of %v", min), + }, + min: min, + } +} + +// MinLen returns the field's required minimum length. +func (e *ErrParamMinLen) MinLen() int { + return e.min +} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/session/doc.go b/vendor/github.com/aws/aws-sdk-go/aws/session/doc.go new file mode 100644 index 000000000..097d3237b --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/aws/session/doc.go @@ -0,0 +1,223 @@ +/* +Package session provides configuration for the SDK's service clients. + +Sessions can be shared across all service clients that share the same base +configuration. The Session is built from the SDK's default configuration and +request handlers. + +Sessions should be cached when possible, because creating a new Session will +load all configuration values from the environment, and config files each time +the Session is created. Sharing the Session value across all of your service +clients will ensure the configuration is loaded the fewest number of times possible. + +Concurrency + +Sessions are safe to use concurrently as long as the Session is not being +modified. The SDK will not modify the Session once the Session has been created. +Creating service clients concurrently from a shared Session is safe. + +Sessions from Shared Config + +Sessions can be created using the method above that will only load the +additional config if the AWS_SDK_LOAD_CONFIG environment variable is set. +Alternatively you can explicitly create a Session with shared config enabled. +To do this you can use NewSessionWithOptions to configure how the Session will +be created. Using the NewSessionWithOptions with SharedConfigState set to +SharedConfigEnabled will create the session as if the AWS_SDK_LOAD_CONFIG +environment variable was set. + +Creating Sessions + +When creating Sessions optional aws.Config values can be passed in that will +override the default, or loaded config values the Session is being created +with. This allows you to provide additional, or case based, configuration +as needed. + +By default NewSession will only load credentials from the shared credentials +file (~/.aws/credentials). If the AWS_SDK_LOAD_CONFIG environment variable is +set to a truthy value the Session will be created from the configuration +values from the shared config (~/.aws/config) and shared credentials +(~/.aws/credentials) files. See the section Sessions from Shared Config for +more information. + +Create a Session with the default config and request handlers. With credentials +region, and profile loaded from the environment and shared config automatically. +Requires the AWS_PROFILE to be set, or "default" is used. + + // Create Session + sess, err := session.NewSession() + + // Create a Session with a custom region + sess, err := session.NewSession(&aws.Config{Region: aws.String("us-east-1")}) + + // Create a S3 client instance from a session + sess, err := session.NewSession() + if err != nil { + // Handle Session creation error + } + svc := s3.New(sess) + +Create Session With Option Overrides + +In addition to NewSession, Sessions can be created using NewSessionWithOptions. +This func allows you to control and override how the Session will be created +through code instead of being driven by environment variables only. + +Use NewSessionWithOptions when you want to provide the config profile, or +override the shared config state (AWS_SDK_LOAD_CONFIG). + + // Equivalent to session.New + sess, err := session.NewSessionWithOptions(session.Options{}) + + // Specify profile to load for the session's config + sess, err := session.NewSessionWithOptions(session.Options{ + Profile: "profile_name", + }) + + // Specify profile for config and region for requests + sess, err := session.NewSessionWithOptions(session.Options{ + Config: aws.Config{Region: aws.String("us-east-1")}, + Profile: "profile_name", + }) + + // Force enable Shared Config support + sess, err := session.NewSessionWithOptions(session.Options{ + SharedConfigState: SharedConfigEnable, + }) + +Adding Handlers + +You can add handlers to a session for processing HTTP requests. All service +clients that use the session inherit the handlers. For example, the following +handler logs every request and its payload made by a service client: + + // Create a session, and add additional handlers for all service + // clients created with the Session to inherit. Adds logging handler. + sess, err := session.NewSession() + sess.Handlers.Send.PushFront(func(r *request.Request) { + // Log every request made and its payload + logger.Println("Request: %s/%s, Payload: %s", + r.ClientInfo.ServiceName, r.Operation, r.Params) + }) + +Deprecated "New" function + +The New session function has been deprecated because it does not provide good +way to return errors that occur when loading the configuration files and values. +Because of this, NewSession was created so errors can be retrieved when +creating a session fails. + +Shared Config Fields + +By default the SDK will only load the shared credentials file's (~/.aws/credentials) +credentials values, and all other config is provided by the environment variables, +SDK defaults, and user provided aws.Config values. + +If the AWS_SDK_LOAD_CONFIG environment variable is set, or SharedConfigEnable +option is used to create the Session the full shared config values will be +loaded. This includes credentials, region, and support for assume role. In +addition the Session will load its configuration from both the shared config +file (~/.aws/config) and shared credentials file (~/.aws/credentials). Both +files have the same format. + +If both config files are present the configuration from both files will be +read. The Session will be created from configuration values from the shared +credentials file (~/.aws/credentials) over those in the shared credentials +file (~/.aws/config). + +Credentials are the values the SDK should use for authenticating requests with +AWS Services. They arfrom a configuration file will need to include both +aws_access_key_id and aws_secret_access_key must be provided together in the +same file to be considered valid. The values will be ignored if not a complete +group. aws_session_token is an optional field that can be provided if both of +the other two fields are also provided. + + aws_access_key_id = AKID + aws_secret_access_key = SECRET + aws_session_token = TOKEN + +Assume Role values allow you to configure the SDK to assume an IAM role using +a set of credentials provided in a config file via the source_profile field. +Both "role_arn" and "source_profile" are required. The SDK does not support +assuming a role with MFA token Via the Session's constructor. You can use the +stscreds.AssumeRoleProvider credentials provider to specify custom +configuration and support for MFA. + + role_arn = arn:aws:iam:::role/ + source_profile = profile_with_creds + external_id = 1234 + mfa_serial = not supported! + role_session_name = session_name + +Region is the region the SDK should use for looking up AWS service endpoints +and signing requests. + + region = us-east-1 + +Environment Variables + +When a Session is created several environment variables can be set to adjust +how the SDK functions, and what configuration data it loads when creating +Sessions. All environment values are optional, but some values like credentials +require multiple of the values to set or the partial values will be ignored. +All environment variable values are strings unless otherwise noted. + +Environment configuration values. If set both Access Key ID and Secret Access +Key must be provided. Session Token and optionally also be provided, but is +not required. + + # Access Key ID + AWS_ACCESS_KEY_ID=AKID + AWS_ACCESS_KEY=AKID # only read if AWS_ACCESS_KEY_ID is not set. + + # Secret Access Key + AWS_SECRET_ACCESS_KEY=SECRET + AWS_SECRET_KEY=SECRET=SECRET # only read if AWS_SECRET_ACCESS_KEY is not set. + + # Session Token + AWS_SESSION_TOKEN=TOKEN + +Region value will instruct the SDK where to make service API requests to. If is +not provided in the environment the region must be provided before a service +client request is made. + + AWS_REGION=us-east-1 + + # AWS_DEFAULT_REGION is only read if AWS_SDK_LOAD_CONFIG is also set, + # and AWS_REGION is not also set. + AWS_DEFAULT_REGION=us-east-1 + +Profile name the SDK should load use when loading shared config from the +configuration files. If not provided "default" will be used as the profile name. + + AWS_PROFILE=my_profile + + # AWS_DEFAULT_PROFILE is only read if AWS_SDK_LOAD_CONFIG is also set, + # and AWS_PROFILE is not also set. + AWS_DEFAULT_PROFILE=my_profile + +SDK load config instructs the SDK to load the shared config in addition to +shared credentials. This also expands the configuration loaded so the shared +credentials will have parity with the shared config file. This also enables +Region and Profile support for the AWS_DEFAULT_REGION and AWS_DEFAULT_PROFILE +env values as well. + + AWS_SDK_LOAD_CONFIG=1 + +Shared credentials file path can be set to instruct the SDK to use an alternative +file for the shared credentials. If not set the file will be loaded from +$HOME/.aws/credentials on Linux/Unix based systems, and +%USERPROFILE%\.aws\credentials on Windows. + + AWS_SHARED_CREDENTIALS_FILE=$HOME/my_shared_credentials + +Shared config file path can be set to instruct the SDK to use an alternative +file for the shared config. If not set the file will be loaded from +$HOME/.aws/config on Linux/Unix based systems, and +%USERPROFILE%\.aws\config on Windows. + + AWS_CONFIG_FILE=$HOME/my_shared_config + + +*/ +package session diff --git a/vendor/github.com/aws/aws-sdk-go/aws/session/env_config.go b/vendor/github.com/aws/aws-sdk-go/aws/session/env_config.go new file mode 100644 index 000000000..d2f0c8448 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/aws/session/env_config.go @@ -0,0 +1,188 @@ +package session + +import ( + "os" + "path/filepath" + "strconv" + + "github.com/aws/aws-sdk-go/aws/credentials" +) + +// envConfig is a collection of environment values the SDK will read +// setup config from. All environment values are optional. But some values +// such as credentials require multiple values to be complete or the values +// will be ignored. +type envConfig struct { + // Environment configuration values. If set both Access Key ID and Secret Access + // Key must be provided. Session Token and optionally also be provided, but is + // not required. + // + // # Access Key ID + // AWS_ACCESS_KEY_ID=AKID + // AWS_ACCESS_KEY=AKID # only read if AWS_ACCESS_KEY_ID is not set. + // + // # Secret Access Key + // AWS_SECRET_ACCESS_KEY=SECRET + // AWS_SECRET_KEY=SECRET=SECRET # only read if AWS_SECRET_ACCESS_KEY is not set. + // + // # Session Token + // AWS_SESSION_TOKEN=TOKEN + Creds credentials.Value + + // Region value will instruct the SDK where to make service API requests to. If is + // not provided in the environment the region must be provided before a service + // client request is made. + // + // AWS_REGION=us-east-1 + // + // # AWS_DEFAULT_REGION is only read if AWS_SDK_LOAD_CONFIG is also set, + // # and AWS_REGION is not also set. + // AWS_DEFAULT_REGION=us-east-1 + Region string + + // Profile name the SDK should load use when loading shared configuration from the + // shared configuration files. If not provided "default" will be used as the + // profile name. + // + // AWS_PROFILE=my_profile + // + // # AWS_DEFAULT_PROFILE is only read if AWS_SDK_LOAD_CONFIG is also set, + // # and AWS_PROFILE is not also set. + // AWS_DEFAULT_PROFILE=my_profile + Profile string + + // SDK load config instructs the SDK to load the shared config in addition to + // shared credentials. This also expands the configuration loaded from the shared + // credentials to have parity with the shared config file. This also enables + // Region and Profile support for the AWS_DEFAULT_REGION and AWS_DEFAULT_PROFILE + // env values as well. + // + // AWS_SDK_LOAD_CONFIG=1 + EnableSharedConfig bool + + // Shared credentials file path can be set to instruct the SDK to use an alternate + // file for the shared credentials. If not set the file will be loaded from + // $HOME/.aws/credentials on Linux/Unix based systems, and + // %USERPROFILE%\.aws\credentials on Windows. + // + // AWS_SHARED_CREDENTIALS_FILE=$HOME/my_shared_credentials + SharedCredentialsFile string + + // Shared config file path can be set to instruct the SDK to use an alternate + // file for the shared config. If not set the file will be loaded from + // $HOME/.aws/config on Linux/Unix based systems, and + // %USERPROFILE%\.aws\config on Windows. + // + // AWS_CONFIG_FILE=$HOME/my_shared_config + SharedConfigFile string +} + +var ( + credAccessEnvKey = []string{ + "AWS_ACCESS_KEY_ID", + "AWS_ACCESS_KEY", + } + credSecretEnvKey = []string{ + "AWS_SECRET_ACCESS_KEY", + "AWS_SECRET_KEY", + } + credSessionEnvKey = []string{ + "AWS_SESSION_TOKEN", + } + + regionEnvKeys = []string{ + "AWS_REGION", + "AWS_DEFAULT_REGION", // Only read if AWS_SDK_LOAD_CONFIG is also set + } + profileEnvKeys = []string{ + "AWS_PROFILE", + "AWS_DEFAULT_PROFILE", // Only read if AWS_SDK_LOAD_CONFIG is also set + } +) + +// loadEnvConfig retrieves the SDK's environment configuration. +// See `envConfig` for the values that will be retrieved. +// +// If the environment variable `AWS_SDK_LOAD_CONFIG` is set to a truthy value +// the shared SDK config will be loaded in addition to the SDK's specific +// configuration values. +func loadEnvConfig() envConfig { + enableSharedConfig, _ := strconv.ParseBool(os.Getenv("AWS_SDK_LOAD_CONFIG")) + return envConfigLoad(enableSharedConfig) +} + +// loadEnvSharedConfig retrieves the SDK's environment configuration, and the +// SDK shared config. See `envConfig` for the values that will be retrieved. +// +// Loads the shared configuration in addition to the SDK's specific configuration. +// This will load the same values as `loadEnvConfig` if the `AWS_SDK_LOAD_CONFIG` +// environment variable is set. +func loadSharedEnvConfig() envConfig { + return envConfigLoad(true) +} + +func envConfigLoad(enableSharedConfig bool) envConfig { + cfg := envConfig{} + + cfg.EnableSharedConfig = enableSharedConfig + + setFromEnvVal(&cfg.Creds.AccessKeyID, credAccessEnvKey) + setFromEnvVal(&cfg.Creds.SecretAccessKey, credSecretEnvKey) + setFromEnvVal(&cfg.Creds.SessionToken, credSessionEnvKey) + + // Require logical grouping of credentials + if len(cfg.Creds.AccessKeyID) == 0 || len(cfg.Creds.SecretAccessKey) == 0 { + cfg.Creds = credentials.Value{} + } else { + cfg.Creds.ProviderName = "EnvConfigCredentials" + } + + regionKeys := regionEnvKeys + profileKeys := profileEnvKeys + if !cfg.EnableSharedConfig { + regionKeys = regionKeys[:1] + profileKeys = profileKeys[:1] + } + + setFromEnvVal(&cfg.Region, regionKeys) + setFromEnvVal(&cfg.Profile, profileKeys) + + cfg.SharedCredentialsFile = sharedCredentialsFilename() + cfg.SharedConfigFile = sharedConfigFilename() + + return cfg +} + +func setFromEnvVal(dst *string, keys []string) { + for _, k := range keys { + if v := os.Getenv(k); len(v) > 0 { + *dst = v + break + } + } +} + +func sharedCredentialsFilename() string { + if name := os.Getenv("AWS_SHARED_CREDENTIALS_FILE"); len(name) > 0 { + return name + } + + return filepath.Join(userHomeDir(), ".aws", "credentials") +} + +func sharedConfigFilename() string { + if name := os.Getenv("AWS_CONFIG_FILE"); len(name) > 0 { + return name + } + + return filepath.Join(userHomeDir(), ".aws", "config") +} + +func userHomeDir() string { + homeDir := os.Getenv("HOME") // *nix + if len(homeDir) == 0 { // windows + homeDir = os.Getenv("USERPROFILE") + } + + return homeDir +} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/session/session.go b/vendor/github.com/aws/aws-sdk-go/aws/session/session.go index 47e4536ff..2374b1f27 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/session/session.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/session/session.go @@ -1,17 +1,14 @@ -// Package session provides a way to create service clients with shared configuration -// and handlers. -// -// Generally this package should be used instead of the `defaults` package. -// -// A session should be used to share configurations and request handlers between multiple -// service clients. When service clients need specific configuration aws.Config can be -// used to provide additional configuration directly to the service client. package session import ( + "fmt" + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/awserr" "github.com/aws/aws-sdk-go/aws/client" "github.com/aws/aws-sdk-go/aws/corehandlers" + "github.com/aws/aws-sdk-go/aws/credentials" + "github.com/aws/aws-sdk-go/aws/credentials/stscreds" "github.com/aws/aws-sdk-go/aws/defaults" "github.com/aws/aws-sdk-go/aws/request" "github.com/aws/aws-sdk-go/private/endpoints" @@ -21,36 +18,199 @@ import ( // store configurations and request handlers for those services. // // Sessions are safe to create service clients concurrently, but it is not safe -// to mutate the session concurrently. +// to mutate the Session concurrently. +// +// The Session satisfies the service client's client.ClientConfigProvider. type Session struct { Config *aws.Config Handlers request.Handlers } -// New creates a new instance of the handlers merging in the provided Configs -// on top of the SDK's default configurations. Once the session is created it -// can be mutated to modify Configs or Handlers. The session is safe to be read -// concurrently, but it should not be written to concurrently. +// New creates a new instance of the handlers merging in the provided configs +// on top of the SDK's default configurations. Once the Session is created it +// can be mutated to modify the Config or Handlers. The Session is safe to be +// read concurrently, but it should not be written to concurrently. // -// Example: -// // Create a session with the default config and request handlers. -// sess := session.New() +// If the AWS_SDK_LOAD_CONFIG environment is set to a truthy value, the New +// method could now encounter an error when loading the configuration. When +// The environment variable is set, and an error occurs, New will return a +// session that will fail all requests reporting the error that occured while +// loading the session. Use NewSession to get the error when creating the +// session. // -// // Create a session with a custom region -// sess := session.New(&aws.Config{Region: aws.String("us-east-1")}) +// If the AWS_SDK_LOAD_CONFIG environment variable is set to a truthy value +// the shared config file (~/.aws/config) will also be loaded, in addition to +// the shared credentials file (~/.aws/config). Values set in both the +// shared config, and shared credentials will be taken from the shared +// credentials file. // -// // Create a session, and add additional handlers for all service -// // clients created with the session to inherit. Adds logging handler. -// sess := session.New() -// sess.Handlers.Send.PushFront(func(r *request.Request) { -// // Log every request made and its payload -// logger.Println("Request: %s/%s, Payload: %s", r.ClientInfo.ServiceName, r.Operation, r.Params) +// Deprecated: Use NewSession functiions to create sessions instead. NewSession +// has the same functionality as New except an error can be returned when the +// func is called instead of waiting to receive an error until a request is made. +func New(cfgs ...*aws.Config) *Session { + // load initial config from environment + envCfg := loadEnvConfig() + + if envCfg.EnableSharedConfig { + s, err := newSession(envCfg, cfgs...) + if err != nil { + // Old session.New expected all errors to be discovered when + // a request is made, and would report the errors then. This + // needs to be replicated if an error occurs while creating + // the session. + msg := "failed to create session with AWS_SDK_LOAD_CONFIG enabled. " + + "Use session.NewSession to handle errors occuring during session creation." + + // Session creation failed, need to report the error and prevent + // any requests from succeeding. + s = &Session{Config: defaults.Config()} + s.Config.MergeIn(cfgs...) + s.Config.Logger.Log("ERROR:", msg, "Error:", err) + s.Handlers.Validate.PushBack(func(r *request.Request) { + r.Error = err + }) + } + return s + } + + return oldNewSession(cfgs...) +} + +// NewSession returns a new Session created from SDK defaults, config files, +// environment, and user provided config files. Once the Session is created +// it can be mutated to modify the Config or Handlers. The Session is safe to +// be read concurrently, but it should not be written to concurrently. +// +// If the AWS_SDK_LOAD_CONFIG environment variable is set to a truthy value +// the shared config file (~/.aws/config) will also be loaded in addition to +// the shared credentials file (~/.aws/config). Values set in both the +// shared config, and shared credentials will be taken from the shared +// credentials file. Enabling the Shared Config will also allow the Session +// to be built with retrieving credentials with AssumeRole set in the config. +// +// See the NewSessionWithOptions func for information on how to override or +// control through code how the Session will be created. Such as specifing the +// config profile, and controlling if shared config is enabled or not. +func NewSession(cfgs ...*aws.Config) (*Session, error) { + envCfg := loadEnvConfig() + + return newSession(envCfg, cfgs...) +} + +// SharedConfigState provides the ability to optionally override the state +// of the session's creation based on the shared config being enabled or +// disabled. +type SharedConfigState int + +const ( + // SharedConfigStateFromEnv does not override any state of the + // AWS_SDK_LOAD_CONFIG env var. It is the default value of the + // SharedConfigState type. + SharedConfigStateFromEnv SharedConfigState = iota + + // SharedConfigDisable overrides the AWS_SDK_LOAD_CONFIG env var value + // and disables the shared config functionality. + SharedConfigDisable + + // SharedConfigEnable overrides the AWS_SDK_LOAD_CONFIG env var value + // and enables the shared config functionality. + SharedConfigEnable +) + +// Options provides the means to control how a Session is created and what +// configuration values will be loaded. +// +type Options struct { + // Provides config values for the SDK to use when creating service clients + // and making API requests to services. Any value set in with this field + // will override the associated value provided by the SDK defaults, + // environment or config files where relevent. + // + // If not set, configuration values from from SDK defaults, environment, + // config will be used. + Config aws.Config + + // Overrides the config profile the Session should be created from. If not + // set the value of the environment variable will be loaded (AWS_PROFILE, + // or AWS_DEFAULT_PROFILE if the Shared Config is enabled). + // + // If not set and environment variables are not set the "default" + // (DefaultSharedConfigProfile) will be used as the profile to load the + // session config from. + Profile string + + // Instructs how the Session will be created based on the AWS_SDK_LOAD_CONFIG + // environment variable. By default a Session will be created using the + // value provided by the AWS_SDK_LOAD_CONFIG environment variable. + // + // Setting this value to SharedConfigEnable or SharedConfigDisable + // will allow you to override the AWS_SDK_LOAD_CONFIG environment variable + // and enable or disable the shared config functionality. + SharedConfigState SharedConfigState +} + +// NewSessionWithOptions returns a new Session created from SDK defaults, config files, +// environment, and user provided config files. This func uses the Options +// values to configure how the Session is created. +// +// If the AWS_SDK_LOAD_CONFIG environment variable is set to a truthy value +// the shared config file (~/.aws/config) will also be loaded in addition to +// the shared credentials file (~/.aws/config). Values set in both the +// shared config, and shared credentials will be taken from the shared +// credentials file. Enabling the Shared Config will also allow the Session +// to be built with retrieving credentials with AssumeRole set in the config. +// +// // Equivalent to session.New +// sess, err := session.NewSessionWithOptions(session.Options{}) +// +// // Specify profile to load for the session's config +// sess, err := session.NewSessionWithOptions(session.Options{ +// Profile: "profile_name", // }) // -// // Create a S3 client instance from a session -// sess := session.New() -// svc := s3.New(sess) -func New(cfgs ...*aws.Config) *Session { +// // Specify profile for config and region for requests +// sess, err := session.NewSessionWithOptions(session.Options{ +// Config: aws.Config{Region: aws.String("us-east-1")}, +// Profile: "profile_name", +// }) +// +// // Force enable Shared Config support +// sess, err := session.NewSessionWithOptions(session.Options{ +// SharedConfigState: SharedConfigEnable, +// }) +func NewSessionWithOptions(opts Options) (*Session, error) { + envCfg := loadEnvConfig() + + if len(opts.Profile) > 0 { + envCfg.Profile = opts.Profile + } + + switch opts.SharedConfigState { + case SharedConfigDisable: + envCfg.EnableSharedConfig = false + case SharedConfigEnable: + envCfg.EnableSharedConfig = true + } + + return newSession(envCfg, &opts.Config) +} + +// Must is a helper function to ensure the Session is valid and there was no +// error when calling a NewSession function. +// +// This helper is intended to be used in variable initialization to load the +// Session and configuration at startup. Such as: +// +// var sess = session.Must(session.NewSession()) +func Must(sess *Session, err error) *Session { + if err != nil { + panic(err) + } + + return sess +} + +func oldNewSession(cfgs ...*aws.Config) *Session { cfg := defaults.Config() handlers := defaults.Handlers() @@ -72,6 +232,115 @@ func New(cfgs ...*aws.Config) *Session { return s } +func newSession(envCfg envConfig, cfgs ...*aws.Config) (*Session, error) { + cfg := defaults.Config() + handlers := defaults.Handlers() + + // Get a merged version of the user provided config to determine if + // credentials were. + userCfg := &aws.Config{} + userCfg.MergeIn(cfgs...) + + // Order config files will be loaded in with later files overwriting + // previous config file values. + cfgFiles := []string{envCfg.SharedConfigFile, envCfg.SharedCredentialsFile} + if !envCfg.EnableSharedConfig { + // The shared config file (~/.aws/config) is only loaded if instructed + // to load via the envConfig.EnableSharedConfig (AWS_SDK_LOAD_CONFIG). + cfgFiles = cfgFiles[1:] + } + + // Load additional config from file(s) + sharedCfg, err := loadSharedConfig(envCfg.Profile, cfgFiles) + if err != nil { + return nil, err + } + + mergeConfigSrcs(cfg, userCfg, envCfg, sharedCfg, handlers) + + s := &Session{ + Config: cfg, + Handlers: handlers, + } + + initHandlers(s) + + return s, nil +} + +func mergeConfigSrcs(cfg, userCfg *aws.Config, envCfg envConfig, sharedCfg sharedConfig, handlers request.Handlers) { + // Merge in user provided configuration + cfg.MergeIn(userCfg) + + // Region if not already set by user + if len(aws.StringValue(cfg.Region)) == 0 { + if len(envCfg.Region) > 0 { + cfg.WithRegion(envCfg.Region) + } else if envCfg.EnableSharedConfig && len(sharedCfg.Region) > 0 { + cfg.WithRegion(sharedCfg.Region) + } + } + + // Configure credentials if not already set + if cfg.Credentials == credentials.AnonymousCredentials && userCfg.Credentials == nil { + if len(envCfg.Creds.AccessKeyID) > 0 { + cfg.Credentials = credentials.NewStaticCredentialsFromCreds( + envCfg.Creds, + ) + } else if envCfg.EnableSharedConfig && len(sharedCfg.AssumeRole.RoleARN) > 0 && sharedCfg.AssumeRoleSource != nil { + cfgCp := *cfg + cfgCp.Credentials = credentials.NewStaticCredentialsFromCreds( + sharedCfg.AssumeRoleSource.Creds, + ) + cfg.Credentials = stscreds.NewCredentials( + &Session{ + Config: &cfgCp, + Handlers: handlers.Copy(), + }, + sharedCfg.AssumeRole.RoleARN, + func(opt *stscreds.AssumeRoleProvider) { + opt.RoleSessionName = sharedCfg.AssumeRole.RoleSessionName + + if len(sharedCfg.AssumeRole.ExternalID) > 0 { + opt.ExternalID = aws.String(sharedCfg.AssumeRole.ExternalID) + } + + // MFA not supported + }, + ) + } else if len(sharedCfg.Creds.AccessKeyID) > 0 { + cfg.Credentials = credentials.NewStaticCredentialsFromCreds( + sharedCfg.Creds, + ) + } else { + // Fallback to default credentials provider, include mock errors + // for the credential chain so user can identify why credentials + // failed to be retrieved. + cfg.Credentials = credentials.NewCredentials(&credentials.ChainProvider{ + VerboseErrors: aws.BoolValue(cfg.CredentialsChainVerboseErrors), + Providers: []credentials.Provider{ + &credProviderError{Err: awserr.New("EnvAccessKeyNotFound", "failed to find credentials in the environment.", nil)}, + &credProviderError{Err: awserr.New("SharedCredsLoad", fmt.Sprintf("failed to load profile, %s.", envCfg.Profile), nil)}, + defaults.RemoteCredProvider(*cfg, handlers), + }, + }) + } + } +} + +type credProviderError struct { + Err error +} + +var emptyCreds = credentials.Value{} + +func (c credProviderError) Retrieve() (credentials.Value, error) { + return credentials.Value{}, c.Err +} +func (c credProviderError) IsExpired() bool { + return true +} + func initHandlers(s *Session) { // Add the Validate parameter handler if it is not disabled. s.Handlers.Validate.Remove(corehandlers.ValidateParametersHandler) @@ -80,13 +349,12 @@ func initHandlers(s *Session) { } } -// Copy creates and returns a copy of the current session, coping the config +// Copy creates and returns a copy of the current Session, coping the config // and handlers. If any additional configs are provided they will be merged -// on top of the session's copied config. +// on top of the Session's copied config. // -// Example: -// // Create a copy of the current session, configured for the us-west-2 region. -// sess.Copy(&aws.Config{Region: aws.String("us-west-2"}) +// // Create a copy of the current Session, configured for the us-west-2 region. +// sess.Copy(&aws.Config{Region: aws.String("us-west-2")}) func (s *Session) Copy(cfgs ...*aws.Config) *Session { newSession := &Session{ Config: s.Config.Copy(cfgs...), @@ -101,15 +369,15 @@ func (s *Session) Copy(cfgs ...*aws.Config) *Session { // ClientConfig satisfies the client.ConfigProvider interface and is used to // configure the service client instances. Passing the Session to the service // client's constructor (New) will use this method to configure the client. -// -// Example: -// sess := session.New() -// s3.New(sess) func (s *Session) ClientConfig(serviceName string, cfgs ...*aws.Config) client.Config { s = s.Copy(cfgs...) endpoint, signingRegion := endpoints.NormalizeEndpoint( - aws.StringValue(s.Config.Endpoint), serviceName, - aws.StringValue(s.Config.Region), aws.BoolValue(s.Config.DisableSSL)) + aws.StringValue(s.Config.Endpoint), + serviceName, + aws.StringValue(s.Config.Region), + aws.BoolValue(s.Config.DisableSSL), + aws.BoolValue(s.Config.UseDualStack), + ) return client.Config{ Config: s.Config, diff --git a/vendor/github.com/aws/aws-sdk-go/aws/session/shared_config.go b/vendor/github.com/aws/aws-sdk-go/aws/session/shared_config.go new file mode 100644 index 000000000..0147eedeb --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/aws/session/shared_config.go @@ -0,0 +1,294 @@ +package session + +import ( + "fmt" + "os" + + "github.com/aws/aws-sdk-go/aws/awserr" + "github.com/aws/aws-sdk-go/aws/credentials" + "github.com/go-ini/ini" +) + +const ( + // Static Credentials group + accessKeyIDKey = `aws_access_key_id` // group required + secretAccessKey = `aws_secret_access_key` // group required + sessionTokenKey = `aws_session_token` // optional + + // Assume Role Credentials group + roleArnKey = `role_arn` // group required + sourceProfileKey = `source_profile` // group required + externalIDKey = `external_id` // optional + mfaSerialKey = `mfa_serial` // optional + roleSessionNameKey = `role_session_name` // optional + + // Additional Config fields + regionKey = `region` + + // DefaultSharedConfigProfile is the default profile to be used when + // loading configuration from the config files if another profile name + // is not provided. + DefaultSharedConfigProfile = `default` +) + +type assumeRoleConfig struct { + RoleARN string + SourceProfile string + ExternalID string + MFASerial string + RoleSessionName string +} + +// sharedConfig represents the configuration fields of the SDK config files. +type sharedConfig struct { + // Credentials values from the config file. Both aws_access_key_id + // and aws_secret_access_key must be provided together in the same file + // to be considered valid. The values will be ignored if not a complete group. + // aws_session_token is an optional field that can be provided if both of the + // other two fields are also provided. + // + // aws_access_key_id + // aws_secret_access_key + // aws_session_token + Creds credentials.Value + + AssumeRole assumeRoleConfig + AssumeRoleSource *sharedConfig + + // Region is the region the SDK should use for looking up AWS service endpoints + // and signing requests. + // + // region + Region string +} + +type sharedConfigFile struct { + Filename string + IniData *ini.File +} + +// loadSharedConfig retrieves the configuration from the list of files +// using the profile provided. The order the files are listed will determine +// precedence. Values in subsequent files will overwrite values defined in +// earlier files. +// +// For example, given two files A and B. Both define credentials. If the order +// of the files are A then B, B's credential values will be used instead of A's. +// +// See sharedConfig.setFromFile for information how the config files +// will be loaded. +func loadSharedConfig(profile string, filenames []string) (sharedConfig, error) { + if len(profile) == 0 { + profile = DefaultSharedConfigProfile + } + + files, err := loadSharedConfigIniFiles(filenames) + if err != nil { + return sharedConfig{}, err + } + + cfg := sharedConfig{} + if err = cfg.setFromIniFiles(profile, files); err != nil { + return sharedConfig{}, err + } + + if len(cfg.AssumeRole.SourceProfile) > 0 { + if err := cfg.setAssumeRoleSource(profile, files); err != nil { + return sharedConfig{}, err + } + } + + return cfg, nil +} + +func loadSharedConfigIniFiles(filenames []string) ([]sharedConfigFile, error) { + files := make([]sharedConfigFile, 0, len(filenames)) + + for _, filename := range filenames { + if _, err := os.Stat(filename); os.IsNotExist(err) { + // Trim files from the list that don't exist. + continue + } + + f, err := ini.Load(filename) + if err != nil { + return nil, SharedConfigLoadError{Filename: filename} + } + + files = append(files, sharedConfigFile{ + Filename: filename, IniData: f, + }) + } + + return files, nil +} + +func (cfg *sharedConfig) setAssumeRoleSource(origProfile string, files []sharedConfigFile) error { + var assumeRoleSrc sharedConfig + + // Multiple level assume role chains are not support + if cfg.AssumeRole.SourceProfile == origProfile { + assumeRoleSrc = *cfg + assumeRoleSrc.AssumeRole = assumeRoleConfig{} + } else { + err := assumeRoleSrc.setFromIniFiles(cfg.AssumeRole.SourceProfile, files) + if err != nil { + return err + } + } + + if len(assumeRoleSrc.Creds.AccessKeyID) == 0 { + return SharedConfigAssumeRoleError{RoleARN: cfg.AssumeRole.RoleARN} + } + + cfg.AssumeRoleSource = &assumeRoleSrc + + return nil +} + +func (cfg *sharedConfig) setFromIniFiles(profile string, files []sharedConfigFile) error { + // Trim files from the list that don't exist. + for _, f := range files { + if err := cfg.setFromIniFile(profile, f); err != nil { + if _, ok := err.(SharedConfigProfileNotExistsError); ok { + // Ignore proviles missings + continue + } + return err + } + } + + return nil +} + +// setFromFile loads the configuration from the file using +// the profile provided. A sharedConfig pointer type value is used so that +// multiple config file loadings can be chained. +// +// Only loads complete logically grouped values, and will not set fields in cfg +// for incomplete grouped values in the config. Such as credentials. For example +// if a config file only includes aws_access_key_id but no aws_secret_access_key +// the aws_access_key_id will be ignored. +func (cfg *sharedConfig) setFromIniFile(profile string, file sharedConfigFile) error { + section, err := file.IniData.GetSection(profile) + if err != nil { + // Fallback to to alternate profile name: profile + section, err = file.IniData.GetSection(fmt.Sprintf("profile %s", profile)) + if err != nil { + return SharedConfigProfileNotExistsError{Profile: profile, Err: err} + } + } + + // Shared Credentials + akid := section.Key(accessKeyIDKey).String() + secret := section.Key(secretAccessKey).String() + if len(akid) > 0 && len(secret) > 0 { + cfg.Creds = credentials.Value{ + AccessKeyID: akid, + SecretAccessKey: secret, + SessionToken: section.Key(sessionTokenKey).String(), + ProviderName: fmt.Sprintf("SharedConfigCredentials: %s", file.Filename), + } + } + + // Assume Role + roleArn := section.Key(roleArnKey).String() + srcProfile := section.Key(sourceProfileKey).String() + if len(roleArn) > 0 && len(srcProfile) > 0 { + cfg.AssumeRole = assumeRoleConfig{ + RoleARN: roleArn, + SourceProfile: srcProfile, + ExternalID: section.Key(externalIDKey).String(), + MFASerial: section.Key(mfaSerialKey).String(), + RoleSessionName: section.Key(roleSessionNameKey).String(), + } + } + + // Region + if v := section.Key(regionKey).String(); len(v) > 0 { + cfg.Region = v + } + + return nil +} + +// SharedConfigLoadError is an error for the shared config file failed to load. +type SharedConfigLoadError struct { + Filename string + Err error +} + +// Code is the short id of the error. +func (e SharedConfigLoadError) Code() string { + return "SharedConfigLoadError" +} + +// Message is the description of the error +func (e SharedConfigLoadError) Message() string { + return fmt.Sprintf("failed to load config file, %s", e.Filename) +} + +// OrigErr is the underlying error that caused the failure. +func (e SharedConfigLoadError) OrigErr() error { + return e.Err +} + +// Error satisfies the error interface. +func (e SharedConfigLoadError) Error() string { + return awserr.SprintError(e.Code(), e.Message(), "", e.Err) +} + +// SharedConfigProfileNotExistsError is an error for the shared config when +// the profile was not find in the config file. +type SharedConfigProfileNotExistsError struct { + Profile string + Err error +} + +// Code is the short id of the error. +func (e SharedConfigProfileNotExistsError) Code() string { + return "SharedConfigProfileNotExistsError" +} + +// Message is the description of the error +func (e SharedConfigProfileNotExistsError) Message() string { + return fmt.Sprintf("failed to get profile, %s", e.Profile) +} + +// OrigErr is the underlying error that caused the failure. +func (e SharedConfigProfileNotExistsError) OrigErr() error { + return e.Err +} + +// Error satisfies the error interface. +func (e SharedConfigProfileNotExistsError) Error() string { + return awserr.SprintError(e.Code(), e.Message(), "", e.Err) +} + +// SharedConfigAssumeRoleError is an error for the shared config when the +// profile contains assume role information, but that information is invalid +// or not complete. +type SharedConfigAssumeRoleError struct { + RoleARN string +} + +// Code is the short id of the error. +func (e SharedConfigAssumeRoleError) Code() string { + return "SharedConfigAssumeRoleError" +} + +// Message is the description of the error +func (e SharedConfigAssumeRoleError) Message() string { + return fmt.Sprintf("failed to load assume role for %s, source profile has no shared credentials", + e.RoleARN) +} + +// OrigErr is the underlying error that caused the failure. +func (e SharedConfigAssumeRoleError) OrigErr() error { + return nil +} + +// Error satisfies the error interface. +func (e SharedConfigAssumeRoleError) Error() string { + return awserr.SprintError(e.Code(), e.Message(), "", nil) +} diff --git a/vendor/github.com/aws/aws-sdk-go/private/signer/v4/header_rules.go b/vendor/github.com/aws/aws-sdk-go/aws/signer/v4/header_rules.go similarity index 100% rename from vendor/github.com/aws/aws-sdk-go/private/signer/v4/header_rules.go rename to vendor/github.com/aws/aws-sdk-go/aws/signer/v4/header_rules.go diff --git a/vendor/github.com/aws/aws-sdk-go/aws/signer/v4/v4.go b/vendor/github.com/aws/aws-sdk-go/aws/signer/v4/v4.go new file mode 100644 index 000000000..7d99f54d1 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/aws/signer/v4/v4.go @@ -0,0 +1,644 @@ +// Package v4 implements signing for AWS V4 signer +// +// Provides request signing for request that need to be signed with +// AWS V4 Signatures. +package v4 + +import ( + "bytes" + "crypto/hmac" + "crypto/sha256" + "encoding/hex" + "fmt" + "io" + "net/http" + "net/url" + "sort" + "strconv" + "strings" + "time" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/credentials" + "github.com/aws/aws-sdk-go/aws/request" + "github.com/aws/aws-sdk-go/private/protocol/rest" +) + +const ( + authHeaderPrefix = "AWS4-HMAC-SHA256" + timeFormat = "20060102T150405Z" + shortTimeFormat = "20060102" + + // emptyStringSHA256 is a SHA256 of an empty string + emptyStringSHA256 = `e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855` +) + +var ignoredHeaders = rules{ + blacklist{ + mapRule{ + "Authorization": struct{}{}, + "User-Agent": struct{}{}, + }, + }, +} + +// requiredSignedHeaders is a whitelist for build canonical headers. +var requiredSignedHeaders = rules{ + whitelist{ + mapRule{ + "Cache-Control": struct{}{}, + "Content-Disposition": struct{}{}, + "Content-Encoding": struct{}{}, + "Content-Language": struct{}{}, + "Content-Md5": struct{}{}, + "Content-Type": struct{}{}, + "Expires": struct{}{}, + "If-Match": struct{}{}, + "If-Modified-Since": struct{}{}, + "If-None-Match": struct{}{}, + "If-Unmodified-Since": struct{}{}, + "Range": struct{}{}, + "X-Amz-Acl": struct{}{}, + "X-Amz-Copy-Source": struct{}{}, + "X-Amz-Copy-Source-If-Match": struct{}{}, + "X-Amz-Copy-Source-If-Modified-Since": struct{}{}, + "X-Amz-Copy-Source-If-None-Match": struct{}{}, + "X-Amz-Copy-Source-If-Unmodified-Since": struct{}{}, + "X-Amz-Copy-Source-Range": struct{}{}, + "X-Amz-Copy-Source-Server-Side-Encryption-Customer-Algorithm": struct{}{}, + "X-Amz-Copy-Source-Server-Side-Encryption-Customer-Key": struct{}{}, + "X-Amz-Copy-Source-Server-Side-Encryption-Customer-Key-Md5": struct{}{}, + "X-Amz-Grant-Full-control": struct{}{}, + "X-Amz-Grant-Read": struct{}{}, + "X-Amz-Grant-Read-Acp": struct{}{}, + "X-Amz-Grant-Write": struct{}{}, + "X-Amz-Grant-Write-Acp": struct{}{}, + "X-Amz-Metadata-Directive": struct{}{}, + "X-Amz-Mfa": struct{}{}, + "X-Amz-Request-Payer": struct{}{}, + "X-Amz-Server-Side-Encryption": struct{}{}, + "X-Amz-Server-Side-Encryption-Aws-Kms-Key-Id": struct{}{}, + "X-Amz-Server-Side-Encryption-Customer-Algorithm": struct{}{}, + "X-Amz-Server-Side-Encryption-Customer-Key": struct{}{}, + "X-Amz-Server-Side-Encryption-Customer-Key-Md5": struct{}{}, + "X-Amz-Storage-Class": struct{}{}, + "X-Amz-Website-Redirect-Location": struct{}{}, + }, + }, + patterns{"X-Amz-Meta-"}, +} + +// allowedHoisting is a whitelist for build query headers. The boolean value +// represents whether or not it is a pattern. +var allowedQueryHoisting = inclusiveRules{ + blacklist{requiredSignedHeaders}, + patterns{"X-Amz-"}, +} + +// Signer applies AWS v4 signing to given request. Use this to sign requests +// that need to be signed with AWS V4 Signatures. +type Signer struct { + // The authentication credentials the request will be signed against. + // This value must be set to sign requests. + Credentials *credentials.Credentials + + // Sets the log level the signer should use when reporting information to + // the logger. If the logger is nil nothing will be logged. See + // aws.LogLevelType for more information on available logging levels + // + // By default nothing will be logged. + Debug aws.LogLevelType + + // The logger loging information will be written to. If there the logger + // is nil, nothing will be logged. + Logger aws.Logger + + // Disables the Signer's moving HTTP header key/value pairs from the HTTP + // request header to the request's query string. This is most commonly used + // with pre-signed requests preventing headers from being added to the + // request's query string. + DisableHeaderHoisting bool + + // currentTimeFn returns the time value which represents the current time. + // This value should only be used for testing. If it is nil the default + // time.Now will be used. + currentTimeFn func() time.Time +} + +// NewSigner returns a Signer pointer configured with the credentials and optional +// option values provided. If not options are provided the Signer will use its +// default configuration. +func NewSigner(credentials *credentials.Credentials, options ...func(*Signer)) *Signer { + v4 := &Signer{ + Credentials: credentials, + } + + for _, option := range options { + option(v4) + } + + return v4 +} + +type signingCtx struct { + ServiceName string + Region string + Request *http.Request + Body io.ReadSeeker + Query url.Values + Time time.Time + ExpireTime time.Duration + SignedHeaderVals http.Header + + credValues credentials.Value + isPresign bool + formattedTime string + formattedShortTime string + + bodyDigest string + signedHeaders string + canonicalHeaders string + canonicalString string + credentialString string + stringToSign string + signature string + authorization string +} + +// Sign signs AWS v4 requests with the provided body, service name, region the +// request is made to, and time the request is signed at. The signTime allows +// you to specify that a request is signed for the future, and cannot be +// used until then. +// +// Returns a list of HTTP headers that were included in the signature or an +// error if signing the request failed. Generally for signed requests this value +// is not needed as the full request context will be captured by the http.Request +// value. It is included for reference though. +// +// Sign differs from Presign in that it will sign the request using HTTP +// header values. This type of signing is intended for http.Request values that +// will not be shared, or are shared in a way the header values on the request +// will not be lost. +// +// The requests body is an io.ReadSeeker so the SHA256 of the body can be +// generated. To bypass the signer computing the hash you can set the +// "X-Amz-Content-Sha256" header with a precomputed value. The signer will +// only compute the hash if the request header value is empty. +func (v4 Signer) Sign(r *http.Request, body io.ReadSeeker, service, region string, signTime time.Time) (http.Header, error) { + return v4.signWithBody(r, body, service, region, 0, signTime) +} + +// Presign signs AWS v4 requests with the provided body, service name, region +// the request is made to, and time the request is signed at. The signTime +// allows you to specify that a request is signed for the future, and cannot +// be used until then. +// +// Returns a list of HTTP headers that were included in the signature or an +// error if signing the request failed. For presigned requests these headers +// and their values must be included on the HTTP request when it is made. This +// is helpful to know what header values need to be shared with the party the +// presigned request will be distributed to. +// +// Presign differs from Sign in that it will sign the request using query string +// instead of header values. This allows you to share the Presigned Request's +// URL with third parties, or distribute it throughout your system with minimal +// dependencies. +// +// Presign also takes an exp value which is the duration the +// signed request will be valid after the signing time. This is allows you to +// set when the request will expire. +// +// The requests body is an io.ReadSeeker so the SHA256 of the body can be +// generated. To bypass the signer computing the hash you can set the +// "X-Amz-Content-Sha256" header with a precomputed value. The signer will +// only compute the hash if the request header value is empty. +// +// Presigning a S3 request will not compute the body's SHA256 hash by default. +// This is done due to the general use case for S3 presigned URLs is to share +// PUT/GET capabilities. If you would like to include the body's SHA256 in the +// presigned request's signature you can set the "X-Amz-Content-Sha256" +// HTTP header and that will be included in the request's signature. +func (v4 Signer) Presign(r *http.Request, body io.ReadSeeker, service, region string, exp time.Duration, signTime time.Time) (http.Header, error) { + return v4.signWithBody(r, body, service, region, exp, signTime) +} + +func (v4 Signer) signWithBody(r *http.Request, body io.ReadSeeker, service, region string, exp time.Duration, signTime time.Time) (http.Header, error) { + currentTimeFn := v4.currentTimeFn + if currentTimeFn == nil { + currentTimeFn = time.Now + } + + ctx := &signingCtx{ + Request: r, + Body: body, + Query: r.URL.Query(), + Time: signTime, + ExpireTime: exp, + isPresign: exp != 0, + ServiceName: service, + Region: region, + } + + if ctx.isRequestSigned() { + if !v4.Credentials.IsExpired() && currentTimeFn().Before(ctx.Time.Add(10*time.Minute)) { + // If the request is already signed, and the credentials have not + // expired, and the request is not too old ignore the signing request. + return ctx.SignedHeaderVals, nil + } + ctx.Time = currentTimeFn() + ctx.handlePresignRemoval() + } + + var err error + ctx.credValues, err = v4.Credentials.Get() + if err != nil { + return http.Header{}, err + } + + ctx.assignAmzQueryValues() + ctx.build(v4.DisableHeaderHoisting) + + if v4.Debug.Matches(aws.LogDebugWithSigning) { + v4.logSigningInfo(ctx) + } + + return ctx.SignedHeaderVals, nil +} + +func (ctx *signingCtx) handlePresignRemoval() { + if !ctx.isPresign { + return + } + + // The credentials have expired for this request. The current signing + // is invalid, and needs to be request because the request will fail. + ctx.removePresign() + + // Update the request's query string to ensure the values stays in + // sync in the case retrieving the new credentials fails. + ctx.Request.URL.RawQuery = ctx.Query.Encode() +} + +func (ctx *signingCtx) assignAmzQueryValues() { + if ctx.isPresign { + ctx.Query.Set("X-Amz-Algorithm", authHeaderPrefix) + if ctx.credValues.SessionToken != "" { + ctx.Query.Set("X-Amz-Security-Token", ctx.credValues.SessionToken) + } else { + ctx.Query.Del("X-Amz-Security-Token") + } + + return + } + + if ctx.credValues.SessionToken != "" { + ctx.Request.Header.Set("X-Amz-Security-Token", ctx.credValues.SessionToken) + } +} + +// SignRequestHandler is a named request handler the SDK will use to sign +// service client request with using the V4 signature. +var SignRequestHandler = request.NamedHandler{ + Name: "v4.SignRequestHandler", Fn: SignSDKRequest, +} + +// SignSDKRequest signs an AWS request with the V4 signature. This +// request handler is bested used only with the SDK's built in service client's +// API operation requests. +// +// This function should not be used on its on its own, but in conjunction with +// an AWS service client's API operation call. To sign a standalone request +// not created by a service client's API operation method use the "Sign" or +// "Presign" functions of the "Signer" type. +// +// If the credentials of the request's config are set to +// credentials.AnonymousCredentials the request will not be signed. +func SignSDKRequest(req *request.Request) { + signSDKRequestWithCurrTime(req, time.Now) +} +func signSDKRequestWithCurrTime(req *request.Request, curTimeFn func() time.Time) { + // If the request does not need to be signed ignore the signing of the + // request if the AnonymousCredentials object is used. + if req.Config.Credentials == credentials.AnonymousCredentials { + return + } + + region := req.ClientInfo.SigningRegion + if region == "" { + region = aws.StringValue(req.Config.Region) + } + + name := req.ClientInfo.SigningName + if name == "" { + name = req.ClientInfo.ServiceName + } + + v4 := NewSigner(req.Config.Credentials, func(v4 *Signer) { + v4.Debug = req.Config.LogLevel.Value() + v4.Logger = req.Config.Logger + v4.DisableHeaderHoisting = req.NotHoist + v4.currentTimeFn = curTimeFn + }) + + signingTime := req.Time + if !req.LastSignedAt.IsZero() { + signingTime = req.LastSignedAt + } + + signedHeaders, err := v4.signWithBody(req.HTTPRequest, req.Body, name, region, req.ExpireTime, signingTime) + if err != nil { + req.Error = err + req.SignedHeaderVals = nil + return + } + + req.SignedHeaderVals = signedHeaders + req.LastSignedAt = curTimeFn() +} + +const logSignInfoMsg = `DEBUG: Request Signiture: +---[ CANONICAL STRING ]----------------------------- +%s +---[ STRING TO SIGN ]-------------------------------- +%s%s +-----------------------------------------------------` +const logSignedURLMsg = ` +---[ SIGNED URL ]------------------------------------ +%s` + +func (v4 *Signer) logSigningInfo(ctx *signingCtx) { + signedURLMsg := "" + if ctx.isPresign { + signedURLMsg = fmt.Sprintf(logSignedURLMsg, ctx.Request.URL.String()) + } + msg := fmt.Sprintf(logSignInfoMsg, ctx.canonicalString, ctx.stringToSign, signedURLMsg) + v4.Logger.Log(msg) +} + +func (ctx *signingCtx) build(disableHeaderHoisting bool) { + ctx.buildTime() // no depends + ctx.buildCredentialString() // no depends + + unsignedHeaders := ctx.Request.Header + if ctx.isPresign { + if !disableHeaderHoisting { + urlValues := url.Values{} + urlValues, unsignedHeaders = buildQuery(allowedQueryHoisting, unsignedHeaders) // no depends + for k := range urlValues { + ctx.Query[k] = urlValues[k] + } + } + } + + ctx.buildBodyDigest() + ctx.buildCanonicalHeaders(ignoredHeaders, unsignedHeaders) + ctx.buildCanonicalString() // depends on canon headers / signed headers + ctx.buildStringToSign() // depends on canon string + ctx.buildSignature() // depends on string to sign + + if ctx.isPresign { + ctx.Request.URL.RawQuery += "&X-Amz-Signature=" + ctx.signature + } else { + parts := []string{ + authHeaderPrefix + " Credential=" + ctx.credValues.AccessKeyID + "/" + ctx.credentialString, + "SignedHeaders=" + ctx.signedHeaders, + "Signature=" + ctx.signature, + } + ctx.Request.Header.Set("Authorization", strings.Join(parts, ", ")) + } +} + +func (ctx *signingCtx) buildTime() { + ctx.formattedTime = ctx.Time.UTC().Format(timeFormat) + ctx.formattedShortTime = ctx.Time.UTC().Format(shortTimeFormat) + + if ctx.isPresign { + duration := int64(ctx.ExpireTime / time.Second) + ctx.Query.Set("X-Amz-Date", ctx.formattedTime) + ctx.Query.Set("X-Amz-Expires", strconv.FormatInt(duration, 10)) + } else { + ctx.Request.Header.Set("X-Amz-Date", ctx.formattedTime) + } +} + +func (ctx *signingCtx) buildCredentialString() { + ctx.credentialString = strings.Join([]string{ + ctx.formattedShortTime, + ctx.Region, + ctx.ServiceName, + "aws4_request", + }, "/") + + if ctx.isPresign { + ctx.Query.Set("X-Amz-Credential", ctx.credValues.AccessKeyID+"/"+ctx.credentialString) + } +} + +func buildQuery(r rule, header http.Header) (url.Values, http.Header) { + query := url.Values{} + unsignedHeaders := http.Header{} + for k, h := range header { + if r.IsValid(k) { + query[k] = h + } else { + unsignedHeaders[k] = h + } + } + + return query, unsignedHeaders +} +func (ctx *signingCtx) buildCanonicalHeaders(r rule, header http.Header) { + var headers []string + headers = append(headers, "host") + for k, v := range header { + canonicalKey := http.CanonicalHeaderKey(k) + if !r.IsValid(canonicalKey) { + continue // ignored header + } + if ctx.SignedHeaderVals == nil { + ctx.SignedHeaderVals = make(http.Header) + } + + lowerCaseKey := strings.ToLower(k) + if _, ok := ctx.SignedHeaderVals[lowerCaseKey]; ok { + // include additional values + ctx.SignedHeaderVals[lowerCaseKey] = append(ctx.SignedHeaderVals[lowerCaseKey], v...) + continue + } + + headers = append(headers, lowerCaseKey) + ctx.SignedHeaderVals[lowerCaseKey] = v + } + sort.Strings(headers) + + ctx.signedHeaders = strings.Join(headers, ";") + + if ctx.isPresign { + ctx.Query.Set("X-Amz-SignedHeaders", ctx.signedHeaders) + } + + headerValues := make([]string, len(headers)) + for i, k := range headers { + if k == "host" { + headerValues[i] = "host:" + ctx.Request.URL.Host + } else { + headerValues[i] = k + ":" + + strings.Join(ctx.SignedHeaderVals[k], ",") + } + } + + ctx.canonicalHeaders = strings.Join(stripExcessSpaces(headerValues), "\n") +} + +func (ctx *signingCtx) buildCanonicalString() { + ctx.Request.URL.RawQuery = strings.Replace(ctx.Query.Encode(), "+", "%20", -1) + uri := ctx.Request.URL.Opaque + if uri != "" { + uri = "/" + strings.Join(strings.Split(uri, "/")[3:], "/") + } else { + uri = ctx.Request.URL.Path + } + if uri == "" { + uri = "/" + } + + if ctx.ServiceName != "s3" { + uri = rest.EscapePath(uri, false) + } + + ctx.canonicalString = strings.Join([]string{ + ctx.Request.Method, + uri, + ctx.Request.URL.RawQuery, + ctx.canonicalHeaders + "\n", + ctx.signedHeaders, + ctx.bodyDigest, + }, "\n") +} + +func (ctx *signingCtx) buildStringToSign() { + ctx.stringToSign = strings.Join([]string{ + authHeaderPrefix, + ctx.formattedTime, + ctx.credentialString, + hex.EncodeToString(makeSha256([]byte(ctx.canonicalString))), + }, "\n") +} + +func (ctx *signingCtx) buildSignature() { + secret := ctx.credValues.SecretAccessKey + date := makeHmac([]byte("AWS4"+secret), []byte(ctx.formattedShortTime)) + region := makeHmac(date, []byte(ctx.Region)) + service := makeHmac(region, []byte(ctx.ServiceName)) + credentials := makeHmac(service, []byte("aws4_request")) + signature := makeHmac(credentials, []byte(ctx.stringToSign)) + ctx.signature = hex.EncodeToString(signature) +} + +func (ctx *signingCtx) buildBodyDigest() { + hash := ctx.Request.Header.Get("X-Amz-Content-Sha256") + if hash == "" { + if ctx.isPresign && ctx.ServiceName == "s3" { + hash = "UNSIGNED-PAYLOAD" + } else if ctx.Body == nil { + hash = emptyStringSHA256 + } else { + hash = hex.EncodeToString(makeSha256Reader(ctx.Body)) + } + if ctx.ServiceName == "s3" || ctx.ServiceName == "glacier" { + ctx.Request.Header.Set("X-Amz-Content-Sha256", hash) + } + } + ctx.bodyDigest = hash +} + +// isRequestSigned returns if the request is currently signed or presigned +func (ctx *signingCtx) isRequestSigned() bool { + if ctx.isPresign && ctx.Query.Get("X-Amz-Signature") != "" { + return true + } + if ctx.Request.Header.Get("Authorization") != "" { + return true + } + + return false +} + +// unsign removes signing flags for both signed and presigned requests. +func (ctx *signingCtx) removePresign() { + ctx.Query.Del("X-Amz-Algorithm") + ctx.Query.Del("X-Amz-Signature") + ctx.Query.Del("X-Amz-Security-Token") + ctx.Query.Del("X-Amz-Date") + ctx.Query.Del("X-Amz-Expires") + ctx.Query.Del("X-Amz-Credential") + ctx.Query.Del("X-Amz-SignedHeaders") +} + +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 { + hash := sha256.New() + start, _ := reader.Seek(0, 1) + defer reader.Seek(start, 0) + + io.Copy(hash, reader) + return hash.Sum(nil) +} + +const doubleSpaces = " " + +var doubleSpaceBytes = []byte(doubleSpaces) + +func stripExcessSpaces(headerVals []string) []string { + vals := make([]string, len(headerVals)) + for i, str := range headerVals { + // Trim leading and trailing spaces + trimmed := strings.TrimSpace(str) + + idx := strings.Index(trimmed, doubleSpaces) + var buf []byte + for idx > -1 { + // Multiple adjacent spaces found + if buf == nil { + // first time create the buffer + buf = []byte(trimmed) + } + + stripToIdx := -1 + for j := idx + 1; j < len(buf); j++ { + if buf[j] != ' ' { + buf = append(buf[:idx+1], buf[j:]...) + stripToIdx = j + break + } + } + + if stripToIdx >= 0 { + idx = bytes.Index(buf[stripToIdx:], doubleSpaceBytes) + if idx >= 0 { + idx += stripToIdx + } + } else { + idx = -1 + } + } + + if buf != nil { + vals[i] = string(buf) + } else { + vals[i] = trimmed + } + } + return vals +} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/types.go b/vendor/github.com/aws/aws-sdk-go/aws/types.go index 0f067c57f..fa014b49e 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/types.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/types.go @@ -61,23 +61,41 @@ func (r ReaderSeekerCloser) Close() error { type WriteAtBuffer struct { buf []byte m sync.Mutex + + // GrowthCoeff defines the growth rate of the internal buffer. By + // default, the growth rate is 1, where expanding the internal + // buffer will allocate only enough capacity to fit the new expected + // length. + GrowthCoeff float64 +} + +// NewWriteAtBuffer creates a WriteAtBuffer with an internal buffer +// provided by buf. +func NewWriteAtBuffer(buf []byte) *WriteAtBuffer { + return &WriteAtBuffer{buf: buf} } // WriteAt writes a slice of bytes to a buffer starting at the position provided // The number of bytes written will be returned, or error. Can overwrite previous // written slices if the write ats overlap. func (b *WriteAtBuffer) WriteAt(p []byte, pos int64) (n int, err error) { + pLen := len(p) + expLen := pos + int64(pLen) b.m.Lock() defer b.m.Unlock() - - expLen := pos + int64(len(p)) if int64(len(b.buf)) < expLen { - newBuf := make([]byte, expLen) - copy(newBuf, b.buf) - b.buf = newBuf + if int64(cap(b.buf)) < expLen { + if b.GrowthCoeff < 1 { + b.GrowthCoeff = 1 + } + newBuf := make([]byte, expLen, int64(b.GrowthCoeff*float64(expLen))) + copy(newBuf, b.buf) + b.buf = newBuf + } + b.buf = b.buf[:expLen] } copy(b.buf[pos:], p) - return len(p), nil + return pLen, nil } // Bytes returns a slice of bytes written to the buffer. diff --git a/vendor/github.com/aws/aws-sdk-go/aws/version.go b/vendor/github.com/aws/aws-sdk-go/aws/version.go index 1a9a5a853..c87a0c256 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/version.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/version.go @@ -5,4 +5,4 @@ package aws const SDKName = "aws-sdk-go" // SDKVersion is the version of this SDK -const SDKVersion = "1.1.2" +const SDKVersion = "1.4.6" diff --git a/vendor/github.com/aws/aws-sdk-go/private/endpoints/endpoints.go b/vendor/github.com/aws/aws-sdk-go/private/endpoints/endpoints.go index 2b279e659..b4ad7405c 100644 --- a/vendor/github.com/aws/aws-sdk-go/private/endpoints/endpoints.go +++ b/vendor/github.com/aws/aws-sdk-go/private/endpoints/endpoints.go @@ -14,9 +14,9 @@ import ( // normalized endpoint and signing region. If the endpoint is not an empty string // the service name and region will be used to look up the service's API endpoint. // If the endpoint is provided the scheme will be added if it is not present. -func NormalizeEndpoint(endpoint, serviceName, region string, disableSSL bool) (normEndpoint, signingRegion string) { +func NormalizeEndpoint(endpoint, serviceName, region string, disableSSL, useDualStack bool) (normEndpoint, signingRegion string) { if endpoint == "" { - return EndpointForRegion(serviceName, region, disableSSL) + return EndpointForRegion(serviceName, region, disableSSL, useDualStack) } return AddScheme(endpoint, disableSSL), "" @@ -24,12 +24,17 @@ func NormalizeEndpoint(endpoint, serviceName, region string, disableSSL bool) (n // 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, disableSSL bool) (endpoint, signingRegion string) { +func EndpointForRegion(svcName, region string, disableSSL, useDualStack bool) (endpoint, signingRegion string) { + dualStackField := "" + if useDualStack { + dualStackField = "/dualstack" + } + derivedKeys := []string{ - region + "/" + svcName, - region + "/*", - "*/" + svcName, - "*/*", + region + "/" + svcName + dualStackField, + region + "/*" + dualStackField, + "*/" + svcName + dualStackField, + "*/*" + dualStackField, } for _, key := range derivedKeys { diff --git a/vendor/github.com/aws/aws-sdk-go/private/endpoints/endpoints.json b/vendor/github.com/aws/aws-sdk-go/private/endpoints/endpoints.json index 7819eedc3..c5bf3c7c3 100644 --- a/vendor/github.com/aws/aws-sdk-go/private/endpoints/endpoints.json +++ b/vendor/github.com/aws/aws-sdk-go/private/endpoints/endpoints.json @@ -8,6 +8,9 @@ "endpoint": "{service}.{region}.amazonaws.com.cn", "signatureVersion": "v4" }, + "cn-north-1/ec2metadata": { + "endpoint": "http://169.254.169.254/latest" + }, "us-gov-west-1/iam": { "endpoint": "iam.us-gov.amazonaws.com" }, @@ -17,6 +20,9 @@ "us-gov-west-1/s3": { "endpoint": "s3-{region}.amazonaws.com" }, + "us-gov-west-1/ec2metadata": { + "endpoint": "http://169.254.169.254/latest" + }, "*/cloudfront": { "endpoint": "cloudfront.amazonaws.com", "signingRegion": "us-east-1" @@ -30,8 +36,7 @@ "signingRegion": "us-east-1" }, "*/ec2metadata": { - "endpoint": "http://169.254.169.254/latest", - "signingRegion": "us-east-1" + "endpoint": "http://169.254.169.254/latest" }, "*/iam": { "endpoint": "iam.amazonaws.com", @@ -57,36 +62,17 @@ "endpoint": "sdb.amazonaws.com", "signingRegion": "us-east-1" }, + "*/s3": { + "endpoint": "s3-{region}.amazonaws.com" + }, + "*/s3/dualstack": { + "endpoint": "s3.dualstack.{region}.amazonaws.com" + }, "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" - }, - "ap-northeast-2/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" + "endpoint": "{service}.{region}.amazonaws.com" } } } diff --git a/vendor/github.com/aws/aws-sdk-go/private/endpoints/endpoints_map.go b/vendor/github.com/aws/aws-sdk-go/private/endpoints/endpoints_map.go index 9b2e1b699..a81d158c3 100644 --- a/vendor/github.com/aws/aws-sdk-go/private/endpoints/endpoints_map.go +++ b/vendor/github.com/aws/aws-sdk-go/private/endpoints/endpoints_map.go @@ -31,8 +31,7 @@ var endpointsMap = endpointStruct{ SigningRegion: "us-east-1", }, "*/ec2metadata": { - Endpoint: "http://169.254.169.254/latest", - SigningRegion: "us-east-1", + Endpoint: "http://169.254.169.254/latest", }, "*/iam": { Endpoint: "iam.amazonaws.com", @@ -46,6 +45,12 @@ var endpointsMap = endpointStruct{ Endpoint: "route53.amazonaws.com", SigningRegion: "us-east-1", }, + "*/s3": { + Endpoint: "s3-{region}.amazonaws.com", + }, + "*/s3/dualstack": { + Endpoint: "s3.dualstack.{region}.amazonaws.com", + }, "*/sts": { Endpoint: "sts.amazonaws.com", SigningRegion: "us-east-1", @@ -54,30 +59,15 @@ var endpointsMap = endpointStruct{ Endpoint: "waf.amazonaws.com", SigningRegion: "us-east-1", }, - "ap-northeast-1/s3": { - Endpoint: "s3-{region}.amazonaws.com", - }, - "ap-northeast-2/s3": { - Endpoint: "s3-{region}.amazonaws.com", - }, - "ap-southeast-1/s3": { - Endpoint: "s3-{region}.amazonaws.com", - }, - "ap-southeast-2/s3": { - Endpoint: "s3-{region}.amazonaws.com", - }, "cn-north-1/*": { Endpoint: "{service}.{region}.amazonaws.com.cn", }, + "cn-north-1/ec2metadata": { + Endpoint: "http://169.254.169.254/latest", + }, "eu-central-1/s3": { Endpoint: "{service}.{region}.amazonaws.com", }, - "eu-west-1/s3": { - Endpoint: "s3-{region}.amazonaws.com", - }, - "sa-east-1/s3": { - Endpoint: "s3-{region}.amazonaws.com", - }, "us-east-1/s3": { Endpoint: "s3.amazonaws.com", }, @@ -85,6 +75,9 @@ var endpointsMap = endpointStruct{ Endpoint: "sdb.amazonaws.com", SigningRegion: "us-east-1", }, + "us-gov-west-1/ec2metadata": { + Endpoint: "http://169.254.169.254/latest", + }, "us-gov-west-1/iam": { Endpoint: "iam.us-gov.amazonaws.com", }, @@ -94,11 +87,5 @@ var endpointsMap = endpointStruct{ "us-gov-west-1/sts": { Endpoint: "sts.us-gov-west-1.amazonaws.com", }, - "us-west-1/s3": { - Endpoint: "s3-{region}.amazonaws.com", - }, - "us-west-2/s3": { - Endpoint: "s3-{region}.amazonaws.com", - }, }, } diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/ec2query/build.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/ec2query/build.go index 68e344d1f..bb0dae97a 100644 --- a/vendor/github.com/aws/aws-sdk-go/private/protocol/ec2query/build.go +++ b/vendor/github.com/aws/aws-sdk-go/private/protocol/ec2query/build.go @@ -1,4 +1,4 @@ -// Package ec2query provides serialisation of AWS EC2 requests and responses. +// Package ec2query provides serialization of AWS EC2 requests and responses. package ec2query //go:generate go run ../../../models/protocol_tests/generate.go ../../../models/protocol_tests/input/ec2.json build_test.go diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/ec2query/unmarshal.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/ec2query/unmarshal.go index 9223e8422..631e63c0b 100644 --- a/vendor/github.com/aws/aws-sdk-go/private/protocol/ec2query/unmarshal.go +++ b/vendor/github.com/aws/aws-sdk-go/private/protocol/ec2query/unmarshal.go @@ -42,7 +42,7 @@ type xmlErrorResponse struct { XMLName xml.Name `xml:"Response"` Code string `xml:"Errors>Error>Code"` Message string `xml:"Errors>Error>Message"` - RequestID string `xml:"RequestId"` + RequestID string `xml:"RequestID"` } // UnmarshalError unmarshals a response error for the EC2 protocol. diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/json/jsonutil/build.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/json/jsonutil/build.go index 1d552afe4..4504efe2b 100644 --- a/vendor/github.com/aws/aws-sdk-go/private/protocol/json/jsonutil/build.go +++ b/vendor/github.com/aws/aws-sdk-go/private/protocol/json/jsonutil/build.go @@ -1,4 +1,4 @@ -// Package jsonutil provides JSON serialisation of AWS requests and responses. +// Package jsonutil provides JSON serialization of AWS requests and responses. package jsonutil import ( @@ -120,7 +120,8 @@ func buildStruct(value reflect.Value, buf *bytes.Buffer, tag reflect.StructTag) name = locName } - fmt.Fprintf(buf, "%q:", name) + writeString(name, buf) + buf.WriteString(`:`) err := buildAny(member, buf, field.Tag) if err != nil { @@ -159,7 +160,7 @@ func (sv sortedValues) Less(i, j int) bool { return sv[i].String() < sv[j].Strin func buildMap(value reflect.Value, buf *bytes.Buffer, tag reflect.StructTag) error { buf.WriteString("{") - var sv sortedValues = value.MapKeys() + sv := sortedValues(value.MapKeys()) sort.Sort(sv) for i, k := range sv { @@ -167,7 +168,9 @@ func buildMap(value reflect.Value, buf *bytes.Buffer, tag reflect.StructTag) err buf.WriteByte(',') } - fmt.Fprintf(buf, "%q:", k) + writeString(k.String(), buf) + buf.WriteString(`:`) + buildAny(value.MapIndex(k), buf, "") } diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/jsonrpc/jsonrpc.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/jsonrpc/jsonrpc.go index 7aff0e0fa..d5490cd7f 100644 --- a/vendor/github.com/aws/aws-sdk-go/private/protocol/jsonrpc/jsonrpc.go +++ b/vendor/github.com/aws/aws-sdk-go/private/protocol/jsonrpc/jsonrpc.go @@ -1,4 +1,4 @@ -// Package jsonrpc provides JSON RPC utilities for serialisation of AWS +// Package jsonrpc provides JSON RPC utilities for serialization of AWS // requests and responses. package jsonrpc diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/query/build.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/query/build.go index 56d69db05..c705481c3 100644 --- a/vendor/github.com/aws/aws-sdk-go/private/protocol/query/build.go +++ b/vendor/github.com/aws/aws-sdk-go/private/protocol/query/build.go @@ -1,4 +1,4 @@ -// Package query provides serialisation of AWS query requests, and responses. +// Package query provides serialization of AWS query requests, and responses. package query //go:generate go run ../../../models/protocol_tests/generate.go ../../../models/protocol_tests/input/query.json build_test.go diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/query/unmarshal_error.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/query/unmarshal_error.go index b8e3c7a31..f21429617 100644 --- a/vendor/github.com/aws/aws-sdk-go/private/protocol/query/unmarshal_error.go +++ b/vendor/github.com/aws/aws-sdk-go/private/protocol/query/unmarshal_error.go @@ -2,7 +2,7 @@ package query import ( "encoding/xml" - "io" + "io/ioutil" "github.com/aws/aws-sdk-go/aws/awserr" "github.com/aws/aws-sdk-go/aws/request" @@ -15,6 +15,10 @@ type xmlErrorResponse struct { RequestID string `xml:"RequestId"` } +type xmlServiceUnavailableResponse struct { + XMLName xml.Name `xml:"ServiceUnavailableException"` +} + // UnmarshalErrorHandler is a name request handler to unmarshal request errors var UnmarshalErrorHandler = request.NamedHandler{Name: "awssdk.query.UnmarshalError", Fn: UnmarshalError} @@ -22,11 +26,16 @@ var UnmarshalErrorHandler = request.NamedHandler{Name: "awssdk.query.UnmarshalEr func UnmarshalError(r *request.Request) { defer r.HTTPResponse.Body.Close() - resp := &xmlErrorResponse{} - err := xml.NewDecoder(r.HTTPResponse.Body).Decode(resp) - if err != nil && err != io.EOF { - r.Error = awserr.New("SerializationError", "failed to decode query XML error response", err) - } else { + bodyBytes, err := ioutil.ReadAll(r.HTTPResponse.Body) + if err != nil { + r.Error = awserr.New("SerializationError", "failed to read from query HTTP response body", err) + return + } + + // First check for specific error + resp := xmlErrorResponse{} + decodeErr := xml.Unmarshal(bodyBytes, &resp) + if decodeErr == nil { reqID := resp.RequestID if reqID == "" { reqID = r.RequestID @@ -36,5 +45,22 @@ func UnmarshalError(r *request.Request) { r.HTTPResponse.StatusCode, reqID, ) + return } + + // Check for unhandled error + servUnavailResp := xmlServiceUnavailableResponse{} + unavailErr := xml.Unmarshal(bodyBytes, &servUnavailResp) + if unavailErr == nil { + r.Error = awserr.NewRequestFailure( + awserr.New("ServiceUnavailableException", "service is unavailable", nil), + r.HTTPResponse.StatusCode, + r.RequestID, + ) + return + } + + // Failed to retrieve any error message from the response body + r.Error = awserr.New("SerializationError", + "failed to decode query XML error response", decodeErr) } diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/rest/build.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/rest/build.go index 5469edb60..5f412516d 100644 --- a/vendor/github.com/aws/aws-sdk-go/private/protocol/rest/build.go +++ b/vendor/github.com/aws/aws-sdk-go/private/protocol/rest/build.go @@ -222,8 +222,7 @@ func EscapePath(path string, encodeSep bool) string { if noEscape[c] || (c == '/' && !encodeSep) { buf.WriteByte(c) } else { - buf.WriteByte('%') - buf.WriteString(strings.ToUpper(strconv.FormatUint(uint64(c), 16))) + fmt.Fprintf(&buf, "%%%02X", c) } } return buf.String() diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/rest/unmarshal.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/rest/unmarshal.go index ba46f5bc9..2cba1d9aa 100644 --- a/vendor/github.com/aws/aws-sdk-go/private/protocol/rest/unmarshal.go +++ b/vendor/github.com/aws/aws-sdk-go/private/protocol/rest/unmarshal.go @@ -3,6 +3,7 @@ package rest import ( "encoding/base64" "fmt" + "io" "io/ioutil" "net/http" "reflect" @@ -51,6 +52,7 @@ func unmarshalBody(r *request.Request, v reflect.Value) { if payload.IsValid() { switch payload.Interface().(type) { case []byte: + defer r.HTTPResponse.Body.Close() b, err := ioutil.ReadAll(r.HTTPResponse.Body) if err != nil { r.Error = awserr.New("SerializationError", "failed to decode REST response", err) @@ -58,6 +60,7 @@ func unmarshalBody(r *request.Request, v reflect.Value) { payload.Set(reflect.ValueOf(b)) } case *string: + defer r.HTTPResponse.Body.Close() b, err := ioutil.ReadAll(r.HTTPResponse.Body) if err != nil { r.Error = awserr.New("SerializationError", "failed to decode REST response", err) @@ -72,6 +75,8 @@ func unmarshalBody(r *request.Request, v reflect.Value) { case "aws.ReadSeekCloser", "io.ReadCloser": payload.Set(reflect.ValueOf(r.HTTPResponse.Body)) default: + io.Copy(ioutil.Discard, r.HTTPResponse.Body) + defer r.HTTPResponse.Body.Close() r.Error = awserr.New("SerializationError", "failed to decode REST response", fmt.Errorf("unknown payload type %s", payload.Type())) diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/restjson/restjson.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/restjson/restjson.go deleted file mode 100644 index 5a0877cb1..000000000 --- a/vendor/github.com/aws/aws-sdk-go/private/protocol/restjson/restjson.go +++ /dev/null @@ -1,91 +0,0 @@ -// Package restjson provides RESTful JSON serialisation of AWS -// requests and responses. -package restjson - -//go:generate go run ../../../models/protocol_tests/generate.go ../../../models/protocol_tests/input/rest-json.json build_test.go -//go:generate go run ../../../models/protocol_tests/generate.go ../../../models/protocol_tests/output/rest-json.json unmarshal_test.go - -import ( - "encoding/json" - "io/ioutil" - "strings" - - "github.com/aws/aws-sdk-go/aws/awserr" - "github.com/aws/aws-sdk-go/aws/request" - "github.com/aws/aws-sdk-go/private/protocol/jsonrpc" - "github.com/aws/aws-sdk-go/private/protocol/rest" -) - -// BuildHandler is a named request handler for building restjson protocol requests -var BuildHandler = request.NamedHandler{Name: "awssdk.restjson.Build", Fn: Build} - -// UnmarshalHandler is a named request handler for unmarshaling restjson protocol requests -var UnmarshalHandler = request.NamedHandler{Name: "awssdk.restjson.Unmarshal", Fn: Unmarshal} - -// UnmarshalMetaHandler is a named request handler for unmarshaling restjson protocol request metadata -var UnmarshalMetaHandler = request.NamedHandler{Name: "awssdk.restjson.UnmarshalMeta", Fn: UnmarshalMeta} - -// UnmarshalErrorHandler is a named request handler for unmarshaling restjson protocol request errors -var UnmarshalErrorHandler = request.NamedHandler{Name: "awssdk.restjson.UnmarshalError", Fn: UnmarshalError} - -// Build builds a request for the REST JSON protocol. -func Build(r *request.Request) { - rest.Build(r) - - if t := rest.PayloadType(r.Params); t == "structure" || t == "" { - jsonrpc.Build(r) - } -} - -// Unmarshal unmarshals a response body for the REST JSON protocol. -func Unmarshal(r *request.Request) { - if t := rest.PayloadType(r.Data); t == "structure" || t == "" { - jsonrpc.Unmarshal(r) - } else { - rest.Unmarshal(r) - } -} - -// UnmarshalMeta unmarshals response headers for the REST JSON protocol. -func UnmarshalMeta(r *request.Request) { - rest.UnmarshalMeta(r) -} - -// UnmarshalError unmarshals a response error for the REST JSON protocol. -func UnmarshalError(r *request.Request) { - code := r.HTTPResponse.Header.Get("X-Amzn-Errortype") - bodyBytes, err := ioutil.ReadAll(r.HTTPResponse.Body) - if err != nil { - r.Error = awserr.New("SerializationError", "failed reading REST JSON error response", err) - return - } - if len(bodyBytes) == 0 { - r.Error = awserr.NewRequestFailure( - awserr.New("SerializationError", r.HTTPResponse.Status, nil), - r.HTTPResponse.StatusCode, - "", - ) - return - } - var jsonErr jsonErrorResponse - if err := json.Unmarshal(bodyBytes, &jsonErr); err != nil { - r.Error = awserr.New("SerializationError", "failed decoding REST JSON error response", err) - return - } - - if code == "" { - code = jsonErr.Code - } - - code = strings.SplitN(code, ":", 2)[0] - r.Error = awserr.NewRequestFailure( - awserr.New(code, jsonErr.Message, nil), - r.HTTPResponse.StatusCode, - r.RequestID, - ) -} - -type jsonErrorResponse struct { - Code string `json:"code"` - Message string `json:"message"` -} diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/restxml/restxml.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/restxml/restxml.go index c74088bfe..c74b97e17 100644 --- a/vendor/github.com/aws/aws-sdk-go/private/protocol/restxml/restxml.go +++ b/vendor/github.com/aws/aws-sdk-go/private/protocol/restxml/restxml.go @@ -1,4 +1,4 @@ -// Package restxml provides RESTful XML serialisation of AWS +// Package restxml provides RESTful XML serialization of AWS // requests and responses. package restxml diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil/build.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil/build.go index ceb4132c5..221029baf 100644 --- a/vendor/github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil/build.go +++ b/vendor/github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil/build.go @@ -1,4 +1,4 @@ -// Package xmlutil provides XML serialisation of AWS requests and responses. +// Package xmlutil provides XML serialization of AWS requests and responses. package xmlutil import ( diff --git a/vendor/github.com/aws/aws-sdk-go/private/signer/v4/v4.go b/vendor/github.com/aws/aws-sdk-go/private/signer/v4/v4.go deleted file mode 100644 index 14b0c6616..000000000 --- a/vendor/github.com/aws/aws-sdk-go/private/signer/v4/v4.go +++ /dev/null @@ -1,438 +0,0 @@ -// Package v4 implements signing for AWS V4 signer -package v4 - -import ( - "crypto/hmac" - "crypto/sha256" - "encoding/hex" - "fmt" - "io" - "net/http" - "net/url" - "sort" - "strconv" - "strings" - "time" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/credentials" - "github.com/aws/aws-sdk-go/aws/request" - "github.com/aws/aws-sdk-go/private/protocol/rest" -) - -const ( - authHeaderPrefix = "AWS4-HMAC-SHA256" - timeFormat = "20060102T150405Z" - shortTimeFormat = "20060102" -) - -var ignoredHeaders = rules{ - blacklist{ - mapRule{ - "Content-Length": struct{}{}, - "User-Agent": struct{}{}, - }, - }, -} - -// requiredSignedHeaders is a whitelist for build canonical headers. -var requiredSignedHeaders = rules{ - whitelist{ - mapRule{ - "Cache-Control": struct{}{}, - "Content-Disposition": struct{}{}, - "Content-Encoding": struct{}{}, - "Content-Language": struct{}{}, - "Content-Md5": struct{}{}, - "Content-Type": struct{}{}, - "Expires": struct{}{}, - "If-Match": struct{}{}, - "If-Modified-Since": struct{}{}, - "If-None-Match": struct{}{}, - "If-Unmodified-Since": struct{}{}, - "Range": struct{}{}, - "X-Amz-Acl": struct{}{}, - "X-Amz-Copy-Source": struct{}{}, - "X-Amz-Copy-Source-If-Match": struct{}{}, - "X-Amz-Copy-Source-If-Modified-Since": struct{}{}, - "X-Amz-Copy-Source-If-None-Match": struct{}{}, - "X-Amz-Copy-Source-If-Unmodified-Since": struct{}{}, - "X-Amz-Copy-Source-Range": struct{}{}, - "X-Amz-Copy-Source-Server-Side-Encryption-Customer-Algorithm": struct{}{}, - "X-Amz-Copy-Source-Server-Side-Encryption-Customer-Key": struct{}{}, - "X-Amz-Copy-Source-Server-Side-Encryption-Customer-Key-Md5": struct{}{}, - "X-Amz-Grant-Full-control": struct{}{}, - "X-Amz-Grant-Read": struct{}{}, - "X-Amz-Grant-Read-Acp": struct{}{}, - "X-Amz-Grant-Write": struct{}{}, - "X-Amz-Grant-Write-Acp": struct{}{}, - "X-Amz-Metadata-Directive": struct{}{}, - "X-Amz-Mfa": struct{}{}, - "X-Amz-Request-Payer": struct{}{}, - "X-Amz-Server-Side-Encryption": struct{}{}, - "X-Amz-Server-Side-Encryption-Aws-Kms-Key-Id": struct{}{}, - "X-Amz-Server-Side-Encryption-Customer-Algorithm": struct{}{}, - "X-Amz-Server-Side-Encryption-Customer-Key": struct{}{}, - "X-Amz-Server-Side-Encryption-Customer-Key-Md5": struct{}{}, - "X-Amz-Storage-Class": struct{}{}, - "X-Amz-Website-Redirect-Location": struct{}{}, - }, - }, - patterns{"X-Amz-Meta-"}, -} - -// allowedHoisting is a whitelist for build query headers. The boolean value -// represents whether or not it is a pattern. -var allowedQueryHoisting = inclusiveRules{ - blacklist{requiredSignedHeaders}, - patterns{"X-Amz-"}, -} - -type signer struct { - Request *http.Request - Time time.Time - ExpireTime time.Duration - ServiceName string - Region string - CredValues credentials.Value - Credentials *credentials.Credentials - Query url.Values - Body io.ReadSeeker - Debug aws.LogLevelType - Logger aws.Logger - - isPresign bool - formattedTime string - formattedShortTime string - - signedHeaders string - canonicalHeaders string - canonicalString string - credentialString string - stringToSign string - signature string - authorization string - notHoist bool - signedHeaderVals http.Header -} - -// 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 *request.Request) { - // If the request does not need to be signed ignore the signing of the - // request if the AnonymousCredentials object is used. - if req.Config.Credentials == credentials.AnonymousCredentials { - return - } - - region := req.ClientInfo.SigningRegion - if region == "" { - region = aws.StringValue(req.Config.Region) - } - - name := req.ClientInfo.SigningName - if name == "" { - name = req.ClientInfo.ServiceName - } - - s := signer{ - Request: req.HTTPRequest, - Time: req.Time, - ExpireTime: req.ExpireTime, - Query: req.HTTPRequest.URL.Query(), - Body: req.Body, - ServiceName: name, - Region: region, - Credentials: req.Config.Credentials, - Debug: req.Config.LogLevel.Value(), - Logger: req.Config.Logger, - notHoist: req.NotHoist, - } - - req.Error = s.sign() - req.SignedHeaderVals = s.signedHeaderVals -} - -func (v4 *signer) sign() error { - if v4.ExpireTime != 0 { - v4.isPresign = true - } - - if v4.isRequestSigned() { - if !v4.Credentials.IsExpired() { - // If the request is already signed, and the credentials have not - // expired yet ignore the signing request. - return nil - } - - // The credentials have expired for this request. The current signing - // is invalid, and needs to be request because the request will fail. - if v4.isPresign { - v4.removePresign() - // Update the request's query string to ensure the values stays in - // sync in the case retrieving the new credentials fails. - v4.Request.URL.RawQuery = v4.Query.Encode() - } - } - - var err error - v4.CredValues, err = v4.Credentials.Get() - if err != nil { - return err - } - - if v4.isPresign { - v4.Query.Set("X-Amz-Algorithm", authHeaderPrefix) - if v4.CredValues.SessionToken != "" { - v4.Query.Set("X-Amz-Security-Token", v4.CredValues.SessionToken) - } else { - v4.Query.Del("X-Amz-Security-Token") - } - } else if v4.CredValues.SessionToken != "" { - v4.Request.Header.Set("X-Amz-Security-Token", v4.CredValues.SessionToken) - } - - v4.build() - - if v4.Debug.Matches(aws.LogDebugWithSigning) { - v4.logSigningInfo() - } - - return nil -} - -const logSignInfoMsg = `DEBUG: Request Signiture: ----[ CANONICAL STRING ]----------------------------- -%s ----[ STRING TO SIGN ]-------------------------------- -%s%s ------------------------------------------------------` -const logSignedURLMsg = ` ----[ SIGNED URL ]------------------------------------ -%s` - -func (v4 *signer) logSigningInfo() { - signedURLMsg := "" - if v4.isPresign { - signedURLMsg = fmt.Sprintf(logSignedURLMsg, v4.Request.URL.String()) - } - msg := fmt.Sprintf(logSignInfoMsg, v4.canonicalString, v4.stringToSign, signedURLMsg) - v4.Logger.Log(msg) -} - -func (v4 *signer) build() { - - v4.buildTime() // no depends - v4.buildCredentialString() // no depends - - unsignedHeaders := v4.Request.Header - if v4.isPresign { - if !v4.notHoist { - urlValues := url.Values{} - urlValues, unsignedHeaders = buildQuery(allowedQueryHoisting, unsignedHeaders) // no depends - for k := range urlValues { - v4.Query[k] = urlValues[k] - } - } - } - - v4.buildCanonicalHeaders(ignoredHeaders, unsignedHeaders) - v4.buildCanonicalString() // depends on canon headers / signed headers - v4.buildStringToSign() // depends on canon string - v4.buildSignature() // depends on string to sign - - if v4.isPresign { - v4.Request.URL.RawQuery += "&X-Amz-Signature=" + v4.signature - } else { - parts := []string{ - authHeaderPrefix + " Credential=" + v4.CredValues.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.CredValues.AccessKeyID+"/"+v4.credentialString) - } -} - -func buildQuery(r rule, header http.Header) (url.Values, http.Header) { - query := url.Values{} - unsignedHeaders := http.Header{} - for k, h := range header { - if r.IsValid(k) { - query[k] = h - } else { - unsignedHeaders[k] = h - } - } - - return query, unsignedHeaders -} -func (v4 *signer) buildCanonicalHeaders(r rule, header http.Header) { - var headers []string - headers = append(headers, "host") - for k, v := range header { - canonicalKey := http.CanonicalHeaderKey(k) - if !r.IsValid(canonicalKey) { - continue // ignored header - } - - lowerCaseKey := strings.ToLower(k) - headers = append(headers, lowerCaseKey) - - if v4.signedHeaderVals == nil { - v4.signedHeaderVals = make(http.Header) - } - v4.signedHeaderVals[lowerCaseKey] = v - } - 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 = "/" - } - - if v4.ServiceName != "s3" { - uri = rest.EscapePath(uri, false) - } - - 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.CredValues.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 -} - -// isRequestSigned returns if the request is currently signed or presigned -func (v4 *signer) isRequestSigned() bool { - if v4.isPresign && v4.Query.Get("X-Amz-Signature") != "" { - return true - } - if v4.Request.Header.Get("Authorization") != "" { - return true - } - - return false -} - -// unsign removes signing flags for both signed and presigned requests. -func (v4 *signer) removePresign() { - v4.Query.Del("X-Amz-Algorithm") - v4.Query.Del("X-Amz-Signature") - v4.Query.Del("X-Amz-Security-Token") - v4.Query.Del("X-Amz-Date") - v4.Query.Del("X-Amz-Expires") - v4.Query.Del("X-Amz-Credential") - v4.Query.Del("X-Amz-SignedHeaders") -} - -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 { - hash := sha256.New() - start, _ := reader.Seek(0, 1) - defer reader.Seek(start, 0) - - io.Copy(hash, reader) - return hash.Sum(nil) -} diff --git a/vendor/github.com/aws/aws-sdk-go/service/ec2/api.go b/vendor/github.com/aws/aws-sdk-go/service/ec2/api.go index f4c4fb46a..0b4c51a81 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/ec2/api.go +++ b/vendor/github.com/aws/aws-sdk-go/service/ec2/api.go @@ -4,6 +4,7 @@ package ec2 import ( + "fmt" "time" "github.com/aws/aws-sdk-go/aws/awsutil" @@ -14,7 +15,28 @@ import ( const opAcceptVpcPeeringConnection = "AcceptVpcPeeringConnection" -// AcceptVpcPeeringConnectionRequest generates a request for the AcceptVpcPeeringConnection operation. +// AcceptVpcPeeringConnectionRequest generates a "aws/request.Request" representing the +// client's request for the AcceptVpcPeeringConnection operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the AcceptVpcPeeringConnection method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the AcceptVpcPeeringConnectionRequest method. +// req, resp := client.AcceptVpcPeeringConnectionRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) AcceptVpcPeeringConnectionRequest(input *AcceptVpcPeeringConnectionInput) (req *request.Request, output *AcceptVpcPeeringConnectionOutput) { op := &request.Operation{ Name: opAcceptVpcPeeringConnection, @@ -44,7 +66,28 @@ func (c *EC2) AcceptVpcPeeringConnection(input *AcceptVpcPeeringConnectionInput) const opAllocateAddress = "AllocateAddress" -// AllocateAddressRequest generates a request for the AllocateAddress operation. +// AllocateAddressRequest generates a "aws/request.Request" representing the +// client's request for the AllocateAddress operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the AllocateAddress method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the AllocateAddressRequest method. +// req, resp := client.AllocateAddressRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) AllocateAddressRequest(input *AllocateAddressInput) (req *request.Request, output *AllocateAddressOutput) { op := &request.Operation{ Name: opAllocateAddress, @@ -75,7 +118,28 @@ func (c *EC2) AllocateAddress(input *AllocateAddressInput) (*AllocateAddressOutp const opAllocateHosts = "AllocateHosts" -// AllocateHostsRequest generates a request for the AllocateHosts operation. +// AllocateHostsRequest generates a "aws/request.Request" representing the +// client's request for the AllocateHosts operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the AllocateHosts method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the AllocateHostsRequest method. +// req, resp := client.AllocateHostsRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) AllocateHostsRequest(input *AllocateHostsInput) (req *request.Request, output *AllocateHostsOutput) { op := &request.Operation{ Name: opAllocateHosts, @@ -93,7 +157,7 @@ func (c *EC2) AllocateHostsRequest(input *AllocateHostsInput) (req *request.Requ return } -// Allocates a Dedicated host to your account. At minimum you need to specify +// Allocates a Dedicated Host to your account. At minimum you need to specify // the instance size type, Availability Zone, and quantity of hosts you want // to allocate. func (c *EC2) AllocateHosts(input *AllocateHostsInput) (*AllocateHostsOutput, error) { @@ -104,7 +168,28 @@ func (c *EC2) AllocateHosts(input *AllocateHostsInput) (*AllocateHostsOutput, er const opAssignPrivateIpAddresses = "AssignPrivateIpAddresses" -// AssignPrivateIpAddressesRequest generates a request for the AssignPrivateIpAddresses operation. +// AssignPrivateIpAddressesRequest generates a "aws/request.Request" representing the +// client's request for the AssignPrivateIpAddresses operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the AssignPrivateIpAddresses method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the AssignPrivateIpAddressesRequest method. +// req, resp := client.AssignPrivateIpAddressesRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) AssignPrivateIpAddressesRequest(input *AssignPrivateIpAddressesInput) (req *request.Request, output *AssignPrivateIpAddressesOutput) { op := &request.Operation{ Name: opAssignPrivateIpAddresses, @@ -143,7 +228,28 @@ func (c *EC2) AssignPrivateIpAddresses(input *AssignPrivateIpAddressesInput) (*A const opAssociateAddress = "AssociateAddress" -// AssociateAddressRequest generates a request for the AssociateAddress operation. +// AssociateAddressRequest generates a "aws/request.Request" representing the +// client's request for the AssociateAddress operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the AssociateAddress method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the AssociateAddressRequest method. +// req, resp := client.AssociateAddressRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) AssociateAddressRequest(input *AssociateAddressInput) (req *request.Request, output *AssociateAddressOutput) { op := &request.Operation{ Name: opAssociateAddress, @@ -186,7 +292,28 @@ func (c *EC2) AssociateAddress(input *AssociateAddressInput) (*AssociateAddressO const opAssociateDhcpOptions = "AssociateDhcpOptions" -// AssociateDhcpOptionsRequest generates a request for the AssociateDhcpOptions operation. +// AssociateDhcpOptionsRequest generates a "aws/request.Request" representing the +// client's request for the AssociateDhcpOptions operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the AssociateDhcpOptions method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the AssociateDhcpOptionsRequest method. +// req, resp := client.AssociateDhcpOptionsRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) AssociateDhcpOptionsRequest(input *AssociateDhcpOptionsInput) (req *request.Request, output *AssociateDhcpOptionsOutput) { op := &request.Operation{ Name: opAssociateDhcpOptions, @@ -226,7 +353,28 @@ func (c *EC2) AssociateDhcpOptions(input *AssociateDhcpOptionsInput) (*Associate const opAssociateRouteTable = "AssociateRouteTable" -// AssociateRouteTableRequest generates a request for the AssociateRouteTable operation. +// AssociateRouteTableRequest generates a "aws/request.Request" representing the +// client's request for the AssociateRouteTable operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the AssociateRouteTable method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the AssociateRouteTableRequest method. +// req, resp := client.AssociateRouteTableRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) AssociateRouteTableRequest(input *AssociateRouteTableInput) (req *request.Request, output *AssociateRouteTableOutput) { op := &request.Operation{ Name: opAssociateRouteTable, @@ -260,7 +408,28 @@ func (c *EC2) AssociateRouteTable(input *AssociateRouteTableInput) (*AssociateRo const opAttachClassicLinkVpc = "AttachClassicLinkVpc" -// AttachClassicLinkVpcRequest generates a request for the AttachClassicLinkVpc operation. +// AttachClassicLinkVpcRequest generates a "aws/request.Request" representing the +// client's request for the AttachClassicLinkVpc operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the AttachClassicLinkVpc method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the AttachClassicLinkVpcRequest method. +// req, resp := client.AttachClassicLinkVpcRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) AttachClassicLinkVpcRequest(input *AttachClassicLinkVpcInput) (req *request.Request, output *AttachClassicLinkVpcOutput) { op := &request.Operation{ Name: opAttachClassicLinkVpc, @@ -298,7 +467,28 @@ func (c *EC2) AttachClassicLinkVpc(input *AttachClassicLinkVpcInput) (*AttachCla const opAttachInternetGateway = "AttachInternetGateway" -// AttachInternetGatewayRequest generates a request for the AttachInternetGateway operation. +// AttachInternetGatewayRequest generates a "aws/request.Request" representing the +// client's request for the AttachInternetGateway operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the AttachInternetGateway method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the AttachInternetGatewayRequest method. +// req, resp := client.AttachInternetGatewayRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) AttachInternetGatewayRequest(input *AttachInternetGatewayInput) (req *request.Request, output *AttachInternetGatewayOutput) { op := &request.Operation{ Name: opAttachInternetGateway, @@ -329,7 +519,28 @@ func (c *EC2) AttachInternetGateway(input *AttachInternetGatewayInput) (*AttachI const opAttachNetworkInterface = "AttachNetworkInterface" -// AttachNetworkInterfaceRequest generates a request for the AttachNetworkInterface operation. +// AttachNetworkInterfaceRequest generates a "aws/request.Request" representing the +// client's request for the AttachNetworkInterface operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the AttachNetworkInterface method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the AttachNetworkInterfaceRequest method. +// req, resp := client.AttachNetworkInterfaceRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) AttachNetworkInterfaceRequest(input *AttachNetworkInterfaceInput) (req *request.Request, output *AttachNetworkInterfaceOutput) { op := &request.Operation{ Name: opAttachNetworkInterface, @@ -356,7 +567,28 @@ func (c *EC2) AttachNetworkInterface(input *AttachNetworkInterfaceInput) (*Attac const opAttachVolume = "AttachVolume" -// AttachVolumeRequest generates a request for the AttachVolume operation. +// AttachVolumeRequest generates a "aws/request.Request" representing the +// client's request for the AttachVolume operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the AttachVolume method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the AttachVolumeRequest method. +// req, resp := client.AttachVolumeRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) AttachVolumeRequest(input *AttachVolumeInput) (req *request.Request, output *VolumeAttachment) { op := &request.Operation{ Name: opAttachVolume, @@ -389,12 +621,18 @@ func (c *EC2) AttachVolumeRequest(input *AttachVolumeInput) (req *request.Reques // // 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). +// 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 EBS volumes, see Attaching Amazon EBS Volumes // (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-attaching-volume.html) @@ -407,7 +645,28 @@ func (c *EC2) AttachVolume(input *AttachVolumeInput) (*VolumeAttachment, error) const opAttachVpnGateway = "AttachVpnGateway" -// AttachVpnGatewayRequest generates a request for the AttachVpnGateway operation. +// AttachVpnGatewayRequest generates a "aws/request.Request" representing the +// client's request for the AttachVpnGateway operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the AttachVpnGateway method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the AttachVpnGatewayRequest method. +// req, resp := client.AttachVpnGatewayRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) AttachVpnGatewayRequest(input *AttachVpnGatewayInput) (req *request.Request, output *AttachVpnGatewayOutput) { op := &request.Operation{ Name: opAttachVpnGateway, @@ -436,7 +695,28 @@ func (c *EC2) AttachVpnGateway(input *AttachVpnGatewayInput) (*AttachVpnGatewayO const opAuthorizeSecurityGroupEgress = "AuthorizeSecurityGroupEgress" -// AuthorizeSecurityGroupEgressRequest generates a request for the AuthorizeSecurityGroupEgress operation. +// AuthorizeSecurityGroupEgressRequest generates a "aws/request.Request" representing the +// client's request for the AuthorizeSecurityGroupEgress operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the AuthorizeSecurityGroupEgress method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the AuthorizeSecurityGroupEgressRequest method. +// req, resp := client.AuthorizeSecurityGroupEgressRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) AuthorizeSecurityGroupEgressRequest(input *AuthorizeSecurityGroupEgressInput) (req *request.Request, output *AuthorizeSecurityGroupEgressOutput) { op := &request.Operation{ Name: opAuthorizeSecurityGroupEgress, @@ -483,7 +763,28 @@ func (c *EC2) AuthorizeSecurityGroupEgress(input *AuthorizeSecurityGroupEgressIn const opAuthorizeSecurityGroupIngress = "AuthorizeSecurityGroupIngress" -// AuthorizeSecurityGroupIngressRequest generates a request for the AuthorizeSecurityGroupIngress operation. +// AuthorizeSecurityGroupIngressRequest generates a "aws/request.Request" representing the +// client's request for the AuthorizeSecurityGroupIngress operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the AuthorizeSecurityGroupIngress method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the AuthorizeSecurityGroupIngressRequest method. +// req, resp := client.AuthorizeSecurityGroupIngressRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) AuthorizeSecurityGroupIngressRequest(input *AuthorizeSecurityGroupIngressInput) (req *request.Request, output *AuthorizeSecurityGroupIngressOutput) { op := &request.Operation{ Name: opAuthorizeSecurityGroupIngress, @@ -530,7 +831,28 @@ func (c *EC2) AuthorizeSecurityGroupIngress(input *AuthorizeSecurityGroupIngress const opBundleInstance = "BundleInstance" -// BundleInstanceRequest generates a request for the BundleInstance operation. +// BundleInstanceRequest generates a "aws/request.Request" representing the +// client's request for the BundleInstance operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the BundleInstance method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the BundleInstanceRequest method. +// req, resp := client.BundleInstanceRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) BundleInstanceRequest(input *BundleInstanceInput) (req *request.Request, output *BundleInstanceOutput) { op := &request.Operation{ Name: opBundleInstance, @@ -566,7 +888,28 @@ func (c *EC2) BundleInstance(input *BundleInstanceInput) (*BundleInstanceOutput, const opCancelBundleTask = "CancelBundleTask" -// CancelBundleTaskRequest generates a request for the CancelBundleTask operation. +// CancelBundleTaskRequest generates a "aws/request.Request" representing the +// client's request for the CancelBundleTask operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the CancelBundleTask method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the CancelBundleTaskRequest method. +// req, resp := client.CancelBundleTaskRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) CancelBundleTaskRequest(input *CancelBundleTaskInput) (req *request.Request, output *CancelBundleTaskOutput) { op := &request.Operation{ Name: opCancelBundleTask, @@ -593,7 +936,28 @@ func (c *EC2) CancelBundleTask(input *CancelBundleTaskInput) (*CancelBundleTaskO const opCancelConversionTask = "CancelConversionTask" -// CancelConversionTaskRequest generates a request for the CancelConversionTask operation. +// CancelConversionTaskRequest generates a "aws/request.Request" representing the +// client's request for the CancelConversionTask operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the CancelConversionTask method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the CancelConversionTaskRequest method. +// req, resp := client.CancelConversionTaskRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) CancelConversionTaskRequest(input *CancelConversionTaskInput) (req *request.Request, output *CancelConversionTaskOutput) { op := &request.Operation{ Name: opCancelConversionTask, @@ -619,9 +983,8 @@ func (c *EC2) CancelConversionTaskRequest(input *CancelConversionTaskInput) (req // 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. +// For more information, see Importing a Virtual Machine Using the Amazon EC2 +// CLI (http://docs.aws.amazon.com/AWSEC2/latest/CommandLineReference/ec2-cli-vmimport-export.html). func (c *EC2) CancelConversionTask(input *CancelConversionTaskInput) (*CancelConversionTaskOutput, error) { req, out := c.CancelConversionTaskRequest(input) err := req.Send() @@ -630,7 +993,28 @@ func (c *EC2) CancelConversionTask(input *CancelConversionTaskInput) (*CancelCon const opCancelExportTask = "CancelExportTask" -// CancelExportTaskRequest generates a request for the CancelExportTask operation. +// CancelExportTaskRequest generates a "aws/request.Request" representing the +// client's request for the CancelExportTask operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the CancelExportTask method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the CancelExportTaskRequest method. +// req, resp := client.CancelExportTaskRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) CancelExportTaskRequest(input *CancelExportTaskInput) (req *request.Request, output *CancelExportTaskOutput) { op := &request.Operation{ Name: opCancelExportTask, @@ -662,7 +1046,28 @@ func (c *EC2) CancelExportTask(input *CancelExportTaskInput) (*CancelExportTaskO const opCancelImportTask = "CancelImportTask" -// CancelImportTaskRequest generates a request for the CancelImportTask operation. +// CancelImportTaskRequest generates a "aws/request.Request" representing the +// client's request for the CancelImportTask operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the CancelImportTask method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the CancelImportTaskRequest method. +// req, resp := client.CancelImportTaskRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) CancelImportTaskRequest(input *CancelImportTaskInput) (req *request.Request, output *CancelImportTaskOutput) { op := &request.Operation{ Name: opCancelImportTask, @@ -689,7 +1094,28 @@ func (c *EC2) CancelImportTask(input *CancelImportTaskInput) (*CancelImportTaskO const opCancelReservedInstancesListing = "CancelReservedInstancesListing" -// CancelReservedInstancesListingRequest generates a request for the CancelReservedInstancesListing operation. +// CancelReservedInstancesListingRequest generates a "aws/request.Request" representing the +// client's request for the CancelReservedInstancesListing operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the CancelReservedInstancesListing method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the CancelReservedInstancesListingRequest method. +// req, resp := client.CancelReservedInstancesListingRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) CancelReservedInstancesListingRequest(input *CancelReservedInstancesListingInput) (req *request.Request, output *CancelReservedInstancesListingOutput) { op := &request.Operation{ Name: opCancelReservedInstancesListing, @@ -720,7 +1146,28 @@ func (c *EC2) CancelReservedInstancesListing(input *CancelReservedInstancesListi const opCancelSpotFleetRequests = "CancelSpotFleetRequests" -// CancelSpotFleetRequestsRequest generates a request for the CancelSpotFleetRequests operation. +// CancelSpotFleetRequestsRequest generates a "aws/request.Request" representing the +// client's request for the CancelSpotFleetRequests operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the CancelSpotFleetRequests method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the CancelSpotFleetRequestsRequest method. +// req, resp := client.CancelSpotFleetRequestsRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) CancelSpotFleetRequestsRequest(input *CancelSpotFleetRequestsInput) (req *request.Request, output *CancelSpotFleetRequestsOutput) { op := &request.Operation{ Name: opCancelSpotFleetRequests, @@ -754,7 +1201,28 @@ func (c *EC2) CancelSpotFleetRequests(input *CancelSpotFleetRequestsInput) (*Can const opCancelSpotInstanceRequests = "CancelSpotInstanceRequests" -// CancelSpotInstanceRequestsRequest generates a request for the CancelSpotInstanceRequests operation. +// CancelSpotInstanceRequestsRequest generates a "aws/request.Request" representing the +// client's request for the CancelSpotInstanceRequests operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the CancelSpotInstanceRequests method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the CancelSpotInstanceRequestsRequest method. +// req, resp := client.CancelSpotInstanceRequestsRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) CancelSpotInstanceRequestsRequest(input *CancelSpotInstanceRequestsInput) (req *request.Request, output *CancelSpotInstanceRequestsOutput) { op := &request.Operation{ Name: opCancelSpotInstanceRequests, @@ -789,7 +1257,28 @@ func (c *EC2) CancelSpotInstanceRequests(input *CancelSpotInstanceRequestsInput) const opConfirmProductInstance = "ConfirmProductInstance" -// ConfirmProductInstanceRequest generates a request for the ConfirmProductInstance operation. +// ConfirmProductInstanceRequest generates a "aws/request.Request" representing the +// client's request for the ConfirmProductInstance operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the ConfirmProductInstance method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the ConfirmProductInstanceRequest method. +// req, resp := client.ConfirmProductInstanceRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) ConfirmProductInstanceRequest(input *ConfirmProductInstanceInput) (req *request.Request, output *ConfirmProductInstanceOutput) { op := &request.Operation{ Name: opConfirmProductInstance, @@ -819,7 +1308,28 @@ func (c *EC2) ConfirmProductInstance(input *ConfirmProductInstanceInput) (*Confi const opCopyImage = "CopyImage" -// CopyImageRequest generates a request for the CopyImage operation. +// CopyImageRequest generates a "aws/request.Request" representing the +// client's request for the CopyImage operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the CopyImage method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the CopyImageRequest method. +// req, resp := client.CopyImageRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) CopyImageRequest(input *CopyImageInput) (req *request.Request, output *CopyImageOutput) { op := &request.Operation{ Name: opCopyImage, @@ -851,7 +1361,28 @@ func (c *EC2) CopyImage(input *CopyImageInput) (*CopyImageOutput, error) { const opCopySnapshot = "CopySnapshot" -// CopySnapshotRequest generates a request for the CopySnapshot operation. +// CopySnapshotRequest generates a "aws/request.Request" representing the +// client's request for the CopySnapshot operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the CopySnapshot method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the CopySnapshotRequest method. +// req, resp := client.CopySnapshotRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) CopySnapshotRequest(input *CopySnapshotInput) (req *request.Request, output *CopySnapshotOutput) { op := &request.Operation{ Name: opCopySnapshot, @@ -881,7 +1412,13 @@ func (c *EC2) CopySnapshotRequest(input *CopySnapshotInput) (req *request.Reques // default AWS Key Management Service (AWS KMS) customer master key (CMK); however, // you can specify a non-default CMK with the KmsKeyId parameter. // -// For more information, see Copying an Amazon EBS Snapshot (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-copy-snapshot.html) +// To copy an encrypted snapshot that has been shared from another account, +// you must have permissions for the CMK used to encrypt the snapshot. +// +// Snapshots created by the CopySnapshot action have an arbitrary volume +// ID that should not be used for any purpose. +// +// 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) (*CopySnapshotOutput, error) { req, out := c.CopySnapshotRequest(input) @@ -891,7 +1428,28 @@ func (c *EC2) CopySnapshot(input *CopySnapshotInput) (*CopySnapshotOutput, error const opCreateCustomerGateway = "CreateCustomerGateway" -// CreateCustomerGatewayRequest generates a request for the CreateCustomerGateway operation. +// CreateCustomerGatewayRequest generates a "aws/request.Request" representing the +// client's request for the CreateCustomerGateway operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the CreateCustomerGateway method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the CreateCustomerGatewayRequest method. +// req, resp := client.CreateCustomerGatewayRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) CreateCustomerGatewayRequest(input *CreateCustomerGatewayInput) (req *request.Request, output *CreateCustomerGatewayOutput) { op := &request.Operation{ Name: opCreateCustomerGateway, @@ -942,7 +1500,28 @@ func (c *EC2) CreateCustomerGateway(input *CreateCustomerGatewayInput) (*CreateC const opCreateDhcpOptions = "CreateDhcpOptions" -// CreateDhcpOptionsRequest generates a request for the CreateDhcpOptions operation. +// CreateDhcpOptionsRequest generates a "aws/request.Request" representing the +// client's request for the CreateDhcpOptions operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the CreateDhcpOptions method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the CreateDhcpOptionsRequest method. +// req, resp := client.CreateDhcpOptionsRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) CreateDhcpOptionsRequest(input *CreateDhcpOptionsInput) (req *request.Request, output *CreateDhcpOptionsOutput) { op := &request.Operation{ Name: opCreateDhcpOptions, @@ -966,28 +1545,39 @@ func (c *EC2) CreateDhcpOptionsRequest(input *CreateDhcpOptionsInput) (req *requ // 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, +// 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 a single parameter, separated by commas. If you want your instance to +// receive a custom DNS hostname as specified in domain-name, you must set domain-name-servers +// to a custom DNS server. +// +// 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"). This value +// is used to complete unqualified DNS hostnames. 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) (*CreateDhcpOptionsOutput, error) { req, out := c.CreateDhcpOptionsRequest(input) @@ -997,7 +1587,28 @@ func (c *EC2) CreateDhcpOptions(input *CreateDhcpOptionsInput) (*CreateDhcpOptio const opCreateFlowLogs = "CreateFlowLogs" -// CreateFlowLogsRequest generates a request for the CreateFlowLogs operation. +// CreateFlowLogsRequest generates a "aws/request.Request" representing the +// client's request for the CreateFlowLogs operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the CreateFlowLogs method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the CreateFlowLogsRequest method. +// req, resp := client.CreateFlowLogsRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) CreateFlowLogsRequest(input *CreateFlowLogsInput) (req *request.Request, output *CreateFlowLogsOutput) { op := &request.Operation{ Name: opCreateFlowLogs, @@ -1033,7 +1644,28 @@ func (c *EC2) CreateFlowLogs(input *CreateFlowLogsInput) (*CreateFlowLogsOutput, const opCreateImage = "CreateImage" -// CreateImageRequest generates a request for the CreateImage operation. +// CreateImageRequest generates a "aws/request.Request" representing the +// client's request for the CreateImage operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the CreateImage method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the CreateImageRequest method. +// req, resp := client.CreateImageRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) CreateImageRequest(input *CreateImageInput) (req *request.Request, output *CreateImageOutput) { op := &request.Operation{ Name: opCreateImage, @@ -1069,7 +1701,28 @@ func (c *EC2) CreateImage(input *CreateImageInput) (*CreateImageOutput, error) { const opCreateInstanceExportTask = "CreateInstanceExportTask" -// CreateInstanceExportTaskRequest generates a request for the CreateInstanceExportTask operation. +// CreateInstanceExportTaskRequest generates a "aws/request.Request" representing the +// client's request for the CreateInstanceExportTask operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the CreateInstanceExportTask method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the CreateInstanceExportTaskRequest method. +// req, resp := client.CreateInstanceExportTaskRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) CreateInstanceExportTaskRequest(input *CreateInstanceExportTaskInput) (req *request.Request, output *CreateInstanceExportTaskOutput) { op := &request.Operation{ Name: opCreateInstanceExportTask, @@ -1091,8 +1744,8 @@ func (c *EC2) CreateInstanceExportTaskRequest(input *CreateInstanceExportTaskInp // // 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. +// an Instance as a VM Using VM Import/Export (http://docs.aws.amazon.com/vm-import/latest/userguide/vmexport.html) +// in the VM Import/Export User Guide. func (c *EC2) CreateInstanceExportTask(input *CreateInstanceExportTaskInput) (*CreateInstanceExportTaskOutput, error) { req, out := c.CreateInstanceExportTaskRequest(input) err := req.Send() @@ -1101,7 +1754,28 @@ func (c *EC2) CreateInstanceExportTask(input *CreateInstanceExportTaskInput) (*C const opCreateInternetGateway = "CreateInternetGateway" -// CreateInternetGatewayRequest generates a request for the CreateInternetGateway operation. +// CreateInternetGatewayRequest generates a "aws/request.Request" representing the +// client's request for the CreateInternetGateway operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the CreateInternetGateway method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the CreateInternetGatewayRequest method. +// req, resp := client.CreateInternetGatewayRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) CreateInternetGatewayRequest(input *CreateInternetGatewayInput) (req *request.Request, output *CreateInternetGatewayOutput) { op := &request.Operation{ Name: opCreateInternetGateway, @@ -1132,7 +1806,28 @@ func (c *EC2) CreateInternetGateway(input *CreateInternetGatewayInput) (*CreateI const opCreateKeyPair = "CreateKeyPair" -// CreateKeyPairRequest generates a request for the CreateKeyPair operation. +// CreateKeyPairRequest generates a "aws/request.Request" representing the +// client's request for the CreateKeyPair operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the CreateKeyPair method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the CreateKeyPairRequest method. +// req, resp := client.CreateKeyPairRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) CreateKeyPairRequest(input *CreateKeyPairInput) (req *request.Request, output *CreateKeyPairOutput) { op := &request.Operation{ Name: opCreateKeyPair, @@ -1170,7 +1865,28 @@ func (c *EC2) CreateKeyPair(input *CreateKeyPairInput) (*CreateKeyPairOutput, er const opCreateNatGateway = "CreateNatGateway" -// CreateNatGatewayRequest generates a request for the CreateNatGateway operation. +// CreateNatGatewayRequest generates a "aws/request.Request" representing the +// client's request for the CreateNatGateway operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the CreateNatGateway method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the CreateNatGatewayRequest method. +// req, resp := client.CreateNatGatewayRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) CreateNatGatewayRequest(input *CreateNatGatewayInput) (req *request.Request, output *CreateNatGatewayOutput) { op := &request.Operation{ Name: opCreateNatGateway, @@ -1202,7 +1918,28 @@ func (c *EC2) CreateNatGateway(input *CreateNatGatewayInput) (*CreateNatGatewayO const opCreateNetworkAcl = "CreateNetworkAcl" -// CreateNetworkAclRequest generates a request for the CreateNetworkAcl operation. +// CreateNetworkAclRequest generates a "aws/request.Request" representing the +// client's request for the CreateNetworkAcl operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the CreateNetworkAcl method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the CreateNetworkAclRequest method. +// req, resp := client.CreateNetworkAclRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) CreateNetworkAclRequest(input *CreateNetworkAclInput) (req *request.Request, output *CreateNetworkAclOutput) { op := &request.Operation{ Name: opCreateNetworkAcl, @@ -1233,7 +1970,28 @@ func (c *EC2) CreateNetworkAcl(input *CreateNetworkAclInput) (*CreateNetworkAclO const opCreateNetworkAclEntry = "CreateNetworkAclEntry" -// CreateNetworkAclEntryRequest generates a request for the CreateNetworkAclEntry operation. +// CreateNetworkAclEntryRequest generates a "aws/request.Request" representing the +// client's request for the CreateNetworkAclEntry operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the CreateNetworkAclEntry method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the CreateNetworkAclEntryRequest method. +// req, resp := client.CreateNetworkAclEntryRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) CreateNetworkAclEntryRequest(input *CreateNetworkAclEntryInput) (req *request.Request, output *CreateNetworkAclEntryOutput) { op := &request.Operation{ Name: opCreateNetworkAclEntry, @@ -1278,7 +2036,28 @@ func (c *EC2) CreateNetworkAclEntry(input *CreateNetworkAclEntryInput) (*CreateN const opCreateNetworkInterface = "CreateNetworkInterface" -// CreateNetworkInterfaceRequest generates a request for the CreateNetworkInterface operation. +// CreateNetworkInterfaceRequest generates a "aws/request.Request" representing the +// client's request for the CreateNetworkInterface operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the CreateNetworkInterface method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the CreateNetworkInterfaceRequest method. +// req, resp := client.CreateNetworkInterfaceRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) CreateNetworkInterfaceRequest(input *CreateNetworkInterfaceInput) (req *request.Request, output *CreateNetworkInterfaceOutput) { op := &request.Operation{ Name: opCreateNetworkInterface, @@ -1309,7 +2088,28 @@ func (c *EC2) CreateNetworkInterface(input *CreateNetworkInterfaceInput) (*Creat const opCreatePlacementGroup = "CreatePlacementGroup" -// CreatePlacementGroupRequest generates a request for the CreatePlacementGroup operation. +// CreatePlacementGroupRequest generates a "aws/request.Request" representing the +// client's request for the CreatePlacementGroup operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the CreatePlacementGroup method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the CreatePlacementGroupRequest method. +// req, resp := client.CreatePlacementGroupRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) CreatePlacementGroupRequest(input *CreatePlacementGroupInput) (req *request.Request, output *CreatePlacementGroupOutput) { op := &request.Operation{ Name: opCreatePlacementGroup, @@ -1343,7 +2143,28 @@ func (c *EC2) CreatePlacementGroup(input *CreatePlacementGroupInput) (*CreatePla const opCreateReservedInstancesListing = "CreateReservedInstancesListing" -// CreateReservedInstancesListingRequest generates a request for the CreateReservedInstancesListing operation. +// CreateReservedInstancesListingRequest generates a "aws/request.Request" representing the +// client's request for the CreateReservedInstancesListing operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the CreateReservedInstancesListing method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the CreateReservedInstancesListingRequest method. +// req, resp := client.CreateReservedInstancesListingRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) CreateReservedInstancesListingRequest(input *CreateReservedInstancesListingInput) (req *request.Request, output *CreateReservedInstancesListingOutput) { op := &request.Operation{ Name: opCreateReservedInstancesListing, @@ -1389,7 +2210,28 @@ func (c *EC2) CreateReservedInstancesListing(input *CreateReservedInstancesListi const opCreateRoute = "CreateRoute" -// CreateRouteRequest generates a request for the CreateRoute operation. +// CreateRouteRequest generates a "aws/request.Request" representing the +// client's request for the CreateRoute operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the CreateRoute method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the CreateRouteRequest method. +// req, resp := client.CreateRouteRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) CreateRouteRequest(input *CreateRouteInput) (req *request.Request, output *CreateRouteOutput) { op := &request.Operation{ Name: opCreateRoute, @@ -1417,9 +2259,9 @@ func (c *EC2) CreateRouteRequest(input *CreateRouteInput) (req *request.Request, // 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/24 (goes to some target A) // -// 192.0.2.0/28 (goes to some target B) +// 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 @@ -1435,7 +2277,28 @@ func (c *EC2) CreateRoute(input *CreateRouteInput) (*CreateRouteOutput, error) { const opCreateRouteTable = "CreateRouteTable" -// CreateRouteTableRequest generates a request for the CreateRouteTable operation. +// CreateRouteTableRequest generates a "aws/request.Request" representing the +// client's request for the CreateRouteTable operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the CreateRouteTable method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the CreateRouteTableRequest method. +// req, resp := client.CreateRouteTableRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) CreateRouteTableRequest(input *CreateRouteTableInput) (req *request.Request, output *CreateRouteTableOutput) { op := &request.Operation{ Name: opCreateRouteTable, @@ -1466,7 +2329,28 @@ func (c *EC2) CreateRouteTable(input *CreateRouteTableInput) (*CreateRouteTableO const opCreateSecurityGroup = "CreateSecurityGroup" -// CreateSecurityGroupRequest generates a request for the CreateSecurityGroup operation. +// CreateSecurityGroupRequest generates a "aws/request.Request" representing the +// client's request for the CreateSecurityGroup operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the CreateSecurityGroup method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the CreateSecurityGroupRequest method. +// req, resp := client.CreateSecurityGroupRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) CreateSecurityGroupRequest(input *CreateSecurityGroupInput) (req *request.Request, output *CreateSecurityGroupOutput) { op := &request.Operation{ Name: opCreateSecurityGroup, @@ -1519,7 +2403,28 @@ func (c *EC2) CreateSecurityGroup(input *CreateSecurityGroupInput) (*CreateSecur const opCreateSnapshot = "CreateSnapshot" -// CreateSnapshotRequest generates a request for the CreateSnapshot operation. +// CreateSnapshotRequest generates a "aws/request.Request" representing the +// client's request for the CreateSnapshot operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the CreateSnapshot method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the CreateSnapshotRequest method. +// req, resp := client.CreateSnapshotRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) CreateSnapshotRequest(input *CreateSnapshotInput) (req *request.Request, output *Snapshot) { op := &request.Operation{ Name: opCreateSnapshot, @@ -1573,7 +2478,28 @@ func (c *EC2) CreateSnapshot(input *CreateSnapshotInput) (*Snapshot, error) { const opCreateSpotDatafeedSubscription = "CreateSpotDatafeedSubscription" -// CreateSpotDatafeedSubscriptionRequest generates a request for the CreateSpotDatafeedSubscription operation. +// CreateSpotDatafeedSubscriptionRequest generates a "aws/request.Request" representing the +// client's request for the CreateSpotDatafeedSubscription operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the CreateSpotDatafeedSubscription method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the CreateSpotDatafeedSubscriptionRequest method. +// req, resp := client.CreateSpotDatafeedSubscriptionRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) CreateSpotDatafeedSubscriptionRequest(input *CreateSpotDatafeedSubscriptionInput) (req *request.Request, output *CreateSpotDatafeedSubscriptionOutput) { op := &request.Operation{ Name: opCreateSpotDatafeedSubscription, @@ -1603,7 +2529,28 @@ func (c *EC2) CreateSpotDatafeedSubscription(input *CreateSpotDatafeedSubscripti const opCreateSubnet = "CreateSubnet" -// CreateSubnetRequest generates a request for the CreateSubnet operation. +// CreateSubnetRequest generates a "aws/request.Request" representing the +// client's request for the CreateSubnet operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the CreateSubnet method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the CreateSubnetRequest method. +// req, resp := client.CreateSubnetRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) CreateSubnetRequest(input *CreateSubnetInput) (req *request.Request, output *CreateSubnetOutput) { op := &request.Operation{ Name: opCreateSubnet, @@ -1654,7 +2601,28 @@ func (c *EC2) CreateSubnet(input *CreateSubnetInput) (*CreateSubnetOutput, error const opCreateTags = "CreateTags" -// CreateTagsRequest generates a request for the CreateTags operation. +// CreateTagsRequest generates a "aws/request.Request" representing the +// client's request for the CreateTags operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the CreateTags method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the CreateTagsRequest method. +// req, resp := client.CreateTagsRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) CreateTagsRequest(input *CreateTagsInput) (req *request.Request, output *CreateTagsOutput) { op := &request.Operation{ Name: opCreateTags, @@ -1691,7 +2659,28 @@ func (c *EC2) CreateTags(input *CreateTagsInput) (*CreateTagsOutput, error) { const opCreateVolume = "CreateVolume" -// CreateVolumeRequest generates a request for the CreateVolume operation. +// CreateVolumeRequest generates a "aws/request.Request" representing the +// client's request for the CreateVolume operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the CreateVolume method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the CreateVolumeRequest method. +// req, resp := client.CreateVolumeRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) CreateVolumeRequest(input *CreateVolumeInput) (req *request.Request, output *Volume) { op := &request.Operation{ Name: opCreateVolume, @@ -1733,7 +2722,28 @@ func (c *EC2) CreateVolume(input *CreateVolumeInput) (*Volume, error) { const opCreateVpc = "CreateVpc" -// CreateVpcRequest generates a request for the CreateVpc operation. +// CreateVpcRequest generates a "aws/request.Request" representing the +// client's request for the CreateVpc operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the CreateVpc method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the CreateVpcRequest method. +// req, resp := client.CreateVpcRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) CreateVpcRequest(input *CreateVpcInput) (req *request.Request, output *CreateVpcOutput) { op := &request.Operation{ Name: opCreateVpc, @@ -1762,6 +2772,11 @@ func (c *EC2) CreateVpcRequest(input *CreateVpcInput) (req *request.Request, out // 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. +// +// You can specify the instance tenancy value for the VPC when you create it. +// You can't change this value for the VPC after you create it. For more information, +// see Dedicated Instances (http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/dedicated-instance.html.html) +// in the Amazon Virtual Private Cloud User Guide. func (c *EC2) CreateVpc(input *CreateVpcInput) (*CreateVpcOutput, error) { req, out := c.CreateVpcRequest(input) err := req.Send() @@ -1770,7 +2785,28 @@ func (c *EC2) CreateVpc(input *CreateVpcInput) (*CreateVpcOutput, error) { const opCreateVpcEndpoint = "CreateVpcEndpoint" -// CreateVpcEndpointRequest generates a request for the CreateVpcEndpoint operation. +// CreateVpcEndpointRequest generates a "aws/request.Request" representing the +// client's request for the CreateVpcEndpoint operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the CreateVpcEndpoint method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the CreateVpcEndpointRequest method. +// req, resp := client.CreateVpcEndpointRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) CreateVpcEndpointRequest(input *CreateVpcEndpointInput) (req *request.Request, output *CreateVpcEndpointOutput) { op := &request.Operation{ Name: opCreateVpcEndpoint, @@ -1803,7 +2839,28 @@ func (c *EC2) CreateVpcEndpoint(input *CreateVpcEndpointInput) (*CreateVpcEndpoi const opCreateVpcPeeringConnection = "CreateVpcPeeringConnection" -// CreateVpcPeeringConnectionRequest generates a request for the CreateVpcPeeringConnection operation. +// CreateVpcPeeringConnectionRequest generates a "aws/request.Request" representing the +// client's request for the CreateVpcPeeringConnection operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the CreateVpcPeeringConnection method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the CreateVpcPeeringConnectionRequest method. +// req, resp := client.CreateVpcPeeringConnectionRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) CreateVpcPeeringConnectionRequest(input *CreateVpcPeeringConnectionInput) (req *request.Request, output *CreateVpcPeeringConnectionOutput) { op := &request.Operation{ Name: opCreateVpcPeeringConnection, @@ -1840,7 +2897,28 @@ func (c *EC2) CreateVpcPeeringConnection(input *CreateVpcPeeringConnectionInput) const opCreateVpnConnection = "CreateVpnConnection" -// CreateVpnConnectionRequest generates a request for the CreateVpnConnection operation. +// CreateVpnConnectionRequest generates a "aws/request.Request" representing the +// client's request for the CreateVpnConnection operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the CreateVpnConnection method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the CreateVpnConnectionRequest method. +// req, resp := client.CreateVpnConnectionRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) CreateVpnConnectionRequest(input *CreateVpnConnectionInput) (req *request.Request, output *CreateVpnConnectionOutput) { op := &request.Operation{ Name: opCreateVpnConnection, @@ -1872,6 +2950,9 @@ func (c *EC2) CreateVpnConnectionRequest(input *CreateVpnConnectionInput) (req * // create a new VPN connection, you must reconfigure your customer gateway with // the new information returned from this call. // +// This is an idempotent operation. If you perform the operation more than +// once, Amazon EC2 doesn't return an error. +// // 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. @@ -1883,7 +2964,28 @@ func (c *EC2) CreateVpnConnection(input *CreateVpnConnectionInput) (*CreateVpnCo const opCreateVpnConnectionRoute = "CreateVpnConnectionRoute" -// CreateVpnConnectionRouteRequest generates a request for the CreateVpnConnectionRoute operation. +// CreateVpnConnectionRouteRequest generates a "aws/request.Request" representing the +// client's request for the CreateVpnConnectionRoute operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the CreateVpnConnectionRoute method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the CreateVpnConnectionRouteRequest method. +// req, resp := client.CreateVpnConnectionRouteRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) CreateVpnConnectionRouteRequest(input *CreateVpnConnectionRouteInput) (req *request.Request, output *CreateVpnConnectionRouteOutput) { op := &request.Operation{ Name: opCreateVpnConnectionRoute, @@ -1919,7 +3021,28 @@ func (c *EC2) CreateVpnConnectionRoute(input *CreateVpnConnectionRouteInput) (*C const opCreateVpnGateway = "CreateVpnGateway" -// CreateVpnGatewayRequest generates a request for the CreateVpnGateway operation. +// CreateVpnGatewayRequest generates a "aws/request.Request" representing the +// client's request for the CreateVpnGateway operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the CreateVpnGateway method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the CreateVpnGatewayRequest method. +// req, resp := client.CreateVpnGatewayRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) CreateVpnGatewayRequest(input *CreateVpnGatewayInput) (req *request.Request, output *CreateVpnGatewayOutput) { op := &request.Operation{ Name: opCreateVpnGateway, @@ -1952,7 +3075,28 @@ func (c *EC2) CreateVpnGateway(input *CreateVpnGatewayInput) (*CreateVpnGatewayO const opDeleteCustomerGateway = "DeleteCustomerGateway" -// DeleteCustomerGatewayRequest generates a request for the DeleteCustomerGateway operation. +// DeleteCustomerGatewayRequest generates a "aws/request.Request" representing the +// client's request for the DeleteCustomerGateway operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the DeleteCustomerGateway method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the DeleteCustomerGatewayRequest method. +// req, resp := client.DeleteCustomerGatewayRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) DeleteCustomerGatewayRequest(input *DeleteCustomerGatewayInput) (req *request.Request, output *DeleteCustomerGatewayOutput) { op := &request.Operation{ Name: opDeleteCustomerGateway, @@ -1982,7 +3126,28 @@ func (c *EC2) DeleteCustomerGateway(input *DeleteCustomerGatewayInput) (*DeleteC const opDeleteDhcpOptions = "DeleteDhcpOptions" -// DeleteDhcpOptionsRequest generates a request for the DeleteDhcpOptions operation. +// DeleteDhcpOptionsRequest generates a "aws/request.Request" representing the +// client's request for the DeleteDhcpOptions operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the DeleteDhcpOptions method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the DeleteDhcpOptionsRequest method. +// req, resp := client.DeleteDhcpOptionsRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) DeleteDhcpOptionsRequest(input *DeleteDhcpOptionsInput) (req *request.Request, output *DeleteDhcpOptionsOutput) { op := &request.Operation{ Name: opDeleteDhcpOptions, @@ -2014,7 +3179,28 @@ func (c *EC2) DeleteDhcpOptions(input *DeleteDhcpOptionsInput) (*DeleteDhcpOptio const opDeleteFlowLogs = "DeleteFlowLogs" -// DeleteFlowLogsRequest generates a request for the DeleteFlowLogs operation. +// DeleteFlowLogsRequest generates a "aws/request.Request" representing the +// client's request for the DeleteFlowLogs operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the DeleteFlowLogs method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the DeleteFlowLogsRequest method. +// req, resp := client.DeleteFlowLogsRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) DeleteFlowLogsRequest(input *DeleteFlowLogsInput) (req *request.Request, output *DeleteFlowLogsOutput) { op := &request.Operation{ Name: opDeleteFlowLogs, @@ -2041,7 +3227,28 @@ func (c *EC2) DeleteFlowLogs(input *DeleteFlowLogsInput) (*DeleteFlowLogsOutput, const opDeleteInternetGateway = "DeleteInternetGateway" -// DeleteInternetGatewayRequest generates a request for the DeleteInternetGateway operation. +// DeleteInternetGatewayRequest generates a "aws/request.Request" representing the +// client's request for the DeleteInternetGateway operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the DeleteInternetGateway method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the DeleteInternetGatewayRequest method. +// req, resp := client.DeleteInternetGatewayRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) DeleteInternetGatewayRequest(input *DeleteInternetGatewayInput) (req *request.Request, output *DeleteInternetGatewayOutput) { op := &request.Operation{ Name: opDeleteInternetGateway, @@ -2071,7 +3278,28 @@ func (c *EC2) DeleteInternetGateway(input *DeleteInternetGatewayInput) (*DeleteI const opDeleteKeyPair = "DeleteKeyPair" -// DeleteKeyPairRequest generates a request for the DeleteKeyPair operation. +// DeleteKeyPairRequest generates a "aws/request.Request" representing the +// client's request for the DeleteKeyPair operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the DeleteKeyPair method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the DeleteKeyPairRequest method. +// req, resp := client.DeleteKeyPairRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) DeleteKeyPairRequest(input *DeleteKeyPairInput) (req *request.Request, output *DeleteKeyPairOutput) { op := &request.Operation{ Name: opDeleteKeyPair, @@ -2100,7 +3328,28 @@ func (c *EC2) DeleteKeyPair(input *DeleteKeyPairInput) (*DeleteKeyPairOutput, er const opDeleteNatGateway = "DeleteNatGateway" -// DeleteNatGatewayRequest generates a request for the DeleteNatGateway operation. +// DeleteNatGatewayRequest generates a "aws/request.Request" representing the +// client's request for the DeleteNatGateway operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the DeleteNatGateway method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the DeleteNatGatewayRequest method. +// req, resp := client.DeleteNatGatewayRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) DeleteNatGatewayRequest(input *DeleteNatGatewayInput) (req *request.Request, output *DeleteNatGatewayOutput) { op := &request.Operation{ Name: opDeleteNatGateway, @@ -2129,7 +3378,28 @@ func (c *EC2) DeleteNatGateway(input *DeleteNatGatewayInput) (*DeleteNatGatewayO const opDeleteNetworkAcl = "DeleteNetworkAcl" -// DeleteNetworkAclRequest generates a request for the DeleteNetworkAcl operation. +// DeleteNetworkAclRequest generates a "aws/request.Request" representing the +// client's request for the DeleteNetworkAcl operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the DeleteNetworkAcl method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the DeleteNetworkAclRequest method. +// req, resp := client.DeleteNetworkAclRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) DeleteNetworkAclRequest(input *DeleteNetworkAclInput) (req *request.Request, output *DeleteNetworkAclOutput) { op := &request.Operation{ Name: opDeleteNetworkAcl, @@ -2159,7 +3429,28 @@ func (c *EC2) DeleteNetworkAcl(input *DeleteNetworkAclInput) (*DeleteNetworkAclO const opDeleteNetworkAclEntry = "DeleteNetworkAclEntry" -// DeleteNetworkAclEntryRequest generates a request for the DeleteNetworkAclEntry operation. +// DeleteNetworkAclEntryRequest generates a "aws/request.Request" representing the +// client's request for the DeleteNetworkAclEntry operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the DeleteNetworkAclEntry method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the DeleteNetworkAclEntryRequest method. +// req, resp := client.DeleteNetworkAclEntryRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) DeleteNetworkAclEntryRequest(input *DeleteNetworkAclEntryInput) (req *request.Request, output *DeleteNetworkAclEntryOutput) { op := &request.Operation{ Name: opDeleteNetworkAclEntry, @@ -2189,7 +3480,28 @@ func (c *EC2) DeleteNetworkAclEntry(input *DeleteNetworkAclEntryInput) (*DeleteN const opDeleteNetworkInterface = "DeleteNetworkInterface" -// DeleteNetworkInterfaceRequest generates a request for the DeleteNetworkInterface operation. +// DeleteNetworkInterfaceRequest generates a "aws/request.Request" representing the +// client's request for the DeleteNetworkInterface operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the DeleteNetworkInterface method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the DeleteNetworkInterfaceRequest method. +// req, resp := client.DeleteNetworkInterfaceRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) DeleteNetworkInterfaceRequest(input *DeleteNetworkInterfaceInput) (req *request.Request, output *DeleteNetworkInterfaceOutput) { op := &request.Operation{ Name: opDeleteNetworkInterface, @@ -2219,7 +3531,28 @@ func (c *EC2) DeleteNetworkInterface(input *DeleteNetworkInterfaceInput) (*Delet const opDeletePlacementGroup = "DeletePlacementGroup" -// DeletePlacementGroupRequest generates a request for the DeletePlacementGroup operation. +// DeletePlacementGroupRequest generates a "aws/request.Request" representing the +// client's request for the DeletePlacementGroup operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the DeletePlacementGroup method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the DeletePlacementGroupRequest method. +// req, resp := client.DeletePlacementGroupRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) DeletePlacementGroupRequest(input *DeletePlacementGroupInput) (req *request.Request, output *DeletePlacementGroupOutput) { op := &request.Operation{ Name: opDeletePlacementGroup, @@ -2251,7 +3584,28 @@ func (c *EC2) DeletePlacementGroup(input *DeletePlacementGroupInput) (*DeletePla const opDeleteRoute = "DeleteRoute" -// DeleteRouteRequest generates a request for the DeleteRoute operation. +// DeleteRouteRequest generates a "aws/request.Request" representing the +// client's request for the DeleteRoute operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the DeleteRoute method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the DeleteRouteRequest method. +// req, resp := client.DeleteRouteRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) DeleteRouteRequest(input *DeleteRouteInput) (req *request.Request, output *DeleteRouteOutput) { op := &request.Operation{ Name: opDeleteRoute, @@ -2280,7 +3634,28 @@ func (c *EC2) DeleteRoute(input *DeleteRouteInput) (*DeleteRouteOutput, error) { const opDeleteRouteTable = "DeleteRouteTable" -// DeleteRouteTableRequest generates a request for the DeleteRouteTable operation. +// DeleteRouteTableRequest generates a "aws/request.Request" representing the +// client's request for the DeleteRouteTable operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the DeleteRouteTable method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the DeleteRouteTableRequest method. +// req, resp := client.DeleteRouteTableRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) DeleteRouteTableRequest(input *DeleteRouteTableInput) (req *request.Request, output *DeleteRouteTableOutput) { op := &request.Operation{ Name: opDeleteRouteTable, @@ -2311,7 +3686,28 @@ func (c *EC2) DeleteRouteTable(input *DeleteRouteTableInput) (*DeleteRouteTableO const opDeleteSecurityGroup = "DeleteSecurityGroup" -// DeleteSecurityGroupRequest generates a request for the DeleteSecurityGroup operation. +// DeleteSecurityGroupRequest generates a "aws/request.Request" representing the +// client's request for the DeleteSecurityGroup operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the DeleteSecurityGroup method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the DeleteSecurityGroupRequest method. +// req, resp := client.DeleteSecurityGroupRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) DeleteSecurityGroupRequest(input *DeleteSecurityGroupInput) (req *request.Request, output *DeleteSecurityGroupOutput) { op := &request.Operation{ Name: opDeleteSecurityGroup, @@ -2344,7 +3740,28 @@ func (c *EC2) DeleteSecurityGroup(input *DeleteSecurityGroupInput) (*DeleteSecur const opDeleteSnapshot = "DeleteSnapshot" -// DeleteSnapshotRequest generates a request for the DeleteSnapshot operation. +// DeleteSnapshotRequest generates a "aws/request.Request" representing the +// client's request for the DeleteSnapshot operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the DeleteSnapshot method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the DeleteSnapshotRequest method. +// req, resp := client.DeleteSnapshotRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) DeleteSnapshotRequest(input *DeleteSnapshotInput) (req *request.Request, output *DeleteSnapshotOutput) { op := &request.Operation{ Name: opDeleteSnapshot, @@ -2387,7 +3804,28 @@ func (c *EC2) DeleteSnapshot(input *DeleteSnapshotInput) (*DeleteSnapshotOutput, const opDeleteSpotDatafeedSubscription = "DeleteSpotDatafeedSubscription" -// DeleteSpotDatafeedSubscriptionRequest generates a request for the DeleteSpotDatafeedSubscription operation. +// DeleteSpotDatafeedSubscriptionRequest generates a "aws/request.Request" representing the +// client's request for the DeleteSpotDatafeedSubscription operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the DeleteSpotDatafeedSubscription method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the DeleteSpotDatafeedSubscriptionRequest method. +// req, resp := client.DeleteSpotDatafeedSubscriptionRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) DeleteSpotDatafeedSubscriptionRequest(input *DeleteSpotDatafeedSubscriptionInput) (req *request.Request, output *DeleteSpotDatafeedSubscriptionOutput) { op := &request.Operation{ Name: opDeleteSpotDatafeedSubscription, @@ -2416,7 +3854,28 @@ func (c *EC2) DeleteSpotDatafeedSubscription(input *DeleteSpotDatafeedSubscripti const opDeleteSubnet = "DeleteSubnet" -// DeleteSubnetRequest generates a request for the DeleteSubnet operation. +// DeleteSubnetRequest generates a "aws/request.Request" representing the +// client's request for the DeleteSubnet operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the DeleteSubnet method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the DeleteSubnetRequest method. +// req, resp := client.DeleteSubnetRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) DeleteSubnetRequest(input *DeleteSubnetInput) (req *request.Request, output *DeleteSubnetOutput) { op := &request.Operation{ Name: opDeleteSubnet, @@ -2446,7 +3905,28 @@ func (c *EC2) DeleteSubnet(input *DeleteSubnetInput) (*DeleteSubnetOutput, error const opDeleteTags = "DeleteTags" -// DeleteTagsRequest generates a request for the DeleteTags operation. +// DeleteTagsRequest generates a "aws/request.Request" representing the +// client's request for the DeleteTags operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the DeleteTags method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the DeleteTagsRequest method. +// req, resp := client.DeleteTagsRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) DeleteTagsRequest(input *DeleteTagsInput) (req *request.Request, output *DeleteTagsOutput) { op := &request.Operation{ Name: opDeleteTags, @@ -2479,7 +3959,28 @@ func (c *EC2) DeleteTags(input *DeleteTagsInput) (*DeleteTagsOutput, error) { const opDeleteVolume = "DeleteVolume" -// DeleteVolumeRequest generates a request for the DeleteVolume operation. +// DeleteVolumeRequest generates a "aws/request.Request" representing the +// client's request for the DeleteVolume operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the DeleteVolume method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the DeleteVolumeRequest method. +// req, resp := client.DeleteVolumeRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) DeleteVolumeRequest(input *DeleteVolumeInput) (req *request.Request, output *DeleteVolumeOutput) { op := &request.Operation{ Name: opDeleteVolume, @@ -2514,7 +4015,28 @@ func (c *EC2) DeleteVolume(input *DeleteVolumeInput) (*DeleteVolumeOutput, error const opDeleteVpc = "DeleteVpc" -// DeleteVpcRequest generates a request for the DeleteVpc operation. +// DeleteVpcRequest generates a "aws/request.Request" representing the +// client's request for the DeleteVpc operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the DeleteVpc method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the DeleteVpcRequest method. +// req, resp := client.DeleteVpcRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) DeleteVpcRequest(input *DeleteVpcInput) (req *request.Request, output *DeleteVpcOutput) { op := &request.Operation{ Name: opDeleteVpc, @@ -2547,7 +4069,28 @@ func (c *EC2) DeleteVpc(input *DeleteVpcInput) (*DeleteVpcOutput, error) { const opDeleteVpcEndpoints = "DeleteVpcEndpoints" -// DeleteVpcEndpointsRequest generates a request for the DeleteVpcEndpoints operation. +// DeleteVpcEndpointsRequest generates a "aws/request.Request" representing the +// client's request for the DeleteVpcEndpoints operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the DeleteVpcEndpoints method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the DeleteVpcEndpointsRequest method. +// req, resp := client.DeleteVpcEndpointsRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) DeleteVpcEndpointsRequest(input *DeleteVpcEndpointsInput) (req *request.Request, output *DeleteVpcEndpointsOutput) { op := &request.Operation{ Name: opDeleteVpcEndpoints, @@ -2575,7 +4118,28 @@ func (c *EC2) DeleteVpcEndpoints(input *DeleteVpcEndpointsInput) (*DeleteVpcEndp const opDeleteVpcPeeringConnection = "DeleteVpcPeeringConnection" -// DeleteVpcPeeringConnectionRequest generates a request for the DeleteVpcPeeringConnection operation. +// DeleteVpcPeeringConnectionRequest generates a "aws/request.Request" representing the +// client's request for the DeleteVpcPeeringConnection operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the DeleteVpcPeeringConnection method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the DeleteVpcPeeringConnectionRequest method. +// req, resp := client.DeleteVpcPeeringConnectionRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) DeleteVpcPeeringConnectionRequest(input *DeleteVpcPeeringConnectionInput) (req *request.Request, output *DeleteVpcPeeringConnectionOutput) { op := &request.Operation{ Name: opDeleteVpcPeeringConnection, @@ -2605,7 +4169,28 @@ func (c *EC2) DeleteVpcPeeringConnection(input *DeleteVpcPeeringConnectionInput) const opDeleteVpnConnection = "DeleteVpnConnection" -// DeleteVpnConnectionRequest generates a request for the DeleteVpnConnection operation. +// DeleteVpnConnectionRequest generates a "aws/request.Request" representing the +// client's request for the DeleteVpnConnection operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the DeleteVpnConnection method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the DeleteVpnConnectionRequest method. +// req, resp := client.DeleteVpnConnectionRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) DeleteVpnConnectionRequest(input *DeleteVpnConnectionInput) (req *request.Request, output *DeleteVpnConnectionOutput) { op := &request.Operation{ Name: opDeleteVpnConnection, @@ -2643,7 +4228,28 @@ func (c *EC2) DeleteVpnConnection(input *DeleteVpnConnectionInput) (*DeleteVpnCo const opDeleteVpnConnectionRoute = "DeleteVpnConnectionRoute" -// DeleteVpnConnectionRouteRequest generates a request for the DeleteVpnConnectionRoute operation. +// DeleteVpnConnectionRouteRequest generates a "aws/request.Request" representing the +// client's request for the DeleteVpnConnectionRoute operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the DeleteVpnConnectionRoute method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the DeleteVpnConnectionRouteRequest method. +// req, resp := client.DeleteVpnConnectionRouteRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) DeleteVpnConnectionRouteRequest(input *DeleteVpnConnectionRouteInput) (req *request.Request, output *DeleteVpnConnectionRouteOutput) { op := &request.Operation{ Name: opDeleteVpnConnectionRoute, @@ -2675,7 +4281,28 @@ func (c *EC2) DeleteVpnConnectionRoute(input *DeleteVpnConnectionRouteInput) (*D const opDeleteVpnGateway = "DeleteVpnGateway" -// DeleteVpnGatewayRequest generates a request for the DeleteVpnGateway operation. +// DeleteVpnGatewayRequest generates a "aws/request.Request" representing the +// client's request for the DeleteVpnGateway operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the DeleteVpnGateway method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the DeleteVpnGatewayRequest method. +// req, resp := client.DeleteVpnGatewayRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) DeleteVpnGatewayRequest(input *DeleteVpnGatewayInput) (req *request.Request, output *DeleteVpnGatewayOutput) { op := &request.Operation{ Name: opDeleteVpnGateway, @@ -2708,7 +4335,28 @@ func (c *EC2) DeleteVpnGateway(input *DeleteVpnGatewayInput) (*DeleteVpnGatewayO const opDeregisterImage = "DeregisterImage" -// DeregisterImageRequest generates a request for the DeregisterImage operation. +// DeregisterImageRequest generates a "aws/request.Request" representing the +// client's request for the DeregisterImage operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the DeregisterImage method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the DeregisterImageRequest method. +// req, resp := client.DeregisterImageRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) DeregisterImageRequest(input *DeregisterImageInput) (req *request.Request, output *DeregisterImageOutput) { op := &request.Operation{ Name: opDeregisterImage, @@ -2740,7 +4388,28 @@ func (c *EC2) DeregisterImage(input *DeregisterImageInput) (*DeregisterImageOutp const opDescribeAccountAttributes = "DescribeAccountAttributes" -// DescribeAccountAttributesRequest generates a request for the DescribeAccountAttributes operation. +// DescribeAccountAttributesRequest generates a "aws/request.Request" representing the +// client's request for the DescribeAccountAttributes operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the DescribeAccountAttributes method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the DescribeAccountAttributesRequest method. +// req, resp := client.DescribeAccountAttributesRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) DescribeAccountAttributesRequest(input *DescribeAccountAttributesInput) (req *request.Request, output *DescribeAccountAttributesOutput) { op := &request.Operation{ Name: opDescribeAccountAttributes, @@ -2761,22 +4430,22 @@ func (c *EC2) DescribeAccountAttributesRequest(input *DescribeAccountAttributesI // Describes attributes of your AWS account. The following are the supported // account attributes: // -// supported-platforms: Indicates whether your account can launch instances +// 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. +// 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 +// max-instances: The maximum number of On-Demand instances that you can // run. // -// vpc-max-security-groups-per-interface: The maximum number of security +// 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. +// 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. +// 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) (*DescribeAccountAttributesOutput, error) { req, out := c.DescribeAccountAttributesRequest(input) err := req.Send() @@ -2785,7 +4454,28 @@ func (c *EC2) DescribeAccountAttributes(input *DescribeAccountAttributesInput) ( const opDescribeAddresses = "DescribeAddresses" -// DescribeAddressesRequest generates a request for the DescribeAddresses operation. +// DescribeAddressesRequest generates a "aws/request.Request" representing the +// client's request for the DescribeAddresses operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the DescribeAddresses method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the DescribeAddressesRequest method. +// req, resp := client.DescribeAddressesRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) DescribeAddressesRequest(input *DescribeAddressesInput) (req *request.Request, output *DescribeAddressesOutput) { op := &request.Operation{ Name: opDescribeAddresses, @@ -2816,7 +4506,28 @@ func (c *EC2) DescribeAddresses(input *DescribeAddressesInput) (*DescribeAddress const opDescribeAvailabilityZones = "DescribeAvailabilityZones" -// DescribeAvailabilityZonesRequest generates a request for the DescribeAvailabilityZones operation. +// DescribeAvailabilityZonesRequest generates a "aws/request.Request" representing the +// client's request for the DescribeAvailabilityZones operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the DescribeAvailabilityZones method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the DescribeAvailabilityZonesRequest method. +// req, resp := client.DescribeAvailabilityZonesRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) DescribeAvailabilityZonesRequest(input *DescribeAvailabilityZonesInput) (req *request.Request, output *DescribeAvailabilityZonesOutput) { op := &request.Operation{ Name: opDescribeAvailabilityZones, @@ -2849,7 +4560,28 @@ func (c *EC2) DescribeAvailabilityZones(input *DescribeAvailabilityZonesInput) ( const opDescribeBundleTasks = "DescribeBundleTasks" -// DescribeBundleTasksRequest generates a request for the DescribeBundleTasks operation. +// DescribeBundleTasksRequest generates a "aws/request.Request" representing the +// client's request for the DescribeBundleTasks operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the DescribeBundleTasks method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the DescribeBundleTasksRequest method. +// req, resp := client.DescribeBundleTasksRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) DescribeBundleTasksRequest(input *DescribeBundleTasksInput) (req *request.Request, output *DescribeBundleTasksOutput) { op := &request.Operation{ Name: opDescribeBundleTasks, @@ -2869,7 +4601,7 @@ func (c *EC2) DescribeBundleTasksRequest(input *DescribeBundleTasksInput) (req * // Describes one or more of your bundling tasks. // -// Completed bundle tasks are listed for only a limited time. If your bundle +// 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. @@ -2881,7 +4613,28 @@ func (c *EC2) DescribeBundleTasks(input *DescribeBundleTasksInput) (*DescribeBun const opDescribeClassicLinkInstances = "DescribeClassicLinkInstances" -// DescribeClassicLinkInstancesRequest generates a request for the DescribeClassicLinkInstances operation. +// DescribeClassicLinkInstancesRequest generates a "aws/request.Request" representing the +// client's request for the DescribeClassicLinkInstances operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the DescribeClassicLinkInstances method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the DescribeClassicLinkInstancesRequest method. +// req, resp := client.DescribeClassicLinkInstancesRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) DescribeClassicLinkInstancesRequest(input *DescribeClassicLinkInstancesInput) (req *request.Request, output *DescribeClassicLinkInstancesOutput) { op := &request.Operation{ Name: opDescribeClassicLinkInstances, @@ -2911,7 +4664,28 @@ func (c *EC2) DescribeClassicLinkInstances(input *DescribeClassicLinkInstancesIn const opDescribeConversionTasks = "DescribeConversionTasks" -// DescribeConversionTasksRequest generates a request for the DescribeConversionTasks operation. +// DescribeConversionTasksRequest generates a "aws/request.Request" representing the +// client's request for the DescribeConversionTasks operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the DescribeConversionTasks method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the DescribeConversionTasksRequest method. +// req, resp := client.DescribeConversionTasksRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) DescribeConversionTasksRequest(input *DescribeConversionTasksInput) (req *request.Request, output *DescribeConversionTasksOutput) { op := &request.Operation{ Name: opDescribeConversionTasks, @@ -2930,9 +4704,10 @@ func (c *EC2) DescribeConversionTasksRequest(input *DescribeConversionTasksInput } // 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. +// the VM Import/Export User Guide (http://docs.aws.amazon.com/vm-import/latest/userguide/). +// +// For information about the import manifest referenced by this API action, +// see VM Import Manifest (http://docs.aws.amazon.com/AWSEC2/latest/APIReference/manifest.html). func (c *EC2) DescribeConversionTasks(input *DescribeConversionTasksInput) (*DescribeConversionTasksOutput, error) { req, out := c.DescribeConversionTasksRequest(input) err := req.Send() @@ -2941,7 +4716,28 @@ func (c *EC2) DescribeConversionTasks(input *DescribeConversionTasksInput) (*Des const opDescribeCustomerGateways = "DescribeCustomerGateways" -// DescribeCustomerGatewaysRequest generates a request for the DescribeCustomerGateways operation. +// DescribeCustomerGatewaysRequest generates a "aws/request.Request" representing the +// client's request for the DescribeCustomerGateways operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the DescribeCustomerGateways method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the DescribeCustomerGatewaysRequest method. +// req, resp := client.DescribeCustomerGatewaysRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) DescribeCustomerGatewaysRequest(input *DescribeCustomerGatewaysInput) (req *request.Request, output *DescribeCustomerGatewaysOutput) { op := &request.Operation{ Name: opDescribeCustomerGateways, @@ -2972,7 +4768,28 @@ func (c *EC2) DescribeCustomerGateways(input *DescribeCustomerGatewaysInput) (*D const opDescribeDhcpOptions = "DescribeDhcpOptions" -// DescribeDhcpOptionsRequest generates a request for the DescribeDhcpOptions operation. +// DescribeDhcpOptionsRequest generates a "aws/request.Request" representing the +// client's request for the DescribeDhcpOptions operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the DescribeDhcpOptions method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the DescribeDhcpOptionsRequest method. +// req, resp := client.DescribeDhcpOptionsRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) DescribeDhcpOptionsRequest(input *DescribeDhcpOptionsInput) (req *request.Request, output *DescribeDhcpOptionsOutput) { op := &request.Operation{ Name: opDescribeDhcpOptions, @@ -3002,7 +4819,28 @@ func (c *EC2) DescribeDhcpOptions(input *DescribeDhcpOptionsInput) (*DescribeDhc const opDescribeExportTasks = "DescribeExportTasks" -// DescribeExportTasksRequest generates a request for the DescribeExportTasks operation. +// DescribeExportTasksRequest generates a "aws/request.Request" representing the +// client's request for the DescribeExportTasks operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the DescribeExportTasks method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the DescribeExportTasksRequest method. +// req, resp := client.DescribeExportTasksRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) DescribeExportTasksRequest(input *DescribeExportTasksInput) (req *request.Request, output *DescribeExportTasksOutput) { op := &request.Operation{ Name: opDescribeExportTasks, @@ -3029,7 +4867,28 @@ func (c *EC2) DescribeExportTasks(input *DescribeExportTasksInput) (*DescribeExp const opDescribeFlowLogs = "DescribeFlowLogs" -// DescribeFlowLogsRequest generates a request for the DescribeFlowLogs operation. +// DescribeFlowLogsRequest generates a "aws/request.Request" representing the +// client's request for the DescribeFlowLogs operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the DescribeFlowLogs method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the DescribeFlowLogsRequest method. +// req, resp := client.DescribeFlowLogsRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) DescribeFlowLogsRequest(input *DescribeFlowLogsInput) (req *request.Request, output *DescribeFlowLogsOutput) { op := &request.Operation{ Name: opDescribeFlowLogs, @@ -3056,9 +4915,135 @@ func (c *EC2) DescribeFlowLogs(input *DescribeFlowLogsInput) (*DescribeFlowLogsO return out, err } +const opDescribeHostReservationOfferings = "DescribeHostReservationOfferings" + +// DescribeHostReservationOfferingsRequest generates a "aws/request.Request" representing the +// client's request for the DescribeHostReservationOfferings operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the DescribeHostReservationOfferings method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the DescribeHostReservationOfferingsRequest method. +// req, resp := client.DescribeHostReservationOfferingsRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +func (c *EC2) DescribeHostReservationOfferingsRequest(input *DescribeHostReservationOfferingsInput) (req *request.Request, output *DescribeHostReservationOfferingsOutput) { + op := &request.Operation{ + Name: opDescribeHostReservationOfferings, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &DescribeHostReservationOfferingsInput{} + } + + req = c.newRequest(op, input, output) + output = &DescribeHostReservationOfferingsOutput{} + req.Data = output + return +} + +// Describes the Dedicated Host Reservations that are available to purchase. +// +// The results describe all the Dedicated Host Reservation offerings, including +// offerings that may not match the instance family and region of your Dedicated +// Hosts. When purchasing an offering, ensure that the the instance family and +// region of the offering matches that of the Dedicated Host/s it will be associated +// with. For an overview of supported instance types, see Dedicated Hosts Overview +// (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/dedicated-hosts-overview.html) +// in the Amazon Elastic Compute Cloud User Guide. +func (c *EC2) DescribeHostReservationOfferings(input *DescribeHostReservationOfferingsInput) (*DescribeHostReservationOfferingsOutput, error) { + req, out := c.DescribeHostReservationOfferingsRequest(input) + err := req.Send() + return out, err +} + +const opDescribeHostReservations = "DescribeHostReservations" + +// DescribeHostReservationsRequest generates a "aws/request.Request" representing the +// client's request for the DescribeHostReservations operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the DescribeHostReservations method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the DescribeHostReservationsRequest method. +// req, resp := client.DescribeHostReservationsRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +func (c *EC2) DescribeHostReservationsRequest(input *DescribeHostReservationsInput) (req *request.Request, output *DescribeHostReservationsOutput) { + op := &request.Operation{ + Name: opDescribeHostReservations, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &DescribeHostReservationsInput{} + } + + req = c.newRequest(op, input, output) + output = &DescribeHostReservationsOutput{} + req.Data = output + return +} + +// Describes Dedicated Host Reservations which are associated with Dedicated +// Hosts in your account. +func (c *EC2) DescribeHostReservations(input *DescribeHostReservationsInput) (*DescribeHostReservationsOutput, error) { + req, out := c.DescribeHostReservationsRequest(input) + err := req.Send() + return out, err +} + const opDescribeHosts = "DescribeHosts" -// DescribeHostsRequest generates a request for the DescribeHosts operation. +// DescribeHostsRequest generates a "aws/request.Request" representing the +// client's request for the DescribeHosts operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the DescribeHosts method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the DescribeHostsRequest method. +// req, resp := client.DescribeHostsRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) DescribeHostsRequest(input *DescribeHostsInput) (req *request.Request, output *DescribeHostsOutput) { op := &request.Operation{ Name: opDescribeHosts, @@ -3076,11 +5061,11 @@ func (c *EC2) DescribeHostsRequest(input *DescribeHostsInput) (req *request.Requ return } -// Describes one or more of your Dedicated hosts. +// Describes one or more of your Dedicated Hosts. // -// The results describe only the Dedicated hosts in the region you're currently -// using. All listed instances consume capacity on your Dedicated host. Dedicated -// hosts that have recently been released will be listed with the state released. +// The results describe only the Dedicated Hosts in the region you're currently +// using. All listed instances consume capacity on your Dedicated Host. Dedicated +// Hosts that have recently been released will be listed with the state released. func (c *EC2) DescribeHosts(input *DescribeHostsInput) (*DescribeHostsOutput, error) { req, out := c.DescribeHostsRequest(input) err := req.Send() @@ -3089,7 +5074,28 @@ func (c *EC2) DescribeHosts(input *DescribeHostsInput) (*DescribeHostsOutput, er const opDescribeIdFormat = "DescribeIdFormat" -// DescribeIdFormatRequest generates a request for the DescribeIdFormat operation. +// DescribeIdFormatRequest generates a "aws/request.Request" representing the +// client's request for the DescribeIdFormat operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the DescribeIdFormat method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the DescribeIdFormatRequest method. +// req, resp := client.DescribeIdFormatRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) DescribeIdFormatRequest(input *DescribeIdFormatInput) (req *request.Request, output *DescribeIdFormatOutput) { op := &request.Operation{ Name: opDescribeIdFormat, @@ -3112,7 +5118,8 @@ func (c *EC2) DescribeIdFormatRequest(input *DescribeIdFormatInput) (req *reques // request only returns information about resource types whose ID formats can // be modified; it does not return information about other resource types. // -// The following resource types support longer IDs: instance | reservation. +// The following resource types support longer IDs: instance | reservation +// | snapshot | volume. // // These settings apply to the IAM user who makes the request; they do not // apply to the entire AWS account. By default, an IAM user defaults to the @@ -3127,9 +5134,89 @@ func (c *EC2) DescribeIdFormat(input *DescribeIdFormatInput) (*DescribeIdFormatO return out, err } +const opDescribeIdentityIdFormat = "DescribeIdentityIdFormat" + +// DescribeIdentityIdFormatRequest generates a "aws/request.Request" representing the +// client's request for the DescribeIdentityIdFormat operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the DescribeIdentityIdFormat method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the DescribeIdentityIdFormatRequest method. +// req, resp := client.DescribeIdentityIdFormatRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +func (c *EC2) DescribeIdentityIdFormatRequest(input *DescribeIdentityIdFormatInput) (req *request.Request, output *DescribeIdentityIdFormatOutput) { + op := &request.Operation{ + Name: opDescribeIdentityIdFormat, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &DescribeIdentityIdFormatInput{} + } + + req = c.newRequest(op, input, output) + output = &DescribeIdentityIdFormatOutput{} + req.Data = output + return +} + +// Describes the ID format settings for resources for the specified IAM user, +// IAM role, or root user. For example, you can view the resource types that +// are enabled for longer IDs. This request only returns information about resource +// types whose ID formats can be modified; it does not return information about +// other resource types. For more information, see Resource IDs (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/resource-ids.html) +// in the Amazon Elastic Compute Cloud User Guide. +// +// The following resource types support longer IDs: instance | reservation +// | snapshot | volume. +// +// These settings apply to the principal specified in the request. They do +// not apply to the principal that makes the request. +func (c *EC2) DescribeIdentityIdFormat(input *DescribeIdentityIdFormatInput) (*DescribeIdentityIdFormatOutput, error) { + req, out := c.DescribeIdentityIdFormatRequest(input) + err := req.Send() + return out, err +} + const opDescribeImageAttribute = "DescribeImageAttribute" -// DescribeImageAttributeRequest generates a request for the DescribeImageAttribute operation. +// DescribeImageAttributeRequest generates a "aws/request.Request" representing the +// client's request for the DescribeImageAttribute operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the DescribeImageAttribute method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the DescribeImageAttributeRequest method. +// req, resp := client.DescribeImageAttributeRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) DescribeImageAttributeRequest(input *DescribeImageAttributeInput) (req *request.Request, output *DescribeImageAttributeOutput) { op := &request.Operation{ Name: opDescribeImageAttribute, @@ -3157,7 +5244,28 @@ func (c *EC2) DescribeImageAttribute(input *DescribeImageAttributeInput) (*Descr const opDescribeImages = "DescribeImages" -// DescribeImagesRequest generates a request for the DescribeImages operation. +// DescribeImagesRequest generates a "aws/request.Request" representing the +// client's request for the DescribeImages operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the DescribeImages method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the DescribeImagesRequest method. +// req, resp := client.DescribeImagesRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) DescribeImagesRequest(input *DescribeImagesInput) (req *request.Request, output *DescribeImagesOutput) { op := &request.Operation{ Name: opDescribeImages, @@ -3180,7 +5288,7 @@ func (c *EC2) DescribeImagesRequest(input *DescribeImagesInput) (req *request.Re // 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 +// Deregistered images are included in the returned results for an unspecified // interval after deregistration. func (c *EC2) DescribeImages(input *DescribeImagesInput) (*DescribeImagesOutput, error) { req, out := c.DescribeImagesRequest(input) @@ -3190,7 +5298,28 @@ func (c *EC2) DescribeImages(input *DescribeImagesInput) (*DescribeImagesOutput, const opDescribeImportImageTasks = "DescribeImportImageTasks" -// DescribeImportImageTasksRequest generates a request for the DescribeImportImageTasks operation. +// DescribeImportImageTasksRequest generates a "aws/request.Request" representing the +// client's request for the DescribeImportImageTasks operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the DescribeImportImageTasks method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the DescribeImportImageTasksRequest method. +// req, resp := client.DescribeImportImageTasksRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) DescribeImportImageTasksRequest(input *DescribeImportImageTasksInput) (req *request.Request, output *DescribeImportImageTasksOutput) { op := &request.Operation{ Name: opDescribeImportImageTasks, @@ -3218,7 +5347,28 @@ func (c *EC2) DescribeImportImageTasks(input *DescribeImportImageTasksInput) (*D const opDescribeImportSnapshotTasks = "DescribeImportSnapshotTasks" -// DescribeImportSnapshotTasksRequest generates a request for the DescribeImportSnapshotTasks operation. +// DescribeImportSnapshotTasksRequest generates a "aws/request.Request" representing the +// client's request for the DescribeImportSnapshotTasks operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the DescribeImportSnapshotTasks method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the DescribeImportSnapshotTasksRequest method. +// req, resp := client.DescribeImportSnapshotTasksRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) DescribeImportSnapshotTasksRequest(input *DescribeImportSnapshotTasksInput) (req *request.Request, output *DescribeImportSnapshotTasksOutput) { op := &request.Operation{ Name: opDescribeImportSnapshotTasks, @@ -3245,7 +5395,28 @@ func (c *EC2) DescribeImportSnapshotTasks(input *DescribeImportSnapshotTasksInpu const opDescribeInstanceAttribute = "DescribeInstanceAttribute" -// DescribeInstanceAttributeRequest generates a request for the DescribeInstanceAttribute operation. +// DescribeInstanceAttributeRequest generates a "aws/request.Request" representing the +// client's request for the DescribeInstanceAttribute operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the DescribeInstanceAttribute method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the DescribeInstanceAttributeRequest method. +// req, resp := client.DescribeInstanceAttributeRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) DescribeInstanceAttributeRequest(input *DescribeInstanceAttributeInput) (req *request.Request, output *DescribeInstanceAttributeOutput) { op := &request.Operation{ Name: opDescribeInstanceAttribute, @@ -3276,7 +5447,28 @@ func (c *EC2) DescribeInstanceAttribute(input *DescribeInstanceAttributeInput) ( const opDescribeInstanceStatus = "DescribeInstanceStatus" -// DescribeInstanceStatusRequest generates a request for the DescribeInstanceStatus operation. +// DescribeInstanceStatusRequest generates a "aws/request.Request" representing the +// client's request for the DescribeInstanceStatus operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the DescribeInstanceStatus method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the DescribeInstanceStatusRequest method. +// req, resp := client.DescribeInstanceStatusRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) DescribeInstanceStatusRequest(input *DescribeInstanceStatusInput) (req *request.Request, output *DescribeInstanceStatusOutput) { op := &request.Operation{ Name: opDescribeInstanceStatus, @@ -3300,23 +5492,24 @@ func (c *EC2) DescribeInstanceStatusRequest(input *DescribeInstanceStatusInput) return } -// Describes the status of one or more instances. +// Describes the status of one or more instances. By default, only running instances +// are described, unless specified otherwise. // // Instance status includes the following components: // -// Status checks - Amazon EC2 performs status checks on running EC2 instances +// Status checks - Amazon EC2 performs status checks on running EC2 instances // to identify hardware and software issues. For more information, see Status // Checks for Your Instances (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/monitoring-system-instance-status-check.html) // and Troubleshooting Instances with Failed Status Checks (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/TroubleshootingInstances.html) // in the Amazon Elastic Compute Cloud User Guide. // -// Scheduled events - Amazon EC2 can schedule events (such as reboot, stop, +// Scheduled events - Amazon EC2 can schedule events (such as reboot, stop, // or terminate) for your instances related to hardware issues, software updates, // or system maintenance. For more information, see Scheduled Events for Your // Instances (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/monitoring-instances-status-check_sched.html) // in the Amazon Elastic Compute Cloud User Guide. // -// Instance state - You can manage your instances from the moment you launch +// Instance state - You can manage your instances from the moment you launch // them through their termination. For more information, see Instance Lifecycle // (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-lifecycle.html) // in the Amazon Elastic Compute Cloud User Guide. @@ -3326,6 +5519,23 @@ func (c *EC2) DescribeInstanceStatus(input *DescribeInstanceStatusInput) (*Descr return out, err } +// DescribeInstanceStatusPages iterates over the pages of a DescribeInstanceStatus operation, +// calling the "fn" function with the response data for each page. To stop +// iterating, return false from the fn function. +// +// See DescribeInstanceStatus method for more information on how to use this operation. +// +// Note: This operation can generate multiple requests to a service. +// +// // Example iterating over at most 3 pages of a DescribeInstanceStatus operation. +// pageNum := 0 +// err := client.DescribeInstanceStatusPages(params, +// func(page *DescribeInstanceStatusOutput, lastPage bool) bool { +// pageNum++ +// fmt.Println(page) +// return pageNum <= 3 +// }) +// func (c *EC2) DescribeInstanceStatusPages(input *DescribeInstanceStatusInput, fn func(p *DescribeInstanceStatusOutput, lastPage bool) (shouldContinue bool)) error { page, _ := c.DescribeInstanceStatusRequest(input) page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) @@ -3336,7 +5546,28 @@ func (c *EC2) DescribeInstanceStatusPages(input *DescribeInstanceStatusInput, fn const opDescribeInstances = "DescribeInstances" -// DescribeInstancesRequest generates a request for the DescribeInstances operation. +// DescribeInstancesRequest generates a "aws/request.Request" representing the +// client's request for the DescribeInstances operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the DescribeInstances method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the DescribeInstancesRequest method. +// req, resp := client.DescribeInstancesRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) DescribeInstancesRequest(input *DescribeInstancesInput) (req *request.Request, output *DescribeInstancesOutput) { op := &request.Operation{ Name: opDescribeInstances, @@ -3370,12 +5601,35 @@ func (c *EC2) DescribeInstancesRequest(input *DescribeInstancesInput) (req *requ // // Recently terminated instances might appear in the returned results. This // interval is usually less than one hour. +// +// If you describe instances in the rare case where an Availability Zone is +// experiencing a service disruption and you specify instance IDs that are in +// the affected zone, or do not specify any instance IDs at all, the call fails. +// If you describe instances and specify only instance IDs that are in an unaffected +// zone, the call works normally. func (c *EC2) DescribeInstances(input *DescribeInstancesInput) (*DescribeInstancesOutput, error) { req, out := c.DescribeInstancesRequest(input) err := req.Send() return out, err } +// DescribeInstancesPages iterates over the pages of a DescribeInstances operation, +// calling the "fn" function with the response data for each page. To stop +// iterating, return false from the fn function. +// +// See DescribeInstances method for more information on how to use this operation. +// +// Note: This operation can generate multiple requests to a service. +// +// // Example iterating over at most 3 pages of a DescribeInstances operation. +// pageNum := 0 +// err := client.DescribeInstancesPages(params, +// func(page *DescribeInstancesOutput, lastPage bool) bool { +// pageNum++ +// fmt.Println(page) +// return pageNum <= 3 +// }) +// func (c *EC2) DescribeInstancesPages(input *DescribeInstancesInput, fn func(p *DescribeInstancesOutput, lastPage bool) (shouldContinue bool)) error { page, _ := c.DescribeInstancesRequest(input) page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) @@ -3386,7 +5640,28 @@ func (c *EC2) DescribeInstancesPages(input *DescribeInstancesInput, fn func(p *D const opDescribeInternetGateways = "DescribeInternetGateways" -// DescribeInternetGatewaysRequest generates a request for the DescribeInternetGateways operation. +// DescribeInternetGatewaysRequest generates a "aws/request.Request" representing the +// client's request for the DescribeInternetGateways operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the DescribeInternetGateways method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the DescribeInternetGatewaysRequest method. +// req, resp := client.DescribeInternetGatewaysRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) DescribeInternetGatewaysRequest(input *DescribeInternetGatewaysInput) (req *request.Request, output *DescribeInternetGatewaysOutput) { op := &request.Operation{ Name: opDescribeInternetGateways, @@ -3413,7 +5688,28 @@ func (c *EC2) DescribeInternetGateways(input *DescribeInternetGatewaysInput) (*D const opDescribeKeyPairs = "DescribeKeyPairs" -// DescribeKeyPairsRequest generates a request for the DescribeKeyPairs operation. +// DescribeKeyPairsRequest generates a "aws/request.Request" representing the +// client's request for the DescribeKeyPairs operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the DescribeKeyPairs method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the DescribeKeyPairsRequest method. +// req, resp := client.DescribeKeyPairsRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) DescribeKeyPairsRequest(input *DescribeKeyPairsInput) (req *request.Request, output *DescribeKeyPairsOutput) { op := &request.Operation{ Name: opDescribeKeyPairs, @@ -3443,7 +5739,28 @@ func (c *EC2) DescribeKeyPairs(input *DescribeKeyPairsInput) (*DescribeKeyPairsO const opDescribeMovingAddresses = "DescribeMovingAddresses" -// DescribeMovingAddressesRequest generates a request for the DescribeMovingAddresses operation. +// DescribeMovingAddressesRequest generates a "aws/request.Request" representing the +// client's request for the DescribeMovingAddresses operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the DescribeMovingAddresses method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the DescribeMovingAddressesRequest method. +// req, resp := client.DescribeMovingAddressesRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) DescribeMovingAddressesRequest(input *DescribeMovingAddressesInput) (req *request.Request, output *DescribeMovingAddressesOutput) { op := &request.Operation{ Name: opDescribeMovingAddresses, @@ -3472,7 +5789,28 @@ func (c *EC2) DescribeMovingAddresses(input *DescribeMovingAddressesInput) (*Des const opDescribeNatGateways = "DescribeNatGateways" -// DescribeNatGatewaysRequest generates a request for the DescribeNatGateways operation. +// DescribeNatGatewaysRequest generates a "aws/request.Request" representing the +// client's request for the DescribeNatGateways operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the DescribeNatGateways method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the DescribeNatGatewaysRequest method. +// req, resp := client.DescribeNatGatewaysRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) DescribeNatGatewaysRequest(input *DescribeNatGatewaysInput) (req *request.Request, output *DescribeNatGatewaysOutput) { op := &request.Operation{ Name: opDescribeNatGateways, @@ -3499,7 +5837,28 @@ func (c *EC2) DescribeNatGateways(input *DescribeNatGatewaysInput) (*DescribeNat const opDescribeNetworkAcls = "DescribeNetworkAcls" -// DescribeNetworkAclsRequest generates a request for the DescribeNetworkAcls operation. +// DescribeNetworkAclsRequest generates a "aws/request.Request" representing the +// client's request for the DescribeNetworkAcls operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the DescribeNetworkAcls method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the DescribeNetworkAclsRequest method. +// req, resp := client.DescribeNetworkAclsRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) DescribeNetworkAclsRequest(input *DescribeNetworkAclsInput) (req *request.Request, output *DescribeNetworkAclsOutput) { op := &request.Operation{ Name: opDescribeNetworkAcls, @@ -3529,7 +5888,28 @@ func (c *EC2) DescribeNetworkAcls(input *DescribeNetworkAclsInput) (*DescribeNet const opDescribeNetworkInterfaceAttribute = "DescribeNetworkInterfaceAttribute" -// DescribeNetworkInterfaceAttributeRequest generates a request for the DescribeNetworkInterfaceAttribute operation. +// DescribeNetworkInterfaceAttributeRequest generates a "aws/request.Request" representing the +// client's request for the DescribeNetworkInterfaceAttribute operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the DescribeNetworkInterfaceAttribute method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the DescribeNetworkInterfaceAttributeRequest method. +// req, resp := client.DescribeNetworkInterfaceAttributeRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) DescribeNetworkInterfaceAttributeRequest(input *DescribeNetworkInterfaceAttributeInput) (req *request.Request, output *DescribeNetworkInterfaceAttributeOutput) { op := &request.Operation{ Name: opDescribeNetworkInterfaceAttribute, @@ -3557,7 +5937,28 @@ func (c *EC2) DescribeNetworkInterfaceAttribute(input *DescribeNetworkInterfaceA const opDescribeNetworkInterfaces = "DescribeNetworkInterfaces" -// DescribeNetworkInterfacesRequest generates a request for the DescribeNetworkInterfaces operation. +// DescribeNetworkInterfacesRequest generates a "aws/request.Request" representing the +// client's request for the DescribeNetworkInterfaces operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the DescribeNetworkInterfaces method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the DescribeNetworkInterfacesRequest method. +// req, resp := client.DescribeNetworkInterfacesRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) DescribeNetworkInterfacesRequest(input *DescribeNetworkInterfacesInput) (req *request.Request, output *DescribeNetworkInterfacesOutput) { op := &request.Operation{ Name: opDescribeNetworkInterfaces, @@ -3584,7 +5985,28 @@ func (c *EC2) DescribeNetworkInterfaces(input *DescribeNetworkInterfacesInput) ( const opDescribePlacementGroups = "DescribePlacementGroups" -// DescribePlacementGroupsRequest generates a request for the DescribePlacementGroups operation. +// DescribePlacementGroupsRequest generates a "aws/request.Request" representing the +// client's request for the DescribePlacementGroups operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the DescribePlacementGroups method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the DescribePlacementGroupsRequest method. +// req, resp := client.DescribePlacementGroupsRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) DescribePlacementGroupsRequest(input *DescribePlacementGroupsInput) (req *request.Request, output *DescribePlacementGroupsOutput) { op := &request.Operation{ Name: opDescribePlacementGroups, @@ -3613,7 +6035,28 @@ func (c *EC2) DescribePlacementGroups(input *DescribePlacementGroupsInput) (*Des const opDescribePrefixLists = "DescribePrefixLists" -// DescribePrefixListsRequest generates a request for the DescribePrefixLists operation. +// DescribePrefixListsRequest generates a "aws/request.Request" representing the +// client's request for the DescribePrefixLists operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the DescribePrefixLists method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the DescribePrefixListsRequest method. +// req, resp := client.DescribePrefixListsRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) DescribePrefixListsRequest(input *DescribePrefixListsInput) (req *request.Request, output *DescribePrefixListsOutput) { op := &request.Operation{ Name: opDescribePrefixLists, @@ -3644,7 +6087,28 @@ func (c *EC2) DescribePrefixLists(input *DescribePrefixListsInput) (*DescribePre const opDescribeRegions = "DescribeRegions" -// DescribeRegionsRequest generates a request for the DescribeRegions operation. +// DescribeRegionsRequest generates a "aws/request.Request" representing the +// client's request for the DescribeRegions operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the DescribeRegions method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the DescribeRegionsRequest method. +// req, resp := client.DescribeRegionsRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) DescribeRegionsRequest(input *DescribeRegionsInput) (req *request.Request, output *DescribeRegionsOutput) { op := &request.Operation{ Name: opDescribeRegions, @@ -3674,7 +6138,28 @@ func (c *EC2) DescribeRegions(input *DescribeRegionsInput) (*DescribeRegionsOutp const opDescribeReservedInstances = "DescribeReservedInstances" -// DescribeReservedInstancesRequest generates a request for the DescribeReservedInstances operation. +// DescribeReservedInstancesRequest generates a "aws/request.Request" representing the +// client's request for the DescribeReservedInstances operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the DescribeReservedInstances method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the DescribeReservedInstancesRequest method. +// req, resp := client.DescribeReservedInstancesRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) DescribeReservedInstancesRequest(input *DescribeReservedInstancesInput) (req *request.Request, output *DescribeReservedInstancesOutput) { op := &request.Operation{ Name: opDescribeReservedInstances, @@ -3704,7 +6189,28 @@ func (c *EC2) DescribeReservedInstances(input *DescribeReservedInstancesInput) ( const opDescribeReservedInstancesListings = "DescribeReservedInstancesListings" -// DescribeReservedInstancesListingsRequest generates a request for the DescribeReservedInstancesListings operation. +// DescribeReservedInstancesListingsRequest generates a "aws/request.Request" representing the +// client's request for the DescribeReservedInstancesListings operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the DescribeReservedInstancesListings method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the DescribeReservedInstancesListingsRequest method. +// req, resp := client.DescribeReservedInstancesListingsRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) DescribeReservedInstancesListingsRequest(input *DescribeReservedInstancesListingsInput) (req *request.Request, output *DescribeReservedInstancesListingsOutput) { op := &request.Operation{ Name: opDescribeReservedInstancesListings, @@ -3752,7 +6258,28 @@ func (c *EC2) DescribeReservedInstancesListings(input *DescribeReservedInstances const opDescribeReservedInstancesModifications = "DescribeReservedInstancesModifications" -// DescribeReservedInstancesModificationsRequest generates a request for the DescribeReservedInstancesModifications operation. +// DescribeReservedInstancesModificationsRequest generates a "aws/request.Request" representing the +// client's request for the DescribeReservedInstancesModifications operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the DescribeReservedInstancesModifications method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the DescribeReservedInstancesModificationsRequest method. +// req, resp := client.DescribeReservedInstancesModificationsRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) DescribeReservedInstancesModificationsRequest(input *DescribeReservedInstancesModificationsInput) (req *request.Request, output *DescribeReservedInstancesModificationsOutput) { op := &request.Operation{ Name: opDescribeReservedInstancesModifications, @@ -3789,6 +6316,23 @@ func (c *EC2) DescribeReservedInstancesModifications(input *DescribeReservedInst return out, err } +// DescribeReservedInstancesModificationsPages iterates over the pages of a DescribeReservedInstancesModifications operation, +// calling the "fn" function with the response data for each page. To stop +// iterating, return false from the fn function. +// +// See DescribeReservedInstancesModifications method for more information on how to use this operation. +// +// Note: This operation can generate multiple requests to a service. +// +// // Example iterating over at most 3 pages of a DescribeReservedInstancesModifications operation. +// pageNum := 0 +// err := client.DescribeReservedInstancesModificationsPages(params, +// func(page *DescribeReservedInstancesModificationsOutput, lastPage bool) bool { +// pageNum++ +// fmt.Println(page) +// return pageNum <= 3 +// }) +// func (c *EC2) DescribeReservedInstancesModificationsPages(input *DescribeReservedInstancesModificationsInput, fn func(p *DescribeReservedInstancesModificationsOutput, lastPage bool) (shouldContinue bool)) error { page, _ := c.DescribeReservedInstancesModificationsRequest(input) page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) @@ -3799,7 +6343,28 @@ func (c *EC2) DescribeReservedInstancesModificationsPages(input *DescribeReserve const opDescribeReservedInstancesOfferings = "DescribeReservedInstancesOfferings" -// DescribeReservedInstancesOfferingsRequest generates a request for the DescribeReservedInstancesOfferings operation. +// DescribeReservedInstancesOfferingsRequest generates a "aws/request.Request" representing the +// client's request for the DescribeReservedInstancesOfferings operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the DescribeReservedInstancesOfferings method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the DescribeReservedInstancesOfferingsRequest method. +// req, resp := client.DescribeReservedInstancesOfferingsRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) DescribeReservedInstancesOfferingsRequest(input *DescribeReservedInstancesOfferingsInput) (req *request.Request, output *DescribeReservedInstancesOfferingsOutput) { op := &request.Operation{ Name: opDescribeReservedInstancesOfferings, @@ -3841,6 +6406,23 @@ func (c *EC2) DescribeReservedInstancesOfferings(input *DescribeReservedInstance return out, err } +// DescribeReservedInstancesOfferingsPages iterates over the pages of a DescribeReservedInstancesOfferings operation, +// calling the "fn" function with the response data for each page. To stop +// iterating, return false from the fn function. +// +// See DescribeReservedInstancesOfferings method for more information on how to use this operation. +// +// Note: This operation can generate multiple requests to a service. +// +// // Example iterating over at most 3 pages of a DescribeReservedInstancesOfferings operation. +// pageNum := 0 +// err := client.DescribeReservedInstancesOfferingsPages(params, +// func(page *DescribeReservedInstancesOfferingsOutput, lastPage bool) bool { +// pageNum++ +// fmt.Println(page) +// return pageNum <= 3 +// }) +// func (c *EC2) DescribeReservedInstancesOfferingsPages(input *DescribeReservedInstancesOfferingsInput, fn func(p *DescribeReservedInstancesOfferingsOutput, lastPage bool) (shouldContinue bool)) error { page, _ := c.DescribeReservedInstancesOfferingsRequest(input) page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) @@ -3851,7 +6433,28 @@ func (c *EC2) DescribeReservedInstancesOfferingsPages(input *DescribeReservedIns const opDescribeRouteTables = "DescribeRouteTables" -// DescribeRouteTablesRequest generates a request for the DescribeRouteTables operation. +// DescribeRouteTablesRequest generates a "aws/request.Request" representing the +// client's request for the DescribeRouteTables operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the DescribeRouteTables method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the DescribeRouteTablesRequest method. +// req, resp := client.DescribeRouteTablesRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) DescribeRouteTablesRequest(input *DescribeRouteTablesInput) (req *request.Request, output *DescribeRouteTablesOutput) { op := &request.Operation{ Name: opDescribeRouteTables, @@ -3886,7 +6489,28 @@ func (c *EC2) DescribeRouteTables(input *DescribeRouteTablesInput) (*DescribeRou const opDescribeScheduledInstanceAvailability = "DescribeScheduledInstanceAvailability" -// DescribeScheduledInstanceAvailabilityRequest generates a request for the DescribeScheduledInstanceAvailability operation. +// DescribeScheduledInstanceAvailabilityRequest generates a "aws/request.Request" representing the +// client's request for the DescribeScheduledInstanceAvailability operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the DescribeScheduledInstanceAvailability method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the DescribeScheduledInstanceAvailabilityRequest method. +// req, resp := client.DescribeScheduledInstanceAvailabilityRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) DescribeScheduledInstanceAvailabilityRequest(input *DescribeScheduledInstanceAvailabilityInput) (req *request.Request, output *DescribeScheduledInstanceAvailabilityOutput) { op := &request.Operation{ Name: opDescribeScheduledInstanceAvailability, @@ -3921,7 +6545,28 @@ func (c *EC2) DescribeScheduledInstanceAvailability(input *DescribeScheduledInst const opDescribeScheduledInstances = "DescribeScheduledInstances" -// DescribeScheduledInstancesRequest generates a request for the DescribeScheduledInstances operation. +// DescribeScheduledInstancesRequest generates a "aws/request.Request" representing the +// client's request for the DescribeScheduledInstances operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the DescribeScheduledInstances method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the DescribeScheduledInstancesRequest method. +// req, resp := client.DescribeScheduledInstancesRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) DescribeScheduledInstancesRequest(input *DescribeScheduledInstancesInput) (req *request.Request, output *DescribeScheduledInstancesOutput) { op := &request.Operation{ Name: opDescribeScheduledInstances, @@ -3946,9 +6591,79 @@ func (c *EC2) DescribeScheduledInstances(input *DescribeScheduledInstancesInput) return out, err } +const opDescribeSecurityGroupReferences = "DescribeSecurityGroupReferences" + +// DescribeSecurityGroupReferencesRequest generates a "aws/request.Request" representing the +// client's request for the DescribeSecurityGroupReferences operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the DescribeSecurityGroupReferences method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the DescribeSecurityGroupReferencesRequest method. +// req, resp := client.DescribeSecurityGroupReferencesRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +func (c *EC2) DescribeSecurityGroupReferencesRequest(input *DescribeSecurityGroupReferencesInput) (req *request.Request, output *DescribeSecurityGroupReferencesOutput) { + op := &request.Operation{ + Name: opDescribeSecurityGroupReferences, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &DescribeSecurityGroupReferencesInput{} + } + + req = c.newRequest(op, input, output) + output = &DescribeSecurityGroupReferencesOutput{} + req.Data = output + return +} + +// [EC2-VPC only] Describes the VPCs on the other side of a VPC peering connection +// that are referencing the security groups you've specified in this request. +func (c *EC2) DescribeSecurityGroupReferences(input *DescribeSecurityGroupReferencesInput) (*DescribeSecurityGroupReferencesOutput, error) { + req, out := c.DescribeSecurityGroupReferencesRequest(input) + err := req.Send() + return out, err +} + const opDescribeSecurityGroups = "DescribeSecurityGroups" -// DescribeSecurityGroupsRequest generates a request for the DescribeSecurityGroups operation. +// DescribeSecurityGroupsRequest generates a "aws/request.Request" representing the +// client's request for the DescribeSecurityGroups operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the DescribeSecurityGroups method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the DescribeSecurityGroupsRequest method. +// req, resp := client.DescribeSecurityGroupsRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) DescribeSecurityGroupsRequest(input *DescribeSecurityGroupsInput) (req *request.Request, output *DescribeSecurityGroupsOutput) { op := &request.Operation{ Name: opDescribeSecurityGroups, @@ -3982,7 +6697,28 @@ func (c *EC2) DescribeSecurityGroups(input *DescribeSecurityGroupsInput) (*Descr const opDescribeSnapshotAttribute = "DescribeSnapshotAttribute" -// DescribeSnapshotAttributeRequest generates a request for the DescribeSnapshotAttribute operation. +// DescribeSnapshotAttributeRequest generates a "aws/request.Request" representing the +// client's request for the DescribeSnapshotAttribute operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the DescribeSnapshotAttribute method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the DescribeSnapshotAttributeRequest method. +// req, resp := client.DescribeSnapshotAttributeRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) DescribeSnapshotAttributeRequest(input *DescribeSnapshotAttributeInput) (req *request.Request, output *DescribeSnapshotAttributeOutput) { op := &request.Operation{ Name: opDescribeSnapshotAttribute, @@ -4003,8 +6739,8 @@ func (c *EC2) DescribeSnapshotAttributeRequest(input *DescribeSnapshotAttributeI // Describes the specified attribute of the specified snapshot. You can specify // only one attribute at a time. // -// For more information about EBS snapshots, see Amazon EBS Snapshots in the -// Amazon Elastic Compute Cloud User Guide. +// For more information about EBS snapshots, see Amazon EBS Snapshots (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSSnapshots.html) +// in the Amazon Elastic Compute Cloud User Guide. func (c *EC2) DescribeSnapshotAttribute(input *DescribeSnapshotAttributeInput) (*DescribeSnapshotAttributeOutput, error) { req, out := c.DescribeSnapshotAttributeRequest(input) err := req.Send() @@ -4013,7 +6749,28 @@ func (c *EC2) DescribeSnapshotAttribute(input *DescribeSnapshotAttributeInput) ( const opDescribeSnapshots = "DescribeSnapshots" -// DescribeSnapshotsRequest generates a request for the DescribeSnapshots operation. +// DescribeSnapshotsRequest generates a "aws/request.Request" representing the +// client's request for the DescribeSnapshots operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the DescribeSnapshots method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the DescribeSnapshotsRequest method. +// req, resp := client.DescribeSnapshotsRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) DescribeSnapshotsRequest(input *DescribeSnapshotsInput) (req *request.Request, output *DescribeSnapshotsOutput) { op := &request.Operation{ Name: opDescribeSnapshots, @@ -4044,24 +6801,30 @@ func (c *EC2) DescribeSnapshotsRequest(input *DescribeSnapshotsInput) (req *requ // // The create volume permissions fall into the following categories: // -// public: The owner of the snapshot granted create volume permissions for +// 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. +// 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 one or more snapshot owners using the OwnerIds option, 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 @@ -4075,14 +6838,31 @@ func (c *EC2) DescribeSnapshotsRequest(input *DescribeSnapshotsInput) (req *requ // a NextToken value that can be passed to a subsequent DescribeSnapshots request // to retrieve the remaining results. // -// For more information about EBS snapshots, see Amazon EBS Snapshots in the -// Amazon Elastic Compute Cloud User Guide. +// For more information about EBS snapshots, see Amazon EBS Snapshots (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSSnapshots.html) +// in the Amazon Elastic Compute Cloud User Guide. func (c *EC2) DescribeSnapshots(input *DescribeSnapshotsInput) (*DescribeSnapshotsOutput, error) { req, out := c.DescribeSnapshotsRequest(input) err := req.Send() return out, err } +// DescribeSnapshotsPages iterates over the pages of a DescribeSnapshots operation, +// calling the "fn" function with the response data for each page. To stop +// iterating, return false from the fn function. +// +// See DescribeSnapshots method for more information on how to use this operation. +// +// Note: This operation can generate multiple requests to a service. +// +// // Example iterating over at most 3 pages of a DescribeSnapshots operation. +// pageNum := 0 +// err := client.DescribeSnapshotsPages(params, +// func(page *DescribeSnapshotsOutput, lastPage bool) bool { +// pageNum++ +// fmt.Println(page) +// return pageNum <= 3 +// }) +// func (c *EC2) DescribeSnapshotsPages(input *DescribeSnapshotsInput, fn func(p *DescribeSnapshotsOutput, lastPage bool) (shouldContinue bool)) error { page, _ := c.DescribeSnapshotsRequest(input) page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) @@ -4093,7 +6873,28 @@ func (c *EC2) DescribeSnapshotsPages(input *DescribeSnapshotsInput, fn func(p *D const opDescribeSpotDatafeedSubscription = "DescribeSpotDatafeedSubscription" -// DescribeSpotDatafeedSubscriptionRequest generates a request for the DescribeSpotDatafeedSubscription operation. +// DescribeSpotDatafeedSubscriptionRequest generates a "aws/request.Request" representing the +// client's request for the DescribeSpotDatafeedSubscription operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the DescribeSpotDatafeedSubscription method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the DescribeSpotDatafeedSubscriptionRequest method. +// req, resp := client.DescribeSpotDatafeedSubscriptionRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) DescribeSpotDatafeedSubscriptionRequest(input *DescribeSpotDatafeedSubscriptionInput) (req *request.Request, output *DescribeSpotDatafeedSubscriptionOutput) { op := &request.Operation{ Name: opDescribeSpotDatafeedSubscription, @@ -4122,7 +6923,28 @@ func (c *EC2) DescribeSpotDatafeedSubscription(input *DescribeSpotDatafeedSubscr const opDescribeSpotFleetInstances = "DescribeSpotFleetInstances" -// DescribeSpotFleetInstancesRequest generates a request for the DescribeSpotFleetInstances operation. +// DescribeSpotFleetInstancesRequest generates a "aws/request.Request" representing the +// client's request for the DescribeSpotFleetInstances operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the DescribeSpotFleetInstances method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the DescribeSpotFleetInstancesRequest method. +// req, resp := client.DescribeSpotFleetInstancesRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) DescribeSpotFleetInstancesRequest(input *DescribeSpotFleetInstancesInput) (req *request.Request, output *DescribeSpotFleetInstancesOutput) { op := &request.Operation{ Name: opDescribeSpotFleetInstances, @@ -4149,7 +6971,28 @@ func (c *EC2) DescribeSpotFleetInstances(input *DescribeSpotFleetInstancesInput) const opDescribeSpotFleetRequestHistory = "DescribeSpotFleetRequestHistory" -// DescribeSpotFleetRequestHistoryRequest generates a request for the DescribeSpotFleetRequestHistory operation. +// DescribeSpotFleetRequestHistoryRequest generates a "aws/request.Request" representing the +// client's request for the DescribeSpotFleetRequestHistory operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the DescribeSpotFleetRequestHistory method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the DescribeSpotFleetRequestHistoryRequest method. +// req, resp := client.DescribeSpotFleetRequestHistoryRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) DescribeSpotFleetRequestHistoryRequest(input *DescribeSpotFleetRequestHistoryInput) (req *request.Request, output *DescribeSpotFleetRequestHistoryOutput) { op := &request.Operation{ Name: opDescribeSpotFleetRequestHistory, @@ -4181,12 +7024,39 @@ func (c *EC2) DescribeSpotFleetRequestHistory(input *DescribeSpotFleetRequestHis const opDescribeSpotFleetRequests = "DescribeSpotFleetRequests" -// DescribeSpotFleetRequestsRequest generates a request for the DescribeSpotFleetRequests operation. +// DescribeSpotFleetRequestsRequest generates a "aws/request.Request" representing the +// client's request for the DescribeSpotFleetRequests operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the DescribeSpotFleetRequests method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the DescribeSpotFleetRequestsRequest method. +// req, resp := client.DescribeSpotFleetRequestsRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) DescribeSpotFleetRequestsRequest(input *DescribeSpotFleetRequestsInput) (req *request.Request, output *DescribeSpotFleetRequestsOutput) { op := &request.Operation{ Name: opDescribeSpotFleetRequests, HTTPMethod: "POST", HTTPPath: "/", + Paginator: &request.Paginator{ + InputTokens: []string{"NextToken"}, + OutputTokens: []string{"NextToken"}, + LimitToken: "MaxResults", + TruncationToken: "", + }, } if input == nil { @@ -4206,9 +7076,55 @@ func (c *EC2) DescribeSpotFleetRequests(input *DescribeSpotFleetRequestsInput) ( return out, err } +// DescribeSpotFleetRequestsPages iterates over the pages of a DescribeSpotFleetRequests operation, +// calling the "fn" function with the response data for each page. To stop +// iterating, return false from the fn function. +// +// See DescribeSpotFleetRequests method for more information on how to use this operation. +// +// Note: This operation can generate multiple requests to a service. +// +// // Example iterating over at most 3 pages of a DescribeSpotFleetRequests operation. +// pageNum := 0 +// err := client.DescribeSpotFleetRequestsPages(params, +// func(page *DescribeSpotFleetRequestsOutput, lastPage bool) bool { +// pageNum++ +// fmt.Println(page) +// return pageNum <= 3 +// }) +// +func (c *EC2) DescribeSpotFleetRequestsPages(input *DescribeSpotFleetRequestsInput, fn func(p *DescribeSpotFleetRequestsOutput, lastPage bool) (shouldContinue bool)) error { + page, _ := c.DescribeSpotFleetRequestsRequest(input) + page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) + return page.EachPage(func(p interface{}, lastPage bool) bool { + return fn(p.(*DescribeSpotFleetRequestsOutput), lastPage) + }) +} + const opDescribeSpotInstanceRequests = "DescribeSpotInstanceRequests" -// DescribeSpotInstanceRequestsRequest generates a request for the DescribeSpotInstanceRequests operation. +// DescribeSpotInstanceRequestsRequest generates a "aws/request.Request" representing the +// client's request for the DescribeSpotInstanceRequests operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the DescribeSpotInstanceRequests method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the DescribeSpotInstanceRequestsRequest method. +// req, resp := client.DescribeSpotInstanceRequestsRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) DescribeSpotInstanceRequestsRequest(input *DescribeSpotInstanceRequestsInput) (req *request.Request, output *DescribeSpotInstanceRequestsOutput) { op := &request.Operation{ Name: opDescribeSpotInstanceRequests, @@ -4246,7 +7162,28 @@ func (c *EC2) DescribeSpotInstanceRequests(input *DescribeSpotInstanceRequestsIn const opDescribeSpotPriceHistory = "DescribeSpotPriceHistory" -// DescribeSpotPriceHistoryRequest generates a request for the DescribeSpotPriceHistory operation. +// DescribeSpotPriceHistoryRequest generates a "aws/request.Request" representing the +// client's request for the DescribeSpotPriceHistory operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the DescribeSpotPriceHistory method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the DescribeSpotPriceHistoryRequest method. +// req, resp := client.DescribeSpotPriceHistoryRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) DescribeSpotPriceHistoryRequest(input *DescribeSpotPriceHistoryInput) (req *request.Request, output *DescribeSpotPriceHistoryOutput) { op := &request.Operation{ Name: opDescribeSpotPriceHistory, @@ -4285,6 +7222,23 @@ func (c *EC2) DescribeSpotPriceHistory(input *DescribeSpotPriceHistoryInput) (*D return out, err } +// DescribeSpotPriceHistoryPages iterates over the pages of a DescribeSpotPriceHistory operation, +// calling the "fn" function with the response data for each page. To stop +// iterating, return false from the fn function. +// +// See DescribeSpotPriceHistory method for more information on how to use this operation. +// +// Note: This operation can generate multiple requests to a service. +// +// // Example iterating over at most 3 pages of a DescribeSpotPriceHistory operation. +// pageNum := 0 +// err := client.DescribeSpotPriceHistoryPages(params, +// func(page *DescribeSpotPriceHistoryOutput, lastPage bool) bool { +// pageNum++ +// fmt.Println(page) +// return pageNum <= 3 +// }) +// func (c *EC2) DescribeSpotPriceHistoryPages(input *DescribeSpotPriceHistoryInput, fn func(p *DescribeSpotPriceHistoryOutput, lastPage bool) (shouldContinue bool)) error { page, _ := c.DescribeSpotPriceHistoryRequest(input) page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) @@ -4293,9 +7247,81 @@ func (c *EC2) DescribeSpotPriceHistoryPages(input *DescribeSpotPriceHistoryInput }) } +const opDescribeStaleSecurityGroups = "DescribeStaleSecurityGroups" + +// DescribeStaleSecurityGroupsRequest generates a "aws/request.Request" representing the +// client's request for the DescribeStaleSecurityGroups operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the DescribeStaleSecurityGroups method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the DescribeStaleSecurityGroupsRequest method. +// req, resp := client.DescribeStaleSecurityGroupsRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +func (c *EC2) DescribeStaleSecurityGroupsRequest(input *DescribeStaleSecurityGroupsInput) (req *request.Request, output *DescribeStaleSecurityGroupsOutput) { + op := &request.Operation{ + Name: opDescribeStaleSecurityGroups, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &DescribeStaleSecurityGroupsInput{} + } + + req = c.newRequest(op, input, output) + output = &DescribeStaleSecurityGroupsOutput{} + req.Data = output + return +} + +// [EC2-VPC only] Describes the stale security group rules for security groups +// in a specified VPC. Rules are stale when they reference a deleted security +// group in a peer VPC, or a security group in a peer VPC for which the VPC +// peering connection has been deleted. +func (c *EC2) DescribeStaleSecurityGroups(input *DescribeStaleSecurityGroupsInput) (*DescribeStaleSecurityGroupsOutput, error) { + req, out := c.DescribeStaleSecurityGroupsRequest(input) + err := req.Send() + return out, err +} + const opDescribeSubnets = "DescribeSubnets" -// DescribeSubnetsRequest generates a request for the DescribeSubnets operation. +// DescribeSubnetsRequest generates a "aws/request.Request" representing the +// client's request for the DescribeSubnets operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the DescribeSubnets method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the DescribeSubnetsRequest method. +// req, resp := client.DescribeSubnetsRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) DescribeSubnetsRequest(input *DescribeSubnetsInput) (req *request.Request, output *DescribeSubnetsOutput) { op := &request.Operation{ Name: opDescribeSubnets, @@ -4325,7 +7351,28 @@ func (c *EC2) DescribeSubnets(input *DescribeSubnetsInput) (*DescribeSubnetsOutp const opDescribeTags = "DescribeTags" -// DescribeTagsRequest generates a request for the DescribeTags operation. +// DescribeTagsRequest generates a "aws/request.Request" representing the +// client's request for the DescribeTags operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the DescribeTags method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the DescribeTagsRequest method. +// req, resp := client.DescribeTagsRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) DescribeTagsRequest(input *DescribeTagsInput) (req *request.Request, output *DescribeTagsOutput) { op := &request.Operation{ Name: opDescribeTags, @@ -4359,6 +7406,23 @@ func (c *EC2) DescribeTags(input *DescribeTagsInput) (*DescribeTagsOutput, error return out, err } +// DescribeTagsPages iterates over the pages of a DescribeTags operation, +// calling the "fn" function with the response data for each page. To stop +// iterating, return false from the fn function. +// +// See DescribeTags method for more information on how to use this operation. +// +// Note: This operation can generate multiple requests to a service. +// +// // Example iterating over at most 3 pages of a DescribeTags operation. +// pageNum := 0 +// err := client.DescribeTagsPages(params, +// func(page *DescribeTagsOutput, lastPage bool) bool { +// pageNum++ +// fmt.Println(page) +// return pageNum <= 3 +// }) +// func (c *EC2) DescribeTagsPages(input *DescribeTagsInput, fn func(p *DescribeTagsOutput, lastPage bool) (shouldContinue bool)) error { page, _ := c.DescribeTagsRequest(input) page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) @@ -4369,7 +7433,28 @@ func (c *EC2) DescribeTagsPages(input *DescribeTagsInput, fn func(p *DescribeTag const opDescribeVolumeAttribute = "DescribeVolumeAttribute" -// DescribeVolumeAttributeRequest generates a request for the DescribeVolumeAttribute operation. +// DescribeVolumeAttributeRequest generates a "aws/request.Request" representing the +// client's request for the DescribeVolumeAttribute operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the DescribeVolumeAttribute method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the DescribeVolumeAttributeRequest method. +// req, resp := client.DescribeVolumeAttributeRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) DescribeVolumeAttributeRequest(input *DescribeVolumeAttributeInput) (req *request.Request, output *DescribeVolumeAttributeOutput) { op := &request.Operation{ Name: opDescribeVolumeAttribute, @@ -4390,8 +7475,8 @@ func (c *EC2) DescribeVolumeAttributeRequest(input *DescribeVolumeAttributeInput // Describes the specified attribute of the specified volume. You can specify // only one attribute at a time. // -// For more information about EBS volumes, see Amazon EBS Volumes in the Amazon -// Elastic Compute Cloud User Guide. +// For more information about EBS volumes, see Amazon EBS Volumes (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSVolumes.html) +// in the Amazon Elastic Compute Cloud User Guide. func (c *EC2) DescribeVolumeAttribute(input *DescribeVolumeAttributeInput) (*DescribeVolumeAttributeOutput, error) { req, out := c.DescribeVolumeAttributeRequest(input) err := req.Send() @@ -4400,7 +7485,28 @@ func (c *EC2) DescribeVolumeAttribute(input *DescribeVolumeAttributeInput) (*Des const opDescribeVolumeStatus = "DescribeVolumeStatus" -// DescribeVolumeStatusRequest generates a request for the DescribeVolumeStatus operation. +// DescribeVolumeStatusRequest generates a "aws/request.Request" representing the +// client's request for the DescribeVolumeStatus operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the DescribeVolumeStatus method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the DescribeVolumeStatusRequest method. +// req, resp := client.DescribeVolumeStatusRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) DescribeVolumeStatusRequest(input *DescribeVolumeStatusInput) (req *request.Request, output *DescribeVolumeStatusOutput) { op := &request.Operation{ Name: opDescribeVolumeStatus, @@ -4436,21 +7542,21 @@ func (c *EC2) DescribeVolumeStatusRequest(input *DescribeVolumeStatusInput) (req // 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). +// 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 +// 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. +// 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 @@ -4465,6 +7571,23 @@ func (c *EC2) DescribeVolumeStatus(input *DescribeVolumeStatusInput) (*DescribeV return out, err } +// DescribeVolumeStatusPages iterates over the pages of a DescribeVolumeStatus operation, +// calling the "fn" function with the response data for each page. To stop +// iterating, return false from the fn function. +// +// See DescribeVolumeStatus method for more information on how to use this operation. +// +// Note: This operation can generate multiple requests to a service. +// +// // Example iterating over at most 3 pages of a DescribeVolumeStatus operation. +// pageNum := 0 +// err := client.DescribeVolumeStatusPages(params, +// func(page *DescribeVolumeStatusOutput, lastPage bool) bool { +// pageNum++ +// fmt.Println(page) +// return pageNum <= 3 +// }) +// func (c *EC2) DescribeVolumeStatusPages(input *DescribeVolumeStatusInput, fn func(p *DescribeVolumeStatusOutput, lastPage bool) (shouldContinue bool)) error { page, _ := c.DescribeVolumeStatusRequest(input) page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) @@ -4475,7 +7598,28 @@ func (c *EC2) DescribeVolumeStatusPages(input *DescribeVolumeStatusInput, fn fun const opDescribeVolumes = "DescribeVolumes" -// DescribeVolumesRequest generates a request for the DescribeVolumes operation. +// DescribeVolumesRequest generates a "aws/request.Request" representing the +// client's request for the DescribeVolumes operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the DescribeVolumes method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the DescribeVolumesRequest method. +// req, resp := client.DescribeVolumesRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) DescribeVolumesRequest(input *DescribeVolumesInput) (req *request.Request, output *DescribeVolumesOutput) { op := &request.Operation{ Name: opDescribeVolumes, @@ -4508,14 +7652,31 @@ func (c *EC2) DescribeVolumesRequest(input *DescribeVolumesInput) (req *request. // a NextToken value that can be passed to a subsequent DescribeVolumes request // to retrieve the remaining results. // -// For more information about EBS volumes, see Amazon EBS Volumes in the Amazon -// Elastic Compute Cloud User Guide. +// For more information about EBS volumes, see Amazon EBS Volumes (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSVolumes.html) +// in the Amazon Elastic Compute Cloud User Guide. func (c *EC2) DescribeVolumes(input *DescribeVolumesInput) (*DescribeVolumesOutput, error) { req, out := c.DescribeVolumesRequest(input) err := req.Send() return out, err } +// DescribeVolumesPages iterates over the pages of a DescribeVolumes operation, +// calling the "fn" function with the response data for each page. To stop +// iterating, return false from the fn function. +// +// See DescribeVolumes method for more information on how to use this operation. +// +// Note: This operation can generate multiple requests to a service. +// +// // Example iterating over at most 3 pages of a DescribeVolumes operation. +// pageNum := 0 +// err := client.DescribeVolumesPages(params, +// func(page *DescribeVolumesOutput, lastPage bool) bool { +// pageNum++ +// fmt.Println(page) +// return pageNum <= 3 +// }) +// func (c *EC2) DescribeVolumesPages(input *DescribeVolumesInput, fn func(p *DescribeVolumesOutput, lastPage bool) (shouldContinue bool)) error { page, _ := c.DescribeVolumesRequest(input) page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) @@ -4526,7 +7687,28 @@ func (c *EC2) DescribeVolumesPages(input *DescribeVolumesInput, fn func(p *Descr const opDescribeVpcAttribute = "DescribeVpcAttribute" -// DescribeVpcAttributeRequest generates a request for the DescribeVpcAttribute operation. +// DescribeVpcAttributeRequest generates a "aws/request.Request" representing the +// client's request for the DescribeVpcAttribute operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the DescribeVpcAttribute method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the DescribeVpcAttributeRequest method. +// req, resp := client.DescribeVpcAttributeRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) DescribeVpcAttributeRequest(input *DescribeVpcAttributeInput) (req *request.Request, output *DescribeVpcAttributeOutput) { op := &request.Operation{ Name: opDescribeVpcAttribute, @@ -4554,7 +7736,28 @@ func (c *EC2) DescribeVpcAttribute(input *DescribeVpcAttributeInput) (*DescribeV const opDescribeVpcClassicLink = "DescribeVpcClassicLink" -// DescribeVpcClassicLinkRequest generates a request for the DescribeVpcClassicLink operation. +// DescribeVpcClassicLinkRequest generates a "aws/request.Request" representing the +// client's request for the DescribeVpcClassicLink operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the DescribeVpcClassicLink method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the DescribeVpcClassicLinkRequest method. +// req, resp := client.DescribeVpcClassicLinkRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) DescribeVpcClassicLinkRequest(input *DescribeVpcClassicLinkInput) (req *request.Request, output *DescribeVpcClassicLinkOutput) { op := &request.Operation{ Name: opDescribeVpcClassicLink, @@ -4581,7 +7784,28 @@ func (c *EC2) DescribeVpcClassicLink(input *DescribeVpcClassicLinkInput) (*Descr const opDescribeVpcClassicLinkDnsSupport = "DescribeVpcClassicLinkDnsSupport" -// DescribeVpcClassicLinkDnsSupportRequest generates a request for the DescribeVpcClassicLinkDnsSupport operation. +// DescribeVpcClassicLinkDnsSupportRequest generates a "aws/request.Request" representing the +// client's request for the DescribeVpcClassicLinkDnsSupport operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the DescribeVpcClassicLinkDnsSupport method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the DescribeVpcClassicLinkDnsSupportRequest method. +// req, resp := client.DescribeVpcClassicLinkDnsSupportRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) DescribeVpcClassicLinkDnsSupportRequest(input *DescribeVpcClassicLinkDnsSupportInput) (req *request.Request, output *DescribeVpcClassicLinkDnsSupportOutput) { op := &request.Operation{ Name: opDescribeVpcClassicLinkDnsSupport, @@ -4614,7 +7838,28 @@ func (c *EC2) DescribeVpcClassicLinkDnsSupport(input *DescribeVpcClassicLinkDnsS const opDescribeVpcEndpointServices = "DescribeVpcEndpointServices" -// DescribeVpcEndpointServicesRequest generates a request for the DescribeVpcEndpointServices operation. +// DescribeVpcEndpointServicesRequest generates a "aws/request.Request" representing the +// client's request for the DescribeVpcEndpointServices operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the DescribeVpcEndpointServices method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the DescribeVpcEndpointServicesRequest method. +// req, resp := client.DescribeVpcEndpointServicesRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) DescribeVpcEndpointServicesRequest(input *DescribeVpcEndpointServicesInput) (req *request.Request, output *DescribeVpcEndpointServicesOutput) { op := &request.Operation{ Name: opDescribeVpcEndpointServices, @@ -4642,7 +7887,28 @@ func (c *EC2) DescribeVpcEndpointServices(input *DescribeVpcEndpointServicesInpu const opDescribeVpcEndpoints = "DescribeVpcEndpoints" -// DescribeVpcEndpointsRequest generates a request for the DescribeVpcEndpoints operation. +// DescribeVpcEndpointsRequest generates a "aws/request.Request" representing the +// client's request for the DescribeVpcEndpoints operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the DescribeVpcEndpoints method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the DescribeVpcEndpointsRequest method. +// req, resp := client.DescribeVpcEndpointsRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) DescribeVpcEndpointsRequest(input *DescribeVpcEndpointsInput) (req *request.Request, output *DescribeVpcEndpointsOutput) { op := &request.Operation{ Name: opDescribeVpcEndpoints, @@ -4669,7 +7935,28 @@ func (c *EC2) DescribeVpcEndpoints(input *DescribeVpcEndpointsInput) (*DescribeV const opDescribeVpcPeeringConnections = "DescribeVpcPeeringConnections" -// DescribeVpcPeeringConnectionsRequest generates a request for the DescribeVpcPeeringConnections operation. +// DescribeVpcPeeringConnectionsRequest generates a "aws/request.Request" representing the +// client's request for the DescribeVpcPeeringConnections operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the DescribeVpcPeeringConnections method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the DescribeVpcPeeringConnectionsRequest method. +// req, resp := client.DescribeVpcPeeringConnectionsRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) DescribeVpcPeeringConnectionsRequest(input *DescribeVpcPeeringConnectionsInput) (req *request.Request, output *DescribeVpcPeeringConnectionsOutput) { op := &request.Operation{ Name: opDescribeVpcPeeringConnections, @@ -4696,7 +7983,28 @@ func (c *EC2) DescribeVpcPeeringConnections(input *DescribeVpcPeeringConnections const opDescribeVpcs = "DescribeVpcs" -// DescribeVpcsRequest generates a request for the DescribeVpcs operation. +// DescribeVpcsRequest generates a "aws/request.Request" representing the +// client's request for the DescribeVpcs operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the DescribeVpcs method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the DescribeVpcsRequest method. +// req, resp := client.DescribeVpcsRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) DescribeVpcsRequest(input *DescribeVpcsInput) (req *request.Request, output *DescribeVpcsOutput) { op := &request.Operation{ Name: opDescribeVpcs, @@ -4723,7 +8031,28 @@ func (c *EC2) DescribeVpcs(input *DescribeVpcsInput) (*DescribeVpcsOutput, error const opDescribeVpnConnections = "DescribeVpnConnections" -// DescribeVpnConnectionsRequest generates a request for the DescribeVpnConnections operation. +// DescribeVpnConnectionsRequest generates a "aws/request.Request" representing the +// client's request for the DescribeVpnConnections operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the DescribeVpnConnections method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the DescribeVpnConnectionsRequest method. +// req, resp := client.DescribeVpnConnectionsRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) DescribeVpnConnectionsRequest(input *DescribeVpnConnectionsInput) (req *request.Request, output *DescribeVpnConnectionsOutput) { op := &request.Operation{ Name: opDescribeVpnConnections, @@ -4754,7 +8083,28 @@ func (c *EC2) DescribeVpnConnections(input *DescribeVpnConnectionsInput) (*Descr const opDescribeVpnGateways = "DescribeVpnGateways" -// DescribeVpnGatewaysRequest generates a request for the DescribeVpnGateways operation. +// DescribeVpnGatewaysRequest generates a "aws/request.Request" representing the +// client's request for the DescribeVpnGateways operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the DescribeVpnGateways method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the DescribeVpnGatewaysRequest method. +// req, resp := client.DescribeVpnGatewaysRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) DescribeVpnGatewaysRequest(input *DescribeVpnGatewaysInput) (req *request.Request, output *DescribeVpnGatewaysOutput) { op := &request.Operation{ Name: opDescribeVpnGateways, @@ -4785,7 +8135,28 @@ func (c *EC2) DescribeVpnGateways(input *DescribeVpnGatewaysInput) (*DescribeVpn const opDetachClassicLinkVpc = "DetachClassicLinkVpc" -// DetachClassicLinkVpcRequest generates a request for the DetachClassicLinkVpc operation. +// DetachClassicLinkVpcRequest generates a "aws/request.Request" representing the +// client's request for the DetachClassicLinkVpc operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the DetachClassicLinkVpc method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the DetachClassicLinkVpcRequest method. +// req, resp := client.DetachClassicLinkVpcRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) DetachClassicLinkVpcRequest(input *DetachClassicLinkVpcInput) (req *request.Request, output *DetachClassicLinkVpcOutput) { op := &request.Operation{ Name: opDetachClassicLinkVpc, @@ -4814,7 +8185,28 @@ func (c *EC2) DetachClassicLinkVpc(input *DetachClassicLinkVpcInput) (*DetachCla const opDetachInternetGateway = "DetachInternetGateway" -// DetachInternetGatewayRequest generates a request for the DetachInternetGateway operation. +// DetachInternetGatewayRequest generates a "aws/request.Request" representing the +// client's request for the DetachInternetGateway operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the DetachInternetGateway method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the DetachInternetGatewayRequest method. +// req, resp := client.DetachInternetGatewayRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) DetachInternetGatewayRequest(input *DetachInternetGatewayInput) (req *request.Request, output *DetachInternetGatewayOutput) { op := &request.Operation{ Name: opDetachInternetGateway, @@ -4845,7 +8237,28 @@ func (c *EC2) DetachInternetGateway(input *DetachInternetGatewayInput) (*DetachI const opDetachNetworkInterface = "DetachNetworkInterface" -// DetachNetworkInterfaceRequest generates a request for the DetachNetworkInterface operation. +// DetachNetworkInterfaceRequest generates a "aws/request.Request" representing the +// client's request for the DetachNetworkInterface operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the DetachNetworkInterface method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the DetachNetworkInterfaceRequest method. +// req, resp := client.DetachNetworkInterfaceRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) DetachNetworkInterfaceRequest(input *DetachNetworkInterfaceInput) (req *request.Request, output *DetachNetworkInterfaceOutput) { op := &request.Operation{ Name: opDetachNetworkInterface, @@ -4874,7 +8287,28 @@ func (c *EC2) DetachNetworkInterface(input *DetachNetworkInterfaceInput) (*Detac const opDetachVolume = "DetachVolume" -// DetachVolumeRequest generates a request for the DetachVolume operation. +// DetachVolumeRequest generates a "aws/request.Request" representing the +// client's request for the DetachVolume operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the DetachVolume method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the DetachVolumeRequest method. +// req, resp := client.DetachVolumeRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) DetachVolumeRequest(input *DetachVolumeInput) (req *request.Request, output *VolumeAttachment) { op := &request.Operation{ Name: opDetachVolume, @@ -4894,9 +8328,10 @@ func (c *EC2) DetachVolumeRequest(input *DetachVolumeInput) (req *request.Reques // Detaches an 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 +// to do so can result in the volume becoming stuck in the busy state while +// detaching. If this happens, detachment can be delayed indefinitely until +// you unmount the volume, force detachment, reboot the instance, or all three. +// If an 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. // @@ -4913,7 +8348,28 @@ func (c *EC2) DetachVolume(input *DetachVolumeInput) (*VolumeAttachment, error) const opDetachVpnGateway = "DetachVpnGateway" -// DetachVpnGatewayRequest generates a request for the DetachVpnGateway operation. +// DetachVpnGatewayRequest generates a "aws/request.Request" representing the +// client's request for the DetachVpnGateway operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the DetachVpnGateway method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the DetachVpnGatewayRequest method. +// req, resp := client.DetachVpnGatewayRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) DetachVpnGatewayRequest(input *DetachVpnGatewayInput) (req *request.Request, output *DetachVpnGatewayOutput) { op := &request.Operation{ Name: opDetachVpnGateway, @@ -4949,7 +8405,28 @@ func (c *EC2) DetachVpnGateway(input *DetachVpnGatewayInput) (*DetachVpnGatewayO const opDisableVgwRoutePropagation = "DisableVgwRoutePropagation" -// DisableVgwRoutePropagationRequest generates a request for the DisableVgwRoutePropagation operation. +// DisableVgwRoutePropagationRequest generates a "aws/request.Request" representing the +// client's request for the DisableVgwRoutePropagation operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the DisableVgwRoutePropagation method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the DisableVgwRoutePropagationRequest method. +// req, resp := client.DisableVgwRoutePropagationRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) DisableVgwRoutePropagationRequest(input *DisableVgwRoutePropagationInput) (req *request.Request, output *DisableVgwRoutePropagationOutput) { op := &request.Operation{ Name: opDisableVgwRoutePropagation, @@ -4979,7 +8456,28 @@ func (c *EC2) DisableVgwRoutePropagation(input *DisableVgwRoutePropagationInput) const opDisableVpcClassicLink = "DisableVpcClassicLink" -// DisableVpcClassicLinkRequest generates a request for the DisableVpcClassicLink operation. +// DisableVpcClassicLinkRequest generates a "aws/request.Request" representing the +// client's request for the DisableVpcClassicLink operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the DisableVpcClassicLink method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the DisableVpcClassicLinkRequest method. +// req, resp := client.DisableVpcClassicLinkRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) DisableVpcClassicLinkRequest(input *DisableVpcClassicLinkInput) (req *request.Request, output *DisableVpcClassicLinkOutput) { op := &request.Operation{ Name: opDisableVpcClassicLink, @@ -5007,7 +8505,28 @@ func (c *EC2) DisableVpcClassicLink(input *DisableVpcClassicLinkInput) (*Disable const opDisableVpcClassicLinkDnsSupport = "DisableVpcClassicLinkDnsSupport" -// DisableVpcClassicLinkDnsSupportRequest generates a request for the DisableVpcClassicLinkDnsSupport operation. +// DisableVpcClassicLinkDnsSupportRequest generates a "aws/request.Request" representing the +// client's request for the DisableVpcClassicLinkDnsSupport operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the DisableVpcClassicLinkDnsSupport method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the DisableVpcClassicLinkDnsSupportRequest method. +// req, resp := client.DisableVpcClassicLinkDnsSupportRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) DisableVpcClassicLinkDnsSupportRequest(input *DisableVpcClassicLinkDnsSupportInput) (req *request.Request, output *DisableVpcClassicLinkDnsSupportOutput) { op := &request.Operation{ Name: opDisableVpcClassicLinkDnsSupport, @@ -5038,7 +8557,28 @@ func (c *EC2) DisableVpcClassicLinkDnsSupport(input *DisableVpcClassicLinkDnsSup const opDisassociateAddress = "DisassociateAddress" -// DisassociateAddressRequest generates a request for the DisassociateAddress operation. +// DisassociateAddressRequest generates a "aws/request.Request" representing the +// client's request for the DisassociateAddress operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the DisassociateAddress method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the DisassociateAddressRequest method. +// req, resp := client.DisassociateAddressRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) DisassociateAddressRequest(input *DisassociateAddressInput) (req *request.Request, output *DisassociateAddressOutput) { op := &request.Operation{ Name: opDisassociateAddress, @@ -5075,7 +8615,28 @@ func (c *EC2) DisassociateAddress(input *DisassociateAddressInput) (*Disassociat const opDisassociateRouteTable = "DisassociateRouteTable" -// DisassociateRouteTableRequest generates a request for the DisassociateRouteTable operation. +// DisassociateRouteTableRequest generates a "aws/request.Request" representing the +// client's request for the DisassociateRouteTable operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the DisassociateRouteTable method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the DisassociateRouteTableRequest method. +// req, resp := client.DisassociateRouteTableRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) DisassociateRouteTableRequest(input *DisassociateRouteTableInput) (req *request.Request, output *DisassociateRouteTableOutput) { op := &request.Operation{ Name: opDisassociateRouteTable, @@ -5109,7 +8670,28 @@ func (c *EC2) DisassociateRouteTable(input *DisassociateRouteTableInput) (*Disas const opEnableVgwRoutePropagation = "EnableVgwRoutePropagation" -// EnableVgwRoutePropagationRequest generates a request for the EnableVgwRoutePropagation operation. +// EnableVgwRoutePropagationRequest generates a "aws/request.Request" representing the +// client's request for the EnableVgwRoutePropagation operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the EnableVgwRoutePropagation method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the EnableVgwRoutePropagationRequest method. +// req, resp := client.EnableVgwRoutePropagationRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) EnableVgwRoutePropagationRequest(input *EnableVgwRoutePropagationInput) (req *request.Request, output *EnableVgwRoutePropagationOutput) { op := &request.Operation{ Name: opEnableVgwRoutePropagation, @@ -5139,7 +8721,28 @@ func (c *EC2) EnableVgwRoutePropagation(input *EnableVgwRoutePropagationInput) ( const opEnableVolumeIO = "EnableVolumeIO" -// EnableVolumeIORequest generates a request for the EnableVolumeIO operation. +// EnableVolumeIORequest generates a "aws/request.Request" representing the +// client's request for the EnableVolumeIO operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the EnableVolumeIO method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the EnableVolumeIORequest method. +// req, resp := client.EnableVolumeIORequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) EnableVolumeIORequest(input *EnableVolumeIOInput) (req *request.Request, output *EnableVolumeIOOutput) { op := &request.Operation{ Name: opEnableVolumeIO, @@ -5169,7 +8772,28 @@ func (c *EC2) EnableVolumeIO(input *EnableVolumeIOInput) (*EnableVolumeIOOutput, const opEnableVpcClassicLink = "EnableVpcClassicLink" -// EnableVpcClassicLinkRequest generates a request for the EnableVpcClassicLink operation. +// EnableVpcClassicLinkRequest generates a "aws/request.Request" representing the +// client's request for the EnableVpcClassicLink operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the EnableVpcClassicLink method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the EnableVpcClassicLinkRequest method. +// req, resp := client.EnableVpcClassicLinkRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) EnableVpcClassicLinkRequest(input *EnableVpcClassicLinkInput) (req *request.Request, output *EnableVpcClassicLinkOutput) { op := &request.Operation{ Name: opEnableVpcClassicLink, @@ -5202,7 +8826,28 @@ func (c *EC2) EnableVpcClassicLink(input *EnableVpcClassicLinkInput) (*EnableVpc const opEnableVpcClassicLinkDnsSupport = "EnableVpcClassicLinkDnsSupport" -// EnableVpcClassicLinkDnsSupportRequest generates a request for the EnableVpcClassicLinkDnsSupport operation. +// EnableVpcClassicLinkDnsSupportRequest generates a "aws/request.Request" representing the +// client's request for the EnableVpcClassicLinkDnsSupport operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the EnableVpcClassicLinkDnsSupport method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the EnableVpcClassicLinkDnsSupportRequest method. +// req, resp := client.EnableVpcClassicLinkDnsSupportRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) EnableVpcClassicLinkDnsSupportRequest(input *EnableVpcClassicLinkDnsSupportInput) (req *request.Request, output *EnableVpcClassicLinkDnsSupportOutput) { op := &request.Operation{ Name: opEnableVpcClassicLinkDnsSupport, @@ -5235,7 +8880,28 @@ func (c *EC2) EnableVpcClassicLinkDnsSupport(input *EnableVpcClassicLinkDnsSuppo const opGetConsoleOutput = "GetConsoleOutput" -// GetConsoleOutputRequest generates a request for the GetConsoleOutput operation. +// GetConsoleOutputRequest generates a "aws/request.Request" representing the +// client's request for the GetConsoleOutput operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the GetConsoleOutput method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the GetConsoleOutputRequest method. +// req, resp := client.GetConsoleOutputRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) GetConsoleOutputRequest(input *GetConsoleOutputInput) (req *request.Request, output *GetConsoleOutputOutput) { op := &request.Operation{ Name: opGetConsoleOutput, @@ -5277,9 +8943,133 @@ func (c *EC2) GetConsoleOutput(input *GetConsoleOutputInput) (*GetConsoleOutputO return out, err } +const opGetConsoleScreenshot = "GetConsoleScreenshot" + +// GetConsoleScreenshotRequest generates a "aws/request.Request" representing the +// client's request for the GetConsoleScreenshot operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the GetConsoleScreenshot method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the GetConsoleScreenshotRequest method. +// req, resp := client.GetConsoleScreenshotRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +func (c *EC2) GetConsoleScreenshotRequest(input *GetConsoleScreenshotInput) (req *request.Request, output *GetConsoleScreenshotOutput) { + op := &request.Operation{ + Name: opGetConsoleScreenshot, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &GetConsoleScreenshotInput{} + } + + req = c.newRequest(op, input, output) + output = &GetConsoleScreenshotOutput{} + req.Data = output + return +} + +// Retrieve a JPG-format screenshot of a running instance to help with troubleshooting. +// +// The returned content is Base64-encoded. +func (c *EC2) GetConsoleScreenshot(input *GetConsoleScreenshotInput) (*GetConsoleScreenshotOutput, error) { + req, out := c.GetConsoleScreenshotRequest(input) + err := req.Send() + return out, err +} + +const opGetHostReservationPurchasePreview = "GetHostReservationPurchasePreview" + +// GetHostReservationPurchasePreviewRequest generates a "aws/request.Request" representing the +// client's request for the GetHostReservationPurchasePreview operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the GetHostReservationPurchasePreview method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the GetHostReservationPurchasePreviewRequest method. +// req, resp := client.GetHostReservationPurchasePreviewRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +func (c *EC2) GetHostReservationPurchasePreviewRequest(input *GetHostReservationPurchasePreviewInput) (req *request.Request, output *GetHostReservationPurchasePreviewOutput) { + op := &request.Operation{ + Name: opGetHostReservationPurchasePreview, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &GetHostReservationPurchasePreviewInput{} + } + + req = c.newRequest(op, input, output) + output = &GetHostReservationPurchasePreviewOutput{} + req.Data = output + return +} + +// Preview a reservation purchase with configurations that match those of your +// Dedicated Host. You must have active Dedicated Hosts in your account before +// you purchase a reservation. +// +// This is a preview of the PurchaseHostReservation action and does not result +// in the offering being purchased. +func (c *EC2) GetHostReservationPurchasePreview(input *GetHostReservationPurchasePreviewInput) (*GetHostReservationPurchasePreviewOutput, error) { + req, out := c.GetHostReservationPurchasePreviewRequest(input) + err := req.Send() + return out, err +} + const opGetPasswordData = "GetPasswordData" -// GetPasswordDataRequest generates a request for the GetPasswordData operation. +// GetPasswordDataRequest generates a "aws/request.Request" representing the +// client's request for the GetPasswordData operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the GetPasswordData method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the GetPasswordDataRequest method. +// req, resp := client.GetPasswordDataRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) GetPasswordDataRequest(input *GetPasswordDataInput) (req *request.Request, output *GetPasswordDataOutput) { op := &request.Operation{ Name: opGetPasswordData, @@ -5319,7 +9109,28 @@ func (c *EC2) GetPasswordData(input *GetPasswordDataInput) (*GetPasswordDataOutp const opImportImage = "ImportImage" -// ImportImageRequest generates a request for the ImportImage operation. +// ImportImageRequest generates a "aws/request.Request" representing the +// client's request for the ImportImage operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the ImportImage method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the ImportImageRequest method. +// req, resp := client.ImportImageRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) ImportImageRequest(input *ImportImageInput) (req *request.Request, output *ImportImageOutput) { op := &request.Operation{ Name: opImportImage, @@ -5338,7 +9149,9 @@ func (c *EC2) ImportImageRequest(input *ImportImageInput) (req *request.Request, } // Import single or multi-volume disk images or EBS snapshots into an Amazon -// Machine Image (AMI). +// Machine Image (AMI). For more information, see Importing a VM as an Image +// Using VM Import/Export (http://docs.aws.amazon.com/vm-import/latest/userguide/vmimport-image-import.html) +// in the VM Import/Export User Guide. func (c *EC2) ImportImage(input *ImportImageInput) (*ImportImageOutput, error) { req, out := c.ImportImageRequest(input) err := req.Send() @@ -5347,7 +9160,28 @@ func (c *EC2) ImportImage(input *ImportImageInput) (*ImportImageOutput, error) { const opImportInstance = "ImportInstance" -// ImportInstanceRequest generates a request for the ImportInstance operation. +// ImportInstanceRequest generates a "aws/request.Request" representing the +// client's request for the ImportInstance operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the ImportInstance method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the ImportInstanceRequest method. +// req, resp := client.ImportInstanceRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) ImportInstanceRequest(input *ImportInstanceInput) (req *request.Request, output *ImportInstanceOutput) { op := &request.Operation{ Name: opImportInstance, @@ -5367,11 +9201,11 @@ func (c *EC2) ImportInstanceRequest(input *ImportInstanceInput) (req *request.Re // 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. +// use ImportImage. For more information, see Importing a Virtual Machine Using +// the Amazon EC2 CLI (http://docs.aws.amazon.com/AWSEC2/latest/CommandLineReference/ec2-cli-vmimport-export.html). +// +// For information about the import manifest referenced by this API action, +// see VM Import Manifest (http://docs.aws.amazon.com/AWSEC2/latest/APIReference/manifest.html). func (c *EC2) ImportInstance(input *ImportInstanceInput) (*ImportInstanceOutput, error) { req, out := c.ImportInstanceRequest(input) err := req.Send() @@ -5380,7 +9214,28 @@ func (c *EC2) ImportInstance(input *ImportInstanceInput) (*ImportInstanceOutput, const opImportKeyPair = "ImportKeyPair" -// ImportKeyPairRequest generates a request for the ImportKeyPair operation. +// ImportKeyPairRequest generates a "aws/request.Request" representing the +// client's request for the ImportKeyPair operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the ImportKeyPair method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the ImportKeyPairRequest method. +// req, resp := client.ImportKeyPairRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) ImportKeyPairRequest(input *ImportKeyPairInput) (req *request.Request, output *ImportKeyPairOutput) { op := &request.Operation{ Name: opImportKeyPair, @@ -5414,7 +9269,28 @@ func (c *EC2) ImportKeyPair(input *ImportKeyPairInput) (*ImportKeyPairOutput, er const opImportSnapshot = "ImportSnapshot" -// ImportSnapshotRequest generates a request for the ImportSnapshot operation. +// ImportSnapshotRequest generates a "aws/request.Request" representing the +// client's request for the ImportSnapshot operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the ImportSnapshot method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the ImportSnapshotRequest method. +// req, resp := client.ImportSnapshotRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) ImportSnapshotRequest(input *ImportSnapshotInput) (req *request.Request, output *ImportSnapshotOutput) { op := &request.Operation{ Name: opImportSnapshot, @@ -5441,7 +9317,28 @@ func (c *EC2) ImportSnapshot(input *ImportSnapshotInput) (*ImportSnapshotOutput, const opImportVolume = "ImportVolume" -// ImportVolumeRequest generates a request for the ImportVolume operation. +// ImportVolumeRequest generates a "aws/request.Request" representing the +// client's request for the ImportVolume operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the ImportVolume method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the ImportVolumeRequest method. +// req, resp := client.ImportVolumeRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) ImportVolumeRequest(input *ImportVolumeInput) (req *request.Request, output *ImportVolumeOutput) { op := &request.Operation{ Name: opImportVolume, @@ -5459,12 +9356,11 @@ func (c *EC2) ImportVolumeRequest(input *ImportVolumeInput) (req *request.Reques 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. +// Creates an import volume task using metadata from the specified disk image.For +// more information, see Importing Disks to Amazon EBS (http://docs.aws.amazon.com/AWSEC2/latest/CommandLineReference/importing-your-volumes-into-amazon-ebs.html). +// +// For information about the import manifest referenced by this API action, +// see VM Import Manifest (http://docs.aws.amazon.com/AWSEC2/latest/APIReference/manifest.html). func (c *EC2) ImportVolume(input *ImportVolumeInput) (*ImportVolumeOutput, error) { req, out := c.ImportVolumeRequest(input) err := req.Send() @@ -5473,7 +9369,28 @@ func (c *EC2) ImportVolume(input *ImportVolumeInput) (*ImportVolumeOutput, error const opModifyHosts = "ModifyHosts" -// ModifyHostsRequest generates a request for the ModifyHosts operation. +// ModifyHostsRequest generates a "aws/request.Request" representing the +// client's request for the ModifyHosts operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the ModifyHosts method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the ModifyHostsRequest method. +// req, resp := client.ModifyHostsRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) ModifyHostsRequest(input *ModifyHostsInput) (req *request.Request, output *ModifyHostsOutput) { op := &request.Operation{ Name: opModifyHosts, @@ -5491,9 +9408,9 @@ func (c *EC2) ModifyHostsRequest(input *ModifyHostsInput) (req *request.Request, return } -// Modify the auto-placement setting of a Dedicated host. When auto-placement +// Modify the auto-placement setting of a Dedicated Host. When auto-placement // is enabled, AWS will place instances that you launch with a tenancy of host, -// but without targeting a specific host ID, onto any available Dedicated host +// but without targeting a specific host ID, onto any available Dedicated Host // in your account which has auto-placement enabled. When auto-placement is // disabled, you need to provide a host ID if you want the instance to launch // onto a specific host. If no host ID is provided, the instance will be launched @@ -5506,7 +9423,28 @@ func (c *EC2) ModifyHosts(input *ModifyHostsInput) (*ModifyHostsOutput, error) { const opModifyIdFormat = "ModifyIdFormat" -// ModifyIdFormatRequest generates a request for the ModifyIdFormat operation. +// ModifyIdFormatRequest generates a "aws/request.Request" representing the +// client's request for the ModifyIdFormat operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the ModifyIdFormat method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the ModifyIdFormatRequest method. +// req, resp := client.ModifyIdFormatRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) ModifyIdFormatRequest(input *ModifyIdFormatInput) (req *request.Request, output *ModifyIdFormatOutput) { op := &request.Operation{ Name: opModifyIdFormat, @@ -5529,23 +9467,111 @@ func (c *EC2) ModifyIdFormatRequest(input *ModifyIdFormatInput) (req *request.Re // Modifies the ID format for the specified resource on a per-region basis. // You can specify that resources should receive longer IDs (17-character IDs) // when they are created. The following resource types support longer IDs: instance -// | reservation. +// | reservation | snapshot | volume. // // This setting applies to the IAM user who makes the request; it does not // apply to the entire AWS account. By default, an IAM user defaults to the -// same settings as the root user, unless they explicitly override the settings -// by running this request. Resources created with longer IDs are visible to -// all IAM users, regardless of these settings and provided that they have permission -// to use the relevant Describe command for the resource type. +// same settings as the root user. If you're using this action as the root user, +// then these settings apply to the entire account, unless an IAM user explicitly +// overrides these settings for themselves. For more information, see Resource +// IDs (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/resource-ids.html) +// in the Amazon Elastic Compute Cloud User Guide. +// +// Resources created with longer IDs are visible to all IAM roles and users, +// regardless of these settings and provided that they have permission to use +// the relevant Describe command for the resource type. func (c *EC2) ModifyIdFormat(input *ModifyIdFormatInput) (*ModifyIdFormatOutput, error) { req, out := c.ModifyIdFormatRequest(input) err := req.Send() return out, err } +const opModifyIdentityIdFormat = "ModifyIdentityIdFormat" + +// ModifyIdentityIdFormatRequest generates a "aws/request.Request" representing the +// client's request for the ModifyIdentityIdFormat operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the ModifyIdentityIdFormat method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the ModifyIdentityIdFormatRequest method. +// req, resp := client.ModifyIdentityIdFormatRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +func (c *EC2) ModifyIdentityIdFormatRequest(input *ModifyIdentityIdFormatInput) (req *request.Request, output *ModifyIdentityIdFormatOutput) { + op := &request.Operation{ + Name: opModifyIdentityIdFormat, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &ModifyIdentityIdFormatInput{} + } + + req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(ec2query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) + output = &ModifyIdentityIdFormatOutput{} + req.Data = output + return +} + +// Modifies the ID format of a resource for the specified IAM user, IAM role, +// or root user. You can specify that resources should receive longer IDs (17-character +// IDs) when they are created. The following resource types support longer IDs: +// instance | reservation | snapshot | volume. For more information, see Resource +// IDs (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/resource-ids.html) +// in the Amazon Elastic Compute Cloud User Guide. +// +// This setting applies to the principal specified in the request; it does +// not apply to the principal that makes the request. +// +// Resources created with longer IDs are visible to all IAM roles and users, +// regardless of these settings and provided that they have permission to use +// the relevant Describe command for the resource type. +func (c *EC2) ModifyIdentityIdFormat(input *ModifyIdentityIdFormatInput) (*ModifyIdentityIdFormatOutput, error) { + req, out := c.ModifyIdentityIdFormatRequest(input) + err := req.Send() + return out, err +} + const opModifyImageAttribute = "ModifyImageAttribute" -// ModifyImageAttributeRequest generates a request for the ModifyImageAttribute operation. +// ModifyImageAttributeRequest generates a "aws/request.Request" representing the +// client's request for the ModifyImageAttribute operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the ModifyImageAttribute method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the ModifyImageAttributeRequest method. +// req, resp := client.ModifyImageAttributeRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) ModifyImageAttributeRequest(input *ModifyImageAttributeInput) (req *request.Request, output *ModifyImageAttributeOutput) { op := &request.Operation{ Name: opModifyImageAttribute, @@ -5568,8 +9594,13 @@ func (c *EC2) ModifyImageAttributeRequest(input *ModifyImageAttributeInput) (req // 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 +// AWS Marketplace product codes cannot be modified. Images with an AWS Marketplace // product code cannot be made public. +// +// The SriovNetSupport enhanced networking attribute cannot be changed using +// this command. Instead, enable SriovNetSupport on an instance and create an +// AMI from the instance. This will result in an image with SriovNetSupport +// enabled. func (c *EC2) ModifyImageAttribute(input *ModifyImageAttributeInput) (*ModifyImageAttributeOutput, error) { req, out := c.ModifyImageAttributeRequest(input) err := req.Send() @@ -5578,7 +9609,28 @@ func (c *EC2) ModifyImageAttribute(input *ModifyImageAttributeInput) (*ModifyIma const opModifyInstanceAttribute = "ModifyInstanceAttribute" -// ModifyInstanceAttributeRequest generates a request for the ModifyInstanceAttribute operation. +// ModifyInstanceAttributeRequest generates a "aws/request.Request" representing the +// client's request for the ModifyInstanceAttribute operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the ModifyInstanceAttribute method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the ModifyInstanceAttributeRequest method. +// req, resp := client.ModifyInstanceAttributeRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) ModifyInstanceAttributeRequest(input *ModifyInstanceAttributeInput) (req *request.Request, output *ModifyInstanceAttributeOutput) { op := &request.Operation{ Name: opModifyInstanceAttribute, @@ -5612,7 +9664,28 @@ func (c *EC2) ModifyInstanceAttribute(input *ModifyInstanceAttributeInput) (*Mod const opModifyInstancePlacement = "ModifyInstancePlacement" -// ModifyInstancePlacementRequest generates a request for the ModifyInstancePlacement operation. +// ModifyInstancePlacementRequest generates a "aws/request.Request" representing the +// client's request for the ModifyInstancePlacement operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the ModifyInstancePlacement method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the ModifyInstancePlacementRequest method. +// req, resp := client.ModifyInstancePlacementRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) ModifyInstancePlacementRequest(input *ModifyInstancePlacementInput) (req *request.Request, output *ModifyInstancePlacementOutput) { op := &request.Operation{ Name: opModifyInstancePlacement, @@ -5634,7 +9707,7 @@ func (c *EC2) ModifyInstancePlacementRequest(input *ModifyInstancePlacementInput // the instance tenancy setting. // // Instance affinity is disabled by default. When instance affinity is host -// and it is not associated with a specific Dedicated host, the next time it +// and it is not associated with a specific Dedicated Host, the next time it // is launched it will automatically be associated with the host it lands on. // This relationship will persist if the instance is stopped/started, or rebooted. // @@ -5657,7 +9730,28 @@ func (c *EC2) ModifyInstancePlacement(input *ModifyInstancePlacementInput) (*Mod const opModifyNetworkInterfaceAttribute = "ModifyNetworkInterfaceAttribute" -// ModifyNetworkInterfaceAttributeRequest generates a request for the ModifyNetworkInterfaceAttribute operation. +// ModifyNetworkInterfaceAttributeRequest generates a "aws/request.Request" representing the +// client's request for the ModifyNetworkInterfaceAttribute operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the ModifyNetworkInterfaceAttribute method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the ModifyNetworkInterfaceAttributeRequest method. +// req, resp := client.ModifyNetworkInterfaceAttributeRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) ModifyNetworkInterfaceAttributeRequest(input *ModifyNetworkInterfaceAttributeInput) (req *request.Request, output *ModifyNetworkInterfaceAttributeOutput) { op := &request.Operation{ Name: opModifyNetworkInterfaceAttribute, @@ -5687,7 +9781,28 @@ func (c *EC2) ModifyNetworkInterfaceAttribute(input *ModifyNetworkInterfaceAttri const opModifyReservedInstances = "ModifyReservedInstances" -// ModifyReservedInstancesRequest generates a request for the ModifyReservedInstances operation. +// ModifyReservedInstancesRequest generates a "aws/request.Request" representing the +// client's request for the ModifyReservedInstances operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the ModifyReservedInstances method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the ModifyReservedInstancesRequest method. +// req, resp := client.ModifyReservedInstancesRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) ModifyReservedInstancesRequest(input *ModifyReservedInstancesInput) (req *request.Request, output *ModifyReservedInstancesOutput) { op := &request.Operation{ Name: opModifyReservedInstances, @@ -5720,7 +9835,28 @@ func (c *EC2) ModifyReservedInstances(input *ModifyReservedInstancesInput) (*Mod const opModifySnapshotAttribute = "ModifySnapshotAttribute" -// ModifySnapshotAttributeRequest generates a request for the ModifySnapshotAttribute operation. +// ModifySnapshotAttributeRequest generates a "aws/request.Request" representing the +// client's request for the ModifySnapshotAttribute operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the ModifySnapshotAttribute method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the ModifySnapshotAttributeRequest method. +// req, resp := client.ModifySnapshotAttributeRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) ModifySnapshotAttributeRequest(input *ModifySnapshotAttributeInput) (req *request.Request, output *ModifySnapshotAttributeOutput) { op := &request.Operation{ Name: opModifySnapshotAttribute, @@ -5746,11 +9882,13 @@ func (c *EC2) ModifySnapshotAttributeRequest(input *ModifySnapshotAttributeInput // 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 +// Encrypted snapshots and snapshots with AWS Marketplace product codes cannot +// be made public. Snapshots encrypted with your default CMK cannot be shared +// with other accounts. +// +// 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) (*ModifySnapshotAttributeOutput, error) { req, out := c.ModifySnapshotAttributeRequest(input) err := req.Send() @@ -5759,7 +9897,28 @@ func (c *EC2) ModifySnapshotAttribute(input *ModifySnapshotAttributeInput) (*Mod const opModifySpotFleetRequest = "ModifySpotFleetRequest" -// ModifySpotFleetRequestRequest generates a request for the ModifySpotFleetRequest operation. +// ModifySpotFleetRequestRequest generates a "aws/request.Request" representing the +// client's request for the ModifySpotFleetRequest operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the ModifySpotFleetRequest method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the ModifySpotFleetRequestRequest method. +// req, resp := client.ModifySpotFleetRequestRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) ModifySpotFleetRequestRequest(input *ModifySpotFleetRequestInput) (req *request.Request, output *ModifySpotFleetRequestOutput) { op := &request.Operation{ Name: opModifySpotFleetRequest, @@ -5805,7 +9964,28 @@ func (c *EC2) ModifySpotFleetRequest(input *ModifySpotFleetRequestInput) (*Modif const opModifySubnetAttribute = "ModifySubnetAttribute" -// ModifySubnetAttributeRequest generates a request for the ModifySubnetAttribute operation. +// ModifySubnetAttributeRequest generates a "aws/request.Request" representing the +// client's request for the ModifySubnetAttribute operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the ModifySubnetAttribute method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the ModifySubnetAttributeRequest method. +// req, resp := client.ModifySubnetAttributeRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) ModifySubnetAttributeRequest(input *ModifySubnetAttributeInput) (req *request.Request, output *ModifySubnetAttributeOutput) { op := &request.Operation{ Name: opModifySubnetAttribute, @@ -5834,7 +10014,28 @@ func (c *EC2) ModifySubnetAttribute(input *ModifySubnetAttributeInput) (*ModifyS const opModifyVolumeAttribute = "ModifyVolumeAttribute" -// ModifyVolumeAttributeRequest generates a request for the ModifyVolumeAttribute operation. +// ModifyVolumeAttributeRequest generates a "aws/request.Request" representing the +// client's request for the ModifyVolumeAttribute operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the ModifyVolumeAttribute method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the ModifyVolumeAttributeRequest method. +// req, resp := client.ModifyVolumeAttributeRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) ModifyVolumeAttributeRequest(input *ModifyVolumeAttributeInput) (req *request.Request, output *ModifyVolumeAttributeOutput) { op := &request.Operation{ Name: opModifyVolumeAttribute, @@ -5872,7 +10073,28 @@ func (c *EC2) ModifyVolumeAttribute(input *ModifyVolumeAttributeInput) (*ModifyV const opModifyVpcAttribute = "ModifyVpcAttribute" -// ModifyVpcAttributeRequest generates a request for the ModifyVpcAttribute operation. +// ModifyVpcAttributeRequest generates a "aws/request.Request" representing the +// client's request for the ModifyVpcAttribute operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the ModifyVpcAttribute method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the ModifyVpcAttributeRequest method. +// req, resp := client.ModifyVpcAttributeRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) ModifyVpcAttributeRequest(input *ModifyVpcAttributeInput) (req *request.Request, output *ModifyVpcAttributeOutput) { op := &request.Operation{ Name: opModifyVpcAttribute, @@ -5901,7 +10123,28 @@ func (c *EC2) ModifyVpcAttribute(input *ModifyVpcAttributeInput) (*ModifyVpcAttr const opModifyVpcEndpoint = "ModifyVpcEndpoint" -// ModifyVpcEndpointRequest generates a request for the ModifyVpcEndpoint operation. +// ModifyVpcEndpointRequest generates a "aws/request.Request" representing the +// client's request for the ModifyVpcEndpoint operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the ModifyVpcEndpoint method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the ModifyVpcEndpointRequest method. +// req, resp := client.ModifyVpcEndpointRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) ModifyVpcEndpointRequest(input *ModifyVpcEndpointInput) (req *request.Request, output *ModifyVpcEndpointOutput) { op := &request.Operation{ Name: opModifyVpcEndpoint, @@ -5928,9 +10171,97 @@ func (c *EC2) ModifyVpcEndpoint(input *ModifyVpcEndpointInput) (*ModifyVpcEndpoi return out, err } +const opModifyVpcPeeringConnectionOptions = "ModifyVpcPeeringConnectionOptions" + +// ModifyVpcPeeringConnectionOptionsRequest generates a "aws/request.Request" representing the +// client's request for the ModifyVpcPeeringConnectionOptions operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the ModifyVpcPeeringConnectionOptions method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the ModifyVpcPeeringConnectionOptionsRequest method. +// req, resp := client.ModifyVpcPeeringConnectionOptionsRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +func (c *EC2) ModifyVpcPeeringConnectionOptionsRequest(input *ModifyVpcPeeringConnectionOptionsInput) (req *request.Request, output *ModifyVpcPeeringConnectionOptionsOutput) { + op := &request.Operation{ + Name: opModifyVpcPeeringConnectionOptions, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &ModifyVpcPeeringConnectionOptionsInput{} + } + + req = c.newRequest(op, input, output) + output = &ModifyVpcPeeringConnectionOptionsOutput{} + req.Data = output + return +} + +// Modifies the VPC peering connection options on one side of a VPC peering +// connection. You can do the following: +// +// Enable/disable communication over the peering connection between an EC2-Classic +// instance that's linked to your VPC (using ClassicLink) and instances in the +// peer VPC. +// +// Enable/disable communication over the peering connection between instances +// in your VPC and an EC2-Classic instance that's linked to the peer VPC. +// +// Enable/disable a local VPC to resolve public DNS hostnames to private +// IP addresses when queried from instances in the peer VPC. +// +// If the peered VPCs are in different accounts, each owner must initiate +// a separate request to modify the peering connection options, depending on +// whether their VPC was the requester or accepter for the VPC peering connection. +// If the peered VPCs are in the same account, you can modify the requester +// and accepter options in the same request. To confirm which VPC is the accepter +// and requester for a VPC peering connection, use the DescribeVpcPeeringConnections +// command. +func (c *EC2) ModifyVpcPeeringConnectionOptions(input *ModifyVpcPeeringConnectionOptionsInput) (*ModifyVpcPeeringConnectionOptionsOutput, error) { + req, out := c.ModifyVpcPeeringConnectionOptionsRequest(input) + err := req.Send() + return out, err +} + const opMonitorInstances = "MonitorInstances" -// MonitorInstancesRequest generates a request for the MonitorInstances operation. +// MonitorInstancesRequest generates a "aws/request.Request" representing the +// client's request for the MonitorInstances operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the MonitorInstances method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the MonitorInstancesRequest method. +// req, resp := client.MonitorInstancesRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) MonitorInstancesRequest(input *MonitorInstancesInput) (req *request.Request, output *MonitorInstancesOutput) { op := &request.Operation{ Name: opMonitorInstances, @@ -5959,7 +10290,28 @@ func (c *EC2) MonitorInstances(input *MonitorInstancesInput) (*MonitorInstancesO const opMoveAddressToVpc = "MoveAddressToVpc" -// MoveAddressToVpcRequest generates a request for the MoveAddressToVpc operation. +// MoveAddressToVpcRequest generates a "aws/request.Request" representing the +// client's request for the MoveAddressToVpc operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the MoveAddressToVpc method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the MoveAddressToVpcRequest method. +// req, resp := client.MoveAddressToVpcRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) MoveAddressToVpcRequest(input *MoveAddressToVpcInput) (req *request.Request, output *MoveAddressToVpcOutput) { op := &request.Operation{ Name: opMoveAddressToVpc, @@ -5982,19 +10334,89 @@ func (c *EC2) MoveAddressToVpcRequest(input *MoveAddressToVpcInput) (req *reques // than 24 hours, and it must not be associated with an instance. After the // Elastic IP address is moved, it is no longer available for use in the EC2-Classic // platform, unless you move it back using the RestoreAddressToClassic request. -// You cannot move an Elastic IP address that's allocated for use in the EC2-VPC -// platform to the EC2-Classic platform. You cannot migrate an Elastic IP address -// that's associated with a reverse DNS record. Contact AWS account and billing -// support to remove the reverse DNS record. +// You cannot move an Elastic IP address that was originally allocated for use +// in the EC2-VPC platform to the EC2-Classic platform. func (c *EC2) MoveAddressToVpc(input *MoveAddressToVpcInput) (*MoveAddressToVpcOutput, error) { req, out := c.MoveAddressToVpcRequest(input) err := req.Send() return out, err } +const opPurchaseHostReservation = "PurchaseHostReservation" + +// PurchaseHostReservationRequest generates a "aws/request.Request" representing the +// client's request for the PurchaseHostReservation operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the PurchaseHostReservation method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the PurchaseHostReservationRequest method. +// req, resp := client.PurchaseHostReservationRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +func (c *EC2) PurchaseHostReservationRequest(input *PurchaseHostReservationInput) (req *request.Request, output *PurchaseHostReservationOutput) { + op := &request.Operation{ + Name: opPurchaseHostReservation, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &PurchaseHostReservationInput{} + } + + req = c.newRequest(op, input, output) + output = &PurchaseHostReservationOutput{} + req.Data = output + return +} + +// Purchase a reservation with configurations that match those of your Dedicated +// Host. You must have active Dedicated Hosts in your account before you purchase +// a reservation. This action results in the specified reservation being purchased +// and charged to your account. +func (c *EC2) PurchaseHostReservation(input *PurchaseHostReservationInput) (*PurchaseHostReservationOutput, error) { + req, out := c.PurchaseHostReservationRequest(input) + err := req.Send() + return out, err +} + const opPurchaseReservedInstancesOffering = "PurchaseReservedInstancesOffering" -// PurchaseReservedInstancesOfferingRequest generates a request for the PurchaseReservedInstancesOffering operation. +// PurchaseReservedInstancesOfferingRequest generates a "aws/request.Request" representing the +// client's request for the PurchaseReservedInstancesOffering operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the PurchaseReservedInstancesOffering method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the PurchaseReservedInstancesOfferingRequest method. +// req, resp := client.PurchaseReservedInstancesOfferingRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) PurchaseReservedInstancesOfferingRequest(input *PurchaseReservedInstancesOfferingInput) (req *request.Request, output *PurchaseReservedInstancesOfferingOutput) { op := &request.Operation{ Name: opPurchaseReservedInstancesOffering, @@ -6032,7 +10454,28 @@ func (c *EC2) PurchaseReservedInstancesOffering(input *PurchaseReservedInstances const opPurchaseScheduledInstances = "PurchaseScheduledInstances" -// PurchaseScheduledInstancesRequest generates a request for the PurchaseScheduledInstances operation. +// PurchaseScheduledInstancesRequest generates a "aws/request.Request" representing the +// client's request for the PurchaseScheduledInstances operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the PurchaseScheduledInstances method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the PurchaseScheduledInstancesRequest method. +// req, resp := client.PurchaseScheduledInstancesRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) PurchaseScheduledInstancesRequest(input *PurchaseScheduledInstancesInput) (req *request.Request, output *PurchaseScheduledInstancesOutput) { op := &request.Operation{ Name: opPurchaseScheduledInstances, @@ -6055,7 +10498,11 @@ func (c *EC2) PurchaseScheduledInstancesRequest(input *PurchaseScheduledInstance // Scheduled Instances enable you to purchase Amazon EC2 compute capacity by // the hour for a one-year term. Before you can purchase a Scheduled Instance, // you must call DescribeScheduledInstanceAvailability to check for available -// schedules and obtain a purchase token. +// schedules and obtain a purchase token. After you purchase a Scheduled Instance, +// you must call RunScheduledInstances during each scheduled time period. +// +// After you purchase a Scheduled Instance, you can't cancel, modify, or resell +// your purchase. func (c *EC2) PurchaseScheduledInstances(input *PurchaseScheduledInstancesInput) (*PurchaseScheduledInstancesOutput, error) { req, out := c.PurchaseScheduledInstancesRequest(input) err := req.Send() @@ -6064,7 +10511,28 @@ func (c *EC2) PurchaseScheduledInstances(input *PurchaseScheduledInstancesInput) const opRebootInstances = "RebootInstances" -// RebootInstancesRequest generates a request for the RebootInstances operation. +// RebootInstancesRequest generates a "aws/request.Request" representing the +// client's request for the RebootInstances operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the RebootInstances method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the RebootInstancesRequest method. +// req, resp := client.RebootInstancesRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) RebootInstancesRequest(input *RebootInstancesInput) (req *request.Request, output *RebootInstancesOutput) { op := &request.Operation{ Name: opRebootInstances, @@ -6089,8 +10557,8 @@ func (c *EC2) RebootInstancesRequest(input *RebootInstancesInput) (req *request. // 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. +// If an 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) @@ -6103,7 +10571,28 @@ func (c *EC2) RebootInstances(input *RebootInstancesInput) (*RebootInstancesOutp const opRegisterImage = "RegisterImage" -// RegisterImageRequest generates a request for the RegisterImage operation. +// RegisterImageRequest generates a "aws/request.Request" representing the +// client's request for the RegisterImage operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the RegisterImage method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the RegisterImageRequest method. +// req, resp := client.RegisterImageRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) RegisterImageRequest(input *RegisterImageInput) (req *request.Request, output *RegisterImageOutput) { op := &request.Operation{ Name: opRegisterImage, @@ -6126,10 +10615,10 @@ func (c *EC2) RegisterImageRequest(input *RegisterImageInput) (req *request.Requ // 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. +// 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 Linux AMI +// You can also use RegisterImage to create an Amazon EBS-backed Linux 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. @@ -6152,7 +10641,7 @@ func (c *EC2) RegisterImageRequest(input *RegisterImageInput) (req *request.Requ // 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 +// You can't register an image where a secondary (non-root) snapshot has AWS // Marketplace product codes. func (c *EC2) RegisterImage(input *RegisterImageInput) (*RegisterImageOutput, error) { req, out := c.RegisterImageRequest(input) @@ -6162,7 +10651,28 @@ func (c *EC2) RegisterImage(input *RegisterImageInput) (*RegisterImageOutput, er const opRejectVpcPeeringConnection = "RejectVpcPeeringConnection" -// RejectVpcPeeringConnectionRequest generates a request for the RejectVpcPeeringConnection operation. +// RejectVpcPeeringConnectionRequest generates a "aws/request.Request" representing the +// client's request for the RejectVpcPeeringConnection operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the RejectVpcPeeringConnection method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the RejectVpcPeeringConnectionRequest method. +// req, resp := client.RejectVpcPeeringConnectionRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) RejectVpcPeeringConnectionRequest(input *RejectVpcPeeringConnectionInput) (req *request.Request, output *RejectVpcPeeringConnectionOutput) { op := &request.Operation{ Name: opRejectVpcPeeringConnection, @@ -6193,7 +10703,28 @@ func (c *EC2) RejectVpcPeeringConnection(input *RejectVpcPeeringConnectionInput) const opReleaseAddress = "ReleaseAddress" -// ReleaseAddressRequest generates a request for the ReleaseAddress operation. +// ReleaseAddressRequest generates a "aws/request.Request" representing the +// client's request for the ReleaseAddress operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the ReleaseAddress method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the ReleaseAddressRequest method. +// req, resp := client.ReleaseAddressRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) ReleaseAddressRequest(input *ReleaseAddressInput) (req *request.Request, output *ReleaseAddressOutput) { op := &request.Operation{ Name: opReleaseAddress, @@ -6236,7 +10767,28 @@ func (c *EC2) ReleaseAddress(input *ReleaseAddressInput) (*ReleaseAddressOutput, const opReleaseHosts = "ReleaseHosts" -// ReleaseHostsRequest generates a request for the ReleaseHosts operation. +// ReleaseHostsRequest generates a "aws/request.Request" representing the +// client's request for the ReleaseHosts operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the ReleaseHosts method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the ReleaseHostsRequest method. +// req, resp := client.ReleaseHostsRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) ReleaseHostsRequest(input *ReleaseHostsInput) (req *request.Request, output *ReleaseHostsOutput) { op := &request.Operation{ Name: opReleaseHosts, @@ -6254,13 +10806,13 @@ func (c *EC2) ReleaseHostsRequest(input *ReleaseHostsInput) (req *request.Reques return } -// When you no longer want to use a Dedicated host it can be released. On-Demand -// billing is stopped and the host goes into released state. The host ID of -// Dedicated hosts that have been released can no longer be specified in another -// request, e.g., ModifyHosts. You must stop or terminate all instances on a -// host before it can be released. +// When you no longer want to use an On-Demand Dedicated Host it can be released. +// On-Demand billing is stopped and the host goes into released state. The host +// ID of Dedicated Hosts that have been released can no longer be specified +// in another request, e.g., ModifyHosts. You must stop or terminate all instances +// on a host before it can be released. // -// When Dedicated hosts are released, it make take some time for them to stop +// When Dedicated Hosts are released, it make take some time for them to stop // counting toward your limit and you may receive capacity errors when trying // to allocate new Dedicated hosts. Try waiting a few minutes, and then try // again. @@ -6274,7 +10826,28 @@ func (c *EC2) ReleaseHosts(input *ReleaseHostsInput) (*ReleaseHostsOutput, error const opReplaceNetworkAclAssociation = "ReplaceNetworkAclAssociation" -// ReplaceNetworkAclAssociationRequest generates a request for the ReplaceNetworkAclAssociation operation. +// ReplaceNetworkAclAssociationRequest generates a "aws/request.Request" representing the +// client's request for the ReplaceNetworkAclAssociation operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the ReplaceNetworkAclAssociation method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the ReplaceNetworkAclAssociationRequest method. +// req, resp := client.ReplaceNetworkAclAssociationRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) ReplaceNetworkAclAssociationRequest(input *ReplaceNetworkAclAssociationInput) (req *request.Request, output *ReplaceNetworkAclAssociationOutput) { op := &request.Operation{ Name: opReplaceNetworkAclAssociation, @@ -6304,7 +10877,28 @@ func (c *EC2) ReplaceNetworkAclAssociation(input *ReplaceNetworkAclAssociationIn const opReplaceNetworkAclEntry = "ReplaceNetworkAclEntry" -// ReplaceNetworkAclEntryRequest generates a request for the ReplaceNetworkAclEntry operation. +// ReplaceNetworkAclEntryRequest generates a "aws/request.Request" representing the +// client's request for the ReplaceNetworkAclEntry operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the ReplaceNetworkAclEntry method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the ReplaceNetworkAclEntryRequest method. +// req, resp := client.ReplaceNetworkAclEntryRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) ReplaceNetworkAclEntryRequest(input *ReplaceNetworkAclEntryInput) (req *request.Request, output *ReplaceNetworkAclEntryOutput) { op := &request.Operation{ Name: opReplaceNetworkAclEntry, @@ -6335,7 +10929,28 @@ func (c *EC2) ReplaceNetworkAclEntry(input *ReplaceNetworkAclEntryInput) (*Repla const opReplaceRoute = "ReplaceRoute" -// ReplaceRouteRequest generates a request for the ReplaceRoute operation. +// ReplaceRouteRequest generates a "aws/request.Request" representing the +// client's request for the ReplaceRoute operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the ReplaceRoute method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the ReplaceRouteRequest method. +// req, resp := client.ReplaceRouteRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) ReplaceRouteRequest(input *ReplaceRouteInput) (req *request.Request, output *ReplaceRouteOutput) { op := &request.Operation{ Name: opReplaceRoute, @@ -6369,7 +10984,28 @@ func (c *EC2) ReplaceRoute(input *ReplaceRouteInput) (*ReplaceRouteOutput, error const opReplaceRouteTableAssociation = "ReplaceRouteTableAssociation" -// ReplaceRouteTableAssociationRequest generates a request for the ReplaceRouteTableAssociation operation. +// ReplaceRouteTableAssociationRequest generates a "aws/request.Request" representing the +// client's request for the ReplaceRouteTableAssociation operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the ReplaceRouteTableAssociation method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the ReplaceRouteTableAssociationRequest method. +// req, resp := client.ReplaceRouteTableAssociationRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) ReplaceRouteTableAssociationRequest(input *ReplaceRouteTableAssociationInput) (req *request.Request, output *ReplaceRouteTableAssociationOutput) { op := &request.Operation{ Name: opReplaceRouteTableAssociation, @@ -6404,7 +11040,28 @@ func (c *EC2) ReplaceRouteTableAssociation(input *ReplaceRouteTableAssociationIn const opReportInstanceStatus = "ReportInstanceStatus" -// ReportInstanceStatusRequest generates a request for the ReportInstanceStatus operation. +// ReportInstanceStatusRequest generates a "aws/request.Request" representing the +// client's request for the ReportInstanceStatus operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the ReportInstanceStatus method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the ReportInstanceStatusRequest method. +// req, resp := client.ReportInstanceStatusRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) ReportInstanceStatusRequest(input *ReportInstanceStatusInput) (req *request.Request, output *ReportInstanceStatusOutput) { op := &request.Operation{ Name: opReportInstanceStatus, @@ -6439,7 +11096,28 @@ func (c *EC2) ReportInstanceStatus(input *ReportInstanceStatusInput) (*ReportIns const opRequestSpotFleet = "RequestSpotFleet" -// RequestSpotFleetRequest generates a request for the RequestSpotFleet operation. +// RequestSpotFleetRequest generates a "aws/request.Request" representing the +// client's request for the RequestSpotFleet operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the RequestSpotFleet method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the RequestSpotFleetRequest method. +// req, resp := client.RequestSpotFleetRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) RequestSpotFleetRequest(input *RequestSpotFleetInput) (req *request.Request, output *RequestSpotFleetOutput) { op := &request.Operation{ Name: opRequestSpotFleet, @@ -6482,7 +11160,28 @@ func (c *EC2) RequestSpotFleet(input *RequestSpotFleetInput) (*RequestSpotFleetO const opRequestSpotInstances = "RequestSpotInstances" -// RequestSpotInstancesRequest generates a request for the RequestSpotInstances operation. +// RequestSpotInstancesRequest generates a "aws/request.Request" representing the +// client's request for the RequestSpotInstances operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the RequestSpotInstances method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the RequestSpotInstancesRequest method. +// req, resp := client.RequestSpotInstancesRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) RequestSpotInstancesRequest(input *RequestSpotInstancesInput) (req *request.Request, output *RequestSpotInstancesOutput) { op := &request.Operation{ Name: opRequestSpotInstances, @@ -6514,7 +11213,28 @@ func (c *EC2) RequestSpotInstances(input *RequestSpotInstancesInput) (*RequestSp const opResetImageAttribute = "ResetImageAttribute" -// ResetImageAttributeRequest generates a request for the ResetImageAttribute operation. +// ResetImageAttributeRequest generates a "aws/request.Request" representing the +// client's request for the ResetImageAttribute operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the ResetImageAttribute method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the ResetImageAttributeRequest method. +// req, resp := client.ResetImageAttributeRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) ResetImageAttributeRequest(input *ResetImageAttributeInput) (req *request.Request, output *ResetImageAttributeOutput) { op := &request.Operation{ Name: opResetImageAttribute, @@ -6545,7 +11265,28 @@ func (c *EC2) ResetImageAttribute(input *ResetImageAttributeInput) (*ResetImageA const opResetInstanceAttribute = "ResetInstanceAttribute" -// ResetInstanceAttributeRequest generates a request for the ResetInstanceAttribute operation. +// ResetInstanceAttributeRequest generates a "aws/request.Request" representing the +// client's request for the ResetInstanceAttribute operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the ResetInstanceAttribute method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the ResetInstanceAttributeRequest method. +// req, resp := client.ResetInstanceAttributeRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) ResetInstanceAttributeRequest(input *ResetInstanceAttributeInput) (req *request.Request, output *ResetInstanceAttributeOutput) { op := &request.Operation{ Name: opResetInstanceAttribute, @@ -6566,10 +11307,10 @@ func (c *EC2) ResetInstanceAttributeRequest(input *ResetInstanceAttributeInput) } // 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, +// 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 +// 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) @@ -6582,7 +11323,28 @@ func (c *EC2) ResetInstanceAttribute(input *ResetInstanceAttributeInput) (*Reset const opResetNetworkInterfaceAttribute = "ResetNetworkInterfaceAttribute" -// ResetNetworkInterfaceAttributeRequest generates a request for the ResetNetworkInterfaceAttribute operation. +// ResetNetworkInterfaceAttributeRequest generates a "aws/request.Request" representing the +// client's request for the ResetNetworkInterfaceAttribute operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the ResetNetworkInterfaceAttribute method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the ResetNetworkInterfaceAttributeRequest method. +// req, resp := client.ResetNetworkInterfaceAttributeRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) ResetNetworkInterfaceAttributeRequest(input *ResetNetworkInterfaceAttributeInput) (req *request.Request, output *ResetNetworkInterfaceAttributeOutput) { op := &request.Operation{ Name: opResetNetworkInterfaceAttribute, @@ -6612,7 +11374,28 @@ func (c *EC2) ResetNetworkInterfaceAttribute(input *ResetNetworkInterfaceAttribu const opResetSnapshotAttribute = "ResetSnapshotAttribute" -// ResetSnapshotAttributeRequest generates a request for the ResetSnapshotAttribute operation. +// ResetSnapshotAttributeRequest generates a "aws/request.Request" representing the +// client's request for the ResetSnapshotAttribute operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the ResetSnapshotAttribute method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the ResetSnapshotAttributeRequest method. +// req, resp := client.ResetSnapshotAttributeRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) ResetSnapshotAttributeRequest(input *ResetSnapshotAttributeInput) (req *request.Request, output *ResetSnapshotAttributeOutput) { op := &request.Operation{ Name: opResetSnapshotAttribute, @@ -6645,7 +11428,28 @@ func (c *EC2) ResetSnapshotAttribute(input *ResetSnapshotAttributeInput) (*Reset const opRestoreAddressToClassic = "RestoreAddressToClassic" -// RestoreAddressToClassicRequest generates a request for the RestoreAddressToClassic operation. +// RestoreAddressToClassicRequest generates a "aws/request.Request" representing the +// client's request for the RestoreAddressToClassic operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the RestoreAddressToClassic method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the RestoreAddressToClassicRequest method. +// req, resp := client.RestoreAddressToClassicRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) RestoreAddressToClassicRequest(input *RestoreAddressToClassicInput) (req *request.Request, output *RestoreAddressToClassicOutput) { op := &request.Operation{ Name: opRestoreAddressToClassic, @@ -6666,9 +11470,7 @@ func (c *EC2) RestoreAddressToClassicRequest(input *RestoreAddressToClassicInput // Restores an Elastic IP address that was previously moved to the EC2-VPC platform // back to the EC2-Classic platform. You cannot move an Elastic IP address that // was originally allocated for use in EC2-VPC. The Elastic IP address must -// not be associated with an instance or network interface. You cannot restore -// an Elastic IP address that's associated with a reverse DNS record. Contact -// AWS account and billing support to remove the reverse DNS record. +// not be associated with an instance or network interface. func (c *EC2) RestoreAddressToClassic(input *RestoreAddressToClassicInput) (*RestoreAddressToClassicOutput, error) { req, out := c.RestoreAddressToClassicRequest(input) err := req.Send() @@ -6677,7 +11479,28 @@ func (c *EC2) RestoreAddressToClassic(input *RestoreAddressToClassicInput) (*Res const opRevokeSecurityGroupEgress = "RevokeSecurityGroupEgress" -// RevokeSecurityGroupEgressRequest generates a request for the RevokeSecurityGroupEgress operation. +// RevokeSecurityGroupEgressRequest generates a "aws/request.Request" representing the +// client's request for the RevokeSecurityGroupEgress operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the RevokeSecurityGroupEgress method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the RevokeSecurityGroupEgressRequest method. +// req, resp := client.RevokeSecurityGroupEgressRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) RevokeSecurityGroupEgressRequest(input *RevokeSecurityGroupEgressInput) (req *request.Request, output *RevokeSecurityGroupEgressOutput) { op := &request.Operation{ Name: opRevokeSecurityGroupEgress, @@ -6717,7 +11540,28 @@ func (c *EC2) RevokeSecurityGroupEgress(input *RevokeSecurityGroupEgressInput) ( const opRevokeSecurityGroupIngress = "RevokeSecurityGroupIngress" -// RevokeSecurityGroupIngressRequest generates a request for the RevokeSecurityGroupIngress operation. +// RevokeSecurityGroupIngressRequest generates a "aws/request.Request" representing the +// client's request for the RevokeSecurityGroupIngress operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the RevokeSecurityGroupIngress method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the RevokeSecurityGroupIngressRequest method. +// req, resp := client.RevokeSecurityGroupIngressRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) RevokeSecurityGroupIngressRequest(input *RevokeSecurityGroupIngressInput) (req *request.Request, output *RevokeSecurityGroupIngressOutput) { op := &request.Operation{ Name: opRevokeSecurityGroupIngress, @@ -6756,7 +11600,28 @@ func (c *EC2) RevokeSecurityGroupIngress(input *RevokeSecurityGroupIngressInput) const opRunInstances = "RunInstances" -// RunInstancesRequest generates a request for the RunInstances operation. +// RunInstancesRequest generates a "aws/request.Request" representing the +// client's request for the RunInstances operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the RunInstances method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the RunInstancesRequest method. +// req, resp := client.RunInstancesRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) RunInstancesRequest(input *RunInstancesInput) (req *request.Request, output *Reservation) { op := &request.Operation{ Name: opRunInstances, @@ -6781,6 +11646,14 @@ func (c *EC2) RunInstancesRequest(input *RunInstancesInput) (req *request.Reques // is ready for you, it enters the running state. To check the state of your // instance, call DescribeInstances. // +// To ensure faster instance launches, break up large requests into smaller +// batches. For example, create five separate launch requests for 100 instances +// each instead of one launch request for 500 instances. +// +// To tag your instance, ensure that it is running as CreateTags requires a +// resource ID. For more information about tagging, see Tagging Your Amazon +// EC2 Resources (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Using_Tags.html). +// // 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) @@ -6805,9 +11678,9 @@ func (c *EC2) RunInstancesRequest(input *RunInstancesInput) (req *request.Reques // If any of the AMIs have a product code attached for which the user has not // subscribed, RunInstances fails. // -// T2 instance types can only be launched into a VPC. If you do not have a -// default VPC, or if you do not specify a subnet ID in the request, RunInstances -// fails. +// Some instance types can only be launched into a VPC. If you do not have +// a default VPC, or if you do not specify a subnet ID in the request, RunInstances +// fails. For more information, see Instance Types Available Only in a VPC (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-vpc.html#vpc-only-instance-types). // // For more information about troubleshooting, see What To Do If An Instance // Immediately Terminates (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Using_InstanceStraightToTerminated.html), @@ -6821,7 +11694,28 @@ func (c *EC2) RunInstances(input *RunInstancesInput) (*Reservation, error) { const opRunScheduledInstances = "RunScheduledInstances" -// RunScheduledInstancesRequest generates a request for the RunScheduledInstances operation. +// RunScheduledInstancesRequest generates a "aws/request.Request" representing the +// client's request for the RunScheduledInstances operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the RunScheduledInstances method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the RunScheduledInstancesRequest method. +// req, resp := client.RunScheduledInstancesRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) RunScheduledInstancesRequest(input *RunScheduledInstancesInput) (req *request.Request, output *RunScheduledInstancesOutput) { op := &request.Operation{ Name: opRunScheduledInstances, @@ -6847,7 +11741,9 @@ func (c *EC2) RunScheduledInstancesRequest(input *RunScheduledInstancesInput) (r // You must launch a Scheduled Instance during its scheduled time period. You // can't stop or reboot a Scheduled Instance, but you can terminate it as needed. // If you terminate a Scheduled Instance before the current scheduled time period -// ends, you can launch it again after a few minutes. +// ends, you can launch it again after a few minutes. For more information, +// see Scheduled Instances (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-scheduled-instances.html) +// in the Amazon Elastic Compute Cloud User Guide. func (c *EC2) RunScheduledInstances(input *RunScheduledInstancesInput) (*RunScheduledInstancesOutput, error) { req, out := c.RunScheduledInstancesRequest(input) err := req.Send() @@ -6856,7 +11752,28 @@ func (c *EC2) RunScheduledInstances(input *RunScheduledInstancesInput) (*RunSche const opStartInstances = "StartInstances" -// StartInstancesRequest generates a request for the StartInstances operation. +// StartInstancesRequest generates a "aws/request.Request" representing the +// client's request for the StartInstances operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the StartInstances method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the StartInstancesRequest method. +// req, resp := client.StartInstancesRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) StartInstancesRequest(input *StartInstancesInput) (req *request.Request, output *StartInstancesOutput) { op := &request.Operation{ Name: opStartInstances, @@ -6901,7 +11818,28 @@ func (c *EC2) StartInstances(input *StartInstancesInput) (*StartInstancesOutput, const opStopInstances = "StopInstances" -// StopInstancesRequest generates a request for the StopInstances operation. +// StopInstancesRequest generates a "aws/request.Request" representing the +// client's request for the StopInstances operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the StopInstances method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the StopInstancesRequest method. +// req, resp := client.StopInstancesRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) StopInstancesRequest(input *StopInstancesInput) (req *request.Request, output *StopInstancesOutput) { op := &request.Operation{ Name: opStopInstances, @@ -6919,36 +11857,35 @@ func (c *EC2) StopInstancesRequest(input *StopInstancesInput) (req *request.Requ 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. +// Stops an Amazon EBS-backed instance. // -// You can't start or stop Spot instances. +// We don't charge hourly usage for a stopped instance, or data transfer fees; +// however, your root partition Amazon EBS volume remains, continues to persist +// your data, and you are charged for Amazon EBS volume usage. 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. // -// 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. +// You can't start or stop Spot instances, and you can't stop instance store-backed +// instances. // -// 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. +// When you stop an instance, we shut it down. 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) +// Stopping an instance is different to rebooting or terminating 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 rebooting, 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) +// When you stop an instance, we attempt to shut it down forcibly after a short +// while. If your instance appears stuck in the stopping state after a period +// of time, there may be an issue with the underlying host computer. For more +// information, 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) (*StopInstancesOutput, error) { req, out := c.StopInstancesRequest(input) @@ -6958,7 +11895,28 @@ func (c *EC2) StopInstances(input *StopInstancesInput) (*StopInstancesOutput, er const opTerminateInstances = "TerminateInstances" -// TerminateInstancesRequest generates a request for the TerminateInstances operation. +// TerminateInstancesRequest generates a "aws/request.Request" representing the +// client's request for the TerminateInstances operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the TerminateInstances method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the TerminateInstancesRequest method. +// req, resp := client.TerminateInstancesRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) TerminateInstancesRequest(input *TerminateInstancesInput) (req *request.Request, output *TerminateInstancesOutput) { op := &request.Operation{ Name: opTerminateInstances, @@ -7006,7 +11964,28 @@ func (c *EC2) TerminateInstances(input *TerminateInstancesInput) (*TerminateInst const opUnassignPrivateIpAddresses = "UnassignPrivateIpAddresses" -// UnassignPrivateIpAddressesRequest generates a request for the UnassignPrivateIpAddresses operation. +// UnassignPrivateIpAddressesRequest generates a "aws/request.Request" representing the +// client's request for the UnassignPrivateIpAddresses operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the UnassignPrivateIpAddresses method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the UnassignPrivateIpAddressesRequest method. +// req, resp := client.UnassignPrivateIpAddressesRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) UnassignPrivateIpAddressesRequest(input *UnassignPrivateIpAddressesInput) (req *request.Request, output *UnassignPrivateIpAddressesOutput) { op := &request.Operation{ Name: opUnassignPrivateIpAddresses, @@ -7035,7 +12014,28 @@ func (c *EC2) UnassignPrivateIpAddresses(input *UnassignPrivateIpAddressesInput) const opUnmonitorInstances = "UnmonitorInstances" -// UnmonitorInstancesRequest generates a request for the UnmonitorInstances operation. +// UnmonitorInstancesRequest generates a "aws/request.Request" representing the +// client's request for the UnmonitorInstances operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the UnmonitorInstances method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the UnmonitorInstancesRequest method. +// req, resp := client.UnmonitorInstancesRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *EC2) UnmonitorInstancesRequest(input *UnmonitorInstancesInput) (req *request.Request, output *UnmonitorInstancesOutput) { op := &request.Operation{ Name: opUnmonitorInstances, @@ -7062,6 +12062,7 @@ func (c *EC2) UnmonitorInstances(input *UnmonitorInstancesInput) (*UnmonitorInst return out, err } +// Contains the parameters for AcceptVpcPeeringConnection. type AcceptVpcPeeringConnectionInput struct { _ struct{} `type:"structure"` @@ -7085,6 +12086,7 @@ func (s AcceptVpcPeeringConnectionInput) GoString() string { return s.String() } +// Contains the output of AcceptVpcPeeringConnection. type AcceptVpcPeeringConnectionOutput struct { _ struct{} `type:"structure"` @@ -7206,6 +12208,7 @@ func (s Address) GoString() string { return s.String() } +// Contains the parameters for AllocateAddress. type AllocateAddressInput struct { _ struct{} `type:"structure"` @@ -7231,6 +12234,7 @@ func (s AllocateAddressInput) GoString() string { return s.String() } +// Contains the output of AllocateAddress. type AllocateAddressOutput struct { _ struct{} `type:"structure"` @@ -7256,17 +12260,18 @@ func (s AllocateAddressOutput) GoString() string { return s.String() } +// Contains the parameters for AllocateHosts. type AllocateHostsInput struct { _ struct{} `type:"structure"` // This is enabled by default. This property allows instances to be automatically - // placed onto available Dedicated hosts, when you are launching instances without + // placed onto available Dedicated Hosts, when you are launching instances without // specifying a host ID. // // Default: Enabled AutoPlacement *string `locationName:"autoPlacement" type:"string" enum:"AutoPlacement"` - // The Availability Zone for the Dedicated hosts. + // The Availability Zone for the Dedicated Hosts. AvailabilityZone *string `locationName:"availabilityZone" type:"string" required:"true"` // Unique, case-sensitive identifier you provide to ensure idempotency of the @@ -7274,12 +12279,12 @@ type AllocateHostsInput struct { // in the Amazon Elastic Compute Cloud User Guide. ClientToken *string `locationName:"clientToken" type:"string"` - // Specify the instance type that you want your Dedicated hosts to be configured + // Specify the instance type that you want your Dedicated Hosts to be configured // for. When you specify the instance type, that is the only instance type that // you can launch onto that host. InstanceType *string `locationName:"instanceType" type:"string" required:"true"` - // The number of Dedicated hosts you want to allocate to your account with these + // The number of Dedicated Hosts you want to allocate to your account with these // parameters. Quantity *int64 `locationName:"quantity" type:"integer" required:"true"` } @@ -7294,10 +12299,30 @@ func (s AllocateHostsInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *AllocateHostsInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "AllocateHostsInput"} + if s.AvailabilityZone == nil { + invalidParams.Add(request.NewErrParamRequired("AvailabilityZone")) + } + if s.InstanceType == nil { + invalidParams.Add(request.NewErrParamRequired("InstanceType")) + } + if s.Quantity == nil { + invalidParams.Add(request.NewErrParamRequired("Quantity")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// Contains the output of AllocateHosts. type AllocateHostsOutput struct { _ struct{} `type:"structure"` - // The ID of the allocated Dedicated host. This is used when you want to launch + // The ID of the allocated Dedicated Host. This is used when you want to launch // an instance onto a specific host. HostIds []*string `locationName:"hostIdSet" locationNameList:"item" type:"list"` } @@ -7312,6 +12337,7 @@ func (s AllocateHostsOutput) GoString() string { return s.String() } +// Contains the parameters for AssignPrivateIpAddresses. type AssignPrivateIpAddressesInput struct { _ struct{} `type:"structure"` @@ -7345,6 +12371,19 @@ func (s AssignPrivateIpAddressesInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *AssignPrivateIpAddressesInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "AssignPrivateIpAddressesInput"} + if s.NetworkInterfaceId == nil { + invalidParams.Add(request.NewErrParamRequired("NetworkInterfaceId")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + type AssignPrivateIpAddressesOutput struct { _ struct{} `type:"structure"` } @@ -7359,6 +12398,7 @@ func (s AssignPrivateIpAddressesOutput) GoString() string { return s.String() } +// Contains the parameters for AssociateAddress. type AssociateAddressInput struct { _ struct{} `type:"structure"` @@ -7408,6 +12448,7 @@ func (s AssociateAddressInput) GoString() string { return s.String() } +// Contains the output of AssociateAddress. type AssociateAddressOutput struct { _ struct{} `type:"structure"` @@ -7426,6 +12467,7 @@ func (s AssociateAddressOutput) GoString() string { return s.String() } +// Contains the parameters for AssociateDhcpOptions. type AssociateDhcpOptionsInput struct { _ struct{} `type:"structure"` @@ -7453,6 +12495,22 @@ func (s AssociateDhcpOptionsInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *AssociateDhcpOptionsInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "AssociateDhcpOptionsInput"} + if s.DhcpOptionsId == nil { + invalidParams.Add(request.NewErrParamRequired("DhcpOptionsId")) + } + if s.VpcId == nil { + invalidParams.Add(request.NewErrParamRequired("VpcId")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + type AssociateDhcpOptionsOutput struct { _ struct{} `type:"structure"` } @@ -7467,6 +12525,7 @@ func (s AssociateDhcpOptionsOutput) GoString() string { return s.String() } +// Contains the parameters for AssociateRouteTable. type AssociateRouteTableInput struct { _ struct{} `type:"structure"` @@ -7493,6 +12552,23 @@ func (s AssociateRouteTableInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *AssociateRouteTableInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "AssociateRouteTableInput"} + if s.RouteTableId == nil { + invalidParams.Add(request.NewErrParamRequired("RouteTableId")) + } + if s.SubnetId == nil { + invalidParams.Add(request.NewErrParamRequired("SubnetId")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// Contains the output of AssociateRouteTable. type AssociateRouteTableOutput struct { _ struct{} `type:"structure"` @@ -7510,6 +12586,7 @@ func (s AssociateRouteTableOutput) GoString() string { return s.String() } +// Contains the parameters for AttachClassicLinkVpc. type AttachClassicLinkVpcInput struct { _ struct{} `type:"structure"` @@ -7540,6 +12617,26 @@ func (s AttachClassicLinkVpcInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *AttachClassicLinkVpcInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "AttachClassicLinkVpcInput"} + if s.Groups == nil { + invalidParams.Add(request.NewErrParamRequired("Groups")) + } + if s.InstanceId == nil { + invalidParams.Add(request.NewErrParamRequired("InstanceId")) + } + if s.VpcId == nil { + invalidParams.Add(request.NewErrParamRequired("VpcId")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// Contains the output of AttachClassicLinkVpc. type AttachClassicLinkVpcOutput struct { _ struct{} `type:"structure"` @@ -7557,6 +12654,7 @@ func (s AttachClassicLinkVpcOutput) GoString() string { return s.String() } +// Contains the parameters for AttachInternetGateway. type AttachInternetGatewayInput struct { _ struct{} `type:"structure"` @@ -7583,6 +12681,22 @@ func (s AttachInternetGatewayInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *AttachInternetGatewayInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "AttachInternetGatewayInput"} + if s.InternetGatewayId == nil { + invalidParams.Add(request.NewErrParamRequired("InternetGatewayId")) + } + if s.VpcId == nil { + invalidParams.Add(request.NewErrParamRequired("VpcId")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + type AttachInternetGatewayOutput struct { _ struct{} `type:"structure"` } @@ -7597,6 +12711,7 @@ func (s AttachInternetGatewayOutput) GoString() string { return s.String() } +// Contains the parameters for AttachNetworkInterface. type AttachNetworkInterfaceInput struct { _ struct{} `type:"structure"` @@ -7626,6 +12741,26 @@ func (s AttachNetworkInterfaceInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *AttachNetworkInterfaceInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "AttachNetworkInterfaceInput"} + if s.DeviceIndex == nil { + invalidParams.Add(request.NewErrParamRequired("DeviceIndex")) + } + if s.InstanceId == nil { + invalidParams.Add(request.NewErrParamRequired("InstanceId")) + } + if s.NetworkInterfaceId == nil { + invalidParams.Add(request.NewErrParamRequired("NetworkInterfaceId")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// Contains the output of AttachNetworkInterface. type AttachNetworkInterfaceOutput struct { _ struct{} `type:"structure"` @@ -7643,6 +12778,7 @@ func (s AttachNetworkInterfaceOutput) GoString() string { return s.String() } +// Contains the parameters for AttachVolume. type AttachVolumeInput struct { _ struct{} `type:"structure"` @@ -7673,6 +12809,26 @@ func (s AttachVolumeInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *AttachVolumeInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "AttachVolumeInput"} + if s.Device == nil { + invalidParams.Add(request.NewErrParamRequired("Device")) + } + if s.InstanceId == nil { + invalidParams.Add(request.NewErrParamRequired("InstanceId")) + } + if s.VolumeId == nil { + invalidParams.Add(request.NewErrParamRequired("VolumeId")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// Contains the parameters for AttachVpnGateway. type AttachVpnGatewayInput struct { _ struct{} `type:"structure"` @@ -7699,6 +12855,23 @@ func (s AttachVpnGatewayInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *AttachVpnGatewayInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "AttachVpnGatewayInput"} + if s.VpcId == nil { + invalidParams.Add(request.NewErrParamRequired("VpcId")) + } + if s.VpnGatewayId == nil { + invalidParams.Add(request.NewErrParamRequired("VpnGatewayId")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// Contains the output of AttachVpnGateway. type AttachVpnGatewayOutput struct { _ struct{} `type:"structure"` @@ -7716,11 +12889,11 @@ func (s AttachVpnGatewayOutput) GoString() string { return s.String() } -// The value to use when a resource attribute accepts a Boolean value. +// Describes a value for a resource attribute that is a Boolean value. type AttributeBooleanValue struct { _ struct{} `type:"structure"` - // Valid values are true or false. + // The attribute value. The valid values are true or false. Value *bool `locationName:"value" type:"boolean"` } @@ -7734,11 +12907,11 @@ func (s AttributeBooleanValue) GoString() string { return s.String() } -// The value to use for a resource attribute. +// Describes a value for a resource attribute that is a String. type AttributeValue struct { _ struct{} `type:"structure"` - // Valid values are case-sensitive and vary by action. + // The attribute value. Note that the value is case-sensitive. Value *string `locationName:"value" type:"string"` } @@ -7752,6 +12925,7 @@ func (s AttributeValue) GoString() string { return s.String() } +// Contains the parameters for AuthorizeSecurityGroupEgress. type AuthorizeSecurityGroupEgressInput struct { _ struct{} `type:"structure"` @@ -7805,6 +12979,19 @@ func (s AuthorizeSecurityGroupEgressInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *AuthorizeSecurityGroupEgressInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "AuthorizeSecurityGroupEgressInput"} + if s.GroupId == nil { + invalidParams.Add(request.NewErrParamRequired("GroupId")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + type AuthorizeSecurityGroupEgressOutput struct { _ struct{} `type:"structure"` } @@ -7819,6 +13006,7 @@ func (s AuthorizeSecurityGroupEgressOutput) GoString() string { return s.String() } +// Contains the parameters for AuthorizeSecurityGroupIngress. type AuthorizeSecurityGroupIngressInput struct { _ struct{} `type:"structure"` @@ -7847,23 +13035,25 @@ type AuthorizeSecurityGroupIngressInput struct { IpPermissions []*IpPermission `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. + // (VPC only) Use -1 to specify all traffic. If you specify -1, traffic on all + // ports is allowed, regardless of any ports you specify. IpProtocol *string `type:"string"` // [EC2-Classic, default VPC] The name of the source security group. You can't // specify this parameter in combination with the following parameters: the // CIDR IP address range, the start of the port range, the IP protocol, and - // the end of the port range. For EC2-VPC, the source security group must be - // in the same VPC. + // the end of the port range. Creates rules that grant full ICMP, UDP, and TCP + // access. To create a rule with a specific IP protocol and port range, use + // a set of IP permissions instead. For EC2-VPC, the source security group must + // be in the same VPC. SourceSecurityGroupName *string `type:"string"` - // [EC2-Classic, default VPC] The AWS account number for the source security - // group. For EC2-VPC, the source security group must be in the same VPC. You - // can't specify this parameter in combination with the following parameters: - // the CIDR IP address range, the IP protocol, the start of the port range, - // and the end of the port range. Creates rules that grant full ICMP, UDP, and - // TCP access. To create a rule with a specific IP protocol and port range, - // use a set of IP permissions instead. + // [EC2-Classic] The AWS account number for the source security group, if the + // source security group is in a different account. You can't specify this parameter + // in combination with the following parameters: the CIDR IP address range, + // the IP protocol, the start of the port range, and the end of the port range. + // Creates rules that grant full ICMP, UDP, and TCP access. To create a rule + // with a specific IP protocol and port range, use a set of IP permissions instead. SourceSecurityGroupOwnerId *string `type:"string"` // The end of port range for the TCP and UDP protocols, or an ICMP code number. @@ -7940,14 +13130,14 @@ func (s AvailabilityZoneMessage) GoString() string { return s.String() } -// The capacity information for instances launched onto the Dedicated host. +// The capacity information for instances launched onto the Dedicated Host. type AvailableCapacity struct { _ struct{} `type:"structure"` - // The total number of instances that the Dedicated host supports. + // The total number of instances that the Dedicated Host supports. AvailableInstanceCapacity []*InstanceCapacity `locationName:"availableInstanceCapacity" locationNameList:"item" type:"list"` - // The number of vCPUs available on the Dedicated host. + // The number of vCPUs available on the Dedicated Host. AvailableVCpus *int64 `locationName:"availableVCpus" type:"integer"` } @@ -7964,6 +13154,7 @@ func (s AvailableCapacity) GoString() string { type BlobAttributeValue struct { _ struct{} `type:"structure"` + // Value is automatically base64 encoded/decoded by the SDK. Value []byte `locationName:"value" type:"blob"` } @@ -8015,6 +13206,7 @@ func (s BlockDeviceMapping) GoString() string { return s.String() } +// Contains the parameters for BundleInstance. type BundleInstanceInput struct { _ struct{} `type:"structure"` @@ -8049,6 +13241,23 @@ func (s BundleInstanceInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *BundleInstanceInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "BundleInstanceInput"} + if s.InstanceId == nil { + invalidParams.Add(request.NewErrParamRequired("InstanceId")) + } + if s.Storage == nil { + invalidParams.Add(request.NewErrParamRequired("Storage")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// Contains the output of BundleInstance. type BundleInstanceOutput struct { _ struct{} `type:"structure"` @@ -8126,6 +13335,7 @@ func (s BundleTaskError) GoString() string { return s.String() } +// Contains the parameters for CancelBundleTask. type CancelBundleTaskInput struct { _ struct{} `type:"structure"` @@ -8149,6 +13359,20 @@ func (s CancelBundleTaskInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *CancelBundleTaskInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "CancelBundleTaskInput"} + if s.BundleId == nil { + invalidParams.Add(request.NewErrParamRequired("BundleId")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// Contains the output of CancelBundleTask. type CancelBundleTaskOutput struct { _ struct{} `type:"structure"` @@ -8166,6 +13390,7 @@ func (s CancelBundleTaskOutput) GoString() string { return s.String() } +// Contains the parameters for CancelConversionTask. type CancelConversionTaskInput struct { _ struct{} `type:"structure"` @@ -8192,6 +13417,19 @@ func (s CancelConversionTaskInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *CancelConversionTaskInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "CancelConversionTaskInput"} + if s.ConversionTaskId == nil { + invalidParams.Add(request.NewErrParamRequired("ConversionTaskId")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + type CancelConversionTaskOutput struct { _ struct{} `type:"structure"` } @@ -8206,6 +13444,7 @@ func (s CancelConversionTaskOutput) GoString() string { return s.String() } +// Contains the parameters for CancelExportTask. type CancelExportTaskInput struct { _ struct{} `type:"structure"` @@ -8223,6 +13462,19 @@ func (s CancelExportTaskInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *CancelExportTaskInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "CancelExportTaskInput"} + if s.ExportTaskId == nil { + invalidParams.Add(request.NewErrParamRequired("ExportTaskId")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + type CancelExportTaskOutput struct { _ struct{} `type:"structure"` } @@ -8237,6 +13489,7 @@ func (s CancelExportTaskOutput) GoString() string { return s.String() } +// Contains the parameters for CancelImportTask. type CancelImportTaskInput struct { _ struct{} `type:"structure"` @@ -8263,6 +13516,7 @@ func (s CancelImportTaskInput) GoString() string { return s.String() } +// Contains the output for CancelImportTask. type CancelImportTaskOutput struct { _ struct{} `type:"structure"` @@ -8286,6 +13540,7 @@ func (s CancelImportTaskOutput) GoString() string { return s.String() } +// Contains the parameters for CancelReservedInstancesListing. type CancelReservedInstancesListingInput struct { _ struct{} `type:"structure"` @@ -8303,6 +13558,20 @@ func (s CancelReservedInstancesListingInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *CancelReservedInstancesListingInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "CancelReservedInstancesListingInput"} + if s.ReservedInstancesListingId == nil { + invalidParams.Add(request.NewErrParamRequired("ReservedInstancesListingId")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// Contains the output of CancelReservedInstancesListing. type CancelReservedInstancesListingOutput struct { _ struct{} `type:"structure"` @@ -8390,6 +13659,22 @@ func (s CancelSpotFleetRequestsInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *CancelSpotFleetRequestsInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "CancelSpotFleetRequestsInput"} + if s.SpotFleetRequestIds == nil { + invalidParams.Add(request.NewErrParamRequired("SpotFleetRequestIds")) + } + if s.TerminateInstances == nil { + invalidParams.Add(request.NewErrParamRequired("TerminateInstances")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + // Contains the output of CancelSpotFleetRequests. type CancelSpotFleetRequestsOutput struct { _ struct{} `type:"structure"` @@ -8459,6 +13744,19 @@ func (s CancelSpotInstanceRequestsInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *CancelSpotInstanceRequestsInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "CancelSpotInstanceRequestsInput"} + if s.SpotInstanceRequestIds == nil { + invalidParams.Add(request.NewErrParamRequired("SpotInstanceRequestIds")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + // Contains the output of CancelSpotInstanceRequests. type CancelSpotInstanceRequestsOutput struct { _ struct{} `type:"structure"` @@ -8573,6 +13871,7 @@ func (s ClientData) GoString() string { return s.String() } +// Contains the parameters for ConfirmProductInstance. type ConfirmProductInstanceInput struct { _ struct{} `type:"structure"` @@ -8599,6 +13898,23 @@ func (s ConfirmProductInstanceInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *ConfirmProductInstanceInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "ConfirmProductInstanceInput"} + if s.InstanceId == nil { + invalidParams.Add(request.NewErrParamRequired("InstanceId")) + } + if s.ProductCode == nil { + invalidParams.Add(request.NewErrParamRequired("ProductCode")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// Contains the output of ConfirmProductInstance. type ConfirmProductInstanceOutput struct { _ struct{} `type:"structure"` @@ -8660,6 +13976,7 @@ func (s ConversionTask) GoString() string { return s.String() } +// Contains the parameters for CopyImage. type CopyImageInput struct { _ struct{} `type:"structure"` @@ -8714,6 +14031,26 @@ func (s CopyImageInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *CopyImageInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "CopyImageInput"} + if s.Name == nil { + invalidParams.Add(request.NewErrParamRequired("Name")) + } + if s.SourceImageId == nil { + invalidParams.Add(request.NewErrParamRequired("SourceImageId")) + } + if s.SourceRegion == nil { + invalidParams.Add(request.NewErrParamRequired("SourceRegion")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// Contains the output of CopyImage. type CopyImageOutput struct { _ struct{} `type:"structure"` @@ -8731,6 +14068,7 @@ func (s CopyImageOutput) GoString() string { return s.String() } +// Contains the parameters for CopySnapshot. type CopySnapshotInput struct { _ struct{} `type:"structure"` @@ -8741,7 +14079,7 @@ type CopySnapshotInput struct { // 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 + // 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). @@ -8753,13 +14091,13 @@ type CopySnapshotInput struct { // it is UnauthorizedOperation. DryRun *bool `locationName:"dryRun" type:"boolean"` - // Specifies whether the destination snapshot should be encrypted. There is - // no way to create an unencrypted snapshot copy from an encrypted snapshot; - // however, you can encrypt a copy of an unencrypted snapshot with this flag. - // The default CMK for EBS is used unless a non-default AWS Key Management Service - // (AWS KMS) CMK is specified with KmsKeyId. 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. + // Specifies whether the destination snapshot should be encrypted. You can encrypt + // a copy of an unencrypted snapshot using this flag, but you cannot use it + // to create an unencrypted copy from an encrypted snapshot. Your default CMK + // for EBS is used unless a non-default AWS Key Management Service (AWS KMS) + // CMK is specified with KmsKeyId. 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"` // The full ARN of the AWS Key Management Service (AWS KMS) CMK to use when @@ -8803,6 +14141,23 @@ func (s CopySnapshotInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *CopySnapshotInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "CopySnapshotInput"} + if s.SourceRegion == nil { + invalidParams.Add(request.NewErrParamRequired("SourceRegion")) + } + if s.SourceSnapshotId == nil { + invalidParams.Add(request.NewErrParamRequired("SourceSnapshotId")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// Contains the output of CopySnapshot. type CopySnapshotOutput struct { _ struct{} `type:"structure"` @@ -8820,6 +14175,7 @@ func (s CopySnapshotOutput) GoString() string { return s.String() } +// Contains the parameters for CreateCustomerGateway. type CreateCustomerGatewayInput struct { _ struct{} `type:"structure"` @@ -8852,6 +14208,26 @@ func (s CreateCustomerGatewayInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *CreateCustomerGatewayInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "CreateCustomerGatewayInput"} + if s.BgpAsn == nil { + invalidParams.Add(request.NewErrParamRequired("BgpAsn")) + } + if s.PublicIp == nil { + invalidParams.Add(request.NewErrParamRequired("PublicIp")) + } + if s.Type == nil { + invalidParams.Add(request.NewErrParamRequired("Type")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// Contains the output of CreateCustomerGateway. type CreateCustomerGatewayOutput struct { _ struct{} `type:"structure"` @@ -8869,6 +14245,7 @@ func (s CreateCustomerGatewayOutput) GoString() string { return s.String() } +// Contains the parameters for CreateDhcpOptions. type CreateDhcpOptionsInput struct { _ struct{} `type:"structure"` @@ -8892,6 +14269,20 @@ func (s CreateDhcpOptionsInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *CreateDhcpOptionsInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "CreateDhcpOptionsInput"} + if s.DhcpConfigurations == nil { + invalidParams.Add(request.NewErrParamRequired("DhcpConfigurations")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// Contains the output of CreateDhcpOptions. type CreateDhcpOptionsOutput struct { _ struct{} `type:"structure"` @@ -8909,6 +14300,7 @@ func (s CreateDhcpOptionsOutput) GoString() string { return s.String() } +// Contains the parameters for CreateFlowLogs. type CreateFlowLogsInput struct { _ struct{} `type:"structure"` @@ -8924,6 +14316,8 @@ type CreateFlowLogsInput struct { LogGroupName *string `type:"string" required:"true"` // One or more subnet, network interface, or VPC IDs. + // + // Constraints: Maximum of 1000 resources ResourceIds []*string `locationName:"ResourceId" locationNameList:"item" type:"list" required:"true"` // The type of resource on which to create the flow log. @@ -8943,6 +14337,32 @@ func (s CreateFlowLogsInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *CreateFlowLogsInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "CreateFlowLogsInput"} + if s.DeliverLogsPermissionArn == nil { + invalidParams.Add(request.NewErrParamRequired("DeliverLogsPermissionArn")) + } + if s.LogGroupName == nil { + invalidParams.Add(request.NewErrParamRequired("LogGroupName")) + } + if s.ResourceIds == nil { + invalidParams.Add(request.NewErrParamRequired("ResourceIds")) + } + if s.ResourceType == nil { + invalidParams.Add(request.NewErrParamRequired("ResourceType")) + } + if s.TrafficType == nil { + invalidParams.Add(request.NewErrParamRequired("TrafficType")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// Contains the output of CreateFlowLogs. type CreateFlowLogsOutput struct { _ struct{} `type:"structure"` @@ -8967,6 +14387,7 @@ func (s CreateFlowLogsOutput) GoString() string { return s.String() } +// Contains the parameters for CreateImage. type CreateImageInput struct { _ struct{} `type:"structure"` @@ -8992,11 +14413,10 @@ type CreateImageInput struct { // 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. + // By default, Amazon EC2 attempts to shut down and reboot the instance before + // creating the image. If the 'No Reboot' option is set, 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"` } @@ -9010,6 +14430,23 @@ func (s CreateImageInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *CreateImageInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "CreateImageInput"} + if s.InstanceId == nil { + invalidParams.Add(request.NewErrParamRequired("InstanceId")) + } + if s.Name == nil { + invalidParams.Add(request.NewErrParamRequired("Name")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// Contains the output of CreateImage. type CreateImageOutput struct { _ struct{} `type:"structure"` @@ -9027,6 +14464,7 @@ func (s CreateImageOutput) GoString() string { return s.String() } +// Contains the parameters for CreateInstanceExportTask. type CreateInstanceExportTaskInput struct { _ struct{} `type:"structure"` @@ -9054,6 +14492,20 @@ func (s CreateInstanceExportTaskInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *CreateInstanceExportTaskInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "CreateInstanceExportTaskInput"} + if s.InstanceId == nil { + invalidParams.Add(request.NewErrParamRequired("InstanceId")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// Contains the output for CreateInstanceExportTask. type CreateInstanceExportTaskOutput struct { _ struct{} `type:"structure"` @@ -9071,6 +14523,7 @@ func (s CreateInstanceExportTaskOutput) GoString() string { return s.String() } +// Contains the parameters for CreateInternetGateway. type CreateInternetGatewayInput struct { _ struct{} `type:"structure"` @@ -9091,6 +14544,7 @@ func (s CreateInternetGatewayInput) GoString() string { return s.String() } +// Contains the output of CreateInternetGateway. type CreateInternetGatewayOutput struct { _ struct{} `type:"structure"` @@ -9108,6 +14562,7 @@ func (s CreateInternetGatewayOutput) GoString() string { return s.String() } +// Contains the parameters for CreateKeyPair. type CreateKeyPairInput struct { _ struct{} `type:"structure"` @@ -9133,6 +14588,19 @@ func (s CreateKeyPairInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *CreateKeyPairInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "CreateKeyPairInput"} + if s.KeyName == nil { + invalidParams.Add(request.NewErrParamRequired("KeyName")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + // Describes a key pair. type CreateKeyPairOutput struct { _ struct{} `type:"structure"` @@ -9157,6 +14625,7 @@ func (s CreateKeyPairOutput) GoString() string { return s.String() } +// Contains the parameters for CreateNatGateway. type CreateNatGatewayInput struct { _ struct{} `type:"structure"` @@ -9185,6 +14654,23 @@ func (s CreateNatGatewayInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *CreateNatGatewayInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "CreateNatGatewayInput"} + if s.AllocationId == nil { + invalidParams.Add(request.NewErrParamRequired("AllocationId")) + } + if s.SubnetId == nil { + invalidParams.Add(request.NewErrParamRequired("SubnetId")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// Contains the output of CreateNatGateway. type CreateNatGatewayOutput struct { _ struct{} `type:"structure"` @@ -9206,6 +14692,7 @@ func (s CreateNatGatewayOutput) GoString() string { return s.String() } +// Contains the parameters for CreateNetworkAclEntry. type CreateNetworkAclEntryInput struct { _ struct{} `type:"structure"` @@ -9241,7 +14728,8 @@ type CreateNetworkAclEntryInput struct { // 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 + // Constraints: Positive integer from 1 to 32766. The range 32767 to 65535 + // is reserved for internal use. RuleNumber *int64 `locationName:"ruleNumber" type:"integer" required:"true"` } @@ -9255,6 +14743,34 @@ func (s CreateNetworkAclEntryInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *CreateNetworkAclEntryInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "CreateNetworkAclEntryInput"} + if s.CidrBlock == nil { + invalidParams.Add(request.NewErrParamRequired("CidrBlock")) + } + if s.Egress == nil { + invalidParams.Add(request.NewErrParamRequired("Egress")) + } + if s.NetworkAclId == nil { + invalidParams.Add(request.NewErrParamRequired("NetworkAclId")) + } + if s.Protocol == nil { + invalidParams.Add(request.NewErrParamRequired("Protocol")) + } + if s.RuleAction == nil { + invalidParams.Add(request.NewErrParamRequired("RuleAction")) + } + if s.RuleNumber == nil { + invalidParams.Add(request.NewErrParamRequired("RuleNumber")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + type CreateNetworkAclEntryOutput struct { _ struct{} `type:"structure"` } @@ -9269,6 +14785,7 @@ func (s CreateNetworkAclEntryOutput) GoString() string { return s.String() } +// Contains the parameters for CreateNetworkAcl. type CreateNetworkAclInput struct { _ struct{} `type:"structure"` @@ -9292,6 +14809,20 @@ func (s CreateNetworkAclInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *CreateNetworkAclInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "CreateNetworkAclInput"} + if s.VpcId == nil { + invalidParams.Add(request.NewErrParamRequired("VpcId")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// Contains the output of CreateNetworkAcl. type CreateNetworkAclOutput struct { _ struct{} `type:"structure"` @@ -9309,6 +14840,7 @@ func (s CreateNetworkAclOutput) GoString() string { return s.String() } +// Contains the parameters for CreateNetworkInterface. type CreateNetworkInterfaceInput struct { _ struct{} `type:"structure"` @@ -9358,6 +14890,30 @@ func (s CreateNetworkInterfaceInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *CreateNetworkInterfaceInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "CreateNetworkInterfaceInput"} + if s.SubnetId == nil { + invalidParams.Add(request.NewErrParamRequired("SubnetId")) + } + if s.PrivateIpAddresses != nil { + for i, v := range s.PrivateIpAddresses { + if v == nil { + continue + } + if err := v.Validate(); err != nil { + invalidParams.AddNested(fmt.Sprintf("%s[%v]", "PrivateIpAddresses", i), err.(request.ErrInvalidParams)) + } + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// Contains the output of CreateNetworkInterface. type CreateNetworkInterfaceOutput struct { _ struct{} `type:"structure"` @@ -9375,6 +14931,7 @@ func (s CreateNetworkInterfaceOutput) GoString() string { return s.String() } +// Contains the parameters for CreatePlacementGroup. type CreatePlacementGroupInput struct { _ struct{} `type:"structure"` @@ -9403,6 +14960,22 @@ func (s CreatePlacementGroupInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *CreatePlacementGroupInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "CreatePlacementGroupInput"} + if s.GroupName == nil { + invalidParams.Add(request.NewErrParamRequired("GroupName")) + } + if s.Strategy == nil { + invalidParams.Add(request.NewErrParamRequired("Strategy")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + type CreatePlacementGroupOutput struct { _ struct{} `type:"structure"` } @@ -9417,6 +14990,7 @@ func (s CreatePlacementGroupOutput) GoString() string { return s.String() } +// Contains the parameters for CreateReservedInstancesListing. type CreateReservedInstancesListingInput struct { _ struct{} `type:"structure"` @@ -9449,6 +15023,29 @@ func (s CreateReservedInstancesListingInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *CreateReservedInstancesListingInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "CreateReservedInstancesListingInput"} + if s.ClientToken == nil { + invalidParams.Add(request.NewErrParamRequired("ClientToken")) + } + if s.InstanceCount == nil { + invalidParams.Add(request.NewErrParamRequired("InstanceCount")) + } + if s.PriceSchedules == nil { + invalidParams.Add(request.NewErrParamRequired("PriceSchedules")) + } + if s.ReservedInstancesId == nil { + invalidParams.Add(request.NewErrParamRequired("ReservedInstancesId")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// Contains the output of CreateReservedInstancesListing. type CreateReservedInstancesListingOutput struct { _ struct{} `type:"structure"` @@ -9466,6 +15063,7 @@ func (s CreateReservedInstancesListingOutput) GoString() string { return s.String() } +// Contains the parameters for CreateRoute. type CreateRouteInput struct { _ struct{} `type:"structure"` @@ -9510,6 +15108,23 @@ func (s CreateRouteInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *CreateRouteInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "CreateRouteInput"} + if s.DestinationCidrBlock == nil { + invalidParams.Add(request.NewErrParamRequired("DestinationCidrBlock")) + } + if s.RouteTableId == nil { + invalidParams.Add(request.NewErrParamRequired("RouteTableId")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// Contains the output of CreateRoute. type CreateRouteOutput struct { _ struct{} `type:"structure"` @@ -9527,6 +15142,7 @@ func (s CreateRouteOutput) GoString() string { return s.String() } +// Contains the parameters for CreateRouteTable. type CreateRouteTableInput struct { _ struct{} `type:"structure"` @@ -9550,6 +15166,20 @@ func (s CreateRouteTableInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *CreateRouteTableInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "CreateRouteTableInput"} + if s.VpcId == nil { + invalidParams.Add(request.NewErrParamRequired("VpcId")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// Contains the output of CreateRouteTable. type CreateRouteTableOutput struct { _ struct{} `type:"structure"` @@ -9567,6 +15197,7 @@ func (s CreateRouteTableOutput) GoString() string { return s.String() } +// Contains the parameters for CreateSecurityGroup. type CreateSecurityGroupInput struct { _ struct{} `type:"structure"` @@ -9576,7 +15207,7 @@ type CreateSecurityGroupInput struct { // // Constraints for EC2-Classic: ASCII characters // - // Constraints for EC2-VPC: a-z, A-Z, 0-9, spaces, and ._-:/()#,@[]+=;{}!$* + // Constraints for EC2-VPC: a-z, A-Z, 0-9, spaces, and ._-:/()#,@[]+=&;{}!$* Description *string `locationName:"GroupDescription" type:"string" required:"true"` // Checks whether you have the required permissions for the action, without @@ -9591,7 +15222,7 @@ type CreateSecurityGroupInput struct { // // Constraints for EC2-Classic: ASCII characters // - // Constraints for EC2-VPC: a-z, A-Z, 0-9, spaces, and ._-:/()#,@[]+=;{}!$* + // 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. @@ -9608,6 +15239,23 @@ func (s CreateSecurityGroupInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *CreateSecurityGroupInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "CreateSecurityGroupInput"} + if s.Description == nil { + invalidParams.Add(request.NewErrParamRequired("Description")) + } + if s.GroupName == nil { + invalidParams.Add(request.NewErrParamRequired("GroupName")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// Contains the output of CreateSecurityGroup. type CreateSecurityGroupOutput struct { _ struct{} `type:"structure"` @@ -9625,6 +15273,7 @@ func (s CreateSecurityGroupOutput) GoString() string { return s.String() } +// Contains the parameters for CreateSnapshot. type CreateSnapshotInput struct { _ struct{} `type:"structure"` @@ -9651,6 +15300,19 @@ func (s CreateSnapshotInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *CreateSnapshotInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "CreateSnapshotInput"} + if s.VolumeId == nil { + invalidParams.Add(request.NewErrParamRequired("VolumeId")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + // Contains the parameters for CreateSpotDatafeedSubscription. type CreateSpotDatafeedSubscriptionInput struct { _ struct{} `type:"structure"` @@ -9678,6 +15340,19 @@ func (s CreateSpotDatafeedSubscriptionInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *CreateSpotDatafeedSubscriptionInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "CreateSpotDatafeedSubscriptionInput"} + if s.Bucket == nil { + invalidParams.Add(request.NewErrParamRequired("Bucket")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + // Contains the output of CreateSpotDatafeedSubscription. type CreateSpotDatafeedSubscriptionOutput struct { _ struct{} `type:"structure"` @@ -9696,6 +15371,7 @@ func (s CreateSpotDatafeedSubscriptionOutput) GoString() string { return s.String() } +// Contains the parameters for CreateSubnet. type CreateSubnetInput struct { _ struct{} `type:"structure"` @@ -9728,6 +15404,23 @@ func (s CreateSubnetInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *CreateSubnetInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "CreateSubnetInput"} + if s.CidrBlock == nil { + invalidParams.Add(request.NewErrParamRequired("CidrBlock")) + } + if s.VpcId == nil { + invalidParams.Add(request.NewErrParamRequired("VpcId")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// Contains the output of CreateSubnet. type CreateSubnetOutput struct { _ struct{} `type:"structure"` @@ -9745,6 +15438,7 @@ func (s CreateSubnetOutput) GoString() string { return s.String() } +// Contains the parameters for CreateTags. type CreateTagsInput struct { _ struct{} `type:"structure"` @@ -9773,6 +15467,22 @@ func (s CreateTagsInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *CreateTagsInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "CreateTagsInput"} + if s.Resources == nil { + invalidParams.Add(request.NewErrParamRequired("Resources")) + } + if s.Tags == nil { + invalidParams.Add(request.NewErrParamRequired("Tags")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + type CreateTagsOutput struct { _ struct{} `type:"structure"` } @@ -9787,6 +15497,7 @@ func (s CreateTagsOutput) GoString() string { return s.String() } +// Contains the parameters for CreateVolume. type CreateVolumeInput struct { _ struct{} `type:"structure"` @@ -9809,11 +15520,11 @@ type CreateVolumeInput struct { // 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 + // 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 + // Constraint: Range is 100 to 20000 for Provisioned IOPS SSD volumes Iops *int64 `type:"integer"` // The full ARN of the AWS Key Management Service (AWS KMS) customer master @@ -9827,9 +15538,9 @@ type CreateVolumeInput struct { // 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. + // Constraints: 1-16384 for gp2, 4-16384 for io1, 500-16384 for st1, 500-16384 + // for sc1, and 1-1024 for standard. 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. @@ -9838,8 +15549,9 @@ type CreateVolumeInput struct { // The snapshot from which to create the volume. SnapshotId *string `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. + // The volume type. This can be gp2 for General Purpose SSD, io1 for Provisioned + // IOPS SSD, st1 for Throughput Optimized HDD, sc1 for Cold HDD, or standard + // for Magnetic volumes. // // Default: standard VolumeType *string `type:"string" enum:"VolumeType"` @@ -9855,6 +15567,19 @@ func (s CreateVolumeInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *CreateVolumeInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "CreateVolumeInput"} + if s.AvailabilityZone == nil { + invalidParams.Add(request.NewErrParamRequired("AvailabilityZone")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + // Describes the user or group to be added or removed from the permissions for // a volume. type CreateVolumePermission struct { @@ -9902,6 +15627,7 @@ func (s CreateVolumePermissionModifications) GoString() string { return s.String() } +// Contains the parameters for CreateVpcEndpoint. type CreateVpcEndpointInput struct { _ struct{} `type:"structure"` @@ -9923,7 +15649,7 @@ type CreateVpcEndpointInput struct { // One or more route table IDs. RouteTableIds []*string `locationName:"RouteTableId" locationNameList:"item" type:"list"` - // The AWS service name, in the form com.amazonaws.region.service. To get a + // The AWS service name, in the form com.amazonaws.region.service . To get a // list of available services, use the DescribeVpcEndpointServices request. ServiceName *string `type:"string" required:"true"` @@ -9941,6 +15667,23 @@ func (s CreateVpcEndpointInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *CreateVpcEndpointInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "CreateVpcEndpointInput"} + if s.ServiceName == nil { + invalidParams.Add(request.NewErrParamRequired("ServiceName")) + } + if s.VpcId == nil { + invalidParams.Add(request.NewErrParamRequired("VpcId")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// Contains the output of CreateVpcEndpoint. type CreateVpcEndpointOutput struct { _ struct{} `type:"structure"` @@ -9962,6 +15705,7 @@ func (s CreateVpcEndpointOutput) GoString() string { return s.String() } +// Contains the parameters for CreateVpc. type CreateVpcInput struct { _ struct{} `type:"structure"` @@ -9974,13 +15718,13 @@ type CreateVpcInput struct { // it is UnauthorizedOperation. 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. + // The tenancy options for instances launched into the VPC. For default, instances + // are launched with shared tenancy by default. You can launch instances with + // any tenancy into a shared tenancy VPC. For dedicated, instances are launched + // as dedicated tenancy instances by default. You can only launch instances + // with a tenancy of dedicated or host into a dedicated tenancy VPC. // - // Important: The host value cannot be used with this parameter. Use the default + // Important: The host value cannot be used with this parameter. Use the default // or dedicated values only. // // Default: default @@ -9997,6 +15741,20 @@ func (s CreateVpcInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *CreateVpcInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "CreateVpcInput"} + if s.CidrBlock == nil { + invalidParams.Add(request.NewErrParamRequired("CidrBlock")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// Contains the output of CreateVpc. type CreateVpcOutput struct { _ struct{} `type:"structure"` @@ -10014,6 +15772,7 @@ func (s CreateVpcOutput) GoString() string { return s.String() } +// Contains the parameters for CreateVpcPeeringConnection. type CreateVpcPeeringConnectionInput struct { _ struct{} `type:"structure"` @@ -10045,6 +15804,7 @@ func (s CreateVpcPeeringConnectionInput) GoString() string { return s.String() } +// Contains the output of CreateVpcPeeringConnection. type CreateVpcPeeringConnectionOutput struct { _ struct{} `type:"structure"` @@ -10062,6 +15822,7 @@ func (s CreateVpcPeeringConnectionOutput) GoString() string { return s.String() } +// Contains the parameters for CreateVpnConnection. type CreateVpnConnectionInput struct { _ struct{} `type:"structure"` @@ -10098,6 +15859,26 @@ func (s CreateVpnConnectionInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *CreateVpnConnectionInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "CreateVpnConnectionInput"} + if s.CustomerGatewayId == nil { + invalidParams.Add(request.NewErrParamRequired("CustomerGatewayId")) + } + if s.Type == nil { + invalidParams.Add(request.NewErrParamRequired("Type")) + } + if s.VpnGatewayId == nil { + invalidParams.Add(request.NewErrParamRequired("VpnGatewayId")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// Contains the output of CreateVpnConnection. type CreateVpnConnectionOutput struct { _ struct{} `type:"structure"` @@ -10115,6 +15896,7 @@ func (s CreateVpnConnectionOutput) GoString() string { return s.String() } +// Contains the parameters for CreateVpnConnectionRoute. type CreateVpnConnectionRouteInput struct { _ struct{} `type:"structure"` @@ -10135,6 +15917,22 @@ func (s CreateVpnConnectionRouteInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *CreateVpnConnectionRouteInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "CreateVpnConnectionRouteInput"} + if s.DestinationCidrBlock == nil { + invalidParams.Add(request.NewErrParamRequired("DestinationCidrBlock")) + } + if s.VpnConnectionId == nil { + invalidParams.Add(request.NewErrParamRequired("VpnConnectionId")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + type CreateVpnConnectionRouteOutput struct { _ struct{} `type:"structure"` } @@ -10149,6 +15947,7 @@ func (s CreateVpnConnectionRouteOutput) GoString() string { return s.String() } +// Contains the parameters for CreateVpnGateway. type CreateVpnGatewayInput struct { _ struct{} `type:"structure"` @@ -10175,6 +15974,20 @@ func (s CreateVpnGatewayInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *CreateVpnGatewayInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "CreateVpnGatewayInput"} + if s.Type == nil { + invalidParams.Add(request.NewErrParamRequired("Type")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// Contains the output of CreateVpnGateway. type CreateVpnGatewayOutput struct { _ struct{} `type:"structure"` @@ -10227,6 +16040,7 @@ func (s CustomerGateway) GoString() string { return s.String() } +// Contains the parameters for DeleteCustomerGateway. type DeleteCustomerGatewayInput struct { _ struct{} `type:"structure"` @@ -10250,6 +16064,19 @@ func (s DeleteCustomerGatewayInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *DeleteCustomerGatewayInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DeleteCustomerGatewayInput"} + if s.CustomerGatewayId == nil { + invalidParams.Add(request.NewErrParamRequired("CustomerGatewayId")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + type DeleteCustomerGatewayOutput struct { _ struct{} `type:"structure"` } @@ -10264,6 +16091,7 @@ func (s DeleteCustomerGatewayOutput) GoString() string { return s.String() } +// Contains the parameters for DeleteDhcpOptions. type DeleteDhcpOptionsInput struct { _ struct{} `type:"structure"` @@ -10287,6 +16115,19 @@ func (s DeleteDhcpOptionsInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *DeleteDhcpOptionsInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DeleteDhcpOptionsInput"} + if s.DhcpOptionsId == nil { + invalidParams.Add(request.NewErrParamRequired("DhcpOptionsId")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + type DeleteDhcpOptionsOutput struct { _ struct{} `type:"structure"` } @@ -10301,6 +16142,7 @@ func (s DeleteDhcpOptionsOutput) GoString() string { return s.String() } +// Contains the parameters for DeleteFlowLogs. type DeleteFlowLogsInput struct { _ struct{} `type:"structure"` @@ -10318,6 +16160,20 @@ func (s DeleteFlowLogsInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *DeleteFlowLogsInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DeleteFlowLogsInput"} + if s.FlowLogIds == nil { + invalidParams.Add(request.NewErrParamRequired("FlowLogIds")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// Contains the output of DeleteFlowLogs. type DeleteFlowLogsOutput struct { _ struct{} `type:"structure"` @@ -10335,6 +16191,7 @@ func (s DeleteFlowLogsOutput) GoString() string { return s.String() } +// Contains the parameters for DeleteInternetGateway. type DeleteInternetGatewayInput struct { _ struct{} `type:"structure"` @@ -10358,6 +16215,19 @@ func (s DeleteInternetGatewayInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *DeleteInternetGatewayInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DeleteInternetGatewayInput"} + if s.InternetGatewayId == nil { + invalidParams.Add(request.NewErrParamRequired("InternetGatewayId")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + type DeleteInternetGatewayOutput struct { _ struct{} `type:"structure"` } @@ -10372,6 +16242,7 @@ func (s DeleteInternetGatewayOutput) GoString() string { return s.String() } +// Contains the parameters for DeleteKeyPair. type DeleteKeyPairInput struct { _ struct{} `type:"structure"` @@ -10395,6 +16266,19 @@ func (s DeleteKeyPairInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *DeleteKeyPairInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DeleteKeyPairInput"} + if s.KeyName == nil { + invalidParams.Add(request.NewErrParamRequired("KeyName")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + type DeleteKeyPairOutput struct { _ struct{} `type:"structure"` } @@ -10409,6 +16293,7 @@ func (s DeleteKeyPairOutput) GoString() string { return s.String() } +// Contains the parameters for DeleteNatGateway. type DeleteNatGatewayInput struct { _ struct{} `type:"structure"` @@ -10426,6 +16311,20 @@ func (s DeleteNatGatewayInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *DeleteNatGatewayInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DeleteNatGatewayInput"} + if s.NatGatewayId == nil { + invalidParams.Add(request.NewErrParamRequired("NatGatewayId")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// Contains the output of DeleteNatGateway. type DeleteNatGatewayOutput struct { _ struct{} `type:"structure"` @@ -10443,6 +16342,7 @@ func (s DeleteNatGatewayOutput) GoString() string { return s.String() } +// Contains the parameters for DeleteNetworkAclEntry. type DeleteNetworkAclEntryInput struct { _ struct{} `type:"structure"` @@ -10472,6 +16372,25 @@ func (s DeleteNetworkAclEntryInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *DeleteNetworkAclEntryInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DeleteNetworkAclEntryInput"} + if s.Egress == nil { + invalidParams.Add(request.NewErrParamRequired("Egress")) + } + if s.NetworkAclId == nil { + invalidParams.Add(request.NewErrParamRequired("NetworkAclId")) + } + if s.RuleNumber == nil { + invalidParams.Add(request.NewErrParamRequired("RuleNumber")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + type DeleteNetworkAclEntryOutput struct { _ struct{} `type:"structure"` } @@ -10486,6 +16405,7 @@ func (s DeleteNetworkAclEntryOutput) GoString() string { return s.String() } +// Contains the parameters for DeleteNetworkAcl. type DeleteNetworkAclInput struct { _ struct{} `type:"structure"` @@ -10509,6 +16429,19 @@ func (s DeleteNetworkAclInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *DeleteNetworkAclInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DeleteNetworkAclInput"} + if s.NetworkAclId == nil { + invalidParams.Add(request.NewErrParamRequired("NetworkAclId")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + type DeleteNetworkAclOutput struct { _ struct{} `type:"structure"` } @@ -10523,6 +16456,7 @@ func (s DeleteNetworkAclOutput) GoString() string { return s.String() } +// Contains the parameters for DeleteNetworkInterface. type DeleteNetworkInterfaceInput struct { _ struct{} `type:"structure"` @@ -10546,6 +16480,19 @@ func (s DeleteNetworkInterfaceInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *DeleteNetworkInterfaceInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DeleteNetworkInterfaceInput"} + if s.NetworkInterfaceId == nil { + invalidParams.Add(request.NewErrParamRequired("NetworkInterfaceId")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + type DeleteNetworkInterfaceOutput struct { _ struct{} `type:"structure"` } @@ -10560,6 +16507,7 @@ func (s DeleteNetworkInterfaceOutput) GoString() string { return s.String() } +// Contains the parameters for DeletePlacementGroup. type DeletePlacementGroupInput struct { _ struct{} `type:"structure"` @@ -10583,6 +16531,19 @@ func (s DeletePlacementGroupInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *DeletePlacementGroupInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DeletePlacementGroupInput"} + if s.GroupName == nil { + invalidParams.Add(request.NewErrParamRequired("GroupName")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + type DeletePlacementGroupOutput struct { _ struct{} `type:"structure"` } @@ -10597,6 +16558,7 @@ func (s DeletePlacementGroupOutput) GoString() string { return s.String() } +// Contains the parameters for DeleteRoute. type DeleteRouteInput struct { _ struct{} `type:"structure"` @@ -10624,6 +16586,22 @@ func (s DeleteRouteInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *DeleteRouteInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DeleteRouteInput"} + if s.DestinationCidrBlock == nil { + invalidParams.Add(request.NewErrParamRequired("DestinationCidrBlock")) + } + if s.RouteTableId == nil { + invalidParams.Add(request.NewErrParamRequired("RouteTableId")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + type DeleteRouteOutput struct { _ struct{} `type:"structure"` } @@ -10638,6 +16616,7 @@ func (s DeleteRouteOutput) GoString() string { return s.String() } +// Contains the parameters for DeleteRouteTable. type DeleteRouteTableInput struct { _ struct{} `type:"structure"` @@ -10661,6 +16640,19 @@ func (s DeleteRouteTableInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *DeleteRouteTableInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DeleteRouteTableInput"} + if s.RouteTableId == nil { + invalidParams.Add(request.NewErrParamRequired("RouteTableId")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + type DeleteRouteTableOutput struct { _ struct{} `type:"structure"` } @@ -10675,6 +16667,7 @@ func (s DeleteRouteTableOutput) GoString() string { return s.String() } +// Contains the parameters for DeleteSecurityGroup. type DeleteSecurityGroupInput struct { _ struct{} `type:"structure"` @@ -10716,6 +16709,7 @@ func (s DeleteSecurityGroupOutput) GoString() string { return s.String() } +// Contains the parameters for DeleteSnapshot. type DeleteSnapshotInput struct { _ struct{} `type:"structure"` @@ -10739,6 +16733,19 @@ func (s DeleteSnapshotInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *DeleteSnapshotInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DeleteSnapshotInput"} + if s.SnapshotId == nil { + invalidParams.Add(request.NewErrParamRequired("SnapshotId")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + type DeleteSnapshotOutput struct { _ struct{} `type:"structure"` } @@ -10788,6 +16795,7 @@ func (s DeleteSpotDatafeedSubscriptionOutput) GoString() string { return s.String() } +// Contains the parameters for DeleteSubnet. type DeleteSubnetInput struct { _ struct{} `type:"structure"` @@ -10811,6 +16819,19 @@ func (s DeleteSubnetInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *DeleteSubnetInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DeleteSubnetInput"} + if s.SubnetId == nil { + invalidParams.Add(request.NewErrParamRequired("SubnetId")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + type DeleteSubnetOutput struct { _ struct{} `type:"structure"` } @@ -10825,6 +16846,7 @@ func (s DeleteSubnetOutput) GoString() string { return s.String() } +// Contains the parameters for DeleteTags. type DeleteTagsInput struct { _ struct{} `type:"structure"` @@ -10854,6 +16876,19 @@ func (s DeleteTagsInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *DeleteTagsInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DeleteTagsInput"} + if s.Resources == nil { + invalidParams.Add(request.NewErrParamRequired("Resources")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + type DeleteTagsOutput struct { _ struct{} `type:"structure"` } @@ -10868,6 +16903,7 @@ func (s DeleteTagsOutput) GoString() string { return s.String() } +// Contains the parameters for DeleteVolume. type DeleteVolumeInput struct { _ struct{} `type:"structure"` @@ -10891,6 +16927,19 @@ func (s DeleteVolumeInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *DeleteVolumeInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DeleteVolumeInput"} + if s.VolumeId == nil { + invalidParams.Add(request.NewErrParamRequired("VolumeId")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + type DeleteVolumeOutput struct { _ struct{} `type:"structure"` } @@ -10905,6 +16954,7 @@ func (s DeleteVolumeOutput) GoString() string { return s.String() } +// Contains the parameters for DeleteVpcEndpoints. type DeleteVpcEndpointsInput struct { _ struct{} `type:"structure"` @@ -10928,6 +16978,20 @@ func (s DeleteVpcEndpointsInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *DeleteVpcEndpointsInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DeleteVpcEndpointsInput"} + if s.VpcEndpointIds == nil { + invalidParams.Add(request.NewErrParamRequired("VpcEndpointIds")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// Contains the output of DeleteVpcEndpoints. type DeleteVpcEndpointsOutput struct { _ struct{} `type:"structure"` @@ -10945,6 +17009,7 @@ func (s DeleteVpcEndpointsOutput) GoString() string { return s.String() } +// Contains the parameters for DeleteVpc. type DeleteVpcInput struct { _ struct{} `type:"structure"` @@ -10968,6 +17033,19 @@ func (s DeleteVpcInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *DeleteVpcInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DeleteVpcInput"} + if s.VpcId == nil { + invalidParams.Add(request.NewErrParamRequired("VpcId")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + type DeleteVpcOutput struct { _ struct{} `type:"structure"` } @@ -10982,6 +17060,7 @@ func (s DeleteVpcOutput) GoString() string { return s.String() } +// Contains the parameters for DeleteVpcPeeringConnection. type DeleteVpcPeeringConnectionInput struct { _ struct{} `type:"structure"` @@ -11005,6 +17084,20 @@ func (s DeleteVpcPeeringConnectionInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *DeleteVpcPeeringConnectionInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DeleteVpcPeeringConnectionInput"} + if s.VpcPeeringConnectionId == nil { + invalidParams.Add(request.NewErrParamRequired("VpcPeeringConnectionId")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// Contains the output of DeleteVpcPeeringConnection. type DeleteVpcPeeringConnectionOutput struct { _ struct{} `type:"structure"` @@ -11022,6 +17115,7 @@ func (s DeleteVpcPeeringConnectionOutput) GoString() string { return s.String() } +// Contains the parameters for DeleteVpnConnection. type DeleteVpnConnectionInput struct { _ struct{} `type:"structure"` @@ -11045,6 +17139,19 @@ func (s DeleteVpnConnectionInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *DeleteVpnConnectionInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DeleteVpnConnectionInput"} + if s.VpnConnectionId == nil { + invalidParams.Add(request.NewErrParamRequired("VpnConnectionId")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + type DeleteVpnConnectionOutput struct { _ struct{} `type:"structure"` } @@ -11059,6 +17166,7 @@ func (s DeleteVpnConnectionOutput) GoString() string { return s.String() } +// Contains the parameters for DeleteVpnConnectionRoute. type DeleteVpnConnectionRouteInput struct { _ struct{} `type:"structure"` @@ -11079,6 +17187,22 @@ func (s DeleteVpnConnectionRouteInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *DeleteVpnConnectionRouteInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DeleteVpnConnectionRouteInput"} + if s.DestinationCidrBlock == nil { + invalidParams.Add(request.NewErrParamRequired("DestinationCidrBlock")) + } + if s.VpnConnectionId == nil { + invalidParams.Add(request.NewErrParamRequired("VpnConnectionId")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + type DeleteVpnConnectionRouteOutput struct { _ struct{} `type:"structure"` } @@ -11093,6 +17217,7 @@ func (s DeleteVpnConnectionRouteOutput) GoString() string { return s.String() } +// Contains the parameters for DeleteVpnGateway. type DeleteVpnGatewayInput struct { _ struct{} `type:"structure"` @@ -11116,6 +17241,19 @@ func (s DeleteVpnGatewayInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *DeleteVpnGatewayInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DeleteVpnGatewayInput"} + if s.VpnGatewayId == nil { + invalidParams.Add(request.NewErrParamRequired("VpnGatewayId")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + type DeleteVpnGatewayOutput struct { _ struct{} `type:"structure"` } @@ -11130,6 +17268,7 @@ func (s DeleteVpnGatewayOutput) GoString() string { return s.String() } +// Contains the parameters for DeregisterImage. type DeregisterImageInput struct { _ struct{} `type:"structure"` @@ -11153,6 +17292,19 @@ func (s DeregisterImageInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *DeregisterImageInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DeregisterImageInput"} + if s.ImageId == nil { + invalidParams.Add(request.NewErrParamRequired("ImageId")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + type DeregisterImageOutput struct { _ struct{} `type:"structure"` } @@ -11167,6 +17319,7 @@ func (s DeregisterImageOutput) GoString() string { return s.String() } +// Contains the parameters for DescribeAccountAttributes. type DescribeAccountAttributesInput struct { _ struct{} `type:"structure"` @@ -11190,6 +17343,7 @@ func (s DescribeAccountAttributesInput) GoString() string { return s.String() } +// Contains the output of DescribeAccountAttributes. type DescribeAccountAttributesOutput struct { _ struct{} `type:"structure"` @@ -11207,6 +17361,7 @@ func (s DescribeAccountAttributesOutput) GoString() string { return s.String() } +// Contains the parameters for DescribeAddresses. type DescribeAddressesInput struct { _ struct{} `type:"structure"` @@ -11223,25 +17378,25 @@ type DescribeAddressesInput struct { // One or more filters. Filter names and values are case-sensitive. // - // allocation-id - [EC2-VPC] The allocation ID for the address. + // allocation-id - [EC2-VPC] The allocation ID for the address. // - // association-id - [EC2-VPC] The association 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) + // 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. + // 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 + // 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. + // network-interface-owner-id - The AWS account ID of the owner. // - // private-ip-address - [EC2-VPC] The private IP address associated with + // private-ip-address - [EC2-VPC] The private IP address associated with // the Elastic IP address. // - // public-ip - 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. @@ -11260,6 +17415,7 @@ func (s DescribeAddressesInput) GoString() string { return s.String() } +// Contains the output of DescribeAddresses. type DescribeAddressesOutput struct { _ struct{} `type:"structure"` @@ -11277,6 +17433,7 @@ func (s DescribeAddressesOutput) GoString() string { return s.String() } +// Contains the parameters for DescribeAvailabilityZones. type DescribeAvailabilityZonesInput struct { _ struct{} `type:"structure"` @@ -11288,15 +17445,15 @@ type DescribeAvailabilityZonesInput struct { // One or more filters. // - // message - Information about the Availability Zone. + // message - Information about the Availability Zone. // - // region-name - The name of the region for the Availability Zone (for example, + // region-name - The name of the region for the Availability Zone (for example, // us-east-1). // - // state - The state of the Availability Zone (available | information | + // state - The state of the Availability Zone (available | information | // impaired | unavailable). // - // zone-name - The name of the Availability Zone (for example, us-east-1a). + // 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. @@ -11313,6 +17470,7 @@ func (s DescribeAvailabilityZonesInput) GoString() string { return s.String() } +// Contains the output of DescribeAvailabiltyZones. type DescribeAvailabilityZonesOutput struct { _ struct{} `type:"structure"` @@ -11330,6 +17488,7 @@ func (s DescribeAvailabilityZonesOutput) GoString() string { return s.String() } +// Contains the parameters for DescribeBundleTasks. type DescribeBundleTasksInput struct { _ struct{} `type:"structure"` @@ -11346,27 +17505,27 @@ type DescribeBundleTasksInput struct { // One or more filters. // - // bundle-id - The ID of the bundle task. + // bundle-id - The ID of the bundle task. // - // error-code - If the task failed, the error code returned. + // error-code - If the task failed, the error code returned. // - // error-message - If the task failed, the error message returned. + // error-message - If the task failed, the error message returned. // - // instance-id - The ID of the instance. + // instance-id - The ID of the instance. // - // progress - The level of task completion, as a percentage (for example, + // progress - The level of task completion, as a percentage (for example, // 20%). // - // s3-bucket - The Amazon S3 bucket to store the AMI. + // s3-bucket - The Amazon S3 bucket to store the AMI. // - // s3-prefix - The beginning of the AMI name. + // s3-prefix - The beginning of the AMI name. // - // start-time - The time the task started (for example, 2013-09-15T17:15:20.000Z). + // 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 + // 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. + // update-time - The time of the most recent update for the task. Filters []*Filter `locationName:"Filter" locationNameList:"Filter" type:"list"` } @@ -11380,6 +17539,7 @@ func (s DescribeBundleTasksInput) GoString() string { return s.String() } +// Contains the output of DescribeBundleTasks. type DescribeBundleTasksOutput struct { _ struct{} `type:"structure"` @@ -11397,6 +17557,7 @@ func (s DescribeBundleTasksOutput) GoString() string { return s.String() } +// Contains the parameters for DescribeClassicLinkInstances. type DescribeClassicLinkInstancesInput struct { _ struct{} `type:"structure"` @@ -11408,23 +17569,24 @@ type DescribeClassicLinkInstancesInput struct { // One or more filters. // - // group-id - The ID of a VPC security group that's associated with the instance. + // group-id - The ID of a VPC security group that's associated with the + // instance. // - // instance-id - The ID of 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=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 + // 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. + // 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. + // 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. @@ -11454,6 +17616,7 @@ func (s DescribeClassicLinkInstancesInput) GoString() string { return s.String() } +// Contains the output of DescribeClassicLinkInstances. type DescribeClassicLinkInstancesOutput struct { _ struct{} `type:"structure"` @@ -11475,6 +17638,7 @@ func (s DescribeClassicLinkInstancesOutput) GoString() string { return s.String() } +// Contains the parameters for DescribeConversionTasks. type DescribeConversionTasksInput struct { _ struct{} `type:"structure"` @@ -11501,6 +17665,7 @@ func (s DescribeConversionTasksInput) GoString() string { return s.String() } +// Contains the output for DescribeConversionTasks. type DescribeConversionTasksOutput struct { _ struct{} `type:"structure"` @@ -11518,6 +17683,7 @@ func (s DescribeConversionTasksOutput) GoString() string { return s.String() } +// Contains the parameters for DescribeCustomerGateways. type DescribeCustomerGatewaysInput struct { _ struct{} `type:"structure"` @@ -11534,31 +17700,31 @@ type DescribeCustomerGatewaysInput struct { // One or more filters. // - // bgp-asn - The customer gateway's Border Gateway Protocol (BGP) Autonomous + // bgp-asn - The customer gateway's Border Gateway Protocol (BGP) Autonomous // System Number (ASN). // - // customer-gateway-id - The ID of the customer gateway. + // customer-gateway-id - The ID of the customer gateway. // - // ip-address - The IP address of the customer gateway's Internet-routable + // ip-address - The IP address of the customer gateway's Internet-routable // external interface. // - // state - The state of the customer gateway (pending | available | deleting + // state - The state of the customer gateway (pending | available | deleting // | deleted). // - // type - The type of customer gateway. Currently, the only supported type + // 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=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 + // 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. + // 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"` } @@ -11572,6 +17738,7 @@ func (s DescribeCustomerGatewaysInput) GoString() string { return s.String() } +// Contains the output of DescribeCustomerGateways. type DescribeCustomerGatewaysOutput struct { _ struct{} `type:"structure"` @@ -11589,6 +17756,7 @@ func (s DescribeCustomerGatewaysOutput) GoString() string { return s.String() } +// Contains the parameters for DescribeDhcpOptions. type DescribeDhcpOptionsInput struct { _ struct{} `type:"structure"` @@ -11605,23 +17773,23 @@ type DescribeDhcpOptionsInput struct { // One or more filters. // - // dhcp-options-id - The ID of a set of DHCP options. + // dhcp-options-id - The ID of a set of DHCP options. // - // key - The key for one of the options (for example, domain-name). + // key - The key for one of the options (for example, domain-name). // - // value - The value for one of the options. + // value - The value for one of the options. // - // tag:key=value - The key/value combination of a tag assigned to the resource. + // 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 + // 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. + // 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"` } @@ -11635,6 +17803,7 @@ func (s DescribeDhcpOptionsInput) GoString() string { return s.String() } +// Contains the output of DescribeDhcpOptions. type DescribeDhcpOptionsOutput struct { _ struct{} `type:"structure"` @@ -11652,6 +17821,7 @@ func (s DescribeDhcpOptionsOutput) GoString() string { return s.String() } +// Contains the parameters for DescribeExportTasks. type DescribeExportTasksInput struct { _ struct{} `type:"structure"` @@ -11669,6 +17839,7 @@ func (s DescribeExportTasksInput) GoString() string { return s.String() } +// Contains the output for DescribeExportTasks. type DescribeExportTasksOutput struct { _ struct{} `type:"structure"` @@ -11686,20 +17857,21 @@ func (s DescribeExportTasksOutput) GoString() string { return s.String() } +// Contains the parameters for DescribeFlowLogs. type DescribeFlowLogsInput struct { _ struct{} `type:"structure"` // One or more filters. // - // deliver-log-status - The status of the logs delivery (SUCCESS | FAILED). + // deliver-log-status - The status of the logs delivery (SUCCESS | FAILED). // - // flow-log-id - The ID of the flow log. + // flow-log-id - The ID of the flow log. // - // log-group-name - The name of the log group. + // log-group-name - The name of the log group. // - // resource-id - The ID of the VPC, subnet, or network interface. + // resource-id - The ID of the VPC, subnet, or network interface. // - // traffic-type - The type of traffic (ACCEPT | REJECT | ALL) + // traffic-type - The type of traffic (ACCEPT | REJECT | ALL) Filter []*Filter `locationNameList:"Filter" type:"list"` // One or more flow log IDs. @@ -11726,6 +17898,7 @@ func (s DescribeFlowLogsInput) GoString() string { return s.String() } +// Contains the output of DescribeFlowLogs. type DescribeFlowLogsOutput struct { _ struct{} `type:"structure"` @@ -11747,28 +17920,157 @@ func (s DescribeFlowLogsOutput) GoString() string { return s.String() } +type DescribeHostReservationOfferingsInput struct { + _ struct{} `type:"structure"` + + // One or more filters. + // + // instance-family - The instance family of the offering (e.g., m4). + // + // payment-option - The payment option (No Upfront | Partial Upfront | All + // Upfront). + Filter []*Filter `locationNameList:"Filter" type:"list"` + + // This is the maximum duration of the reservation you'd like to purchase, specified + // in seconds.Reservations are available in 1, 3, and 5 year terms. The number + // of seconds specified must be the number of seconds in a year (365x24x60x60) + // times one of the supported durations (1, 3, or 5). For example, specify 157680000 + // for 5 years. + MaxDuration *int64 `type:"integer"` + + // The maximum number of results to return for the request in a single page. + // The remaining results can be seen by sending another request with the returned + // nextToken value. This value can be between 5 and 500; if maxResults is given + // a larger value than 500, you will receive an error. + MaxResults *int64 `type:"integer"` + + // This is the minimum duration of the reservation you'd like to purchase, specified + // in seconds. Reservations are available in 1, 3, and 5 year terms. The number + // of seconds specified must be the number of seconds in a year (365x24x60x60) + // times one of the supported durations (1, 3, or 5). For example, specify 94608000 + // for 3 years. + MinDuration *int64 `type:"integer"` + + // The token to use to retrieve the next page of results. + NextToken *string `type:"string"` + + // The ID of the reservation offering. + OfferingId *string `type:"string"` +} + +// String returns the string representation +func (s DescribeHostReservationOfferingsInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DescribeHostReservationOfferingsInput) GoString() string { + return s.String() +} + +type DescribeHostReservationOfferingsOutput struct { + _ struct{} `type:"structure"` + + // 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"` + + // Information about the offerings. + OfferingSet []*HostOffering `locationName:"offeringSet" type:"list"` +} + +// String returns the string representation +func (s DescribeHostReservationOfferingsOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DescribeHostReservationOfferingsOutput) GoString() string { + return s.String() +} + +type DescribeHostReservationsInput struct { + _ struct{} `type:"structure"` + + // One or more filters. + // + // instance-family - The instance family (e.g., m4). + // + // payment-option - The payment option (No Upfront | Partial Upfront | All + // Upfront). + // + // state - The state of the reservation (payment-pending | payment-failed + // | active | retired). + Filter []*Filter `locationNameList:"Filter" type:"list"` + + // One or more host reservation IDs. + HostReservationIdSet []*string `locationNameList:"item" type:"list"` + + // The maximum number of results to return for the request in a single page. + // The remaining results can be seen by sending another request with the returned + // nextToken value. This value can be between 5 and 500; if maxResults is given + // a larger value than 500, you will receive an error. + MaxResults *int64 `type:"integer"` + + // The token to use to retrieve the next page of results. + NextToken *string `type:"string"` +} + +// String returns the string representation +func (s DescribeHostReservationsInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DescribeHostReservationsInput) GoString() string { + return s.String() +} + +type DescribeHostReservationsOutput struct { + _ struct{} `type:"structure"` + + // Details about the reservation's configuration. + HostReservationSet []*HostReservation `locationName:"hostReservationSet" 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"` +} + +// String returns the string representation +func (s DescribeHostReservationsOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DescribeHostReservationsOutput) GoString() string { + return s.String() +} + +// Contains the parameters for DescribeHosts. type DescribeHostsInput struct { _ struct{} `type:"structure"` // One or more filters. // - // instance-type - The instance type size that the Dedicated host is configured + // instance-type - The instance type size that the Dedicated Host is configured // to support. // - // auto-placement - Whether auto-placement is enabled or disabled (on | off). + // auto-placement - Whether auto-placement is enabled or disabled (on | + // off). // - // host-reservation-id - The ID of the reservation associated with this host. + // host-reservation-id - The ID of the reservation assigned to this host. // - // client-token - The idempotency token you provided when you launched the + // client-token - The idempotency token you provided when you launched the // instance // - // state- The allocation state of the Dedicated host (available | under-assessment + // state- The allocation state of the Dedicated Host (available | under-assessment // | permanent-failure | released | released-permanent-failure). // - // availability-zone - The Availability Zone of the host. + // availability-zone - The Availability Zone of the host. Filter []*Filter `locationName:"filter" locationNameList:"Filter" type:"list"` - // The IDs of the Dedicated hosts. The IDs are used for targeted instance launches. + // The IDs of the Dedicated Hosts. The IDs are used for targeted instance launches. HostIds []*string `locationName:"hostId" locationNameList:"item" type:"list"` // The maximum number of results to return for the request in a single page. @@ -11792,10 +18094,11 @@ func (s DescribeHostsInput) GoString() string { return s.String() } +// Contains the output of DescribeHosts. type DescribeHostsOutput struct { _ struct{} `type:"structure"` - // Information about the Dedicated hosts. + // Information about the Dedicated Hosts. Hosts []*Host `locationName:"hostSet" locationNameList:"item" type:"list"` // The token to use to retrieve the next page of results. This value is null @@ -11813,10 +18116,11 @@ func (s DescribeHostsOutput) GoString() string { return s.String() } +// Contains the parameters for DescribeIdFormat. type DescribeIdFormatInput struct { _ struct{} `type:"structure"` - // The type of resource. + // The type of resource: instance | reservation | snapshot | volume Resource *string `type:"string"` } @@ -11830,6 +18134,7 @@ func (s DescribeIdFormatInput) GoString() string { return s.String() } +// Contains the output of DescribeIdFormat. type DescribeIdFormatOutput struct { _ struct{} `type:"structure"` @@ -11847,12 +18152,66 @@ func (s DescribeIdFormatOutput) GoString() string { return s.String() } +// Contains the parameters for DescribeIdentityIdFormat. +type DescribeIdentityIdFormatInput struct { + _ struct{} `type:"structure"` + + // The ARN of the principal, which can be an IAM role, IAM user, or the root + // user. + PrincipalArn *string `locationName:"principalArn" type:"string" required:"true"` + + // The type of resource: instance | reservation | snapshot | volume + Resource *string `locationName:"resource" type:"string"` +} + +// String returns the string representation +func (s DescribeIdentityIdFormatInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DescribeIdentityIdFormatInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *DescribeIdentityIdFormatInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DescribeIdentityIdFormatInput"} + if s.PrincipalArn == nil { + invalidParams.Add(request.NewErrParamRequired("PrincipalArn")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// Contains the output of DescribeIdentityIdFormat. +type DescribeIdentityIdFormatOutput struct { + _ struct{} `type:"structure"` + + // Information about the ID format for the resources. + Statuses []*IdFormat `locationName:"statusSet" locationNameList:"item" type:"list"` +} + +// String returns the string representation +func (s DescribeIdentityIdFormatOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DescribeIdentityIdFormatOutput) GoString() string { + return s.String() +} + +// Contains the parameters for DescribeImageAttribute. type DescribeImageAttributeInput struct { _ struct{} `type:"structure"` // The AMI attribute. // - // Note: Depending on your account privileges, the blockDeviceMapping 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" enum:"ImageAttributeName"` @@ -11877,6 +18236,22 @@ func (s DescribeImageAttributeInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *DescribeImageAttributeInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DescribeImageAttributeInput"} + if s.Attribute == nil { + invalidParams.Add(request.NewErrParamRequired("Attribute")) + } + if s.ImageId == nil { + invalidParams.Add(request.NewErrParamRequired("ImageId")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + // Describes an image attribute. type DescribeImageAttributeOutput struct { _ struct{} `type:"structure"` @@ -11902,7 +18277,8 @@ type DescribeImageAttributeOutput struct { // The RAM disk ID. RamdiskId *AttributeValue `locationName:"ramdisk" type:"structure"` - // The value to use for a resource attribute. + // Indicates whether enhanced networking with the Intel 82599 Virtual Function + // interface is enabled. SriovNetSupport *AttributeValue `locationName:"sriovNetSupport" type:"structure"` } @@ -11916,6 +18292,7 @@ func (s DescribeImageAttributeOutput) GoString() string { return s.String() } +// Contains the parameters for DescribeImages. type DescribeImagesInput struct { _ struct{} `type:"structure"` @@ -11931,74 +18308,76 @@ type DescribeImagesInput struct { // One or more filters. // - // architecture - The image architecture (i386 | x86_64). + // architecture - The image architecture (i386 | x86_64). // - // block-device-mapping.delete-on-termination - A Boolean value that indicates + // 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 EBS volume + // block-device-mapping.device-name - The device name for the EBS volume // (for example, /dev/sdh). // - // block-device-mapping.snapshot-id - The ID of the snapshot used for the + // block-device-mapping.snapshot-id - The ID of the snapshot used for the // EBS volume. // - // block-device-mapping.volume-size - The volume size of the EBS volume, + // block-device-mapping.volume-size - The volume size of the EBS volume, // in GiB. // - // block-device-mapping.volume-type - The volume type of the EBS volume (gp2 - // | standard | io1). + // block-device-mapping.volume-type - The volume type of the EBS volume + // (gp2 | io1 | st1 | sc1 | standard). // - // description - The description of the image (provided during image creation). + // description - The description of the image (provided during image creation). // - // hypervisor - The hypervisor type (ovm | xen). + // hypervisor - The hypervisor type (ovm | xen). // - // image-id - The ID of the image. + // image-id - The ID of the image. // - // image-type - The image type (machine | kernel | ramdisk). + // image-type - The image type (machine | kernel | ramdisk). // - // is-public - A Boolean that indicates whether the image is public. + // is-public - A Boolean that indicates whether the image is public. // - // kernel-id - The kernel ID. + // kernel-id - The kernel ID. // - // manifest-location - The location of the image manifest. + // manifest-location - The location of the image manifest. // - // name - The name of the AMI (provided during image creation). + // name - The name of the AMI (provided during image creation). // - // owner-alias - The AWS account alias (for example, amazon). + // owner-alias - String value from an Amazon-maintained list (amazon | aws-marketplace + // | microsoft) of snapshot owners. Not to be confused with the user-configured + // AWS account alias, which is set from the IAM console. // - // owner-id - The AWS account ID of the image owner. + // owner-id - The AWS account ID of the image owner. // - // platform - The platform. To only list Windows-based AMIs, use windows. + // platform - The platform. To only list Windows-based AMIs, use windows. // - // product-code - The product code. + // product-code - The product code. // - // product-code.type - The type of the product code (devpay | marketplace). + // product-code.type - The type of the product code (devpay | marketplace). // - // ramdisk-id - The RAM disk ID. + // ramdisk-id - The RAM disk ID. // - // root-device-name - The name of the root device volume (for example, /dev/sda1). + // 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). + // root-device-type - The type of the root device volume (ebs | instance-store). // - // state - The state of the image (available | pending | failed). + // state - The state of the image (available | pending | failed). // - // state-reason-code - The reason code for the state change. + // state-reason-code - The reason code for the state change. // - // state-reason-message - The message 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=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 + // 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. + // 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). + // virtualization-type - The virtualization type (paravirtual | hvm). Filters []*Filter `locationName:"Filter" locationNameList:"Filter" type:"list"` // One or more image IDs. @@ -12006,10 +18385,10 @@ type DescribeImagesInput struct { // 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. + // Filters the images by the owner. Specify an AWS account ID, self (owner is + // the sender of the request), or an AWS owner alias (valid values are amazon + // | aws-marketplace | microsoft). Omitting this option returns all images for + // which you have launch permissions, regardless of ownership. Owners []*string `locationName:"Owner" locationNameList:"Owner" type:"list"` } @@ -12023,6 +18402,7 @@ func (s DescribeImagesInput) GoString() string { return s.String() } +// Contains the output of DescribeImages. type DescribeImagesOutput struct { _ struct{} `type:"structure"` @@ -12040,6 +18420,7 @@ func (s DescribeImagesOutput) GoString() string { return s.String() } +// Contains the parameters for DescribeImportImageTasks. type DescribeImportImageTasksInput struct { _ struct{} `type:"structure"` @@ -12049,13 +18430,15 @@ type DescribeImportImageTasksInput struct { // it is UnauthorizedOperation. DryRun *bool `type:"boolean"` - // One or more filters. + // Filter tasks using the task-state filter and one of the following values: + // active, completed, deleting, deleted. Filters []*Filter `locationNameList:"Filter" type:"list"` // A list of import image task IDs. ImportTaskIds []*string `locationName:"ImportTaskId" locationNameList:"ImportTaskId" type:"list"` - // The maximum number of results to return in a single request. + // The maximum number of results to return in a single call. To retrieve the + // remaining results, make another call with the returned NextToken value. MaxResults *int64 `type:"integer"` // A token that indicates the next page of results. @@ -12072,6 +18455,7 @@ func (s DescribeImportImageTasksInput) GoString() string { return s.String() } +// Contains the output for DescribeImportImageTasks. type DescribeImportImageTasksOutput struct { _ struct{} `type:"structure"` @@ -12094,6 +18478,7 @@ func (s DescribeImportImageTasksOutput) GoString() string { return s.String() } +// Contains the parameters for DescribeImportSnapshotTasks. type DescribeImportSnapshotTasksInput struct { _ struct{} `type:"structure"` @@ -12109,7 +18494,8 @@ type DescribeImportSnapshotTasksInput struct { // A list of import snapshot task IDs. ImportTaskIds []*string `locationName:"ImportTaskId" locationNameList:"ImportTaskId" type:"list"` - // The maximum number of results to return in a single request. + // The maximum number of results to return in a single call. To retrieve the + // remaining results, make another call with the returned NextToken value. MaxResults *int64 `type:"integer"` // A token that indicates the next page of results. @@ -12126,6 +18512,7 @@ func (s DescribeImportSnapshotTasksInput) GoString() string { return s.String() } +// Contains the output for DescribeImportSnapshotTasks. type DescribeImportSnapshotTasksOutput struct { _ struct{} `type:"structure"` @@ -12148,10 +18535,13 @@ func (s DescribeImportSnapshotTasksOutput) GoString() string { return s.String() } +// Contains the parameters for DescribeInstanceAttribute. type DescribeInstanceAttributeInput struct { _ struct{} `type:"structure"` // The instance attribute. + // + // Note: The enaSupport attribute is not supported at this time. Attribute *string `locationName:"attribute" type:"string" required:"true" enum:"InstanceAttributeName"` // Checks whether you have the required permissions for the action, without @@ -12174,6 +18564,22 @@ func (s DescribeInstanceAttributeInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *DescribeInstanceAttributeInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DescribeInstanceAttributeInput"} + if s.Attribute == nil { + invalidParams.Add(request.NewErrParamRequired("Attribute")) + } + if s.InstanceId == nil { + invalidParams.Add(request.NewErrParamRequired("InstanceId")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + // Describes an instance attribute. type DescribeInstanceAttributeOutput struct { _ struct{} `type:"structure"` @@ -12188,6 +18594,9 @@ type DescribeInstanceAttributeOutput struct { // Indicates whether the instance is optimized for EBS I/O. EbsOptimized *AttributeBooleanValue `locationName:"ebsOptimized" type:"structure"` + // Indicates whether enhanced networking with ENA is enabled. + EnaSupport *AttributeBooleanValue `locationName:"enaSupport" type:"structure"` + // The security groups associated with the instance. Groups []*GroupIdentifier `locationName:"groupSet" locationNameList:"item" type:"list"` @@ -12218,10 +18627,11 @@ type DescribeInstanceAttributeOutput struct { // must be false for a NAT instance to perform NAT. SourceDestCheck *AttributeBooleanValue `locationName:"sourceDestCheck" type:"structure"` - // The value to use for a resource attribute. + // Indicates whether enhanced networking with the Intel 82599 Virtual Function + // interface is enabled. SriovNetSupport *AttributeValue `locationName:"sriovNetSupport" type:"structure"` - // The Base64-encoded MIME user data. + // The user data. UserData *AttributeValue `locationName:"userData" type:"structure"` } @@ -12235,6 +18645,7 @@ func (s DescribeInstanceAttributeOutput) GoString() string { return s.String() } +// Contains the parameters for DescribeInstanceStatus. type DescribeInstanceStatusInput struct { _ struct{} `type:"structure"` @@ -12246,38 +18657,38 @@ type DescribeInstanceStatusInput struct { // One or more filters. // - // availability-zone - The Availability Zone of the instance. + // availability-zone - The Availability Zone of the instance. // - // event.code - The code for the scheduled event (instance-reboot | system-reboot + // event.code - The code for the scheduled event (instance-reboot | system-reboot // | system-maintenance | instance-retirement | instance-stop). // - // event.description - A description of the event. + // event.description - A description of the event. // - // event.not-after - The latest end time for the scheduled event (for example, + // event.not-after - The latest end time for the scheduled event (for example, // 2014-09-15T17:15:20.000Z). // - // event.not-before - The earliest start time for the scheduled event (for + // event.not-before - The earliest start time for the scheduled event (for // example, 2014-09-15T17:15:20.000Z). // - // instance-state-code - The code for the instance state, as a 16-bit unsigned + // instance-state-code - The code for the instance state, 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-state-name - The state of the instance (pending | running | + // shutting-down | terminated | stopping | stopped). // - // instance-status.reachability - Filters on instance status where the name + // 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). + // 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.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 + // system-status.status - The system status of the instance (ok | impaired // | initializing | insufficient-data | not-applicable). Filters []*Filter `locationName:"Filter" locationNameList:"Filter" type:"list"` @@ -12294,12 +18705,10 @@ type DescribeInstanceStatusInput struct { // 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. + // The maximum number of results to return in a single call. To retrieve the + // remaining results, make another call with the returned NextToken value. This + // value can be between 5 and 1000. You cannot specify this parameter and the + // instance IDs parameter in the same call. MaxResults *int64 `type:"integer"` // The token to retrieve the next page of results. @@ -12316,6 +18725,7 @@ func (s DescribeInstanceStatusInput) GoString() string { return s.String() } +// Contains the output of DescribeInstanceStatus. type DescribeInstanceStatusOutput struct { _ struct{} `type:"structure"` @@ -12337,6 +18747,7 @@ func (s DescribeInstanceStatusOutput) GoString() string { return s.String() } +// Contains the parameters for DescribeInstances. type DescribeInstancesInput struct { _ struct{} `type:"structure"` @@ -12348,232 +18759,234 @@ type DescribeInstancesInput struct { // One or more filters. // - // affinity - The affinity setting for an instance running on a Dedicated - // host (default | host). + // affinity - The affinity setting for an instance running on a Dedicated + // Host (default | host). // - // architecture - The instance architecture (i386 | x86_64). + // architecture - The instance architecture (i386 | x86_64). // - // availability-zone - The Availability Zone of the instance. + // availability-zone - The Availability Zone of the instance. // - // block-device-mapping.attach-time - The attach time for an EBS volume mapped - // to the instance, for example, 2010-09-15T17:15:20.000Z. + // block-device-mapping.attach-time - The attach time for an EBS volume + // mapped to the instance, for example, 2010-09-15T17:15:20.000Z. // - // block-device-mapping.delete-on-termination - A Boolean that indicates + // block-device-mapping.delete-on-termination - A Boolean that indicates // whether the EBS volume is deleted on instance termination. // - // block-device-mapping.device-name - The device name for the EBS volume + // block-device-mapping.device-name - The device name for the EBS volume // (for example, /dev/sdh or xvdh). // - // block-device-mapping.status - The status for the EBS volume (attaching + // block-device-mapping.status - The status for the EBS volume (attaching // | attached | detaching | detached). // - // block-device-mapping.volume-id - The volume ID of the EBS volume. + // block-device-mapping.volume-id - The volume ID of the EBS volume. // - // client-token - The idempotency token you provided when you launched the + // client-token - The idempotency token you provided when you launched the // instance. // - // dns-name - The public DNS name of the instance. + // dns-name - The public DNS name of the instance. // - // group-id - The ID of the security group for the instance. EC2-Classic + // 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 + // group-name - The name of the security group for the instance. EC2-Classic // only. // - // host-Id - The ID of the Dedicated host on which the instance is running, + // host-id - The ID of the Dedicated Host on which the instance is running, // if applicable. // - // hypervisor - The hypervisor type of the instance (ovm | xen). + // hypervisor - The hypervisor type of the instance (ovm | xen). // - // iam-instance-profile.arn - The instance profile associated with the instance. + // 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. + // image-id - The ID of the image used to launch the instance. // - // instance-id - The ID of the instance. + // instance-id - The ID of the instance. // - // instance-lifecycle - Indicates whether this is a Spot Instance (spot). + // instance-lifecycle - Indicates whether this is a Spot Instance or a Scheduled + // Instance (spot | scheduled). // - // instance-state-code - The state of the instance, as a 16-bit unsigned + // 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-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-type - The type of instance (for example, t2.micro). // - // instance.group-id - The ID of the security group for the instance. + // instance.group-id - The ID of the security group for the instance. // - // instance.group-name - The name 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. + // ip-address - The public IP address of the instance. // - // kernel-id - The kernel ID. + // kernel-id - The kernel ID. // - // key-name - The name of the key pair used when the instance was launched. + // 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 + // 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. + // launch-time - The time when the instance was launched. // - // monitoring-state - Indicates whether monitoring is enabled for the instance + // monitoring-state - Indicates whether monitoring is enabled for the instance // (disabled | enabled). // - // owner-id - The AWS account ID of the instance owner. + // owner-id - The AWS account ID of the instance owner. // - // placement-group-name - The name of the placement group for the instance. + // placement-group-name - The name of the placement group for the instance. // - // platform - The platform. Use windows if you have Windows instances; otherwise, + // platform - The platform. Use windows if you have Windows instances; otherwise, // leave blank. // - // private-dns-name - The private DNS name of the instance. + // private-dns-name - The private DNS name of the instance. // - // private-ip-address - The private IP address 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 + // product-code - The product code associated with the AMI used to launch // the instance. // - // product-code.type - The type of product code (devpay | marketplace). + // product-code.type - The type of product code (devpay | marketplace). // - // ramdisk-id - The RAM disk ID. + // ramdisk-id - The RAM disk ID. // - // reason - The reason for the current state of the instance (for example, + // 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 + // 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 + // 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-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 + // 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 + // 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. + // spot-instance-request-id - The ID of the Spot instance request. // - // state-reason-code - The reason code for the state change. + // state-reason-code - The reason code for the state change. // - // state-reason-message - A message that describes the state change. + // state-reason-message - A message that describes the state change. // - // subnet-id - The ID of the subnet for the instance. + // subnet-id - The ID of the subnet for the instance. // - // tag:key=value - The key/value combination of a tag assigned to the resource, + // 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 + // 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. + // 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 | host). + // tenancy - The tenancy of an instance (dedicated | default | host). // - // virtualization-type - The virtualization type of the instance (paravirtual + // virtualization-type - The virtualization type of the instance (paravirtual // | hvm). // - // vpc-id - The ID of the VPC that the instance is running in. + // vpc-id - The ID of the VPC that the instance is running in. // - // network-interface.description - The description of the network interface. + // network-interface.description - The description of the network interface. // - // network-interface.subnet-id - The ID of the subnet for 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.vpc-id - The ID of the VPC for the network interface. // - // network-interface.network-interface-id - The ID of 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.owner-id - The ID of the owner of the network interface. // - // network-interface.availability-zone - The Availability Zone for the network + // 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-id - The requester ID for the network interface. // - // network-interface.requester-managed - Indicates whether 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) + // 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.mac-address - The MAC address of the network interface. // - // network-interface.private-dns-name - The private DNS name of the network + // network-interface.private-dns-name - The private DNS name of the network // interface. // - // network-interface.source-dest-check - Whether the network interface performs + // 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 + // 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 + // 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.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-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.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 + // 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 + // 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 + // 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.attach-time - The time that the network + // interface was attached to an instance. // - // network-interface.attachment.delete-on-termination - Specifies whether + // 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 + // 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 + // 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 + // 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 + // 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 + // 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 + // 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 + // 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"` @@ -12582,12 +18995,10 @@ type DescribeInstancesInput struct { // 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. + // The maximum number of results to return in a single call. To retrieve the + // remaining results, make another call with the returned NextToken value. This + // value can be between 5 and 1000. You cannot specify this parameter and the + // instance IDs parameter or tag filters in the same call. MaxResults *int64 `locationName:"maxResults" type:"integer"` // The token to request the next page of results. @@ -12604,6 +19015,7 @@ func (s DescribeInstancesInput) GoString() string { return s.String() } +// Contains the output of DescribeInstances. type DescribeInstancesOutput struct { _ struct{} `type:"structure"` @@ -12625,6 +19037,7 @@ func (s DescribeInstancesOutput) GoString() string { return s.String() } +// Contains the parameters for DescribeInternetGateways. type DescribeInternetGatewaysInput struct { _ struct{} `type:"structure"` @@ -12636,24 +19049,24 @@ type DescribeInternetGatewaysInput struct { // One or more filters. // - // attachment.state - The current state of the attachment between the gateway + // 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. + // attachment.vpc-id - The ID of an attached VPC. // - // internet-gateway-id - The ID of the Internet gateway. + // 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=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 + // 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. + // 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. @@ -12672,6 +19085,7 @@ func (s DescribeInternetGatewaysInput) GoString() string { return s.String() } +// Contains the output of DescribeInternetGateways. type DescribeInternetGatewaysOutput struct { _ struct{} `type:"structure"` @@ -12689,6 +19103,7 @@ func (s DescribeInternetGatewaysOutput) GoString() string { return s.String() } +// Contains the parameters for DescribeKeyPairs. type DescribeKeyPairsInput struct { _ struct{} `type:"structure"` @@ -12700,9 +19115,9 @@ type DescribeKeyPairsInput struct { // One or more filters. // - // fingerprint - The fingerprint of the key pair. + // fingerprint - The fingerprint of the key pair. // - // key-name - The name 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. @@ -12721,6 +19136,7 @@ func (s DescribeKeyPairsInput) GoString() string { return s.String() } +// Contains the output of DescribeKeyPairs. type DescribeKeyPairsOutput struct { _ struct{} `type:"structure"` @@ -12738,6 +19154,7 @@ func (s DescribeKeyPairsOutput) GoString() string { return s.String() } +// Contains the parameters for DescribeMovingAddresses. type DescribeMovingAddressesInput struct { _ struct{} `type:"structure"` @@ -12749,7 +19166,7 @@ type DescribeMovingAddressesInput struct { // One or more filters. // - // moving-status - The status of the Elastic IP address (MovingToVpc | RestoringToClassic). + // moving-status - The status of the Elastic IP address (MovingToVpc | RestoringToClassic). Filters []*Filter `locationName:"filter" locationNameList:"Filter" type:"list"` // The maximum number of results to return for the request in a single page. @@ -12777,6 +19194,7 @@ func (s DescribeMovingAddressesInput) GoString() string { return s.String() } +// Contains the output of DescribeMovingAddresses. type DescribeMovingAddressesOutput struct { _ struct{} `type:"structure"` @@ -12798,19 +19216,20 @@ func (s DescribeMovingAddressesOutput) GoString() string { return s.String() } +// Contains the parameters for DescribeNatGateways. type DescribeNatGatewaysInput struct { _ struct{} `type:"structure"` // One or more filters. // - // nat-gateway-id - The ID of the NAT gateway. + // nat-gateway-id - The ID of the NAT gateway. // - // state - The state of the NAT gateway (pending | failed | available | deleting - // | deleted). + // state - The state of the NAT gateway (pending | failed | available | + // deleting | deleted). // - // subnet-id - The ID of the subnet in which the NAT gateway resides. + // subnet-id - The ID of the subnet in which the NAT gateway resides. // - // vpc-id - The ID of the VPC in which the NAT gateway resides. + // vpc-id - The ID of the VPC in which the NAT gateway resides. Filter []*Filter `locationNameList:"Filter" type:"list"` // The maximum number of items to return for this request. The request returns @@ -12838,6 +19257,7 @@ func (s DescribeNatGatewaysInput) GoString() string { return s.String() } +// Contains the output of DescribeNatGateways. type DescribeNatGatewaysOutput struct { _ struct{} `type:"structure"` @@ -12859,6 +19279,7 @@ func (s DescribeNatGatewaysOutput) GoString() string { return s.String() } +// Contains the parameters for DescribeNetworkAcls. type DescribeNetworkAclsInput struct { _ struct{} `type:"structure"` @@ -12870,51 +19291,52 @@ type DescribeNetworkAclsInput struct { // One or more filters. // - // association.association-id - The ID of an association ID for the ACL. + // 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.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. + // association.subnet-id - The ID of the subnet involved in the association. // - // default - Indicates whether the ACL is the default network ACL for the + // default - Indicates whether the ACL is the default network ACL for the // VPC. // - // entry.cidr - The CIDR range specified in the entry. + // entry.cidr - The CIDR range specified in the entry. // - // entry.egress - Indicates whether the entry applies to egress traffic. + // entry.egress - Indicates whether the entry applies to egress traffic. // - // entry.icmp.code - The ICMP code specified in the entry, if any. + // 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.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.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.port-range.to - The end of the port range specified in the entry. // - // entry.protocol - The protocol specified in the entry (tcp | udp | icmp + // 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-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. + // 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. + // 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=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 + // 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. + // 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. + // 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. @@ -12933,6 +19355,7 @@ func (s DescribeNetworkAclsInput) GoString() string { return s.String() } +// Contains the output of DescribeNetworkAcls. type DescribeNetworkAclsOutput struct { _ struct{} `type:"structure"` @@ -12950,6 +19373,7 @@ func (s DescribeNetworkAclsOutput) GoString() string { return s.String() } +// Contains the parameters for DescribeNetworkInterfaceAttribute. type DescribeNetworkInterfaceAttributeInput struct { _ struct{} `type:"structure"` @@ -12976,6 +19400,20 @@ func (s DescribeNetworkInterfaceAttributeInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *DescribeNetworkInterfaceAttributeInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DescribeNetworkInterfaceAttributeInput"} + if s.NetworkInterfaceId == nil { + invalidParams.Add(request.NewErrParamRequired("NetworkInterfaceId")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// Contains the output of DescribeNetworkInterfaceAttribute. type DescribeNetworkInterfaceAttributeOutput struct { _ struct{} `type:"structure"` @@ -13005,6 +19443,7 @@ func (s DescribeNetworkInterfaceAttributeOutput) GoString() string { return s.String() } +// Contains the parameters for DescribeNetworkInterfaces. type DescribeNetworkInterfacesInput struct { _ struct{} `type:"structure"` @@ -13016,106 +19455,106 @@ type DescribeNetworkInterfacesInput struct { // One or more filters. // - // addresses.private-ip-address - The private IP addresses associated with + // 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.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 + // 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 + // 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 + // 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 + // 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 + // 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 + // 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. + // association.public-dns-name - The public DNS name for the network interface. // - // attachment.attachment-id - The ID of the interface attachment. + // attachment.attachment-id - The ID of the interface attachment. // - // attachment.attach.time - The time that the network interface was attached + // attachment.attach.time - The time that the network interface was attached // to an instance. // - // attachment.delete-on-termination - Indicates whether the attachment is + // attachment.delete-on-termination - Indicates whether the attachment is // deleted when an instance is terminated. // - // attachment.device-index - The device index to which the network interface + // attachment.device-index - The device index to which the network interface // is attached. // - // 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.nat-gateway-id - The ID of the NAT gateway to which the network + // attachment.instance-id - The ID of the instance to which the network // interface is attached. // - // attachment.status - The status of the attachment (attaching | attached + // attachment.instance-owner-id - The owner ID of the instance to which + // the network interface is attached. + // + // attachment.nat-gateway-id - The ID of the NAT gateway to which the network + // interface is attached. + // + // attachment.status - The status of the attachment (attaching | attached // | detaching | detached). // - // availability-zone - The Availability Zone of the network interface. + // availability-zone - The Availability Zone of the network interface. // - // description - The description 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-id - The ID of a security group associated with the network interface. // - // group-name - The name of a security group associated with the network + // group-name - The name of a security group associated with the network // interface. // - // mac-address - The MAC address of the network interface. + // mac-address - The MAC address of the network interface. // - // network-interface-id - The ID of the network interface. + // network-interface-id - The ID of the network interface. // - // owner-id - The AWS account ID of the network interface owner. + // owner-id - The AWS account ID of the network interface owner. // - // private-ip-address - The private IP address or addresses of the network + // private-ip-address - The private IP address or addresses of the network // interface. // - // private-dns-name - The private DNS name 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 + // 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). + // 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. + // 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 + // 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. + // 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=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 + // 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. + // 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. + // 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. @@ -13134,6 +19573,7 @@ func (s DescribeNetworkInterfacesInput) GoString() string { return s.String() } +// Contains the output of DescribeNetworkInterfaces. type DescribeNetworkInterfacesOutput struct { _ struct{} `type:"structure"` @@ -13151,6 +19591,7 @@ func (s DescribeNetworkInterfacesOutput) GoString() string { return s.String() } +// Contains the parameters for DescribePlacementGroups. type DescribePlacementGroupsInput struct { _ struct{} `type:"structure"` @@ -13162,12 +19603,12 @@ type DescribePlacementGroupsInput struct { // One or more filters. // - // group-name - The name of the placement group. + // group-name - The name of the placement group. // - // state - The state of the placement group (pending | available | deleting + // state - The state of the placement group (pending | available | deleting // | deleted). // - // strategy - The strategy of the placement group (cluster). + // strategy - The strategy of the placement group (cluster). Filters []*Filter `locationName:"Filter" locationNameList:"Filter" type:"list"` // One or more placement group names. @@ -13186,6 +19627,7 @@ func (s DescribePlacementGroupsInput) GoString() string { return s.String() } +// Contains the output of DescribePlacementGroups. type DescribePlacementGroupsOutput struct { _ struct{} `type:"structure"` @@ -13203,6 +19645,7 @@ func (s DescribePlacementGroupsOutput) GoString() string { return s.String() } +// Contains the parameters for DescribePrefixLists. type DescribePrefixListsInput struct { _ struct{} `type:"structure"` @@ -13214,9 +19657,9 @@ type DescribePrefixListsInput struct { // One or more filters. // - // prefix-list-id: The ID of a prefix list. + // prefix-list-id: The ID of a prefix list. // - // prefix-list-name: The name of a prefix list. + // prefix-list-name: The name of a prefix list. Filters []*Filter `locationName:"Filter" locationNameList:"Filter" type:"list"` // The maximum number of items to return for this request. The request returns @@ -13245,6 +19688,7 @@ func (s DescribePrefixListsInput) GoString() string { return s.String() } +// Contains the output of DescribePrefixLists. type DescribePrefixListsOutput struct { _ struct{} `type:"structure"` @@ -13266,6 +19710,7 @@ func (s DescribePrefixListsOutput) GoString() string { return s.String() } +// Contains the parameters for DescribeRegions. type DescribeRegionsInput struct { _ struct{} `type:"structure"` @@ -13277,9 +19722,9 @@ type DescribeRegionsInput struct { // One or more filters. // - // endpoint - The endpoint of the region (for example, ec2.us-east-1.amazonaws.com). + // 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). + // 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. @@ -13296,6 +19741,7 @@ func (s DescribeRegionsInput) GoString() string { return s.String() } +// Contains the output of DescribeRegions. type DescribeRegionsOutput struct { _ struct{} `type:"structure"` @@ -13313,6 +19759,7 @@ func (s DescribeRegionsOutput) GoString() string { return s.String() } +// Contains the parameters for DescribeReservedInstances. type DescribeReservedInstancesInput struct { _ struct{} `type:"structure"` @@ -13324,20 +19771,20 @@ type DescribeReservedInstancesInput struct { // One or more filters. // - // availability-zone - The Availability Zone where the Reserved Instance + // availability-zone - The Availability Zone where the Reserved Instance // can be used. // - // duration - The duration of the Reserved Instance (one year or three years), + // duration - The duration of the Reserved Instance (one year or three years), // in seconds (31536000 | 94608000). // - // end - The time when the Reserved Instance expires (for example, 2015-08-07T11:54:42.000Z). + // end - The time when the Reserved Instance expires (for example, 2015-08-07T11:54:42.000Z). // - // fixed-price - The purchase price of the Reserved Instance (for example, + // fixed-price - The purchase price of the Reserved Instance (for example, // 9800.0). // - // instance-type - The instance type that is covered by the reservation. + // instance-type - The instance type that is covered by the reservation. // - // product-description - The Reserved Instance product platform description. + // product-description - The Reserved Instance product platform description. // Instances that include (Amazon VPC) in the product platform description will // only be displayed to EC2-Classic account holders and are for use with Amazon // VPC (Linux/UNIX | Linux/UNIX (Amazon VPC) | SUSE Linux | SUSE Linux (Amazon @@ -13347,27 +19794,27 @@ type DescribeReservedInstancesInput struct { // with SQL Server Web (Amazon VPC) | Windows with SQL Server Enterprise | Windows // with SQL Server Enterprise (Amazon VPC)). // - // reserved-instances-id - The ID of the Reserved Instance. + // reserved-instances-id - The ID of the Reserved Instance. // - // start - The time at which the Reserved Instance purchase request was placed - // (for example, 2014-08-07T11:54:42.000Z). + // start - The time at which the Reserved Instance purchase request was + // placed (for example, 2014-08-07T11:54:42.000Z). // - // state - The state of the Reserved Instance (payment-pending | active | - // payment-failed | retired). + // state - The state of the Reserved Instance (payment-pending | active + // | payment-failed | retired). // - // tag:key=value - The key/value combination of a tag assigned to the resource. + // 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 + // 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. + // tag-value - The value of a tag assigned to the resource. This filter + // is independent of the tag-key filter. // - // usage-price - The usage price of the Reserved Instance, per hour (for + // usage-price - The usage price of the Reserved Instance, per hour (for // example, 0.84). Filters []*Filter `locationName:"Filter" locationNameList:"Filter" type:"list"` @@ -13393,19 +19840,20 @@ func (s DescribeReservedInstancesInput) GoString() string { return s.String() } +// Contains the parameters for DescribeReservedInstancesListings. type DescribeReservedInstancesListingsInput struct { _ struct{} `type:"structure"` // One or more filters. // - // reserved-instances-id - The ID of the Reserved Instances. + // reserved-instances-id - The ID of the Reserved Instances. // - // reserved-instances-listing-id - The ID of the Reserved Instances listing. + // reserved-instances-listing-id - The ID of the Reserved Instances listing. // - // status - The status of the Reserved Instance listing (pending | active + // status - The status of the Reserved Instance listing (pending | active // | cancelled | closed). // - // status-message - The reason for the status. + // status-message - The reason for the status. Filters []*Filter `locationName:"filters" locationNameList:"Filter" type:"list"` // One or more Reserved Instance IDs. @@ -13425,6 +19873,7 @@ func (s DescribeReservedInstancesListingsInput) GoString() string { return s.String() } +// Contains the output of DescribeReservedInstancesListings. type DescribeReservedInstancesListingsOutput struct { _ struct{} `type:"structure"` @@ -13442,43 +19891,44 @@ func (s DescribeReservedInstancesListingsOutput) GoString() string { return s.String() } +// Contains the parameters for DescribeReservedInstancesModifications. type DescribeReservedInstancesModificationsInput struct { _ struct{} `type:"structure"` // One or more filters. // - // client-token - The idempotency token for the modification request. + // client-token - The idempotency token for the modification request. // - // create-date - The time when the modification request was created. + // create-date - The time when the modification request was created. // - // effective-date - The time when the modification becomes effective. + // effective-date - The time when the modification becomes effective. // - // modification-result.reserved-instances-id - The ID for the Reserved Instances + // modification-result.reserved-instances-id - The ID for the Reserved Instances // created as part of the modification request. This ID is only available when // the status of the modification is fulfilled. // - // modification-result.target-configuration.availability-zone - The Availability + // modification-result.target-configuration.availability-zone - The Availability // Zone for the new Reserved Instances. // - // modification-result.target-configuration.instance-count - The number + // modification-result.target-configuration.instance-count - The number // of new Reserved Instances. // - // modification-result.target-configuration.instance-type - The instance + // modification-result.target-configuration.instance-type - The instance // type of the new Reserved Instances. // - // modification-result.target-configuration.platform - The network platform + // 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-id - The ID of the Reserved Instances modified. // - // reserved-instances-modification-id - The ID of the modification request. + // reserved-instances-modification-id - The ID of the modification request. // - // status - The status of the Reserved Instances modification request (processing + // status - The status of the Reserved Instances modification request (processing // | fulfilled | failed). // - // status-message - The reason for the status. + // status-message - The reason for the status. // - // update-date - The time when the modification request was last updated. + // 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. @@ -13498,6 +19948,7 @@ func (s DescribeReservedInstancesModificationsInput) GoString() string { return s.String() } +// Contains the output of DescribeReservedInstancesModifications. type DescribeReservedInstancesModificationsOutput struct { _ struct{} `type:"structure"` @@ -13519,6 +19970,7 @@ func (s DescribeReservedInstancesModificationsOutput) GoString() string { return s.String() } +// Contains the parameters for DescribeReservedInstancesOfferings. type DescribeReservedInstancesOfferingsInput struct { _ struct{} `type:"structure"` @@ -13533,22 +19985,22 @@ type DescribeReservedInstancesOfferingsInput struct { // One or more filters. // - // availability-zone - The Availability Zone where the Reserved Instance + // availability-zone - The Availability Zone where the Reserved Instance // can be used. // - // duration - The duration of the Reserved Instance (for example, one year + // duration - The duration of the Reserved Instance (for example, one year // or three years), in seconds (31536000 | 94608000). // - // fixed-price - The purchase price of the Reserved Instance (for example, + // fixed-price - The purchase price of the Reserved Instance (for example, // 9800.0). // - // instance-type - The instance type that is covered by the reservation. + // instance-type - The instance type that is covered by the reservation. // - // 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 both AWS and the Reserved Instance Marketplace are listed. + // 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 both AWS and the Reserved Instance Marketplace are listed. // - // product-description - The Reserved Instance product platform description. + // product-description - The Reserved Instance product platform description. // Instances that include (Amazon VPC) in the product platform description will // only be displayed to EC2-Classic account holders and are for use with Amazon // VPC. (Linux/UNIX | Linux/UNIX (Amazon VPC) | SUSE Linux | SUSE Linux (Amazon @@ -13558,9 +20010,9 @@ type DescribeReservedInstancesOfferingsInput struct { // with SQL Server Web (Amazon VPC) | Windows with SQL Server Enterprise | Windows // with SQL Server Enterprise (Amazon VPC)) // - // reserved-instances-offering-id - The Reserved Instances offering ID. + // reserved-instances-offering-id - The Reserved Instances offering ID. // - // usage-price - The usage price of the Reserved Instance, per hour (for + // usage-price - The usage price of the Reserved Instance, per hour (for // example, 0.84). Filters []*Filter `locationName:"Filter" locationNameList:"Filter" type:"list"` @@ -13627,6 +20079,7 @@ func (s DescribeReservedInstancesOfferingsInput) GoString() string { return s.String() } +// Contains the output of DescribeReservedInstancesOfferings. type DescribeReservedInstancesOfferingsOutput struct { _ struct{} `type:"structure"` @@ -13648,6 +20101,7 @@ func (s DescribeReservedInstancesOfferingsOutput) GoString() string { return s.String() } +// Contains the output for DescribeReservedInstances. type DescribeReservedInstancesOutput struct { _ struct{} `type:"structure"` @@ -13665,6 +20119,7 @@ func (s DescribeReservedInstancesOutput) GoString() string { return s.String() } +// Contains the parameters for DescribeRouteTables. type DescribeRouteTablesInput struct { _ struct{} `type:"structure"` @@ -13676,59 +20131,59 @@ type DescribeRouteTablesInput struct { // One or more filters. // - // association.route-table-association-id - The ID of an association ID for - // the route table. + // 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.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.subnet-id - The ID of the subnet involved in the association. // - // association.main - Indicates whether the route table is the main route + // association.main - Indicates whether the route table is the main route // table for the VPC (true | false). // - // route-table-id - The ID of the route table. + // route-table-id - The ID of the route table. // - // route.destination-cidr-block - The CIDR range specified in a route in + // route.destination-cidr-block - The CIDR range specified in a route in // the table. // - // route.destination-prefix-list-id - The ID (prefix) of the AWS service + // route.destination-prefix-list-id - The ID (prefix) of the AWS service // specified in a route in the table. // - // route.gateway-id - The ID of a gateway 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 + // route.instance-id - The ID of an instance specified in a route in the // table. // - // route.nat-gateway-id - The ID of a NAT gateway. + // route.nat-gateway-id - The ID of a NAT gateway. // - // 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.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). + // 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. + // 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=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 + // 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. + // 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. + // 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. @@ -13747,6 +20202,7 @@ func (s DescribeRouteTablesInput) GoString() string { return s.String() } +// Contains the output of DescribeRouteTables. type DescribeRouteTablesOutput struct { _ struct{} `type:"structure"` @@ -13776,20 +20232,21 @@ type DescribeScheduledInstanceAvailabilityInput struct { // One or more filters. // - // availability-zone - The Availability Zone (for example, us-west-2a). + // availability-zone - The Availability Zone (for example, us-west-2a). // - // instance-type - The instance type (for example, c4.large). + // instance-type - The instance type (for example, c4.large). // - // network-platform - The network platform (EC2-Classic or EC2-VPC). + // network-platform - The network platform (EC2-Classic or EC2-VPC). // - // platform - The platform (Linux/UNIX or Windows). + // platform - The platform (Linux/UNIX or Windows). Filters []*Filter `locationName:"Filter" locationNameList:"Filter" type:"list"` // The time period for the first schedule to start. FirstSlotStartTimeRange *SlotDateTimeRangeRequest `type:"structure" required:"true"` - // The maximum number of results to return in a single call. To retrieve the - // remaining results, make another call with the returned NextToken value. + // The maximum number of results to return in a single call. This value can + // be between 5 and 300. The default value is 300. To retrieve the remaining + // results, make another call with the returned NextToken value. MaxResults *int64 `type:"integer"` // The maximum available duration, in hours. This value must be greater than @@ -13819,6 +20276,27 @@ func (s DescribeScheduledInstanceAvailabilityInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *DescribeScheduledInstanceAvailabilityInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DescribeScheduledInstanceAvailabilityInput"} + if s.FirstSlotStartTimeRange == nil { + invalidParams.Add(request.NewErrParamRequired("FirstSlotStartTimeRange")) + } + if s.Recurrence == nil { + invalidParams.Add(request.NewErrParamRequired("Recurrence")) + } + if s.FirstSlotStartTimeRange != nil { + if err := s.FirstSlotStartTimeRange.Validate(); err != nil { + invalidParams.AddNested("FirstSlotStartTimeRange", err.(request.ErrInvalidParams)) + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + // Contains the output of DescribeScheduledInstanceAvailability. type DescribeScheduledInstanceAvailabilityOutput struct { _ struct{} `type:"structure"` @@ -13853,17 +20331,18 @@ type DescribeScheduledInstancesInput struct { // One or more filters. // - // availability-zone - The Availability Zone (for example, us-west-2a). + // availability-zone - The Availability Zone (for example, us-west-2a). // - // instance-type - The instance type (for example, c4.large). + // instance-type - The instance type (for example, c4.large). // - // network-platform - The network platform (EC2-Classic or EC2-VPC). + // network-platform - The network platform (EC2-Classic or EC2-VPC). // - // platform - The platform (Linux/UNIX or Windows). + // platform - The platform (Linux/UNIX or Windows). Filters []*Filter `locationName:"Filter" locationNameList:"Filter" type:"list"` - // The maximum number of results to return in a single call. To retrieve the - // remaining results, make another call with the returned NextToken value. + // The maximum number of results to return in a single call. This value can + // be between 5 and 300. The default value is 100. To retrieve the remaining + // results, make another call with the returned NextToken value. MaxResults *int64 `type:"integer"` // The token for the next set of results. @@ -13908,6 +20387,60 @@ func (s DescribeScheduledInstancesOutput) GoString() string { return s.String() } +type DescribeSecurityGroupReferencesInput struct { + _ struct{} `type:"structure"` + + // Checks whether you have the required permissions for the operation, without + // actually making the request, and provides an error response. If you have + // the required permissions, the error response is DryRunOperation. Otherwise, + // it is UnauthorizedOperation. + DryRun *bool `type:"boolean"` + + // One or more security group IDs in your account. + GroupId []*string `locationNameList:"item" type:"list" required:"true"` +} + +// String returns the string representation +func (s DescribeSecurityGroupReferencesInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DescribeSecurityGroupReferencesInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *DescribeSecurityGroupReferencesInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DescribeSecurityGroupReferencesInput"} + if s.GroupId == nil { + invalidParams.Add(request.NewErrParamRequired("GroupId")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +type DescribeSecurityGroupReferencesOutput struct { + _ struct{} `type:"structure"` + + // Information about the VPCs with the referencing security groups. + SecurityGroupReferenceSet []*SecurityGroupReference `locationName:"securityGroupReferenceSet" locationNameList:"item" type:"list"` +} + +// String returns the string representation +func (s DescribeSecurityGroupReferencesOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DescribeSecurityGroupReferencesOutput) GoString() string { + return s.String() +} + +// Contains the parameters for DescribeSecurityGroups. type DescribeSecurityGroupsInput struct { _ struct{} `type:"structure"` @@ -13921,42 +20454,42 @@ type DescribeSecurityGroupsInput struct { // security groups for which any combination of rules - not necessarily a single // rule - match all filters. // - // description - The description of the security group. + // description - The description of the security group. // - // egress.ip-permission.prefix-list-id - The ID (prefix) of the AWS service + // egress.ip-permission.prefix-list-id - The ID (prefix) of the AWS service // to which the security group allows access. // - // group-id - The ID of the security group. + // group-id - The ID of the security group. // - // group-name - The name 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.cidr - A CIDR range that has been granted permission. // - // ip-permission.from-port - The start of port range for the TCP and UDP + // 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 + // 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 + // 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 + // 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, + // 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 + // 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. + // 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-key - The key of a tag assigned to the security group. // - // tag-value - The value 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. + // 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 @@ -13984,6 +20517,7 @@ func (s DescribeSecurityGroupsInput) GoString() string { return s.String() } +// Contains the output of DescribeSecurityGroups. type DescribeSecurityGroupsOutput struct { _ struct{} `type:"structure"` @@ -14001,6 +20535,7 @@ func (s DescribeSecurityGroupsOutput) GoString() string { return s.String() } +// Contains the parameters for DescribeSnapshotAttribute. type DescribeSnapshotAttributeInput struct { _ struct{} `type:"structure"` @@ -14027,6 +20562,23 @@ func (s DescribeSnapshotAttributeInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *DescribeSnapshotAttributeInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DescribeSnapshotAttributeInput"} + if s.Attribute == nil { + invalidParams.Add(request.NewErrParamRequired("Attribute")) + } + if s.SnapshotId == nil { + invalidParams.Add(request.NewErrParamRequired("SnapshotId")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// Contains the output of DescribeSnapshotAttribute. type DescribeSnapshotAttributeOutput struct { _ struct{} `type:"structure"` @@ -14050,6 +20602,7 @@ func (s DescribeSnapshotAttributeOutput) GoString() string { return s.String() } +// Contains the parameters for DescribeSnapshots. type DescribeSnapshotsInput struct { _ struct{} `type:"structure"` @@ -14061,37 +20614,38 @@ type DescribeSnapshotsInput struct { // One or more filters. // - // description - A description of the snapshot. + // description - A description of the snapshot. // - // owner-alias - The AWS account alias (for example, amazon) that owns the - // snapshot. + // owner-alias - Value from an Amazon-maintained list (amazon | aws-marketplace + // | microsoft) of snapshot owners. Not to be confused with the user-configured + // AWS account alias, which is set from the IAM consolew. // - // owner-id - The ID of the AWS account 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, + // progress - The progress of the snapshot, as a percentage (for example, // 80%). // - // snapshot-id - The snapshot ID. + // snapshot-id - The snapshot ID. // - // start-time - The time stamp when the snapshot was initiated. + // start-time - The time stamp when the snapshot was initiated. // - // status - The status of the snapshot (pending | completed | error). + // 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=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 + // 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. + // 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-id - The ID of the volume the snapshot is for. // - // volume-size - The size of the volume, in GiB. + // 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 @@ -14135,6 +20689,7 @@ func (s DescribeSnapshotsInput) GoString() string { return s.String() } +// Contains the output of DescribeSnapshots. type DescribeSnapshotsOutput struct { _ struct{} `type:"structure"` @@ -14229,6 +20784,19 @@ func (s DescribeSpotFleetInstancesInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *DescribeSpotFleetInstancesInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DescribeSpotFleetInstancesInput"} + if s.SpotFleetRequestId == nil { + invalidParams.Add(request.NewErrParamRequired("SpotFleetRequestId")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + // Contains the output of DescribeSpotFleetInstances. type DescribeSpotFleetInstancesOutput struct { _ struct{} `type:"structure"` @@ -14293,6 +20861,22 @@ func (s DescribeSpotFleetRequestHistoryInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *DescribeSpotFleetRequestHistoryInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DescribeSpotFleetRequestHistoryInput"} + if s.SpotFleetRequestId == nil { + invalidParams.Add(request.NewErrParamRequired("SpotFleetRequestId")) + } + if s.StartTime == nil { + invalidParams.Add(request.NewErrParamRequired("StartTime")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + // Contains the output of DescribeSpotFleetRequestHistory. type DescribeSpotFleetRequestHistoryOutput struct { _ struct{} `type:"structure"` @@ -14393,112 +20977,113 @@ type DescribeSpotInstanceRequestsInput struct { // One or more filters. // - // availability-zone-group - The Availability Zone group. + // availability-zone-group - The Availability Zone group. // - // create-time - The time stamp when the Spot instance request was created. + // create-time - The time stamp when the Spot instance request was created. // - // fault-code - The fault code related to the request. + // fault-code - The fault code related to the request. // - // fault-message - The fault message related to the request. + // fault-message - The fault message related to the request. // - // instance-id - The ID of the instance that fulfilled the request. + // instance-id - The ID of the instance that fulfilled the request. // - // launch-group - The Spot instance launch group. + // launch-group - The Spot instance launch group. // - // launch.block-device-mapping.delete-on-termination - Indicates whether + // 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 + // 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 + // 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-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.block-device-mapping.volume-type - The type of the Amazon EBS + // volume: gp2 for General Purpose SSD, io1 for Provisioned IOPS SSD, st1 for + // Throughput Optimized HDD, sc1for Cold HDD, or standard for Magnetic. // - // launch.group-id - The security group for the instance. + // launch.group-id - The security group for the instance. // - // launch.image-id - The ID of the AMI. + // launch.image-id - The ID of the AMI. // - // launch.instance-type - The type of instance (for example, m3.medium). + // launch.instance-type - The type of instance (for example, m3.medium). // - // launch.kernel-id - The kernel ID. + // launch.kernel-id - The kernel ID. // - // launch.key-name - The name of the key pair the instance launched with. + // launch.key-name - The name of the key pair the instance launched with. // - // launch.monitoring-enabled - Whether monitoring is enabled for the Spot + // launch.monitoring-enabled - Whether monitoring is enabled for the Spot // instance. // - // launch.ramdisk-id - The RAM disk ID. + // launch.ramdisk-id - The RAM disk ID. // - // network-interface.network-interface-id - The ID of the network interface. + // network-interface.network-interface-id - The ID of the network interface. // - // network-interface.device-index - The index of the device for the network + // 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.subnet-id - The ID of the subnet for the instance. // - // network-interface.description - A description of the network interface. + // network-interface.description - A description of the network interface. // - // network-interface.private-ip-address - The primary private IP address + // network-interface.private-ip-address - The primary private IP address // of the network interface. // - // network-interface.delete-on-termination - Indicates whether the network + // 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 + // network-interface.group-id - The ID of the security group associated // with the network interface. // - // network-interface.addresses.primary - Indicates whether the IP address + // 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 + // product-description - The product description associated with the instance // (Linux/UNIX | Windows). // - // spot-instance-request-id - The Spot instance request ID. + // spot-instance-request-id - The Spot instance request ID. // - // spot-price - The maximum hourly price for any Spot instance launched to - // fulfill the request. + // 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 + // 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 + // 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 + // 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=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 + // 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. + // 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). + // type - The type of Spot instance request (one-time | persistent). // - // launched-availability-zone - The Availability Zone in which the bid is + // launched-availability-zone - The Availability Zone in which the bid is // launched. // - // valid-from - The start date of the request. + // valid-from - The start date of the request. // - // valid-until - The end 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. @@ -14552,18 +21137,19 @@ type DescribeSpotPriceHistoryInput struct { // One or more filters. // - // availability-zone - The Availability Zone for which prices should be returned. + // availability-zone - The Availability Zone for which prices should be + // returned. // - // instance-type - The type of instance (for example, m3.medium). + // instance-type - The type of instance (for example, m3.medium). // - // product-description - The product description for the Spot price (Linux/UNIX + // 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; + // 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, in UTC format (for + // timestamp - The timestamp of the Spot price history, in UTC format (for // example, YYYY-MM-DDTHH:MM:SSZ). You can use wildcards (* and ?). Greater // than or less than comparison is not supported. Filters []*Filter `locationName:"Filter" locationNameList:"Filter" type:"list"` @@ -14619,6 +21205,79 @@ func (s DescribeSpotPriceHistoryOutput) GoString() string { return s.String() } +type DescribeStaleSecurityGroupsInput struct { + _ struct{} `type:"structure"` + + // Checks whether you have the required permissions for the operation, without + // actually making the request, and provides an error response. If you have + // the required permissions, the error response is DryRunOperation. Otherwise, + // it is UnauthorizedOperation. + DryRun *bool `type:"boolean"` + + // The maximum number of items to return for this request. The request returns + // a token that you can specify in a subsequent call to get the next set of + // results. + MaxResults *int64 `min:"5" type:"integer"` + + // The token for the next set of items to return. (You received this token from + // a prior call.) + NextToken *string `min:"1" type:"string"` + + // The ID of the VPC. + VpcId *string `type:"string" required:"true"` +} + +// String returns the string representation +func (s DescribeStaleSecurityGroupsInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DescribeStaleSecurityGroupsInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *DescribeStaleSecurityGroupsInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DescribeStaleSecurityGroupsInput"} + if s.MaxResults != nil && *s.MaxResults < 5 { + invalidParams.Add(request.NewErrParamMinValue("MaxResults", 5)) + } + if s.NextToken != nil && len(*s.NextToken) < 1 { + invalidParams.Add(request.NewErrParamMinLen("NextToken", 1)) + } + if s.VpcId == nil { + invalidParams.Add(request.NewErrParamRequired("VpcId")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +type DescribeStaleSecurityGroupsOutput struct { + _ struct{} `type:"structure"` + + // The token to use when requesting the next set of items. If there are no additional + // items to return, the string is empty. + NextToken *string `locationName:"nextToken" type:"string"` + + // Information about the stale security groups. + StaleSecurityGroupSet []*StaleSecurityGroup `locationName:"staleSecurityGroupSet" locationNameList:"item" type:"list"` +} + +// String returns the string representation +func (s DescribeStaleSecurityGroupsOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DescribeStaleSecurityGroupsOutput) GoString() string { + return s.String() +} + +// Contains the parameters for DescribeSubnets. type DescribeSubnetsInput struct { _ struct{} `type:"structure"` @@ -14630,36 +21289,36 @@ type DescribeSubnetsInput struct { // One or more filters. // - // availabilityZone - The Availability Zone for the subnet. You can also + // 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 + // 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. + // 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 + // 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). + // state - The state of the subnet (pending | available). // - // subnet-id - The ID of the subnet. + // subnet-id - The ID of the subnet. // - // tag:key=value - The key/value combination of a tag assigned to the resource. + // 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 + // 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. + // 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. + // vpc-id - The ID of the VPC for the subnet. Filters []*Filter `locationName:"Filter" locationNameList:"Filter" type:"list"` // One or more subnet IDs. @@ -14678,6 +21337,7 @@ func (s DescribeSubnetsInput) GoString() string { return s.String() } +// Contains the output of DescribeSubnets. type DescribeSubnetsOutput struct { _ struct{} `type:"structure"` @@ -14695,6 +21355,7 @@ func (s DescribeSubnetsOutput) GoString() string { return s.String() } +// Contains the parameters for DescribeTags. type DescribeTagsInput struct { _ struct{} `type:"structure"` @@ -14706,23 +21367,21 @@ type DescribeTagsInput struct { // One or more filters. // - // key - The tag key. + // key - The tag key. // - // resource-id - The resource ID. + // resource-id - The resource ID. // - // resource-type - The resource type (customer-gateway | dhcp-options | image - // | instance | internet-gateway | network-acl | network-interface | reserved-instances + // 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. + // 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. + // The maximum number of results to return in a single call. This value can + // be between 5 and 1000. To retrieve the remaining results, make another call + // with the returned NextToken value. MaxResults *int64 `locationName:"maxResults" type:"integer"` // The token to retrieve the next page of results. @@ -14739,6 +21398,7 @@ func (s DescribeTagsInput) GoString() string { return s.String() } +// Contains the output of DescribeTags. type DescribeTagsOutput struct { _ struct{} `type:"structure"` @@ -14760,6 +21420,7 @@ func (s DescribeTagsOutput) GoString() string { return s.String() } +// Contains the parameters for DescribeVolumeAttribute. type DescribeVolumeAttributeInput struct { _ struct{} `type:"structure"` @@ -14786,6 +21447,20 @@ func (s DescribeVolumeAttributeInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *DescribeVolumeAttributeInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DescribeVolumeAttributeInput"} + if s.VolumeId == nil { + invalidParams.Add(request.NewErrParamRequired("VolumeId")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// Contains the output of DescribeVolumeAttribute. type DescribeVolumeAttributeOutput struct { _ struct{} `type:"structure"` @@ -14809,6 +21484,7 @@ func (s DescribeVolumeAttributeOutput) GoString() string { return s.String() } +// Contains the parameters for DescribeVolumeStatus. type DescribeVolumeStatusInput struct { _ struct{} `type:"structure"` @@ -14820,34 +21496,34 @@ type DescribeVolumeStatusInput struct { // One or more filters. // - // action.code - The action code for the event (for example, enable-volume-io). + // action.code - The action code for the event (for example, enable-volume-io). // - // action.description - A description of the action. + // action.description - A description of the action. // - // action.event-id - The event ID associated with the action. + // action.event-id - The event ID associated with the action. // - // availability-zone - The Availability Zone of the instance. + // availability-zone - The Availability Zone of the instance. // - // event.description - A description of the event. + // event.description - A description of the event. // - // event.event-id - The event ID. + // event.event-id - The event ID. // - // event.event-type - The event type (for io-enabled: passed | failed; for + // 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-after - The latest end time for the event. // - // event.not-before - The earliest start 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 + // 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 + // 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 + // volume-status.status - The status of the volume (ok | impaired | warning // | insufficient-data). Filters []*Filter `locationName:"Filter" locationNameList:"Filter" type:"list"` @@ -14883,6 +21559,7 @@ func (s DescribeVolumeStatusInput) GoString() string { return s.String() } +// Contains the output of DescribeVolumeStatus. type DescribeVolumeStatusOutput struct { _ struct{} `type:"structure"` @@ -14904,6 +21581,7 @@ func (s DescribeVolumeStatusOutput) GoString() string { return s.String() } +// Contains the parameters for DescribeVolumes. type DescribeVolumesInput struct { _ struct{} `type:"structure"` @@ -14915,50 +21593,50 @@ type DescribeVolumesInput struct { // One or more filters. // - // attachment.attach-time - The time stamp when the attachment initiated. + // attachment.attach-time - The time stamp when the attachment initiated. // - // attachment.delete-on-termination - Whether the volume is deleted on instance + // attachment.delete-on-termination - Whether the volume is deleted on instance // termination. // - // attachment.device - The device name that is exposed to the instance (for + // 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 + // attachment.instance-id - The ID of the instance the volume is attached // to. // - // attachment.status - The attachment state (attaching | attached | detaching + // attachment.status - The attachment state (attaching | attached | detaching // | detached). // - // availability-zone - The Availability Zone in which the volume was created. + // availability-zone - The Availability Zone in which the volume was created. // - // create-time - The time stamp when the volume was created. + // create-time - The time stamp when the volume was created. // - // encrypted - The encryption status of the volume. + // encrypted - The encryption status of the volume. // - // size - The size of the volume, in GiB. + // size - The size of the volume, in GiB. // - // snapshot-id - The snapshot from which the volume was created. + // snapshot-id - The snapshot from which the volume was created. // - // status - The status of the volume (creating | available | in-use | deleting + // 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=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 + // 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. + // 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-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. + // volume-type - The Amazon EBS volume type. This can be gp2 for General + // Purpose SSD, io1 for Provisioned IOPS SSD, st1 for Throughput Optimized HDD, + // sc1 for Cold HDD, or standard for Magnetic volumes. Filters []*Filter `locationName:"Filter" locationNameList:"Filter" type:"list"` // The maximum number of volume results returned by DescribeVolumes in paginated @@ -14992,6 +21670,7 @@ func (s DescribeVolumesInput) GoString() string { return s.String() } +// Contains the output of DescribeVolumes. type DescribeVolumesOutput struct { _ struct{} `type:"structure"` @@ -15015,6 +21694,7 @@ func (s DescribeVolumesOutput) GoString() string { return s.String() } +// Contains the parameters for DescribeVpcAttribute. type DescribeVpcAttributeInput struct { _ struct{} `type:"structure"` @@ -15041,6 +21721,23 @@ func (s DescribeVpcAttributeInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *DescribeVpcAttributeInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DescribeVpcAttributeInput"} + if s.Attribute == nil { + invalidParams.Add(request.NewErrParamRequired("Attribute")) + } + if s.VpcId == nil { + invalidParams.Add(request.NewErrParamRequired("VpcId")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// Contains the output of DescribeVpcAttribute. type DescribeVpcAttributeOutput struct { _ struct{} `type:"structure"` @@ -15068,6 +21765,7 @@ func (s DescribeVpcAttributeOutput) GoString() string { return s.String() } +// Contains the parameters for DescribeVpcClassicLinkDnsSupport. type DescribeVpcClassicLinkDnsSupportInput struct { _ struct{} `type:"structure"` @@ -15094,6 +21792,23 @@ func (s DescribeVpcClassicLinkDnsSupportInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *DescribeVpcClassicLinkDnsSupportInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DescribeVpcClassicLinkDnsSupportInput"} + if s.MaxResults != nil && *s.MaxResults < 5 { + invalidParams.Add(request.NewErrParamMinValue("MaxResults", 5)) + } + if s.NextToken != nil && len(*s.NextToken) < 1 { + invalidParams.Add(request.NewErrParamMinLen("NextToken", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// Contains the output of DescribeVpcClassicLinkDnsSupport. type DescribeVpcClassicLinkDnsSupportOutput struct { _ struct{} `type:"structure"` @@ -15114,6 +21829,7 @@ func (s DescribeVpcClassicLinkDnsSupportOutput) GoString() string { return s.String() } +// Contains the parameters for DescribeVpcClassicLink. type DescribeVpcClassicLinkInput struct { _ struct{} `type:"structure"` @@ -15125,20 +21841,20 @@ type DescribeVpcClassicLinkInput struct { // One or more filters. // - // is-classic-link-enabled - Whether the VPC is enabled for ClassicLink (true - // | false). + // 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=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 + // 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. + // 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. @@ -15155,6 +21871,7 @@ func (s DescribeVpcClassicLinkInput) GoString() string { return s.String() } +// Contains the output of DescribeVpcClassicLink. type DescribeVpcClassicLinkOutput struct { _ struct{} `type:"structure"` @@ -15172,6 +21889,7 @@ func (s DescribeVpcClassicLinkOutput) GoString() string { return s.String() } +// Contains the parameters for DescribeVpcEndpointServices. type DescribeVpcEndpointServicesInput struct { _ struct{} `type:"structure"` @@ -15203,6 +21921,7 @@ func (s DescribeVpcEndpointServicesInput) GoString() string { return s.String() } +// Contains the output of DescribeVpcEndpointServices. type DescribeVpcEndpointServicesOutput struct { _ struct{} `type:"structure"` @@ -15224,6 +21943,7 @@ func (s DescribeVpcEndpointServicesOutput) GoString() string { return s.String() } +// Contains the parameters for DescribeVpcEndpoints. type DescribeVpcEndpointsInput struct { _ struct{} `type:"structure"` @@ -15235,13 +21955,13 @@ type DescribeVpcEndpointsInput struct { // One or more filters. // - // service-name: The name of the AWS service. + // service-name: The name of the AWS service. // - // vpc-id: The ID of the VPC in which the endpoint resides. + // vpc-id: The ID of the VPC in which the endpoint resides. // - // vpc-endpoint-id: The ID of the endpoint. + // vpc-endpoint-id: The ID of the endpoint. // - // vpc-endpoint-state: The state of the endpoint. (pending | available | + // vpc-endpoint-state: The state of the endpoint. (pending | available | // deleting | deleted) Filters []*Filter `locationName:"Filter" locationNameList:"Filter" type:"list"` @@ -15270,6 +21990,7 @@ func (s DescribeVpcEndpointsInput) GoString() string { return s.String() } +// Contains the output of DescribeVpcEndpoints. type DescribeVpcEndpointsOutput struct { _ struct{} `type:"structure"` @@ -15291,6 +22012,7 @@ func (s DescribeVpcEndpointsOutput) GoString() string { return s.String() } +// Contains the parameters for DescribeVpcPeeringConnections. type DescribeVpcPeeringConnectionsInput struct { _ struct{} `type:"structure"` @@ -15302,41 +22024,41 @@ type DescribeVpcPeeringConnectionsInput struct { // One or more filters. // - // accepter-vpc-info.cidr-block - The CIDR block of the peer VPC. + // 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 + // 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. + // accepter-vpc-info.vpc-id - The ID of the peer VPC. // - // expiration-time - The expiration date and time for the VPC peering connection. + // 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.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.owner-id - The AWS account ID of the owner of the + // requester VPC. // - // requester-vpc-info.vpc-id - The ID 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 + // 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 + // 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=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 + // 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. + // 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. + // 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. @@ -15355,6 +22077,7 @@ func (s DescribeVpcPeeringConnectionsInput) GoString() string { return s.String() } +// Contains the output of DescribeVpcPeeringConnections. type DescribeVpcPeeringConnectionsOutput struct { _ struct{} `type:"structure"` @@ -15372,6 +22095,7 @@ func (s DescribeVpcPeeringConnectionsOutput) GoString() string { return s.String() } +// Contains the parameters for DescribeVpcs. type DescribeVpcsInput struct { _ struct{} `type:"structure"` @@ -15383,29 +22107,29 @@ type DescribeVpcsInput struct { // One or more filters. // - // cidr - The CIDR block of the VPC. The CIDR block you specify must exactly + // 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. + // dhcp-options-id - The ID of a set of DHCP options. // - // isDefault - Indicates whether the VPC is the default VPC. + // isDefault - Indicates whether the VPC is the default VPC. // - // state - The state of the VPC (pending | available). + // state - The state of the VPC (pending | available). // - // tag:key=value - The key/value combination of a tag assigned to the resource. + // 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 + // 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. + // 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. + // vpc-id - The ID of the VPC. Filters []*Filter `locationName:"Filter" locationNameList:"Filter" type:"list"` // One or more VPC IDs. @@ -15424,6 +22148,7 @@ func (s DescribeVpcsInput) GoString() string { return s.String() } +// Contains the output of DescribeVpcs. type DescribeVpcsOutput struct { _ struct{} `type:"structure"` @@ -15441,6 +22166,7 @@ func (s DescribeVpcsOutput) GoString() string { return s.String() } +// Contains the parameters for DescribeVpnConnections. type DescribeVpnConnectionsInput struct { _ struct{} `type:"structure"` @@ -15452,44 +22178,44 @@ type DescribeVpnConnectionsInput struct { // One or more filters. // - // customer-gateway-configuration - The configuration information for the + // customer-gateway-configuration - The configuration information for the // customer gateway. // - // customer-gateway-id - The ID of a customer gateway associated with the + // customer-gateway-id - The ID of a customer gateway associated with the // VPN connection. // - // state - The state of the VPN connection (pending | available | deleting + // state - The state of the VPN connection (pending | available | deleting // | deleted). // - // option.static-routes-only - Indicates whether the connection has static + // 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 + // 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 + // 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=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 + // 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. + // 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. + // type - The type of VPN connection. Currently the only supported type + // is ipsec.1. // - // vpn-connection-id - The ID of the VPN connection. + // vpn-connection-id - The ID of the VPN connection. // - // vpn-gateway-id - The ID of a virtual private gateway associated with 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. @@ -15508,6 +22234,7 @@ func (s DescribeVpnConnectionsInput) GoString() string { return s.String() } +// Contains the output of DescribeVpnConnections. type DescribeVpnConnectionsOutput struct { _ struct{} `type:"structure"` @@ -15525,6 +22252,7 @@ func (s DescribeVpnConnectionsOutput) GoString() string { return s.String() } +// Contains the parameters for DescribeVpnGateways. type DescribeVpnGatewaysInput struct { _ struct{} `type:"structure"` @@ -15536,33 +22264,33 @@ type DescribeVpnGatewaysInput struct { // One or more filters. // - // attachment.state - The current state of the attachment between the gateway + // 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. + // attachment.vpc-id - The ID of an attached VPC. // - // availability-zone - The Availability Zone for the virtual private gateway + // availability-zone - The Availability Zone for the virtual private gateway // (if applicable). // - // state - The state of the virtual private gateway (pending | available + // 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=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 + // 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. + // 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 - The type of virtual private gateway. Currently the only supported // type is ipsec.1. // - // vpn-gateway-id - The ID of the virtual private gateway. + // 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. @@ -15581,6 +22309,7 @@ func (s DescribeVpnGatewaysInput) GoString() string { return s.String() } +// Contains the output of DescribeVpnGateways. type DescribeVpnGatewaysOutput struct { _ struct{} `type:"structure"` @@ -15598,6 +22327,7 @@ func (s DescribeVpnGatewaysOutput) GoString() string { return s.String() } +// Contains the parameters for DetachClassicLinkVpc. type DetachClassicLinkVpcInput struct { _ struct{} `type:"structure"` @@ -15624,6 +22354,23 @@ func (s DetachClassicLinkVpcInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *DetachClassicLinkVpcInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DetachClassicLinkVpcInput"} + if s.InstanceId == nil { + invalidParams.Add(request.NewErrParamRequired("InstanceId")) + } + if s.VpcId == nil { + invalidParams.Add(request.NewErrParamRequired("VpcId")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// Contains the output of DetachClassicLinkVpc. type DetachClassicLinkVpcOutput struct { _ struct{} `type:"structure"` @@ -15641,6 +22388,7 @@ func (s DetachClassicLinkVpcOutput) GoString() string { return s.String() } +// Contains the parameters for DetachInternetGateway. type DetachInternetGatewayInput struct { _ struct{} `type:"structure"` @@ -15667,6 +22415,22 @@ func (s DetachInternetGatewayInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *DetachInternetGatewayInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DetachInternetGatewayInput"} + if s.InternetGatewayId == nil { + invalidParams.Add(request.NewErrParamRequired("InternetGatewayId")) + } + if s.VpcId == nil { + invalidParams.Add(request.NewErrParamRequired("VpcId")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + type DetachInternetGatewayOutput struct { _ struct{} `type:"structure"` } @@ -15681,6 +22445,7 @@ func (s DetachInternetGatewayOutput) GoString() string { return s.String() } +// Contains the parameters for DetachNetworkInterface. type DetachNetworkInterfaceInput struct { _ struct{} `type:"structure"` @@ -15707,6 +22472,19 @@ func (s DetachNetworkInterfaceInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *DetachNetworkInterfaceInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DetachNetworkInterfaceInput"} + if s.AttachmentId == nil { + invalidParams.Add(request.NewErrParamRequired("AttachmentId")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + type DetachNetworkInterfaceOutput struct { _ struct{} `type:"structure"` } @@ -15721,6 +22499,7 @@ func (s DetachNetworkInterfaceOutput) GoString() string { return s.String() } +// Contains the parameters for DetachVolume. type DetachVolumeInput struct { _ struct{} `type:"structure"` @@ -15759,6 +22538,20 @@ func (s DetachVolumeInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *DetachVolumeInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DetachVolumeInput"} + if s.VolumeId == nil { + invalidParams.Add(request.NewErrParamRequired("VolumeId")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// Contains the parameters for DetachVpnGateway. type DetachVpnGatewayInput struct { _ struct{} `type:"structure"` @@ -15785,6 +22578,22 @@ func (s DetachVpnGatewayInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *DetachVpnGatewayInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DetachVpnGatewayInput"} + if s.VpcId == nil { + invalidParams.Add(request.NewErrParamRequired("VpcId")) + } + if s.VpnGatewayId == nil { + invalidParams.Add(request.NewErrParamRequired("VpnGatewayId")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + type DetachVpnGatewayOutput struct { _ struct{} `type:"structure"` } @@ -15844,6 +22653,7 @@ func (s DhcpOptions) GoString() string { return s.String() } +// Contains the parameters for DisableVgwRoutePropagation. type DisableVgwRoutePropagationInput struct { _ struct{} `type:"structure"` @@ -15864,6 +22674,22 @@ func (s DisableVgwRoutePropagationInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *DisableVgwRoutePropagationInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DisableVgwRoutePropagationInput"} + if s.GatewayId == nil { + invalidParams.Add(request.NewErrParamRequired("GatewayId")) + } + if s.RouteTableId == nil { + invalidParams.Add(request.NewErrParamRequired("RouteTableId")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + type DisableVgwRoutePropagationOutput struct { _ struct{} `type:"structure"` } @@ -15878,6 +22704,7 @@ func (s DisableVgwRoutePropagationOutput) GoString() string { return s.String() } +// Contains the parameters for DisableVpcClassicLinkDnsSupport. type DisableVpcClassicLinkDnsSupportInput struct { _ struct{} `type:"structure"` @@ -15895,6 +22722,7 @@ func (s DisableVpcClassicLinkDnsSupportInput) GoString() string { return s.String() } +// Contains the output of DisableVpcClassicLinkDnsSupport. type DisableVpcClassicLinkDnsSupportOutput struct { _ struct{} `type:"structure"` @@ -15912,6 +22740,7 @@ func (s DisableVpcClassicLinkDnsSupportOutput) GoString() string { return s.String() } +// Contains the parameters for DisableVpcClassicLink. type DisableVpcClassicLinkInput struct { _ struct{} `type:"structure"` @@ -15935,6 +22764,20 @@ func (s DisableVpcClassicLinkInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *DisableVpcClassicLinkInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DisableVpcClassicLinkInput"} + if s.VpcId == nil { + invalidParams.Add(request.NewErrParamRequired("VpcId")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// Contains the output of DisableVpcClassicLink. type DisableVpcClassicLinkOutput struct { _ struct{} `type:"structure"` @@ -15952,6 +22795,7 @@ func (s DisableVpcClassicLinkOutput) GoString() string { return s.String() } +// Contains the parameters for DisassociateAddress. type DisassociateAddressInput struct { _ struct{} `type:"structure"` @@ -15992,6 +22836,7 @@ func (s DisassociateAddressOutput) GoString() string { return s.String() } +// Contains the parameters for DisassociateRouteTable. type DisassociateRouteTableInput struct { _ struct{} `type:"structure"` @@ -16016,6 +22861,19 @@ func (s DisassociateRouteTableInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *DisassociateRouteTableInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DisassociateRouteTableInput"} + if s.AssociationId == nil { + invalidParams.Add(request.NewErrParamRequired("AssociationId")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + type DisassociateRouteTableOutput struct { _ struct{} `type:"structure"` } @@ -16054,6 +22912,26 @@ func (s DiskImage) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *DiskImage) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DiskImage"} + if s.Image != nil { + if err := s.Image.Validate(); err != nil { + invalidParams.AddNested("Image", err.(request.ErrInvalidParams)) + } + } + if s.Volume != nil { + if err := s.Volume.Validate(); err != nil { + invalidParams.AddNested("Volume", err.(request.ErrInvalidParams)) + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + // Describes a disk image. type DiskImageDescription struct { _ struct{} `type:"structure"` @@ -16069,6 +22947,9 @@ type DiskImageDescription struct { // Request Authentication Alternative" section of the Authenticating REST Requests // (http://docs.aws.amazon.com/AmazonS3/latest/dev/RESTAuthentication.html) // topic in the Amazon Simple Storage Service Developer Guide. + // + // For information about the import manifest referenced by this API action, + // see VM Import Manifest (http://docs.aws.amazon.com/AWSEC2/latest/APIReference/manifest.html). ImportManifestUrl *string `locationName:"importManifestUrl" type:"string" required:"true"` // The size of the disk image, in GiB. @@ -16100,6 +22981,9 @@ type DiskImageDetail struct { // URL for an Amazon S3 object, read the "Query String Request Authentication // Alternative" section of the Authenticating REST Requests (http://docs.aws.amazon.com/AmazonS3/latest/dev/RESTAuthentication.html) // topic in the Amazon Simple Storage Service Developer Guide. + // + // For information about the import manifest referenced by this API action, + // see VM Import Manifest (http://docs.aws.amazon.com/AWSEC2/latest/APIReference/manifest.html). ImportManifestUrl *string `locationName:"importManifestUrl" type:"string" required:"true"` } @@ -16113,6 +22997,25 @@ func (s DiskImageDetail) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *DiskImageDetail) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DiskImageDetail"} + if s.Bytes == nil { + invalidParams.Add(request.NewErrParamRequired("Bytes")) + } + if s.Format == nil { + invalidParams.Add(request.NewErrParamRequired("Format")) + } + if s.ImportManifestUrl == nil { + invalidParams.Add(request.NewErrParamRequired("ImportManifestUrl")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + // Describes a disk image volume. type DiskImageVolumeDescription struct { _ struct{} `type:"structure"` @@ -16146,18 +23049,18 @@ type EbsBlockDevice struct { 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) + // For io1, this represents the number of IOPS that are provisioned for the + // volume. For gp2, this represents the baseline performance of the volume and + // the rate at which the volume accumulates I/O credits for bursting. For more + // information about General Purpose SSD baseline performance, I/O credits, + // and bursting, see Amazon EBS Volume Types (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSVolumeTypes.html) // in the Amazon Elastic Compute Cloud User Guide. // - // Constraint: Range is 100 to 20000 for Provisioned IOPS (SSD) volumes and - // 3 to 10000 for General Purpose (SSD) volumes. + // Constraint: Range is 100-20000 IOPS for io1 volumes and 100-10000 IOPS for + // gp2 volumes. // // Condition: This parameter is required for requests to create io1 volumes; - // it is not used in requests to create standard or gp2 volumes. + // it is not used in requests to create gp2, st1, sc1, or standard volumes. Iops *int64 `locationName:"iops" type:"integer"` // The ID of the snapshot. @@ -16165,16 +23068,17 @@ type EbsBlockDevice struct { // 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. + // Constraints: 1-16384 for General Purpose SSD (gp2), 4-16384 for Provisioned + // IOPS SSD (io1), 500-16384 for Throughput Optimized HDD (st1), 500-16384 for + // Cold HDD (sc1), and 1-1024 for Magnetic (standard) 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. + // The volume type: gp2, io1, st1, sc1, or standard. // // Default: standard VolumeType *string `locationName:"volumeType" type:"string" enum:"VolumeType"` @@ -16217,6 +23121,8 @@ func (s EbsInstanceBlockDevice) GoString() string { return s.String() } +// Describes information used to set up an EBS volume specified in a block device +// mapping. type EbsInstanceBlockDeviceSpecification struct { _ struct{} `type:"structure"` @@ -16237,6 +23143,7 @@ func (s EbsInstanceBlockDeviceSpecification) GoString() string { return s.String() } +// Contains the parameters for EnableVgwRoutePropagation. type EnableVgwRoutePropagationInput struct { _ struct{} `type:"structure"` @@ -16257,6 +23164,22 @@ func (s EnableVgwRoutePropagationInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *EnableVgwRoutePropagationInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "EnableVgwRoutePropagationInput"} + if s.GatewayId == nil { + invalidParams.Add(request.NewErrParamRequired("GatewayId")) + } + if s.RouteTableId == nil { + invalidParams.Add(request.NewErrParamRequired("RouteTableId")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + type EnableVgwRoutePropagationOutput struct { _ struct{} `type:"structure"` } @@ -16271,6 +23194,7 @@ func (s EnableVgwRoutePropagationOutput) GoString() string { return s.String() } +// Contains the parameters for EnableVolumeIO. type EnableVolumeIOInput struct { _ struct{} `type:"structure"` @@ -16294,6 +23218,19 @@ func (s EnableVolumeIOInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *EnableVolumeIOInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "EnableVolumeIOInput"} + if s.VolumeId == nil { + invalidParams.Add(request.NewErrParamRequired("VolumeId")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + type EnableVolumeIOOutput struct { _ struct{} `type:"structure"` } @@ -16308,6 +23245,7 @@ func (s EnableVolumeIOOutput) GoString() string { return s.String() } +// Contains the parameters for EnableVpcClassicLinkDnsSupport. type EnableVpcClassicLinkDnsSupportInput struct { _ struct{} `type:"structure"` @@ -16325,6 +23263,7 @@ func (s EnableVpcClassicLinkDnsSupportInput) GoString() string { return s.String() } +// Contains the output of EnableVpcClassicLinkDnsSupport. type EnableVpcClassicLinkDnsSupportOutput struct { _ struct{} `type:"structure"` @@ -16342,6 +23281,7 @@ func (s EnableVpcClassicLinkDnsSupportOutput) GoString() string { return s.String() } +// Contains the parameters for EnableVpcClassicLink. type EnableVpcClassicLinkInput struct { _ struct{} `type:"structure"` @@ -16365,6 +23305,20 @@ func (s EnableVpcClassicLinkInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *EnableVpcClassicLinkInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "EnableVpcClassicLinkInput"} + if s.VpcId == nil { + invalidParams.Add(request.NewErrParamRequired("VpcId")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// Contains the output of EnableVpcClassicLink. type EnableVpcClassicLinkOutput struct { _ struct{} `type:"structure"` @@ -16393,54 +23347,54 @@ type EventInformation struct { // // The following are the error events. // - // iamFleetRoleInvalid - The Spot fleet did not have the required permissions + // iamFleetRoleInvalid - The Spot fleet did not have the required permissions // either to launch or terminate an instance. // - // launchSpecTemporarilyBlacklisted - The configuration is not valid and + // launchSpecTemporarilyBlacklisted - The configuration is not valid and // several attempts to launch instances have failed. For more information, see // the description of the event. // - // spotFleetRequestConfigurationInvalid - The configuration is not valid. + // spotFleetRequestConfigurationInvalid - The configuration is not valid. // For more information, see the description of the event. // - // spotInstanceCountLimitExceeded - You've reached the limit on the number + // spotInstanceCountLimitExceeded - You've reached the limit on the number // of Spot instances that you can launch. // // The following are the fleetRequestChange events. // - // active - The Spot fleet has been validated and Amazon EC2 is attempting + // active - The Spot fleet has been validated and Amazon EC2 is attempting // to maintain the target number of running Spot instances. // - // cancelled - The Spot fleet is canceled and has no running Spot instances. + // cancelled - The Spot fleet is canceled and has no running Spot instances. // The Spot fleet will be deleted two days after its instances were terminated. // - // cancelled_running - The Spot fleet is canceled and will not launch additional + // cancelled_running - The Spot fleet is canceled and will not launch additional // Spot instances, but its existing Spot instances continue to run until they // are interrupted or terminated. // - // cancelled_terminating - The Spot fleet is canceled and its Spot instances + // cancelled_terminating - The Spot fleet is canceled and its Spot instances // are terminating. // - // expired - The Spot fleet request has expired. A subsequent event indicates + // expired - The Spot fleet request has expired. A subsequent event indicates // that the instances were terminated, if the request was created with TerminateInstancesWithExpiration // set. // - // modify_in_progress - A request to modify the Spot fleet request was accepted + // modify_in_progress - A request to modify the Spot fleet request was accepted // and is in progress. // - // modify_successful - The Spot fleet request was modified. + // modify_successful - The Spot fleet request was modified. // - // price_update - The bid price for a launch configuration was adjusted because - // it was too high. This change is permanent. + // price_update - The bid price for a launch configuration was adjusted + // because it was too high. This change is permanent. // - // submitted - The Spot fleet request is being evaluated and Amazon EC2 is - // preparing to launch the target number of Spot instances. + // submitted - The Spot fleet request is being evaluated and Amazon EC2 + // is preparing to launch the target number of Spot instances. // // The following are the instanceChange events. // - // launched - A bid was fulfilled and a new instance was launched. + // launched - A bid was fulfilled and a new instance was launched. // - // terminated - An instance was terminated by the user. + // terminated - An instance was terminated by the user. EventSubType *string `locationName:"eventSubType" type:"string"` // The ID of the instance. This information is available only for instanceChange @@ -16620,6 +23574,7 @@ func (s FlowLog) GoString() string { return s.String() } +// Contains the parameters for GetConsoleOutput. type GetConsoleOutputInput struct { _ struct{} `type:"structure"` @@ -16643,14 +23598,28 @@ func (s GetConsoleOutputInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *GetConsoleOutputInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "GetConsoleOutputInput"} + if s.InstanceId == nil { + invalidParams.Add(request.NewErrParamRequired("InstanceId")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// Contains the output of GetConsoleOutput. type GetConsoleOutputOutput struct { _ struct{} `type:"structure"` // The ID of the instance. InstanceId *string `locationName:"instanceId" type:"string"` - // The console output, Base64 encoded. If using a command line tool, the tools - // decode the output for you. + // The console output, Base64-encoded. If using a command line tool, the tool + // decodes the output for you. Output *string `locationName:"output" type:"string"` // The time the output was last updated. @@ -16667,6 +23636,134 @@ func (s GetConsoleOutputOutput) GoString() string { return s.String() } +// Contains the parameters for the request. +type GetConsoleScreenshotInput struct { + _ struct{} `type:"structure"` + + // Checks whether you have the required permissions for the action, without + // actually making the request, and provides an error response. If you have + // the required permissions, the error response is DryRunOperation. Otherwise, + // it is UnauthorizedOperation. + DryRun *bool `type:"boolean"` + + // The ID of the instance. + InstanceId *string `type:"string" required:"true"` + + // When set to true, acts as keystroke input and wakes up an instance that's + // in standby or "sleep" mode. + WakeUp *bool `type:"boolean"` +} + +// String returns the string representation +func (s GetConsoleScreenshotInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s GetConsoleScreenshotInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *GetConsoleScreenshotInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "GetConsoleScreenshotInput"} + if s.InstanceId == nil { + invalidParams.Add(request.NewErrParamRequired("InstanceId")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// Contains the output of the request. +type GetConsoleScreenshotOutput struct { + _ struct{} `type:"structure"` + + // The data that comprises the image. + ImageData *string `locationName:"imageData" type:"string"` + + // The ID of the instance. + InstanceId *string `locationName:"instanceId" type:"string"` +} + +// String returns the string representation +func (s GetConsoleScreenshotOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s GetConsoleScreenshotOutput) GoString() string { + return s.String() +} + +type GetHostReservationPurchasePreviewInput struct { + _ struct{} `type:"structure"` + + // The ID/s of the Dedicated Host/s that the reservation will be associated + // with. + HostIdSet []*string `locationNameList:"item" type:"list" required:"true"` + + // The offering ID of the reservation. + OfferingId *string `type:"string" required:"true"` +} + +// String returns the string representation +func (s GetHostReservationPurchasePreviewInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s GetHostReservationPurchasePreviewInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *GetHostReservationPurchasePreviewInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "GetHostReservationPurchasePreviewInput"} + if s.HostIdSet == nil { + invalidParams.Add(request.NewErrParamRequired("HostIdSet")) + } + if s.OfferingId == nil { + invalidParams.Add(request.NewErrParamRequired("OfferingId")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +type GetHostReservationPurchasePreviewOutput struct { + _ struct{} `type:"structure"` + + // The currency in which the totalUpfrontPrice and totalHourlyPrice amounts + // are specified. At this time, the only supported currency is USD. + CurrencyCode *string `locationName:"currencyCode" type:"string" enum:"CurrencyCodeValues"` + + // The purchase information of the Dedicated Host Reservation and the Dedicated + // Hosts associated with it. + Purchase []*Purchase `locationName:"purchase" type:"list"` + + // The potential total hourly price of the reservation per hour. + TotalHourlyPrice *string `locationName:"totalHourlyPrice" type:"string"` + + // The potential total upfront price. This is billed immediately. + TotalUpfrontPrice *string `locationName:"totalUpfrontPrice" type:"string"` +} + +// String returns the string representation +func (s GetHostReservationPurchasePreviewOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s GetHostReservationPurchasePreviewOutput) GoString() string { + return s.String() +} + +// Contains the parameters for GetPasswordData. type GetPasswordDataInput struct { _ struct{} `type:"structure"` @@ -16690,6 +23787,20 @@ func (s GetPasswordDataInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *GetPasswordDataInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "GetPasswordDataInput"} + if s.InstanceId == nil { + invalidParams.Add(request.NewErrParamRequired("InstanceId")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// Contains the output of GetPasswordData. type GetPasswordDataOutput struct { _ struct{} `type:"structure"` @@ -16743,12 +23854,12 @@ type HistoryRecord struct { // The event type. // - // error - Indicates an error with the Spot fleet request. + // error - Indicates an error with the Spot fleet request. // - // fleetRequestChange - Indicates a change in the status or configuration + // fleetRequestChange - Indicates a change in the status or configuration // of the Spot fleet request. // - // instanceChange - Indicates that an instance was launched or terminated. + // instanceChange - Indicates that an instance was launched or terminated. EventType *string `locationName:"eventType" type:"string" required:"true" enum:"EventType"` // The date and time of the event, in UTC format (for example, YYYY-MM-DDTHH:MM:SSZ). @@ -16765,17 +23876,17 @@ func (s HistoryRecord) GoString() string { return s.String() } -// Describes the properties of the Dedicated host. +// Describes the properties of the Dedicated Host. type Host struct { _ struct{} `type:"structure"` // Whether auto-placement is on or off. AutoPlacement *string `locationName:"autoPlacement" type:"string" enum:"AutoPlacement"` - // The Availability Zone of the Dedicated host. + // The Availability Zone of the Dedicated Host. AvailabilityZone *string `locationName:"availabilityZone" type:"string"` - // The number of new instances that can be launched onto the Dedicated host. + // The number of new instances that can be launched onto the Dedicated Host. AvailableCapacity *AvailableCapacity `locationName:"availableCapacity" type:"structure"` // Unique, case-sensitive identifier you provide to ensure idempotency of the @@ -16783,20 +23894,20 @@ type Host struct { // in the Amazon Elastic Compute Cloud User Guide. ClientToken *string `locationName:"clientToken" type:"string"` - // The ID of the Dedicated host. + // The ID of the Dedicated Host. HostId *string `locationName:"hostId" type:"string"` - // The hardware specifications of the Dedicated host. + // The hardware specifications of the Dedicated Host. HostProperties *HostProperties `locationName:"hostProperties" type:"structure"` - // The reservation ID of the Dedicated host. This returns a null response if - // the Dedicated host doesn't have an associated reservation. + // The reservation ID of the Dedicated Host. This returns a null response if + // the Dedicated Host doesn't have an associated reservation. HostReservationId *string `locationName:"hostReservationId" type:"string"` - // The IDs and instance type that are currently running on the Dedicated host. + // The IDs and instance type that are currently running on the Dedicated Host. Instances []*HostInstance `locationName:"instances" locationNameList:"item" type:"list"` - // The Dedicated host's state. + // The Dedicated Host's state. State *string `locationName:"state" type:"string" enum:"AllocationState"` } @@ -16810,13 +23921,14 @@ func (s Host) GoString() string { return s.String() } +// Describes an instance running on a Dedicated Host. type HostInstance struct { _ struct{} `type:"structure"` - // the IDs of instances that are running on the Dedicated host. + // the IDs of instances that are running on the Dedicated Host. InstanceId *string `locationName:"instanceId" type:"string"` - // The instance type size (e.g., m3.medium) of the running instance. + // The instance type size (for example, m3.medium) of the running instance. InstanceType *string `locationName:"instanceType" type:"string"` } @@ -16830,19 +23942,56 @@ func (s HostInstance) GoString() string { return s.String() } +// Details about the Dedicated Host Reservation offering. +type HostOffering struct { + _ struct{} `type:"structure"` + + // The currency of the offering. + CurrencyCode *string `locationName:"currencyCode" type:"string" enum:"CurrencyCodeValues"` + + // The duration of the offering (in seconds). + Duration *int64 `locationName:"duration" type:"integer"` + + // The hourly price of the offering. + HourlyPrice *string `locationName:"hourlyPrice" type:"string"` + + // The instance family that the offering covers. + InstanceFamily *string `locationName:"instanceFamily" type:"string"` + + // The ID of the offering. + OfferingId *string `locationName:"offeringId" type:"string"` + + // The available payment option. + PaymentOption *string `locationName:"paymentOption" type:"string" enum:"PaymentOption"` + + // The upfront price of the offering. Does not apply to No Upfront offerings. + UpfrontPrice *string `locationName:"upfrontPrice" type:"string"` +} + +// String returns the string representation +func (s HostOffering) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s HostOffering) GoString() string { + return s.String() +} + +// Describes properties of a Dedicated Host. type HostProperties struct { _ struct{} `type:"structure"` - // The number of cores on the Dedicated host. + // The number of cores on the Dedicated Host. Cores *int64 `locationName:"cores" type:"integer"` - // The instance type size that the Dedicated host supports (e.g., m3.medium). + // The instance type size that the Dedicated Host supports (for example, m3.medium). InstanceType *string `locationName:"instanceType" type:"string"` - // The number of sockets on the Dedicated host. + // The number of sockets on the Dedicated Host. Sockets *int64 `locationName:"sockets" type:"integer"` - // The number of vCPUs on the Dedicated host. + // The number of vCPUs on the Dedicated Host. TotalVCpus *int64 `locationName:"totalVCpus" type:"integer"` } @@ -16856,6 +24005,65 @@ func (s HostProperties) GoString() string { return s.String() } +// Details about the Dedicated Host Reservation and associated Dedicated Hosts. +type HostReservation struct { + _ struct{} `type:"structure"` + + // The number of Dedicated Hosts the reservation is associated with. + Count *int64 `locationName:"count" type:"integer"` + + // The currency in which the upfrontPrice and hourlyPrice amounts are specified. + // At this time, the only supported currency is USD. + CurrencyCode *string `locationName:"currencyCode" type:"string" enum:"CurrencyCodeValues"` + + // The length of the reservation's term, specified in seconds. Can be 31536000 + // (1 year) | 94608000 (3 years) | 157680000 (5 years). + Duration *int64 `locationName:"duration" type:"integer"` + + // The date and time that the reservation ends. + End *time.Time `locationName:"end" type:"timestamp" timestampFormat:"iso8601"` + + // The IDs of the Dedicated Hosts associated with the reservation. + HostIdSet []*string `locationName:"hostIdSet" locationNameList:"item" type:"list"` + + // The ID of the reservation that specifies the associated Dedicated Hosts. + HostReservationId *string `locationName:"hostReservationId" type:"string"` + + // The hourly price of the reservation. + HourlyPrice *string `locationName:"hourlyPrice" type:"string"` + + // The instance family of the Dedicated Host Reservation. The instance family + // on the Dedicated Host must be the same in order for it to benefit from the + // reservation. + InstanceFamily *string `locationName:"instanceFamily" type:"string"` + + // The ID of the reservation. This remains the same regardless of which Dedicated + // Hosts are associated with it. + OfferingId *string `locationName:"offeringId" type:"string"` + + // The payment option selected for this reservation. + PaymentOption *string `locationName:"paymentOption" type:"string" enum:"PaymentOption"` + + // The date and time that the reservation started. + Start *time.Time `locationName:"start" type:"timestamp" timestampFormat:"iso8601"` + + // The state of the reservation. + State *string `locationName:"state" type:"string" enum:"ReservationState"` + + // The upfront price of the reservation. + UpfrontPrice *string `locationName:"upfrontPrice" type:"string"` +} + +// String returns the string representation +func (s HostReservation) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s HostReservation) GoString() string { + return s.String() +} + // Describes an IAM instance profile. type IamInstanceProfile struct { _ struct{} `type:"structure"` @@ -16924,7 +24132,8 @@ type IdFormat struct { _ struct{} `type:"structure"` // The date in UTC at which you are permanently switched over to using longer - // IDs. + // IDs. If a deadline is not yet available for this resource type, this field + // is not returned. Deadline *time.Time `locationName:"deadline" type:"timestamp" timestampFormat:"iso8601"` // The type of resource. @@ -16960,6 +24169,9 @@ type Image struct { // The description of the AMI that was provided during image creation. Description *string `locationName:"description" type:"string"` + // Specifies whether enhanced networking with ENA is enabled. + EnaSupport *bool `locationName:"enaSupport" type:"boolean"` + // The hypervisor type of the image. Hypervisor *string `locationName:"hypervisor" type:"string" enum:"HypervisorType"` @@ -17008,7 +24220,8 @@ type Image struct { // an instance store volume. RootDeviceType *string `locationName:"rootDeviceType" type:"string" enum:"DeviceType"` - // Specifies whether enhanced networking is enabled. + // Specifies whether enhanced networking with the Intel 82599 Virtual Function + // interface is enabled. SriovNetSupport *string `locationName:"sriovNetSupport" type:"string"` // The current state of the AMI. If the state is available, the image is successfully @@ -17071,6 +24284,7 @@ func (s ImageDiskContainer) GoString() string { return s.String() } +// Contains the parameters for ImportImage. type ImportImageInput struct { _ struct{} `type:"structure"` @@ -17104,10 +24318,10 @@ type ImportImageInput struct { // The license type to be used for the Amazon Machine Image (AMI) after importing. // - // Note: You may only use BYOL if you have existing licenses with rights to + // 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. + // see Prerequisites (http://docs.aws.amazon.com/vm-import/latest/userguide/vmimport-image-import.html#prerequisites-image) + // in the VM Import/Export User Guide. // // Valid values: AWS | BYOL LicenseType *string `type:"string"` @@ -17131,6 +24345,7 @@ func (s ImportImageInput) GoString() string { return s.String() } +// Contains the output for ImportImage. type ImportImageOutput struct { _ struct{} `type:"structure"` @@ -17230,6 +24445,7 @@ func (s ImportImageTask) GoString() string { return s.String() } +// Contains the parameters for ImportInstance. type ImportInstanceInput struct { _ struct{} `type:"structure"` @@ -17262,6 +24478,29 @@ func (s ImportInstanceInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *ImportInstanceInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "ImportInstanceInput"} + if s.Platform == nil { + invalidParams.Add(request.NewErrParamRequired("Platform")) + } + if s.DiskImages != nil { + for i, v := range s.DiskImages { + if v == nil { + continue + } + if err := v.Validate(); err != nil { + invalidParams.AddNested(fmt.Sprintf("%s[%v]", "DiskImages", i), err.(request.ErrInvalidParams)) + } + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + // Describes the launch specification for VM import. type ImportInstanceLaunchSpecification struct { _ struct{} `type:"structure"` @@ -17283,8 +24522,8 @@ type ImportInstanceLaunchSpecification struct { InstanceInitiatedShutdownBehavior *string `locationName:"instanceInitiatedShutdownBehavior" type:"string" enum:"ShutdownBehavior"` // The instance type. For more information about the instance types that 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. + // can import, see Instance Types (http://docs.aws.amazon.com/vm-import/latest/userguide/vmimport-image-import.html#vmimport-instance-types) + // in the VM Import/Export User Guide. InstanceType *string `locationName:"instanceType" type:"string" enum:"InstanceType"` // Indicates whether monitoring is enabled. @@ -17299,7 +24538,9 @@ type ImportInstanceLaunchSpecification struct { // [EC2-VPC] The ID of the subnet in which to launch the instance. SubnetId *string `locationName:"subnetId" type:"string"` - // The Base64-encoded MIME user data to be made available to the instance. + // The user data to make available to the instance. If you are using an AWS + // SDK or command line tool, Base64-encoding is performed for you, and you can + // load the text from a file. Otherwise, you must provide Base64-encoded text. UserData *UserData `locationName:"userData" type:"structure"` } @@ -17313,6 +24554,7 @@ func (s ImportInstanceLaunchSpecification) GoString() string { return s.String() } +// Contains the output for ImportInstance. type ImportInstanceOutput struct { _ struct{} `type:"structure"` @@ -17393,6 +24635,7 @@ func (s ImportInstanceVolumeDetailItem) GoString() string { return s.String() } +// Contains the parameters for ImportKeyPair. type ImportKeyPairInput struct { _ struct{} `type:"structure"` @@ -17405,8 +24648,10 @@ type ImportKeyPairInput struct { // 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. + // The public key. For API calls, the text must be base64-encoded. For command + // line tools, base64 encoding is performed for you. + // + // PublicKeyMaterial is automatically base64 encoded/decoded by the SDK. PublicKeyMaterial []byte `locationName:"publicKeyMaterial" type:"blob" required:"true"` } @@ -17420,6 +24665,23 @@ func (s ImportKeyPairInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *ImportKeyPairInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "ImportKeyPairInput"} + if s.KeyName == nil { + invalidParams.Add(request.NewErrParamRequired("KeyName")) + } + if s.PublicKeyMaterial == nil { + invalidParams.Add(request.NewErrParamRequired("PublicKeyMaterial")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// Contains the output of ImportKeyPair. type ImportKeyPairOutput struct { _ struct{} `type:"structure"` @@ -17440,6 +24702,7 @@ func (s ImportKeyPairOutput) GoString() string { return s.String() } +// Contains the parameters for ImportSnapshot. type ImportSnapshotInput struct { _ struct{} `type:"structure"` @@ -17475,6 +24738,7 @@ func (s ImportSnapshotInput) GoString() string { return s.String() } +// Contains the output for ImportSnapshot. type ImportSnapshotOutput struct { _ struct{} `type:"structure"` @@ -17522,6 +24786,7 @@ func (s ImportSnapshotTask) GoString() string { return s.String() } +// Contains the parameters for ImportVolume. type ImportVolumeInput struct { _ struct{} `type:"structure"` @@ -17554,6 +24819,36 @@ func (s ImportVolumeInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *ImportVolumeInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "ImportVolumeInput"} + if s.AvailabilityZone == nil { + invalidParams.Add(request.NewErrParamRequired("AvailabilityZone")) + } + if s.Image == nil { + invalidParams.Add(request.NewErrParamRequired("Image")) + } + if s.Volume == nil { + invalidParams.Add(request.NewErrParamRequired("Volume")) + } + if s.Image != nil { + if err := s.Image.Validate(); err != nil { + invalidParams.AddNested("Image", err.(request.ErrInvalidParams)) + } + } + if s.Volume != nil { + if err := s.Volume.Validate(); err != nil { + invalidParams.AddNested("Volume", err.(request.ErrInvalidParams)) + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// Contains the output for ImportVolume. type ImportVolumeOutput struct { _ struct{} `type:"structure"` @@ -17625,6 +24920,9 @@ type Instance struct { // Optimized instance. EbsOptimized *bool `locationName:"ebsOptimized" type:"boolean"` + // Specifies whether enhanced networking with ENA is enabled. + EnaSupport *bool `locationName:"enaSupport" type:"boolean"` + // The hypervisor type of the instance. Hypervisor *string `locationName:"hypervisor" type:"string" enum:"HypervisorType"` @@ -17637,7 +24935,7 @@ type Instance struct { // The ID of the instance. InstanceId *string `locationName:"instanceId" type:"string"` - // Indicates whether this is a Spot instance. + // Indicates whether this is a Spot instance or a Scheduled Instance. InstanceLifecycle *string `locationName:"instanceLifecycle" type:"string" enum:"InstanceLifecycleType"` // The instance type. @@ -17709,7 +25007,8 @@ type Instance struct { // If the request is a Spot instance request, the ID of the request. SpotInstanceRequestId *string `locationName:"spotInstanceRequestId" type:"string"` - // Specifies whether enhanced networking is enabled. + // Specifies whether enhanced networking with the Intel 82599 Virtual Function + // interface is enabled. SriovNetSupport *string `locationName:"sriovNetSupport" type:"string"` // The current state of the instance. @@ -17794,17 +25093,17 @@ func (s InstanceBlockDeviceMappingSpecification) GoString() string { return s.String() } -// Information about the instance type that the Dedicated host supports. +// Information about the instance type that the Dedicated Host supports. type InstanceCapacity struct { _ struct{} `type:"structure"` - // The number of instances that can still be launched onto the Dedicated host. + // The number of instances that can still be launched onto the Dedicated Host. AvailableCapacity *int64 `locationName:"availableCapacity" type:"integer"` - // The instance type size supported by the Dedicated host. + // The instance type size supported by the Dedicated Host. InstanceType *string `locationName:"instanceType" type:"string"` - // The total number of instances that can be launched onto the Dedicated host. + // The total number of instances that can be launched onto the Dedicated Host. TotalCapacity *int64 `locationName:"totalCapacity" type:"integer"` } @@ -18053,6 +25352,26 @@ func (s InstanceNetworkInterfaceSpecification) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *InstanceNetworkInterfaceSpecification) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "InstanceNetworkInterfaceSpecification"} + if s.PrivateIpAddresses != nil { + for i, v := range s.PrivateIpAddresses { + if v == nil { + continue + } + if err := v.Validate(); err != nil { + invalidParams.AddNested(fmt.Sprintf("%s[%v]", "PrivateIpAddresses", i), err.(request.ErrInvalidParams)) + } + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + // Describes a private IP address. type InstancePrivateIpAddress struct { _ struct{} `type:"structure"` @@ -18088,17 +25407,17 @@ type InstanceState struct { // The low byte represents the state. The high byte is an opaque internal value // and should be ignored. // - // 0 : pending + // 0 : pending // - // 16 : running + // 16 : running // - // 32 : shutting-down + // 32 : shutting-down // - // 48 : terminated + // 48 : terminated // - // 64 : stopping + // 64 : stopping // - // 80 : stopped + // 80 : stopped Code *int64 `locationName:"code" type:"integer"` // The current state of the instance. @@ -18434,6 +25753,9 @@ type LaunchSpecification struct { AddressingType *string `locationName:"addressingType" type:"string"` // One or more block device mapping entries. + // + // Although you can specify encrypted EBS volumes in this block device mapping + // for your Spot Instances, these volumes are not encrypted. BlockDeviceMappings []*BlockDeviceMapping `locationName:"blockDeviceMapping" locationNameList:"item" type:"list"` // Indicates whether the instance is optimized for EBS I/O. This optimization @@ -18480,7 +25802,9 @@ type LaunchSpecification struct { // 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. + // The user data to make available to the instances. If you are using an AWS + // SDK or command line tool, Base64-encoding is performed for you, and you can + // load the text from a file. Otherwise, you must provide Base64-encoded text. UserData *string `locationName:"userData" type:"string"` } @@ -18494,13 +25818,14 @@ func (s LaunchSpecification) GoString() string { return s.String() } +// Contains the parameters for ModifyHosts. type ModifyHostsInput struct { _ struct{} `type:"structure"` // Specify whether to enable or disable auto-placement. AutoPlacement *string `locationName:"autoPlacement" type:"string" required:"true" enum:"AutoPlacement"` - // The host IDs of the Dedicated hosts you want to modify. + // The host IDs of the Dedicated Hosts you want to modify. HostIds []*string `locationName:"hostId" locationNameList:"item" type:"list" required:"true"` } @@ -18514,13 +25839,30 @@ func (s ModifyHostsInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *ModifyHostsInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "ModifyHostsInput"} + if s.AutoPlacement == nil { + invalidParams.Add(request.NewErrParamRequired("AutoPlacement")) + } + if s.HostIds == nil { + invalidParams.Add(request.NewErrParamRequired("HostIds")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// Contains the output of ModifyHosts. type ModifyHostsOutput struct { _ struct{} `type:"structure"` - // The IDs of the Dedicated hosts that were successfully modified. + // The IDs of the Dedicated Hosts that were successfully modified. Successful []*string `locationName:"successful" locationNameList:"item" type:"list"` - // The IDs of the Dedicated hosts that could not be modified. Check whether + // The IDs of the Dedicated Hosts that could not be modified. Check whether // the setting you requested can be used. Unsuccessful []*UnsuccessfulItem `locationName:"unsuccessful" locationNameList:"item" type:"list"` } @@ -18535,10 +25877,11 @@ func (s ModifyHostsOutput) GoString() string { return s.String() } +// Contains the parameters of ModifyIdFormat. type ModifyIdFormatInput struct { _ struct{} `type:"structure"` - // The type of resource. + // The type of resource: instance | reservation | snapshot | volume Resource *string `type:"string" required:"true"` // Indicate whether the resource should use longer IDs (17-character IDs). @@ -18555,6 +25898,22 @@ func (s ModifyIdFormatInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *ModifyIdFormatInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "ModifyIdFormatInput"} + if s.Resource == nil { + invalidParams.Add(request.NewErrParamRequired("Resource")) + } + if s.UseLongIds == nil { + invalidParams.Add(request.NewErrParamRequired("UseLongIds")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + type ModifyIdFormatOutput struct { _ struct{} `type:"structure"` } @@ -18569,6 +25928,65 @@ func (s ModifyIdFormatOutput) GoString() string { return s.String() } +// Contains the parameters of ModifyIdentityIdFormat. +type ModifyIdentityIdFormatInput struct { + _ struct{} `type:"structure"` + + // The ARN of the principal, which can be an IAM user, IAM role, or the root + // user. + PrincipalArn *string `locationName:"principalArn" type:"string" required:"true"` + + // The type of resource: instance | reservation | snapshot | volume + Resource *string `locationName:"resource" type:"string" required:"true"` + + // Indicates whether the resource should use longer IDs (17-character IDs) + UseLongIds *bool `locationName:"useLongIds" type:"boolean" required:"true"` +} + +// String returns the string representation +func (s ModifyIdentityIdFormatInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ModifyIdentityIdFormatInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *ModifyIdentityIdFormatInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "ModifyIdentityIdFormatInput"} + if s.PrincipalArn == nil { + invalidParams.Add(request.NewErrParamRequired("PrincipalArn")) + } + if s.Resource == nil { + invalidParams.Add(request.NewErrParamRequired("Resource")) + } + if s.UseLongIds == nil { + invalidParams.Add(request.NewErrParamRequired("UseLongIds")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +type ModifyIdentityIdFormatOutput struct { + _ struct{} `type:"structure"` +} + +// String returns the string representation +func (s ModifyIdentityIdFormatOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ModifyIdentityIdFormatOutput) GoString() string { + return s.String() +} + +// Contains the parameters for ModifyImageAttribute. type ModifyImageAttributeInput struct { _ struct{} `type:"structure"` @@ -18620,6 +26038,19 @@ func (s ModifyImageAttributeInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *ModifyImageAttributeInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "ModifyImageAttributeInput"} + if s.ImageId == nil { + invalidParams.Add(request.NewErrParamRequired("ImageId")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + type ModifyImageAttributeOutput struct { _ struct{} `type:"structure"` } @@ -18634,6 +26065,7 @@ func (s ModifyImageAttributeOutput) GoString() string { return s.String() } +// Contains the parameters for ModifyInstanceAttribute. type ModifyInstanceAttributeInput struct { _ struct{} `type:"structure"` @@ -18669,6 +26101,12 @@ type ModifyInstanceAttributeInput struct { // Optimized instance. EbsOptimized *AttributeBooleanValue `locationName:"ebsOptimized" type:"structure"` + // Set to true to enable enhanced networking with ENA for the instance. + // + // This option is supported only for HVM instances. Specifying this option + // with a PV instance can make it unreachable. + EnaSupport *AttributeBooleanValue `locationName:"enaSupport" 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. @@ -18701,15 +26139,20 @@ type ModifyInstanceAttributeInput struct { // value must be false for a NAT instance to perform NAT. SourceDestCheck *AttributeBooleanValue `type:"structure"` - // Set to simple to enable enhanced networking for the instance. + // Set to simple to enable enhanced networking with the Intel 82599 Virtual + // Function interface for the instance. // - // There is no way to disable enhanced networking at this time. + // There is no way to disable enhanced networking with the Intel 82599 Virtual + // Function interface 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"` - // Changes the instance's user data to the specified value. + // Changes the instance's user data to the specified value. If you are using + // an AWS SDK or command line tool, Base64-encoding is performed for you, and + // you can load the text from a file. Otherwise, you must provide Base64-encoded + // text. UserData *BlobAttributeValue `locationName:"userData" type:"structure"` // A new value for the attribute. Use only with the kernel, ramdisk, userData, @@ -18727,6 +26170,19 @@ func (s ModifyInstanceAttributeInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *ModifyInstanceAttributeInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "ModifyInstanceAttributeInput"} + if s.InstanceId == nil { + invalidParams.Add(request.NewErrParamRequired("InstanceId")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + type ModifyInstanceAttributeOutput struct { _ struct{} `type:"structure"` } @@ -18741,13 +26197,14 @@ func (s ModifyInstanceAttributeOutput) GoString() string { return s.String() } +// Contains the parameters for ModifyInstancePlacement. type ModifyInstancePlacementInput struct { _ struct{} `type:"structure"` // The new affinity setting for the instance. Affinity *string `locationName:"affinity" type:"string" enum:"Affinity"` - // The ID of the Dedicated host that the instance will have affinity with. + // The ID of the Dedicated Host that the instance will have affinity with. HostId *string `locationName:"hostId" type:"string"` // The ID of the instance that you are modifying. @@ -18767,6 +26224,20 @@ func (s ModifyInstancePlacementInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *ModifyInstancePlacementInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "ModifyInstancePlacementInput"} + if s.InstanceId == nil { + invalidParams.Add(request.NewErrParamRequired("InstanceId")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// Contains the output of ModifyInstancePlacement. type ModifyInstancePlacementOutput struct { _ struct{} `type:"structure"` @@ -18784,6 +26255,7 @@ func (s ModifyInstancePlacementOutput) GoString() string { return s.String() } +// Contains the parameters for ModifyNetworkInterfaceAttribute. type ModifyNetworkInterfaceAttributeInput struct { _ struct{} `type:"structure"` @@ -18827,6 +26299,19 @@ func (s ModifyNetworkInterfaceAttributeInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *ModifyNetworkInterfaceAttributeInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "ModifyNetworkInterfaceAttributeInput"} + if s.NetworkInterfaceId == nil { + invalidParams.Add(request.NewErrParamRequired("NetworkInterfaceId")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + type ModifyNetworkInterfaceAttributeOutput struct { _ struct{} `type:"structure"` } @@ -18841,6 +26326,7 @@ func (s ModifyNetworkInterfaceAttributeOutput) GoString() string { return s.String() } +// Contains the parameters for ModifyReservedInstances. type ModifyReservedInstancesInput struct { _ struct{} `type:"structure"` @@ -18865,6 +26351,23 @@ func (s ModifyReservedInstancesInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *ModifyReservedInstancesInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "ModifyReservedInstancesInput"} + if s.ReservedInstancesIds == nil { + invalidParams.Add(request.NewErrParamRequired("ReservedInstancesIds")) + } + if s.TargetConfigurations == nil { + invalidParams.Add(request.NewErrParamRequired("TargetConfigurations")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// Contains the output of ModifyReservedInstances. type ModifyReservedInstancesOutput struct { _ struct{} `type:"structure"` @@ -18882,6 +26385,7 @@ func (s ModifyReservedInstancesOutput) GoString() string { return s.String() } +// Contains the parameters for ModifySnapshotAttribute. type ModifySnapshotAttributeInput struct { _ struct{} `type:"structure"` @@ -18922,6 +26426,19 @@ func (s ModifySnapshotAttributeInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *ModifySnapshotAttributeInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "ModifySnapshotAttributeInput"} + if s.SnapshotId == nil { + invalidParams.Add(request.NewErrParamRequired("SnapshotId")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + type ModifySnapshotAttributeOutput struct { _ struct{} `type:"structure"` } @@ -18962,6 +26479,19 @@ func (s ModifySpotFleetRequestInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *ModifySpotFleetRequestInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "ModifySpotFleetRequestInput"} + if s.SpotFleetRequestId == nil { + invalidParams.Add(request.NewErrParamRequired("SpotFleetRequestId")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + // Contains the output of ModifySpotFleetRequest. type ModifySpotFleetRequestOutput struct { _ struct{} `type:"structure"` @@ -18980,6 +26510,7 @@ func (s ModifySpotFleetRequestOutput) GoString() string { return s.String() } +// Contains the parameters for ModifySubnetAttribute. type ModifySubnetAttributeInput struct { _ struct{} `type:"structure"` @@ -19001,6 +26532,19 @@ func (s ModifySubnetAttributeInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *ModifySubnetAttributeInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "ModifySubnetAttributeInput"} + if s.SubnetId == nil { + invalidParams.Add(request.NewErrParamRequired("SubnetId")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + type ModifySubnetAttributeOutput struct { _ struct{} `type:"structure"` } @@ -19015,6 +26559,7 @@ func (s ModifySubnetAttributeOutput) GoString() string { return s.String() } +// Contains the parameters for ModifyVolumeAttribute. type ModifyVolumeAttributeInput struct { _ struct{} `type:"structure"` @@ -19041,6 +26586,19 @@ func (s ModifyVolumeAttributeInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *ModifyVolumeAttributeInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "ModifyVolumeAttributeInput"} + if s.VolumeId == nil { + invalidParams.Add(request.NewErrParamRequired("VolumeId")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + type ModifyVolumeAttributeOutput struct { _ struct{} `type:"structure"` } @@ -19055,6 +26613,7 @@ func (s ModifyVolumeAttributeOutput) GoString() string { return s.String() } +// Contains the parameters for ModifyVpcAttribute. type ModifyVpcAttributeInput struct { _ struct{} `type:"structure"` @@ -19090,6 +26649,19 @@ func (s ModifyVpcAttributeInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *ModifyVpcAttributeInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "ModifyVpcAttributeInput"} + if s.VpcId == nil { + invalidParams.Add(request.NewErrParamRequired("VpcId")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + type ModifyVpcAttributeOutput struct { _ struct{} `type:"structure"` } @@ -19104,6 +26676,7 @@ func (s ModifyVpcAttributeOutput) GoString() string { return s.String() } +// Contains the parameters for ModifyVpcEndpoint. type ModifyVpcEndpointInput struct { _ struct{} `type:"structure"` @@ -19141,6 +26714,20 @@ func (s ModifyVpcEndpointInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *ModifyVpcEndpointInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "ModifyVpcEndpointInput"} + if s.VpcEndpointId == nil { + invalidParams.Add(request.NewErrParamRequired("VpcEndpointId")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// Contains the output of ModifyVpcEndpoint. type ModifyVpcEndpointOutput struct { _ struct{} `type:"structure"` @@ -19158,6 +26745,69 @@ func (s ModifyVpcEndpointOutput) GoString() string { return s.String() } +type ModifyVpcPeeringConnectionOptionsInput struct { + _ struct{} `type:"structure"` + + // The VPC peering connection options for the accepter VPC. + AccepterPeeringConnectionOptions *PeeringConnectionOptionsRequest `type:"structure"` + + // Checks whether you have the required permissions for the operation, without + // actually making the request, and provides an error response. If you have + // the required permissions, the error response is DryRunOperation. Otherwise, + // it is UnauthorizedOperation. + DryRun *bool `type:"boolean"` + + // The VPC peering connection options for the requester VPC. + RequesterPeeringConnectionOptions *PeeringConnectionOptionsRequest `type:"structure"` + + // The ID of the VPC peering connection. + VpcPeeringConnectionId *string `type:"string" required:"true"` +} + +// String returns the string representation +func (s ModifyVpcPeeringConnectionOptionsInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ModifyVpcPeeringConnectionOptionsInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *ModifyVpcPeeringConnectionOptionsInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "ModifyVpcPeeringConnectionOptionsInput"} + if s.VpcPeeringConnectionId == nil { + invalidParams.Add(request.NewErrParamRequired("VpcPeeringConnectionId")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +type ModifyVpcPeeringConnectionOptionsOutput struct { + _ struct{} `type:"structure"` + + // Information about the VPC peering connection options for the accepter VPC. + AccepterPeeringConnectionOptions *PeeringConnectionOptions `locationName:"accepterPeeringConnectionOptions" type:"structure"` + + // Information about the VPC peering connection options for the requester VPC. + RequesterPeeringConnectionOptions *PeeringConnectionOptions `locationName:"requesterPeeringConnectionOptions" type:"structure"` +} + +// String returns the string representation +func (s ModifyVpcPeeringConnectionOptionsOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ModifyVpcPeeringConnectionOptionsOutput) GoString() string { + return s.String() +} + +// Contains the parameters for MonitorInstances. type MonitorInstancesInput struct { _ struct{} `type:"structure"` @@ -19181,6 +26831,20 @@ func (s MonitorInstancesInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *MonitorInstancesInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "MonitorInstancesInput"} + if s.InstanceIds == nil { + invalidParams.Add(request.NewErrParamRequired("InstanceIds")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// Contains the output of MonitorInstances. type MonitorInstancesOutput struct { _ struct{} `type:"structure"` @@ -19216,6 +26880,7 @@ func (s Monitoring) GoString() string { return s.String() } +// Contains the parameters for MoveAddressToVpc. type MoveAddressToVpcInput struct { _ struct{} `type:"structure"` @@ -19239,6 +26904,20 @@ func (s MoveAddressToVpcInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *MoveAddressToVpcInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "MoveAddressToVpcInput"} + if s.PublicIp == nil { + invalidParams.Add(request.NewErrParamRequired("PublicIp")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// Contains the output of MoveAddressToVpc. type MoveAddressToVpcOutput struct { _ struct{} `type:"structure"` @@ -19293,19 +26972,29 @@ type NatGateway struct { // If the NAT gateway could not be created, specifies the error code for the // failure. (InsufficientFreeAddressesInSubnet | Gateway.NotAttached | InvalidAllocationID.NotFound - // | Resource.AlreadyAssociated | InternalError) + // | Resource.AlreadyAssociated | InternalError | InvalidSubnetID.NotFound) FailureCode *string `locationName:"failureCode" type:"string"` // If the NAT gateway could not be created, specifies the error message for // the failure, that corresponds to the error code. // - // For InsufficientFreeAddressesInSubnet: Subnet has insufficient free addresses - // to create this NAT gateway For Gateway.NotAttached: Network vpc-xxxxxxxx - // has no Internet gateway attached For InvalidAllocationID.NotFound: Elastic - // IP address eipalloc-xxxxxxxx could not be associated with this NAT gateway - // For Resource.AlreadyAssociated: Elastic IP address eipalloc-xxxxxxxx is already - // associated For InternalError: Network interface eni-xxxxxxxx, created and - // used internally by this NAT gateway is in an invalid state. Please try again. + // For InsufficientFreeAddressesInSubnet: "Subnet has insufficient free addresses + // to create this NAT gateway" + // + // For Gateway.NotAttached: "Network vpc-xxxxxxxx has no Internet gateway + // attached" + // + // For InvalidAllocationID.NotFound: "Elastic IP address eipalloc-xxxxxxxx + // could not be associated with this NAT gateway" + // + // For Resource.AlreadyAssociated: "Elastic IP address eipalloc-xxxxxxxx + // is already associated" + // + // For InternalError: "Network interface eni-xxxxxxxx, created and used internally + // by this NAT gateway is in an invalid state. Please try again." + // + // For InvalidSubnetID.NotFound: "The specified subnet subnet-xxxxxxxx does + // not exist or could not be found." FailureMessage *string `locationName:"failureMessage" type:"string"` // Information about the IP addresses and network interface associated with @@ -19315,7 +27004,28 @@ type NatGateway struct { // The ID of the NAT gateway. NatGatewayId *string `locationName:"natGatewayId" type:"string"` + // Reserved. If you need to sustain traffic greater than the documented limits + // (http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/vpc-nat-gateway.html), + // contact us through the Support Center (https://console.aws.amazon.com/support/home?). + ProvisionedBandwidth *ProvisionedBandwidth `locationName:"provisionedBandwidth" type:"structure"` + // The state of the NAT gateway. + // + // pending: The NAT gateway is being created and is not ready to process + // traffic. + // + // failed: The NAT gateway could not be created. Check the failureCode and + // failureMessage fields for the reason. + // + // available: The NAT gateway is able to process traffic. This status remains + // until you delete the NAT gateway, and does not indicate the health of the + // NAT gateway. + // + // deleting: The NAT gateway is in the process of being terminated and may + // still be processing traffic. + // + // deleted: The NAT gateway has been terminated and is no longer processing + // traffic. State *string `locationName:"state" type:"string" enum:"NatGatewayState"` // The ID of the subnet in which the NAT gateway is located. @@ -19666,11 +27376,65 @@ func (s NewDhcpConfiguration) GoString() string { return s.String() } +// Describes the VPC peering connection options. +type PeeringConnectionOptions struct { + _ struct{} `type:"structure"` + + // If true, enables a local VPC to resolve public DNS hostnames to private IP + // addresses when queried from instances in the peer VPC. + AllowDnsResolutionFromRemoteVpc *bool `locationName:"allowDnsResolutionFromRemoteVpc" type:"boolean"` + + // If true, enables outbound communication from an EC2-Classic instance that's + // linked to a local VPC via ClassicLink to instances in a peer VPC. + AllowEgressFromLocalClassicLinkToRemoteVpc *bool `locationName:"allowEgressFromLocalClassicLinkToRemoteVpc" type:"boolean"` + + // If true, enables outbound communication from instances in a local VPC to + // an EC2-Classic instance that's linked to a peer VPC via ClassicLink. + AllowEgressFromLocalVpcToRemoteClassicLink *bool `locationName:"allowEgressFromLocalVpcToRemoteClassicLink" type:"boolean"` +} + +// String returns the string representation +func (s PeeringConnectionOptions) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s PeeringConnectionOptions) GoString() string { + return s.String() +} + +// The VPC peering connection options. +type PeeringConnectionOptionsRequest struct { + _ struct{} `type:"structure"` + + // If true, enables a local VPC to resolve public DNS hostnames to private IP + // addresses when queried from instances in the peer VPC. + AllowDnsResolutionFromRemoteVpc *bool `type:"boolean"` + + // If true, enables outbound communication from an EC2-Classic instance that's + // linked to a local VPC via ClassicLink to instances in a peer VPC. + AllowEgressFromLocalClassicLinkToRemoteVpc *bool `type:"boolean"` + + // If true, enables outbound communication from instances in a local VPC to + // an EC2-Classic instance that's linked to a peer VPC via ClassicLink. + AllowEgressFromLocalVpcToRemoteClassicLink *bool `type:"boolean"` +} + +// String returns the string representation +func (s PeeringConnectionOptionsRequest) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s PeeringConnectionOptionsRequest) GoString() string { + return s.String() +} + // Describes the placement for the instance. type Placement struct { _ struct{} `type:"structure"` - // The affinity setting for the instance on the Dedicated host. This parameter + // The affinity setting for the instance on the Dedicated Host. This parameter // is not supported for the ImportInstance command. Affinity *string `locationName:"affinity" type:"string"` @@ -19894,6 +27658,19 @@ func (s PrivateIpAddressSpecification) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *PrivateIpAddressSpecification) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "PrivateIpAddressSpecification"} + if s.PrivateIpAddress == nil { + invalidParams.Add(request.NewErrParamRequired("PrivateIpAddress")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + // Describes a product code. type ProductCode struct { _ struct{} `type:"structure"` @@ -19933,15 +27710,186 @@ func (s PropagatingVgw) GoString() string { return s.String() } +// Reserved. If you need to sustain traffic greater than the documented limits +// (http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/vpc-nat-gateway.html), +// contact us through the Support Center (https://console.aws.amazon.com/support/home?). +type ProvisionedBandwidth struct { + _ struct{} `type:"structure"` + + // Reserved. If you need to sustain traffic greater than the documented limits + // (http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/vpc-nat-gateway.html), + // contact us through the Support Center (https://console.aws.amazon.com/support/home?). + ProvisionTime *time.Time `locationName:"provisionTime" type:"timestamp" timestampFormat:"iso8601"` + + // Reserved. If you need to sustain traffic greater than the documented limits + // (http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/vpc-nat-gateway.html), + // contact us through the Support Center (https://console.aws.amazon.com/support/home?). + Provisioned *string `locationName:"provisioned" type:"string"` + + // Reserved. If you need to sustain traffic greater than the documented limits + // (http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/vpc-nat-gateway.html), + // contact us through the Support Center (https://console.aws.amazon.com/support/home?). + RequestTime *time.Time `locationName:"requestTime" type:"timestamp" timestampFormat:"iso8601"` + + // Reserved. If you need to sustain traffic greater than the documented limits + // (http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/vpc-nat-gateway.html), + // contact us through the Support Center (https://console.aws.amazon.com/support/home?). + Requested *string `locationName:"requested" type:"string"` + + // Reserved. If you need to sustain traffic greater than the documented limits + // (http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/vpc-nat-gateway.html), + // contact us through the Support Center (https://console.aws.amazon.com/support/home?). + Status *string `locationName:"status" type:"string"` +} + +// String returns the string representation +func (s ProvisionedBandwidth) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ProvisionedBandwidth) GoString() string { + return s.String() +} + +// Describes the result of the purchase. +type Purchase struct { + _ struct{} `type:"structure"` + + // The currency in which the UpfrontPrice and HourlyPrice amounts are specified. + // At this time, the only supported currency is USD. + CurrencyCode *string `locationName:"currencyCode" type:"string" enum:"CurrencyCodeValues"` + + // The duration of the reservation's term in seconds. + Duration *int64 `locationName:"duration" type:"integer"` + + // The IDs of the Dedicated Hosts associated with the reservation. + HostIdSet []*string `locationName:"hostIdSet" locationNameList:"item" type:"list"` + + // The ID of the reservation. + HostReservationId *string `locationName:"hostReservationId" type:"string"` + + // The hourly price of the reservation per hour. + HourlyPrice *string `locationName:"hourlyPrice" type:"string"` + + // The instance family on the Dedicated Host that the reservation can be associated + // with. + InstanceFamily *string `locationName:"instanceFamily" type:"string"` + + // The payment option for the reservation. + PaymentOption *string `locationName:"paymentOption" type:"string" enum:"PaymentOption"` + + // The upfront price of the reservation. + UpfrontPrice *string `locationName:"upfrontPrice" type:"string"` +} + +// String returns the string representation +func (s Purchase) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s Purchase) GoString() string { + return s.String() +} + +type PurchaseHostReservationInput struct { + _ struct{} `type:"structure"` + + // 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"` + + // The currency in which the totalUpfrontPrice, LimitPrice, and totalHourlyPrice + // amounts are specified. At this time, the only supported currency is USD. + CurrencyCode *string `type:"string" enum:"CurrencyCodeValues"` + + // The ID/s of the Dedicated Host/s that the reservation will be associated + // with. + HostIdSet []*string `locationNameList:"item" type:"list" required:"true"` + + // The specified limit is checked against the total upfront cost of the reservation + // (calculated as the offering's upfront cost multiplied by the host count). + // If the total upfront cost is greater than the specified price limit, the + // request will fail. This is used to ensure that the purchase does not exceed + // the expected upfront cost of the purchase. At this time, the only supported + // currency is USD. For example, to indicate a limit price of USD 100, specify + // 100.00. + LimitPrice *string `type:"string"` + + // The ID of the offering. + OfferingId *string `type:"string" required:"true"` +} + +// String returns the string representation +func (s PurchaseHostReservationInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s PurchaseHostReservationInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *PurchaseHostReservationInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "PurchaseHostReservationInput"} + if s.HostIdSet == nil { + invalidParams.Add(request.NewErrParamRequired("HostIdSet")) + } + if s.OfferingId == nil { + invalidParams.Add(request.NewErrParamRequired("OfferingId")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +type PurchaseHostReservationOutput struct { + _ struct{} `type:"structure"` + + // 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 `locationName:"clientToken" type:"string"` + + // The currency in which the totalUpfrontPrice and totalHourlyPrice amounts + // are specified. At this time, the only supported currency is USD. + CurrencyCode *string `locationName:"currencyCode" type:"string" enum:"CurrencyCodeValues"` + + // Describes the details of the purchase. + Purchase []*Purchase `locationName:"purchase" type:"list"` + + // The total hourly price of the reservation calculated per hour. + TotalHourlyPrice *string `locationName:"totalHourlyPrice" type:"string"` + + // The total amount that will be charged to your account when you purchase the + // reservation. + TotalUpfrontPrice *string `locationName:"totalUpfrontPrice" type:"string"` +} + +// String returns the string representation +func (s PurchaseHostReservationOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s PurchaseHostReservationOutput) GoString() string { + return s.String() +} + // Describes a request to purchase Scheduled Instances. type PurchaseRequest struct { _ struct{} `type:"structure"` // The number of instances. - InstanceCount *int64 `type:"integer"` + InstanceCount *int64 `type:"integer" required:"true"` // The purchase token. - PurchaseToken *string `type:"string"` + PurchaseToken *string `type:"string" required:"true"` } // String returns the string representation @@ -19954,6 +27902,23 @@ func (s PurchaseRequest) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *PurchaseRequest) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "PurchaseRequest"} + if s.InstanceCount == nil { + invalidParams.Add(request.NewErrParamRequired("InstanceCount")) + } + if s.PurchaseToken == nil { + invalidParams.Add(request.NewErrParamRequired("PurchaseToken")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// Contains the parameters for PurchaseReservedInstancesOffering. type PurchaseReservedInstancesOfferingInput struct { _ struct{} `type:"structure"` @@ -19985,6 +27950,23 @@ func (s PurchaseReservedInstancesOfferingInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *PurchaseReservedInstancesOfferingInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "PurchaseReservedInstancesOfferingInput"} + if s.InstanceCount == nil { + invalidParams.Add(request.NewErrParamRequired("InstanceCount")) + } + if s.ReservedInstancesOfferingId == nil { + invalidParams.Add(request.NewErrParamRequired("ReservedInstancesOfferingId")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// Contains the output of PurchaseReservedInstancesOffering. type PurchaseReservedInstancesOfferingOutput struct { _ struct{} `type:"structure"` @@ -20008,7 +27990,7 @@ type PurchaseScheduledInstancesInput struct { // Unique, case-sensitive identifier that ensures the idempotency of the request. // For more information, see Ensuring Idempotency (http://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html). - ClientToken *string `type:"string"` + ClientToken *string `type:"string" idempotencyToken:"true"` // Checks whether you have the required permissions for the action, without // actually making the request, and provides an error response. If you have @@ -20017,7 +27999,7 @@ type PurchaseScheduledInstancesInput struct { DryRun *bool `type:"boolean"` // One or more purchase requests. - PurchaseRequests []*PurchaseRequest `locationName:"PurchaseRequest" locationNameList:"PurchaseRequest" type:"list" required:"true"` + PurchaseRequests []*PurchaseRequest `locationName:"PurchaseRequest" locationNameList:"PurchaseRequest" min:"1" type:"list" required:"true"` } // String returns the string representation @@ -20030,6 +28012,32 @@ func (s PurchaseScheduledInstancesInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *PurchaseScheduledInstancesInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "PurchaseScheduledInstancesInput"} + if s.PurchaseRequests == nil { + invalidParams.Add(request.NewErrParamRequired("PurchaseRequests")) + } + if s.PurchaseRequests != nil && len(s.PurchaseRequests) < 1 { + invalidParams.Add(request.NewErrParamMinLen("PurchaseRequests", 1)) + } + if s.PurchaseRequests != nil { + for i, v := range s.PurchaseRequests { + if v == nil { + continue + } + if err := v.Validate(); err != nil { + invalidParams.AddNested(fmt.Sprintf("%s[%v]", "PurchaseRequests", i), err.(request.ErrInvalidParams)) + } + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + // Contains the output of PurchaseScheduledInstances. type PurchaseScheduledInstancesOutput struct { _ struct{} `type:"structure"` @@ -20048,6 +28056,7 @@ func (s PurchaseScheduledInstancesOutput) GoString() string { return s.String() } +// Contains the parameters for RebootInstances. type RebootInstancesInput struct { _ struct{} `type:"structure"` @@ -20071,6 +28080,19 @@ func (s RebootInstancesInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *RebootInstancesInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "RebootInstancesInput"} + if s.InstanceIds == nil { + invalidParams.Add(request.NewErrParamRequired("InstanceIds")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + type RebootInstancesOutput struct { _ struct{} `type:"structure"` } @@ -20127,6 +28149,7 @@ func (s Region) GoString() string { return s.String() } +// Contains the parameters for RegisterImage. type RegisterImageInput struct { _ struct{} `type:"structure"` @@ -20148,6 +28171,13 @@ type RegisterImageInput struct { // it is UnauthorizedOperation. DryRun *bool `locationName:"dryRun" type:"boolean"` + // Set to true to enable enhanced networking with ENA for the AMI and any instances + // that you launch from the AMI. + // + // This option is supported only for HVM AMIs. Specifying this option with + // a PV AMI can make instances launched from the AMI unreachable. + EnaSupport *bool `locationName:"enaSupport" type:"boolean"` + // The full path to your AMI manifest in Amazon S3 storage. ImageLocation *string `type:"string"` @@ -20167,10 +28197,11 @@ type RegisterImageInput struct { // 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. + // Set to simple to enable enhanced networking with the Intel 82599 Virtual + // Function interface for the AMI and any instances that you launch from the + // AMI. // - // There is no way to disable enhanced networking at this time. + // There is no way to disable sriovNetSupport 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. @@ -20192,6 +28223,20 @@ func (s RegisterImageInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *RegisterImageInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "RegisterImageInput"} + if s.Name == nil { + invalidParams.Add(request.NewErrParamRequired("Name")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// Contains the output of RegisterImage. type RegisterImageOutput struct { _ struct{} `type:"structure"` @@ -20209,6 +28254,7 @@ func (s RegisterImageOutput) GoString() string { return s.String() } +// Contains the parameters for RejectVpcPeeringConnection. type RejectVpcPeeringConnectionInput struct { _ struct{} `type:"structure"` @@ -20232,6 +28278,20 @@ func (s RejectVpcPeeringConnectionInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *RejectVpcPeeringConnectionInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "RejectVpcPeeringConnectionInput"} + if s.VpcPeeringConnectionId == nil { + invalidParams.Add(request.NewErrParamRequired("VpcPeeringConnectionId")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// Contains the output of RejectVpcPeeringConnection. type RejectVpcPeeringConnectionOutput struct { _ struct{} `type:"structure"` @@ -20249,6 +28309,7 @@ func (s RejectVpcPeeringConnectionOutput) GoString() string { return s.String() } +// Contains the parameters for ReleaseAddress. type ReleaseAddressInput struct { _ struct{} `type:"structure"` @@ -20289,10 +28350,11 @@ func (s ReleaseAddressOutput) GoString() string { return s.String() } +// Contains the parameters for ReleaseHosts. type ReleaseHostsInput struct { _ struct{} `type:"structure"` - // The IDs of the Dedicated hosts you want to release. + // The IDs of the Dedicated Hosts you want to release. HostIds []*string `locationName:"hostId" locationNameList:"item" type:"list" required:"true"` } @@ -20306,13 +28368,27 @@ func (s ReleaseHostsInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *ReleaseHostsInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "ReleaseHostsInput"} + if s.HostIds == nil { + invalidParams.Add(request.NewErrParamRequired("HostIds")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// Contains the output of ReleaseHosts. type ReleaseHostsOutput struct { _ struct{} `type:"structure"` - // The IDs of the Dedicated hosts that were successfully released. + // The IDs of the Dedicated Hosts that were successfully released. Successful []*string `locationName:"successful" locationNameList:"item" type:"list"` - // The IDs of the Dedicated hosts that could not be released, including an error + // The IDs of the Dedicated Hosts that could not be released, including an error // message. Unsuccessful []*UnsuccessfulItem `locationName:"unsuccessful" locationNameList:"item" type:"list"` } @@ -20327,6 +28403,7 @@ func (s ReleaseHostsOutput) GoString() string { return s.String() } +// Contains the parameters for ReplaceNetworkAclAssociation. type ReplaceNetworkAclAssociationInput struct { _ struct{} `type:"structure"` @@ -20354,6 +28431,23 @@ func (s ReplaceNetworkAclAssociationInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *ReplaceNetworkAclAssociationInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "ReplaceNetworkAclAssociationInput"} + if s.AssociationId == nil { + invalidParams.Add(request.NewErrParamRequired("AssociationId")) + } + if s.NetworkAclId == nil { + invalidParams.Add(request.NewErrParamRequired("NetworkAclId")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// Contains the output of ReplaceNetworkAclAssociation. type ReplaceNetworkAclAssociationOutput struct { _ struct{} `type:"structure"` @@ -20371,6 +28465,7 @@ func (s ReplaceNetworkAclAssociationOutput) GoString() string { return s.String() } +// Contains the parameters for ReplaceNetworkAclEntry. type ReplaceNetworkAclEntryInput struct { _ struct{} `type:"structure"` @@ -20419,6 +28514,34 @@ func (s ReplaceNetworkAclEntryInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *ReplaceNetworkAclEntryInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "ReplaceNetworkAclEntryInput"} + if s.CidrBlock == nil { + invalidParams.Add(request.NewErrParamRequired("CidrBlock")) + } + if s.Egress == nil { + invalidParams.Add(request.NewErrParamRequired("Egress")) + } + if s.NetworkAclId == nil { + invalidParams.Add(request.NewErrParamRequired("NetworkAclId")) + } + if s.Protocol == nil { + invalidParams.Add(request.NewErrParamRequired("Protocol")) + } + if s.RuleAction == nil { + invalidParams.Add(request.NewErrParamRequired("RuleAction")) + } + if s.RuleNumber == nil { + invalidParams.Add(request.NewErrParamRequired("RuleNumber")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + type ReplaceNetworkAclEntryOutput struct { _ struct{} `type:"structure"` } @@ -20433,6 +28556,7 @@ func (s ReplaceNetworkAclEntryOutput) GoString() string { return s.String() } +// Contains the parameters for ReplaceRoute. type ReplaceRouteInput struct { _ struct{} `type:"structure"` @@ -20475,6 +28599,22 @@ func (s ReplaceRouteInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *ReplaceRouteInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "ReplaceRouteInput"} + if s.DestinationCidrBlock == nil { + invalidParams.Add(request.NewErrParamRequired("DestinationCidrBlock")) + } + if s.RouteTableId == nil { + invalidParams.Add(request.NewErrParamRequired("RouteTableId")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + type ReplaceRouteOutput struct { _ struct{} `type:"structure"` } @@ -20489,6 +28629,7 @@ func (s ReplaceRouteOutput) GoString() string { return s.String() } +// Contains the parameters for ReplaceRouteTableAssociation. type ReplaceRouteTableAssociationInput struct { _ struct{} `type:"structure"` @@ -20515,6 +28656,23 @@ func (s ReplaceRouteTableAssociationInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *ReplaceRouteTableAssociationInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "ReplaceRouteTableAssociationInput"} + if s.AssociationId == nil { + invalidParams.Add(request.NewErrParamRequired("AssociationId")) + } + if s.RouteTableId == nil { + invalidParams.Add(request.NewErrParamRequired("RouteTableId")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// Contains the output of ReplaceRouteTableAssociation. type ReplaceRouteTableAssociationOutput struct { _ struct{} `type:"structure"` @@ -20532,6 +28690,7 @@ func (s ReplaceRouteTableAssociationOutput) GoString() string { return s.String() } +// Contains the parameters for ReportInstanceStatus. type ReportInstanceStatusInput struct { _ struct{} `type:"structure"` @@ -20552,26 +28711,26 @@ type ReportInstanceStatusInput struct { // One or more reason codes that describes the health state of your instance. // - // instance-stuck-in-state: My instance is stuck in a state. + // instance-stuck-in-state: My instance is stuck in a state. // - // unresponsive: My instance is unresponsive. + // unresponsive: My instance is unresponsive. // - // not-accepting-credentials: My instance is not accepting my credentials. + // not-accepting-credentials: My instance is not accepting my credentials. // - // password-not-available: A password is not available for my instance. + // 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-network: My instance is experiencing performance problems + // which I believe are network related. // - // performance-instance-store: My instance is experiencing performance problems + // 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 + // 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. + // performance-other: My instance is experiencing performance problems. // - // other: [explain using the description parameter] + // 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. @@ -20591,6 +28750,25 @@ func (s ReportInstanceStatusInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *ReportInstanceStatusInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "ReportInstanceStatusInput"} + if s.Instances == nil { + invalidParams.Add(request.NewErrParamRequired("Instances")) + } + if s.ReasonCodes == nil { + invalidParams.Add(request.NewErrParamRequired("ReasonCodes")) + } + if s.Status == nil { + invalidParams.Add(request.NewErrParamRequired("Status")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + type ReportInstanceStatusOutput struct { _ struct{} `type:"structure"` } @@ -20629,6 +28807,24 @@ func (s RequestSpotFleetInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *RequestSpotFleetInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "RequestSpotFleetInput"} + if s.SpotFleetRequestConfig == nil { + invalidParams.Add(request.NewErrParamRequired("SpotFleetRequestConfig")) + } + if s.SpotFleetRequestConfig != nil { + if err := s.SpotFleetRequestConfig.Validate(); err != nil { + invalidParams.AddNested("SpotFleetRequestConfig", err.(request.ErrInvalidParams)) + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + // Contains the output of RequestSpotFleet. type RequestSpotFleetOutput struct { _ struct{} `type:"structure"` @@ -20672,8 +28868,9 @@ type RequestSpotInstancesInput struct { // Default: Instances are launched in any available Availability Zone. AvailabilityZoneGroup *string `locationName:"availabilityZoneGroup" type:"string"` - // The required duration for the Spot instances, in minutes. This value must - // be a multiple of 60 (60, 120, 180, 240, 300, or 360). + // The required duration for the Spot instances (also known as Spot blocks), + // in minutes. This value must be a multiple of 60 (60, 120, 180, 240, 300, + // or 360). // // The duration period starts as soon as your Spot instance receives its instance // ID. At the end of the duration period, Amazon EC2 marks the Spot instance @@ -20746,6 +28943,24 @@ func (s RequestSpotInstancesInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *RequestSpotInstancesInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "RequestSpotInstancesInput"} + if s.SpotPrice == nil { + invalidParams.Add(request.NewErrParamRequired("SpotPrice")) + } + if s.LaunchSpecification != nil { + if err := s.LaunchSpecification.Validate(); err != nil { + invalidParams.AddNested("LaunchSpecification", err.(request.ErrInvalidParams)) + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + // Contains the output of RequestSpotInstances. type RequestSpotInstancesOutput struct { _ struct{} `type:"structure"` @@ -20772,6 +28987,9 @@ type RequestSpotLaunchSpecification struct { AddressingType *string `locationName:"addressingType" type:"string"` // One or more block device mapping entries. + // + // Although you can specify encrypted EBS volumes in this block device mapping + // for your Spot Instances, these volumes are not encrypted. BlockDeviceMappings []*BlockDeviceMapping `locationName:"blockDeviceMapping" locationNameList:"item" type:"list"` // Indicates whether the instance is optimized for EBS I/O. This optimization @@ -20817,7 +29035,9 @@ type RequestSpotLaunchSpecification struct { // 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. + // The user data to make available to the instances. If you are using an AWS + // SDK or command line tool, Base64-encoding is performed for you, and you can + // load the text from a file. Otherwise, you must provide Base64-encoded text. UserData *string `locationName:"userData" type:"string"` } @@ -20831,11 +29051,36 @@ func (s RequestSpotLaunchSpecification) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *RequestSpotLaunchSpecification) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "RequestSpotLaunchSpecification"} + if s.Monitoring != nil { + if err := s.Monitoring.Validate(); err != nil { + invalidParams.AddNested("Monitoring", err.(request.ErrInvalidParams)) + } + } + if s.NetworkInterfaces != nil { + for i, v := range s.NetworkInterfaces { + if v == nil { + continue + } + if err := v.Validate(); err != nil { + invalidParams.AddNested(fmt.Sprintf("%s[%v]", "NetworkInterfaces", i), err.(request.ErrInvalidParams)) + } + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + // Describes a reservation. type Reservation struct { _ struct{} `type:"structure"` - // One or more security groups. + // [EC2-Classic only] One or more security groups. Groups []*GroupIdentifier `locationName:"groupSet" locationNameList:"item" type:"list"` // One or more instances. @@ -21086,6 +29331,7 @@ func (s ReservedInstancesModification) GoString() string { return s.String() } +// Describes the modification request/s. type ReservedInstancesModificationResult struct { _ struct{} `type:"structure"` @@ -21166,6 +29412,7 @@ func (s ReservedInstancesOffering) GoString() string { return s.String() } +// Contains the parameters for ResetImageAttribute. type ResetImageAttributeInput struct { _ struct{} `type:"structure"` @@ -21193,6 +29440,22 @@ func (s ResetImageAttributeInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *ResetImageAttributeInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "ResetImageAttributeInput"} + if s.Attribute == nil { + invalidParams.Add(request.NewErrParamRequired("Attribute")) + } + if s.ImageId == nil { + invalidParams.Add(request.NewErrParamRequired("ImageId")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + type ResetImageAttributeOutput struct { _ struct{} `type:"structure"` } @@ -21207,10 +29470,14 @@ func (s ResetImageAttributeOutput) GoString() string { return s.String() } +// Contains the parameters for ResetInstanceAttribute. type ResetInstanceAttributeInput struct { _ struct{} `type:"structure"` // The attribute to reset. + // + // You can only reset the following attributes: kernel | ramdisk | sourceDestCheck. + // To change an instance attribute, use ModifyInstanceAttribute. Attribute *string `locationName:"attribute" type:"string" required:"true" enum:"InstanceAttributeName"` // Checks whether you have the required permissions for the action, without @@ -21233,6 +29500,22 @@ func (s ResetInstanceAttributeInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *ResetInstanceAttributeInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "ResetInstanceAttributeInput"} + if s.Attribute == nil { + invalidParams.Add(request.NewErrParamRequired("Attribute")) + } + if s.InstanceId == nil { + invalidParams.Add(request.NewErrParamRequired("InstanceId")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + type ResetInstanceAttributeOutput struct { _ struct{} `type:"structure"` } @@ -21247,6 +29530,7 @@ func (s ResetInstanceAttributeOutput) GoString() string { return s.String() } +// Contains the parameters for ResetNetworkInterfaceAttribute. type ResetNetworkInterfaceAttributeInput struct { _ struct{} `type:"structure"` @@ -21273,6 +29557,19 @@ func (s ResetNetworkInterfaceAttributeInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *ResetNetworkInterfaceAttributeInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "ResetNetworkInterfaceAttributeInput"} + if s.NetworkInterfaceId == nil { + invalidParams.Add(request.NewErrParamRequired("NetworkInterfaceId")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + type ResetNetworkInterfaceAttributeOutput struct { _ struct{} `type:"structure"` } @@ -21287,6 +29584,7 @@ func (s ResetNetworkInterfaceAttributeOutput) GoString() string { return s.String() } +// Contains the parameters for ResetSnapshotAttribute. type ResetSnapshotAttributeInput struct { _ struct{} `type:"structure"` @@ -21314,6 +29612,22 @@ func (s ResetSnapshotAttributeInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *ResetSnapshotAttributeInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "ResetSnapshotAttributeInput"} + if s.Attribute == nil { + invalidParams.Add(request.NewErrParamRequired("Attribute")) + } + if s.SnapshotId == nil { + invalidParams.Add(request.NewErrParamRequired("SnapshotId")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + type ResetSnapshotAttributeOutput struct { _ struct{} `type:"structure"` } @@ -21328,6 +29642,7 @@ func (s ResetSnapshotAttributeOutput) GoString() string { return s.String() } +// Contains the parameters for RestoreAddressToClassic. type RestoreAddressToClassicInput struct { _ struct{} `type:"structure"` @@ -21351,6 +29666,20 @@ func (s RestoreAddressToClassicInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *RestoreAddressToClassicInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "RestoreAddressToClassicInput"} + if s.PublicIp == nil { + invalidParams.Add(request.NewErrParamRequired("PublicIp")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// Contains the output of RestoreAddressToClassic. type RestoreAddressToClassicOutput struct { _ struct{} `type:"structure"` @@ -21371,6 +29700,7 @@ func (s RestoreAddressToClassicOutput) GoString() string { return s.String() } +// Contains the parameters for RevokeSecurityGroupEgress. type RevokeSecurityGroupEgressInput struct { _ struct{} `type:"structure"` @@ -21424,6 +29754,19 @@ func (s RevokeSecurityGroupEgressInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *RevokeSecurityGroupEgressInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "RevokeSecurityGroupEgressInput"} + if s.GroupId == nil { + invalidParams.Add(request.NewErrParamRequired("GroupId")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + type RevokeSecurityGroupEgressOutput struct { _ struct{} `type:"structure"` } @@ -21438,6 +29781,7 @@ func (s RevokeSecurityGroupEgressOutput) GoString() string { return s.String() } +// Contains the parameters for RevokeSecurityGroupIngress. type RevokeSecurityGroupIngressInput struct { _ struct{} `type:"structure"` @@ -21474,15 +29818,16 @@ type RevokeSecurityGroupIngressInput struct { // specify this parameter in combination with the following parameters: the // CIDR IP address range, the start of the port range, the IP protocol, and // the end of the port range. For EC2-VPC, the source security group must be - // in the same VPC. + // in the same VPC. To revoke a specific rule for an IP protocol and port range, + // use a set of IP permissions instead. SourceSecurityGroupName *string `type:"string"` - // [EC2-Classic, default VPC] The AWS account ID of the source security group. - // For EC2-VPC, the source security group must be in the same VPC. You can't - // specify this parameter in combination with the following parameters: the - // CIDR IP address range, the IP protocol, the start of the port range, and - // the end of the port range. To revoke a specific rule for an IP protocol and - // port range, use a set of IP permissions instead. + // [EC2-Classic] The AWS account ID of the source security group, if the source + // security group is in a different account. You can't specify this parameter + // in combination with the following parameters: the CIDR IP address range, + // the IP protocol, the start of the port range, and the end of the port range. + // To revoke a specific rule for an IP protocol and port range, use a set of + // IP permissions instead. SourceSecurityGroupOwnerId *string `type:"string"` // The end of port range for the TCP and UDP protocols, or an ICMP code number. @@ -21541,10 +29886,12 @@ type Route struct { // 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. + // CreateRouteTable - The route was automatically created when the route + // table was created. + // + // CreateRoute - The route was manually added to the route table. + // + // EnableVgwRoutePropagation - The route was propagated by route propagation. Origin *string `locationName:"origin" type:"string" enum:"RouteOrigin"` // The state of the route. The blackhole state indicates that the route's target @@ -21626,6 +29973,7 @@ func (s RouteTableAssociation) GoString() string { return s.String() } +// Contains the parameters for RunInstances. type RunInstancesInput struct { _ struct{} `type:"structure"` @@ -21633,6 +29981,12 @@ type RunInstancesInput struct { AdditionalInfo *string `locationName:"additionalInfo" type:"string"` // The block device mapping. + // + // Supplying both a snapshot ID and an encryption value as arguments for block-device + // mapping results in an error. This is because only blank volumes can be encrypted + // on start, and these are not created from a snapshot. If a snapshot is the + // basis for the volume, it contains data by definition and its encryption status + // cannot be changed using this action. BlockDeviceMappings []*BlockDeviceMapping `locationName:"BlockDeviceMapping" locationNameList:"BlockDeviceMapping" type:"list"` // Unique, case-sensitive identifier you provide to ensure the idempotency of @@ -21706,7 +30060,7 @@ type RunInstancesInput struct { // Constraints: Between 1 and the maximum number you're allowed for the specified // instance type. For more information about the default limits, and how to // request an increase, see How many instances can I run in Amazon EC2 (http://aws.amazon.com/ec2/faqs/#How_many_instances_can_I_run_in_Amazon_EC2) - // in the Amazon EC2 General FAQ. + // in the Amazon EC2 FAQ. MaxCount *int64 `type:"integer" required:"true"` // The minimum number of instances to launch. If you specify a minimum that @@ -21759,12 +30113,12 @@ type RunInstancesInput struct { // [EC2-VPC] The ID of the subnet to launch the instance into. SubnetId *string `type:"string"` - // Data to configure the instance, or a script to run during instance launch. - // For more information, see Running Commands on Your Linux Instance at Launch - // (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/user-data.html) (Linux) - // and Adding User Data (http://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/ec2-instance-metadata.html#instancedata-add-user-data) - // (Windows). For API calls, the text must be base64-encoded. Command line tools - // perform encoding for you. + // The user data to make available to the instance. For more information, see + // Running Commands on Your Linux Instance at Launch (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/user-data.html) + // (Linux) and Adding User Data (http://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/ec2-instance-metadata.html#instancedata-add-user-data) + // (Windows). If you are using an AWS SDK or command line tool, Base64-encoding + // is performed for you, and you can load the text from a file. Otherwise, you + // must provide Base64-encoded text. UserData *string `type:"string"` } @@ -21778,6 +30132,40 @@ func (s RunInstancesInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *RunInstancesInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "RunInstancesInput"} + if s.ImageId == nil { + invalidParams.Add(request.NewErrParamRequired("ImageId")) + } + if s.MaxCount == nil { + invalidParams.Add(request.NewErrParamRequired("MaxCount")) + } + if s.MinCount == nil { + invalidParams.Add(request.NewErrParamRequired("MinCount")) + } + if s.Monitoring != nil { + if err := s.Monitoring.Validate(); err != nil { + invalidParams.AddNested("Monitoring", err.(request.ErrInvalidParams)) + } + } + if s.NetworkInterfaces != nil { + for i, v := range s.NetworkInterfaces { + if v == nil { + continue + } + if err := v.Validate(); err != nil { + invalidParams.AddNested(fmt.Sprintf("%s[%v]", "NetworkInterfaces", i), err.(request.ErrInvalidParams)) + } + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + // Describes the monitoring for the instance. type RunInstancesMonitoringEnabled struct { _ struct{} `type:"structure"` @@ -21796,13 +30184,26 @@ func (s RunInstancesMonitoringEnabled) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *RunInstancesMonitoringEnabled) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "RunInstancesMonitoringEnabled"} + if s.Enabled == nil { + invalidParams.Add(request.NewErrParamRequired("Enabled")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + // Contains the parameters for RunScheduledInstances. type RunScheduledInstancesInput struct { _ struct{} `type:"structure"` // Unique, case-sensitive identifier that ensures the idempotency of the request. // For more information, see Ensuring Idempotency (http://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html). - ClientToken *string `type:"string"` + ClientToken *string `type:"string" idempotencyToken:"true"` // Checks whether you have the required permissions for the action, without // actually making the request, and provides an error response. If you have @@ -21832,6 +30233,27 @@ func (s RunScheduledInstancesInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *RunScheduledInstancesInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "RunScheduledInstancesInput"} + if s.LaunchSpecification == nil { + invalidParams.Add(request.NewErrParamRequired("LaunchSpecification")) + } + if s.ScheduledInstanceId == nil { + invalidParams.Add(request.NewErrParamRequired("ScheduledInstanceId")) + } + if s.LaunchSpecification != nil { + if err := s.LaunchSpecification.Validate(); err != nil { + invalidParams.AddNested("LaunchSpecification", err.(request.ErrInvalidParams)) + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + // Contains the output of RunScheduledInstances. type RunScheduledInstancesOutput struct { _ struct{} `type:"structure"` @@ -21868,11 +30290,13 @@ type S3Storage struct { // 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. + // An Amazon S3 upload policy that gives Amazon EC2 permission to upload items + // into Amazon S3 on your behalf. + // + // UploadPolicy is automatically base64 encoded/decoded by the SDK. UploadPolicy []byte `locationName:"uploadPolicy" type:"blob"` - // The signature of the Base64 encoded JSON document. + // The signature of the JSON document. UploadPolicySignature *string `locationName:"uploadPolicySignature" type:"string"` } @@ -22122,19 +30546,18 @@ type ScheduledInstancesEbs struct { Encrypted *bool `type:"boolean"` // The number of I/O operations per second (IOPS) that the volume supports. - // For Provisioned IOPS (SSD) volumes, this represents the number of IOPS that - // are provisioned for the volume. For General Purpose (SSD) volumes, this represents - // the baseline performance of the volume and the rate at which the volume accumulates - // I/O credits for bursting. For more information about General Purpose (SSD) - // baseline performance, I/O credits, and bursting, see Amazon EBS Volume Types - // (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSVolumeTypes.html) + // For io1 volumes, this represents the number of IOPS that are provisioned + // for the volume. For gp2 volumes, this represents the baseline performance + // of the volume and the rate at which the volume accumulates I/O credits for + // bursting. For more information about gp2 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. + // Constraint: Range is 100-20000 IOPS for io1 volumes and 100-10000 IOPS for + // gp2 volumes. // - // Condition: This parameter is required for requests to create io1 volumes; - // it is not used in requests to create standard or gp2 volumes. + // Condition: This parameter is required for requests to create io1volumes; + // it is not used in requests to create gp2, st1, sc1, or standard volumes. Iops *int64 `type:"integer"` // The ID of the snapshot. @@ -22146,8 +30569,8 @@ type ScheduledInstancesEbs struct { // a volume size, the default is the snapshot size. VolumeSize *int64 `type:"integer"` - // The volume type. gp2 for General Purpose (SSD) volumes, io1 for Provisioned - // IOPS (SSD) volumes, and standard for Magnetic volumes. + // The volume type. gp2 for General Purpose SSD, io1 for Provisioned IOPS SSD, + // Throughput Optimized HDD for st1, Cold HDD for sc1, or standard for Magnetic. // // Default: standard VolumeType *string `type:"string"` @@ -22185,6 +30608,10 @@ func (s ScheduledInstancesIamInstanceProfile) GoString() string { } // Describes the launch specification for a Scheduled Instance. +// +// If you are launching the Scheduled Instance in EC2-VPC, you must specify +// the ID of the subnet. You can specify the subnet using either SubnetId or +// NetworkInterface. type ScheduledInstancesLaunchSpecification struct { _ struct{} `type:"structure"` @@ -22247,6 +30674,19 @@ func (s ScheduledInstancesLaunchSpecification) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *ScheduledInstancesLaunchSpecification) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "ScheduledInstancesLaunchSpecification"} + if s.ImageId == nil { + invalidParams.Add(request.NewErrParamRequired("ImageId")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + // Describes whether monitoring is enabled for a Scheduled Instance. type ScheduledInstancesMonitoring struct { _ struct{} `type:"structure"` @@ -22396,6 +30836,30 @@ func (s SecurityGroup) GoString() string { return s.String() } +// Describes a VPC with a security group that references your security group. +type SecurityGroupReference struct { + _ struct{} `type:"structure"` + + // The ID of your security group. + GroupId *string `locationName:"groupId" type:"string" required:"true"` + + // The ID of the VPC with the referencing security group. + ReferencingVpcId *string `locationName:"referencingVpcId" type:"string" required:"true"` + + // The ID of the VPC peering connection. + VpcPeeringConnectionId *string `locationName:"vpcPeeringConnectionId" type:"string"` +} + +// String returns the string representation +func (s SecurityGroupReference) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s SecurityGroupReference) GoString() string { + return s.String() +} + // Describes the time period for a Scheduled Instance to start its first schedule. // The time period must span less than one day. type SlotDateTimeRangeRequest struct { @@ -22420,6 +30884,22 @@ func (s SlotDateTimeRangeRequest) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *SlotDateTimeRangeRequest) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "SlotDateTimeRangeRequest"} + if s.EarliestTime == nil { + invalidParams.Add(request.NewErrParamRequired("EarliestTime")) + } + if s.LatestTime == nil { + invalidParams.Add(request.NewErrParamRequired("LatestTime")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + // Describes the time period for a Scheduled Instance to start its first schedule. type SlotStartTimeRangeRequest struct { _ struct{} `type:"structure"` @@ -22464,8 +30944,9 @@ type Snapshot struct { // volume. KmsKeyId *string `locationName:"kmsKeyId" type:"string"` - // The AWS account alias (for example, amazon, self) or AWS account ID that - // owns the snapshot. + // Value from an Amazon-maintained list (amazon | aws-marketplace | microsoft) + // of snapshot owners. Not to be confused with the user-configured AWS account + // alias, which is set from the IAM console. OwnerAlias *string `locationName:"ownerAlias" type:"string"` // The AWS account ID of the EBS snapshot owner. @@ -22494,7 +30975,9 @@ type Snapshot struct { // Any tags assigned to the snapshot. Tags []*Tag `locationName:"tagSet" locationNameList:"item" type:"list"` - // The ID of the volume that was used to create the snapshot. + // The ID of the volume that was used to create the snapshot. Snapshots created + // by the CopySnapshot action have an arbitrary volume ID that should not be + // used for any purpose. VolumeId *string `locationName:"volumeId" type:"string"` // The size of the volume, in GiB. @@ -22542,7 +31025,7 @@ type SnapshotDetail struct { // The URL used to access the disk image. Url *string `locationName:"url" type:"string"` - // Describes the S3 bucket for the disk image. + // The S3 bucket for the disk image. UserBucket *UserBucketDetails `locationName:"userBucket" type:"structure"` } @@ -22572,7 +31055,7 @@ type SnapshotDiskContainer struct { // a https URL (https://..) or an Amazon S3 URL (s3://..). Url *string `type:"string"` - // Describes the S3 bucket for the disk image. + // The S3 bucket for the disk image. UserBucket *UserBucket `type:"structure"` } @@ -22719,7 +31202,9 @@ type SpotFleetLaunchSpecification struct { // subnets, separate them using commas; for example, "subnet-a61dafcf, subnet-65ea5f08". SubnetId *string `locationName:"subnetId" type:"string"` - // The Base64-encoded MIME user data to make available to the instances. + // The user data to make available to the instances. If you are using an AWS + // SDK or command line tool, Base64-encoding is performed for you, and you can + // load the text from a file. Otherwise, you must provide Base64-encoded text. UserData *string `locationName:"userData" type:"string"` // The number of units provided by the specified instance type. These are the @@ -22742,6 +31227,26 @@ func (s SpotFleetLaunchSpecification) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *SpotFleetLaunchSpecification) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "SpotFleetLaunchSpecification"} + if s.NetworkInterfaces != nil { + for i, v := range s.NetworkInterfaces { + if v == nil { + continue + } + if err := v.Validate(); err != nil { + invalidParams.AddNested(fmt.Sprintf("%s[%v]", "NetworkInterfaces", i), err.(request.ErrInvalidParams)) + } + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + // Describes whether monitoring is enabled. type SpotFleetMonitoring struct { _ struct{} `type:"structure"` @@ -22766,6 +31271,13 @@ func (s SpotFleetMonitoring) GoString() string { type SpotFleetRequestConfig struct { _ struct{} `type:"structure"` + // The progress of the Spot fleet request. If there is an error, the status + // is error. After all bids are placed, the status is pending_fulfillment. If + // the size of the fleet is equal to or greater than its target capacity, the + // status is fulfilled. If the size of the fleet is decreased, the status is + // pending_termination while Spot instances are terminating. + ActivityStatus *string `locationName:"activityStatus" type:"string" enum:"ActivityStatus"` + // The creation date and time of the request. CreateTime *time.Time `locationName:"createTime" type:"timestamp" timestampFormat:"iso8601" required:"true"` @@ -22807,6 +31319,10 @@ type SpotFleetRequestConfigData struct { // the Spot fleet. ExcessCapacityTerminationPolicy *string `locationName:"excessCapacityTerminationPolicy" type:"string" enum:"ExcessCapacityTerminationPolicy"` + // The number of units fulfilled by this request compared to the set target + // capacity. + FulfilledCapacity *float64 `locationName:"fulfilledCapacity" type:"double"` + // Grants the Spot fleet permission to terminate Spot instances on your behalf // when you cancel its Spot fleet request using CancelSpotFleetRequests or when // the Spot fleet request expires, if you set terminateInstancesWithExpiration. @@ -22827,6 +31343,16 @@ type SpotFleetRequestConfigData struct { // fleet request expires. TerminateInstancesWithExpiration *bool `locationName:"terminateInstancesWithExpiration" type:"boolean"` + // The type of request. Indicates whether the fleet will only request the target + // capacity or also attempt to maintain it. When you request a certain target + // capacity, the fleet will only place the required bids. It will not attempt + // to replenish Spot instances if capacity is diminished, nor will it submit + // bids in alternative Spot pools if capacity is not available. When you want + // to maintain a certain target capacity, fleet will place the required bids + // to meet this target capacity. It will also automatically replenish any interrupted + // instances. Default: maintain. + Type *string `locationName:"type" type:"string" enum:"FleetType"` + // The start date and time of the request, in UTC format (for example, YYYY-MM-DDTHH:MM:SSZ). // The default is to start fulfilling the request immediately. ValidFrom *time.Time `locationName:"validFrom" type:"timestamp" timestampFormat:"iso8601"` @@ -22847,6 +31373,41 @@ func (s SpotFleetRequestConfigData) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *SpotFleetRequestConfigData) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "SpotFleetRequestConfigData"} + if s.IamFleetRole == nil { + invalidParams.Add(request.NewErrParamRequired("IamFleetRole")) + } + if s.LaunchSpecifications == nil { + invalidParams.Add(request.NewErrParamRequired("LaunchSpecifications")) + } + if s.LaunchSpecifications != nil && len(s.LaunchSpecifications) < 1 { + invalidParams.Add(request.NewErrParamMinLen("LaunchSpecifications", 1)) + } + if s.SpotPrice == nil { + invalidParams.Add(request.NewErrParamRequired("SpotPrice")) + } + if s.TargetCapacity == nil { + invalidParams.Add(request.NewErrParamRequired("TargetCapacity")) + } + if s.LaunchSpecifications != nil { + for i, v := range s.LaunchSpecifications { + if v == nil { + continue + } + if err := v.Validate(); err != nil { + invalidParams.AddNested(fmt.Sprintf("%s[%v]", "LaunchSpecifications", i), err.(request.ErrInvalidParams)) + } + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + // Describes a Spot instance request. type SpotInstanceRequest struct { _ struct{} `type:"structure"` @@ -22981,8 +31542,10 @@ func (s SpotInstanceStatus) GoString() string { type SpotPlacement struct { _ struct{} `type:"structure"` - // The Availability Zones. To specify multiple Availability Zones, separate - // them using commas; for example, "us-west-2a, us-west-2b". + // The Availability Zone. + // + // [Spot fleet only] To specify multiple Availability Zones, separate them + // using commas; for example, "us-west-2a, us-west-2b". AvailabilityZone *string `locationName:"availabilityZone" type:"string"` // The name of the placement group (for cluster instances). @@ -23030,6 +31593,78 @@ func (s SpotPrice) GoString() string { return s.String() } +// Describes a stale rule in a security group. +type StaleIpPermission struct { + _ struct{} `type:"structure"` + + // The start of the 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 IP protocol name (for tcp, udp, and icmp) or number (see Protocol Numbers) + // (http://www.iana.org/assignments/protocol-numbers/protocol-numbers.xhtml). + IpProtocol *string `locationName:"ipProtocol" type:"string"` + + // One or more IP ranges. Not applicable for stale security group rules. + IpRanges []*string `locationName:"ipRanges" locationNameList:"item" type:"list"` + + // One or more prefix list IDs for an AWS service. Not applicable for stale + // security group rules. + PrefixListIds []*string `locationName:"prefixListIds" locationNameList:"item" type:"list"` + + // The end of the port range for the TCP and UDP protocols, or an ICMP type + // number. A value of -1 indicates all ICMP types. + ToPort *int64 `locationName:"toPort" type:"integer"` + + // One or more security group pairs. Returns the ID of the referenced security + // group and VPC, and the ID and status of the VPC peering connection. + UserIdGroupPairs []*UserIdGroupPair `locationName:"groups" locationNameList:"item" type:"list"` +} + +// String returns the string representation +func (s StaleIpPermission) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s StaleIpPermission) GoString() string { + return s.String() +} + +// Describes a stale security group (a security group that contains stale rules). +type StaleSecurityGroup struct { + _ struct{} `type:"structure"` + + // The description of the security group. + Description *string `locationName:"description" type:"string"` + + // The ID of the security group. + GroupId *string `locationName:"groupId" type:"string" required:"true"` + + // The name of the security group. + GroupName *string `locationName:"groupName" type:"string"` + + // Information about the stale inbound rules in the security group. + StaleIpPermissions []*StaleIpPermission `locationName:"staleIpPermissions" locationNameList:"item" type:"list"` + + // Information about the stale outbound rules in the security group. + StaleIpPermissionsEgress []*StaleIpPermission `locationName:"staleIpPermissionsEgress" locationNameList:"item" type:"list"` + + // The ID of the VPC for the security group. + VpcId *string `locationName:"vpcId" type:"string"` +} + +// String returns the string representation +func (s StaleSecurityGroup) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s StaleSecurityGroup) GoString() string { + return s.String() +} + +// Contains the parameters for StartInstances. type StartInstancesInput struct { _ struct{} `type:"structure"` @@ -23056,6 +31691,20 @@ func (s StartInstancesInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *StartInstancesInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "StartInstancesInput"} + if s.InstanceIds == nil { + invalidParams.Add(request.NewErrParamRequired("InstanceIds")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// Contains the output of StartInstances. type StartInstancesOutput struct { _ struct{} `type:"structure"` @@ -23082,28 +31731,29 @@ type StateReason struct { // The message for the state change. // - // Server.SpotInstanceTermination: A Spot instance was terminated due to an - // increase in the market price. + // Server.SpotInstanceTermination: A Spot instance was terminated due to + // an increase in the market price. // - // Server.InternalError: An internal error occurred during instance launch, + // Server.InternalError: An internal error occurred during instance launch, // resulting in termination. // - // Server.InsufficientInstanceCapacity: There was insufficient instance capacity - // to satisfy the launch request. + // 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.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.InstanceInitiatedShutdown: The instance was shut down using the + // shutdown -h command from the instance. // - // Client.UserInitiatedShutdown: The instance was shut down using the Amazon + // Client.UserInitiatedShutdown: The instance was shut down using the Amazon // EC2 API. // - // Client.VolumeLimitExceeded: The limit on the number of EBS volumes or total - // storage was exceeded. Decrease usage or request an increase in your limits. + // Client.VolumeLimitExceeded: The limit on the number of EBS volumes or + // total storage was exceeded. Decrease usage or request an increase in your + // limits. // - // Client.InvalidSnapshot.NotFound: The specified snapshot was not found. + // Client.InvalidSnapshot.NotFound: The specified snapshot was not found. Message *string `locationName:"message" type:"string"` } @@ -23117,6 +31767,7 @@ func (s StateReason) GoString() string { return s.String() } +// Contains the parameters for StopInstances. type StopInstancesInput struct { _ struct{} `type:"structure"` @@ -23148,6 +31799,20 @@ func (s StopInstancesInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *StopInstancesInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "StopInstancesInput"} + if s.InstanceIds == nil { + invalidParams.Add(request.NewErrParamRequired("InstanceIds")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// Contains the output of StopInstances. type StopInstancesOutput struct { _ struct{} `type:"structure"` @@ -23280,6 +31945,7 @@ func (s TagDescription) GoString() string { return s.String() } +// Contains the parameters for TerminateInstances. type TerminateInstancesInput struct { _ struct{} `type:"structure"` @@ -23303,6 +31969,20 @@ func (s TerminateInstancesInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *TerminateInstancesInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "TerminateInstancesInput"} + if s.InstanceIds == nil { + invalidParams.Add(request.NewErrParamRequired("InstanceIds")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// Contains the output of TerminateInstances. type TerminateInstancesOutput struct { _ struct{} `type:"structure"` @@ -23320,6 +32000,7 @@ func (s TerminateInstancesOutput) GoString() string { return s.String() } +// Contains the parameters for UnassignPrivateIpAddresses. type UnassignPrivateIpAddressesInput struct { _ struct{} `type:"structure"` @@ -23341,6 +32022,22 @@ func (s UnassignPrivateIpAddressesInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *UnassignPrivateIpAddressesInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "UnassignPrivateIpAddressesInput"} + if s.NetworkInterfaceId == nil { + invalidParams.Add(request.NewErrParamRequired("NetworkInterfaceId")) + } + if s.PrivateIpAddresses == nil { + invalidParams.Add(request.NewErrParamRequired("PrivateIpAddresses")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + type UnassignPrivateIpAddressesOutput struct { _ struct{} `type:"structure"` } @@ -23355,6 +32052,7 @@ func (s UnassignPrivateIpAddressesOutput) GoString() string { return s.String() } +// Contains the parameters for UnmonitorInstances. type UnmonitorInstancesInput struct { _ struct{} `type:"structure"` @@ -23378,6 +32076,20 @@ func (s UnmonitorInstancesInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *UnmonitorInstancesInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "UnmonitorInstancesInput"} + if s.InstanceIds == nil { + invalidParams.Add(request.NewErrParamRequired("InstanceIds")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// Contains the output of UnmonitorInstances. type UnmonitorInstancesOutput struct { _ struct{} `type:"structure"` @@ -23445,7 +32157,7 @@ type UserBucket struct { // The name of the S3 bucket where the disk image is located. S3Bucket *string `type:"string"` - // The key for the disk image. + // The file name of the disk image. S3Key *string `type:"string"` } @@ -23466,7 +32178,7 @@ type UserBucketDetails struct { // The S3 bucket from which the disk image was created. S3Bucket *string `locationName:"s3Bucket" type:"string"` - // The key from which the disk image was created. + // The file name of the disk image. S3Key *string `locationName:"s3Key" type:"string"` } @@ -23480,11 +32192,13 @@ func (s UserBucketDetails) GoString() string { return s.String() } -// Describes the user data to be made available to an instance. +// Describes the user data for an instance. type UserData struct { _ struct{} `type:"structure"` - // The Base64-encoded MIME user data for the instance. + // The user data. If you are using an AWS SDK or command line tool, Base64-encoding + // is performed for you, and you can load the text from a file. Otherwise, you + // must provide Base64-encoded text. Data *string `locationName:"data" type:"string"` } @@ -23507,11 +32221,24 @@ type UserIdGroupPair struct { // 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. + // VPC, use the security group ID. GroupName *string `locationName:"groupName" type:"string"` - // The ID of an AWS account. EC2-Classic only. + // The status of a VPC peering connection, if applicable. + PeeringStatus *string `locationName:"peeringStatus" type:"string"` + + // The ID of an AWS account. For a referenced security group in another VPC, + // the account ID of the referenced security group is returned. + // + // [EC2-Classic] Required when adding or removing rules that reference a security + // group in another AWS account. UserId *string `locationName:"userId" type:"string"` + + // The ID of the VPC for the referenced security group, if applicable. + VpcId *string `locationName:"vpcId" type:"string"` + + // The ID of the VPC peering connection, if applicable. + VpcPeeringConnectionId *string `locationName:"vpcPeeringConnectionId" type:"string"` } // String returns the string representation @@ -23572,18 +32299,18 @@ type Volume struct { 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 + // 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 + // 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. + // Constraint: Range is 100-20000 IOPS for io1 volumes and 100-10000 IOPS for + // gp2 volumes. // // Condition: This parameter is required for requests to create io1 volumes; - // it is not used in requests to create standard or gp2 volumes. + // it is not used in requests to create gp2, st1, sc1, or standard volumes. Iops *int64 `locationName:"iops" type:"integer"` // The full ARN of the AWS Key Management Service (AWS KMS) customer master @@ -23605,8 +32332,9 @@ type Volume struct { // 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. + // The volume type. This can be gp2 for General Purpose SSD, io1 for Provisioned + // IOPS SSD, st1 for Throughput Optimized HDD, sc1 for Cold HDD, or standard + // for Magnetic volumes. VolumeType *string `locationName:"volumeType" type:"string" enum:"VolumeType"` } @@ -23671,6 +32399,19 @@ func (s VolumeDetail) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *VolumeDetail) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "VolumeDetail"} + if s.Size == nil { + invalidParams.Add(request.NewErrParamRequired("Size")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + // Describes a volume status operation code. type VolumeStatusAction struct { _ struct{} `type:"structure"` @@ -23922,13 +32663,15 @@ func (s VpcEndpoint) GoString() string { type VpcPeeringConnection struct { _ struct{} `type:"structure"` - // The information of the peer VPC. + // Information about the accepter VPC. CIDR block information is not returned + // when creating a VPC peering connection, or when describing a VPC peering + // connection that's in the initiating-request or pending-acceptance state. 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. + // Information about the requester VPC. RequesterVpcInfo *VpcPeeringConnectionVpcInfo `locationName:"requesterVpcInfo" type:"structure"` // The status of the VPC peering connection. @@ -23951,6 +32694,33 @@ func (s VpcPeeringConnection) GoString() string { return s.String() } +// Describes the VPC peering connection options. +type VpcPeeringConnectionOptionsDescription struct { + _ struct{} `type:"structure"` + + // Indicates whether a local VPC can resolve public DNS hostnames to private + // IP addresses when queried from instances in a peer VPC. + AllowDnsResolutionFromRemoteVpc *bool `locationName:"allowDnsResolutionFromRemoteVpc" type:"boolean"` + + // Indicates whether a local ClassicLink connection can communicate with the + // peer VPC over the VPC peering connection. + AllowEgressFromLocalClassicLinkToRemoteVpc *bool `locationName:"allowEgressFromLocalClassicLinkToRemoteVpc" type:"boolean"` + + // Indicates whether a local VPC can communicate with a ClassicLink connection + // in the peer VPC over the VPC peering connection. + AllowEgressFromLocalVpcToRemoteClassicLink *bool `locationName:"allowEgressFromLocalVpcToRemoteClassicLink" type:"boolean"` +} + +// String returns the string representation +func (s VpcPeeringConnectionOptionsDescription) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s VpcPeeringConnectionOptionsDescription) GoString() string { + return s.String() +} + // Describes the status of a VPC peering connection. type VpcPeeringConnectionStateReason struct { _ struct{} `type:"structure"` @@ -23982,6 +32752,10 @@ type VpcPeeringConnectionVpcInfo struct { // The AWS account ID of the VPC owner. OwnerId *string `locationName:"ownerId" type:"string"` + // Information about the VPC peering connection options for the accepter or + // requester VPC. + PeeringOptions *VpcPeeringConnectionOptionsDescription `locationName:"peeringOptions" type:"structure"` + // The ID of the VPC. VpcId *string `locationName:"vpcId" type:"string"` } @@ -24147,6 +32921,17 @@ const ( AccountAttributeNameDefaultVpc = "default-vpc" ) +const ( + // @enum ActivityStatus + ActivityStatusError = "error" + // @enum ActivityStatus + ActivityStatusPendingFulfillment = "pending_fulfillment" + // @enum ActivityStatus + ActivityStatusPendingTermination = "pending_termination" + // @enum ActivityStatus + ActivityStatusFulfilled = "fulfilled" +) + const ( // @enum Affinity AffinityDefault = "default" @@ -24368,6 +33153,13 @@ const ( ExportTaskStateCompleted = "completed" ) +const ( + // @enum FleetType + FleetTypeRequest = "request" + // @enum FleetType + FleetTypeMaintain = "maintain" +) + const ( // @enum FlowLogsResourceType FlowLogsResourceTypeVpc = "VPC" @@ -24466,11 +33258,15 @@ const ( InstanceAttributeNameEbsOptimized = "ebsOptimized" // @enum InstanceAttributeName InstanceAttributeNameSriovNetSupport = "sriovNetSupport" + // @enum InstanceAttributeName + InstanceAttributeNameEnaSupport = "enaSupport" ) const ( // @enum InstanceLifecycleType InstanceLifecycleTypeSpot = "spot" + // @enum InstanceLifecycleType + InstanceLifecycleTypeScheduled = "scheduled" ) const ( @@ -24492,6 +33288,16 @@ const ( // @enum InstanceType InstanceTypeT1Micro = "t1.micro" // @enum InstanceType + InstanceTypeT2Nano = "t2.nano" + // @enum InstanceType + InstanceTypeT2Micro = "t2.micro" + // @enum InstanceType + InstanceTypeT2Small = "t2.small" + // @enum InstanceType + InstanceTypeT2Medium = "t2.medium" + // @enum InstanceType + InstanceTypeT2Large = "t2.large" + // @enum InstanceType InstanceTypeM1Small = "m1.small" // @enum InstanceType InstanceTypeM1Medium = "m1.medium" @@ -24518,16 +33324,6 @@ const ( // @enum InstanceType InstanceTypeM410xlarge = "m4.10xlarge" // @enum InstanceType - InstanceTypeT2Nano = "t2.nano" - // @enum InstanceType - InstanceTypeT2Micro = "t2.micro" - // @enum InstanceType - InstanceTypeT2Small = "t2.small" - // @enum InstanceType - InstanceTypeT2Medium = "t2.medium" - // @enum InstanceType - InstanceTypeT2Large = "t2.large" - // @enum InstanceType InstanceTypeM2Xlarge = "m2.xlarge" // @enum InstanceType InstanceTypeM22xlarge = "m2.2xlarge" @@ -24536,6 +33332,24 @@ const ( // @enum InstanceType InstanceTypeCr18xlarge = "cr1.8xlarge" // @enum InstanceType + InstanceTypeR3Large = "r3.large" + // @enum InstanceType + InstanceTypeR3Xlarge = "r3.xlarge" + // @enum InstanceType + InstanceTypeR32xlarge = "r3.2xlarge" + // @enum InstanceType + InstanceTypeR34xlarge = "r3.4xlarge" + // @enum InstanceType + InstanceTypeR38xlarge = "r3.8xlarge" + // @enum InstanceType + InstanceTypeX14xlarge = "x1.4xlarge" + // @enum InstanceType + InstanceTypeX18xlarge = "x1.8xlarge" + // @enum InstanceType + InstanceTypeX116xlarge = "x1.16xlarge" + // @enum InstanceType + InstanceTypeX132xlarge = "x1.32xlarge" + // @enum InstanceType InstanceTypeI2Xlarge = "i2.xlarge" // @enum InstanceType InstanceTypeI22xlarge = "i2.2xlarge" @@ -24578,18 +33392,10 @@ const ( // @enum InstanceType InstanceTypeG22xlarge = "g2.2xlarge" // @enum InstanceType + InstanceTypeG28xlarge = "g2.8xlarge" + // @enum InstanceType InstanceTypeCg14xlarge = "cg1.4xlarge" // @enum InstanceType - InstanceTypeR3Large = "r3.large" - // @enum InstanceType - InstanceTypeR3Xlarge = "r3.xlarge" - // @enum InstanceType - InstanceTypeR32xlarge = "r3.2xlarge" - // @enum InstanceType - InstanceTypeR34xlarge = "r3.4xlarge" - // @enum InstanceType - InstanceTypeR38xlarge = "r3.8xlarge" - // @enum InstanceType InstanceTypeD2Xlarge = "d2.xlarge" // @enum InstanceType InstanceTypeD22xlarge = "d2.2xlarge" @@ -24703,6 +33509,15 @@ const ( OperationTypeRemove = "remove" ) +const ( + // @enum PaymentOption + PaymentOptionAllUpfront = "AllUpfront" + // @enum PaymentOption + PaymentOptionPartialUpfront = "PartialUpfront" + // @enum PaymentOption + PaymentOptionNoUpfront = "NoUpfront" +) + const ( // @enum PermissionGroup PermissionGroupAll = "all" @@ -24780,6 +33595,17 @@ const ( ReportStatusTypeImpaired = "impaired" ) +const ( + // @enum ReservationState + ReservationStatePaymentPending = "payment-pending" + // @enum ReservationState + ReservationStatePaymentFailed = "payment-failed" + // @enum ReservationState + ReservationStateActive = "active" + // @enum ReservationState + ReservationStateRetired = "retired" +) + const ( // @enum ReservedInstanceState ReservedInstanceStatePaymentPending = "payment-pending" @@ -25043,6 +33869,10 @@ const ( VolumeTypeIo1 = "io1" // @enum VolumeType VolumeTypeGp2 = "gp2" + // @enum VolumeType + VolumeTypeSc1 = "sc1" + // @enum VolumeType + VolumeTypeSt1 = "st1" ) const ( diff --git a/vendor/github.com/aws/aws-sdk-go/service/ec2/customizations.go b/vendor/github.com/aws/aws-sdk-go/service/ec2/customizations.go index 9e94fe671..36181d991 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/ec2/customizations.go +++ b/vendor/github.com/aws/aws-sdk-go/service/ec2/customizations.go @@ -40,7 +40,11 @@ func fillPresignedURL(r *request.Request) { clientInfo := r.ClientInfo clientInfo.Endpoint, clientInfo.SigningRegion = endpoints.EndpointForRegion( - clientInfo.ServiceName, aws.StringValue(cfg.Region), aws.BoolValue(cfg.DisableSSL)) + clientInfo.ServiceName, + aws.StringValue(cfg.Region), + aws.BoolValue(cfg.DisableSSL), + aws.BoolValue(cfg.UseDualStack), + ) // Presign a CopySnapshot request with modified params req := request.New(*cfg, clientInfo, r.Handlers, r.Retryer, r.Operation, newParams, r.Data) diff --git a/vendor/github.com/aws/aws-sdk-go/service/ec2/ec2iface/interface.go b/vendor/github.com/aws/aws-sdk-go/service/ec2/ec2iface/interface.go deleted file mode 100644 index 3091c64d5..000000000 --- a/vendor/github.com/aws/aws-sdk-go/service/ec2/ec2iface/interface.go +++ /dev/null @@ -1,832 +0,0 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. - -// Package ec2iface provides an interface for the Amazon Elastic Compute Cloud. -package ec2iface - -import ( - "github.com/aws/aws-sdk-go/aws/request" - "github.com/aws/aws-sdk-go/service/ec2" -) - -// EC2API is the interface type for ec2.EC2. -type EC2API interface { - AcceptVpcPeeringConnectionRequest(*ec2.AcceptVpcPeeringConnectionInput) (*request.Request, *ec2.AcceptVpcPeeringConnectionOutput) - - AcceptVpcPeeringConnection(*ec2.AcceptVpcPeeringConnectionInput) (*ec2.AcceptVpcPeeringConnectionOutput, error) - - AllocateAddressRequest(*ec2.AllocateAddressInput) (*request.Request, *ec2.AllocateAddressOutput) - - AllocateAddress(*ec2.AllocateAddressInput) (*ec2.AllocateAddressOutput, error) - - AllocateHostsRequest(*ec2.AllocateHostsInput) (*request.Request, *ec2.AllocateHostsOutput) - - AllocateHosts(*ec2.AllocateHostsInput) (*ec2.AllocateHostsOutput, error) - - AssignPrivateIpAddressesRequest(*ec2.AssignPrivateIpAddressesInput) (*request.Request, *ec2.AssignPrivateIpAddressesOutput) - - AssignPrivateIpAddresses(*ec2.AssignPrivateIpAddressesInput) (*ec2.AssignPrivateIpAddressesOutput, error) - - AssociateAddressRequest(*ec2.AssociateAddressInput) (*request.Request, *ec2.AssociateAddressOutput) - - AssociateAddress(*ec2.AssociateAddressInput) (*ec2.AssociateAddressOutput, error) - - AssociateDhcpOptionsRequest(*ec2.AssociateDhcpOptionsInput) (*request.Request, *ec2.AssociateDhcpOptionsOutput) - - AssociateDhcpOptions(*ec2.AssociateDhcpOptionsInput) (*ec2.AssociateDhcpOptionsOutput, error) - - AssociateRouteTableRequest(*ec2.AssociateRouteTableInput) (*request.Request, *ec2.AssociateRouteTableOutput) - - AssociateRouteTable(*ec2.AssociateRouteTableInput) (*ec2.AssociateRouteTableOutput, error) - - AttachClassicLinkVpcRequest(*ec2.AttachClassicLinkVpcInput) (*request.Request, *ec2.AttachClassicLinkVpcOutput) - - AttachClassicLinkVpc(*ec2.AttachClassicLinkVpcInput) (*ec2.AttachClassicLinkVpcOutput, error) - - AttachInternetGatewayRequest(*ec2.AttachInternetGatewayInput) (*request.Request, *ec2.AttachInternetGatewayOutput) - - AttachInternetGateway(*ec2.AttachInternetGatewayInput) (*ec2.AttachInternetGatewayOutput, error) - - AttachNetworkInterfaceRequest(*ec2.AttachNetworkInterfaceInput) (*request.Request, *ec2.AttachNetworkInterfaceOutput) - - AttachNetworkInterface(*ec2.AttachNetworkInterfaceInput) (*ec2.AttachNetworkInterfaceOutput, error) - - AttachVolumeRequest(*ec2.AttachVolumeInput) (*request.Request, *ec2.VolumeAttachment) - - AttachVolume(*ec2.AttachVolumeInput) (*ec2.VolumeAttachment, error) - - AttachVpnGatewayRequest(*ec2.AttachVpnGatewayInput) (*request.Request, *ec2.AttachVpnGatewayOutput) - - AttachVpnGateway(*ec2.AttachVpnGatewayInput) (*ec2.AttachVpnGatewayOutput, error) - - AuthorizeSecurityGroupEgressRequest(*ec2.AuthorizeSecurityGroupEgressInput) (*request.Request, *ec2.AuthorizeSecurityGroupEgressOutput) - - AuthorizeSecurityGroupEgress(*ec2.AuthorizeSecurityGroupEgressInput) (*ec2.AuthorizeSecurityGroupEgressOutput, error) - - AuthorizeSecurityGroupIngressRequest(*ec2.AuthorizeSecurityGroupIngressInput) (*request.Request, *ec2.AuthorizeSecurityGroupIngressOutput) - - AuthorizeSecurityGroupIngress(*ec2.AuthorizeSecurityGroupIngressInput) (*ec2.AuthorizeSecurityGroupIngressOutput, error) - - BundleInstanceRequest(*ec2.BundleInstanceInput) (*request.Request, *ec2.BundleInstanceOutput) - - BundleInstance(*ec2.BundleInstanceInput) (*ec2.BundleInstanceOutput, error) - - CancelBundleTaskRequest(*ec2.CancelBundleTaskInput) (*request.Request, *ec2.CancelBundleTaskOutput) - - CancelBundleTask(*ec2.CancelBundleTaskInput) (*ec2.CancelBundleTaskOutput, error) - - CancelConversionTaskRequest(*ec2.CancelConversionTaskInput) (*request.Request, *ec2.CancelConversionTaskOutput) - - CancelConversionTask(*ec2.CancelConversionTaskInput) (*ec2.CancelConversionTaskOutput, error) - - CancelExportTaskRequest(*ec2.CancelExportTaskInput) (*request.Request, *ec2.CancelExportTaskOutput) - - CancelExportTask(*ec2.CancelExportTaskInput) (*ec2.CancelExportTaskOutput, error) - - CancelImportTaskRequest(*ec2.CancelImportTaskInput) (*request.Request, *ec2.CancelImportTaskOutput) - - CancelImportTask(*ec2.CancelImportTaskInput) (*ec2.CancelImportTaskOutput, error) - - CancelReservedInstancesListingRequest(*ec2.CancelReservedInstancesListingInput) (*request.Request, *ec2.CancelReservedInstancesListingOutput) - - CancelReservedInstancesListing(*ec2.CancelReservedInstancesListingInput) (*ec2.CancelReservedInstancesListingOutput, error) - - CancelSpotFleetRequestsRequest(*ec2.CancelSpotFleetRequestsInput) (*request.Request, *ec2.CancelSpotFleetRequestsOutput) - - CancelSpotFleetRequests(*ec2.CancelSpotFleetRequestsInput) (*ec2.CancelSpotFleetRequestsOutput, error) - - CancelSpotInstanceRequestsRequest(*ec2.CancelSpotInstanceRequestsInput) (*request.Request, *ec2.CancelSpotInstanceRequestsOutput) - - CancelSpotInstanceRequests(*ec2.CancelSpotInstanceRequestsInput) (*ec2.CancelSpotInstanceRequestsOutput, error) - - ConfirmProductInstanceRequest(*ec2.ConfirmProductInstanceInput) (*request.Request, *ec2.ConfirmProductInstanceOutput) - - ConfirmProductInstance(*ec2.ConfirmProductInstanceInput) (*ec2.ConfirmProductInstanceOutput, error) - - CopyImageRequest(*ec2.CopyImageInput) (*request.Request, *ec2.CopyImageOutput) - - CopyImage(*ec2.CopyImageInput) (*ec2.CopyImageOutput, error) - - CopySnapshotRequest(*ec2.CopySnapshotInput) (*request.Request, *ec2.CopySnapshotOutput) - - CopySnapshot(*ec2.CopySnapshotInput) (*ec2.CopySnapshotOutput, error) - - CreateCustomerGatewayRequest(*ec2.CreateCustomerGatewayInput) (*request.Request, *ec2.CreateCustomerGatewayOutput) - - CreateCustomerGateway(*ec2.CreateCustomerGatewayInput) (*ec2.CreateCustomerGatewayOutput, error) - - CreateDhcpOptionsRequest(*ec2.CreateDhcpOptionsInput) (*request.Request, *ec2.CreateDhcpOptionsOutput) - - CreateDhcpOptions(*ec2.CreateDhcpOptionsInput) (*ec2.CreateDhcpOptionsOutput, error) - - CreateFlowLogsRequest(*ec2.CreateFlowLogsInput) (*request.Request, *ec2.CreateFlowLogsOutput) - - CreateFlowLogs(*ec2.CreateFlowLogsInput) (*ec2.CreateFlowLogsOutput, error) - - CreateImageRequest(*ec2.CreateImageInput) (*request.Request, *ec2.CreateImageOutput) - - CreateImage(*ec2.CreateImageInput) (*ec2.CreateImageOutput, error) - - CreateInstanceExportTaskRequest(*ec2.CreateInstanceExportTaskInput) (*request.Request, *ec2.CreateInstanceExportTaskOutput) - - CreateInstanceExportTask(*ec2.CreateInstanceExportTaskInput) (*ec2.CreateInstanceExportTaskOutput, error) - - CreateInternetGatewayRequest(*ec2.CreateInternetGatewayInput) (*request.Request, *ec2.CreateInternetGatewayOutput) - - CreateInternetGateway(*ec2.CreateInternetGatewayInput) (*ec2.CreateInternetGatewayOutput, error) - - CreateKeyPairRequest(*ec2.CreateKeyPairInput) (*request.Request, *ec2.CreateKeyPairOutput) - - CreateKeyPair(*ec2.CreateKeyPairInput) (*ec2.CreateKeyPairOutput, error) - - CreateNatGatewayRequest(*ec2.CreateNatGatewayInput) (*request.Request, *ec2.CreateNatGatewayOutput) - - CreateNatGateway(*ec2.CreateNatGatewayInput) (*ec2.CreateNatGatewayOutput, error) - - CreateNetworkAclRequest(*ec2.CreateNetworkAclInput) (*request.Request, *ec2.CreateNetworkAclOutput) - - CreateNetworkAcl(*ec2.CreateNetworkAclInput) (*ec2.CreateNetworkAclOutput, error) - - CreateNetworkAclEntryRequest(*ec2.CreateNetworkAclEntryInput) (*request.Request, *ec2.CreateNetworkAclEntryOutput) - - CreateNetworkAclEntry(*ec2.CreateNetworkAclEntryInput) (*ec2.CreateNetworkAclEntryOutput, error) - - CreateNetworkInterfaceRequest(*ec2.CreateNetworkInterfaceInput) (*request.Request, *ec2.CreateNetworkInterfaceOutput) - - CreateNetworkInterface(*ec2.CreateNetworkInterfaceInput) (*ec2.CreateNetworkInterfaceOutput, error) - - CreatePlacementGroupRequest(*ec2.CreatePlacementGroupInput) (*request.Request, *ec2.CreatePlacementGroupOutput) - - CreatePlacementGroup(*ec2.CreatePlacementGroupInput) (*ec2.CreatePlacementGroupOutput, error) - - CreateReservedInstancesListingRequest(*ec2.CreateReservedInstancesListingInput) (*request.Request, *ec2.CreateReservedInstancesListingOutput) - - CreateReservedInstancesListing(*ec2.CreateReservedInstancesListingInput) (*ec2.CreateReservedInstancesListingOutput, error) - - CreateRouteRequest(*ec2.CreateRouteInput) (*request.Request, *ec2.CreateRouteOutput) - - CreateRoute(*ec2.CreateRouteInput) (*ec2.CreateRouteOutput, error) - - CreateRouteTableRequest(*ec2.CreateRouteTableInput) (*request.Request, *ec2.CreateRouteTableOutput) - - CreateRouteTable(*ec2.CreateRouteTableInput) (*ec2.CreateRouteTableOutput, error) - - CreateSecurityGroupRequest(*ec2.CreateSecurityGroupInput) (*request.Request, *ec2.CreateSecurityGroupOutput) - - CreateSecurityGroup(*ec2.CreateSecurityGroupInput) (*ec2.CreateSecurityGroupOutput, error) - - CreateSnapshotRequest(*ec2.CreateSnapshotInput) (*request.Request, *ec2.Snapshot) - - CreateSnapshot(*ec2.CreateSnapshotInput) (*ec2.Snapshot, error) - - CreateSpotDatafeedSubscriptionRequest(*ec2.CreateSpotDatafeedSubscriptionInput) (*request.Request, *ec2.CreateSpotDatafeedSubscriptionOutput) - - CreateSpotDatafeedSubscription(*ec2.CreateSpotDatafeedSubscriptionInput) (*ec2.CreateSpotDatafeedSubscriptionOutput, error) - - CreateSubnetRequest(*ec2.CreateSubnetInput) (*request.Request, *ec2.CreateSubnetOutput) - - CreateSubnet(*ec2.CreateSubnetInput) (*ec2.CreateSubnetOutput, error) - - CreateTagsRequest(*ec2.CreateTagsInput) (*request.Request, *ec2.CreateTagsOutput) - - CreateTags(*ec2.CreateTagsInput) (*ec2.CreateTagsOutput, error) - - CreateVolumeRequest(*ec2.CreateVolumeInput) (*request.Request, *ec2.Volume) - - CreateVolume(*ec2.CreateVolumeInput) (*ec2.Volume, error) - - CreateVpcRequest(*ec2.CreateVpcInput) (*request.Request, *ec2.CreateVpcOutput) - - CreateVpc(*ec2.CreateVpcInput) (*ec2.CreateVpcOutput, error) - - CreateVpcEndpointRequest(*ec2.CreateVpcEndpointInput) (*request.Request, *ec2.CreateVpcEndpointOutput) - - CreateVpcEndpoint(*ec2.CreateVpcEndpointInput) (*ec2.CreateVpcEndpointOutput, error) - - CreateVpcPeeringConnectionRequest(*ec2.CreateVpcPeeringConnectionInput) (*request.Request, *ec2.CreateVpcPeeringConnectionOutput) - - CreateVpcPeeringConnection(*ec2.CreateVpcPeeringConnectionInput) (*ec2.CreateVpcPeeringConnectionOutput, error) - - CreateVpnConnectionRequest(*ec2.CreateVpnConnectionInput) (*request.Request, *ec2.CreateVpnConnectionOutput) - - CreateVpnConnection(*ec2.CreateVpnConnectionInput) (*ec2.CreateVpnConnectionOutput, error) - - CreateVpnConnectionRouteRequest(*ec2.CreateVpnConnectionRouteInput) (*request.Request, *ec2.CreateVpnConnectionRouteOutput) - - CreateVpnConnectionRoute(*ec2.CreateVpnConnectionRouteInput) (*ec2.CreateVpnConnectionRouteOutput, error) - - CreateVpnGatewayRequest(*ec2.CreateVpnGatewayInput) (*request.Request, *ec2.CreateVpnGatewayOutput) - - CreateVpnGateway(*ec2.CreateVpnGatewayInput) (*ec2.CreateVpnGatewayOutput, error) - - DeleteCustomerGatewayRequest(*ec2.DeleteCustomerGatewayInput) (*request.Request, *ec2.DeleteCustomerGatewayOutput) - - DeleteCustomerGateway(*ec2.DeleteCustomerGatewayInput) (*ec2.DeleteCustomerGatewayOutput, error) - - DeleteDhcpOptionsRequest(*ec2.DeleteDhcpOptionsInput) (*request.Request, *ec2.DeleteDhcpOptionsOutput) - - DeleteDhcpOptions(*ec2.DeleteDhcpOptionsInput) (*ec2.DeleteDhcpOptionsOutput, error) - - DeleteFlowLogsRequest(*ec2.DeleteFlowLogsInput) (*request.Request, *ec2.DeleteFlowLogsOutput) - - DeleteFlowLogs(*ec2.DeleteFlowLogsInput) (*ec2.DeleteFlowLogsOutput, error) - - DeleteInternetGatewayRequest(*ec2.DeleteInternetGatewayInput) (*request.Request, *ec2.DeleteInternetGatewayOutput) - - DeleteInternetGateway(*ec2.DeleteInternetGatewayInput) (*ec2.DeleteInternetGatewayOutput, error) - - DeleteKeyPairRequest(*ec2.DeleteKeyPairInput) (*request.Request, *ec2.DeleteKeyPairOutput) - - DeleteKeyPair(*ec2.DeleteKeyPairInput) (*ec2.DeleteKeyPairOutput, error) - - DeleteNatGatewayRequest(*ec2.DeleteNatGatewayInput) (*request.Request, *ec2.DeleteNatGatewayOutput) - - DeleteNatGateway(*ec2.DeleteNatGatewayInput) (*ec2.DeleteNatGatewayOutput, error) - - DeleteNetworkAclRequest(*ec2.DeleteNetworkAclInput) (*request.Request, *ec2.DeleteNetworkAclOutput) - - DeleteNetworkAcl(*ec2.DeleteNetworkAclInput) (*ec2.DeleteNetworkAclOutput, error) - - DeleteNetworkAclEntryRequest(*ec2.DeleteNetworkAclEntryInput) (*request.Request, *ec2.DeleteNetworkAclEntryOutput) - - DeleteNetworkAclEntry(*ec2.DeleteNetworkAclEntryInput) (*ec2.DeleteNetworkAclEntryOutput, error) - - DeleteNetworkInterfaceRequest(*ec2.DeleteNetworkInterfaceInput) (*request.Request, *ec2.DeleteNetworkInterfaceOutput) - - DeleteNetworkInterface(*ec2.DeleteNetworkInterfaceInput) (*ec2.DeleteNetworkInterfaceOutput, error) - - DeletePlacementGroupRequest(*ec2.DeletePlacementGroupInput) (*request.Request, *ec2.DeletePlacementGroupOutput) - - DeletePlacementGroup(*ec2.DeletePlacementGroupInput) (*ec2.DeletePlacementGroupOutput, error) - - DeleteRouteRequest(*ec2.DeleteRouteInput) (*request.Request, *ec2.DeleteRouteOutput) - - DeleteRoute(*ec2.DeleteRouteInput) (*ec2.DeleteRouteOutput, error) - - DeleteRouteTableRequest(*ec2.DeleteRouteTableInput) (*request.Request, *ec2.DeleteRouteTableOutput) - - DeleteRouteTable(*ec2.DeleteRouteTableInput) (*ec2.DeleteRouteTableOutput, error) - - DeleteSecurityGroupRequest(*ec2.DeleteSecurityGroupInput) (*request.Request, *ec2.DeleteSecurityGroupOutput) - - DeleteSecurityGroup(*ec2.DeleteSecurityGroupInput) (*ec2.DeleteSecurityGroupOutput, error) - - DeleteSnapshotRequest(*ec2.DeleteSnapshotInput) (*request.Request, *ec2.DeleteSnapshotOutput) - - DeleteSnapshot(*ec2.DeleteSnapshotInput) (*ec2.DeleteSnapshotOutput, error) - - DeleteSpotDatafeedSubscriptionRequest(*ec2.DeleteSpotDatafeedSubscriptionInput) (*request.Request, *ec2.DeleteSpotDatafeedSubscriptionOutput) - - DeleteSpotDatafeedSubscription(*ec2.DeleteSpotDatafeedSubscriptionInput) (*ec2.DeleteSpotDatafeedSubscriptionOutput, error) - - DeleteSubnetRequest(*ec2.DeleteSubnetInput) (*request.Request, *ec2.DeleteSubnetOutput) - - DeleteSubnet(*ec2.DeleteSubnetInput) (*ec2.DeleteSubnetOutput, error) - - DeleteTagsRequest(*ec2.DeleteTagsInput) (*request.Request, *ec2.DeleteTagsOutput) - - DeleteTags(*ec2.DeleteTagsInput) (*ec2.DeleteTagsOutput, error) - - DeleteVolumeRequest(*ec2.DeleteVolumeInput) (*request.Request, *ec2.DeleteVolumeOutput) - - DeleteVolume(*ec2.DeleteVolumeInput) (*ec2.DeleteVolumeOutput, error) - - DeleteVpcRequest(*ec2.DeleteVpcInput) (*request.Request, *ec2.DeleteVpcOutput) - - DeleteVpc(*ec2.DeleteVpcInput) (*ec2.DeleteVpcOutput, error) - - DeleteVpcEndpointsRequest(*ec2.DeleteVpcEndpointsInput) (*request.Request, *ec2.DeleteVpcEndpointsOutput) - - DeleteVpcEndpoints(*ec2.DeleteVpcEndpointsInput) (*ec2.DeleteVpcEndpointsOutput, error) - - DeleteVpcPeeringConnectionRequest(*ec2.DeleteVpcPeeringConnectionInput) (*request.Request, *ec2.DeleteVpcPeeringConnectionOutput) - - DeleteVpcPeeringConnection(*ec2.DeleteVpcPeeringConnectionInput) (*ec2.DeleteVpcPeeringConnectionOutput, error) - - DeleteVpnConnectionRequest(*ec2.DeleteVpnConnectionInput) (*request.Request, *ec2.DeleteVpnConnectionOutput) - - DeleteVpnConnection(*ec2.DeleteVpnConnectionInput) (*ec2.DeleteVpnConnectionOutput, error) - - DeleteVpnConnectionRouteRequest(*ec2.DeleteVpnConnectionRouteInput) (*request.Request, *ec2.DeleteVpnConnectionRouteOutput) - - DeleteVpnConnectionRoute(*ec2.DeleteVpnConnectionRouteInput) (*ec2.DeleteVpnConnectionRouteOutput, error) - - DeleteVpnGatewayRequest(*ec2.DeleteVpnGatewayInput) (*request.Request, *ec2.DeleteVpnGatewayOutput) - - DeleteVpnGateway(*ec2.DeleteVpnGatewayInput) (*ec2.DeleteVpnGatewayOutput, error) - - DeregisterImageRequest(*ec2.DeregisterImageInput) (*request.Request, *ec2.DeregisterImageOutput) - - DeregisterImage(*ec2.DeregisterImageInput) (*ec2.DeregisterImageOutput, error) - - DescribeAccountAttributesRequest(*ec2.DescribeAccountAttributesInput) (*request.Request, *ec2.DescribeAccountAttributesOutput) - - DescribeAccountAttributes(*ec2.DescribeAccountAttributesInput) (*ec2.DescribeAccountAttributesOutput, error) - - DescribeAddressesRequest(*ec2.DescribeAddressesInput) (*request.Request, *ec2.DescribeAddressesOutput) - - DescribeAddresses(*ec2.DescribeAddressesInput) (*ec2.DescribeAddressesOutput, error) - - DescribeAvailabilityZonesRequest(*ec2.DescribeAvailabilityZonesInput) (*request.Request, *ec2.DescribeAvailabilityZonesOutput) - - DescribeAvailabilityZones(*ec2.DescribeAvailabilityZonesInput) (*ec2.DescribeAvailabilityZonesOutput, error) - - DescribeBundleTasksRequest(*ec2.DescribeBundleTasksInput) (*request.Request, *ec2.DescribeBundleTasksOutput) - - DescribeBundleTasks(*ec2.DescribeBundleTasksInput) (*ec2.DescribeBundleTasksOutput, error) - - DescribeClassicLinkInstancesRequest(*ec2.DescribeClassicLinkInstancesInput) (*request.Request, *ec2.DescribeClassicLinkInstancesOutput) - - DescribeClassicLinkInstances(*ec2.DescribeClassicLinkInstancesInput) (*ec2.DescribeClassicLinkInstancesOutput, error) - - DescribeConversionTasksRequest(*ec2.DescribeConversionTasksInput) (*request.Request, *ec2.DescribeConversionTasksOutput) - - DescribeConversionTasks(*ec2.DescribeConversionTasksInput) (*ec2.DescribeConversionTasksOutput, error) - - DescribeCustomerGatewaysRequest(*ec2.DescribeCustomerGatewaysInput) (*request.Request, *ec2.DescribeCustomerGatewaysOutput) - - DescribeCustomerGateways(*ec2.DescribeCustomerGatewaysInput) (*ec2.DescribeCustomerGatewaysOutput, error) - - DescribeDhcpOptionsRequest(*ec2.DescribeDhcpOptionsInput) (*request.Request, *ec2.DescribeDhcpOptionsOutput) - - DescribeDhcpOptions(*ec2.DescribeDhcpOptionsInput) (*ec2.DescribeDhcpOptionsOutput, error) - - DescribeExportTasksRequest(*ec2.DescribeExportTasksInput) (*request.Request, *ec2.DescribeExportTasksOutput) - - DescribeExportTasks(*ec2.DescribeExportTasksInput) (*ec2.DescribeExportTasksOutput, error) - - DescribeFlowLogsRequest(*ec2.DescribeFlowLogsInput) (*request.Request, *ec2.DescribeFlowLogsOutput) - - DescribeFlowLogs(*ec2.DescribeFlowLogsInput) (*ec2.DescribeFlowLogsOutput, error) - - DescribeHostsRequest(*ec2.DescribeHostsInput) (*request.Request, *ec2.DescribeHostsOutput) - - DescribeHosts(*ec2.DescribeHostsInput) (*ec2.DescribeHostsOutput, error) - - DescribeIdFormatRequest(*ec2.DescribeIdFormatInput) (*request.Request, *ec2.DescribeIdFormatOutput) - - DescribeIdFormat(*ec2.DescribeIdFormatInput) (*ec2.DescribeIdFormatOutput, error) - - DescribeImageAttributeRequest(*ec2.DescribeImageAttributeInput) (*request.Request, *ec2.DescribeImageAttributeOutput) - - DescribeImageAttribute(*ec2.DescribeImageAttributeInput) (*ec2.DescribeImageAttributeOutput, error) - - DescribeImagesRequest(*ec2.DescribeImagesInput) (*request.Request, *ec2.DescribeImagesOutput) - - DescribeImages(*ec2.DescribeImagesInput) (*ec2.DescribeImagesOutput, error) - - DescribeImportImageTasksRequest(*ec2.DescribeImportImageTasksInput) (*request.Request, *ec2.DescribeImportImageTasksOutput) - - DescribeImportImageTasks(*ec2.DescribeImportImageTasksInput) (*ec2.DescribeImportImageTasksOutput, error) - - DescribeImportSnapshotTasksRequest(*ec2.DescribeImportSnapshotTasksInput) (*request.Request, *ec2.DescribeImportSnapshotTasksOutput) - - DescribeImportSnapshotTasks(*ec2.DescribeImportSnapshotTasksInput) (*ec2.DescribeImportSnapshotTasksOutput, error) - - DescribeInstanceAttributeRequest(*ec2.DescribeInstanceAttributeInput) (*request.Request, *ec2.DescribeInstanceAttributeOutput) - - DescribeInstanceAttribute(*ec2.DescribeInstanceAttributeInput) (*ec2.DescribeInstanceAttributeOutput, error) - - DescribeInstanceStatusRequest(*ec2.DescribeInstanceStatusInput) (*request.Request, *ec2.DescribeInstanceStatusOutput) - - DescribeInstanceStatus(*ec2.DescribeInstanceStatusInput) (*ec2.DescribeInstanceStatusOutput, error) - - DescribeInstanceStatusPages(*ec2.DescribeInstanceStatusInput, func(*ec2.DescribeInstanceStatusOutput, bool) bool) error - - DescribeInstancesRequest(*ec2.DescribeInstancesInput) (*request.Request, *ec2.DescribeInstancesOutput) - - DescribeInstances(*ec2.DescribeInstancesInput) (*ec2.DescribeInstancesOutput, error) - - DescribeInstancesPages(*ec2.DescribeInstancesInput, func(*ec2.DescribeInstancesOutput, bool) bool) error - - DescribeInternetGatewaysRequest(*ec2.DescribeInternetGatewaysInput) (*request.Request, *ec2.DescribeInternetGatewaysOutput) - - DescribeInternetGateways(*ec2.DescribeInternetGatewaysInput) (*ec2.DescribeInternetGatewaysOutput, error) - - DescribeKeyPairsRequest(*ec2.DescribeKeyPairsInput) (*request.Request, *ec2.DescribeKeyPairsOutput) - - DescribeKeyPairs(*ec2.DescribeKeyPairsInput) (*ec2.DescribeKeyPairsOutput, error) - - DescribeMovingAddressesRequest(*ec2.DescribeMovingAddressesInput) (*request.Request, *ec2.DescribeMovingAddressesOutput) - - DescribeMovingAddresses(*ec2.DescribeMovingAddressesInput) (*ec2.DescribeMovingAddressesOutput, error) - - DescribeNatGatewaysRequest(*ec2.DescribeNatGatewaysInput) (*request.Request, *ec2.DescribeNatGatewaysOutput) - - DescribeNatGateways(*ec2.DescribeNatGatewaysInput) (*ec2.DescribeNatGatewaysOutput, error) - - DescribeNetworkAclsRequest(*ec2.DescribeNetworkAclsInput) (*request.Request, *ec2.DescribeNetworkAclsOutput) - - DescribeNetworkAcls(*ec2.DescribeNetworkAclsInput) (*ec2.DescribeNetworkAclsOutput, error) - - DescribeNetworkInterfaceAttributeRequest(*ec2.DescribeNetworkInterfaceAttributeInput) (*request.Request, *ec2.DescribeNetworkInterfaceAttributeOutput) - - DescribeNetworkInterfaceAttribute(*ec2.DescribeNetworkInterfaceAttributeInput) (*ec2.DescribeNetworkInterfaceAttributeOutput, error) - - DescribeNetworkInterfacesRequest(*ec2.DescribeNetworkInterfacesInput) (*request.Request, *ec2.DescribeNetworkInterfacesOutput) - - DescribeNetworkInterfaces(*ec2.DescribeNetworkInterfacesInput) (*ec2.DescribeNetworkInterfacesOutput, error) - - DescribePlacementGroupsRequest(*ec2.DescribePlacementGroupsInput) (*request.Request, *ec2.DescribePlacementGroupsOutput) - - DescribePlacementGroups(*ec2.DescribePlacementGroupsInput) (*ec2.DescribePlacementGroupsOutput, error) - - DescribePrefixListsRequest(*ec2.DescribePrefixListsInput) (*request.Request, *ec2.DescribePrefixListsOutput) - - DescribePrefixLists(*ec2.DescribePrefixListsInput) (*ec2.DescribePrefixListsOutput, error) - - DescribeRegionsRequest(*ec2.DescribeRegionsInput) (*request.Request, *ec2.DescribeRegionsOutput) - - DescribeRegions(*ec2.DescribeRegionsInput) (*ec2.DescribeRegionsOutput, error) - - DescribeReservedInstancesRequest(*ec2.DescribeReservedInstancesInput) (*request.Request, *ec2.DescribeReservedInstancesOutput) - - DescribeReservedInstances(*ec2.DescribeReservedInstancesInput) (*ec2.DescribeReservedInstancesOutput, error) - - DescribeReservedInstancesListingsRequest(*ec2.DescribeReservedInstancesListingsInput) (*request.Request, *ec2.DescribeReservedInstancesListingsOutput) - - DescribeReservedInstancesListings(*ec2.DescribeReservedInstancesListingsInput) (*ec2.DescribeReservedInstancesListingsOutput, error) - - DescribeReservedInstancesModificationsRequest(*ec2.DescribeReservedInstancesModificationsInput) (*request.Request, *ec2.DescribeReservedInstancesModificationsOutput) - - DescribeReservedInstancesModifications(*ec2.DescribeReservedInstancesModificationsInput) (*ec2.DescribeReservedInstancesModificationsOutput, error) - - DescribeReservedInstancesModificationsPages(*ec2.DescribeReservedInstancesModificationsInput, func(*ec2.DescribeReservedInstancesModificationsOutput, bool) bool) error - - DescribeReservedInstancesOfferingsRequest(*ec2.DescribeReservedInstancesOfferingsInput) (*request.Request, *ec2.DescribeReservedInstancesOfferingsOutput) - - DescribeReservedInstancesOfferings(*ec2.DescribeReservedInstancesOfferingsInput) (*ec2.DescribeReservedInstancesOfferingsOutput, error) - - DescribeReservedInstancesOfferingsPages(*ec2.DescribeReservedInstancesOfferingsInput, func(*ec2.DescribeReservedInstancesOfferingsOutput, bool) bool) error - - DescribeRouteTablesRequest(*ec2.DescribeRouteTablesInput) (*request.Request, *ec2.DescribeRouteTablesOutput) - - DescribeRouteTables(*ec2.DescribeRouteTablesInput) (*ec2.DescribeRouteTablesOutput, error) - - DescribeScheduledInstanceAvailabilityRequest(*ec2.DescribeScheduledInstanceAvailabilityInput) (*request.Request, *ec2.DescribeScheduledInstanceAvailabilityOutput) - - DescribeScheduledInstanceAvailability(*ec2.DescribeScheduledInstanceAvailabilityInput) (*ec2.DescribeScheduledInstanceAvailabilityOutput, error) - - DescribeScheduledInstancesRequest(*ec2.DescribeScheduledInstancesInput) (*request.Request, *ec2.DescribeScheduledInstancesOutput) - - DescribeScheduledInstances(*ec2.DescribeScheduledInstancesInput) (*ec2.DescribeScheduledInstancesOutput, error) - - DescribeSecurityGroupsRequest(*ec2.DescribeSecurityGroupsInput) (*request.Request, *ec2.DescribeSecurityGroupsOutput) - - DescribeSecurityGroups(*ec2.DescribeSecurityGroupsInput) (*ec2.DescribeSecurityGroupsOutput, error) - - DescribeSnapshotAttributeRequest(*ec2.DescribeSnapshotAttributeInput) (*request.Request, *ec2.DescribeSnapshotAttributeOutput) - - DescribeSnapshotAttribute(*ec2.DescribeSnapshotAttributeInput) (*ec2.DescribeSnapshotAttributeOutput, error) - - DescribeSnapshotsRequest(*ec2.DescribeSnapshotsInput) (*request.Request, *ec2.DescribeSnapshotsOutput) - - DescribeSnapshots(*ec2.DescribeSnapshotsInput) (*ec2.DescribeSnapshotsOutput, error) - - DescribeSnapshotsPages(*ec2.DescribeSnapshotsInput, func(*ec2.DescribeSnapshotsOutput, bool) bool) error - - DescribeSpotDatafeedSubscriptionRequest(*ec2.DescribeSpotDatafeedSubscriptionInput) (*request.Request, *ec2.DescribeSpotDatafeedSubscriptionOutput) - - DescribeSpotDatafeedSubscription(*ec2.DescribeSpotDatafeedSubscriptionInput) (*ec2.DescribeSpotDatafeedSubscriptionOutput, error) - - DescribeSpotFleetInstancesRequest(*ec2.DescribeSpotFleetInstancesInput) (*request.Request, *ec2.DescribeSpotFleetInstancesOutput) - - DescribeSpotFleetInstances(*ec2.DescribeSpotFleetInstancesInput) (*ec2.DescribeSpotFleetInstancesOutput, error) - - DescribeSpotFleetRequestHistoryRequest(*ec2.DescribeSpotFleetRequestHistoryInput) (*request.Request, *ec2.DescribeSpotFleetRequestHistoryOutput) - - DescribeSpotFleetRequestHistory(*ec2.DescribeSpotFleetRequestHistoryInput) (*ec2.DescribeSpotFleetRequestHistoryOutput, error) - - DescribeSpotFleetRequestsRequest(*ec2.DescribeSpotFleetRequestsInput) (*request.Request, *ec2.DescribeSpotFleetRequestsOutput) - - DescribeSpotFleetRequests(*ec2.DescribeSpotFleetRequestsInput) (*ec2.DescribeSpotFleetRequestsOutput, error) - - DescribeSpotInstanceRequestsRequest(*ec2.DescribeSpotInstanceRequestsInput) (*request.Request, *ec2.DescribeSpotInstanceRequestsOutput) - - DescribeSpotInstanceRequests(*ec2.DescribeSpotInstanceRequestsInput) (*ec2.DescribeSpotInstanceRequestsOutput, error) - - DescribeSpotPriceHistoryRequest(*ec2.DescribeSpotPriceHistoryInput) (*request.Request, *ec2.DescribeSpotPriceHistoryOutput) - - DescribeSpotPriceHistory(*ec2.DescribeSpotPriceHistoryInput) (*ec2.DescribeSpotPriceHistoryOutput, error) - - DescribeSpotPriceHistoryPages(*ec2.DescribeSpotPriceHistoryInput, func(*ec2.DescribeSpotPriceHistoryOutput, bool) bool) error - - DescribeSubnetsRequest(*ec2.DescribeSubnetsInput) (*request.Request, *ec2.DescribeSubnetsOutput) - - DescribeSubnets(*ec2.DescribeSubnetsInput) (*ec2.DescribeSubnetsOutput, error) - - DescribeTagsRequest(*ec2.DescribeTagsInput) (*request.Request, *ec2.DescribeTagsOutput) - - DescribeTags(*ec2.DescribeTagsInput) (*ec2.DescribeTagsOutput, error) - - DescribeTagsPages(*ec2.DescribeTagsInput, func(*ec2.DescribeTagsOutput, bool) bool) error - - DescribeVolumeAttributeRequest(*ec2.DescribeVolumeAttributeInput) (*request.Request, *ec2.DescribeVolumeAttributeOutput) - - DescribeVolumeAttribute(*ec2.DescribeVolumeAttributeInput) (*ec2.DescribeVolumeAttributeOutput, error) - - DescribeVolumeStatusRequest(*ec2.DescribeVolumeStatusInput) (*request.Request, *ec2.DescribeVolumeStatusOutput) - - DescribeVolumeStatus(*ec2.DescribeVolumeStatusInput) (*ec2.DescribeVolumeStatusOutput, error) - - DescribeVolumeStatusPages(*ec2.DescribeVolumeStatusInput, func(*ec2.DescribeVolumeStatusOutput, bool) bool) error - - DescribeVolumesRequest(*ec2.DescribeVolumesInput) (*request.Request, *ec2.DescribeVolumesOutput) - - DescribeVolumes(*ec2.DescribeVolumesInput) (*ec2.DescribeVolumesOutput, error) - - DescribeVolumesPages(*ec2.DescribeVolumesInput, func(*ec2.DescribeVolumesOutput, bool) bool) error - - DescribeVpcAttributeRequest(*ec2.DescribeVpcAttributeInput) (*request.Request, *ec2.DescribeVpcAttributeOutput) - - DescribeVpcAttribute(*ec2.DescribeVpcAttributeInput) (*ec2.DescribeVpcAttributeOutput, error) - - DescribeVpcClassicLinkRequest(*ec2.DescribeVpcClassicLinkInput) (*request.Request, *ec2.DescribeVpcClassicLinkOutput) - - DescribeVpcClassicLink(*ec2.DescribeVpcClassicLinkInput) (*ec2.DescribeVpcClassicLinkOutput, error) - - DescribeVpcClassicLinkDnsSupportRequest(*ec2.DescribeVpcClassicLinkDnsSupportInput) (*request.Request, *ec2.DescribeVpcClassicLinkDnsSupportOutput) - - DescribeVpcClassicLinkDnsSupport(*ec2.DescribeVpcClassicLinkDnsSupportInput) (*ec2.DescribeVpcClassicLinkDnsSupportOutput, error) - - DescribeVpcEndpointServicesRequest(*ec2.DescribeVpcEndpointServicesInput) (*request.Request, *ec2.DescribeVpcEndpointServicesOutput) - - DescribeVpcEndpointServices(*ec2.DescribeVpcEndpointServicesInput) (*ec2.DescribeVpcEndpointServicesOutput, error) - - DescribeVpcEndpointsRequest(*ec2.DescribeVpcEndpointsInput) (*request.Request, *ec2.DescribeVpcEndpointsOutput) - - DescribeVpcEndpoints(*ec2.DescribeVpcEndpointsInput) (*ec2.DescribeVpcEndpointsOutput, error) - - DescribeVpcPeeringConnectionsRequest(*ec2.DescribeVpcPeeringConnectionsInput) (*request.Request, *ec2.DescribeVpcPeeringConnectionsOutput) - - DescribeVpcPeeringConnections(*ec2.DescribeVpcPeeringConnectionsInput) (*ec2.DescribeVpcPeeringConnectionsOutput, error) - - DescribeVpcsRequest(*ec2.DescribeVpcsInput) (*request.Request, *ec2.DescribeVpcsOutput) - - DescribeVpcs(*ec2.DescribeVpcsInput) (*ec2.DescribeVpcsOutput, error) - - DescribeVpnConnectionsRequest(*ec2.DescribeVpnConnectionsInput) (*request.Request, *ec2.DescribeVpnConnectionsOutput) - - DescribeVpnConnections(*ec2.DescribeVpnConnectionsInput) (*ec2.DescribeVpnConnectionsOutput, error) - - DescribeVpnGatewaysRequest(*ec2.DescribeVpnGatewaysInput) (*request.Request, *ec2.DescribeVpnGatewaysOutput) - - DescribeVpnGateways(*ec2.DescribeVpnGatewaysInput) (*ec2.DescribeVpnGatewaysOutput, error) - - DetachClassicLinkVpcRequest(*ec2.DetachClassicLinkVpcInput) (*request.Request, *ec2.DetachClassicLinkVpcOutput) - - DetachClassicLinkVpc(*ec2.DetachClassicLinkVpcInput) (*ec2.DetachClassicLinkVpcOutput, error) - - DetachInternetGatewayRequest(*ec2.DetachInternetGatewayInput) (*request.Request, *ec2.DetachInternetGatewayOutput) - - DetachInternetGateway(*ec2.DetachInternetGatewayInput) (*ec2.DetachInternetGatewayOutput, error) - - DetachNetworkInterfaceRequest(*ec2.DetachNetworkInterfaceInput) (*request.Request, *ec2.DetachNetworkInterfaceOutput) - - DetachNetworkInterface(*ec2.DetachNetworkInterfaceInput) (*ec2.DetachNetworkInterfaceOutput, error) - - DetachVolumeRequest(*ec2.DetachVolumeInput) (*request.Request, *ec2.VolumeAttachment) - - DetachVolume(*ec2.DetachVolumeInput) (*ec2.VolumeAttachment, error) - - DetachVpnGatewayRequest(*ec2.DetachVpnGatewayInput) (*request.Request, *ec2.DetachVpnGatewayOutput) - - DetachVpnGateway(*ec2.DetachVpnGatewayInput) (*ec2.DetachVpnGatewayOutput, error) - - DisableVgwRoutePropagationRequest(*ec2.DisableVgwRoutePropagationInput) (*request.Request, *ec2.DisableVgwRoutePropagationOutput) - - DisableVgwRoutePropagation(*ec2.DisableVgwRoutePropagationInput) (*ec2.DisableVgwRoutePropagationOutput, error) - - DisableVpcClassicLinkRequest(*ec2.DisableVpcClassicLinkInput) (*request.Request, *ec2.DisableVpcClassicLinkOutput) - - DisableVpcClassicLink(*ec2.DisableVpcClassicLinkInput) (*ec2.DisableVpcClassicLinkOutput, error) - - DisableVpcClassicLinkDnsSupportRequest(*ec2.DisableVpcClassicLinkDnsSupportInput) (*request.Request, *ec2.DisableVpcClassicLinkDnsSupportOutput) - - DisableVpcClassicLinkDnsSupport(*ec2.DisableVpcClassicLinkDnsSupportInput) (*ec2.DisableVpcClassicLinkDnsSupportOutput, error) - - DisassociateAddressRequest(*ec2.DisassociateAddressInput) (*request.Request, *ec2.DisassociateAddressOutput) - - DisassociateAddress(*ec2.DisassociateAddressInput) (*ec2.DisassociateAddressOutput, error) - - DisassociateRouteTableRequest(*ec2.DisassociateRouteTableInput) (*request.Request, *ec2.DisassociateRouteTableOutput) - - DisassociateRouteTable(*ec2.DisassociateRouteTableInput) (*ec2.DisassociateRouteTableOutput, error) - - EnableVgwRoutePropagationRequest(*ec2.EnableVgwRoutePropagationInput) (*request.Request, *ec2.EnableVgwRoutePropagationOutput) - - EnableVgwRoutePropagation(*ec2.EnableVgwRoutePropagationInput) (*ec2.EnableVgwRoutePropagationOutput, error) - - EnableVolumeIORequest(*ec2.EnableVolumeIOInput) (*request.Request, *ec2.EnableVolumeIOOutput) - - EnableVolumeIO(*ec2.EnableVolumeIOInput) (*ec2.EnableVolumeIOOutput, error) - - EnableVpcClassicLinkRequest(*ec2.EnableVpcClassicLinkInput) (*request.Request, *ec2.EnableVpcClassicLinkOutput) - - EnableVpcClassicLink(*ec2.EnableVpcClassicLinkInput) (*ec2.EnableVpcClassicLinkOutput, error) - - EnableVpcClassicLinkDnsSupportRequest(*ec2.EnableVpcClassicLinkDnsSupportInput) (*request.Request, *ec2.EnableVpcClassicLinkDnsSupportOutput) - - EnableVpcClassicLinkDnsSupport(*ec2.EnableVpcClassicLinkDnsSupportInput) (*ec2.EnableVpcClassicLinkDnsSupportOutput, error) - - GetConsoleOutputRequest(*ec2.GetConsoleOutputInput) (*request.Request, *ec2.GetConsoleOutputOutput) - - GetConsoleOutput(*ec2.GetConsoleOutputInput) (*ec2.GetConsoleOutputOutput, error) - - GetPasswordDataRequest(*ec2.GetPasswordDataInput) (*request.Request, *ec2.GetPasswordDataOutput) - - GetPasswordData(*ec2.GetPasswordDataInput) (*ec2.GetPasswordDataOutput, error) - - ImportImageRequest(*ec2.ImportImageInput) (*request.Request, *ec2.ImportImageOutput) - - ImportImage(*ec2.ImportImageInput) (*ec2.ImportImageOutput, error) - - ImportInstanceRequest(*ec2.ImportInstanceInput) (*request.Request, *ec2.ImportInstanceOutput) - - ImportInstance(*ec2.ImportInstanceInput) (*ec2.ImportInstanceOutput, error) - - ImportKeyPairRequest(*ec2.ImportKeyPairInput) (*request.Request, *ec2.ImportKeyPairOutput) - - ImportKeyPair(*ec2.ImportKeyPairInput) (*ec2.ImportKeyPairOutput, error) - - ImportSnapshotRequest(*ec2.ImportSnapshotInput) (*request.Request, *ec2.ImportSnapshotOutput) - - ImportSnapshot(*ec2.ImportSnapshotInput) (*ec2.ImportSnapshotOutput, error) - - ImportVolumeRequest(*ec2.ImportVolumeInput) (*request.Request, *ec2.ImportVolumeOutput) - - ImportVolume(*ec2.ImportVolumeInput) (*ec2.ImportVolumeOutput, error) - - ModifyHostsRequest(*ec2.ModifyHostsInput) (*request.Request, *ec2.ModifyHostsOutput) - - ModifyHosts(*ec2.ModifyHostsInput) (*ec2.ModifyHostsOutput, error) - - ModifyIdFormatRequest(*ec2.ModifyIdFormatInput) (*request.Request, *ec2.ModifyIdFormatOutput) - - ModifyIdFormat(*ec2.ModifyIdFormatInput) (*ec2.ModifyIdFormatOutput, error) - - ModifyImageAttributeRequest(*ec2.ModifyImageAttributeInput) (*request.Request, *ec2.ModifyImageAttributeOutput) - - ModifyImageAttribute(*ec2.ModifyImageAttributeInput) (*ec2.ModifyImageAttributeOutput, error) - - ModifyInstanceAttributeRequest(*ec2.ModifyInstanceAttributeInput) (*request.Request, *ec2.ModifyInstanceAttributeOutput) - - ModifyInstanceAttribute(*ec2.ModifyInstanceAttributeInput) (*ec2.ModifyInstanceAttributeOutput, error) - - ModifyInstancePlacementRequest(*ec2.ModifyInstancePlacementInput) (*request.Request, *ec2.ModifyInstancePlacementOutput) - - ModifyInstancePlacement(*ec2.ModifyInstancePlacementInput) (*ec2.ModifyInstancePlacementOutput, error) - - ModifyNetworkInterfaceAttributeRequest(*ec2.ModifyNetworkInterfaceAttributeInput) (*request.Request, *ec2.ModifyNetworkInterfaceAttributeOutput) - - ModifyNetworkInterfaceAttribute(*ec2.ModifyNetworkInterfaceAttributeInput) (*ec2.ModifyNetworkInterfaceAttributeOutput, error) - - ModifyReservedInstancesRequest(*ec2.ModifyReservedInstancesInput) (*request.Request, *ec2.ModifyReservedInstancesOutput) - - ModifyReservedInstances(*ec2.ModifyReservedInstancesInput) (*ec2.ModifyReservedInstancesOutput, error) - - ModifySnapshotAttributeRequest(*ec2.ModifySnapshotAttributeInput) (*request.Request, *ec2.ModifySnapshotAttributeOutput) - - ModifySnapshotAttribute(*ec2.ModifySnapshotAttributeInput) (*ec2.ModifySnapshotAttributeOutput, error) - - ModifySpotFleetRequestRequest(*ec2.ModifySpotFleetRequestInput) (*request.Request, *ec2.ModifySpotFleetRequestOutput) - - ModifySpotFleetRequest(*ec2.ModifySpotFleetRequestInput) (*ec2.ModifySpotFleetRequestOutput, error) - - ModifySubnetAttributeRequest(*ec2.ModifySubnetAttributeInput) (*request.Request, *ec2.ModifySubnetAttributeOutput) - - ModifySubnetAttribute(*ec2.ModifySubnetAttributeInput) (*ec2.ModifySubnetAttributeOutput, error) - - ModifyVolumeAttributeRequest(*ec2.ModifyVolumeAttributeInput) (*request.Request, *ec2.ModifyVolumeAttributeOutput) - - ModifyVolumeAttribute(*ec2.ModifyVolumeAttributeInput) (*ec2.ModifyVolumeAttributeOutput, error) - - ModifyVpcAttributeRequest(*ec2.ModifyVpcAttributeInput) (*request.Request, *ec2.ModifyVpcAttributeOutput) - - ModifyVpcAttribute(*ec2.ModifyVpcAttributeInput) (*ec2.ModifyVpcAttributeOutput, error) - - ModifyVpcEndpointRequest(*ec2.ModifyVpcEndpointInput) (*request.Request, *ec2.ModifyVpcEndpointOutput) - - ModifyVpcEndpoint(*ec2.ModifyVpcEndpointInput) (*ec2.ModifyVpcEndpointOutput, error) - - MonitorInstancesRequest(*ec2.MonitorInstancesInput) (*request.Request, *ec2.MonitorInstancesOutput) - - MonitorInstances(*ec2.MonitorInstancesInput) (*ec2.MonitorInstancesOutput, error) - - MoveAddressToVpcRequest(*ec2.MoveAddressToVpcInput) (*request.Request, *ec2.MoveAddressToVpcOutput) - - MoveAddressToVpc(*ec2.MoveAddressToVpcInput) (*ec2.MoveAddressToVpcOutput, error) - - PurchaseReservedInstancesOfferingRequest(*ec2.PurchaseReservedInstancesOfferingInput) (*request.Request, *ec2.PurchaseReservedInstancesOfferingOutput) - - PurchaseReservedInstancesOffering(*ec2.PurchaseReservedInstancesOfferingInput) (*ec2.PurchaseReservedInstancesOfferingOutput, error) - - PurchaseScheduledInstancesRequest(*ec2.PurchaseScheduledInstancesInput) (*request.Request, *ec2.PurchaseScheduledInstancesOutput) - - PurchaseScheduledInstances(*ec2.PurchaseScheduledInstancesInput) (*ec2.PurchaseScheduledInstancesOutput, error) - - RebootInstancesRequest(*ec2.RebootInstancesInput) (*request.Request, *ec2.RebootInstancesOutput) - - RebootInstances(*ec2.RebootInstancesInput) (*ec2.RebootInstancesOutput, error) - - RegisterImageRequest(*ec2.RegisterImageInput) (*request.Request, *ec2.RegisterImageOutput) - - RegisterImage(*ec2.RegisterImageInput) (*ec2.RegisterImageOutput, error) - - RejectVpcPeeringConnectionRequest(*ec2.RejectVpcPeeringConnectionInput) (*request.Request, *ec2.RejectVpcPeeringConnectionOutput) - - RejectVpcPeeringConnection(*ec2.RejectVpcPeeringConnectionInput) (*ec2.RejectVpcPeeringConnectionOutput, error) - - ReleaseAddressRequest(*ec2.ReleaseAddressInput) (*request.Request, *ec2.ReleaseAddressOutput) - - ReleaseAddress(*ec2.ReleaseAddressInput) (*ec2.ReleaseAddressOutput, error) - - ReleaseHostsRequest(*ec2.ReleaseHostsInput) (*request.Request, *ec2.ReleaseHostsOutput) - - ReleaseHosts(*ec2.ReleaseHostsInput) (*ec2.ReleaseHostsOutput, error) - - ReplaceNetworkAclAssociationRequest(*ec2.ReplaceNetworkAclAssociationInput) (*request.Request, *ec2.ReplaceNetworkAclAssociationOutput) - - ReplaceNetworkAclAssociation(*ec2.ReplaceNetworkAclAssociationInput) (*ec2.ReplaceNetworkAclAssociationOutput, error) - - ReplaceNetworkAclEntryRequest(*ec2.ReplaceNetworkAclEntryInput) (*request.Request, *ec2.ReplaceNetworkAclEntryOutput) - - ReplaceNetworkAclEntry(*ec2.ReplaceNetworkAclEntryInput) (*ec2.ReplaceNetworkAclEntryOutput, error) - - ReplaceRouteRequest(*ec2.ReplaceRouteInput) (*request.Request, *ec2.ReplaceRouteOutput) - - ReplaceRoute(*ec2.ReplaceRouteInput) (*ec2.ReplaceRouteOutput, error) - - ReplaceRouteTableAssociationRequest(*ec2.ReplaceRouteTableAssociationInput) (*request.Request, *ec2.ReplaceRouteTableAssociationOutput) - - ReplaceRouteTableAssociation(*ec2.ReplaceRouteTableAssociationInput) (*ec2.ReplaceRouteTableAssociationOutput, error) - - ReportInstanceStatusRequest(*ec2.ReportInstanceStatusInput) (*request.Request, *ec2.ReportInstanceStatusOutput) - - ReportInstanceStatus(*ec2.ReportInstanceStatusInput) (*ec2.ReportInstanceStatusOutput, error) - - RequestSpotFleetRequest(*ec2.RequestSpotFleetInput) (*request.Request, *ec2.RequestSpotFleetOutput) - - RequestSpotFleet(*ec2.RequestSpotFleetInput) (*ec2.RequestSpotFleetOutput, error) - - RequestSpotInstancesRequest(*ec2.RequestSpotInstancesInput) (*request.Request, *ec2.RequestSpotInstancesOutput) - - RequestSpotInstances(*ec2.RequestSpotInstancesInput) (*ec2.RequestSpotInstancesOutput, error) - - ResetImageAttributeRequest(*ec2.ResetImageAttributeInput) (*request.Request, *ec2.ResetImageAttributeOutput) - - ResetImageAttribute(*ec2.ResetImageAttributeInput) (*ec2.ResetImageAttributeOutput, error) - - ResetInstanceAttributeRequest(*ec2.ResetInstanceAttributeInput) (*request.Request, *ec2.ResetInstanceAttributeOutput) - - ResetInstanceAttribute(*ec2.ResetInstanceAttributeInput) (*ec2.ResetInstanceAttributeOutput, error) - - ResetNetworkInterfaceAttributeRequest(*ec2.ResetNetworkInterfaceAttributeInput) (*request.Request, *ec2.ResetNetworkInterfaceAttributeOutput) - - ResetNetworkInterfaceAttribute(*ec2.ResetNetworkInterfaceAttributeInput) (*ec2.ResetNetworkInterfaceAttributeOutput, error) - - ResetSnapshotAttributeRequest(*ec2.ResetSnapshotAttributeInput) (*request.Request, *ec2.ResetSnapshotAttributeOutput) - - ResetSnapshotAttribute(*ec2.ResetSnapshotAttributeInput) (*ec2.ResetSnapshotAttributeOutput, error) - - RestoreAddressToClassicRequest(*ec2.RestoreAddressToClassicInput) (*request.Request, *ec2.RestoreAddressToClassicOutput) - - RestoreAddressToClassic(*ec2.RestoreAddressToClassicInput) (*ec2.RestoreAddressToClassicOutput, error) - - RevokeSecurityGroupEgressRequest(*ec2.RevokeSecurityGroupEgressInput) (*request.Request, *ec2.RevokeSecurityGroupEgressOutput) - - RevokeSecurityGroupEgress(*ec2.RevokeSecurityGroupEgressInput) (*ec2.RevokeSecurityGroupEgressOutput, error) - - RevokeSecurityGroupIngressRequest(*ec2.RevokeSecurityGroupIngressInput) (*request.Request, *ec2.RevokeSecurityGroupIngressOutput) - - RevokeSecurityGroupIngress(*ec2.RevokeSecurityGroupIngressInput) (*ec2.RevokeSecurityGroupIngressOutput, error) - - RunInstancesRequest(*ec2.RunInstancesInput) (*request.Request, *ec2.Reservation) - - RunInstances(*ec2.RunInstancesInput) (*ec2.Reservation, error) - - RunScheduledInstancesRequest(*ec2.RunScheduledInstancesInput) (*request.Request, *ec2.RunScheduledInstancesOutput) - - RunScheduledInstances(*ec2.RunScheduledInstancesInput) (*ec2.RunScheduledInstancesOutput, error) - - StartInstancesRequest(*ec2.StartInstancesInput) (*request.Request, *ec2.StartInstancesOutput) - - StartInstances(*ec2.StartInstancesInput) (*ec2.StartInstancesOutput, error) - - StopInstancesRequest(*ec2.StopInstancesInput) (*request.Request, *ec2.StopInstancesOutput) - - StopInstances(*ec2.StopInstancesInput) (*ec2.StopInstancesOutput, error) - - TerminateInstancesRequest(*ec2.TerminateInstancesInput) (*request.Request, *ec2.TerminateInstancesOutput) - - TerminateInstances(*ec2.TerminateInstancesInput) (*ec2.TerminateInstancesOutput, error) - - UnassignPrivateIpAddressesRequest(*ec2.UnassignPrivateIpAddressesInput) (*request.Request, *ec2.UnassignPrivateIpAddressesOutput) - - UnassignPrivateIpAddresses(*ec2.UnassignPrivateIpAddressesInput) (*ec2.UnassignPrivateIpAddressesOutput, error) - - UnmonitorInstancesRequest(*ec2.UnmonitorInstancesInput) (*request.Request, *ec2.UnmonitorInstancesOutput) - - UnmonitorInstances(*ec2.UnmonitorInstancesInput) (*ec2.UnmonitorInstancesOutput, error) -} - -var _ EC2API = (*ec2.EC2)(nil) diff --git a/vendor/github.com/aws/aws-sdk-go/service/ec2/service.go b/vendor/github.com/aws/aws-sdk-go/service/ec2/service.go index 9d5fa8160..4e6fa4cd7 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/ec2/service.go +++ b/vendor/github.com/aws/aws-sdk-go/service/ec2/service.go @@ -7,8 +7,8 @@ import ( "github.com/aws/aws-sdk-go/aws/client" "github.com/aws/aws-sdk-go/aws/client/metadata" "github.com/aws/aws-sdk-go/aws/request" + "github.com/aws/aws-sdk-go/aws/signer/v4" "github.com/aws/aws-sdk-go/private/protocol/ec2query" - "github.com/aws/aws-sdk-go/private/signer/v4" ) // Amazon Elastic Compute Cloud (Amazon EC2) provides resizable computing capacity @@ -54,14 +54,14 @@ func newClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegio ServiceName: ServiceName, SigningRegion: signingRegion, Endpoint: endpoint, - APIVersion: "2015-10-01", + APIVersion: "2016-04-01", }, handlers, ), } // Handlers - svc.Handlers.Sign.PushBack(v4.Sign) + svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler) svc.Handlers.Build.PushBackNamed(ec2query.BuildHandler) svc.Handlers.Unmarshal.PushBackNamed(ec2query.UnmarshalHandler) svc.Handlers.UnmarshalMeta.PushBackNamed(ec2query.UnmarshalMetaHandler) diff --git a/vendor/github.com/aws/aws-sdk-go/service/ec2/waiters.go b/vendor/github.com/aws/aws-sdk-go/service/ec2/waiters.go index 1b28317a1..bee4a057f 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/ec2/waiters.go +++ b/vendor/github.com/aws/aws-sdk-go/service/ec2/waiters.go @@ -226,6 +226,35 @@ func (c *EC2) WaitUntilImageAvailable(input *DescribeImagesInput) error { return w.Wait() } +func (c *EC2) WaitUntilImageExists(input *DescribeImagesInput) error { + waiterCfg := waiter.Config{ + Operation: "DescribeImages", + Delay: 15, + MaxAttempts: 40, + Acceptors: []waiter.WaitAcceptor{ + { + State: "success", + Matcher: "path", + Argument: "length(Images[]) > `0`", + Expected: true, + }, + { + State: "retry", + Matcher: "error", + Argument: "", + Expected: "InvalidAMIID.NotFound", + }, + }, + } + + w := waiter.Waiter{ + Client: c, + Input: input, + Config: waiterCfg, + } + return w.Wait() +} + func (c *EC2) WaitUntilInstanceExists(input *DescribeInstancesInput) error { waiterCfg := waiter.Config{ Operation: "DescribeInstances", @@ -234,15 +263,15 @@ func (c *EC2) WaitUntilInstanceExists(input *DescribeInstancesInput) error { Acceptors: []waiter.WaitAcceptor{ { State: "success", - Matcher: "status", - Argument: "", - Expected: 200, + Matcher: "path", + Argument: "length(Reservations[]) > `0`", + Expected: true, }, { State: "retry", Matcher: "error", Argument: "", - Expected: "InvalidInstanceIDNotFound", + Expected: "InvalidInstanceID.NotFound", }, }, } @@ -285,6 +314,12 @@ func (c *EC2) WaitUntilInstanceRunning(input *DescribeInstancesInput) error { Argument: "Reservations[].Instances[].State.Name", Expected: "stopping", }, + { + State: "retry", + Matcher: "error", + Argument: "", + Expected: "InvalidInstanceID.NotFound", + }, }, } @@ -308,6 +343,12 @@ func (c *EC2) WaitUntilInstanceStatusOk(input *DescribeInstanceStatusInput) erro Argument: "InstanceStatuses[].InstanceStatus.Status", Expected: "ok", }, + { + State: "retry", + Matcher: "error", + Argument: "", + Expected: "InvalidInstanceID.NotFound", + }, }, } @@ -405,7 +446,54 @@ func (c *EC2) WaitUntilKeyPairExists(input *DescribeKeyPairsInput) error { State: "retry", Matcher: "error", Argument: "", - Expected: "InvalidKeyPairNotFound", + Expected: "InvalidKeyPair.NotFound", + }, + }, + } + + w := waiter.Waiter{ + Client: c, + Input: input, + Config: waiterCfg, + } + return w.Wait() +} + +func (c *EC2) WaitUntilNatGatewayAvailable(input *DescribeNatGatewaysInput) error { + waiterCfg := waiter.Config{ + Operation: "DescribeNatGateways", + Delay: 15, + MaxAttempts: 40, + Acceptors: []waiter.WaitAcceptor{ + { + State: "success", + Matcher: "pathAll", + Argument: "NatGateways[].State", + Expected: "available", + }, + { + State: "failure", + Matcher: "pathAny", + Argument: "NatGateways[].State", + Expected: "failed", + }, + { + State: "failure", + Matcher: "pathAny", + Argument: "NatGateways[].State", + Expected: "deleting", + }, + { + State: "failure", + Matcher: "pathAny", + Argument: "NatGateways[].State", + Expected: "deleted", + }, + { + State: "retry", + Matcher: "error", + Argument: "", + Expected: "NatGatewayNotFound", }, }, } @@ -434,7 +522,7 @@ func (c *EC2) WaitUntilNetworkInterfaceAvailable(input *DescribeNetworkInterface State: "failure", Matcher: "error", Argument: "", - Expected: "InvalidNetworkInterfaceIDNotFound", + Expected: "InvalidNetworkInterfaceID.NotFound", }, }, } @@ -631,7 +719,7 @@ func (c *EC2) WaitUntilVolumeDeleted(input *DescribeVolumesInput) error { State: "success", Matcher: "error", Argument: "", - Expected: "InvalidVolumeNotFound", + Expected: "InvalidVolume.NotFound", }, }, } @@ -696,6 +784,64 @@ func (c *EC2) WaitUntilVpcAvailable(input *DescribeVpcsInput) error { return w.Wait() } +func (c *EC2) WaitUntilVpcExists(input *DescribeVpcsInput) error { + waiterCfg := waiter.Config{ + Operation: "DescribeVpcs", + Delay: 1, + MaxAttempts: 5, + Acceptors: []waiter.WaitAcceptor{ + { + State: "success", + Matcher: "status", + Argument: "", + Expected: 200, + }, + { + State: "retry", + Matcher: "error", + Argument: "", + Expected: "InvalidVpcID.NotFound", + }, + }, + } + + w := waiter.Waiter{ + Client: c, + Input: input, + Config: waiterCfg, + } + return w.Wait() +} + +func (c *EC2) WaitUntilVpcPeeringConnectionExists(input *DescribeVpcPeeringConnectionsInput) error { + waiterCfg := waiter.Config{ + Operation: "DescribeVpcPeeringConnections", + Delay: 15, + MaxAttempts: 40, + Acceptors: []waiter.WaitAcceptor{ + { + State: "success", + Matcher: "status", + Argument: "", + Expected: 200, + }, + { + State: "retry", + Matcher: "error", + Argument: "", + Expected: "InvalidVpcPeeringConnectionID.NotFound", + }, + }, + } + + w := waiter.Waiter{ + Client: c, + Input: input, + Config: waiterCfg, + } + return w.Wait() +} + func (c *EC2) WaitUntilVpnConnectionAvailable(input *DescribeVpnConnectionsInput) error { waiterCfg := waiter.Config{ Operation: "DescribeVpnConnections", diff --git a/vendor/github.com/aws/aws-sdk-go/service/ecr/api.go b/vendor/github.com/aws/aws-sdk-go/service/ecr/api.go new file mode 100644 index 000000000..b6ffa5109 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/service/ecr/api.go @@ -0,0 +1,2114 @@ +// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. + +// Package ecr provides a client for Amazon EC2 Container Registry. +package ecr + +import ( + "time" + + "github.com/aws/aws-sdk-go/aws/awsutil" + "github.com/aws/aws-sdk-go/aws/request" +) + +const opBatchCheckLayerAvailability = "BatchCheckLayerAvailability" + +// BatchCheckLayerAvailabilityRequest generates a "aws/request.Request" representing the +// client's request for the BatchCheckLayerAvailability operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the BatchCheckLayerAvailability method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the BatchCheckLayerAvailabilityRequest method. +// req, resp := client.BatchCheckLayerAvailabilityRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +func (c *ECR) BatchCheckLayerAvailabilityRequest(input *BatchCheckLayerAvailabilityInput) (req *request.Request, output *BatchCheckLayerAvailabilityOutput) { + op := &request.Operation{ + Name: opBatchCheckLayerAvailability, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &BatchCheckLayerAvailabilityInput{} + } + + req = c.newRequest(op, input, output) + output = &BatchCheckLayerAvailabilityOutput{} + req.Data = output + return +} + +// Check the availability of multiple image layers in a specified registry and +// repository. +// +// This operation is used by the Amazon ECR proxy, and it is not intended +// for general use by customers. Use the docker CLI to pull, tag, and push images. +func (c *ECR) BatchCheckLayerAvailability(input *BatchCheckLayerAvailabilityInput) (*BatchCheckLayerAvailabilityOutput, error) { + req, out := c.BatchCheckLayerAvailabilityRequest(input) + err := req.Send() + return out, err +} + +const opBatchDeleteImage = "BatchDeleteImage" + +// BatchDeleteImageRequest generates a "aws/request.Request" representing the +// client's request for the BatchDeleteImage operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the BatchDeleteImage method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the BatchDeleteImageRequest method. +// req, resp := client.BatchDeleteImageRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +func (c *ECR) BatchDeleteImageRequest(input *BatchDeleteImageInput) (req *request.Request, output *BatchDeleteImageOutput) { + op := &request.Operation{ + Name: opBatchDeleteImage, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &BatchDeleteImageInput{} + } + + req = c.newRequest(op, input, output) + output = &BatchDeleteImageOutput{} + req.Data = output + return +} + +// Deletes a list of specified images within a specified repository. Images +// are specified with either imageTag or imageDigest. +func (c *ECR) BatchDeleteImage(input *BatchDeleteImageInput) (*BatchDeleteImageOutput, error) { + req, out := c.BatchDeleteImageRequest(input) + err := req.Send() + return out, err +} + +const opBatchGetImage = "BatchGetImage" + +// BatchGetImageRequest generates a "aws/request.Request" representing the +// client's request for the BatchGetImage operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the BatchGetImage method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the BatchGetImageRequest method. +// req, resp := client.BatchGetImageRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +func (c *ECR) BatchGetImageRequest(input *BatchGetImageInput) (req *request.Request, output *BatchGetImageOutput) { + op := &request.Operation{ + Name: opBatchGetImage, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &BatchGetImageInput{} + } + + req = c.newRequest(op, input, output) + output = &BatchGetImageOutput{} + req.Data = output + return +} + +// Gets detailed information for specified images within a specified repository. +// Images are specified with either imageTag or imageDigest. +func (c *ECR) BatchGetImage(input *BatchGetImageInput) (*BatchGetImageOutput, error) { + req, out := c.BatchGetImageRequest(input) + err := req.Send() + return out, err +} + +const opCompleteLayerUpload = "CompleteLayerUpload" + +// CompleteLayerUploadRequest generates a "aws/request.Request" representing the +// client's request for the CompleteLayerUpload operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the CompleteLayerUpload method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the CompleteLayerUploadRequest method. +// req, resp := client.CompleteLayerUploadRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +func (c *ECR) CompleteLayerUploadRequest(input *CompleteLayerUploadInput) (req *request.Request, output *CompleteLayerUploadOutput) { + op := &request.Operation{ + Name: opCompleteLayerUpload, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &CompleteLayerUploadInput{} + } + + req = c.newRequest(op, input, output) + output = &CompleteLayerUploadOutput{} + req.Data = output + return +} + +// Inform Amazon ECR that the image layer upload for a specified registry, repository +// name, and upload ID, has completed. You can optionally provide a sha256 digest +// of the image layer for data validation purposes. +// +// This operation is used by the Amazon ECR proxy, and it is not intended +// for general use by customers. Use the docker CLI to pull, tag, and push images. +func (c *ECR) CompleteLayerUpload(input *CompleteLayerUploadInput) (*CompleteLayerUploadOutput, error) { + req, out := c.CompleteLayerUploadRequest(input) + err := req.Send() + return out, err +} + +const opCreateRepository = "CreateRepository" + +// CreateRepositoryRequest generates a "aws/request.Request" representing the +// client's request for the CreateRepository operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the CreateRepository method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the CreateRepositoryRequest method. +// req, resp := client.CreateRepositoryRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +func (c *ECR) CreateRepositoryRequest(input *CreateRepositoryInput) (req *request.Request, output *CreateRepositoryOutput) { + op := &request.Operation{ + Name: opCreateRepository, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &CreateRepositoryInput{} + } + + req = c.newRequest(op, input, output) + output = &CreateRepositoryOutput{} + req.Data = output + return +} + +// Creates an image repository. +func (c *ECR) CreateRepository(input *CreateRepositoryInput) (*CreateRepositoryOutput, error) { + req, out := c.CreateRepositoryRequest(input) + err := req.Send() + return out, err +} + +const opDeleteRepository = "DeleteRepository" + +// DeleteRepositoryRequest generates a "aws/request.Request" representing the +// client's request for the DeleteRepository operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the DeleteRepository method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the DeleteRepositoryRequest method. +// req, resp := client.DeleteRepositoryRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +func (c *ECR) DeleteRepositoryRequest(input *DeleteRepositoryInput) (req *request.Request, output *DeleteRepositoryOutput) { + op := &request.Operation{ + Name: opDeleteRepository, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &DeleteRepositoryInput{} + } + + req = c.newRequest(op, input, output) + output = &DeleteRepositoryOutput{} + req.Data = output + return +} + +// Deletes an existing image repository. If a repository contains images, you +// must use the force option to delete it. +func (c *ECR) DeleteRepository(input *DeleteRepositoryInput) (*DeleteRepositoryOutput, error) { + req, out := c.DeleteRepositoryRequest(input) + err := req.Send() + return out, err +} + +const opDeleteRepositoryPolicy = "DeleteRepositoryPolicy" + +// DeleteRepositoryPolicyRequest generates a "aws/request.Request" representing the +// client's request for the DeleteRepositoryPolicy operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the DeleteRepositoryPolicy method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the DeleteRepositoryPolicyRequest method. +// req, resp := client.DeleteRepositoryPolicyRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +func (c *ECR) DeleteRepositoryPolicyRequest(input *DeleteRepositoryPolicyInput) (req *request.Request, output *DeleteRepositoryPolicyOutput) { + op := &request.Operation{ + Name: opDeleteRepositoryPolicy, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &DeleteRepositoryPolicyInput{} + } + + req = c.newRequest(op, input, output) + output = &DeleteRepositoryPolicyOutput{} + req.Data = output + return +} + +// Deletes the repository policy from a specified repository. +func (c *ECR) DeleteRepositoryPolicy(input *DeleteRepositoryPolicyInput) (*DeleteRepositoryPolicyOutput, error) { + req, out := c.DeleteRepositoryPolicyRequest(input) + err := req.Send() + return out, err +} + +const opDescribeRepositories = "DescribeRepositories" + +// DescribeRepositoriesRequest generates a "aws/request.Request" representing the +// client's request for the DescribeRepositories operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the DescribeRepositories method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the DescribeRepositoriesRequest method. +// req, resp := client.DescribeRepositoriesRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +func (c *ECR) DescribeRepositoriesRequest(input *DescribeRepositoriesInput) (req *request.Request, output *DescribeRepositoriesOutput) { + op := &request.Operation{ + Name: opDescribeRepositories, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &DescribeRepositoriesInput{} + } + + req = c.newRequest(op, input, output) + output = &DescribeRepositoriesOutput{} + req.Data = output + return +} + +// Describes image repositories in a registry. +func (c *ECR) DescribeRepositories(input *DescribeRepositoriesInput) (*DescribeRepositoriesOutput, error) { + req, out := c.DescribeRepositoriesRequest(input) + err := req.Send() + return out, err +} + +const opGetAuthorizationToken = "GetAuthorizationToken" + +// GetAuthorizationTokenRequest generates a "aws/request.Request" representing the +// client's request for the GetAuthorizationToken operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the GetAuthorizationToken method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the GetAuthorizationTokenRequest method. +// req, resp := client.GetAuthorizationTokenRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +func (c *ECR) GetAuthorizationTokenRequest(input *GetAuthorizationTokenInput) (req *request.Request, output *GetAuthorizationTokenOutput) { + op := &request.Operation{ + Name: opGetAuthorizationToken, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &GetAuthorizationTokenInput{} + } + + req = c.newRequest(op, input, output) + output = &GetAuthorizationTokenOutput{} + req.Data = output + return +} + +// Retrieves a token that is valid for a specified registry for 12 hours. This +// command allows you to use the docker CLI to push and pull images with Amazon +// ECR. If you do not specify a registry, the default registry is assumed. +// +// The authorizationToken returned for each registry specified is a base64 +// encoded string that can be decoded and used in a docker login command to +// authenticate to a registry. The AWS CLI offers an aws ecr get-login command +// that simplifies the login process. +func (c *ECR) GetAuthorizationToken(input *GetAuthorizationTokenInput) (*GetAuthorizationTokenOutput, error) { + req, out := c.GetAuthorizationTokenRequest(input) + err := req.Send() + return out, err +} + +const opGetDownloadUrlForLayer = "GetDownloadUrlForLayer" + +// GetDownloadUrlForLayerRequest generates a "aws/request.Request" representing the +// client's request for the GetDownloadUrlForLayer operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the GetDownloadUrlForLayer method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the GetDownloadUrlForLayerRequest method. +// req, resp := client.GetDownloadUrlForLayerRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +func (c *ECR) GetDownloadUrlForLayerRequest(input *GetDownloadUrlForLayerInput) (req *request.Request, output *GetDownloadUrlForLayerOutput) { + op := &request.Operation{ + Name: opGetDownloadUrlForLayer, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &GetDownloadUrlForLayerInput{} + } + + req = c.newRequest(op, input, output) + output = &GetDownloadUrlForLayerOutput{} + req.Data = output + return +} + +// Retrieves the pre-signed Amazon S3 download URL corresponding to an image +// layer. You can only get URLs for image layers that are referenced in an image. +// +// This operation is used by the Amazon ECR proxy, and it is not intended +// for general use by customers. Use the docker CLI to pull, tag, and push images. +func (c *ECR) GetDownloadUrlForLayer(input *GetDownloadUrlForLayerInput) (*GetDownloadUrlForLayerOutput, error) { + req, out := c.GetDownloadUrlForLayerRequest(input) + err := req.Send() + return out, err +} + +const opGetRepositoryPolicy = "GetRepositoryPolicy" + +// GetRepositoryPolicyRequest generates a "aws/request.Request" representing the +// client's request for the GetRepositoryPolicy operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the GetRepositoryPolicy method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the GetRepositoryPolicyRequest method. +// req, resp := client.GetRepositoryPolicyRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +func (c *ECR) GetRepositoryPolicyRequest(input *GetRepositoryPolicyInput) (req *request.Request, output *GetRepositoryPolicyOutput) { + op := &request.Operation{ + Name: opGetRepositoryPolicy, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &GetRepositoryPolicyInput{} + } + + req = c.newRequest(op, input, output) + output = &GetRepositoryPolicyOutput{} + req.Data = output + return +} + +// Retrieves the repository policy for a specified repository. +func (c *ECR) GetRepositoryPolicy(input *GetRepositoryPolicyInput) (*GetRepositoryPolicyOutput, error) { + req, out := c.GetRepositoryPolicyRequest(input) + err := req.Send() + return out, err +} + +const opInitiateLayerUpload = "InitiateLayerUpload" + +// InitiateLayerUploadRequest generates a "aws/request.Request" representing the +// client's request for the InitiateLayerUpload operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the InitiateLayerUpload method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the InitiateLayerUploadRequest method. +// req, resp := client.InitiateLayerUploadRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +func (c *ECR) InitiateLayerUploadRequest(input *InitiateLayerUploadInput) (req *request.Request, output *InitiateLayerUploadOutput) { + op := &request.Operation{ + Name: opInitiateLayerUpload, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &InitiateLayerUploadInput{} + } + + req = c.newRequest(op, input, output) + output = &InitiateLayerUploadOutput{} + req.Data = output + return +} + +// Notify Amazon ECR that you intend to upload an image layer. +// +// This operation is used by the Amazon ECR proxy, and it is not intended +// for general use by customers. Use the docker CLI to pull, tag, and push images. +func (c *ECR) InitiateLayerUpload(input *InitiateLayerUploadInput) (*InitiateLayerUploadOutput, error) { + req, out := c.InitiateLayerUploadRequest(input) + err := req.Send() + return out, err +} + +const opListImages = "ListImages" + +// ListImagesRequest generates a "aws/request.Request" representing the +// client's request for the ListImages operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the ListImages method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the ListImagesRequest method. +// req, resp := client.ListImagesRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +func (c *ECR) ListImagesRequest(input *ListImagesInput) (req *request.Request, output *ListImagesOutput) { + op := &request.Operation{ + Name: opListImages, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &ListImagesInput{} + } + + req = c.newRequest(op, input, output) + output = &ListImagesOutput{} + req.Data = output + return +} + +// Lists all the image IDs for a given repository. +func (c *ECR) ListImages(input *ListImagesInput) (*ListImagesOutput, error) { + req, out := c.ListImagesRequest(input) + err := req.Send() + return out, err +} + +const opPutImage = "PutImage" + +// PutImageRequest generates a "aws/request.Request" representing the +// client's request for the PutImage operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the PutImage method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the PutImageRequest method. +// req, resp := client.PutImageRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +func (c *ECR) PutImageRequest(input *PutImageInput) (req *request.Request, output *PutImageOutput) { + op := &request.Operation{ + Name: opPutImage, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &PutImageInput{} + } + + req = c.newRequest(op, input, output) + output = &PutImageOutput{} + req.Data = output + return +} + +// Creates or updates the image manifest associated with an image. +// +// This operation is used by the Amazon ECR proxy, and it is not intended +// for general use by customers. Use the docker CLI to pull, tag, and push images. +func (c *ECR) PutImage(input *PutImageInput) (*PutImageOutput, error) { + req, out := c.PutImageRequest(input) + err := req.Send() + return out, err +} + +const opSetRepositoryPolicy = "SetRepositoryPolicy" + +// SetRepositoryPolicyRequest generates a "aws/request.Request" representing the +// client's request for the SetRepositoryPolicy operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the SetRepositoryPolicy method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the SetRepositoryPolicyRequest method. +// req, resp := client.SetRepositoryPolicyRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +func (c *ECR) SetRepositoryPolicyRequest(input *SetRepositoryPolicyInput) (req *request.Request, output *SetRepositoryPolicyOutput) { + op := &request.Operation{ + Name: opSetRepositoryPolicy, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &SetRepositoryPolicyInput{} + } + + req = c.newRequest(op, input, output) + output = &SetRepositoryPolicyOutput{} + req.Data = output + return +} + +// Applies a repository policy on a specified repository to control access permissions. +func (c *ECR) SetRepositoryPolicy(input *SetRepositoryPolicyInput) (*SetRepositoryPolicyOutput, error) { + req, out := c.SetRepositoryPolicyRequest(input) + err := req.Send() + return out, err +} + +const opUploadLayerPart = "UploadLayerPart" + +// UploadLayerPartRequest generates a "aws/request.Request" representing the +// client's request for the UploadLayerPart operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the UploadLayerPart method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the UploadLayerPartRequest method. +// req, resp := client.UploadLayerPartRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +func (c *ECR) UploadLayerPartRequest(input *UploadLayerPartInput) (req *request.Request, output *UploadLayerPartOutput) { + op := &request.Operation{ + Name: opUploadLayerPart, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &UploadLayerPartInput{} + } + + req = c.newRequest(op, input, output) + output = &UploadLayerPartOutput{} + req.Data = output + return +} + +// Uploads an image layer part to Amazon ECR. +// +// This operation is used by the Amazon ECR proxy, and it is not intended +// for general use by customers. Use the docker CLI to pull, tag, and push images. +func (c *ECR) UploadLayerPart(input *UploadLayerPartInput) (*UploadLayerPartOutput, error) { + req, out := c.UploadLayerPartRequest(input) + err := req.Send() + return out, err +} + +// An object representing authorization data for an Amazon ECR registry. +type AuthorizationData struct { + _ struct{} `type:"structure"` + + // A base64-encoded string that contains authorization data for the specified + // Amazon ECR registry. When the string is decoded, it is presented in the format + // user:password for private registry authentication using docker login. + AuthorizationToken *string `locationName:"authorizationToken" type:"string"` + + // The Unix time in seconds and milliseconds when the authorization token expires. + // Authorization tokens are valid for 12 hours. + ExpiresAt *time.Time `locationName:"expiresAt" type:"timestamp" timestampFormat:"unix"` + + // The registry URL to use for this authorization token in a docker login command. + // The Amazon ECR registry URL format is https://aws_account_id.dkr.ecr.region.amazonaws.com. + // For example, https://012345678910.dkr.ecr.us-east-1.amazonaws.com.. + ProxyEndpoint *string `locationName:"proxyEndpoint" type:"string"` +} + +// String returns the string representation +func (s AuthorizationData) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s AuthorizationData) GoString() string { + return s.String() +} + +type BatchCheckLayerAvailabilityInput struct { + _ struct{} `type:"structure"` + + // The digests of the image layers to check. + LayerDigests []*string `locationName:"layerDigests" min:"1" type:"list" required:"true"` + + // The AWS account ID associated with the registry that contains the image layers + // to check. If you do not specify a registry, the default registry is assumed. + RegistryId *string `locationName:"registryId" type:"string"` + + // The name of the repository that is associated with the image layers to check. + RepositoryName *string `locationName:"repositoryName" min:"2" type:"string" required:"true"` +} + +// String returns the string representation +func (s BatchCheckLayerAvailabilityInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s BatchCheckLayerAvailabilityInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *BatchCheckLayerAvailabilityInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "BatchCheckLayerAvailabilityInput"} + if s.LayerDigests == nil { + invalidParams.Add(request.NewErrParamRequired("LayerDigests")) + } + if s.LayerDigests != nil && len(s.LayerDigests) < 1 { + invalidParams.Add(request.NewErrParamMinLen("LayerDigests", 1)) + } + if s.RepositoryName == nil { + invalidParams.Add(request.NewErrParamRequired("RepositoryName")) + } + if s.RepositoryName != nil && len(*s.RepositoryName) < 2 { + invalidParams.Add(request.NewErrParamMinLen("RepositoryName", 2)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +type BatchCheckLayerAvailabilityOutput struct { + _ struct{} `type:"structure"` + + // Any failures associated with the call. + Failures []*LayerFailure `locationName:"failures" type:"list"` + + // A list of image layer objects corresponding to the image layer references + // in the request. + Layers []*Layer `locationName:"layers" type:"list"` +} + +// String returns the string representation +func (s BatchCheckLayerAvailabilityOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s BatchCheckLayerAvailabilityOutput) GoString() string { + return s.String() +} + +// Deletes specified images within a specified repository. Images are specified +// with either the imageTag or imageDigest. +type BatchDeleteImageInput struct { + _ struct{} `type:"structure"` + + // A list of image ID references that correspond to images to delete. The format + // of the imageIds reference is imageTag=tag or imageDigest=digest. + ImageIds []*ImageIdentifier `locationName:"imageIds" min:"1" type:"list" required:"true"` + + // The AWS account ID associated with the registry that contains the image to + // delete. If you do not specify a registry, the default registry is assumed. + RegistryId *string `locationName:"registryId" type:"string"` + + // The repository that contains the image to delete. + RepositoryName *string `locationName:"repositoryName" min:"2" type:"string" required:"true"` +} + +// String returns the string representation +func (s BatchDeleteImageInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s BatchDeleteImageInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *BatchDeleteImageInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "BatchDeleteImageInput"} + if s.ImageIds == nil { + invalidParams.Add(request.NewErrParamRequired("ImageIds")) + } + if s.ImageIds != nil && len(s.ImageIds) < 1 { + invalidParams.Add(request.NewErrParamMinLen("ImageIds", 1)) + } + if s.RepositoryName == nil { + invalidParams.Add(request.NewErrParamRequired("RepositoryName")) + } + if s.RepositoryName != nil && len(*s.RepositoryName) < 2 { + invalidParams.Add(request.NewErrParamMinLen("RepositoryName", 2)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +type BatchDeleteImageOutput struct { + _ struct{} `type:"structure"` + + // Any failures associated with the call. + Failures []*ImageFailure `locationName:"failures" type:"list"` + + // The image IDs of the deleted images. + ImageIds []*ImageIdentifier `locationName:"imageIds" min:"1" type:"list"` +} + +// String returns the string representation +func (s BatchDeleteImageOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s BatchDeleteImageOutput) GoString() string { + return s.String() +} + +type BatchGetImageInput struct { + _ struct{} `type:"structure"` + + // A list of image ID references that correspond to images to describe. The + // format of the imageIds reference is imageTag=tag or imageDigest=digest. + ImageIds []*ImageIdentifier `locationName:"imageIds" min:"1" type:"list" required:"true"` + + // The AWS account ID associated with the registry that contains the images + // to describe. If you do not specify a registry, the default registry is assumed. + RegistryId *string `locationName:"registryId" type:"string"` + + // The repository that contains the images to describe. + RepositoryName *string `locationName:"repositoryName" min:"2" type:"string" required:"true"` +} + +// String returns the string representation +func (s BatchGetImageInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s BatchGetImageInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *BatchGetImageInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "BatchGetImageInput"} + if s.ImageIds == nil { + invalidParams.Add(request.NewErrParamRequired("ImageIds")) + } + if s.ImageIds != nil && len(s.ImageIds) < 1 { + invalidParams.Add(request.NewErrParamMinLen("ImageIds", 1)) + } + if s.RepositoryName == nil { + invalidParams.Add(request.NewErrParamRequired("RepositoryName")) + } + if s.RepositoryName != nil && len(*s.RepositoryName) < 2 { + invalidParams.Add(request.NewErrParamMinLen("RepositoryName", 2)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +type BatchGetImageOutput struct { + _ struct{} `type:"structure"` + + // Any failures associated with the call. + Failures []*ImageFailure `locationName:"failures" type:"list"` + + // A list of image objects corresponding to the image references in the request. + Images []*Image `locationName:"images" type:"list"` +} + +// String returns the string representation +func (s BatchGetImageOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s BatchGetImageOutput) GoString() string { + return s.String() +} + +type CompleteLayerUploadInput struct { + _ struct{} `type:"structure"` + + // The sha256 digest of the image layer. + LayerDigests []*string `locationName:"layerDigests" min:"1" type:"list" required:"true"` + + // The AWS account ID associated with the registry to which to upload layers. + // If you do not specify a registry, the default registry is assumed. + RegistryId *string `locationName:"registryId" type:"string"` + + // The name of the repository to associate with the image layer. + RepositoryName *string `locationName:"repositoryName" min:"2" type:"string" required:"true"` + + // The upload ID from a previous InitiateLayerUpload operation to associate + // with the image layer. + UploadId *string `locationName:"uploadId" type:"string" required:"true"` +} + +// String returns the string representation +func (s CompleteLayerUploadInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s CompleteLayerUploadInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *CompleteLayerUploadInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "CompleteLayerUploadInput"} + if s.LayerDigests == nil { + invalidParams.Add(request.NewErrParamRequired("LayerDigests")) + } + if s.LayerDigests != nil && len(s.LayerDigests) < 1 { + invalidParams.Add(request.NewErrParamMinLen("LayerDigests", 1)) + } + if s.RepositoryName == nil { + invalidParams.Add(request.NewErrParamRequired("RepositoryName")) + } + if s.RepositoryName != nil && len(*s.RepositoryName) < 2 { + invalidParams.Add(request.NewErrParamMinLen("RepositoryName", 2)) + } + if s.UploadId == nil { + invalidParams.Add(request.NewErrParamRequired("UploadId")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +type CompleteLayerUploadOutput struct { + _ struct{} `type:"structure"` + + // The sha256 digest of the image layer. + LayerDigest *string `locationName:"layerDigest" type:"string"` + + // The registry ID associated with the request. + RegistryId *string `locationName:"registryId" type:"string"` + + // The repository name associated with the request. + RepositoryName *string `locationName:"repositoryName" min:"2" type:"string"` + + // The upload ID associated with the layer. + UploadId *string `locationName:"uploadId" type:"string"` +} + +// String returns the string representation +func (s CompleteLayerUploadOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s CompleteLayerUploadOutput) GoString() string { + return s.String() +} + +type CreateRepositoryInput struct { + _ struct{} `type:"structure"` + + // The name to use for the repository. The repository name may be specified + // on its own (such as nginx-web-app) or it can be prepended with a namespace + // to group the repository into a category (such as project-a/nginx-web-app). + RepositoryName *string `locationName:"repositoryName" min:"2" type:"string" required:"true"` +} + +// String returns the string representation +func (s CreateRepositoryInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s CreateRepositoryInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *CreateRepositoryInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "CreateRepositoryInput"} + if s.RepositoryName == nil { + invalidParams.Add(request.NewErrParamRequired("RepositoryName")) + } + if s.RepositoryName != nil && len(*s.RepositoryName) < 2 { + invalidParams.Add(request.NewErrParamMinLen("RepositoryName", 2)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +type CreateRepositoryOutput struct { + _ struct{} `type:"structure"` + + // An object representing a repository. + Repository *Repository `locationName:"repository" type:"structure"` +} + +// String returns the string representation +func (s CreateRepositoryOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s CreateRepositoryOutput) GoString() string { + return s.String() +} + +type DeleteRepositoryInput struct { + _ struct{} `type:"structure"` + + // Force the deletion of the repository if it contains images. + Force *bool `locationName:"force" type:"boolean"` + + // The AWS account ID associated with the registry that contains the repository + // to delete. If you do not specify a registry, the default registry is assumed. + RegistryId *string `locationName:"registryId" type:"string"` + + // The name of the repository to delete. + RepositoryName *string `locationName:"repositoryName" min:"2" type:"string" required:"true"` +} + +// String returns the string representation +func (s DeleteRepositoryInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DeleteRepositoryInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *DeleteRepositoryInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DeleteRepositoryInput"} + if s.RepositoryName == nil { + invalidParams.Add(request.NewErrParamRequired("RepositoryName")) + } + if s.RepositoryName != nil && len(*s.RepositoryName) < 2 { + invalidParams.Add(request.NewErrParamMinLen("RepositoryName", 2)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +type DeleteRepositoryOutput struct { + _ struct{} `type:"structure"` + + // An object representing a repository. + Repository *Repository `locationName:"repository" type:"structure"` +} + +// String returns the string representation +func (s DeleteRepositoryOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DeleteRepositoryOutput) GoString() string { + return s.String() +} + +type DeleteRepositoryPolicyInput struct { + _ struct{} `type:"structure"` + + // The AWS account ID associated with the registry that contains the repository + // policy to delete. If you do not specify a registry, the default registry + // is assumed. + RegistryId *string `locationName:"registryId" type:"string"` + + // The name of the repository that is associated with the repository policy + // to delete. + RepositoryName *string `locationName:"repositoryName" min:"2" type:"string" required:"true"` +} + +// String returns the string representation +func (s DeleteRepositoryPolicyInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DeleteRepositoryPolicyInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *DeleteRepositoryPolicyInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DeleteRepositoryPolicyInput"} + if s.RepositoryName == nil { + invalidParams.Add(request.NewErrParamRequired("RepositoryName")) + } + if s.RepositoryName != nil && len(*s.RepositoryName) < 2 { + invalidParams.Add(request.NewErrParamMinLen("RepositoryName", 2)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +type DeleteRepositoryPolicyOutput struct { + _ struct{} `type:"structure"` + + // The JSON repository policy that was deleted from the repository. + PolicyText *string `locationName:"policyText" type:"string"` + + // The registry ID associated with the request. + RegistryId *string `locationName:"registryId" type:"string"` + + // The repository name associated with the request. + RepositoryName *string `locationName:"repositoryName" min:"2" type:"string"` +} + +// String returns the string representation +func (s DeleteRepositoryPolicyOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DeleteRepositoryPolicyOutput) GoString() string { + return s.String() +} + +type DescribeRepositoriesInput struct { + _ struct{} `type:"structure"` + + // The maximum number of repository results returned by DescribeRepositories + // in paginated output. When this parameter is used, DescribeRepositories 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 DescribeRepositories request with the returned nextToken value. This + // value can be between 1 and 100. If this parameter is not used, then DescribeRepositories + // returns up to 100 results and a nextToken value, if applicable. + MaxResults *int64 `locationName:"maxResults" min:"1" type:"integer"` + + // The nextToken value returned from a previous paginated DescribeRepositories + // 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. + // + // This token should be treated as an opaque identifier that is only used + // to retrieve the next items in a list and not for other programmatic purposes. + NextToken *string `locationName:"nextToken" type:"string"` + + // The AWS account ID associated with the registry that contains the repositories + // to be described. If you do not specify a registry, the default registry is + // assumed. + RegistryId *string `locationName:"registryId" type:"string"` + + // A list of repositories to describe. If this parameter is omitted, then all + // repositories in a registry are described. + RepositoryNames []*string `locationName:"repositoryNames" min:"1" type:"list"` +} + +// String returns the string representation +func (s DescribeRepositoriesInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DescribeRepositoriesInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *DescribeRepositoriesInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DescribeRepositoriesInput"} + if s.MaxResults != nil && *s.MaxResults < 1 { + invalidParams.Add(request.NewErrParamMinValue("MaxResults", 1)) + } + if s.RepositoryNames != nil && len(s.RepositoryNames) < 1 { + invalidParams.Add(request.NewErrParamMinLen("RepositoryNames", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +type DescribeRepositoriesOutput struct { + _ struct{} `type:"structure"` + + // The nextToken value to include in a future DescribeRepositories request. + // When the results of a DescribeRepositories 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"` + + // A list of repository objects corresponding to valid repositories. + Repositories []*Repository `locationName:"repositories" type:"list"` +} + +// String returns the string representation +func (s DescribeRepositoriesOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DescribeRepositoriesOutput) GoString() string { + return s.String() +} + +type GetAuthorizationTokenInput struct { + _ struct{} `type:"structure"` + + // A list of AWS account IDs that are associated with the registries for which + // to get authorization tokens. If you do not specify a registry, the default + // registry is assumed. + RegistryIds []*string `locationName:"registryIds" min:"1" type:"list"` +} + +// String returns the string representation +func (s GetAuthorizationTokenInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s GetAuthorizationTokenInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *GetAuthorizationTokenInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "GetAuthorizationTokenInput"} + if s.RegistryIds != nil && len(s.RegistryIds) < 1 { + invalidParams.Add(request.NewErrParamMinLen("RegistryIds", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +type GetAuthorizationTokenOutput struct { + _ struct{} `type:"structure"` + + // A list of authorization token data objects that correspond to the registryIds + // values in the request. + AuthorizationData []*AuthorizationData `locationName:"authorizationData" type:"list"` +} + +// String returns the string representation +func (s GetAuthorizationTokenOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s GetAuthorizationTokenOutput) GoString() string { + return s.String() +} + +type GetDownloadUrlForLayerInput struct { + _ struct{} `type:"structure"` + + // The digest of the image layer to download. + LayerDigest *string `locationName:"layerDigest" type:"string" required:"true"` + + // The AWS account ID associated with the registry that contains the image layer + // to download. If you do not specify a registry, the default registry is assumed. + RegistryId *string `locationName:"registryId" type:"string"` + + // The name of the repository that is associated with the image layer to download. + RepositoryName *string `locationName:"repositoryName" min:"2" type:"string" required:"true"` +} + +// String returns the string representation +func (s GetDownloadUrlForLayerInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s GetDownloadUrlForLayerInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *GetDownloadUrlForLayerInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "GetDownloadUrlForLayerInput"} + if s.LayerDigest == nil { + invalidParams.Add(request.NewErrParamRequired("LayerDigest")) + } + if s.RepositoryName == nil { + invalidParams.Add(request.NewErrParamRequired("RepositoryName")) + } + if s.RepositoryName != nil && len(*s.RepositoryName) < 2 { + invalidParams.Add(request.NewErrParamMinLen("RepositoryName", 2)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +type GetDownloadUrlForLayerOutput struct { + _ struct{} `type:"structure"` + + // The pre-signed Amazon S3 download URL for the requested layer. + DownloadUrl *string `locationName:"downloadUrl" type:"string"` + + // The digest of the image layer to download. + LayerDigest *string `locationName:"layerDigest" type:"string"` +} + +// String returns the string representation +func (s GetDownloadUrlForLayerOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s GetDownloadUrlForLayerOutput) GoString() string { + return s.String() +} + +type GetRepositoryPolicyInput struct { + _ struct{} `type:"structure"` + + // The AWS account ID associated with the registry that contains the repository. + // If you do not specify a registry, the default registry is assumed. + RegistryId *string `locationName:"registryId" type:"string"` + + // The name of the repository whose policy you want to retrieve. + RepositoryName *string `locationName:"repositoryName" min:"2" type:"string" required:"true"` +} + +// String returns the string representation +func (s GetRepositoryPolicyInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s GetRepositoryPolicyInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *GetRepositoryPolicyInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "GetRepositoryPolicyInput"} + if s.RepositoryName == nil { + invalidParams.Add(request.NewErrParamRequired("RepositoryName")) + } + if s.RepositoryName != nil && len(*s.RepositoryName) < 2 { + invalidParams.Add(request.NewErrParamMinLen("RepositoryName", 2)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +type GetRepositoryPolicyOutput struct { + _ struct{} `type:"structure"` + + // The JSON repository policy text associated with the repository. + PolicyText *string `locationName:"policyText" type:"string"` + + // The registry ID associated with the request. + RegistryId *string `locationName:"registryId" type:"string"` + + // The repository name associated with the request. + RepositoryName *string `locationName:"repositoryName" min:"2" type:"string"` +} + +// String returns the string representation +func (s GetRepositoryPolicyOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s GetRepositoryPolicyOutput) GoString() string { + return s.String() +} + +// An object representing an Amazon ECR image. +type Image struct { + _ struct{} `type:"structure"` + + // An object containing the image tag and image digest associated with an image. + ImageId *ImageIdentifier `locationName:"imageId" type:"structure"` + + // The image manifest associated with the image. + ImageManifest *string `locationName:"imageManifest" type:"string"` + + // The AWS account ID associated with the registry containing the image. + RegistryId *string `locationName:"registryId" type:"string"` + + // The name of the repository associated with the image. + RepositoryName *string `locationName:"repositoryName" min:"2" type:"string"` +} + +// String returns the string representation +func (s Image) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s Image) GoString() string { + return s.String() +} + +// An object representing an Amazon ECR image failure. +type ImageFailure struct { + _ struct{} `type:"structure"` + + // The code associated with the failure. + FailureCode *string `locationName:"failureCode" type:"string" enum:"ImageFailureCode"` + + // The reason for the failure. + FailureReason *string `locationName:"failureReason" type:"string"` + + // The image ID associated with the failure. + ImageId *ImageIdentifier `locationName:"imageId" type:"structure"` +} + +// String returns the string representation +func (s ImageFailure) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ImageFailure) GoString() string { + return s.String() +} + +// An object with identifying information for an Amazon ECR image. +type ImageIdentifier struct { + _ struct{} `type:"structure"` + + // The sha256 digest of the image manifest. + ImageDigest *string `locationName:"imageDigest" type:"string"` + + // The tag used for the image. + ImageTag *string `locationName:"imageTag" type:"string"` +} + +// String returns the string representation +func (s ImageIdentifier) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ImageIdentifier) GoString() string { + return s.String() +} + +type InitiateLayerUploadInput struct { + _ struct{} `type:"structure"` + + // The AWS account ID associated with the registry that you intend to upload + // layers to. If you do not specify a registry, the default registry is assumed. + RegistryId *string `locationName:"registryId" type:"string"` + + // The name of the repository that you intend to upload layers to. + RepositoryName *string `locationName:"repositoryName" min:"2" type:"string" required:"true"` +} + +// String returns the string representation +func (s InitiateLayerUploadInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s InitiateLayerUploadInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *InitiateLayerUploadInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "InitiateLayerUploadInput"} + if s.RepositoryName == nil { + invalidParams.Add(request.NewErrParamRequired("RepositoryName")) + } + if s.RepositoryName != nil && len(*s.RepositoryName) < 2 { + invalidParams.Add(request.NewErrParamMinLen("RepositoryName", 2)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +type InitiateLayerUploadOutput struct { + _ struct{} `type:"structure"` + + // The size, in bytes, that Amazon ECR expects future layer part uploads to + // be. + PartSize *int64 `locationName:"partSize" type:"long"` + + // The upload ID for the layer upload. This parameter is passed to further UploadLayerPart + // and CompleteLayerUpload operations. + UploadId *string `locationName:"uploadId" type:"string"` +} + +// String returns the string representation +func (s InitiateLayerUploadOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s InitiateLayerUploadOutput) GoString() string { + return s.String() +} + +// An object representing an Amazon ECR image layer. +type Layer struct { + _ struct{} `type:"structure"` + + // The availability status of the image layer. Valid values are AVAILABLE and + // UNAVAILABLE. + LayerAvailability *string `locationName:"layerAvailability" type:"string" enum:"LayerAvailability"` + + // The sha256 digest of the image layer. + LayerDigest *string `locationName:"layerDigest" type:"string"` + + // The size, in bytes, of the image layer. + LayerSize *int64 `locationName:"layerSize" type:"long"` +} + +// String returns the string representation +func (s Layer) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s Layer) GoString() string { + return s.String() +} + +// An object representing an Amazon ECR image layer failure. +type LayerFailure struct { + _ struct{} `type:"structure"` + + // The failure code associated with the failure. + FailureCode *string `locationName:"failureCode" type:"string" enum:"LayerFailureCode"` + + // The reason for the failure. + FailureReason *string `locationName:"failureReason" type:"string"` + + // The layer digest associated with the failure. + LayerDigest *string `locationName:"layerDigest" type:"string"` +} + +// String returns the string representation +func (s LayerFailure) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s LayerFailure) GoString() string { + return s.String() +} + +type ListImagesFilter struct { + _ struct{} `type:"structure"` + + TagStatus *string `locationName:"tagStatus" type:"string" enum:"TagStatus"` +} + +// String returns the string representation +func (s ListImagesFilter) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ListImagesFilter) GoString() string { + return s.String() +} + +type ListImagesInput struct { + _ struct{} `type:"structure"` + + Filter *ListImagesFilter `locationName:"filter" type:"structure"` + + // The maximum number of image results returned by ListImages in paginated output. + // When this parameter is used, ListImages 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 ListImages request + // with the returned nextToken value. This value can be between 1 and 100. If + // this parameter is not used, then ListImages returns up to 100 results and + // a nextToken value, if applicable. + MaxResults *int64 `locationName:"maxResults" min:"1" type:"integer"` + + // The nextToken value returned from a previous paginated ListImages 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. + // + // This token should be treated as an opaque identifier that is only used + // to retrieve the next items in a list and not for other programmatic purposes. + NextToken *string `locationName:"nextToken" type:"string"` + + // The AWS account ID associated with the registry that contains the repository + // to list images in. If you do not specify a registry, the default registry + // is assumed. + RegistryId *string `locationName:"registryId" type:"string"` + + // The repository whose image IDs are to be listed. + RepositoryName *string `locationName:"repositoryName" min:"2" type:"string" required:"true"` +} + +// String returns the string representation +func (s ListImagesInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ListImagesInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *ListImagesInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "ListImagesInput"} + if s.MaxResults != nil && *s.MaxResults < 1 { + invalidParams.Add(request.NewErrParamMinValue("MaxResults", 1)) + } + if s.RepositoryName == nil { + invalidParams.Add(request.NewErrParamRequired("RepositoryName")) + } + if s.RepositoryName != nil && len(*s.RepositoryName) < 2 { + invalidParams.Add(request.NewErrParamMinLen("RepositoryName", 2)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +type ListImagesOutput struct { + _ struct{} `type:"structure"` + + // The list of image IDs for the requested repository. + ImageIds []*ImageIdentifier `locationName:"imageIds" min:"1" type:"list"` + + // The nextToken value to include in a future ListImages request. When the results + // of a ListImages 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"` +} + +// String returns the string representation +func (s ListImagesOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ListImagesOutput) GoString() string { + return s.String() +} + +type PutImageInput struct { + _ struct{} `type:"structure"` + + // The image manifest corresponding to the image to be uploaded. + ImageManifest *string `locationName:"imageManifest" type:"string" required:"true"` + + // The AWS account ID associated with the registry that contains the repository + // in which to put the image. If you do not specify a registry, the default + // registry is assumed. + RegistryId *string `locationName:"registryId" type:"string"` + + // The name of the repository in which to put the image. + RepositoryName *string `locationName:"repositoryName" min:"2" type:"string" required:"true"` +} + +// String returns the string representation +func (s PutImageInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s PutImageInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *PutImageInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "PutImageInput"} + if s.ImageManifest == nil { + invalidParams.Add(request.NewErrParamRequired("ImageManifest")) + } + if s.RepositoryName == nil { + invalidParams.Add(request.NewErrParamRequired("RepositoryName")) + } + if s.RepositoryName != nil && len(*s.RepositoryName) < 2 { + invalidParams.Add(request.NewErrParamMinLen("RepositoryName", 2)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +type PutImageOutput struct { + _ struct{} `type:"structure"` + + // Details of the image uploaded. + Image *Image `locationName:"image" type:"structure"` +} + +// String returns the string representation +func (s PutImageOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s PutImageOutput) GoString() string { + return s.String() +} + +// An object representing a repository. +type Repository struct { + _ struct{} `type:"structure"` + + // The AWS account ID associated with the registry that contains the repository. + RegistryId *string `locationName:"registryId" type:"string"` + + // The Amazon Resource Name (ARN) that identifies the repository. The ARN contains + // the arn:aws:ecr namespace, followed by the region of the repository, the + // AWS account ID of the repository owner, the repository namespace, and then + // the repository name. For example, arn:aws:ecr:region:012345678910:repository/test. + RepositoryArn *string `locationName:"repositoryArn" type:"string"` + + // The name of the repository. + RepositoryName *string `locationName:"repositoryName" min:"2" type:"string"` + + // The URI for the repository. You can use this URI for Docker push and pull + // operations. + RepositoryUri *string `locationName:"repositoryUri" type:"string"` +} + +// String returns the string representation +func (s Repository) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s Repository) GoString() string { + return s.String() +} + +type SetRepositoryPolicyInput struct { + _ struct{} `type:"structure"` + + // If the policy you are attempting to set on a repository policy would prevent + // you from setting another policy in the future, you must force the SetRepositoryPolicy + // operation. This is intended to prevent accidental repository lock outs. + Force *bool `locationName:"force" type:"boolean"` + + // The JSON repository policy text to apply to the repository. + PolicyText *string `locationName:"policyText" type:"string" required:"true"` + + // The AWS account ID associated with the registry that contains the repository. + // If you do not specify a registry, the default registry is assumed. + RegistryId *string `locationName:"registryId" type:"string"` + + // The name of the repository to receive the policy. + RepositoryName *string `locationName:"repositoryName" min:"2" type:"string" required:"true"` +} + +// String returns the string representation +func (s SetRepositoryPolicyInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s SetRepositoryPolicyInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *SetRepositoryPolicyInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "SetRepositoryPolicyInput"} + if s.PolicyText == nil { + invalidParams.Add(request.NewErrParamRequired("PolicyText")) + } + if s.RepositoryName == nil { + invalidParams.Add(request.NewErrParamRequired("RepositoryName")) + } + if s.RepositoryName != nil && len(*s.RepositoryName) < 2 { + invalidParams.Add(request.NewErrParamMinLen("RepositoryName", 2)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +type SetRepositoryPolicyOutput struct { + _ struct{} `type:"structure"` + + // The JSON repository policy text applied to the repository. + PolicyText *string `locationName:"policyText" type:"string"` + + // The registry ID associated with the request. + RegistryId *string `locationName:"registryId" type:"string"` + + // The repository name associated with the request. + RepositoryName *string `locationName:"repositoryName" min:"2" type:"string"` +} + +// String returns the string representation +func (s SetRepositoryPolicyOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s SetRepositoryPolicyOutput) GoString() string { + return s.String() +} + +type UploadLayerPartInput struct { + _ struct{} `type:"structure"` + + // The base64-encoded layer part payload. + // + // LayerPartBlob is automatically base64 encoded/decoded by the SDK. + LayerPartBlob []byte `locationName:"layerPartBlob" type:"blob" required:"true"` + + // The integer value of the first byte of the layer part. + PartFirstByte *int64 `locationName:"partFirstByte" type:"long" required:"true"` + + // The integer value of the last byte of the layer part. + PartLastByte *int64 `locationName:"partLastByte" type:"long" required:"true"` + + // The AWS account ID associated with the registry that you are uploading layer + // parts to. If you do not specify a registry, the default registry is assumed. + RegistryId *string `locationName:"registryId" type:"string"` + + // The name of the repository that you are uploading layer parts to. + RepositoryName *string `locationName:"repositoryName" min:"2" type:"string" required:"true"` + + // The upload ID from a previous InitiateLayerUpload operation to associate + // with the layer part upload. + UploadId *string `locationName:"uploadId" type:"string" required:"true"` +} + +// String returns the string representation +func (s UploadLayerPartInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s UploadLayerPartInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *UploadLayerPartInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "UploadLayerPartInput"} + if s.LayerPartBlob == nil { + invalidParams.Add(request.NewErrParamRequired("LayerPartBlob")) + } + if s.PartFirstByte == nil { + invalidParams.Add(request.NewErrParamRequired("PartFirstByte")) + } + if s.PartLastByte == nil { + invalidParams.Add(request.NewErrParamRequired("PartLastByte")) + } + if s.RepositoryName == nil { + invalidParams.Add(request.NewErrParamRequired("RepositoryName")) + } + if s.RepositoryName != nil && len(*s.RepositoryName) < 2 { + invalidParams.Add(request.NewErrParamMinLen("RepositoryName", 2)) + } + if s.UploadId == nil { + invalidParams.Add(request.NewErrParamRequired("UploadId")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +type UploadLayerPartOutput struct { + _ struct{} `type:"structure"` + + // The integer value of the last byte received in the request. + LastByteReceived *int64 `locationName:"lastByteReceived" type:"long"` + + // The registry ID associated with the request. + RegistryId *string `locationName:"registryId" type:"string"` + + // The repository name associated with the request. + RepositoryName *string `locationName:"repositoryName" min:"2" type:"string"` + + // The upload ID associated with the request. + UploadId *string `locationName:"uploadId" type:"string"` +} + +// String returns the string representation +func (s UploadLayerPartOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s UploadLayerPartOutput) GoString() string { + return s.String() +} + +const ( + // @enum ImageFailureCode + ImageFailureCodeInvalidImageDigest = "InvalidImageDigest" + // @enum ImageFailureCode + ImageFailureCodeInvalidImageTag = "InvalidImageTag" + // @enum ImageFailureCode + ImageFailureCodeImageTagDoesNotMatchDigest = "ImageTagDoesNotMatchDigest" + // @enum ImageFailureCode + ImageFailureCodeImageNotFound = "ImageNotFound" + // @enum ImageFailureCode + ImageFailureCodeMissingDigestAndTag = "MissingDigestAndTag" +) + +const ( + // @enum LayerAvailability + LayerAvailabilityAvailable = "AVAILABLE" + // @enum LayerAvailability + LayerAvailabilityUnavailable = "UNAVAILABLE" +) + +const ( + // @enum LayerFailureCode + LayerFailureCodeInvalidLayerDigest = "InvalidLayerDigest" + // @enum LayerFailureCode + LayerFailureCodeMissingLayerDigest = "MissingLayerDigest" +) + +const ( + // @enum TagStatus + TagStatusTagged = "TAGGED" + // @enum TagStatus + TagStatusUntagged = "UNTAGGED" +) diff --git a/vendor/github.com/aws/aws-sdk-go/service/ecr/service.go b/vendor/github.com/aws/aws-sdk-go/service/ecr/service.go new file mode 100644 index 000000000..53e3c57e3 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/service/ecr/service.go @@ -0,0 +1,93 @@ +// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. + +package ecr + +import ( + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/client" + "github.com/aws/aws-sdk-go/aws/client/metadata" + "github.com/aws/aws-sdk-go/aws/request" + "github.com/aws/aws-sdk-go/aws/signer/v4" + "github.com/aws/aws-sdk-go/private/protocol/jsonrpc" +) + +// Amazon EC2 Container Registry (Amazon ECR) is a managed AWS Docker registry +// service. Customers can use the familiar Docker CLI to push, pull, and manage +// images. Amazon ECR provides a secure, scalable, and reliable registry. Amazon +// ECR supports private Docker repositories with resource-based permissions +// using AWS IAM so that specific users or Amazon EC2 instances can access repositories +// and images. Developers can use the Docker CLI to author and manage images. +//The service client's operations are safe to be used concurrently. +// It is not safe to mutate any of the client's properties though. +type ECR struct { + *client.Client +} + +// Used for custom client initialization logic +var initClient func(*client.Client) + +// Used for custom request initialization logic +var initRequest func(*request.Request) + +// A ServiceName is the name of the service the client will make API calls to. +const ServiceName = "ecr" + +// New creates a new instance of the ECR client with a session. +// If additional configuration is needed for the client instance use the optional +// aws.Config parameter to add your extra config. +// +// Example: +// // Create a ECR client from just a session. +// svc := ecr.New(mySession) +// +// // Create a ECR client with additional configuration +// svc := ecr.New(mySession, aws.NewConfig().WithRegion("us-west-2")) +func New(p client.ConfigProvider, cfgs ...*aws.Config) *ECR { + c := p.ClientConfig(ServiceName, cfgs...) + return newClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) +} + +// newClient creates, initializes and returns a new service client instance. +func newClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *ECR { + svc := &ECR{ + Client: client.New( + cfg, + metadata.ClientInfo{ + ServiceName: ServiceName, + SigningRegion: signingRegion, + Endpoint: endpoint, + APIVersion: "2015-09-21", + JSONVersion: "1.1", + TargetPrefix: "AmazonEC2ContainerRegistry_V20150921", + }, + handlers, + ), + } + + // Handlers + svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler) + svc.Handlers.Build.PushBackNamed(jsonrpc.BuildHandler) + svc.Handlers.Unmarshal.PushBackNamed(jsonrpc.UnmarshalHandler) + svc.Handlers.UnmarshalMeta.PushBackNamed(jsonrpc.UnmarshalMetaHandler) + svc.Handlers.UnmarshalError.PushBackNamed(jsonrpc.UnmarshalErrorHandler) + + // Run custom client initialization if present + if initClient != nil { + initClient(svc.Client) + } + + return svc +} + +// newRequest creates a new request for a ECR operation and runs any +// custom request initialization. +func (c *ECR) newRequest(op *request.Operation, params, data interface{}) *request.Request { + req := c.NewRequest(op, params, data) + + // Run custom request initialization if present + if initRequest != nil { + initRequest(req) + } + + return req +} diff --git a/vendor/github.com/aws/aws-sdk-go/service/s3/api.go b/vendor/github.com/aws/aws-sdk-go/service/s3/api.go index 54bebd096..553b0e4a3 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/s3/api.go +++ b/vendor/github.com/aws/aws-sdk-go/service/s3/api.go @@ -4,6 +4,7 @@ package s3 import ( + "fmt" "io" "time" @@ -15,7 +16,28 @@ import ( const opAbortMultipartUpload = "AbortMultipartUpload" -// AbortMultipartUploadRequest generates a request for the AbortMultipartUpload operation. +// AbortMultipartUploadRequest generates a "aws/request.Request" representing the +// client's request for the AbortMultipartUpload operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the AbortMultipartUpload method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the AbortMultipartUploadRequest method. +// req, resp := client.AbortMultipartUploadRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *S3) AbortMultipartUploadRequest(input *AbortMultipartUploadInput) (req *request.Request, output *AbortMultipartUploadOutput) { op := &request.Operation{ Name: opAbortMultipartUpload, @@ -46,7 +68,28 @@ func (c *S3) AbortMultipartUpload(input *AbortMultipartUploadInput) (*AbortMulti const opCompleteMultipartUpload = "CompleteMultipartUpload" -// CompleteMultipartUploadRequest generates a request for the CompleteMultipartUpload operation. +// CompleteMultipartUploadRequest generates a "aws/request.Request" representing the +// client's request for the CompleteMultipartUpload operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the CompleteMultipartUpload method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the CompleteMultipartUploadRequest method. +// req, resp := client.CompleteMultipartUploadRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *S3) CompleteMultipartUploadRequest(input *CompleteMultipartUploadInput) (req *request.Request, output *CompleteMultipartUploadOutput) { op := &request.Operation{ Name: opCompleteMultipartUpload, @@ -73,7 +116,28 @@ func (c *S3) CompleteMultipartUpload(input *CompleteMultipartUploadInput) (*Comp const opCopyObject = "CopyObject" -// CopyObjectRequest generates a request for the CopyObject operation. +// CopyObjectRequest generates a "aws/request.Request" representing the +// client's request for the CopyObject operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the CopyObject method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the CopyObjectRequest method. +// req, resp := client.CopyObjectRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *S3) CopyObjectRequest(input *CopyObjectInput) (req *request.Request, output *CopyObjectOutput) { op := &request.Operation{ Name: opCopyObject, @@ -100,7 +164,28 @@ func (c *S3) CopyObject(input *CopyObjectInput) (*CopyObjectOutput, error) { const opCreateBucket = "CreateBucket" -// CreateBucketRequest generates a request for the CreateBucket operation. +// CreateBucketRequest generates a "aws/request.Request" representing the +// client's request for the CreateBucket operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the CreateBucket method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the CreateBucketRequest method. +// req, resp := client.CreateBucketRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *S3) CreateBucketRequest(input *CreateBucketInput) (req *request.Request, output *CreateBucketOutput) { op := &request.Operation{ Name: opCreateBucket, @@ -127,7 +212,28 @@ func (c *S3) CreateBucket(input *CreateBucketInput) (*CreateBucketOutput, error) const opCreateMultipartUpload = "CreateMultipartUpload" -// CreateMultipartUploadRequest generates a request for the CreateMultipartUpload operation. +// CreateMultipartUploadRequest generates a "aws/request.Request" representing the +// client's request for the CreateMultipartUpload operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the CreateMultipartUpload method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the CreateMultipartUploadRequest method. +// req, resp := client.CreateMultipartUploadRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *S3) CreateMultipartUploadRequest(input *CreateMultipartUploadInput) (req *request.Request, output *CreateMultipartUploadOutput) { op := &request.Operation{ Name: opCreateMultipartUpload, @@ -160,7 +266,28 @@ func (c *S3) CreateMultipartUpload(input *CreateMultipartUploadInput) (*CreateMu const opDeleteBucket = "DeleteBucket" -// DeleteBucketRequest generates a request for the DeleteBucket operation. +// DeleteBucketRequest generates a "aws/request.Request" representing the +// client's request for the DeleteBucket operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the DeleteBucket method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the DeleteBucketRequest method. +// req, resp := client.DeleteBucketRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *S3) DeleteBucketRequest(input *DeleteBucketInput) (req *request.Request, output *DeleteBucketOutput) { op := &request.Operation{ Name: opDeleteBucket, @@ -190,7 +317,28 @@ func (c *S3) DeleteBucket(input *DeleteBucketInput) (*DeleteBucketOutput, error) const opDeleteBucketCors = "DeleteBucketCors" -// DeleteBucketCorsRequest generates a request for the DeleteBucketCors operation. +// DeleteBucketCorsRequest generates a "aws/request.Request" representing the +// client's request for the DeleteBucketCors operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the DeleteBucketCors method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the DeleteBucketCorsRequest method. +// req, resp := client.DeleteBucketCorsRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *S3) DeleteBucketCorsRequest(input *DeleteBucketCorsInput) (req *request.Request, output *DeleteBucketCorsOutput) { op := &request.Operation{ Name: opDeleteBucketCors, @@ -219,7 +367,28 @@ func (c *S3) DeleteBucketCors(input *DeleteBucketCorsInput) (*DeleteBucketCorsOu const opDeleteBucketLifecycle = "DeleteBucketLifecycle" -// DeleteBucketLifecycleRequest generates a request for the DeleteBucketLifecycle operation. +// DeleteBucketLifecycleRequest generates a "aws/request.Request" representing the +// client's request for the DeleteBucketLifecycle operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the DeleteBucketLifecycle method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the DeleteBucketLifecycleRequest method. +// req, resp := client.DeleteBucketLifecycleRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *S3) DeleteBucketLifecycleRequest(input *DeleteBucketLifecycleInput) (req *request.Request, output *DeleteBucketLifecycleOutput) { op := &request.Operation{ Name: opDeleteBucketLifecycle, @@ -248,7 +417,28 @@ func (c *S3) DeleteBucketLifecycle(input *DeleteBucketLifecycleInput) (*DeleteBu const opDeleteBucketPolicy = "DeleteBucketPolicy" -// DeleteBucketPolicyRequest generates a request for the DeleteBucketPolicy operation. +// DeleteBucketPolicyRequest generates a "aws/request.Request" representing the +// client's request for the DeleteBucketPolicy operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the DeleteBucketPolicy method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the DeleteBucketPolicyRequest method. +// req, resp := client.DeleteBucketPolicyRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *S3) DeleteBucketPolicyRequest(input *DeleteBucketPolicyInput) (req *request.Request, output *DeleteBucketPolicyOutput) { op := &request.Operation{ Name: opDeleteBucketPolicy, @@ -277,7 +467,28 @@ func (c *S3) DeleteBucketPolicy(input *DeleteBucketPolicyInput) (*DeleteBucketPo const opDeleteBucketReplication = "DeleteBucketReplication" -// DeleteBucketReplicationRequest generates a request for the DeleteBucketReplication operation. +// DeleteBucketReplicationRequest generates a "aws/request.Request" representing the +// client's request for the DeleteBucketReplication operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the DeleteBucketReplication method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the DeleteBucketReplicationRequest method. +// req, resp := client.DeleteBucketReplicationRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *S3) DeleteBucketReplicationRequest(input *DeleteBucketReplicationInput) (req *request.Request, output *DeleteBucketReplicationOutput) { op := &request.Operation{ Name: opDeleteBucketReplication, @@ -297,6 +508,7 @@ func (c *S3) DeleteBucketReplicationRequest(input *DeleteBucketReplicationInput) return } +// Deletes the replication configuration from the bucket. func (c *S3) DeleteBucketReplication(input *DeleteBucketReplicationInput) (*DeleteBucketReplicationOutput, error) { req, out := c.DeleteBucketReplicationRequest(input) err := req.Send() @@ -305,7 +517,28 @@ func (c *S3) DeleteBucketReplication(input *DeleteBucketReplicationInput) (*Dele const opDeleteBucketTagging = "DeleteBucketTagging" -// DeleteBucketTaggingRequest generates a request for the DeleteBucketTagging operation. +// DeleteBucketTaggingRequest generates a "aws/request.Request" representing the +// client's request for the DeleteBucketTagging operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the DeleteBucketTagging method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the DeleteBucketTaggingRequest method. +// req, resp := client.DeleteBucketTaggingRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *S3) DeleteBucketTaggingRequest(input *DeleteBucketTaggingInput) (req *request.Request, output *DeleteBucketTaggingOutput) { op := &request.Operation{ Name: opDeleteBucketTagging, @@ -334,7 +567,28 @@ func (c *S3) DeleteBucketTagging(input *DeleteBucketTaggingInput) (*DeleteBucket const opDeleteBucketWebsite = "DeleteBucketWebsite" -// DeleteBucketWebsiteRequest generates a request for the DeleteBucketWebsite operation. +// DeleteBucketWebsiteRequest generates a "aws/request.Request" representing the +// client's request for the DeleteBucketWebsite operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the DeleteBucketWebsite method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the DeleteBucketWebsiteRequest method. +// req, resp := client.DeleteBucketWebsiteRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *S3) DeleteBucketWebsiteRequest(input *DeleteBucketWebsiteInput) (req *request.Request, output *DeleteBucketWebsiteOutput) { op := &request.Operation{ Name: opDeleteBucketWebsite, @@ -363,7 +617,28 @@ func (c *S3) DeleteBucketWebsite(input *DeleteBucketWebsiteInput) (*DeleteBucket const opDeleteObject = "DeleteObject" -// DeleteObjectRequest generates a request for the DeleteObject operation. +// DeleteObjectRequest generates a "aws/request.Request" representing the +// client's request for the DeleteObject operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the DeleteObject method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the DeleteObjectRequest method. +// req, resp := client.DeleteObjectRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *S3) DeleteObjectRequest(input *DeleteObjectInput) (req *request.Request, output *DeleteObjectOutput) { op := &request.Operation{ Name: opDeleteObject, @@ -392,7 +667,28 @@ func (c *S3) DeleteObject(input *DeleteObjectInput) (*DeleteObjectOutput, error) const opDeleteObjects = "DeleteObjects" -// DeleteObjectsRequest generates a request for the DeleteObjects operation. +// DeleteObjectsRequest generates a "aws/request.Request" representing the +// client's request for the DeleteObjects operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the DeleteObjects method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the DeleteObjectsRequest method. +// req, resp := client.DeleteObjectsRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *S3) DeleteObjectsRequest(input *DeleteObjectsInput) (req *request.Request, output *DeleteObjectsOutput) { op := &request.Operation{ Name: opDeleteObjects, @@ -418,9 +714,78 @@ func (c *S3) DeleteObjects(input *DeleteObjectsInput) (*DeleteObjectsOutput, err return out, err } +const opGetBucketAccelerateConfiguration = "GetBucketAccelerateConfiguration" + +// GetBucketAccelerateConfigurationRequest generates a "aws/request.Request" representing the +// client's request for the GetBucketAccelerateConfiguration operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the GetBucketAccelerateConfiguration method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the GetBucketAccelerateConfigurationRequest method. +// req, resp := client.GetBucketAccelerateConfigurationRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +func (c *S3) GetBucketAccelerateConfigurationRequest(input *GetBucketAccelerateConfigurationInput) (req *request.Request, output *GetBucketAccelerateConfigurationOutput) { + op := &request.Operation{ + Name: opGetBucketAccelerateConfiguration, + HTTPMethod: "GET", + HTTPPath: "/{Bucket}?accelerate", + } + + if input == nil { + input = &GetBucketAccelerateConfigurationInput{} + } + + req = c.newRequest(op, input, output) + output = &GetBucketAccelerateConfigurationOutput{} + req.Data = output + return +} + +// Returns the accelerate configuration of a bucket. +func (c *S3) GetBucketAccelerateConfiguration(input *GetBucketAccelerateConfigurationInput) (*GetBucketAccelerateConfigurationOutput, error) { + req, out := c.GetBucketAccelerateConfigurationRequest(input) + err := req.Send() + return out, err +} + const opGetBucketAcl = "GetBucketAcl" -// GetBucketAclRequest generates a request for the GetBucketAcl operation. +// GetBucketAclRequest generates a "aws/request.Request" representing the +// client's request for the GetBucketAcl operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the GetBucketAcl method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the GetBucketAclRequest method. +// req, resp := client.GetBucketAclRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *S3) GetBucketAclRequest(input *GetBucketAclInput) (req *request.Request, output *GetBucketAclOutput) { op := &request.Operation{ Name: opGetBucketAcl, @@ -447,7 +812,28 @@ func (c *S3) GetBucketAcl(input *GetBucketAclInput) (*GetBucketAclOutput, error) const opGetBucketCors = "GetBucketCors" -// GetBucketCorsRequest generates a request for the GetBucketCors operation. +// GetBucketCorsRequest generates a "aws/request.Request" representing the +// client's request for the GetBucketCors operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the GetBucketCors method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the GetBucketCorsRequest method. +// req, resp := client.GetBucketCorsRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *S3) GetBucketCorsRequest(input *GetBucketCorsInput) (req *request.Request, output *GetBucketCorsOutput) { op := &request.Operation{ Name: opGetBucketCors, @@ -474,7 +860,28 @@ func (c *S3) GetBucketCors(input *GetBucketCorsInput) (*GetBucketCorsOutput, err const opGetBucketLifecycle = "GetBucketLifecycle" -// GetBucketLifecycleRequest generates a request for the GetBucketLifecycle operation. +// GetBucketLifecycleRequest generates a "aws/request.Request" representing the +// client's request for the GetBucketLifecycle operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the GetBucketLifecycle method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the GetBucketLifecycleRequest method. +// req, resp := client.GetBucketLifecycleRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *S3) GetBucketLifecycleRequest(input *GetBucketLifecycleInput) (req *request.Request, output *GetBucketLifecycleOutput) { if c.Client.Config.Logger != nil { c.Client.Config.Logger.Log("This operation, GetBucketLifecycle, has been deprecated") @@ -504,7 +911,28 @@ func (c *S3) GetBucketLifecycle(input *GetBucketLifecycleInput) (*GetBucketLifec const opGetBucketLifecycleConfiguration = "GetBucketLifecycleConfiguration" -// GetBucketLifecycleConfigurationRequest generates a request for the GetBucketLifecycleConfiguration operation. +// GetBucketLifecycleConfigurationRequest generates a "aws/request.Request" representing the +// client's request for the GetBucketLifecycleConfiguration operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the GetBucketLifecycleConfiguration method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the GetBucketLifecycleConfigurationRequest method. +// req, resp := client.GetBucketLifecycleConfigurationRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *S3) GetBucketLifecycleConfigurationRequest(input *GetBucketLifecycleConfigurationInput) (req *request.Request, output *GetBucketLifecycleConfigurationOutput) { op := &request.Operation{ Name: opGetBucketLifecycleConfiguration, @@ -531,7 +959,28 @@ func (c *S3) GetBucketLifecycleConfiguration(input *GetBucketLifecycleConfigurat const opGetBucketLocation = "GetBucketLocation" -// GetBucketLocationRequest generates a request for the GetBucketLocation operation. +// GetBucketLocationRequest generates a "aws/request.Request" representing the +// client's request for the GetBucketLocation operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the GetBucketLocation method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the GetBucketLocationRequest method. +// req, resp := client.GetBucketLocationRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *S3) GetBucketLocationRequest(input *GetBucketLocationInput) (req *request.Request, output *GetBucketLocationOutput) { op := &request.Operation{ Name: opGetBucketLocation, @@ -558,7 +1007,28 @@ func (c *S3) GetBucketLocation(input *GetBucketLocationInput) (*GetBucketLocatio const opGetBucketLogging = "GetBucketLogging" -// GetBucketLoggingRequest generates a request for the GetBucketLogging operation. +// GetBucketLoggingRequest generates a "aws/request.Request" representing the +// client's request for the GetBucketLogging operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the GetBucketLogging method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the GetBucketLoggingRequest method. +// req, resp := client.GetBucketLoggingRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *S3) GetBucketLoggingRequest(input *GetBucketLoggingInput) (req *request.Request, output *GetBucketLoggingOutput) { op := &request.Operation{ Name: opGetBucketLogging, @@ -586,7 +1056,28 @@ func (c *S3) GetBucketLogging(input *GetBucketLoggingInput) (*GetBucketLoggingOu const opGetBucketNotification = "GetBucketNotification" -// GetBucketNotificationRequest generates a request for the GetBucketNotification operation. +// GetBucketNotificationRequest generates a "aws/request.Request" representing the +// client's request for the GetBucketNotification operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the GetBucketNotification method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the GetBucketNotificationRequest method. +// req, resp := client.GetBucketNotificationRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *S3) GetBucketNotificationRequest(input *GetBucketNotificationConfigurationRequest) (req *request.Request, output *NotificationConfigurationDeprecated) { if c.Client.Config.Logger != nil { c.Client.Config.Logger.Log("This operation, GetBucketNotification, has been deprecated") @@ -616,7 +1107,28 @@ func (c *S3) GetBucketNotification(input *GetBucketNotificationConfigurationRequ const opGetBucketNotificationConfiguration = "GetBucketNotificationConfiguration" -// GetBucketNotificationConfigurationRequest generates a request for the GetBucketNotificationConfiguration operation. +// GetBucketNotificationConfigurationRequest generates a "aws/request.Request" representing the +// client's request for the GetBucketNotificationConfiguration operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the GetBucketNotificationConfiguration method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the GetBucketNotificationConfigurationRequest method. +// req, resp := client.GetBucketNotificationConfigurationRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *S3) GetBucketNotificationConfigurationRequest(input *GetBucketNotificationConfigurationRequest) (req *request.Request, output *NotificationConfiguration) { op := &request.Operation{ Name: opGetBucketNotificationConfiguration, @@ -643,7 +1155,28 @@ func (c *S3) GetBucketNotificationConfiguration(input *GetBucketNotificationConf const opGetBucketPolicy = "GetBucketPolicy" -// GetBucketPolicyRequest generates a request for the GetBucketPolicy operation. +// GetBucketPolicyRequest generates a "aws/request.Request" representing the +// client's request for the GetBucketPolicy operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the GetBucketPolicy method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the GetBucketPolicyRequest method. +// req, resp := client.GetBucketPolicyRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *S3) GetBucketPolicyRequest(input *GetBucketPolicyInput) (req *request.Request, output *GetBucketPolicyOutput) { op := &request.Operation{ Name: opGetBucketPolicy, @@ -670,7 +1203,28 @@ func (c *S3) GetBucketPolicy(input *GetBucketPolicyInput) (*GetBucketPolicyOutpu const opGetBucketReplication = "GetBucketReplication" -// GetBucketReplicationRequest generates a request for the GetBucketReplication operation. +// GetBucketReplicationRequest generates a "aws/request.Request" representing the +// client's request for the GetBucketReplication operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the GetBucketReplication method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the GetBucketReplicationRequest method. +// req, resp := client.GetBucketReplicationRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *S3) GetBucketReplicationRequest(input *GetBucketReplicationInput) (req *request.Request, output *GetBucketReplicationOutput) { op := &request.Operation{ Name: opGetBucketReplication, @@ -688,6 +1242,7 @@ func (c *S3) GetBucketReplicationRequest(input *GetBucketReplicationInput) (req return } +// Returns the replication configuration of a bucket. func (c *S3) GetBucketReplication(input *GetBucketReplicationInput) (*GetBucketReplicationOutput, error) { req, out := c.GetBucketReplicationRequest(input) err := req.Send() @@ -696,7 +1251,28 @@ func (c *S3) GetBucketReplication(input *GetBucketReplicationInput) (*GetBucketR const opGetBucketRequestPayment = "GetBucketRequestPayment" -// GetBucketRequestPaymentRequest generates a request for the GetBucketRequestPayment operation. +// GetBucketRequestPaymentRequest generates a "aws/request.Request" representing the +// client's request for the GetBucketRequestPayment operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the GetBucketRequestPayment method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the GetBucketRequestPaymentRequest method. +// req, resp := client.GetBucketRequestPaymentRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *S3) GetBucketRequestPaymentRequest(input *GetBucketRequestPaymentInput) (req *request.Request, output *GetBucketRequestPaymentOutput) { op := &request.Operation{ Name: opGetBucketRequestPayment, @@ -723,7 +1299,28 @@ func (c *S3) GetBucketRequestPayment(input *GetBucketRequestPaymentInput) (*GetB const opGetBucketTagging = "GetBucketTagging" -// GetBucketTaggingRequest generates a request for the GetBucketTagging operation. +// GetBucketTaggingRequest generates a "aws/request.Request" representing the +// client's request for the GetBucketTagging operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the GetBucketTagging method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the GetBucketTaggingRequest method. +// req, resp := client.GetBucketTaggingRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *S3) GetBucketTaggingRequest(input *GetBucketTaggingInput) (req *request.Request, output *GetBucketTaggingOutput) { op := &request.Operation{ Name: opGetBucketTagging, @@ -750,7 +1347,28 @@ func (c *S3) GetBucketTagging(input *GetBucketTaggingInput) (*GetBucketTaggingOu const opGetBucketVersioning = "GetBucketVersioning" -// GetBucketVersioningRequest generates a request for the GetBucketVersioning operation. +// GetBucketVersioningRequest generates a "aws/request.Request" representing the +// client's request for the GetBucketVersioning operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the GetBucketVersioning method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the GetBucketVersioningRequest method. +// req, resp := client.GetBucketVersioningRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *S3) GetBucketVersioningRequest(input *GetBucketVersioningInput) (req *request.Request, output *GetBucketVersioningOutput) { op := &request.Operation{ Name: opGetBucketVersioning, @@ -777,7 +1395,28 @@ func (c *S3) GetBucketVersioning(input *GetBucketVersioningInput) (*GetBucketVer const opGetBucketWebsite = "GetBucketWebsite" -// GetBucketWebsiteRequest generates a request for the GetBucketWebsite operation. +// GetBucketWebsiteRequest generates a "aws/request.Request" representing the +// client's request for the GetBucketWebsite operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the GetBucketWebsite method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the GetBucketWebsiteRequest method. +// req, resp := client.GetBucketWebsiteRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *S3) GetBucketWebsiteRequest(input *GetBucketWebsiteInput) (req *request.Request, output *GetBucketWebsiteOutput) { op := &request.Operation{ Name: opGetBucketWebsite, @@ -804,7 +1443,28 @@ func (c *S3) GetBucketWebsite(input *GetBucketWebsiteInput) (*GetBucketWebsiteOu const opGetObject = "GetObject" -// GetObjectRequest generates a request for the GetObject operation. +// GetObjectRequest generates a "aws/request.Request" representing the +// client's request for the GetObject operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the GetObject method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the GetObjectRequest method. +// req, resp := client.GetObjectRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *S3) GetObjectRequest(input *GetObjectInput) (req *request.Request, output *GetObjectOutput) { op := &request.Operation{ Name: opGetObject, @@ -831,7 +1491,28 @@ func (c *S3) GetObject(input *GetObjectInput) (*GetObjectOutput, error) { const opGetObjectAcl = "GetObjectAcl" -// GetObjectAclRequest generates a request for the GetObjectAcl operation. +// GetObjectAclRequest generates a "aws/request.Request" representing the +// client's request for the GetObjectAcl operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the GetObjectAcl method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the GetObjectAclRequest method. +// req, resp := client.GetObjectAclRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *S3) GetObjectAclRequest(input *GetObjectAclInput) (req *request.Request, output *GetObjectAclOutput) { op := &request.Operation{ Name: opGetObjectAcl, @@ -858,7 +1539,28 @@ func (c *S3) GetObjectAcl(input *GetObjectAclInput) (*GetObjectAclOutput, error) const opGetObjectTorrent = "GetObjectTorrent" -// GetObjectTorrentRequest generates a request for the GetObjectTorrent operation. +// GetObjectTorrentRequest generates a "aws/request.Request" representing the +// client's request for the GetObjectTorrent operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the GetObjectTorrent method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the GetObjectTorrentRequest method. +// req, resp := client.GetObjectTorrentRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *S3) GetObjectTorrentRequest(input *GetObjectTorrentInput) (req *request.Request, output *GetObjectTorrentOutput) { op := &request.Operation{ Name: opGetObjectTorrent, @@ -885,7 +1587,28 @@ func (c *S3) GetObjectTorrent(input *GetObjectTorrentInput) (*GetObjectTorrentOu const opHeadBucket = "HeadBucket" -// HeadBucketRequest generates a request for the HeadBucket operation. +// HeadBucketRequest generates a "aws/request.Request" representing the +// client's request for the HeadBucket operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the HeadBucket method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the HeadBucketRequest method. +// req, resp := client.HeadBucketRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *S3) HeadBucketRequest(input *HeadBucketInput) (req *request.Request, output *HeadBucketOutput) { op := &request.Operation{ Name: opHeadBucket, @@ -915,7 +1638,28 @@ func (c *S3) HeadBucket(input *HeadBucketInput) (*HeadBucketOutput, error) { const opHeadObject = "HeadObject" -// HeadObjectRequest generates a request for the HeadObject operation. +// HeadObjectRequest generates a "aws/request.Request" representing the +// client's request for the HeadObject operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the HeadObject method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the HeadObjectRequest method. +// req, resp := client.HeadObjectRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *S3) HeadObjectRequest(input *HeadObjectInput) (req *request.Request, output *HeadObjectOutput) { op := &request.Operation{ Name: opHeadObject, @@ -944,7 +1688,28 @@ func (c *S3) HeadObject(input *HeadObjectInput) (*HeadObjectOutput, error) { const opListBuckets = "ListBuckets" -// ListBucketsRequest generates a request for the ListBuckets operation. +// ListBucketsRequest generates a "aws/request.Request" representing the +// client's request for the ListBuckets operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the ListBuckets method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the ListBucketsRequest method. +// req, resp := client.ListBucketsRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *S3) ListBucketsRequest(input *ListBucketsInput) (req *request.Request, output *ListBucketsOutput) { op := &request.Operation{ Name: opListBuckets, @@ -971,7 +1736,28 @@ func (c *S3) ListBuckets(input *ListBucketsInput) (*ListBucketsOutput, error) { const opListMultipartUploads = "ListMultipartUploads" -// ListMultipartUploadsRequest generates a request for the ListMultipartUploads operation. +// ListMultipartUploadsRequest generates a "aws/request.Request" representing the +// client's request for the ListMultipartUploads operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the ListMultipartUploads method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the ListMultipartUploadsRequest method. +// req, resp := client.ListMultipartUploadsRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *S3) ListMultipartUploadsRequest(input *ListMultipartUploadsInput) (req *request.Request, output *ListMultipartUploadsOutput) { op := &request.Operation{ Name: opListMultipartUploads, @@ -1002,6 +1788,23 @@ func (c *S3) ListMultipartUploads(input *ListMultipartUploadsInput) (*ListMultip return out, err } +// ListMultipartUploadsPages iterates over the pages of a ListMultipartUploads operation, +// calling the "fn" function with the response data for each page. To stop +// iterating, return false from the fn function. +// +// See ListMultipartUploads method for more information on how to use this operation. +// +// Note: This operation can generate multiple requests to a service. +// +// // Example iterating over at most 3 pages of a ListMultipartUploads operation. +// pageNum := 0 +// err := client.ListMultipartUploadsPages(params, +// func(page *ListMultipartUploadsOutput, lastPage bool) bool { +// pageNum++ +// fmt.Println(page) +// return pageNum <= 3 +// }) +// func (c *S3) ListMultipartUploadsPages(input *ListMultipartUploadsInput, fn func(p *ListMultipartUploadsOutput, lastPage bool) (shouldContinue bool)) error { page, _ := c.ListMultipartUploadsRequest(input) page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) @@ -1012,7 +1815,28 @@ func (c *S3) ListMultipartUploadsPages(input *ListMultipartUploadsInput, fn func const opListObjectVersions = "ListObjectVersions" -// ListObjectVersionsRequest generates a request for the ListObjectVersions operation. +// ListObjectVersionsRequest generates a "aws/request.Request" representing the +// client's request for the ListObjectVersions operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the ListObjectVersions method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the ListObjectVersionsRequest method. +// req, resp := client.ListObjectVersionsRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *S3) ListObjectVersionsRequest(input *ListObjectVersionsInput) (req *request.Request, output *ListObjectVersionsOutput) { op := &request.Operation{ Name: opListObjectVersions, @@ -1043,6 +1867,23 @@ func (c *S3) ListObjectVersions(input *ListObjectVersionsInput) (*ListObjectVers return out, err } +// ListObjectVersionsPages iterates over the pages of a ListObjectVersions operation, +// calling the "fn" function with the response data for each page. To stop +// iterating, return false from the fn function. +// +// See ListObjectVersions method for more information on how to use this operation. +// +// Note: This operation can generate multiple requests to a service. +// +// // Example iterating over at most 3 pages of a ListObjectVersions operation. +// pageNum := 0 +// err := client.ListObjectVersionsPages(params, +// func(page *ListObjectVersionsOutput, lastPage bool) bool { +// pageNum++ +// fmt.Println(page) +// return pageNum <= 3 +// }) +// func (c *S3) ListObjectVersionsPages(input *ListObjectVersionsInput, fn func(p *ListObjectVersionsOutput, lastPage bool) (shouldContinue bool)) error { page, _ := c.ListObjectVersionsRequest(input) page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) @@ -1053,7 +1894,28 @@ func (c *S3) ListObjectVersionsPages(input *ListObjectVersionsInput, fn func(p * const opListObjects = "ListObjects" -// ListObjectsRequest generates a request for the ListObjects operation. +// ListObjectsRequest generates a "aws/request.Request" representing the +// client's request for the ListObjects operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the ListObjects method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the ListObjectsRequest method. +// req, resp := client.ListObjectsRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *S3) ListObjectsRequest(input *ListObjectsInput) (req *request.Request, output *ListObjectsOutput) { op := &request.Operation{ Name: opListObjects, @@ -1086,6 +1948,23 @@ func (c *S3) ListObjects(input *ListObjectsInput) (*ListObjectsOutput, error) { return out, err } +// ListObjectsPages iterates over the pages of a ListObjects operation, +// calling the "fn" function with the response data for each page. To stop +// iterating, return false from the fn function. +// +// See ListObjects method for more information on how to use this operation. +// +// Note: This operation can generate multiple requests to a service. +// +// // Example iterating over at most 3 pages of a ListObjects operation. +// pageNum := 0 +// err := client.ListObjectsPages(params, +// func(page *ListObjectsOutput, lastPage bool) bool { +// pageNum++ +// fmt.Println(page) +// return pageNum <= 3 +// }) +// func (c *S3) ListObjectsPages(input *ListObjectsInput, fn func(p *ListObjectsOutput, lastPage bool) (shouldContinue bool)) error { page, _ := c.ListObjectsRequest(input) page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) @@ -1094,9 +1973,112 @@ func (c *S3) ListObjectsPages(input *ListObjectsInput, fn func(p *ListObjectsOut }) } +const opListObjectsV2 = "ListObjectsV2" + +// ListObjectsV2Request generates a "aws/request.Request" representing the +// client's request for the ListObjectsV2 operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the ListObjectsV2 method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the ListObjectsV2Request method. +// req, resp := client.ListObjectsV2Request(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +func (c *S3) ListObjectsV2Request(input *ListObjectsV2Input) (req *request.Request, output *ListObjectsV2Output) { + op := &request.Operation{ + Name: opListObjectsV2, + HTTPMethod: "GET", + HTTPPath: "/{Bucket}?list-type=2", + Paginator: &request.Paginator{ + InputTokens: []string{"ContinuationToken"}, + OutputTokens: []string{"NextContinuationToken"}, + LimitToken: "MaxKeys", + TruncationToken: "", + }, + } + + if input == nil { + input = &ListObjectsV2Input{} + } + + req = c.newRequest(op, input, output) + output = &ListObjectsV2Output{} + req.Data = output + return +} + +// Returns some or all (up to 1000) of the objects in a bucket. You can use +// the request parameters as selection criteria to return a subset of the objects +// in a bucket. Note: ListObjectsV2 is the revised List Objects API and we recommend +// you use this revised API for new application development. +func (c *S3) ListObjectsV2(input *ListObjectsV2Input) (*ListObjectsV2Output, error) { + req, out := c.ListObjectsV2Request(input) + err := req.Send() + return out, err +} + +// ListObjectsV2Pages iterates over the pages of a ListObjectsV2 operation, +// calling the "fn" function with the response data for each page. To stop +// iterating, return false from the fn function. +// +// See ListObjectsV2 method for more information on how to use this operation. +// +// Note: This operation can generate multiple requests to a service. +// +// // Example iterating over at most 3 pages of a ListObjectsV2 operation. +// pageNum := 0 +// err := client.ListObjectsV2Pages(params, +// func(page *ListObjectsV2Output, lastPage bool) bool { +// pageNum++ +// fmt.Println(page) +// return pageNum <= 3 +// }) +// +func (c *S3) ListObjectsV2Pages(input *ListObjectsV2Input, fn func(p *ListObjectsV2Output, lastPage bool) (shouldContinue bool)) error { + page, _ := c.ListObjectsV2Request(input) + page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) + return page.EachPage(func(p interface{}, lastPage bool) bool { + return fn(p.(*ListObjectsV2Output), lastPage) + }) +} + const opListParts = "ListParts" -// ListPartsRequest generates a request for the ListParts operation. +// ListPartsRequest generates a "aws/request.Request" representing the +// client's request for the ListParts operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the ListParts method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the ListPartsRequest method. +// req, resp := client.ListPartsRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *S3) ListPartsRequest(input *ListPartsInput) (req *request.Request, output *ListPartsOutput) { op := &request.Operation{ Name: opListParts, @@ -1127,6 +2109,23 @@ func (c *S3) ListParts(input *ListPartsInput) (*ListPartsOutput, error) { return out, err } +// ListPartsPages iterates over the pages of a ListParts operation, +// calling the "fn" function with the response data for each page. To stop +// iterating, return false from the fn function. +// +// See ListParts method for more information on how to use this operation. +// +// Note: This operation can generate multiple requests to a service. +// +// // Example iterating over at most 3 pages of a ListParts operation. +// pageNum := 0 +// err := client.ListPartsPages(params, +// func(page *ListPartsOutput, lastPage bool) bool { +// pageNum++ +// fmt.Println(page) +// return pageNum <= 3 +// }) +// func (c *S3) ListPartsPages(input *ListPartsInput, fn func(p *ListPartsOutput, lastPage bool) (shouldContinue bool)) error { page, _ := c.ListPartsRequest(input) page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) @@ -1135,9 +2134,80 @@ func (c *S3) ListPartsPages(input *ListPartsInput, fn func(p *ListPartsOutput, l }) } +const opPutBucketAccelerateConfiguration = "PutBucketAccelerateConfiguration" + +// PutBucketAccelerateConfigurationRequest generates a "aws/request.Request" representing the +// client's request for the PutBucketAccelerateConfiguration operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the PutBucketAccelerateConfiguration method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the PutBucketAccelerateConfigurationRequest method. +// req, resp := client.PutBucketAccelerateConfigurationRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +func (c *S3) PutBucketAccelerateConfigurationRequest(input *PutBucketAccelerateConfigurationInput) (req *request.Request, output *PutBucketAccelerateConfigurationOutput) { + op := &request.Operation{ + Name: opPutBucketAccelerateConfiguration, + HTTPMethod: "PUT", + HTTPPath: "/{Bucket}?accelerate", + } + + if input == nil { + input = &PutBucketAccelerateConfigurationInput{} + } + + req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(restxml.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) + output = &PutBucketAccelerateConfigurationOutput{} + req.Data = output + return +} + +// Sets the accelerate configuration of an existing bucket. +func (c *S3) PutBucketAccelerateConfiguration(input *PutBucketAccelerateConfigurationInput) (*PutBucketAccelerateConfigurationOutput, error) { + req, out := c.PutBucketAccelerateConfigurationRequest(input) + err := req.Send() + return out, err +} + const opPutBucketAcl = "PutBucketAcl" -// PutBucketAclRequest generates a request for the PutBucketAcl operation. +// PutBucketAclRequest generates a "aws/request.Request" representing the +// client's request for the PutBucketAcl operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the PutBucketAcl method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the PutBucketAclRequest method. +// req, resp := client.PutBucketAclRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *S3) PutBucketAclRequest(input *PutBucketAclInput) (req *request.Request, output *PutBucketAclOutput) { op := &request.Operation{ Name: opPutBucketAcl, @@ -1166,7 +2236,28 @@ func (c *S3) PutBucketAcl(input *PutBucketAclInput) (*PutBucketAclOutput, error) const opPutBucketCors = "PutBucketCors" -// PutBucketCorsRequest generates a request for the PutBucketCors operation. +// PutBucketCorsRequest generates a "aws/request.Request" representing the +// client's request for the PutBucketCors operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the PutBucketCors method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the PutBucketCorsRequest method. +// req, resp := client.PutBucketCorsRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *S3) PutBucketCorsRequest(input *PutBucketCorsInput) (req *request.Request, output *PutBucketCorsOutput) { op := &request.Operation{ Name: opPutBucketCors, @@ -1195,7 +2286,28 @@ func (c *S3) PutBucketCors(input *PutBucketCorsInput) (*PutBucketCorsOutput, err const opPutBucketLifecycle = "PutBucketLifecycle" -// PutBucketLifecycleRequest generates a request for the PutBucketLifecycle operation. +// PutBucketLifecycleRequest generates a "aws/request.Request" representing the +// client's request for the PutBucketLifecycle operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the PutBucketLifecycle method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the PutBucketLifecycleRequest method. +// req, resp := client.PutBucketLifecycleRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *S3) PutBucketLifecycleRequest(input *PutBucketLifecycleInput) (req *request.Request, output *PutBucketLifecycleOutput) { if c.Client.Config.Logger != nil { c.Client.Config.Logger.Log("This operation, PutBucketLifecycle, has been deprecated") @@ -1227,7 +2339,28 @@ func (c *S3) PutBucketLifecycle(input *PutBucketLifecycleInput) (*PutBucketLifec const opPutBucketLifecycleConfiguration = "PutBucketLifecycleConfiguration" -// PutBucketLifecycleConfigurationRequest generates a request for the PutBucketLifecycleConfiguration operation. +// PutBucketLifecycleConfigurationRequest generates a "aws/request.Request" representing the +// client's request for the PutBucketLifecycleConfiguration operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the PutBucketLifecycleConfiguration method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the PutBucketLifecycleConfigurationRequest method. +// req, resp := client.PutBucketLifecycleConfigurationRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *S3) PutBucketLifecycleConfigurationRequest(input *PutBucketLifecycleConfigurationInput) (req *request.Request, output *PutBucketLifecycleConfigurationOutput) { op := &request.Operation{ Name: opPutBucketLifecycleConfiguration, @@ -1257,7 +2390,28 @@ func (c *S3) PutBucketLifecycleConfiguration(input *PutBucketLifecycleConfigurat const opPutBucketLogging = "PutBucketLogging" -// PutBucketLoggingRequest generates a request for the PutBucketLogging operation. +// PutBucketLoggingRequest generates a "aws/request.Request" representing the +// client's request for the PutBucketLogging operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the PutBucketLogging method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the PutBucketLoggingRequest method. +// req, resp := client.PutBucketLoggingRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *S3) PutBucketLoggingRequest(input *PutBucketLoggingInput) (req *request.Request, output *PutBucketLoggingOutput) { op := &request.Operation{ Name: opPutBucketLogging, @@ -1288,7 +2442,28 @@ func (c *S3) PutBucketLogging(input *PutBucketLoggingInput) (*PutBucketLoggingOu const opPutBucketNotification = "PutBucketNotification" -// PutBucketNotificationRequest generates a request for the PutBucketNotification operation. +// PutBucketNotificationRequest generates a "aws/request.Request" representing the +// client's request for the PutBucketNotification operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the PutBucketNotification method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the PutBucketNotificationRequest method. +// req, resp := client.PutBucketNotificationRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *S3) PutBucketNotificationRequest(input *PutBucketNotificationInput) (req *request.Request, output *PutBucketNotificationOutput) { if c.Client.Config.Logger != nil { c.Client.Config.Logger.Log("This operation, PutBucketNotification, has been deprecated") @@ -1320,7 +2495,28 @@ func (c *S3) PutBucketNotification(input *PutBucketNotificationInput) (*PutBucke const opPutBucketNotificationConfiguration = "PutBucketNotificationConfiguration" -// PutBucketNotificationConfigurationRequest generates a request for the PutBucketNotificationConfiguration operation. +// PutBucketNotificationConfigurationRequest generates a "aws/request.Request" representing the +// client's request for the PutBucketNotificationConfiguration operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the PutBucketNotificationConfiguration method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the PutBucketNotificationConfigurationRequest method. +// req, resp := client.PutBucketNotificationConfigurationRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *S3) PutBucketNotificationConfigurationRequest(input *PutBucketNotificationConfigurationInput) (req *request.Request, output *PutBucketNotificationConfigurationOutput) { op := &request.Operation{ Name: opPutBucketNotificationConfiguration, @@ -1349,7 +2545,28 @@ func (c *S3) PutBucketNotificationConfiguration(input *PutBucketNotificationConf const opPutBucketPolicy = "PutBucketPolicy" -// PutBucketPolicyRequest generates a request for the PutBucketPolicy operation. +// PutBucketPolicyRequest generates a "aws/request.Request" representing the +// client's request for the PutBucketPolicy operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the PutBucketPolicy method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the PutBucketPolicyRequest method. +// req, resp := client.PutBucketPolicyRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *S3) PutBucketPolicyRequest(input *PutBucketPolicyInput) (req *request.Request, output *PutBucketPolicyOutput) { op := &request.Operation{ Name: opPutBucketPolicy, @@ -1379,7 +2596,28 @@ func (c *S3) PutBucketPolicy(input *PutBucketPolicyInput) (*PutBucketPolicyOutpu const opPutBucketReplication = "PutBucketReplication" -// PutBucketReplicationRequest generates a request for the PutBucketReplication operation. +// PutBucketReplicationRequest generates a "aws/request.Request" representing the +// client's request for the PutBucketReplication operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the PutBucketReplication method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the PutBucketReplicationRequest method. +// req, resp := client.PutBucketReplicationRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *S3) PutBucketReplicationRequest(input *PutBucketReplicationInput) (req *request.Request, output *PutBucketReplicationOutput) { op := &request.Operation{ Name: opPutBucketReplication, @@ -1409,7 +2647,28 @@ func (c *S3) PutBucketReplication(input *PutBucketReplicationInput) (*PutBucketR const opPutBucketRequestPayment = "PutBucketRequestPayment" -// PutBucketRequestPaymentRequest generates a request for the PutBucketRequestPayment operation. +// PutBucketRequestPaymentRequest generates a "aws/request.Request" representing the +// client's request for the PutBucketRequestPayment operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the PutBucketRequestPayment method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the PutBucketRequestPaymentRequest method. +// req, resp := client.PutBucketRequestPaymentRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *S3) PutBucketRequestPaymentRequest(input *PutBucketRequestPaymentInput) (req *request.Request, output *PutBucketRequestPaymentOutput) { op := &request.Operation{ Name: opPutBucketRequestPayment, @@ -1442,7 +2701,28 @@ func (c *S3) PutBucketRequestPayment(input *PutBucketRequestPaymentInput) (*PutB const opPutBucketTagging = "PutBucketTagging" -// PutBucketTaggingRequest generates a request for the PutBucketTagging operation. +// PutBucketTaggingRequest generates a "aws/request.Request" representing the +// client's request for the PutBucketTagging operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the PutBucketTagging method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the PutBucketTaggingRequest method. +// req, resp := client.PutBucketTaggingRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *S3) PutBucketTaggingRequest(input *PutBucketTaggingInput) (req *request.Request, output *PutBucketTaggingOutput) { op := &request.Operation{ Name: opPutBucketTagging, @@ -1471,7 +2751,28 @@ func (c *S3) PutBucketTagging(input *PutBucketTaggingInput) (*PutBucketTaggingOu const opPutBucketVersioning = "PutBucketVersioning" -// PutBucketVersioningRequest generates a request for the PutBucketVersioning operation. +// PutBucketVersioningRequest generates a "aws/request.Request" representing the +// client's request for the PutBucketVersioning operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the PutBucketVersioning method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the PutBucketVersioningRequest method. +// req, resp := client.PutBucketVersioningRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *S3) PutBucketVersioningRequest(input *PutBucketVersioningInput) (req *request.Request, output *PutBucketVersioningOutput) { op := &request.Operation{ Name: opPutBucketVersioning, @@ -1501,7 +2802,28 @@ func (c *S3) PutBucketVersioning(input *PutBucketVersioningInput) (*PutBucketVer const opPutBucketWebsite = "PutBucketWebsite" -// PutBucketWebsiteRequest generates a request for the PutBucketWebsite operation. +// PutBucketWebsiteRequest generates a "aws/request.Request" representing the +// client's request for the PutBucketWebsite operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the PutBucketWebsite method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the PutBucketWebsiteRequest method. +// req, resp := client.PutBucketWebsiteRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *S3) PutBucketWebsiteRequest(input *PutBucketWebsiteInput) (req *request.Request, output *PutBucketWebsiteOutput) { op := &request.Operation{ Name: opPutBucketWebsite, @@ -1530,7 +2852,28 @@ func (c *S3) PutBucketWebsite(input *PutBucketWebsiteInput) (*PutBucketWebsiteOu const opPutObject = "PutObject" -// PutObjectRequest generates a request for the PutObject operation. +// PutObjectRequest generates a "aws/request.Request" representing the +// client's request for the PutObject operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the PutObject method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the PutObjectRequest method. +// req, resp := client.PutObjectRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *S3) PutObjectRequest(input *PutObjectInput) (req *request.Request, output *PutObjectOutput) { op := &request.Operation{ Name: opPutObject, @@ -1557,7 +2900,28 @@ func (c *S3) PutObject(input *PutObjectInput) (*PutObjectOutput, error) { const opPutObjectAcl = "PutObjectAcl" -// PutObjectAclRequest generates a request for the PutObjectAcl operation. +// PutObjectAclRequest generates a "aws/request.Request" representing the +// client's request for the PutObjectAcl operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the PutObjectAcl method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the PutObjectAclRequest method. +// req, resp := client.PutObjectAclRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *S3) PutObjectAclRequest(input *PutObjectAclInput) (req *request.Request, output *PutObjectAclOutput) { op := &request.Operation{ Name: opPutObjectAcl, @@ -1585,7 +2949,28 @@ func (c *S3) PutObjectAcl(input *PutObjectAclInput) (*PutObjectAclOutput, error) const opRestoreObject = "RestoreObject" -// RestoreObjectRequest generates a request for the RestoreObject operation. +// RestoreObjectRequest generates a "aws/request.Request" representing the +// client's request for the RestoreObject operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the RestoreObject method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the RestoreObjectRequest method. +// req, resp := client.RestoreObjectRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *S3) RestoreObjectRequest(input *RestoreObjectInput) (req *request.Request, output *RestoreObjectOutput) { op := &request.Operation{ Name: opRestoreObject, @@ -1612,7 +2997,28 @@ func (c *S3) RestoreObject(input *RestoreObjectInput) (*RestoreObjectOutput, err const opUploadPart = "UploadPart" -// UploadPartRequest generates a request for the UploadPart operation. +// UploadPartRequest generates a "aws/request.Request" representing the +// client's request for the UploadPart operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the UploadPart method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the UploadPartRequest method. +// req, resp := client.UploadPartRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *S3) UploadPartRequest(input *UploadPartInput) (req *request.Request, output *UploadPartOutput) { op := &request.Operation{ Name: opUploadPart, @@ -1645,7 +3051,28 @@ func (c *S3) UploadPart(input *UploadPartInput) (*UploadPartOutput, error) { const opUploadPartCopy = "UploadPartCopy" -// UploadPartCopyRequest generates a request for the UploadPartCopy operation. +// UploadPartCopyRequest generates a "aws/request.Request" representing the +// client's request for the UploadPartCopy operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the UploadPartCopy method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the UploadPartCopyRequest method. +// req, resp := client.UploadPartCopyRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *S3) UploadPartCopyRequest(input *UploadPartCopyInput) (req *request.Request, output *UploadPartCopyOutput) { op := &request.Operation{ Name: opUploadPartCopy, @@ -1670,6 +3097,26 @@ func (c *S3) UploadPartCopy(input *UploadPartCopyInput) (*UploadPartCopyOutput, return out, err } +// Specifies the days since the initiation of an Incomplete Multipart Upload +// that Lifecycle will wait before permanently removing all parts of the upload. +type AbortIncompleteMultipartUpload struct { + _ struct{} `type:"structure"` + + // Indicates the number of days that must pass since initiation for Lifecycle + // to abort an Incomplete Multipart Upload. + DaysAfterInitiation *int64 `type:"integer"` +} + +// String returns the string representation +func (s AbortIncompleteMultipartUpload) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s AbortIncompleteMultipartUpload) GoString() string { + return s.String() +} + type AbortMultipartUploadInput struct { _ struct{} `type:"structure"` @@ -1696,6 +3143,28 @@ func (s AbortMultipartUploadInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *AbortMultipartUploadInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "AbortMultipartUploadInput"} + if s.Bucket == nil { + invalidParams.Add(request.NewErrParamRequired("Bucket")) + } + if s.Key == nil { + invalidParams.Add(request.NewErrParamRequired("Key")) + } + if s.Key != nil && len(*s.Key) < 1 { + invalidParams.Add(request.NewErrParamMinLen("Key", 1)) + } + if s.UploadId == nil { + invalidParams.Add(request.NewErrParamRequired("UploadId")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + type AbortMultipartUploadOutput struct { _ struct{} `type:"structure"` @@ -1714,6 +3183,23 @@ func (s AbortMultipartUploadOutput) GoString() string { return s.String() } +type AccelerateConfiguration struct { + _ struct{} `type:"structure"` + + // The accelerate configuration of the bucket. + Status *string `type:"string" enum:"BucketAccelerateStatus"` +} + +// String returns the string representation +func (s AccelerateConfiguration) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s AccelerateConfiguration) GoString() string { + return s.String() +} + type AccessControlPolicy struct { _ struct{} `type:"structure"` @@ -1733,6 +3219,26 @@ func (s AccessControlPolicy) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *AccessControlPolicy) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "AccessControlPolicy"} + if s.Grants != nil { + for i, v := range s.Grants { + if v == nil { + continue + } + if err := v.Validate(); err != nil { + invalidParams.AddNested(fmt.Sprintf("%s[%v]", "Grants", i), err.(request.ErrInvalidParams)) + } + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + type Bucket struct { _ struct{} `type:"structure"` @@ -1769,6 +3275,29 @@ func (s BucketLifecycleConfiguration) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *BucketLifecycleConfiguration) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "BucketLifecycleConfiguration"} + if s.Rules == nil { + invalidParams.Add(request.NewErrParamRequired("Rules")) + } + if s.Rules != nil { + for i, v := range s.Rules { + if v == nil { + continue + } + if err := v.Validate(); err != nil { + invalidParams.AddNested(fmt.Sprintf("%s[%v]", "Rules", i), err.(request.ErrInvalidParams)) + } + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + type BucketLoggingStatus struct { _ struct{} `type:"structure"` @@ -1785,6 +3314,21 @@ func (s BucketLoggingStatus) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *BucketLoggingStatus) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "BucketLoggingStatus"} + if s.LoggingEnabled != nil { + if err := s.LoggingEnabled.Validate(); err != nil { + invalidParams.AddNested("LoggingEnabled", err.(request.ErrInvalidParams)) + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + type CORSConfiguration struct { _ struct{} `type:"structure"` @@ -1801,6 +3345,29 @@ func (s CORSConfiguration) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *CORSConfiguration) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "CORSConfiguration"} + if s.CORSRules == nil { + invalidParams.Add(request.NewErrParamRequired("CORSRules")) + } + if s.CORSRules != nil { + for i, v := range s.CORSRules { + if v == nil { + continue + } + if err := v.Validate(); err != nil { + invalidParams.AddNested(fmt.Sprintf("%s[%v]", "CORSRules", i), err.(request.ErrInvalidParams)) + } + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + type CORSRule struct { _ struct{} `type:"structure"` @@ -1834,6 +3401,22 @@ func (s CORSRule) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *CORSRule) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "CORSRule"} + if s.AllowedMethods == nil { + invalidParams.Add(request.NewErrParamRequired("AllowedMethods")) + } + if s.AllowedOrigins == nil { + invalidParams.Add(request.NewErrParamRequired("AllowedOrigins")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + type CloudFunctionConfiguration struct { _ struct{} `type:"structure"` @@ -1905,6 +3488,28 @@ func (s CompleteMultipartUploadInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *CompleteMultipartUploadInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "CompleteMultipartUploadInput"} + if s.Bucket == nil { + invalidParams.Add(request.NewErrParamRequired("Bucket")) + } + if s.Key == nil { + invalidParams.Add(request.NewErrParamRequired("Key")) + } + if s.Key != nil && len(*s.Key) < 1 { + invalidParams.Add(request.NewErrParamMinLen("Key", 1)) + } + if s.UploadId == nil { + invalidParams.Add(request.NewErrParamRequired("UploadId")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + type CompleteMultipartUploadOutput struct { _ struct{} `type:"structure"` @@ -2143,6 +3748,28 @@ func (s CopyObjectInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *CopyObjectInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "CopyObjectInput"} + if s.Bucket == nil { + invalidParams.Add(request.NewErrParamRequired("Bucket")) + } + if s.CopySource == nil { + invalidParams.Add(request.NewErrParamRequired("CopySource")) + } + if s.Key == nil { + invalidParams.Add(request.NewErrParamRequired("Key")) + } + if s.Key != nil && len(*s.Key) < 1 { + invalidParams.Add(request.NewErrParamMinLen("Key", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + type CopyObjectOutput struct { _ struct{} `type:"structure" payload:"CopyObjectResult"` @@ -2282,6 +3909,19 @@ func (s CreateBucketInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *CreateBucketInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "CreateBucketInput"} + if s.Bucket == nil { + invalidParams.Add(request.NewErrParamRequired("Bucket")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + type CreateBucketOutput struct { _ struct{} `type:"structure"` @@ -2393,9 +4033,35 @@ func (s CreateMultipartUploadInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *CreateMultipartUploadInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "CreateMultipartUploadInput"} + if s.Bucket == nil { + invalidParams.Add(request.NewErrParamRequired("Bucket")) + } + if s.Key == nil { + invalidParams.Add(request.NewErrParamRequired("Key")) + } + if s.Key != nil && len(*s.Key) < 1 { + invalidParams.Add(request.NewErrParamMinLen("Key", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + type CreateMultipartUploadOutput struct { _ struct{} `type:"structure"` + // Date when multipart upload will become eligible for abort operation by lifecycle. + AbortDate *time.Time `location:"header" locationName:"x-amz-abort-date" type:"timestamp" timestampFormat:"rfc822"` + + // Id of the lifecycle rule that makes a multipart upload eligible for abort + // operation. + AbortRuleId *string `location:"header" locationName:"x-amz-abort-rule-id" type:"string"` + // Name of the bucket to which the multipart upload was initiated. Bucket *string `locationName:"Bucket" type:"string"` @@ -2458,6 +4124,29 @@ func (s Delete) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *Delete) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "Delete"} + if s.Objects == nil { + invalidParams.Add(request.NewErrParamRequired("Objects")) + } + if s.Objects != nil { + for i, v := range s.Objects { + if v == nil { + continue + } + if err := v.Validate(); err != nil { + invalidParams.AddNested(fmt.Sprintf("%s[%v]", "Objects", i), err.(request.ErrInvalidParams)) + } + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + type DeleteBucketCorsInput struct { _ struct{} `type:"structure"` @@ -2474,6 +4163,19 @@ func (s DeleteBucketCorsInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *DeleteBucketCorsInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DeleteBucketCorsInput"} + if s.Bucket == nil { + invalidParams.Add(request.NewErrParamRequired("Bucket")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + type DeleteBucketCorsOutput struct { _ struct{} `type:"structure"` } @@ -2504,6 +4206,19 @@ func (s DeleteBucketInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *DeleteBucketInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DeleteBucketInput"} + if s.Bucket == nil { + invalidParams.Add(request.NewErrParamRequired("Bucket")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + type DeleteBucketLifecycleInput struct { _ struct{} `type:"structure"` @@ -2520,6 +4235,19 @@ func (s DeleteBucketLifecycleInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *DeleteBucketLifecycleInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DeleteBucketLifecycleInput"} + if s.Bucket == nil { + invalidParams.Add(request.NewErrParamRequired("Bucket")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + type DeleteBucketLifecycleOutput struct { _ struct{} `type:"structure"` } @@ -2564,6 +4292,19 @@ func (s DeleteBucketPolicyInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *DeleteBucketPolicyInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DeleteBucketPolicyInput"} + if s.Bucket == nil { + invalidParams.Add(request.NewErrParamRequired("Bucket")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + type DeleteBucketPolicyOutput struct { _ struct{} `type:"structure"` } @@ -2594,6 +4335,19 @@ func (s DeleteBucketReplicationInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *DeleteBucketReplicationInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DeleteBucketReplicationInput"} + if s.Bucket == nil { + invalidParams.Add(request.NewErrParamRequired("Bucket")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + type DeleteBucketReplicationOutput struct { _ struct{} `type:"structure"` } @@ -2624,6 +4378,19 @@ func (s DeleteBucketTaggingInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *DeleteBucketTaggingInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DeleteBucketTaggingInput"} + if s.Bucket == nil { + invalidParams.Add(request.NewErrParamRequired("Bucket")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + type DeleteBucketTaggingOutput struct { _ struct{} `type:"structure"` } @@ -2654,6 +4421,19 @@ func (s DeleteBucketWebsiteInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *DeleteBucketWebsiteInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DeleteBucketWebsiteInput"} + if s.Bucket == nil { + invalidParams.Add(request.NewErrParamRequired("Bucket")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + type DeleteBucketWebsiteOutput struct { _ struct{} `type:"structure"` } @@ -2728,6 +4508,25 @@ func (s DeleteObjectInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *DeleteObjectInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DeleteObjectInput"} + if s.Bucket == nil { + invalidParams.Add(request.NewErrParamRequired("Bucket")) + } + if s.Key == nil { + invalidParams.Add(request.NewErrParamRequired("Key")) + } + if s.Key != nil && len(*s.Key) < 1 { + invalidParams.Add(request.NewErrParamMinLen("Key", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + type DeleteObjectOutput struct { _ struct{} `type:"structure"` @@ -2782,6 +4581,27 @@ func (s DeleteObjectsInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *DeleteObjectsInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DeleteObjectsInput"} + if s.Bucket == nil { + invalidParams.Add(request.NewErrParamRequired("Bucket")) + } + if s.Delete == nil { + invalidParams.Add(request.NewErrParamRequired("Delete")) + } + if s.Delete != nil { + if err := s.Delete.Validate(); err != nil { + invalidParams.AddNested("Delete", err.(request.ErrInvalidParams)) + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + type DeleteObjectsOutput struct { _ struct{} `type:"structure"` @@ -2847,6 +4667,19 @@ func (s Destination) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *Destination) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "Destination"} + if s.Bucket == nil { + invalidParams.Add(request.NewErrParamRequired("Bucket")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + type Error struct { _ struct{} `type:"structure"` @@ -2886,6 +4719,22 @@ func (s ErrorDocument) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *ErrorDocument) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "ErrorDocument"} + if s.Key == nil { + invalidParams.Add(request.NewErrParamRequired("Key")) + } + if s.Key != nil && len(*s.Key) < 1 { + invalidParams.Add(request.NewErrParamMinLen("Key", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + // Container for key value pair that defines the criteria for the filter rule. type FilterRule struct { _ struct{} `type:"structure"` @@ -2910,6 +4759,53 @@ func (s FilterRule) GoString() string { return s.String() } +type GetBucketAccelerateConfigurationInput struct { + _ struct{} `type:"structure"` + + // Name of the bucket for which the accelerate configuration is retrieved. + Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` +} + +// String returns the string representation +func (s GetBucketAccelerateConfigurationInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s GetBucketAccelerateConfigurationInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *GetBucketAccelerateConfigurationInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "GetBucketAccelerateConfigurationInput"} + if s.Bucket == nil { + invalidParams.Add(request.NewErrParamRequired("Bucket")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +type GetBucketAccelerateConfigurationOutput struct { + _ struct{} `type:"structure"` + + // The accelerate configuration of the bucket. + Status *string `type:"string" enum:"BucketAccelerateStatus"` +} + +// String returns the string representation +func (s GetBucketAccelerateConfigurationOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s GetBucketAccelerateConfigurationOutput) GoString() string { + return s.String() +} + type GetBucketAclInput struct { _ struct{} `type:"structure"` @@ -2926,6 +4822,19 @@ func (s GetBucketAclInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *GetBucketAclInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "GetBucketAclInput"} + if s.Bucket == nil { + invalidParams.Add(request.NewErrParamRequired("Bucket")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + type GetBucketAclOutput struct { _ struct{} `type:"structure"` @@ -2961,6 +4870,19 @@ func (s GetBucketCorsInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *GetBucketCorsInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "GetBucketCorsInput"} + if s.Bucket == nil { + invalidParams.Add(request.NewErrParamRequired("Bucket")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + type GetBucketCorsOutput struct { _ struct{} `type:"structure"` @@ -2993,6 +4915,19 @@ func (s GetBucketLifecycleConfigurationInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *GetBucketLifecycleConfigurationInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "GetBucketLifecycleConfigurationInput"} + if s.Bucket == nil { + invalidParams.Add(request.NewErrParamRequired("Bucket")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + type GetBucketLifecycleConfigurationOutput struct { _ struct{} `type:"structure"` @@ -3025,6 +4960,19 @@ func (s GetBucketLifecycleInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *GetBucketLifecycleInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "GetBucketLifecycleInput"} + if s.Bucket == nil { + invalidParams.Add(request.NewErrParamRequired("Bucket")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + type GetBucketLifecycleOutput struct { _ struct{} `type:"structure"` @@ -3057,6 +5005,19 @@ func (s GetBucketLocationInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *GetBucketLocationInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "GetBucketLocationInput"} + if s.Bucket == nil { + invalidParams.Add(request.NewErrParamRequired("Bucket")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + type GetBucketLocationOutput struct { _ struct{} `type:"structure"` @@ -3089,6 +5050,19 @@ func (s GetBucketLoggingInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *GetBucketLoggingInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "GetBucketLoggingInput"} + if s.Bucket == nil { + invalidParams.Add(request.NewErrParamRequired("Bucket")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + type GetBucketLoggingOutput struct { _ struct{} `type:"structure"` @@ -3108,7 +5082,7 @@ func (s GetBucketLoggingOutput) GoString() string { type GetBucketNotificationConfigurationRequest struct { _ struct{} `type:"structure"` - // Name of the buket to get the notification configuration for. + // Name of the bucket to get the notification configuration for. Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` } @@ -3122,6 +5096,19 @@ func (s GetBucketNotificationConfigurationRequest) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *GetBucketNotificationConfigurationRequest) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "GetBucketNotificationConfigurationRequest"} + if s.Bucket == nil { + invalidParams.Add(request.NewErrParamRequired("Bucket")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + type GetBucketPolicyInput struct { _ struct{} `type:"structure"` @@ -3138,6 +5125,19 @@ func (s GetBucketPolicyInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *GetBucketPolicyInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "GetBucketPolicyInput"} + if s.Bucket == nil { + invalidParams.Add(request.NewErrParamRequired("Bucket")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + type GetBucketPolicyOutput struct { _ struct{} `type:"structure" payload:"Policy"` @@ -3171,6 +5171,19 @@ func (s GetBucketReplicationInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *GetBucketReplicationInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "GetBucketReplicationInput"} + if s.Bucket == nil { + invalidParams.Add(request.NewErrParamRequired("Bucket")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + type GetBucketReplicationOutput struct { _ struct{} `type:"structure" payload:"ReplicationConfiguration"` @@ -3205,6 +5218,19 @@ func (s GetBucketRequestPaymentInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *GetBucketRequestPaymentInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "GetBucketRequestPaymentInput"} + if s.Bucket == nil { + invalidParams.Add(request.NewErrParamRequired("Bucket")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + type GetBucketRequestPaymentOutput struct { _ struct{} `type:"structure"` @@ -3238,6 +5264,19 @@ func (s GetBucketTaggingInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *GetBucketTaggingInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "GetBucketTaggingInput"} + if s.Bucket == nil { + invalidParams.Add(request.NewErrParamRequired("Bucket")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + type GetBucketTaggingOutput struct { _ struct{} `type:"structure"` @@ -3270,6 +5309,19 @@ func (s GetBucketVersioningInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *GetBucketVersioningInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "GetBucketVersioningInput"} + if s.Bucket == nil { + invalidParams.Add(request.NewErrParamRequired("Bucket")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + type GetBucketVersioningOutput struct { _ struct{} `type:"structure"` @@ -3308,6 +5360,19 @@ func (s GetBucketWebsiteInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *GetBucketWebsiteInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "GetBucketWebsiteInput"} + if s.Bucket == nil { + invalidParams.Add(request.NewErrParamRequired("Bucket")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + type GetBucketWebsiteOutput struct { _ struct{} `type:"structure"` @@ -3357,6 +5422,25 @@ func (s GetObjectAclInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *GetObjectAclInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "GetObjectAclInput"} + if s.Bucket == nil { + invalidParams.Add(request.NewErrParamRequired("Bucket")) + } + if s.Key == nil { + invalidParams.Add(request.NewErrParamRequired("Key")) + } + if s.Key != nil && len(*s.Key) < 1 { + invalidParams.Add(request.NewErrParamMinLen("Key", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + type GetObjectAclOutput struct { _ struct{} `type:"structure"` @@ -3460,6 +5544,25 @@ func (s GetObjectInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *GetObjectInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "GetObjectInput"} + if s.Bucket == nil { + invalidParams.Add(request.NewErrParamRequired("Bucket")) + } + if s.Key == nil { + invalidParams.Add(request.NewErrParamRequired("Key")) + } + if s.Key != nil && len(*s.Key) < 1 { + invalidParams.Add(request.NewErrParamMinLen("Key", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + type GetObjectOutput struct { _ struct{} `type:"structure" payload:"Body"` @@ -3483,7 +5586,7 @@ type GetObjectOutput struct { ContentLanguage *string `location:"header" locationName:"Content-Language" type:"string"` // Size of the body in bytes. - ContentLength *int64 `location:"header" locationName:"Content-Length" type:"integer"` + ContentLength *int64 `location:"header" locationName:"Content-Length" type:"long"` // The portion of the object returned in the response. ContentRange *string `location:"header" locationName:"Content-Range" type:"string"` @@ -3593,6 +5696,25 @@ func (s GetObjectTorrentInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *GetObjectTorrentInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "GetObjectTorrentInput"} + if s.Bucket == nil { + invalidParams.Add(request.NewErrParamRequired("Bucket")) + } + if s.Key == nil { + invalidParams.Add(request.NewErrParamRequired("Key")) + } + if s.Key != nil && len(*s.Key) < 1 { + invalidParams.Add(request.NewErrParamMinLen("Key", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + type GetObjectTorrentOutput struct { _ struct{} `type:"structure" payload:"Body"` @@ -3632,6 +5754,21 @@ func (s Grant) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *Grant) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "Grant"} + if s.Grantee != nil { + if err := s.Grantee.Validate(); err != nil { + invalidParams.AddNested("Grantee", err.(request.ErrInvalidParams)) + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + type Grantee struct { _ struct{} `type:"structure" xmlPrefix:"xsi" xmlURI:"http://www.w3.org/2001/XMLSchema-instance"` @@ -3661,6 +5798,19 @@ func (s Grantee) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *Grantee) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "Grantee"} + if s.Type == nil { + invalidParams.Add(request.NewErrParamRequired("Type")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + type HeadBucketInput struct { _ struct{} `type:"structure"` @@ -3677,6 +5827,19 @@ func (s HeadBucketInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *HeadBucketInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "HeadBucketInput"} + if s.Bucket == nil { + invalidParams.Add(request.NewErrParamRequired("Bucket")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + type HeadBucketOutput struct { _ struct{} `type:"structure"` } @@ -3753,6 +5916,25 @@ func (s HeadObjectInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *HeadObjectInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "HeadObjectInput"} + if s.Bucket == nil { + invalidParams.Add(request.NewErrParamRequired("Bucket")) + } + if s.Key == nil { + invalidParams.Add(request.NewErrParamRequired("Key")) + } + if s.Key != nil && len(*s.Key) < 1 { + invalidParams.Add(request.NewErrParamMinLen("Key", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + type HeadObjectOutput struct { _ struct{} `type:"structure"` @@ -3773,7 +5955,7 @@ type HeadObjectOutput struct { ContentLanguage *string `location:"header" locationName:"Content-Language" type:"string"` // Size of the body in bytes. - ContentLength *int64 `location:"header" locationName:"Content-Length" type:"integer"` + ContentLength *int64 `location:"header" locationName:"Content-Length" type:"long"` // A standard MIME type describing the format of the object data. ContentType *string `location:"header" locationName:"Content-Type" type:"string"` @@ -3876,6 +6058,19 @@ func (s IndexDocument) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *IndexDocument) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "IndexDocument"} + if s.Suffix == nil { + invalidParams.Add(request.NewErrParamRequired("Suffix")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + type Initiator struct { _ struct{} `type:"structure"` @@ -3946,6 +6141,22 @@ func (s LambdaFunctionConfiguration) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *LambdaFunctionConfiguration) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "LambdaFunctionConfiguration"} + if s.Events == nil { + invalidParams.Add(request.NewErrParamRequired("Events")) + } + if s.LambdaFunctionArn == nil { + invalidParams.Add(request.NewErrParamRequired("LambdaFunctionArn")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + type LifecycleConfiguration struct { _ struct{} `type:"structure"` @@ -3962,6 +6173,29 @@ func (s LifecycleConfiguration) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *LifecycleConfiguration) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "LifecycleConfiguration"} + if s.Rules == nil { + invalidParams.Add(request.NewErrParamRequired("Rules")) + } + if s.Rules != nil { + for i, v := range s.Rules { + if v == nil { + continue + } + if err := v.Validate(); err != nil { + invalidParams.AddNested(fmt.Sprintf("%s[%v]", "Rules", i), err.(request.ErrInvalidParams)) + } + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + type LifecycleExpiration struct { _ struct{} `type:"structure"` @@ -3972,6 +6206,12 @@ type LifecycleExpiration struct { // Indicates the lifetime, in days, of the objects that are subject to the rule. // The value must be a non-zero positive integer. Days *int64 `type:"integer"` + + // Indicates whether Amazon S3 will remove a delete marker with no noncurrent + // versions. If set to true, the delete marker will be expired; if set to false + // the policy takes no action. This cannot be specified with Days or Date in + // a Lifecycle Expiration Policy. + ExpiredObjectDeleteMarker *bool `type:"boolean"` } // String returns the string representation @@ -3987,6 +6227,10 @@ func (s LifecycleExpiration) GoString() string { type LifecycleRule struct { _ struct{} `type:"structure"` + // Specifies the days since the initiation of an Incomplete Multipart Upload + // that Lifecycle will wait before permanently removing all parts of the upload. + AbortIncompleteMultipartUpload *AbortIncompleteMultipartUpload `type:"structure"` + Expiration *LifecycleExpiration `type:"structure"` // Unique identifier for the rule. The value cannot be longer than 255 characters. @@ -4021,6 +6265,22 @@ func (s LifecycleRule) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *LifecycleRule) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "LifecycleRule"} + if s.Prefix == nil { + invalidParams.Add(request.NewErrParamRequired("Prefix")) + } + if s.Status == nil { + invalidParams.Add(request.NewErrParamRequired("Status")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + type ListBucketsInput struct { _ struct{} `type:"structure"` } @@ -4098,6 +6358,19 @@ func (s ListMultipartUploadsInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *ListMultipartUploadsInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "ListMultipartUploadsInput"} + if s.Bucket == nil { + invalidParams.Add(request.NewErrParamRequired("Bucket")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + type ListMultipartUploadsOutput struct { _ struct{} `type:"structure"` @@ -4192,6 +6465,19 @@ func (s ListObjectVersionsInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *ListObjectVersionsInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "ListObjectVersionsInput"} + if s.Bucket == nil { + invalidParams.Add(request.NewErrParamRequired("Bucket")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + type ListObjectVersionsOutput struct { _ struct{} `type:"structure"` @@ -4278,6 +6564,19 @@ func (s ListObjectsInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *ListObjectsInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "ListObjectsInput"} + if s.Bucket == nil { + invalidParams.Add(request.NewErrParamRequired("Bucket")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + type ListObjectsOutput struct { _ struct{} `type:"structure"` @@ -4322,6 +6621,124 @@ func (s ListObjectsOutput) GoString() string { return s.String() } +type ListObjectsV2Input struct { + _ struct{} `type:"structure"` + + // Name of the bucket to list. + Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` + + // ContinuationToken indicates Amazon S3 that the list is being continued on + // this bucket with a token. ContinuationToken is obfuscated and is not a real + // key + ContinuationToken *string `location:"querystring" locationName:"continuation-token" type:"string"` + + // A delimiter is a character you use to group keys. + Delimiter *string `location:"querystring" locationName:"delimiter" type:"string"` + + // Encoding type used by Amazon S3 to encode object keys in the response. + EncodingType *string `location:"querystring" locationName:"encoding-type" type:"string" enum:"EncodingType"` + + // The owner field is not present in listV2 by default, if you want to return + // owner field with each key in the result then set the fetch owner field to + // true + FetchOwner *bool `location:"querystring" locationName:"fetch-owner" type:"boolean"` + + // Sets the maximum number of keys returned in the response. The response might + // contain fewer keys but will never contain more. + MaxKeys *int64 `location:"querystring" locationName:"max-keys" type:"integer"` + + // Limits the response to keys that begin with the specified prefix. + Prefix *string `location:"querystring" locationName:"prefix" type:"string"` + + // StartAfter is where you want Amazon S3 to start listing from. Amazon S3 starts + // listing after this specified key. StartAfter can be any key in the bucket + StartAfter *string `location:"querystring" locationName:"start-after" type:"string"` +} + +// String returns the string representation +func (s ListObjectsV2Input) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ListObjectsV2Input) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *ListObjectsV2Input) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "ListObjectsV2Input"} + if s.Bucket == nil { + invalidParams.Add(request.NewErrParamRequired("Bucket")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +type ListObjectsV2Output struct { + _ struct{} `type:"structure"` + + // CommonPrefixes contains all (if there are any) keys between Prefix and the + // next occurrence of the string specified by delimiter + CommonPrefixes []*CommonPrefix `type:"list" flattened:"true"` + + // Metadata about each object returned. + Contents []*Object `type:"list" flattened:"true"` + + // ContinuationToken indicates Amazon S3 that the list is being continued on + // this bucket with a token. ContinuationToken is obfuscated and is not a real + // key + ContinuationToken *string `type:"string"` + + // A delimiter is a character you use to group keys. + Delimiter *string `type:"string"` + + // Encoding type used by Amazon S3 to encode object keys in the response. + EncodingType *string `type:"string" enum:"EncodingType"` + + // A flag that indicates whether or not Amazon S3 returned all of the results + // that satisfied the search criteria. + IsTruncated *bool `type:"boolean"` + + // KeyCount is the number of keys returned with this request. KeyCount will + // always be less than equals to MaxKeys field. Say you ask for 50 keys, your + // result will include less than equals 50 keys + KeyCount *int64 `type:"integer"` + + // Sets the maximum number of keys returned in the response. The response might + // contain fewer keys but will never contain more. + MaxKeys *int64 `type:"integer"` + + // Name of the bucket to list. + Name *string `type:"string"` + + // NextContinuationToken is sent when isTruncated is true which means there + // are more keys in the bucket that can be listed. The next list requests to + // Amazon S3 can be continued with this NextContinuationToken. NextContinuationToken + // is obfuscated and is not a real key + NextContinuationToken *string `type:"string"` + + // Limits the response to keys that begin with the specified prefix. + Prefix *string `type:"string"` + + // StartAfter is where you want Amazon S3 to start listing from. Amazon S3 starts + // listing after this specified key. StartAfter can be any key in the bucket + StartAfter *string `type:"string"` +} + +// String returns the string representation +func (s ListObjectsV2Output) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ListObjectsV2Output) GoString() string { + return s.String() +} + type ListPartsInput struct { _ struct{} `type:"structure"` @@ -4356,9 +6773,38 @@ func (s ListPartsInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *ListPartsInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "ListPartsInput"} + if s.Bucket == nil { + invalidParams.Add(request.NewErrParamRequired("Bucket")) + } + if s.Key == nil { + invalidParams.Add(request.NewErrParamRequired("Key")) + } + if s.Key != nil && len(*s.Key) < 1 { + invalidParams.Add(request.NewErrParamMinLen("Key", 1)) + } + if s.UploadId == nil { + invalidParams.Add(request.NewErrParamRequired("UploadId")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + type ListPartsOutput struct { _ struct{} `type:"structure"` + // Date when multipart upload will become eligible for abort operation by lifecycle. + AbortDate *time.Time `location:"header" locationName:"x-amz-abort-date" type:"timestamp" timestampFormat:"rfc822"` + + // Id of the lifecycle rule that makes a multipart upload eligible for abort + // operation. + AbortRuleId *string `location:"header" locationName:"x-amz-abort-rule-id" type:"string"` + // Name of the bucket to which the multipart upload was initiated. Bucket *string `type:"string"` @@ -4435,6 +6881,26 @@ func (s LoggingEnabled) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *LoggingEnabled) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "LoggingEnabled"} + if s.TargetGrants != nil { + for i, v := range s.TargetGrants { + if v == nil { + continue + } + if err := v.Validate(); err != nil { + invalidParams.AddNested(fmt.Sprintf("%s[%v]", "TargetGrants", i), err.(request.ErrInvalidParams)) + } + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + type MultipartUpload struct { _ struct{} `type:"structure"` @@ -4477,8 +6943,8 @@ type NoncurrentVersionExpiration struct { // Specifies the number of days an object is noncurrent before Amazon S3 can // perform the associated action. For information about the noncurrent days // calculations, see How Amazon S3 Calculates When an Object Became Noncurrent - // (/AmazonS3/latest/dev/s3-access-control.html) in the Amazon Simple Storage - // Service Developer Guide. + // (http://docs.aws.amazon.com/AmazonS3/latest/dev/s3-access-control.html) in + // the Amazon Simple Storage Service Developer Guide. NoncurrentDays *int64 `type:"integer"` } @@ -4503,8 +6969,8 @@ type NoncurrentVersionTransition struct { // Specifies the number of days an object is noncurrent before Amazon S3 can // perform the associated action. For information about the noncurrent days // calculations, see How Amazon S3 Calculates When an Object Became Noncurrent - // (/AmazonS3/latest/dev/s3-access-control.html) in the Amazon Simple Storage - // Service Developer Guide. + // (http://docs.aws.amazon.com/AmazonS3/latest/dev/s3-access-control.html) in + // the Amazon Simple Storage Service Developer Guide. NoncurrentDays *int64 `type:"integer"` // The class of storage used to store the object. @@ -4543,6 +7009,46 @@ func (s NotificationConfiguration) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *NotificationConfiguration) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "NotificationConfiguration"} + if s.LambdaFunctionConfigurations != nil { + for i, v := range s.LambdaFunctionConfigurations { + if v == nil { + continue + } + if err := v.Validate(); err != nil { + invalidParams.AddNested(fmt.Sprintf("%s[%v]", "LambdaFunctionConfigurations", i), err.(request.ErrInvalidParams)) + } + } + } + if s.QueueConfigurations != nil { + for i, v := range s.QueueConfigurations { + if v == nil { + continue + } + if err := v.Validate(); err != nil { + invalidParams.AddNested(fmt.Sprintf("%s[%v]", "QueueConfigurations", i), err.(request.ErrInvalidParams)) + } + } + } + if s.TopicConfigurations != nil { + for i, v := range s.TopicConfigurations { + if v == nil { + continue + } + if err := v.Validate(); err != nil { + invalidParams.AddNested(fmt.Sprintf("%s[%v]", "TopicConfigurations", i), err.(request.ErrInvalidParams)) + } + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + type NotificationConfigurationDeprecated struct { _ struct{} `type:"structure"` @@ -4630,6 +7136,22 @@ func (s ObjectIdentifier) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *ObjectIdentifier) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "ObjectIdentifier"} + if s.Key == nil { + invalidParams.Add(request.NewErrParamRequired("Key")) + } + if s.Key != nil && len(*s.Key) < 1 { + invalidParams.Add(request.NewErrParamMinLen("Key", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + type ObjectVersion struct { _ struct{} `type:"structure"` @@ -4712,6 +7234,56 @@ func (s Part) GoString() string { return s.String() } +type PutBucketAccelerateConfigurationInput struct { + _ struct{} `type:"structure" payload:"AccelerateConfiguration"` + + // Specifies the Accelerate Configuration you want to set for the bucket. + AccelerateConfiguration *AccelerateConfiguration `locationName:"AccelerateConfiguration" type:"structure" required:"true"` + + // Name of the bucket for which the accelerate configuration is set. + Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` +} + +// String returns the string representation +func (s PutBucketAccelerateConfigurationInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s PutBucketAccelerateConfigurationInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *PutBucketAccelerateConfigurationInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "PutBucketAccelerateConfigurationInput"} + if s.AccelerateConfiguration == nil { + invalidParams.Add(request.NewErrParamRequired("AccelerateConfiguration")) + } + if s.Bucket == nil { + invalidParams.Add(request.NewErrParamRequired("Bucket")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +type PutBucketAccelerateConfigurationOutput struct { + _ struct{} `type:"structure"` +} + +// String returns the string representation +func (s PutBucketAccelerateConfigurationOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s PutBucketAccelerateConfigurationOutput) GoString() string { + return s.String() +} + type PutBucketAclInput struct { _ struct{} `type:"structure" payload:"AccessControlPolicy"` @@ -4749,6 +7321,24 @@ func (s PutBucketAclInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *PutBucketAclInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "PutBucketAclInput"} + if s.Bucket == nil { + invalidParams.Add(request.NewErrParamRequired("Bucket")) + } + if s.AccessControlPolicy != nil { + if err := s.AccessControlPolicy.Validate(); err != nil { + invalidParams.AddNested("AccessControlPolicy", err.(request.ErrInvalidParams)) + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + type PutBucketAclOutput struct { _ struct{} `type:"structure"` } @@ -4781,6 +7371,27 @@ func (s PutBucketCorsInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *PutBucketCorsInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "PutBucketCorsInput"} + if s.Bucket == nil { + invalidParams.Add(request.NewErrParamRequired("Bucket")) + } + if s.CORSConfiguration == nil { + invalidParams.Add(request.NewErrParamRequired("CORSConfiguration")) + } + if s.CORSConfiguration != nil { + if err := s.CORSConfiguration.Validate(); err != nil { + invalidParams.AddNested("CORSConfiguration", err.(request.ErrInvalidParams)) + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + type PutBucketCorsOutput struct { _ struct{} `type:"structure"` } @@ -4813,6 +7424,24 @@ func (s PutBucketLifecycleConfigurationInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *PutBucketLifecycleConfigurationInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "PutBucketLifecycleConfigurationInput"} + if s.Bucket == nil { + invalidParams.Add(request.NewErrParamRequired("Bucket")) + } + if s.LifecycleConfiguration != nil { + if err := s.LifecycleConfiguration.Validate(); err != nil { + invalidParams.AddNested("LifecycleConfiguration", err.(request.ErrInvalidParams)) + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + type PutBucketLifecycleConfigurationOutput struct { _ struct{} `type:"structure"` } @@ -4845,6 +7474,24 @@ func (s PutBucketLifecycleInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *PutBucketLifecycleInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "PutBucketLifecycleInput"} + if s.Bucket == nil { + invalidParams.Add(request.NewErrParamRequired("Bucket")) + } + if s.LifecycleConfiguration != nil { + if err := s.LifecycleConfiguration.Validate(); err != nil { + invalidParams.AddNested("LifecycleConfiguration", err.(request.ErrInvalidParams)) + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + type PutBucketLifecycleOutput struct { _ struct{} `type:"structure"` } @@ -4877,6 +7524,27 @@ func (s PutBucketLoggingInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *PutBucketLoggingInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "PutBucketLoggingInput"} + if s.Bucket == nil { + invalidParams.Add(request.NewErrParamRequired("Bucket")) + } + if s.BucketLoggingStatus == nil { + invalidParams.Add(request.NewErrParamRequired("BucketLoggingStatus")) + } + if s.BucketLoggingStatus != nil { + if err := s.BucketLoggingStatus.Validate(); err != nil { + invalidParams.AddNested("BucketLoggingStatus", err.(request.ErrInvalidParams)) + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + type PutBucketLoggingOutput struct { _ struct{} `type:"structure"` } @@ -4911,6 +7579,27 @@ func (s PutBucketNotificationConfigurationInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *PutBucketNotificationConfigurationInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "PutBucketNotificationConfigurationInput"} + if s.Bucket == nil { + invalidParams.Add(request.NewErrParamRequired("Bucket")) + } + if s.NotificationConfiguration == nil { + invalidParams.Add(request.NewErrParamRequired("NotificationConfiguration")) + } + if s.NotificationConfiguration != nil { + if err := s.NotificationConfiguration.Validate(); err != nil { + invalidParams.AddNested("NotificationConfiguration", err.(request.ErrInvalidParams)) + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + type PutBucketNotificationConfigurationOutput struct { _ struct{} `type:"structure"` } @@ -4943,6 +7632,22 @@ func (s PutBucketNotificationInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *PutBucketNotificationInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "PutBucketNotificationInput"} + if s.Bucket == nil { + invalidParams.Add(request.NewErrParamRequired("Bucket")) + } + if s.NotificationConfiguration == nil { + invalidParams.Add(request.NewErrParamRequired("NotificationConfiguration")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + type PutBucketNotificationOutput struct { _ struct{} `type:"structure"` } @@ -4976,6 +7681,22 @@ func (s PutBucketPolicyInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *PutBucketPolicyInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "PutBucketPolicyInput"} + if s.Bucket == nil { + invalidParams.Add(request.NewErrParamRequired("Bucket")) + } + if s.Policy == nil { + invalidParams.Add(request.NewErrParamRequired("Policy")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + type PutBucketPolicyOutput struct { _ struct{} `type:"structure"` } @@ -5010,6 +7731,27 @@ func (s PutBucketReplicationInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *PutBucketReplicationInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "PutBucketReplicationInput"} + if s.Bucket == nil { + invalidParams.Add(request.NewErrParamRequired("Bucket")) + } + if s.ReplicationConfiguration == nil { + invalidParams.Add(request.NewErrParamRequired("ReplicationConfiguration")) + } + if s.ReplicationConfiguration != nil { + if err := s.ReplicationConfiguration.Validate(); err != nil { + invalidParams.AddNested("ReplicationConfiguration", err.(request.ErrInvalidParams)) + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + type PutBucketReplicationOutput struct { _ struct{} `type:"structure"` } @@ -5042,6 +7784,27 @@ func (s PutBucketRequestPaymentInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *PutBucketRequestPaymentInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "PutBucketRequestPaymentInput"} + if s.Bucket == nil { + invalidParams.Add(request.NewErrParamRequired("Bucket")) + } + if s.RequestPaymentConfiguration == nil { + invalidParams.Add(request.NewErrParamRequired("RequestPaymentConfiguration")) + } + if s.RequestPaymentConfiguration != nil { + if err := s.RequestPaymentConfiguration.Validate(); err != nil { + invalidParams.AddNested("RequestPaymentConfiguration", err.(request.ErrInvalidParams)) + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + type PutBucketRequestPaymentOutput struct { _ struct{} `type:"structure"` } @@ -5074,6 +7837,27 @@ func (s PutBucketTaggingInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *PutBucketTaggingInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "PutBucketTaggingInput"} + if s.Bucket == nil { + invalidParams.Add(request.NewErrParamRequired("Bucket")) + } + if s.Tagging == nil { + invalidParams.Add(request.NewErrParamRequired("Tagging")) + } + if s.Tagging != nil { + if err := s.Tagging.Validate(); err != nil { + invalidParams.AddNested("Tagging", err.(request.ErrInvalidParams)) + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + type PutBucketTaggingOutput struct { _ struct{} `type:"structure"` } @@ -5110,6 +7894,22 @@ func (s PutBucketVersioningInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *PutBucketVersioningInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "PutBucketVersioningInput"} + if s.Bucket == nil { + invalidParams.Add(request.NewErrParamRequired("Bucket")) + } + if s.VersioningConfiguration == nil { + invalidParams.Add(request.NewErrParamRequired("VersioningConfiguration")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + type PutBucketVersioningOutput struct { _ struct{} `type:"structure"` } @@ -5142,6 +7942,27 @@ func (s PutBucketWebsiteInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *PutBucketWebsiteInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "PutBucketWebsiteInput"} + if s.Bucket == nil { + invalidParams.Add(request.NewErrParamRequired("Bucket")) + } + if s.WebsiteConfiguration == nil { + invalidParams.Add(request.NewErrParamRequired("WebsiteConfiguration")) + } + if s.WebsiteConfiguration != nil { + if err := s.WebsiteConfiguration.Validate(); err != nil { + invalidParams.AddNested("WebsiteConfiguration", err.(request.ErrInvalidParams)) + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + type PutBucketWebsiteOutput struct { _ struct{} `type:"structure"` } @@ -5189,6 +8010,9 @@ type PutObjectAclInput struct { // Documentation on downloading objects from requester pays buckets can be found // at http://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html RequestPayer *string `location:"header" locationName:"x-amz-request-payer" type:"string" enum:"RequestPayer"` + + // VersionId used to reference a specific version of the object. + VersionId *string `location:"querystring" locationName:"versionId" type:"string"` } // String returns the string representation @@ -5201,6 +8025,30 @@ func (s PutObjectAclInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *PutObjectAclInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "PutObjectAclInput"} + if s.Bucket == nil { + invalidParams.Add(request.NewErrParamRequired("Bucket")) + } + if s.Key == nil { + invalidParams.Add(request.NewErrParamRequired("Key")) + } + if s.Key != nil && len(*s.Key) < 1 { + invalidParams.Add(request.NewErrParamMinLen("Key", 1)) + } + if s.AccessControlPolicy != nil { + if err := s.AccessControlPolicy.Validate(); err != nil { + invalidParams.AddNested("AccessControlPolicy", err.(request.ErrInvalidParams)) + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + type PutObjectAclOutput struct { _ struct{} `type:"structure"` @@ -5228,6 +8076,7 @@ type PutObjectInput struct { // Object data. Body io.ReadSeeker `type:"blob"` + // Name of the bucket to which the PUT operation was initiated. Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` // Specifies caching behavior along the request/reply chain. @@ -5246,7 +8095,7 @@ type PutObjectInput struct { // Size of the body in bytes. This parameter is useful when the size of the // body cannot be determined automatically. - ContentLength *int64 `location:"header" locationName:"Content-Length" type:"integer"` + ContentLength *int64 `location:"header" locationName:"Content-Length" type:"long"` // A standard MIME type describing the format of the object data. ContentType *string `location:"header" locationName:"Content-Type" type:"string"` @@ -5266,6 +8115,7 @@ type PutObjectInput struct { // Allows grantee to write the ACL for the applicable object. GrantWriteACP *string `location:"header" locationName:"x-amz-grant-write-acp" type:"string"` + // Object key for which the PUT operation was initiated. Key *string `location:"uri" locationName:"Key" min:"1" type:"string" required:"true"` // A map of metadata to store with the object in S3. @@ -5321,6 +8171,25 @@ func (s PutObjectInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *PutObjectInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "PutObjectInput"} + if s.Bucket == nil { + invalidParams.Add(request.NewErrParamRequired("Bucket")) + } + if s.Key == nil { + invalidParams.Add(request.NewErrParamRequired("Key")) + } + if s.Key != nil && len(*s.Key) < 1 { + invalidParams.Add(request.NewErrParamMinLen("Key", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + type PutObjectOutput struct { _ struct{} `type:"structure"` @@ -5398,6 +8267,22 @@ func (s QueueConfiguration) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *QueueConfiguration) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "QueueConfiguration"} + if s.Events == nil { + invalidParams.Add(request.NewErrParamRequired("Events")) + } + if s.QueueArn == nil { + invalidParams.Add(request.NewErrParamRequired("QueueArn")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + type QueueConfigurationDeprecated struct { _ struct{} `type:"structure"` @@ -5482,6 +8367,19 @@ func (s RedirectAllRequestsTo) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *RedirectAllRequestsTo) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "RedirectAllRequestsTo"} + if s.HostName == nil { + invalidParams.Add(request.NewErrParamRequired("HostName")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + // Container for replication rules. You can add as many as 1,000 rules. Total // replication configuration size can be up to 2 MB. type ReplicationConfiguration struct { @@ -5506,6 +8404,32 @@ func (s ReplicationConfiguration) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *ReplicationConfiguration) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "ReplicationConfiguration"} + if s.Role == nil { + invalidParams.Add(request.NewErrParamRequired("Role")) + } + if s.Rules == nil { + invalidParams.Add(request.NewErrParamRequired("Rules")) + } + if s.Rules != nil { + for i, v := range s.Rules { + if v == nil { + continue + } + if err := v.Validate(); err != nil { + invalidParams.AddNested(fmt.Sprintf("%s[%v]", "Rules", i), err.(request.ErrInvalidParams)) + } + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + type ReplicationRule struct { _ struct{} `type:"structure"` @@ -5533,6 +8457,30 @@ func (s ReplicationRule) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *ReplicationRule) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "ReplicationRule"} + if s.Destination == nil { + invalidParams.Add(request.NewErrParamRequired("Destination")) + } + if s.Prefix == nil { + invalidParams.Add(request.NewErrParamRequired("Prefix")) + } + if s.Status == nil { + invalidParams.Add(request.NewErrParamRequired("Status")) + } + if s.Destination != nil { + if err := s.Destination.Validate(); err != nil { + invalidParams.AddNested("Destination", err.(request.ErrInvalidParams)) + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + type RequestPaymentConfiguration struct { _ struct{} `type:"structure"` @@ -5550,6 +8498,19 @@ func (s RequestPaymentConfiguration) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *RequestPaymentConfiguration) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "RequestPaymentConfiguration"} + if s.Payer == nil { + invalidParams.Add(request.NewErrParamRequired("Payer")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + type RestoreObjectInput struct { _ struct{} `type:"structure" payload:"RestoreRequest"` @@ -5578,6 +8539,30 @@ func (s RestoreObjectInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *RestoreObjectInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "RestoreObjectInput"} + if s.Bucket == nil { + invalidParams.Add(request.NewErrParamRequired("Bucket")) + } + if s.Key == nil { + invalidParams.Add(request.NewErrParamRequired("Key")) + } + if s.Key != nil && len(*s.Key) < 1 { + invalidParams.Add(request.NewErrParamMinLen("Key", 1)) + } + if s.RestoreRequest != nil { + if err := s.RestoreRequest.Validate(); err != nil { + invalidParams.AddNested("RestoreRequest", err.(request.ErrInvalidParams)) + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + type RestoreObjectOutput struct { _ struct{} `type:"structure"` @@ -5613,6 +8598,19 @@ func (s RestoreRequest) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *RestoreRequest) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "RestoreRequest"} + if s.Days == nil { + invalidParams.Add(request.NewErrParamRequired("Days")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + type RoutingRule struct { _ struct{} `type:"structure"` @@ -5638,9 +8636,26 @@ func (s RoutingRule) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *RoutingRule) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "RoutingRule"} + if s.Redirect == nil { + invalidParams.Add(request.NewErrParamRequired("Redirect")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + type Rule struct { _ struct{} `type:"structure"` + // Specifies the days since the initiation of an Incomplete Multipart Upload + // that Lifecycle will wait before permanently removing all parts of the upload. + AbortIncompleteMultipartUpload *AbortIncompleteMultipartUpload `type:"structure"` + Expiration *LifecycleExpiration `type:"structure"` // Unique identifier for the rule. The value cannot be longer than 255 characters. @@ -5680,6 +8695,22 @@ func (s Rule) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *Rule) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "Rule"} + if s.Prefix == nil { + invalidParams.Add(request.NewErrParamRequired("Prefix")) + } + if s.Status == nil { + invalidParams.Add(request.NewErrParamRequired("Status")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + type Tag struct { _ struct{} `type:"structure"` @@ -5700,6 +8731,25 @@ func (s Tag) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *Tag) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "Tag"} + if s.Key == nil { + invalidParams.Add(request.NewErrParamRequired("Key")) + } + if s.Key != nil && len(*s.Key) < 1 { + invalidParams.Add(request.NewErrParamMinLen("Key", 1)) + } + if s.Value == nil { + invalidParams.Add(request.NewErrParamRequired("Value")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + type Tagging struct { _ struct{} `type:"structure"` @@ -5716,6 +8766,29 @@ func (s Tagging) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *Tagging) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "Tagging"} + if s.TagSet == nil { + invalidParams.Add(request.NewErrParamRequired("TagSet")) + } + if s.TagSet != nil { + for i, v := range s.TagSet { + if v == nil { + continue + } + if err := v.Validate(); err != nil { + invalidParams.AddNested(fmt.Sprintf("%s[%v]", "TagSet", i), err.(request.ErrInvalidParams)) + } + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + type TargetGrant struct { _ struct{} `type:"structure"` @@ -5735,6 +8808,21 @@ func (s TargetGrant) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *TargetGrant) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "TargetGrant"} + if s.Grantee != nil { + if err := s.Grantee.Validate(); err != nil { + invalidParams.AddNested("Grantee", err.(request.ErrInvalidParams)) + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + // Container for specifying the configuration when you want Amazon S3 to publish // events to an Amazon Simple Notification Service (Amazon SNS) topic. type TopicConfiguration struct { @@ -5766,6 +8854,22 @@ func (s TopicConfiguration) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *TopicConfiguration) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "TopicConfiguration"} + if s.Events == nil { + invalidParams.Add(request.NewErrParamRequired("Events")) + } + if s.TopicArn == nil { + invalidParams.Add(request.NewErrParamRequired("TopicArn")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + type TopicConfigurationDeprecated struct { _ struct{} `type:"structure"` @@ -5902,6 +9006,34 @@ func (s UploadPartCopyInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *UploadPartCopyInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "UploadPartCopyInput"} + if s.Bucket == nil { + invalidParams.Add(request.NewErrParamRequired("Bucket")) + } + if s.CopySource == nil { + invalidParams.Add(request.NewErrParamRequired("CopySource")) + } + if s.Key == nil { + invalidParams.Add(request.NewErrParamRequired("Key")) + } + if s.Key != nil && len(*s.Key) < 1 { + invalidParams.Add(request.NewErrParamMinLen("Key", 1)) + } + if s.PartNumber == nil { + invalidParams.Add(request.NewErrParamRequired("PartNumber")) + } + if s.UploadId == nil { + invalidParams.Add(request.NewErrParamRequired("UploadId")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + type UploadPartCopyOutput struct { _ struct{} `type:"structure" payload:"CopyPartResult"` @@ -5947,14 +9079,17 @@ func (s UploadPartCopyOutput) GoString() string { type UploadPartInput struct { _ struct{} `type:"structure" payload:"Body"` + // Object data. Body io.ReadSeeker `type:"blob"` + // Name of the bucket to which the multipart upload was initiated. Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` // Size of the body in bytes. This parameter is useful when the size of the // body cannot be determined automatically. - ContentLength *int64 `location:"header" locationName:"Content-Length" type:"integer"` + ContentLength *int64 `location:"header" locationName:"Content-Length" type:"long"` + // Object key for which the multipart upload was initiated. Key *string `location:"uri" locationName:"Key" min:"1" type:"string" required:"true"` // Part number of part being uploaded. This is a positive integer between 1 @@ -5997,6 +9132,31 @@ func (s UploadPartInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *UploadPartInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "UploadPartInput"} + if s.Bucket == nil { + invalidParams.Add(request.NewErrParamRequired("Bucket")) + } + if s.Key == nil { + invalidParams.Add(request.NewErrParamRequired("Key")) + } + if s.Key != nil && len(*s.Key) < 1 { + invalidParams.Add(request.NewErrParamMinLen("Key", 1)) + } + if s.PartNumber == nil { + invalidParams.Add(request.NewErrParamRequired("PartNumber")) + } + if s.UploadId == nil { + invalidParams.Add(request.NewErrParamRequired("UploadId")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + type UploadPartOutput struct { _ struct{} `type:"structure"` @@ -6080,6 +9240,48 @@ func (s WebsiteConfiguration) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *WebsiteConfiguration) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "WebsiteConfiguration"} + if s.ErrorDocument != nil { + if err := s.ErrorDocument.Validate(); err != nil { + invalidParams.AddNested("ErrorDocument", err.(request.ErrInvalidParams)) + } + } + if s.IndexDocument != nil { + if err := s.IndexDocument.Validate(); err != nil { + invalidParams.AddNested("IndexDocument", err.(request.ErrInvalidParams)) + } + } + if s.RedirectAllRequestsTo != nil { + if err := s.RedirectAllRequestsTo.Validate(); err != nil { + invalidParams.AddNested("RedirectAllRequestsTo", err.(request.ErrInvalidParams)) + } + } + if s.RoutingRules != nil { + for i, v := range s.RoutingRules { + if v == nil { + continue + } + if err := v.Validate(); err != nil { + invalidParams.AddNested(fmt.Sprintf("%s[%v]", "RoutingRules", i), err.(request.ErrInvalidParams)) + } + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +const ( + // @enum BucketAccelerateStatus + BucketAccelerateStatusEnabled = "Enabled" + // @enum BucketAccelerateStatus + BucketAccelerateStatusSuspended = "Suspended" +) + const ( // @enum BucketCannedACL BucketCannedACLPrivate = "private" @@ -6101,6 +9303,8 @@ const ( // @enum BucketLocationConstraint BucketLocationConstraintUsWest2 = "us-west-2" // @enum BucketLocationConstraint + BucketLocationConstraintApSouth1 = "ap-south-1" + // @enum BucketLocationConstraint BucketLocationConstraintApSoutheast1 = "ap-southeast-1" // @enum BucketLocationConstraint BucketLocationConstraintApSoutheast2 = "ap-southeast-2" diff --git a/vendor/github.com/aws/aws-sdk-go/service/s3/customizations.go b/vendor/github.com/aws/aws-sdk-go/service/s3/customizations.go index c227f242c..846334723 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/s3/customizations.go +++ b/vendor/github.com/aws/aws-sdk-go/service/s3/customizations.go @@ -6,32 +6,41 @@ import ( ) func init() { - initClient = func(c *client.Client) { - // Support building custom host-style bucket endpoints - c.Handlers.Build.PushFront(updateHostWithBucket) + initClient = defaultInitClientFn + initRequest = defaultInitRequestFn +} - // Require SSL when using SSE keys - c.Handlers.Validate.PushBack(validateSSERequiresSSL) - c.Handlers.Build.PushBack(computeSSEKeys) +func defaultInitClientFn(c *client.Client) { + // Support building custom endpoints based on config + c.Handlers.Build.PushFront(updateEndpointForS3Config) - // S3 uses custom error unmarshaling logic - c.Handlers.UnmarshalError.Clear() - c.Handlers.UnmarshalError.PushBack(unmarshalError) - } + // Require SSL when using SSE keys + c.Handlers.Validate.PushBack(validateSSERequiresSSL) + c.Handlers.Build.PushBack(computeSSEKeys) - initRequest = func(r *request.Request) { - switch r.Operation.Name { - case opPutBucketCors, opPutBucketLifecycle, opPutBucketPolicy, opPutBucketTagging, opDeleteObjects, opPutBucketLifecycleConfiguration: - // These S3 operations require Content-MD5 to be set - r.Handlers.Build.PushBack(contentMD5) - case opGetBucketLocation: - // GetBucketLocation has custom parsing logic - r.Handlers.Unmarshal.PushFront(buildGetBucketLocation) - case opCreateBucket: - // Auto-populate LocationConstraint with current region - r.Handlers.Validate.PushFront(populateLocationConstraint) - case opCopyObject, opUploadPartCopy, opCompleteMultipartUpload: - r.Handlers.Unmarshal.PushFront(copyMultipartStatusOKUnmarhsalError) - } + // S3 uses custom error unmarshaling logic + c.Handlers.UnmarshalError.Clear() + c.Handlers.UnmarshalError.PushBack(unmarshalError) +} + +func defaultInitRequestFn(r *request.Request) { + // Add reuest handlers for specific platforms. + // e.g. 100-continue support for PUT requests using Go 1.6 + platformRequestHandlers(r) + + switch r.Operation.Name { + case opPutBucketCors, opPutBucketLifecycle, opPutBucketPolicy, + opPutBucketTagging, opDeleteObjects, opPutBucketLifecycleConfiguration, + opPutBucketReplication: + // These S3 operations require Content-MD5 to be set + r.Handlers.Build.PushBack(contentMD5) + case opGetBucketLocation: + // GetBucketLocation has custom parsing logic + r.Handlers.Unmarshal.PushFront(buildGetBucketLocation) + case opCreateBucket: + // Auto-populate LocationConstraint with current region + r.Handlers.Validate.PushFront(populateLocationConstraint) + case opCopyObject, opUploadPartCopy, opCompleteMultipartUpload: + r.Handlers.Unmarshal.PushFront(copyMultipartStatusOKUnmarhsalError) } } diff --git a/vendor/github.com/aws/aws-sdk-go/service/s3/host_style_bucket.go b/vendor/github.com/aws/aws-sdk-go/service/s3/host_style_bucket.go index b7cf4f9cc..ccbf5cc1a 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/s3/host_style_bucket.go +++ b/vendor/github.com/aws/aws-sdk-go/service/s3/host_style_bucket.go @@ -1,14 +1,132 @@ package s3 import ( + "fmt" + "net/url" "regexp" "strings" "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/awserr" "github.com/aws/aws-sdk-go/aws/awsutil" "github.com/aws/aws-sdk-go/aws/request" ) +// an operationBlacklist is a list of operation names that should a +// request handler should not be executed with. +type operationBlacklist []string + +// Continue will return true of the Request's operation name is not +// in the blacklist. False otherwise. +func (b operationBlacklist) Continue(r *request.Request) bool { + for i := 0; i < len(b); i++ { + if b[i] == r.Operation.Name { + return false + } + } + return true +} + +var accelerateOpBlacklist = operationBlacklist{ + opListBuckets, opCreateBucket, opDeleteBucket, +} + +// Request handler to automatically add the bucket name to the endpoint domain +// if possible. This style of bucket is valid for all bucket names which are +// DNS compatible and do not contain "." +func updateEndpointForS3Config(r *request.Request) { + forceHostStyle := aws.BoolValue(r.Config.S3ForcePathStyle) + accelerate := aws.BoolValue(r.Config.S3UseAccelerate) + useDualStack := aws.BoolValue(r.Config.UseDualStack) + + if useDualStack && accelerate { + r.Error = awserr.New("InvalidParameterException", + fmt.Sprintf("configuration aws.Config.UseDualStack is not compatible with aws.Config.Accelerate"), + nil) + return + } + + if accelerate && accelerateOpBlacklist.Continue(r) { + if forceHostStyle { + if r.Config.Logger != nil { + r.Config.Logger.Log("ERROR: aws.Config.S3UseAccelerate is not compatible with aws.Config.S3ForcePathStyle, ignoring S3ForcePathStyle.") + } + } + updateEndpointForAccelerate(r) + } else if !forceHostStyle && r.Operation.Name != opGetBucketLocation { + updateEndpointForHostStyle(r) + } +} + +func updateEndpointForHostStyle(r *request.Request) { + bucket, ok := bucketNameFromReqParams(r.Params) + if !ok { + // Ignore operation requests if the bucketname was not provided + // if this is an input validation error the validation handler + // will report it. + return + } + + if !hostCompatibleBucketName(r.HTTPRequest.URL, bucket) { + // bucket name must be valid to put into the host + return + } + + moveBucketToHost(r.HTTPRequest.URL, bucket) +} + +func updateEndpointForAccelerate(r *request.Request) { + bucket, ok := bucketNameFromReqParams(r.Params) + if !ok { + // Ignore operation requests if the bucketname was not provided + // if this is an input validation error the validation handler + // will report it. + return + } + + if !hostCompatibleBucketName(r.HTTPRequest.URL, bucket) { + r.Error = awserr.New("InvalidParameterException", + fmt.Sprintf("bucket name %s is not compatibile with S3 Accelerate", bucket), + nil) + return + } + + // Change endpoint from s3(-[a-z0-1-])?.amazonaws.com to s3-accelerate.amazonaws.com + r.HTTPRequest.URL.Host = replaceHostRegion(r.HTTPRequest.URL.Host, "accelerate") + moveBucketToHost(r.HTTPRequest.URL, bucket) +} + +// Attempts to retrieve the bucket name from the request input parameters. +// If no bucket is found, or the field is empty "", false will be returned. +func bucketNameFromReqParams(params interface{}) (string, bool) { + b, _ := awsutil.ValuesAtPath(params, "Bucket") + if len(b) == 0 { + return "", false + } + + if bucket, ok := b[0].(*string); ok { + if bucketStr := aws.StringValue(bucket); bucketStr != "" { + return bucketStr, true + } + } + + return "", false +} + +// hostCompatibleBucketName returns true if the request should +// put the bucket in the host. This is false if S3ForcePathStyle is +// explicitly set or if the bucket is not DNS compatible. +func hostCompatibleBucketName(u *url.URL, bucket string) bool { + // Bucket might be DNS compatible but dots in the hostname will fail + // certificate validation, so do not use host-style. + if u.Scheme == "https" && strings.Contains(bucket, ".") { + return false + } + + // if the bucket is DNS compatible + return dnsCompatibleBucketName(bucket) +} + var reDomain = regexp.MustCompile(`^[a-z0-9][a-z0-9\.\-]{1,61}[a-z0-9]$`) var reIPAddress = regexp.MustCompile(`^(\d+\.){3}\d+$`) @@ -20,41 +138,36 @@ func dnsCompatibleBucketName(bucket string) bool { !strings.Contains(bucket, "..") } -// hostStyleBucketName returns true if the request should put the bucket in -// the host. This is false if S3ForcePathStyle is explicitly set or if the -// bucket is not DNS compatible. -func hostStyleBucketName(r *request.Request, bucket string) bool { - if aws.BoolValue(r.Config.S3ForcePathStyle) { - return false +// moveBucketToHost moves the bucket name from the URI path to URL host. +func moveBucketToHost(u *url.URL, bucket string) { + u.Host = bucket + "." + u.Host + u.Path = strings.Replace(u.Path, "/{Bucket}", "", -1) + if u.Path == "" { + u.Path = "/" } - - // Bucket might be DNS compatible but dots in the hostname will fail - // certificate validation, so do not use host-style. - if r.HTTPRequest.URL.Scheme == "https" && strings.Contains(bucket, ".") { - return false - } - - // GetBucketLocation should be able to be called from any region within - // a partition, and return the associated region of the bucket. - if r.Operation.Name == opGetBucketLocation { - return false - } - - // Use host-style if the bucket is DNS compatible - return dnsCompatibleBucketName(bucket) } -func updateHostWithBucket(r *request.Request) { - b, _ := awsutil.ValuesAtPath(r.Params, "Bucket") - if len(b) == 0 { - return +const s3HostPrefix = "s3" + +// replaceHostRegion replaces the S3 region string in the host with the +// value provided. If v is empty the host prefix returned will be s3. +func replaceHostRegion(host, v string) string { + if !strings.HasPrefix(host, s3HostPrefix) { + return host } - if bucket := b[0].(*string); aws.StringValue(bucket) != "" && hostStyleBucketName(r, *bucket) { - r.HTTPRequest.URL.Host = *bucket + "." + r.HTTPRequest.URL.Host - r.HTTPRequest.URL.Path = strings.Replace(r.HTTPRequest.URL.Path, "/{Bucket}", "", -1) - if r.HTTPRequest.URL.Path == "" { - r.HTTPRequest.URL.Path = "/" + suffix := host[len(s3HostPrefix):] + for i := len(s3HostPrefix); i < len(host); i++ { + if host[i] == '.' { + // Trim until '.' leave the it in place. + suffix = host[i:] + break } } + + if len(v) == 0 { + return fmt.Sprintf("s3%s", suffix) + } + + return fmt.Sprintf("s3-%s%s", v, suffix) } diff --git a/vendor/github.com/aws/aws-sdk-go/service/s3/platform_handlers.go b/vendor/github.com/aws/aws-sdk-go/service/s3/platform_handlers.go new file mode 100644 index 000000000..8e6f3307d --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/service/s3/platform_handlers.go @@ -0,0 +1,8 @@ +// +build !go1.6 + +package s3 + +import "github.com/aws/aws-sdk-go/aws/request" + +func platformRequestHandlers(r *request.Request) { +} diff --git a/vendor/github.com/aws/aws-sdk-go/service/s3/platform_handlers_go1.6.go b/vendor/github.com/aws/aws-sdk-go/service/s3/platform_handlers_go1.6.go new file mode 100644 index 000000000..14d05f7b7 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/service/s3/platform_handlers_go1.6.go @@ -0,0 +1,28 @@ +// +build go1.6 + +package s3 + +import ( + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/request" +) + +func platformRequestHandlers(r *request.Request) { + if r.Operation.HTTPMethod == "PUT" { + // 100-Continue should only be used on put requests. + r.Handlers.Sign.PushBack(add100Continue) + } +} + +func add100Continue(r *request.Request) { + if aws.BoolValue(r.Config.S3Disable100Continue) { + return + } + if r.HTTPRequest.ContentLength < 1024*1024*2 { + // Ignore requests smaller than 2MB. This helps prevent delaying + // requests unnecessarily. + return + } + + r.HTTPRequest.Header.Set("Expect", "100-Continue") +} diff --git a/vendor/github.com/aws/aws-sdk-go/service/s3/s3iface/interface.go b/vendor/github.com/aws/aws-sdk-go/service/s3/s3iface/interface.go index 9e66afb34..e6f8796a1 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/s3/s3iface/interface.go +++ b/vendor/github.com/aws/aws-sdk-go/service/s3/s3iface/interface.go @@ -66,6 +66,10 @@ type S3API interface { DeleteObjects(*s3.DeleteObjectsInput) (*s3.DeleteObjectsOutput, error) + GetBucketAccelerateConfigurationRequest(*s3.GetBucketAccelerateConfigurationInput) (*request.Request, *s3.GetBucketAccelerateConfigurationOutput) + + GetBucketAccelerateConfiguration(*s3.GetBucketAccelerateConfigurationInput) (*s3.GetBucketAccelerateConfigurationOutput, error) + GetBucketAclRequest(*s3.GetBucketAclInput) (*request.Request, *s3.GetBucketAclOutput) GetBucketAcl(*s3.GetBucketAclInput) (*s3.GetBucketAclOutput, error) @@ -164,12 +168,22 @@ type S3API interface { ListObjectsPages(*s3.ListObjectsInput, func(*s3.ListObjectsOutput, bool) bool) error + ListObjectsV2Request(*s3.ListObjectsV2Input) (*request.Request, *s3.ListObjectsV2Output) + + ListObjectsV2(*s3.ListObjectsV2Input) (*s3.ListObjectsV2Output, error) + + ListObjectsV2Pages(*s3.ListObjectsV2Input, func(*s3.ListObjectsV2Output, bool) bool) error + ListPartsRequest(*s3.ListPartsInput) (*request.Request, *s3.ListPartsOutput) ListParts(*s3.ListPartsInput) (*s3.ListPartsOutput, error) ListPartsPages(*s3.ListPartsInput, func(*s3.ListPartsOutput, bool) bool) error + PutBucketAccelerateConfigurationRequest(*s3.PutBucketAccelerateConfigurationInput) (*request.Request, *s3.PutBucketAccelerateConfigurationOutput) + + PutBucketAccelerateConfiguration(*s3.PutBucketAccelerateConfigurationInput) (*s3.PutBucketAccelerateConfigurationOutput, error) + PutBucketAclRequest(*s3.PutBucketAclInput) (*request.Request, *s3.PutBucketAclOutput) PutBucketAcl(*s3.PutBucketAclInput) (*s3.PutBucketAclOutput, error) diff --git a/vendor/github.com/aws/aws-sdk-go/service/s3/s3manager/download.go b/vendor/github.com/aws/aws-sdk-go/service/s3/s3manager/download.go index 8d6d9310f..cb509ffc4 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/s3/s3manager/download.go +++ b/vendor/github.com/aws/aws-sdk-go/service/s3/s3manager/download.go @@ -34,7 +34,7 @@ type Downloader struct { PartSize int64 // The number of goroutines to spin up in parallel when sending parts. - // If this is set to zero, the DefaultConcurrency value will be used. + // If this is set to zero, the DefaultDownloadConcurrency value will be used. Concurrency int // An S3 client to use when performing downloads. @@ -49,7 +49,7 @@ type Downloader struct { // // Example: // // The session the S3 Downloader will use -// sess := session.New() +// sess, err := session.NewSession() // // // Create a downloader with the session and default options // downloader := s3manager.NewDownloader(sess) @@ -77,8 +77,11 @@ func NewDownloader(c client.ConfigProvider, options ...func(*Downloader)) *Downl // to make S3 API calls. // // Example: +// // The session the S3 Downloader will use +// sess, err := session.NewSession() +// // // The S3 client the S3 Downloader will use -// s3Svc := s3.new(session.New()) +// s3Svc := s3.new(sess) // // // Create a downloader with the s3 client and default options // downloader := s3manager.NewDownloaderWithClient(s3Svc) @@ -170,7 +173,7 @@ func (d *downloader) download() (n int64, err error) { // Assign work for d.getErr() == nil { if d.pos >= total { - break // We're finished queueing chunks + break // We're finished queuing chunks } // Queue the next range of bytes to read. diff --git a/vendor/github.com/aws/aws-sdk-go/service/s3/s3manager/upload.go b/vendor/github.com/aws/aws-sdk-go/service/s3/s3manager/upload.go index 44ee75a17..70add6c3f 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/s3/s3manager/upload.go +++ b/vendor/github.com/aws/aws-sdk-go/service/s3/s3manager/upload.go @@ -8,6 +8,7 @@ import ( "sync" "time" + "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/awserr" "github.com/aws/aws-sdk-go/aws/awsutil" "github.com/aws/aws-sdk-go/aws/client" @@ -42,7 +43,7 @@ const DefaultUploadConcurrency = 5 // u := s3manager.NewUploader(opts) // output, err := u.upload(input) // if err != nil { -// if multierr, ok := err.(MultiUploadFailure); ok { +// if multierr, ok := err.(s3manager.MultiUploadFailure); ok { // // Process error and its associated uploadID // fmt.Println("Error:", multierr.Code(), multierr.Message(), multierr.UploadID()) // } else { @@ -165,7 +166,7 @@ type UploadInput struct { // requests for an object protected by AWS KMS will fail if not made via SSL // or using SigV4. Documentation on configuring any of the officially supported // AWS SDKs and CLI can be found at http://docs.aws.amazon.com/AmazonS3/latest/dev/UsingAWSSDK.html#specify-signature-version - SSEKMSKeyID *string `location:"header" locationName:"x-amz-server-side-encryption-aws-kms-key-id" type:"string"` + SSEKMSKeyId *string `location:"header" locationName:"x-amz-server-side-encryption-aws-kms-key-id" type:"string"` // The Server-side encryption algorithm used when storing this object in S3 // (e.g., AES256, aws:kms). @@ -208,7 +209,7 @@ type Uploader struct { PartSize int64 // The number of goroutines to spin up in parallel when sending parts. - // If this is set to zero, the DefaultConcurrency value will be used. + // If this is set to zero, the DefaultUploadConcurrency value will be used. Concurrency int // Setting this value to true will cause the SDK to avoid calling @@ -237,7 +238,7 @@ type Uploader struct { // // Example: // // The session the S3 Uploader will use -// sess := session.New() +// sess, err := session.NewSession() // // // Create an uploader with the session and default options // uploader := s3manager.NewUploader(sess) @@ -267,8 +268,11 @@ func NewUploader(c client.ConfigProvider, options ...func(*Uploader)) *Uploader // a S3 service client to make S3 API calls. // // Example: +// // The session the S3 Uploader will use +// sess, err := session.NewSession() +// // // S3 service client the Upload manager will use. -// s3Svc := s3.New(session.New()) +// s3Svc := s3.New(sess) // // // Create an uploader with S3 client and default options // uploader := s3manager.NewUploaderWithClient(s3Svc) @@ -317,7 +321,7 @@ func NewUploaderWithClient(svc s3iface.S3API, options ...func(*Uploader)) *Uploa // // Perform upload with options different than the those in the Uploader. // result, err := uploader.Upload(upParams, func(u *s3manager.Uploader) { // u.PartSize = 10 * 1024 * 1024 // 10MB part size -// u.LeavePartsOnError = true // Dont delete the parts if the upload fails. +// u.LeavePartsOnError = true // Don't delete the parts if the upload fails. // }) func (u Uploader) Upload(input *UploadInput, options ...func(*Uploader)) (*UploadOutput, error) { i := uploader{in: input, ctx: u} @@ -350,15 +354,15 @@ func (u *uploader) upload() (*UploadOutput, error) { } // Do one read to determine if we have more than one part - buf, err := u.nextReader() - if err == io.EOF || err == io.ErrUnexpectedEOF { // single part - return u.singlePart(buf) + reader, _, err := u.nextReader() + if err == io.EOF { // single part + return u.singlePart(reader) } else if err != nil { return nil, awserr.New("ReadRequestBody", "read upload data failed", err) } mu := multiuploader{uploader: u} - return mu.upload(buf) + return mu.upload(reader) } // init will initialize all default options. @@ -404,7 +408,7 @@ func (u *uploader) initSize() { // This operation increases the shared u.readerPos counter, but note that it // does not need to be wrapped in a mutex because nextReader is only called // from the main thread. -func (u *uploader) nextReader() (io.ReadSeeker, error) { +func (u *uploader) nextReader() (io.ReadSeeker, int, error) { switch r := u.in.Body.(type) { case io.ReaderAt: var err error @@ -413,29 +417,36 @@ func (u *uploader) nextReader() (io.ReadSeeker, error) { if u.totalSize >= 0 { bytesLeft := u.totalSize - u.readerPos - if bytesLeft == 0 { + if bytesLeft <= u.ctx.PartSize { err = io.EOF n = bytesLeft - } else if bytesLeft <= u.ctx.PartSize { - err = io.ErrUnexpectedEOF - n = bytesLeft } } - buf := io.NewSectionReader(r, u.readerPos, n) + reader := io.NewSectionReader(r, u.readerPos, n) u.readerPos += n - return buf, err + return reader, int(n), err default: - packet := make([]byte, u.ctx.PartSize) - n, err := io.ReadFull(u.in.Body, packet) + part := make([]byte, u.ctx.PartSize) + n, err := readFillBuf(r, part) u.readerPos += int64(n) - return bytes.NewReader(packet[0:n]), err + return bytes.NewReader(part[0:n]), n, err } } +func readFillBuf(r io.Reader, b []byte) (offset int, err error) { + for offset < len(b) && err == nil { + var n int + n, err = r.Read(b[offset:]) + offset += n + } + + return offset, err +} + // singlePart contains upload logic for uploading a single chunk via // a regular PutObject request. Multipart requests require at least two // parts, or at least 5MB of data. @@ -507,7 +518,9 @@ func (u *multiuploader) upload(firstBuf io.ReadSeeker) (*UploadOutput, error) { ch <- chunk{buf: firstBuf, num: num} // Read and queue the rest of the parts - for u.geterr() == nil { + var err error + for u.geterr() == nil && err == nil { + num++ // This upload exceeded maximum number of supported parts, error now. if num > int64(u.ctx.MaxUploadParts) || num > int64(MaxUploadParts) { var msg string @@ -521,22 +534,27 @@ func (u *multiuploader) upload(firstBuf io.ReadSeeker) (*UploadOutput, error) { u.seterr(awserr.New("TotalPartsExceeded", msg, nil)) break } - num++ - buf, err := u.nextReader() - if err == io.EOF { - break - } + var reader io.ReadSeeker + var nextChunkLen int + reader, nextChunkLen, err = u.nextReader() - ch <- chunk{buf: buf, num: num} - - if err != nil && err != io.ErrUnexpectedEOF { + if err != nil && err != io.EOF { u.seterr(awserr.New( "ReadRequestBody", "read multipart upload data failed", err)) break } + + if nextChunkLen == 0 { + // No need to upload empty part, if file was empty to start + // with empty single part would of been created and never + // started multipart upload. + break + } + + ch <- chunk{buf: reader, num: num} } // Close the channel, wait for workers, and complete upload @@ -554,7 +572,7 @@ func (u *multiuploader) upload(firstBuf io.ReadSeeker) (*UploadOutput, error) { } } return &UploadOutput{ - Location: *complete.Location, + Location: aws.StringValue(complete.Location), VersionID: complete.VersionId, UploadID: u.uploadID, }, nil diff --git a/vendor/github.com/aws/aws-sdk-go/service/s3/service.go b/vendor/github.com/aws/aws-sdk-go/service/s3/service.go index cf01da535..5833952a2 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/s3/service.go +++ b/vendor/github.com/aws/aws-sdk-go/service/s3/service.go @@ -7,8 +7,8 @@ import ( "github.com/aws/aws-sdk-go/aws/client" "github.com/aws/aws-sdk-go/aws/client/metadata" "github.com/aws/aws-sdk-go/aws/request" + "github.com/aws/aws-sdk-go/aws/signer/v4" "github.com/aws/aws-sdk-go/private/protocol/restxml" - "github.com/aws/aws-sdk-go/private/signer/v4" ) // S3 is a client for Amazon S3. @@ -58,7 +58,7 @@ func newClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegio } // Handlers - svc.Handlers.Sign.PushBack(v4.Sign) + svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler) svc.Handlers.Build.PushBackNamed(restxml.BuildHandler) svc.Handlers.Unmarshal.PushBackNamed(restxml.UnmarshalHandler) svc.Handlers.UnmarshalMeta.PushBackNamed(restxml.UnmarshalMetaHandler) diff --git a/vendor/github.com/aws/aws-sdk-go/service/s3/unmarshal_error.go b/vendor/github.com/aws/aws-sdk-go/service/s3/unmarshal_error.go index cd6004825..ed91c5872 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/s3/unmarshal_error.go +++ b/vendor/github.com/aws/aws-sdk-go/service/s3/unmarshal_error.go @@ -4,6 +4,7 @@ import ( "encoding/xml" "fmt" "io" + "io/ioutil" "net/http" "strings" @@ -20,7 +21,10 @@ type xmlErrorResponse struct { func unmarshalError(r *request.Request) { defer r.HTTPResponse.Body.Close() + defer io.Copy(ioutil.Discard, r.HTTPResponse.Body) + // Bucket exists in a different region, and request needs + // to be made to the correct region. if r.HTTPResponse.StatusCode == http.StatusMovedPermanently { r.Error = awserr.NewRequestFailure( awserr.New("BucketRegionError", @@ -33,25 +37,29 @@ func unmarshalError(r *request.Request) { return } - if r.HTTPResponse.ContentLength == 0 { - // No body, use status code to generate an awserr.Error - r.Error = awserr.NewRequestFailure( - awserr.New(strings.Replace(r.HTTPResponse.Status, " ", "", -1), r.HTTPResponse.Status, nil), - r.HTTPResponse.StatusCode, - r.RequestID, - ) - return - } + var errCode, errMsg string + // Attempt to parse error from body if it is known resp := &xmlErrorResponse{} err := xml.NewDecoder(r.HTTPResponse.Body).Decode(resp) if err != nil && err != io.EOF { - r.Error = awserr.New("SerializationError", "failed to decode S3 XML error response", nil) + errCode = "SerializationError" + errMsg = "failed to decode S3 XML error response" } else { - r.Error = awserr.NewRequestFailure( - awserr.New(resp.Code, resp.Message, nil), - r.HTTPResponse.StatusCode, - r.RequestID, - ) + errCode = resp.Code + errMsg = resp.Message } + + // Fallback to status code converted to message if still no error code + if len(errCode) == 0 { + statusText := http.StatusText(r.HTTPResponse.StatusCode) + errCode = strings.Replace(statusText, " ", "", -1) + errMsg = statusText + } + + r.Error = awserr.NewRequestFailure( + awserr.New(errCode, errMsg, nil), + r.HTTPResponse.StatusCode, + r.RequestID, + ) } diff --git a/vendor/github.com/aws/aws-sdk-go/service/s3/waiters.go b/vendor/github.com/aws/aws-sdk-go/service/s3/waiters.go index 4879fca8a..cbd3d3116 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/s3/waiters.go +++ b/vendor/github.com/aws/aws-sdk-go/service/s3/waiters.go @@ -18,6 +18,12 @@ func (c *S3) WaitUntilBucketExists(input *HeadBucketInput) error { Argument: "", Expected: 200, }, + { + State: "success", + Matcher: "status", + Argument: "", + Expected: 301, + }, { State: "success", Matcher: "status", diff --git a/vendor/github.com/aws/aws-sdk-go/service/sts/api.go b/vendor/github.com/aws/aws-sdk-go/service/sts/api.go index a6c09f7c7..f11e8675f 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/sts/api.go +++ b/vendor/github.com/aws/aws-sdk-go/service/sts/api.go @@ -12,7 +12,28 @@ import ( const opAssumeRole = "AssumeRole" -// AssumeRoleRequest generates a request for the AssumeRole operation. +// AssumeRoleRequest generates a "aws/request.Request" representing the +// client's request for the AssumeRole operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the AssumeRole method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the AssumeRoleRequest method. +// req, resp := client.AssumeRoleRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *STS) AssumeRoleRequest(input *AssumeRoleInput) (req *request.Request, output *AssumeRoleOutput) { op := &request.Operation{ Name: opAssumeRole, @@ -33,11 +54,15 @@ func (c *STS) AssumeRoleRequest(input *AssumeRoleInput) (req *request.Request, o // Returns a set of temporary security credentials (consisting of an access // key ID, a secret access key, and a security token) that you can use to access // AWS resources that you might not normally have access to. Typically, you -// use AssumeRole for cross-account access or federation. +// use AssumeRole for cross-account access or federation. For a comparison of +// AssumeRole with the other APIs that produce temporary credentials, see Requesting +// Temporary Security Credentials (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html) +// and Comparing the AWS STS APIs (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html#stsapi_comparison) +// in the IAM User Guide. // -// Important: You cannot call AssumeRole by using AWS account credentials; -// access will be denied. You must use IAM user credentials or temporary security -// credentials to call AssumeRole. +// Important: You cannot call AssumeRole by using AWS root account credentials; +// access is denied. You must use credentials for an IAM user or an IAM role +// to call AssumeRole. // // For cross-account access, imagine that you own multiple accounts and need // to access resources in each account. You could create long-term credentials @@ -47,7 +72,7 @@ func (c *STS) AssumeRoleRequest(input *AssumeRoleInput) (req *request.Request, o // then use temporary security credentials to access all the other accounts // by assuming roles in those accounts. For more information about roles, see // IAM Roles (Delegation and Federation) (http://docs.aws.amazon.com/IAM/latest/UserGuide/roles-toplevel.html) -// in the Using IAM. +// in the IAM User Guide. // // For federation, you can, for example, grant single sign-on access to the // AWS Management Console. If you already have an identity and authentication @@ -58,11 +83,15 @@ func (c *STS) AssumeRoleRequest(input *AssumeRoleInput) (req *request.Request, o // that user. With those temporary security credentials, you construct a sign-in // URL that users can use to access the console. For more information, see Common // Scenarios for Temporary Credentials (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp.html#sts-introduction) -// in the Using IAM. +// in the IAM User Guide. // // The temporary security credentials are valid for the duration that you specified -// when calling AssumeRole, which can be from 900 seconds (15 minutes) to 3600 -// seconds (1 hour). The default is 1 hour. +// when calling AssumeRole, which can be from 900 seconds (15 minutes) to a +// maximum of 3600 seconds (1 hour). The default is 1 hour. +// +// The temporary security credentials created by AssumeRole can be used to +// make API calls to any AWS service with the following exception: you cannot +// call the STS service's GetFederationToken or GetSessionToken APIs. // // Optionally, you can pass an IAM access policy to this operation. If you // choose not to pass a policy, the temporary security credentials that are @@ -70,17 +99,26 @@ func (c *STS) AssumeRoleRequest(input *AssumeRoleInput) (req *request.Request, o // policy of the role that is being assumed. If you pass a policy to this operation, // the temporary security credentials that are returned by the operation have // the permissions that are allowed by both the access policy of the role that -// is being assumed, and the policy that you pass. This gives you a way to further -// restrict the permissions for the resulting temporary security credentials. +// is being assumed, and the policy that you pass. This gives you a way to +// further restrict the permissions for the resulting temporary security credentials. // You cannot use the passed policy to grant permissions that are in excess // of those allowed by the access policy of the role that is being assumed. // For more information, see Permissions for AssumeRole, AssumeRoleWithSAML, // and AssumeRoleWithWebIdentity (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_control-access_assumerole.html) -// in the Using IAM. +// in the IAM User Guide. // // To assume a role, your AWS account must be trusted by the role. The trust // relationship is defined in the role's trust policy when the role is created. -// You must also have a policy that allows you to call sts:AssumeRole. +// That trust policy states which accounts are allowed to delegate access to +// this account's role. +// +// The user who wants to access the role must also have permissions delegated +// from the role's administrator. If the user is in a different account than +// the role, then the user's administrator must attach a policy that allows +// the user to call AssumeRole on the ARN of the role in the other account. +// If the user is in the same account as the role, then you can either attach +// a policy to the user (identical to the previous different account user), +// or you can add the user as a principal directly in the role's trust policy // // Using MFA with AssumeRole // @@ -96,7 +134,7 @@ func (c *STS) AssumeRoleRequest(input *AssumeRoleInput) (req *request.Request, o // "Condition": {"Bool": {"aws:MultiFactorAuthPresent": true}} // // For more information, see Configuring MFA-Protected API Access (http://docs.aws.amazon.com/IAM/latest/UserGuide/MFAProtectedAPI.html) -// in the Using IAM guide. +// in the IAM User Guide guide. // // To use MFA with AssumeRole, you pass values for the SerialNumber and TokenCode // parameters. The SerialNumber value identifies the user's hardware or virtual @@ -110,7 +148,28 @@ func (c *STS) AssumeRole(input *AssumeRoleInput) (*AssumeRoleOutput, error) { const opAssumeRoleWithSAML = "AssumeRoleWithSAML" -// AssumeRoleWithSAMLRequest generates a request for the AssumeRoleWithSAML operation. +// AssumeRoleWithSAMLRequest generates a "aws/request.Request" representing the +// client's request for the AssumeRoleWithSAML operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the AssumeRoleWithSAML method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the AssumeRoleWithSAMLRequest method. +// req, resp := client.AssumeRoleWithSAMLRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *STS) AssumeRoleWithSAMLRequest(input *AssumeRoleWithSAMLInput) (req *request.Request, output *AssumeRoleWithSAMLOutput) { op := &request.Operation{ Name: opAssumeRoleWithSAML, @@ -131,31 +190,40 @@ func (c *STS) AssumeRoleWithSAMLRequest(input *AssumeRoleWithSAMLInput) (req *re // Returns a set of temporary security credentials for users who have been authenticated // via a SAML authentication response. This operation provides a mechanism for // tying an enterprise identity store or directory to role-based AWS access -// without user-specific credentials or configuration. +// without user-specific credentials or configuration. For a comparison of AssumeRoleWithSAML +// with the other APIs that produce temporary credentials, see Requesting Temporary +// Security Credentials (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html) +// and Comparing the AWS STS APIs (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html#stsapi_comparison) +// in the IAM User Guide. // // The temporary security credentials returned by this operation consist of // an access key ID, a secret access key, and a security token. Applications // can use these temporary security credentials to sign calls to AWS services. -// The credentials are valid for the duration that you specified when calling -// AssumeRoleWithSAML, which can be up to 3600 seconds (1 hour) or until the -// time specified in the SAML authentication response's SessionNotOnOrAfter -// value, whichever is shorter. // -// The maximum duration for a session is 1 hour, and the minimum duration is -// 15 minutes, even if values outside this range are specified. Optionally, -// you can pass an IAM access policy to this operation. If you choose not to -// pass a policy, the temporary security credentials that are returned by the -// operation have the permissions that are defined in the access policy of the -// role that is being assumed. If you pass a policy to this operation, the temporary -// security credentials that are returned by the operation have the permissions -// that are allowed by both the access policy of the role that is being assumed, -// and the policy that you pass. This gives you a way to further restrict the -// permissions for the resulting temporary security credentials. You cannot -// use the passed policy to grant permissions that are in excess of those allowed -// by the access policy of the role that is being assumed. For more information, -// see Permissions for AssumeRole, AssumeRoleWithSAML, and AssumeRoleWithWebIdentity -// (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_control-access_assumerole.html) -// in the Using IAM. +// The temporary security credentials are valid for the duration that you specified +// when calling AssumeRole, or until the time specified in the SAML authentication +// response's SessionNotOnOrAfter value, whichever is shorter. The duration +// can be from 900 seconds (15 minutes) to a maximum of 3600 seconds (1 hour). +// The default is 1 hour. +// +// The temporary security credentials created by AssumeRoleWithSAML can be +// used to make API calls to any AWS service with the following exception: you +// cannot call the STS service's GetFederationToken or GetSessionToken APIs. +// +// Optionally, you can pass an IAM access policy to this operation. If you +// choose not to pass a policy, the temporary security credentials that are +// returned by the operation have the permissions that are defined in the access +// policy of the role that is being assumed. If you pass a policy to this operation, +// the temporary security credentials that are returned by the operation have +// the permissions that are allowed by the intersection of both the access policy +// of the role that is being assumed, and the policy that you pass. This means +// that both policies must grant the permission for the action to be allowed. +// This gives you a way to further restrict the permissions for the resulting +// temporary security credentials. You cannot use the passed policy to grant +// permissions that are in excess of those allowed by the access policy of the +// role that is being assumed. For more information, see Permissions for AssumeRole, +// AssumeRoleWithSAML, and AssumeRoleWithWebIdentity (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_control-access_assumerole.html) +// in the IAM User Guide. // // Before your application can call AssumeRoleWithSAML, you must configure // your SAML identity provider (IdP) to issue the claims required by AWS. Additionally, @@ -167,13 +235,25 @@ func (c *STS) AssumeRoleWithSAMLRequest(input *AssumeRoleWithSAMLInput) (req *re // The identity of the caller is validated by using keys in the metadata document // that is uploaded for the SAML provider entity for your identity provider. // -// For more information, see the following resources: +// Calling AssumeRoleWithSAML can result in an entry in your AWS CloudTrail +// logs. The entry includes the value in the NameID element of the SAML assertion. +// We recommend that you use a NameIDType that is not associated with any personally +// identifiable information (PII). For example, you could instead use the Persistent +// Identifier (urn:oasis:names:tc:SAML:2.0:nameid-format:persistent). // -// About SAML 2.0-based Federation (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_providers_saml.html) -// in the Using IAM. Creating SAML Identity Providers (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_providers_create_saml.html) -// in the Using IAM. Configuring a Relying Party and Claims (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_providers_create_saml_relying-party.html) -// in the Using IAM. Creating a Role for SAML 2.0 Federation (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_create_for-idp_saml.html) -// in the Using IAM. +// For more information, see the following resources: +// +// About SAML 2.0-based Federation (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_providers_saml.html) +// in the IAM User Guide. +// +// Creating SAML Identity Providers (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_providers_create_saml.html) +// in the IAM User Guide. +// +// Configuring a Relying Party and Claims (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_providers_create_saml_relying-party.html) +// in the IAM User Guide. +// +// Creating a Role for SAML 2.0 Federation (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_create_for-idp_saml.html) +// in the IAM User Guide. func (c *STS) AssumeRoleWithSAML(input *AssumeRoleWithSAMLInput) (*AssumeRoleWithSAMLOutput, error) { req, out := c.AssumeRoleWithSAMLRequest(input) err := req.Send() @@ -182,7 +262,28 @@ func (c *STS) AssumeRoleWithSAML(input *AssumeRoleWithSAMLInput) (*AssumeRoleWit const opAssumeRoleWithWebIdentity = "AssumeRoleWithWebIdentity" -// AssumeRoleWithWebIdentityRequest generates a request for the AssumeRoleWithWebIdentity operation. +// AssumeRoleWithWebIdentityRequest generates a "aws/request.Request" representing the +// client's request for the AssumeRoleWithWebIdentity operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the AssumeRoleWithWebIdentity method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the AssumeRoleWithWebIdentityRequest method. +// req, resp := client.AssumeRoleWithWebIdentityRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *STS) AssumeRoleWithWebIdentityRequest(input *AssumeRoleWithWebIdentityInput) (req *request.Request, output *AssumeRoleWithWebIdentityOutput) { op := &request.Operation{ Name: opAssumeRoleWithWebIdentity, @@ -222,13 +323,22 @@ func (c *STS) AssumeRoleWithWebIdentityRequest(input *AssumeRoleWithWebIdentityI // long-term AWS credentials in the application, and without deploying server-based // proxy services that use long-term AWS credentials. Instead, the identity // of the caller is validated by using a token from the web identity provider. +// For a comparison of AssumeRoleWithWebIdentity with the other APIs that produce +// temporary credentials, see Requesting Temporary Security Credentials (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html) +// and Comparing the AWS STS APIs (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html#stsapi_comparison) +// in the IAM User Guide. // // The temporary security credentials returned by this API consist of an access // key ID, a secret access key, and a security token. Applications can use these -// temporary security credentials to sign calls to AWS service APIs. The credentials -// are valid for the duration that you specified when calling AssumeRoleWithWebIdentity, -// which can be from 900 seconds (15 minutes) to 3600 seconds (1 hour). By default, -// the temporary security credentials are valid for 1 hour. +// temporary security credentials to sign calls to AWS service APIs. +// +// The credentials are valid for the duration that you specified when calling +// AssumeRoleWithWebIdentity, which can be from 900 seconds (15 minutes) to +// a maximum of 3600 seconds (1 hour). The default is 1 hour. +// +// The temporary security credentials created by AssumeRoleWithWebIdentity +// can be used to make API calls to any AWS service with the following exception: +// you cannot call the STS service's GetFederationToken or GetSessionToken APIs. // // Optionally, you can pass an IAM access policy to this operation. If you // choose not to pass a policy, the temporary security credentials that are @@ -236,13 +346,13 @@ func (c *STS) AssumeRoleWithWebIdentityRequest(input *AssumeRoleWithWebIdentityI // policy of the role that is being assumed. If you pass a policy to this operation, // the temporary security credentials that are returned by the operation have // the permissions that are allowed by both the access policy of the role that -// is being assumed, and the policy that you pass. This gives you a way to further -// restrict the permissions for the resulting temporary security credentials. +// is being assumed, and the policy that you pass. This gives you a way to +// further restrict the permissions for the resulting temporary security credentials. // You cannot use the passed policy to grant permissions that are in excess // of those allowed by the access policy of the role that is being assumed. // For more information, see Permissions for AssumeRole, AssumeRoleWithSAML, // and AssumeRoleWithWebIdentity (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_control-access_assumerole.html) -// in the Using IAM. +// in the IAM User Guide. // // Before your application can call AssumeRoleWithWebIdentity, you must have // an identity token from a supported identity provider and create a role that @@ -250,19 +360,30 @@ func (c *STS) AssumeRoleWithWebIdentityRequest(input *AssumeRoleWithWebIdentityI // the identity provider that is associated with the identity token. In other // words, the identity provider must be specified in the role's trust policy. // -// For more information about how to use web identity federation and the AssumeRoleWithWebIdentity +// Calling AssumeRoleWithWebIdentity can result in an entry in your AWS CloudTrail +// logs. The entry includes the Subject (http://openid.net/specs/openid-connect-core-1_0.html#Claims) +// of the provided Web Identity Token. We recommend that you avoid using any +// personally identifiable information (PII) in this field. For example, you +// could instead use a GUID or a pairwise identifier, as suggested in the OIDC +// specification (http://openid.net/specs/openid-connect-core-1_0.html#SubjectIDTypes). +// +// For more information about how to use web identity federation and the AssumeRoleWithWebIdentity // API, see the following resources: // -// Using Web Identity Federation APIs for Mobile Apps (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_providers_oidc_manual) +// Using Web Identity Federation APIs for Mobile Apps (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_providers_oidc_manual) // and Federation Through a Web-based Identity Provider (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html#api_assumerolewithwebidentity). -// Web Identity Federation Playground (https://web-identity-federation-playground.s3.amazonaws.com/index.html). +// +// Web Identity Federation Playground (https://web-identity-federation-playground.s3.amazonaws.com/index.html). // This interactive website lets you walk through the process of authenticating // via Login with Amazon, Facebook, or Google, getting temporary security credentials, -// and then using those credentials to make a request to AWS. AWS SDK for iOS -// (http://aws.amazon.com/sdkforios/) and AWS SDK for Android (http://aws.amazon.com/sdkforandroid/). -// These toolkits contain sample apps that show how to invoke the identity providers, -// and then how to use the information from these providers to get and use temporary -// security credentials. Web Identity Federation with Mobile Applications (http://aws.amazon.com/articles/4617974389850313). +// and then using those credentials to make a request to AWS. +// +// AWS SDK for iOS (http://aws.amazon.com/sdkforios/) and AWS SDK for Android +// (http://aws.amazon.com/sdkforandroid/). These toolkits contain sample apps +// that show how to invoke the identity providers, and then how to use the information +// from these providers to get and use temporary security credentials. +// +// Web Identity Federation with Mobile Applications (http://aws.amazon.com/articles/4617974389850313). // This article discusses web identity federation and shows an example of how // to use web identity federation to get access to content in Amazon S3. func (c *STS) AssumeRoleWithWebIdentity(input *AssumeRoleWithWebIdentityInput) (*AssumeRoleWithWebIdentityOutput, error) { @@ -273,7 +394,28 @@ func (c *STS) AssumeRoleWithWebIdentity(input *AssumeRoleWithWebIdentityInput) ( const opDecodeAuthorizationMessage = "DecodeAuthorizationMessage" -// DecodeAuthorizationMessageRequest generates a request for the DecodeAuthorizationMessage operation. +// DecodeAuthorizationMessageRequest generates a "aws/request.Request" representing the +// client's request for the DecodeAuthorizationMessage operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the DecodeAuthorizationMessage method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the DecodeAuthorizationMessageRequest method. +// req, resp := client.DecodeAuthorizationMessageRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *STS) DecodeAuthorizationMessageRequest(input *DecodeAuthorizationMessageInput) (req *request.Request, output *DecodeAuthorizationMessageOutput) { op := &request.Operation{ Name: opDecodeAuthorizationMessage, @@ -301,29 +443,107 @@ func (c *STS) DecodeAuthorizationMessageRequest(input *DecodeAuthorizationMessag // // Only certain AWS actions return an encoded authorization message. The documentation // for an individual action indicates whether that action returns an encoded -// message in addition to returning an HTTP code. The message is encoded because -// the details of the authorization status can constitute privileged information -// that the user who requested the action should not see. To decode an authorization -// status message, a user must be granted permissions via an IAM policy to request -// the DecodeAuthorizationMessage (sts:DecodeAuthorizationMessage) action. +// message in addition to returning an HTTP code. +// +// The message is encoded because the details of the authorization status +// can constitute privileged information that the user who requested the action +// should not see. To decode an authorization status message, a user must be +// granted permissions via an IAM policy to request the DecodeAuthorizationMessage +// (sts:DecodeAuthorizationMessage) action. // // The decoded message includes the following type of information: // -// Whether the request was denied due to an explicit deny or due to the absence +// Whether the request was denied due to an explicit deny or due to the absence // of an explicit allow. For more information, see Determining Whether a Request // is Allowed or Denied (http://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_evaluation-logic.html#policy-eval-denyallow) -// in the Using IAM. The principal who made the request. The requested action. -// The requested resource. The values of condition keys in the context of the -// user's request. +// in the IAM User Guide. +// +// The principal who made the request. +// +// The requested action. +// +// The requested resource. +// +// The values of condition keys in the context of the user's request. func (c *STS) DecodeAuthorizationMessage(input *DecodeAuthorizationMessageInput) (*DecodeAuthorizationMessageOutput, error) { req, out := c.DecodeAuthorizationMessageRequest(input) err := req.Send() return out, err } +const opGetCallerIdentity = "GetCallerIdentity" + +// GetCallerIdentityRequest generates a "aws/request.Request" representing the +// client's request for the GetCallerIdentity operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the GetCallerIdentity method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the GetCallerIdentityRequest method. +// req, resp := client.GetCallerIdentityRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +func (c *STS) GetCallerIdentityRequest(input *GetCallerIdentityInput) (req *request.Request, output *GetCallerIdentityOutput) { + op := &request.Operation{ + Name: opGetCallerIdentity, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &GetCallerIdentityInput{} + } + + req = c.newRequest(op, input, output) + output = &GetCallerIdentityOutput{} + req.Data = output + return +} + +// Returns details about the IAM identity whose credentials are used to call +// the API. +func (c *STS) GetCallerIdentity(input *GetCallerIdentityInput) (*GetCallerIdentityOutput, error) { + req, out := c.GetCallerIdentityRequest(input) + err := req.Send() + return out, err +} + const opGetFederationToken = "GetFederationToken" -// GetFederationTokenRequest generates a request for the GetFederationToken operation. +// GetFederationTokenRequest generates a "aws/request.Request" representing the +// client's request for the GetFederationToken operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the GetFederationToken method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the GetFederationTokenRequest method. +// req, resp := client.GetFederationTokenRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *STS) GetFederationTokenRequest(input *GetFederationTokenInput) (req *request.Request, output *GetFederationTokenOutput) { op := &request.Operation{ Name: opGetFederationToken, @@ -348,6 +568,10 @@ func (c *STS) GetFederationTokenRequest(input *GetFederationTokenInput) (req *re // you must call the GetFederationToken action using the long-term security // credentials of an IAM user, this call is appropriate in contexts where those // credentials can be safely stored, usually in a server-based application. +// For a comparison of GetFederationToken with the other APIs that produce temporary +// credentials, see Requesting Temporary Security Credentials (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html) +// and Comparing the AWS STS APIs (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html#stsapi_comparison) +// in the IAM User Guide. // // If you are creating a mobile-based or browser-based app that can authenticate // users using a web identity provider like Login with Amazon, Facebook, Google, @@ -358,35 +582,45 @@ func (c *STS) GetFederationTokenRequest(input *GetFederationTokenInput) (req *re // // The GetFederationToken action must be called by using the long-term AWS // security credentials of an IAM user. You can also call GetFederationToken -// using the security credentials of an AWS account (root), but this is not -// recommended. Instead, we recommend that you create an IAM user for the purpose -// of the proxy application and then attach a policy to the IAM user that limits -// federated users to only the actions and resources they need access to. For -// more information, see IAM Best Practices (http://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html) -// in the Using IAM. +// using the security credentials of an AWS root account, but we do not recommended +// it. Instead, we recommend that you create an IAM user for the purpose of +// the proxy application and then attach a policy to the IAM user that limits +// federated users to only the actions and resources that they need access to. +// For more information, see IAM Best Practices (http://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html) +// in the IAM User Guide. // // The temporary security credentials that are obtained by using the long-term -// credentials of an IAM user are valid for the specified duration, between -// 900 seconds (15 minutes) and 129600 seconds (36 hours). Temporary credentials -// that are obtained by using AWS account (root) credentials have a maximum -// duration of 3600 seconds (1 hour) +// credentials of an IAM user are valid for the specified duration, from 900 +// seconds (15 minutes) up to a maximium of 129600 seconds (36 hours). The default +// is 43200 seconds (12 hours). Temporary credentials that are obtained by using +// AWS root account credentials have a maximum duration of 3600 seconds (1 hour). // -// Permissions +// The temporary security credentials created by GetFederationToken can be +// used to make API calls to any AWS service with the following exceptions: +// +// You cannot use these credentials to call any IAM APIs. +// +// You cannot call any STS APIs. +// +// Permissions // // The permissions for the temporary security credentials returned by GetFederationToken // are determined by a combination of the following: // -// The policy or policies that are attached to the IAM user whose credentials -// are used to call GetFederationToken. The policy that is passed as a parameter -// in the call. The passed policy is attached to the temporary security credentials -// that result from the GetFederationToken API call--that is, to the federated -// user. When the federated user makes an AWS request, AWS evaluates the policy -// attached to the federated user in combination with the policy or policies -// attached to the IAM user whose credentials were used to call GetFederationToken. -// AWS allows the federated user's request only when both the federated user -// and the IAM user are explicitly allowed to perform the requested action. -// The passed policy cannot grant more permissions than those that are defined -// in the IAM user policy. +// The policy or policies that are attached to the IAM user whose credentials +// are used to call GetFederationToken. +// +// The policy that is passed as a parameter in the call. +// +// The passed policy is attached to the temporary security credentials that +// result from the GetFederationToken API call--that is, to the federated user. +// When the federated user makes an AWS request, AWS evaluates the policy attached +// to the federated user in combination with the policy or policies attached +// to the IAM user whose credentials were used to call GetFederationToken. AWS +// allows the federated user's request only when both the federated user and +// the IAM user are explicitly allowed to perform the requested action. The +// passed policy cannot grant more permissions than those that are defined in +// the IAM user policy. // // A typical use case is that the permissions of the IAM user whose credentials // are used to call GetFederationToken are designed to allow access to all the @@ -413,7 +647,28 @@ func (c *STS) GetFederationToken(input *GetFederationTokenInput) (*GetFederation const opGetSessionToken = "GetSessionToken" -// GetSessionTokenRequest generates a request for the GetSessionToken operation. +// GetSessionTokenRequest generates a "aws/request.Request" representing the +// client's request for the GetSessionToken operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the GetSessionToken method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the GetSessionTokenRequest method. +// req, resp := client.GetSessionTokenRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// func (c *STS) GetSessionTokenRequest(input *GetSessionTokenInput) (req *request.Request, output *GetSessionTokenOutput) { op := &request.Operation{ Name: opGetSessionToken, @@ -439,15 +694,29 @@ func (c *STS) GetSessionTokenRequest(input *GetSessionTokenInput) (req *request. // is associated with their MFA device. Using the temporary security credentials // that are returned from the call, IAM users can then make programmatic calls // to APIs that require MFA authentication. If you do not supply a correct MFA -// code, then the API returns an access denied error. +// code, then the API returns an access denied error. For a comparison of GetSessionToken +// with the other APIs that produce temporary credentials, see Requesting Temporary +// Security Credentials (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html) +// and Comparing the AWS STS APIs (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html#stsapi_comparison) +// in the IAM User Guide. // // The GetSessionToken action must be called by using the long-term AWS security // credentials of the AWS account or an IAM user. Credentials that are created -// by IAM users are valid for the duration that you specify, between 900 seconds -// (15 minutes) and 129600 seconds (36 hours); credentials that are created -// by using account credentials have a maximum duration of 3600 seconds (1 hour). +// by IAM users are valid for the duration that you specify, from 900 seconds +// (15 minutes) up to a maximum of 129600 seconds (36 hours), with a default +// of 43200 seconds (12 hours); credentials that are created by using account +// credentials can range from 900 seconds (15 minutes) up to a maximum of 3600 +// seconds (1 hour), with a default of 1 hour. // -// We recommend that you do not call GetSessionToken with root account credentials. +// The temporary security credentials created by GetSessionToken can be used +// to make API calls to any AWS service with the following exceptions: +// +// You cannot call any IAM APIs unless MFA authentication information is +// included in the request. +// +// You cannot call any STS API except AssumeRole. +// +// We recommend that you do not call GetSessionToken with root account credentials. // Instead, follow our best practices (http://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#create-iam-users) // by creating one or more IAM users, giving them the necessary permissions, // and using IAM users for everyday interaction with AWS. @@ -462,7 +731,7 @@ func (c *STS) GetSessionTokenRequest(input *GetSessionTokenInput) (req *request. // // For more information about using GetSessionToken to create temporary credentials, // go to Temporary Credentials for Users in Untrusted Environments (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html#api_getsessiontoken) -// in the Using IAM. +// in the IAM User Guide. func (c *STS) GetSessionToken(input *GetSessionTokenInput) (*GetSessionTokenOutput, error) { req, out := c.GetSessionTokenRequest(input) err := req.Send() @@ -475,6 +744,14 @@ type AssumeRoleInput struct { // The duration, in seconds, of the role session. The value can range from 900 // seconds (15 minutes) to 3600 seconds (1 hour). By default, the value is set // to 3600 seconds. + // + // This is separate from the duration of a console session that you might + // request using the returned credentials. The request to the federation endpoint + // for a console sign-in token takes a SessionDuration parameter that specifies + // the maximum length of the console session, separately from the DurationSeconds + // parameter on this API. For more information, see Creating a URL that Enables + // Federated Users to Access the AWS Management Console (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_providers_enable-console-custom-url.html) + // in the IAM User Guide. DurationSeconds *int64 `min:"900" type:"integer"` // A unique identifier that is used by third parties when assuming roles in @@ -485,7 +762,12 @@ type AssumeRoleInput struct { // ID is useful in order to help third parties bind a role to the customer who // created it. For more information about the external ID, see How to Use an // External ID When Granting Access to Your AWS Resources to a Third Party (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_create_for-user_externalid.html) - // in the Using IAM. + // in the IAM User Guide. + // + // The format for this parameter, as described by its regex pattern, is a string + // of characters consisting of upper- and lower-case alphanumeric characters + // with no spaces. You can also include underscores or any of the following + // characters: =,.@:\/- ExternalId *string `min:"2" type:"string"` // An IAM policy in JSON format. @@ -499,9 +781,15 @@ type AssumeRoleInput struct { // of those allowed by the access policy of the role that is being assumed. // For more information, see Permissions for AssumeRole, AssumeRoleWithSAML, // and AssumeRoleWithWebIdentity (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_control-access_assumerole.html) - // in the Using IAM. + // in the IAM User Guide. // - // The policy plain text must be 2048 bytes or shorter. However, an internal + // The format for this parameter, as described by its regex pattern, is a string + // of characters up to 2048 characters in length. The characters can be any + // ASCII character from the space character to the end of the valid character + // list (\u0020-\u00FF). It can also include the tab (\u0009), linefeed (\u000A), + // and carriage return (\u000D) characters. + // + // The policy plain text must be 2048 bytes or shorter. However, an internal // conversion compresses it into a packed binary format with a separate limit. // The PackedPolicySize response element indicates by percentage how close to // the upper size limit the policy is, with 100% equaling the maximum allowed @@ -520,6 +808,11 @@ type AssumeRoleInput struct { // of the assumed role principal. This means that subsequent cross-account API // requests using the temporary security credentials will expose the role session // name to the external account in their CloudTrail logs. + // + // The format for this parameter, as described by its regex pattern, is a string + // of characters consisting of upper- and lower-case alphanumeric characters + // with no spaces. You can also include underscores or any of the following + // characters: =,.@- RoleSessionName *string `min:"2" type:"string" required:"true"` // The identification number of the MFA device that is associated with the user @@ -527,12 +820,20 @@ type AssumeRoleInput struct { // of the role being assumed includes a condition that requires MFA authentication. // The value is either the serial number for a hardware device (such as GAHT12345678) // or an Amazon Resource Name (ARN) for a virtual device (such as arn:aws:iam::123456789012:mfa/user). + // + // The format for this parameter, as described by its regex pattern, is a string + // of characters consisting of upper- and lower-case alphanumeric characters + // with no spaces. You can also include underscores or any of the following + // characters: =,.@- SerialNumber *string `min:"9" type:"string"` // The value provided by the MFA device, if the trust policy of the role being // assumed requires MFA (that is, if the policy includes a condition that tests // for MFA). If the role being assumed requires MFA and if the TokenCode value // is missing or expired, the AssumeRole call returns an "access denied" error. + // + // The format for this parameter, as described by its regex pattern, is a sequence + // of six numeric digits. TokenCode *string `min:"6" type:"string"` } @@ -546,6 +847,43 @@ func (s AssumeRoleInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *AssumeRoleInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "AssumeRoleInput"} + if s.DurationSeconds != nil && *s.DurationSeconds < 900 { + invalidParams.Add(request.NewErrParamMinValue("DurationSeconds", 900)) + } + if s.ExternalId != nil && len(*s.ExternalId) < 2 { + invalidParams.Add(request.NewErrParamMinLen("ExternalId", 2)) + } + if s.Policy != nil && len(*s.Policy) < 1 { + invalidParams.Add(request.NewErrParamMinLen("Policy", 1)) + } + if s.RoleArn == nil { + invalidParams.Add(request.NewErrParamRequired("RoleArn")) + } + if s.RoleArn != nil && len(*s.RoleArn) < 20 { + invalidParams.Add(request.NewErrParamMinLen("RoleArn", 20)) + } + if s.RoleSessionName == nil { + invalidParams.Add(request.NewErrParamRequired("RoleSessionName")) + } + if s.RoleSessionName != nil && len(*s.RoleSessionName) < 2 { + invalidParams.Add(request.NewErrParamMinLen("RoleSessionName", 2)) + } + if s.SerialNumber != nil && len(*s.SerialNumber) < 9 { + invalidParams.Add(request.NewErrParamMinLen("SerialNumber", 9)) + } + if s.TokenCode != nil && len(*s.TokenCode) < 6 { + invalidParams.Add(request.NewErrParamMinLen("TokenCode", 6)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + // Contains the response to a successful AssumeRole request, including temporary // AWS credentials that can be used to make AWS requests. type AssumeRoleOutput struct { @@ -561,7 +899,7 @@ type AssumeRoleOutput struct { // The temporary security credentials, which include an access key ID, a secret // access key, and a security (or session) token. // - // Note: The size of the security token that STS APIs return is not fixed. + // Note: The size of the security token that STS APIs return is not fixed. // We strongly recommend that you make no assumptions about the maximum size. // As of this writing, the typical size is less than 4096 bytes, but that can // vary. Also, future updates to AWS might require larger sizes. @@ -592,8 +930,13 @@ type AssumeRoleWithSAMLInput struct { // response's SessionNotOnOrAfter value. The actual expiration time is whichever // value is shorter. // - // The maximum duration for a session is 1 hour, and the minimum duration is - // 15 minutes, even if values outside this range are specified. + // This is separate from the duration of a console session that you might + // request using the returned credentials. The request to the federation endpoint + // for a console sign-in token takes a SessionDuration parameter that specifies + // the maximum length of the console session, separately from the DurationSeconds + // parameter on this API. For more information, see Enabling SAML 2.0 Federated + // Users to Access the AWS Management Console (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_providers_enable-console-saml.html) + // in the IAM User Guide. DurationSeconds *int64 `min:"900" type:"integer"` // An IAM policy in JSON format. @@ -601,15 +944,21 @@ type AssumeRoleWithSAMLInput struct { // The policy parameter is optional. If you pass a policy, the temporary security // credentials that are returned by the operation have the permissions that // are allowed by both the access policy of the role that is being assumed, - // and the policy that you pass. This gives you a way to further restrict the - // permissions for the resulting temporary security credentials. You cannot + // and the policy that you pass. This gives you a way to further restrict + // the permissions for the resulting temporary security credentials. You cannot // use the passed policy to grant permissions that are in excess of those allowed // by the access policy of the role that is being assumed. For more information, // Permissions for AssumeRole, AssumeRoleWithSAML, and AssumeRoleWithWebIdentity // (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_control-access_assumerole.html) - // in the Using IAM. + // in the IAM User Guide. // - // The policy plain text must be 2048 bytes or shorter. However, an internal + // The format for this parameter, as described by its regex pattern, is a string + // of characters up to 2048 characters in length. The characters can be any + // ASCII character from the space character to the end of the valid character + // list (\u0020-\u00FF). It can also include the tab (\u0009), linefeed (\u000A), + // and carriage return (\u000D) characters. + // + // The policy plain text must be 2048 bytes or shorter. However, an internal // conversion compresses it into a packed binary format with a separate limit. // The PackedPolicySize response element indicates by percentage how close to // the upper size limit the policy is, with 100% equaling the maximum allowed @@ -641,6 +990,40 @@ func (s AssumeRoleWithSAMLInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *AssumeRoleWithSAMLInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "AssumeRoleWithSAMLInput"} + if s.DurationSeconds != nil && *s.DurationSeconds < 900 { + invalidParams.Add(request.NewErrParamMinValue("DurationSeconds", 900)) + } + if s.Policy != nil && len(*s.Policy) < 1 { + invalidParams.Add(request.NewErrParamMinLen("Policy", 1)) + } + if s.PrincipalArn == nil { + invalidParams.Add(request.NewErrParamRequired("PrincipalArn")) + } + if s.PrincipalArn != nil && len(*s.PrincipalArn) < 20 { + invalidParams.Add(request.NewErrParamMinLen("PrincipalArn", 20)) + } + if s.RoleArn == nil { + invalidParams.Add(request.NewErrParamRequired("RoleArn")) + } + if s.RoleArn != nil && len(*s.RoleArn) < 20 { + invalidParams.Add(request.NewErrParamMinLen("RoleArn", 20)) + } + if s.SAMLAssertion == nil { + invalidParams.Add(request.NewErrParamRequired("SAMLAssertion")) + } + if s.SAMLAssertion != nil && len(*s.SAMLAssertion) < 4 { + invalidParams.Add(request.NewErrParamMinLen("SAMLAssertion", 4)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + // Contains the response to a successful AssumeRoleWithSAML request, including // temporary AWS credentials that can be used to make AWS requests. type AssumeRoleWithSAMLOutput struct { @@ -657,7 +1040,7 @@ type AssumeRoleWithSAMLOutput struct { // The temporary security credentials, which include an access key ID, a secret // access key, and a security (or session) token. // - // Note: The size of the security token that STS APIs return is not fixed. + // Note: The size of the security token that STS APIs return is not fixed. // We strongly recommend that you make no assumptions about the maximum size. // As of this writing, the typical size is less than 4096 bytes, but that can // vary. Also, future updates to AWS might require larger sizes. @@ -712,6 +1095,14 @@ type AssumeRoleWithWebIdentityInput struct { // The duration, in seconds, of the role session. The value can range from 900 // seconds (15 minutes) to 3600 seconds (1 hour). By default, the value is set // to 3600 seconds. + // + // This is separate from the duration of a console session that you might + // request using the returned credentials. The request to the federation endpoint + // for a console sign-in token takes a SessionDuration parameter that specifies + // the maximum length of the console session, separately from the DurationSeconds + // parameter on this API. For more information, see Creating a URL that Enables + // Federated Users to Access the AWS Management Console (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_providers_enable-console-custom-url.html) + // in the IAM User Guide. DurationSeconds *int64 `min:"900" type:"integer"` // An IAM policy in JSON format. @@ -719,14 +1110,20 @@ type AssumeRoleWithWebIdentityInput struct { // The policy parameter is optional. If you pass a policy, the temporary security // credentials that are returned by the operation have the permissions that // are allowed by both the access policy of the role that is being assumed, - // and the policy that you pass. This gives you a way to further restrict the - // permissions for the resulting temporary security credentials. You cannot + // and the policy that you pass. This gives you a way to further restrict + // the permissions for the resulting temporary security credentials. You cannot // use the passed policy to grant permissions that are in excess of those allowed // by the access policy of the role that is being assumed. For more information, // see Permissions for AssumeRoleWithWebIdentity (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_control-access_assumerole.html) - // in the Using IAM. + // in the IAM User Guide. // - // The policy plain text must be 2048 bytes or shorter. However, an internal + // The format for this parameter, as described by its regex pattern, is a string + // of characters up to 2048 characters in length. The characters can be any + // ASCII character from the space character to the end of the valid character + // list (\u0020-\u00FF). It can also include the tab (\u0009), linefeed (\u000A), + // and carriage return (\u000D) characters. + // + // The policy plain text must be 2048 bytes or shorter. However, an internal // conversion compresses it into a packed binary format with a separate limit. // The PackedPolicySize response element indicates by percentage how close to // the upper size limit the policy is, with 100% equaling the maximum allowed @@ -750,6 +1147,11 @@ type AssumeRoleWithWebIdentityInput struct { // That way, the temporary security credentials that your application will use // are associated with that user. This session name is included as part of the // ARN and assumed role ID in the AssumedRoleUser response element. + // + // The format for this parameter, as described by its regex pattern, is a string + // of characters consisting of upper- and lower-case alphanumeric characters + // with no spaces. You can also include underscores or any of the following + // characters: =,.@- RoleSessionName *string `min:"2" type:"string" required:"true"` // The OAuth 2.0 access token or OpenID Connect ID token that is provided by @@ -769,6 +1171,43 @@ func (s AssumeRoleWithWebIdentityInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *AssumeRoleWithWebIdentityInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "AssumeRoleWithWebIdentityInput"} + if s.DurationSeconds != nil && *s.DurationSeconds < 900 { + invalidParams.Add(request.NewErrParamMinValue("DurationSeconds", 900)) + } + if s.Policy != nil && len(*s.Policy) < 1 { + invalidParams.Add(request.NewErrParamMinLen("Policy", 1)) + } + if s.ProviderId != nil && len(*s.ProviderId) < 4 { + invalidParams.Add(request.NewErrParamMinLen("ProviderId", 4)) + } + if s.RoleArn == nil { + invalidParams.Add(request.NewErrParamRequired("RoleArn")) + } + if s.RoleArn != nil && len(*s.RoleArn) < 20 { + invalidParams.Add(request.NewErrParamMinLen("RoleArn", 20)) + } + if s.RoleSessionName == nil { + invalidParams.Add(request.NewErrParamRequired("RoleSessionName")) + } + if s.RoleSessionName != nil && len(*s.RoleSessionName) < 2 { + invalidParams.Add(request.NewErrParamMinLen("RoleSessionName", 2)) + } + if s.WebIdentityToken == nil { + invalidParams.Add(request.NewErrParamRequired("WebIdentityToken")) + } + if s.WebIdentityToken != nil && len(*s.WebIdentityToken) < 4 { + invalidParams.Add(request.NewErrParamMinLen("WebIdentityToken", 4)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + // Contains the response to a successful AssumeRoleWithWebIdentity request, // including temporary AWS credentials that can be used to make AWS requests. type AssumeRoleWithWebIdentityOutput struct { @@ -789,7 +1228,7 @@ type AssumeRoleWithWebIdentityOutput struct { // The temporary security credentials, which include an access key ID, a secret // access key, and a security token. // - // Note: The size of the security token that STS APIs return is not fixed. + // Note: The size of the security token that STS APIs return is not fixed. // We strongly recommend that you make no assumptions about the maximum size. // As of this writing, the typical size is less than 4096 bytes, but that can // vary. Also, future updates to AWS might require larger sizes. @@ -896,14 +1335,29 @@ func (s DecodeAuthorizationMessageInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *DecodeAuthorizationMessageInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DecodeAuthorizationMessageInput"} + if s.EncodedMessage == nil { + invalidParams.Add(request.NewErrParamRequired("EncodedMessage")) + } + if s.EncodedMessage != nil && len(*s.EncodedMessage) < 1 { + invalidParams.Add(request.NewErrParamMinLen("EncodedMessage", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + // A document that contains additional information about the authorization status // of a request from an encoded message that is returned in response to an AWS // request. type DecodeAuthorizationMessageOutput struct { _ struct{} `type:"structure"` - // An XML document that contains the decoded message. For more information, - // see DecodeAuthorizationMessage. + // An XML document that contains the decoded message. DecodedMessage *string `type:"string"` } @@ -942,6 +1396,49 @@ func (s FederatedUser) GoString() string { return s.String() } +type GetCallerIdentityInput struct { + _ struct{} `type:"structure"` +} + +// String returns the string representation +func (s GetCallerIdentityInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s GetCallerIdentityInput) GoString() string { + return s.String() +} + +// Contains the response to a successful GetCallerIdentity request, including +// information about the entity making the request. +type GetCallerIdentityOutput struct { + _ struct{} `type:"structure"` + + // The AWS account ID number of the account that owns or contains the calling + // entity. + Account *string `type:"string"` + + // The AWS ARN associated with the calling entity. + Arn *string `min:"20" type:"string"` + + // The unique identifier of the calling entity. The exact value depends on the + // type of entity making the call. The values returned are those listed in the + // aws:userid column in the Principal table (http://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_variables.html#principaltable) + // found on the Policy Variables reference page in the IAM User Guide. + UserId *string `type:"string"` +} + +// String returns the string representation +func (s GetCallerIdentityOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s GetCallerIdentityOutput) GoString() string { + return s.String() +} + type GetFederationTokenInput struct { _ struct{} `type:"structure"` @@ -958,6 +1455,11 @@ type GetFederationTokenInput struct { // temporary security credentials (such as Bob). For example, you can reference // the federated user name in a resource-based policy, such as in an Amazon // S3 bucket policy. + // + // The format for this parameter, as described by its regex pattern, is a string + // of characters consisting of upper- and lower-case alphanumeric characters + // with no spaces. You can also include underscores or any of the following + // characters: =,.@- Name *string `min:"2" type:"string" required:"true"` // An IAM policy in JSON format that is passed with the GetFederationToken call @@ -975,12 +1477,20 @@ type GetFederationTokenInput struct { // credentials are used to access a resource that has a resource-based policy // that specifically allows the federated user to access the resource. // - // The policy plain text must be 2048 bytes or shorter. However, an internal + // The format for this parameter, as described by its regex pattern, is a string + // of characters up to 2048 characters in length. The characters can be any + // ASCII character from the space character to the end of the valid character + // list (\u0020-\u00FF). It can also include the tab (\u0009), linefeed (\u000A), + // and carriage return (\u000D) characters. + // + // The policy plain text must be 2048 bytes or shorter. However, an internal // conversion compresses it into a packed binary format with a separate limit. // The PackedPolicySize response element indicates by percentage how close to // the upper size limit the policy is, with 100% equaling the maximum allowed - // size. For more information about how permissions work, see Permissions for - // GetFederationToken (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_control-access_getfederationtoken.html). + // size. + // + // For more information about how permissions work, see Permissions for GetFederationToken + // (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_control-access_getfederationtoken.html). Policy *string `min:"1" type:"string"` } @@ -994,6 +1504,28 @@ func (s GetFederationTokenInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *GetFederationTokenInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "GetFederationTokenInput"} + if s.DurationSeconds != nil && *s.DurationSeconds < 900 { + invalidParams.Add(request.NewErrParamMinValue("DurationSeconds", 900)) + } + if s.Name == nil { + invalidParams.Add(request.NewErrParamRequired("Name")) + } + if s.Name != nil && len(*s.Name) < 2 { + invalidParams.Add(request.NewErrParamMinLen("Name", 2)) + } + if s.Policy != nil && len(*s.Policy) < 1 { + invalidParams.Add(request.NewErrParamMinLen("Policy", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + // Contains the response to a successful GetFederationToken request, including // temporary AWS credentials that can be used to make AWS requests. type GetFederationTokenOutput struct { @@ -1002,7 +1534,7 @@ type GetFederationTokenOutput struct { // The temporary security credentials, which include an access key ID, a secret // access key, and a security (or session) token. // - // Note: The size of the security token that STS APIs return is not fixed. + // Note: The size of the security token that STS APIs return is not fixed. // We strongly recommend that you make no assumptions about the maximum size. // As of this writing, the typical size is less than 4096 bytes, but that can // vary. Also, future updates to AWS might require larger sizes. @@ -1048,6 +1580,11 @@ type GetSessionTokenInput struct { // Name (ARN) for a virtual device (such as arn:aws:iam::123456789012:mfa/user). // You can find the device for an IAM user by going to the AWS Management Console // and viewing the user's security credentials. + // + // The format for this parameter, as described by its regex pattern, is a string + // of characters consisting of upper- and lower-case alphanumeric characters + // with no spaces. You can also include underscores or any of the following + // characters: =,.@- SerialNumber *string `min:"9" type:"string"` // The value provided by the MFA device, if MFA is required. If any policy requires @@ -1055,6 +1592,9 @@ type GetSessionTokenInput struct { // is required, and the user does not provide a code when requesting a set of // temporary security credentials, the user will receive an "access denied" // response when requesting resources that require MFA authentication. + // + // The format for this parameter, as described by its regex pattern, is a sequence + // of six numeric digits. TokenCode *string `min:"6" type:"string"` } @@ -1068,6 +1608,25 @@ func (s GetSessionTokenInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *GetSessionTokenInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "GetSessionTokenInput"} + if s.DurationSeconds != nil && *s.DurationSeconds < 900 { + invalidParams.Add(request.NewErrParamMinValue("DurationSeconds", 900)) + } + if s.SerialNumber != nil && len(*s.SerialNumber) < 9 { + invalidParams.Add(request.NewErrParamMinLen("SerialNumber", 9)) + } + if s.TokenCode != nil && len(*s.TokenCode) < 6 { + invalidParams.Add(request.NewErrParamMinLen("TokenCode", 6)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + // Contains the response to a successful GetSessionToken request, including // temporary AWS credentials that can be used to make AWS requests. type GetSessionTokenOutput struct { @@ -1076,7 +1635,7 @@ type GetSessionTokenOutput struct { // The temporary security credentials, which include an access key ID, a secret // access key, and a security (or session) token. // - // Note: The size of the security token that STS APIs return is not fixed. + // Note: The size of the security token that STS APIs return is not fixed. // We strongly recommend that you make no assumptions about the maximum size. // As of this writing, the typical size is less than 4096 bytes, but that can // vary. Also, future updates to AWS might require larger sizes. diff --git a/vendor/github.com/aws/aws-sdk-go/service/sts/service.go b/vendor/github.com/aws/aws-sdk-go/service/sts/service.go index d1944ed20..c938e6ca1 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/sts/service.go +++ b/vendor/github.com/aws/aws-sdk-go/service/sts/service.go @@ -7,8 +7,8 @@ import ( "github.com/aws/aws-sdk-go/aws/client" "github.com/aws/aws-sdk-go/aws/client/metadata" "github.com/aws/aws-sdk-go/aws/request" + "github.com/aws/aws-sdk-go/aws/signer/v4" "github.com/aws/aws-sdk-go/private/protocol/query" - "github.com/aws/aws-sdk-go/private/signer/v4" ) // The AWS Security Token Service (STS) is a web service that enables you to @@ -17,33 +17,33 @@ import ( // This guide provides descriptions of the STS API. For more detailed information // about using this service, go to Temporary Security Credentials (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp.html). // -// As an alternative to using the API, you can use one of the AWS SDKs, which +// As an alternative to using the API, you can use one of the AWS SDKs, which // consist of libraries and sample code for various programming languages and // platforms (Java, Ruby, .NET, iOS, Android, etc.). The SDKs provide a convenient // way to create programmatic access to STS. For example, the SDKs take care // of cryptographically signing requests, managing errors, and retrying requests // automatically. For information about the AWS SDKs, including how to download // and install them, see the Tools for Amazon Web Services page (http://aws.amazon.com/tools/). +// // For information about setting up signatures and authorization through the -// API, go to Signing AWS API Requests (http://docs.aws.amazon.com/general/latest/gr/signing_aws_api_requests.html" -// target="_blank) in the AWS General Reference. For general information about -// the Query API, go to Making Query Requests (http://docs.aws.amazon.com/IAM/latest/UserGuide/IAM_UsingQueryAPI.html" -// target="_blank) in Using IAM. For information about using security tokens -// with other AWS products, go to AWS Services That Work with IAM (http://docs.aws.amazon.com/IAM/latest/UserGuide/reference_aws-services-that-work-with-iam.html) -// in the Using IAM. +// API, go to Signing AWS API Requests (http://docs.aws.amazon.com/general/latest/gr/signing_aws_api_requests.html) +// in the AWS General Reference. For general information about the Query API, +// go to Making Query Requests (http://docs.aws.amazon.com/IAM/latest/UserGuide/IAM_UsingQueryAPI.html) +// in Using IAM. For information about using security tokens with other AWS +// products, go to AWS Services That Work with IAM (http://docs.aws.amazon.com/IAM/latest/UserGuide/reference_aws-services-that-work-with-iam.html) +// in the IAM User Guide. // // If you're new to AWS and need additional technical information about a specific // AWS product, you can find the product's technical documentation at http://aws.amazon.com/documentation/ -// (http://aws.amazon.com/documentation/" target="_blank). +// (http://aws.amazon.com/documentation/). // // Endpoints // // The AWS Security Token Service (STS) has a default endpoint of https://sts.amazonaws.com -// that maps to the US East (N. Virginia) region. Additional regions are available, -// but must first be activated in the AWS Management Console before you can -// use a different region's endpoint. For more information about activating -// a region for STS see Activating STS in a New Region (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_enable-regions.html) -// in the Using IAM. +// that maps to the US East (N. Virginia) region. Additional regions are available +// and are activated by default. For more information, see Activating and Deactivating +// AWS STS in an AWS Region (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_enable-regions.html) +// in the IAM User Guide. // // For information about STS endpoints, see Regions and Endpoints (http://docs.aws.amazon.com/general/latest/gr/rande.html#sts_region) // in the AWS General Reference. @@ -102,7 +102,7 @@ func newClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegio } // Handlers - svc.Handlers.Sign.PushBack(v4.Sign) + svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler) svc.Handlers.Build.PushBackNamed(query.BuildHandler) svc.Handlers.Unmarshal.PushBackNamed(query.UnmarshalHandler) svc.Handlers.UnmarshalMeta.PushBackNamed(query.UnmarshalMetaHandler) diff --git a/vendor/github.com/aws/aws-sdk-go/service/sts/stsiface/interface.go b/vendor/github.com/aws/aws-sdk-go/service/sts/stsiface/interface.go deleted file mode 100644 index 09dae0c9d..000000000 --- a/vendor/github.com/aws/aws-sdk-go/service/sts/stsiface/interface.go +++ /dev/null @@ -1,38 +0,0 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. - -// Package stsiface provides an interface for the AWS Security Token Service. -package stsiface - -import ( - "github.com/aws/aws-sdk-go/aws/request" - "github.com/aws/aws-sdk-go/service/sts" -) - -// STSAPI is the interface type for sts.STS. -type STSAPI interface { - AssumeRoleRequest(*sts.AssumeRoleInput) (*request.Request, *sts.AssumeRoleOutput) - - AssumeRole(*sts.AssumeRoleInput) (*sts.AssumeRoleOutput, error) - - AssumeRoleWithSAMLRequest(*sts.AssumeRoleWithSAMLInput) (*request.Request, *sts.AssumeRoleWithSAMLOutput) - - AssumeRoleWithSAML(*sts.AssumeRoleWithSAMLInput) (*sts.AssumeRoleWithSAMLOutput, error) - - AssumeRoleWithWebIdentityRequest(*sts.AssumeRoleWithWebIdentityInput) (*request.Request, *sts.AssumeRoleWithWebIdentityOutput) - - AssumeRoleWithWebIdentity(*sts.AssumeRoleWithWebIdentityInput) (*sts.AssumeRoleWithWebIdentityOutput, error) - - DecodeAuthorizationMessageRequest(*sts.DecodeAuthorizationMessageInput) (*request.Request, *sts.DecodeAuthorizationMessageOutput) - - DecodeAuthorizationMessage(*sts.DecodeAuthorizationMessageInput) (*sts.DecodeAuthorizationMessageOutput, error) - - GetFederationTokenRequest(*sts.GetFederationTokenInput) (*request.Request, *sts.GetFederationTokenOutput) - - GetFederationToken(*sts.GetFederationTokenInput) (*sts.GetFederationTokenOutput, error) - - GetSessionTokenRequest(*sts.GetSessionTokenInput) (*request.Request, *sts.GetSessionTokenOutput) - - GetSessionToken(*sts.GetSessionTokenInput) (*sts.GetSessionTokenOutput, error) -} - -var _ STSAPI = (*sts.STS)(nil) diff --git a/vendor/github.com/davecgh/go-spew/LICENSE b/vendor/github.com/davecgh/go-spew/LICENSE new file mode 100644 index 000000000..2a7cfd2bf --- /dev/null +++ b/vendor/github.com/davecgh/go-spew/LICENSE @@ -0,0 +1,13 @@ +Copyright (c) 2012-2013 Dave Collins + +Permission to use, copy, modify, and distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/vendor/github.com/davecgh/go-spew/spew/bypass.go b/vendor/github.com/davecgh/go-spew/spew/bypass.go new file mode 100644 index 000000000..565bf5899 --- /dev/null +++ b/vendor/github.com/davecgh/go-spew/spew/bypass.go @@ -0,0 +1,151 @@ +// Copyright (c) 2015 Dave Collins +// +// Permission to use, copy, modify, and distribute this software for any +// purpose with or without fee is hereby granted, provided that the above +// copyright notice and this permission notice appear in all copies. +// +// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +// NOTE: Due to the following build constraints, this file will only be compiled +// when the code is not running on Google App Engine and "-tags disableunsafe" +// is not added to the go build command line. +// +build !appengine,!disableunsafe + +package spew + +import ( + "reflect" + "unsafe" +) + +const ( + // UnsafeDisabled is a build-time constant which specifies whether or + // not access to the unsafe package is available. + UnsafeDisabled = false + + // ptrSize is the size of a pointer on the current arch. + ptrSize = unsafe.Sizeof((*byte)(nil)) +) + +var ( + // offsetPtr, offsetScalar, and offsetFlag are the offsets for the + // internal reflect.Value fields. These values are valid before golang + // commit ecccf07e7f9d which changed the format. The are also valid + // after commit 82f48826c6c7 which changed the format again to mirror + // the original format. Code in the init function updates these offsets + // as necessary. + offsetPtr = uintptr(ptrSize) + offsetScalar = uintptr(0) + offsetFlag = uintptr(ptrSize * 2) + + // flagKindWidth and flagKindShift indicate various bits that the + // reflect package uses internally to track kind information. + // + // flagRO indicates whether or not the value field of a reflect.Value is + // read-only. + // + // flagIndir indicates whether the value field of a reflect.Value is + // the actual data or a pointer to the data. + // + // These values are valid before golang commit 90a7c3c86944 which + // changed their positions. Code in the init function updates these + // flags as necessary. + flagKindWidth = uintptr(5) + flagKindShift = uintptr(flagKindWidth - 1) + flagRO = uintptr(1 << 0) + flagIndir = uintptr(1 << 1) +) + +func init() { + // Older versions of reflect.Value stored small integers directly in the + // ptr field (which is named val in the older versions). Versions + // between commits ecccf07e7f9d and 82f48826c6c7 added a new field named + // scalar for this purpose which unfortunately came before the flag + // field, so the offset of the flag field is different for those + // versions. + // + // This code constructs a new reflect.Value from a known small integer + // and checks if the size of the reflect.Value struct indicates it has + // the scalar field. When it does, the offsets are updated accordingly. + vv := reflect.ValueOf(0xf00) + if unsafe.Sizeof(vv) == (ptrSize * 4) { + offsetScalar = ptrSize * 2 + offsetFlag = ptrSize * 3 + } + + // Commit 90a7c3c86944 changed the flag positions such that the low + // order bits are the kind. This code extracts the kind from the flags + // field and ensures it's the correct type. When it's not, the flag + // order has been changed to the newer format, so the flags are updated + // accordingly. + upf := unsafe.Pointer(uintptr(unsafe.Pointer(&vv)) + offsetFlag) + upfv := *(*uintptr)(upf) + flagKindMask := uintptr((1<>flagKindShift != uintptr(reflect.Int) { + flagKindShift = 0 + flagRO = 1 << 5 + flagIndir = 1 << 6 + + // Commit adf9b30e5594 modified the flags to separate the + // flagRO flag into two bits which specifies whether or not the + // field is embedded. This causes flagIndir to move over a bit + // and means that flagRO is the combination of either of the + // original flagRO bit and the new bit. + // + // This code detects the change by extracting what used to be + // the indirect bit to ensure it's set. When it's not, the flag + // order has been changed to the newer format, so the flags are + // updated accordingly. + if upfv&flagIndir == 0 { + flagRO = 3 << 5 + flagIndir = 1 << 7 + } + } +} + +// unsafeReflectValue converts the passed reflect.Value into a one that bypasses +// the typical safety restrictions preventing access to unaddressable and +// unexported data. It works by digging the raw pointer to the underlying +// value out of the protected value and generating a new unprotected (unsafe) +// reflect.Value to it. +// +// This allows us to check for implementations of the Stringer and error +// interfaces to be used for pretty printing ordinarily unaddressable and +// inaccessible values such as unexported struct fields. +func unsafeReflectValue(v reflect.Value) (rv reflect.Value) { + indirects := 1 + vt := v.Type() + upv := unsafe.Pointer(uintptr(unsafe.Pointer(&v)) + offsetPtr) + rvf := *(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&v)) + offsetFlag)) + if rvf&flagIndir != 0 { + vt = reflect.PtrTo(v.Type()) + indirects++ + } else if offsetScalar != 0 { + // The value is in the scalar field when it's not one of the + // reference types. + switch vt.Kind() { + case reflect.Uintptr: + case reflect.Chan: + case reflect.Func: + case reflect.Map: + case reflect.Ptr: + case reflect.UnsafePointer: + default: + upv = unsafe.Pointer(uintptr(unsafe.Pointer(&v)) + + offsetScalar) + } + } + + pv := reflect.NewAt(vt, upv) + rv = pv + for i := 0; i < indirects; i++ { + rv = rv.Elem() + } + return rv +} diff --git a/vendor/github.com/davecgh/go-spew/spew/bypasssafe.go b/vendor/github.com/davecgh/go-spew/spew/bypasssafe.go new file mode 100644 index 000000000..457e41235 --- /dev/null +++ b/vendor/github.com/davecgh/go-spew/spew/bypasssafe.go @@ -0,0 +1,37 @@ +// Copyright (c) 2015 Dave Collins +// +// Permission to use, copy, modify, and distribute this software for any +// purpose with or without fee is hereby granted, provided that the above +// copyright notice and this permission notice appear in all copies. +// +// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +// NOTE: Due to the following build constraints, this file will only be compiled +// when either the code is running on Google App Engine or "-tags disableunsafe" +// is added to the go build command line. +// +build appengine disableunsafe + +package spew + +import "reflect" + +const ( + // UnsafeDisabled is a build-time constant which specifies whether or + // not access to the unsafe package is available. + UnsafeDisabled = true +) + +// unsafeReflectValue typically converts the passed reflect.Value into a one +// that bypasses the typical safety restrictions preventing access to +// unaddressable and unexported data. However, doing this relies on access to +// the unsafe package. This is a stub version which simply returns the passed +// reflect.Value when the unsafe package is not available. +func unsafeReflectValue(v reflect.Value) reflect.Value { + return v +} diff --git a/vendor/github.com/davecgh/go-spew/spew/common.go b/vendor/github.com/davecgh/go-spew/spew/common.go new file mode 100644 index 000000000..14f02dc15 --- /dev/null +++ b/vendor/github.com/davecgh/go-spew/spew/common.go @@ -0,0 +1,341 @@ +/* + * Copyright (c) 2013 Dave Collins + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +package spew + +import ( + "bytes" + "fmt" + "io" + "reflect" + "sort" + "strconv" +) + +// Some constants in the form of bytes to avoid string overhead. This mirrors +// the technique used in the fmt package. +var ( + panicBytes = []byte("(PANIC=") + plusBytes = []byte("+") + iBytes = []byte("i") + trueBytes = []byte("true") + falseBytes = []byte("false") + interfaceBytes = []byte("(interface {})") + commaNewlineBytes = []byte(",\n") + newlineBytes = []byte("\n") + openBraceBytes = []byte("{") + openBraceNewlineBytes = []byte("{\n") + closeBraceBytes = []byte("}") + asteriskBytes = []byte("*") + colonBytes = []byte(":") + colonSpaceBytes = []byte(": ") + openParenBytes = []byte("(") + closeParenBytes = []byte(")") + spaceBytes = []byte(" ") + pointerChainBytes = []byte("->") + nilAngleBytes = []byte("") + maxNewlineBytes = []byte("\n") + maxShortBytes = []byte("") + circularBytes = []byte("") + circularShortBytes = []byte("") + invalidAngleBytes = []byte("") + openBracketBytes = []byte("[") + closeBracketBytes = []byte("]") + percentBytes = []byte("%") + precisionBytes = []byte(".") + openAngleBytes = []byte("<") + closeAngleBytes = []byte(">") + openMapBytes = []byte("map[") + closeMapBytes = []byte("]") + lenEqualsBytes = []byte("len=") + capEqualsBytes = []byte("cap=") +) + +// hexDigits is used to map a decimal value to a hex digit. +var hexDigits = "0123456789abcdef" + +// catchPanic handles any panics that might occur during the handleMethods +// calls. +func catchPanic(w io.Writer, v reflect.Value) { + if err := recover(); err != nil { + w.Write(panicBytes) + fmt.Fprintf(w, "%v", err) + w.Write(closeParenBytes) + } +} + +// handleMethods attempts to call the Error and String methods on the underlying +// type the passed reflect.Value represents and outputes the result to Writer w. +// +// It handles panics in any called methods by catching and displaying the error +// as the formatted value. +func handleMethods(cs *ConfigState, w io.Writer, v reflect.Value) (handled bool) { + // We need an interface to check if the type implements the error or + // Stringer interface. However, the reflect package won't give us an + // interface on certain things like unexported struct fields in order + // to enforce visibility rules. We use unsafe, when it's available, + // to bypass these restrictions since this package does not mutate the + // values. + if !v.CanInterface() { + if UnsafeDisabled { + return false + } + + v = unsafeReflectValue(v) + } + + // Choose whether or not to do error and Stringer interface lookups against + // the base type or a pointer to the base type depending on settings. + // Technically calling one of these methods with a pointer receiver can + // mutate the value, however, types which choose to satisify an error or + // Stringer interface with a pointer receiver should not be mutating their + // state inside these interface methods. + if !cs.DisablePointerMethods && !UnsafeDisabled && !v.CanAddr() { + v = unsafeReflectValue(v) + } + if v.CanAddr() { + v = v.Addr() + } + + // Is it an error or Stringer? + switch iface := v.Interface().(type) { + case error: + defer catchPanic(w, v) + if cs.ContinueOnMethod { + w.Write(openParenBytes) + w.Write([]byte(iface.Error())) + w.Write(closeParenBytes) + w.Write(spaceBytes) + return false + } + + w.Write([]byte(iface.Error())) + return true + + case fmt.Stringer: + defer catchPanic(w, v) + if cs.ContinueOnMethod { + w.Write(openParenBytes) + w.Write([]byte(iface.String())) + w.Write(closeParenBytes) + w.Write(spaceBytes) + return false + } + w.Write([]byte(iface.String())) + return true + } + return false +} + +// printBool outputs a boolean value as true or false to Writer w. +func printBool(w io.Writer, val bool) { + if val { + w.Write(trueBytes) + } else { + w.Write(falseBytes) + } +} + +// printInt outputs a signed integer value to Writer w. +func printInt(w io.Writer, val int64, base int) { + w.Write([]byte(strconv.FormatInt(val, base))) +} + +// printUint outputs an unsigned integer value to Writer w. +func printUint(w io.Writer, val uint64, base int) { + w.Write([]byte(strconv.FormatUint(val, base))) +} + +// printFloat outputs a floating point value using the specified precision, +// which is expected to be 32 or 64bit, to Writer w. +func printFloat(w io.Writer, val float64, precision int) { + w.Write([]byte(strconv.FormatFloat(val, 'g', -1, precision))) +} + +// printComplex outputs a complex value using the specified float precision +// for the real and imaginary parts to Writer w. +func printComplex(w io.Writer, c complex128, floatPrecision int) { + r := real(c) + w.Write(openParenBytes) + w.Write([]byte(strconv.FormatFloat(r, 'g', -1, floatPrecision))) + i := imag(c) + if i >= 0 { + w.Write(plusBytes) + } + w.Write([]byte(strconv.FormatFloat(i, 'g', -1, floatPrecision))) + w.Write(iBytes) + w.Write(closeParenBytes) +} + +// printHexPtr outputs a uintptr formatted as hexidecimal with a leading '0x' +// prefix to Writer w. +func printHexPtr(w io.Writer, p uintptr) { + // Null pointer. + num := uint64(p) + if num == 0 { + w.Write(nilAngleBytes) + return + } + + // Max uint64 is 16 bytes in hex + 2 bytes for '0x' prefix + buf := make([]byte, 18) + + // It's simpler to construct the hex string right to left. + base := uint64(16) + i := len(buf) - 1 + for num >= base { + buf[i] = hexDigits[num%base] + num /= base + i-- + } + buf[i] = hexDigits[num] + + // Add '0x' prefix. + i-- + buf[i] = 'x' + i-- + buf[i] = '0' + + // Strip unused leading bytes. + buf = buf[i:] + w.Write(buf) +} + +// valuesSorter implements sort.Interface to allow a slice of reflect.Value +// elements to be sorted. +type valuesSorter struct { + values []reflect.Value + strings []string // either nil or same len and values + cs *ConfigState +} + +// newValuesSorter initializes a valuesSorter instance, which holds a set of +// surrogate keys on which the data should be sorted. It uses flags in +// ConfigState to decide if and how to populate those surrogate keys. +func newValuesSorter(values []reflect.Value, cs *ConfigState) sort.Interface { + vs := &valuesSorter{values: values, cs: cs} + if canSortSimply(vs.values[0].Kind()) { + return vs + } + if !cs.DisableMethods { + vs.strings = make([]string, len(values)) + for i := range vs.values { + b := bytes.Buffer{} + if !handleMethods(cs, &b, vs.values[i]) { + vs.strings = nil + break + } + vs.strings[i] = b.String() + } + } + if vs.strings == nil && cs.SpewKeys { + vs.strings = make([]string, len(values)) + for i := range vs.values { + vs.strings[i] = Sprintf("%#v", vs.values[i].Interface()) + } + } + return vs +} + +// canSortSimply tests whether a reflect.Kind is a primitive that can be sorted +// directly, or whether it should be considered for sorting by surrogate keys +// (if the ConfigState allows it). +func canSortSimply(kind reflect.Kind) bool { + // This switch parallels valueSortLess, except for the default case. + switch kind { + case reflect.Bool: + return true + case reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, reflect.Int: + return true + case reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uint: + return true + case reflect.Float32, reflect.Float64: + return true + case reflect.String: + return true + case reflect.Uintptr: + return true + case reflect.Array: + return true + } + return false +} + +// Len returns the number of values in the slice. It is part of the +// sort.Interface implementation. +func (s *valuesSorter) Len() int { + return len(s.values) +} + +// Swap swaps the values at the passed indices. It is part of the +// sort.Interface implementation. +func (s *valuesSorter) Swap(i, j int) { + s.values[i], s.values[j] = s.values[j], s.values[i] + if s.strings != nil { + s.strings[i], s.strings[j] = s.strings[j], s.strings[i] + } +} + +// valueSortLess returns whether the first value should sort before the second +// value. It is used by valueSorter.Less as part of the sort.Interface +// implementation. +func valueSortLess(a, b reflect.Value) bool { + switch a.Kind() { + case reflect.Bool: + return !a.Bool() && b.Bool() + case reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, reflect.Int: + return a.Int() < b.Int() + case reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uint: + return a.Uint() < b.Uint() + case reflect.Float32, reflect.Float64: + return a.Float() < b.Float() + case reflect.String: + return a.String() < b.String() + case reflect.Uintptr: + return a.Uint() < b.Uint() + case reflect.Array: + // Compare the contents of both arrays. + l := a.Len() + for i := 0; i < l; i++ { + av := a.Index(i) + bv := b.Index(i) + if av.Interface() == bv.Interface() { + continue + } + return valueSortLess(av, bv) + } + } + return a.String() < b.String() +} + +// Less returns whether the value at index i should sort before the +// value at index j. It is part of the sort.Interface implementation. +func (s *valuesSorter) Less(i, j int) bool { + if s.strings == nil { + return valueSortLess(s.values[i], s.values[j]) + } + return s.strings[i] < s.strings[j] +} + +// sortValues is a sort function that handles both native types and any type that +// can be converted to error or Stringer. Other inputs are sorted according to +// their Value.String() value to ensure display stability. +func sortValues(values []reflect.Value, cs *ConfigState) { + if len(values) == 0 { + return + } + sort.Sort(newValuesSorter(values, cs)) +} diff --git a/vendor/github.com/davecgh/go-spew/spew/config.go b/vendor/github.com/davecgh/go-spew/spew/config.go new file mode 100644 index 000000000..ee1ab07b3 --- /dev/null +++ b/vendor/github.com/davecgh/go-spew/spew/config.go @@ -0,0 +1,297 @@ +/* + * Copyright (c) 2013 Dave Collins + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +package spew + +import ( + "bytes" + "fmt" + "io" + "os" +) + +// ConfigState houses the configuration options used by spew to format and +// display values. There is a global instance, Config, that is used to control +// all top-level Formatter and Dump functionality. Each ConfigState instance +// provides methods equivalent to the top-level functions. +// +// The zero value for ConfigState provides no indentation. You would typically +// want to set it to a space or a tab. +// +// Alternatively, you can use NewDefaultConfig to get a ConfigState instance +// with default settings. See the documentation of NewDefaultConfig for default +// values. +type ConfigState struct { + // Indent specifies the string to use for each indentation level. The + // global config instance that all top-level functions use set this to a + // single space by default. If you would like more indentation, you might + // set this to a tab with "\t" or perhaps two spaces with " ". + Indent string + + // MaxDepth controls the maximum number of levels to descend into nested + // data structures. The default, 0, means there is no limit. + // + // NOTE: Circular data structures are properly detected, so it is not + // necessary to set this value unless you specifically want to limit deeply + // nested data structures. + MaxDepth int + + // DisableMethods specifies whether or not error and Stringer interfaces are + // invoked for types that implement them. + DisableMethods bool + + // DisablePointerMethods specifies whether or not to check for and invoke + // error and Stringer interfaces on types which only accept a pointer + // receiver when the current type is not a pointer. + // + // NOTE: This might be an unsafe action since calling one of these methods + // with a pointer receiver could technically mutate the value, however, + // in practice, types which choose to satisify an error or Stringer + // interface with a pointer receiver should not be mutating their state + // inside these interface methods. As a result, this option relies on + // access to the unsafe package, so it will not have any effect when + // running in environments without access to the unsafe package such as + // Google App Engine or with the "disableunsafe" build tag specified. + DisablePointerMethods bool + + // ContinueOnMethod specifies whether or not recursion should continue once + // a custom error or Stringer interface is invoked. The default, false, + // means it will print the results of invoking the custom error or Stringer + // interface and return immediately instead of continuing to recurse into + // the internals of the data type. + // + // NOTE: This flag does not have any effect if method invocation is disabled + // via the DisableMethods or DisablePointerMethods options. + ContinueOnMethod bool + + // SortKeys specifies map keys should be sorted before being printed. Use + // this to have a more deterministic, diffable output. Note that only + // native types (bool, int, uint, floats, uintptr and string) and types + // that support the error or Stringer interfaces (if methods are + // enabled) are supported, with other types sorted according to the + // reflect.Value.String() output which guarantees display stability. + SortKeys bool + + // SpewKeys specifies that, as a last resort attempt, map keys should + // be spewed to strings and sorted by those strings. This is only + // considered if SortKeys is true. + SpewKeys bool +} + +// Config is the active configuration of the top-level functions. +// The configuration can be changed by modifying the contents of spew.Config. +var Config = ConfigState{Indent: " "} + +// Errorf is a wrapper for fmt.Errorf that treats each argument as if it were +// passed with a Formatter interface returned by c.NewFormatter. It returns +// the formatted string as a value that satisfies error. See NewFormatter +// for formatting details. +// +// This function is shorthand for the following syntax: +// +// fmt.Errorf(format, c.NewFormatter(a), c.NewFormatter(b)) +func (c *ConfigState) Errorf(format string, a ...interface{}) (err error) { + return fmt.Errorf(format, c.convertArgs(a)...) +} + +// Fprint is a wrapper for fmt.Fprint that treats each argument as if it were +// passed with a Formatter interface returned by c.NewFormatter. It returns +// the number of bytes written and any write error encountered. See +// NewFormatter for formatting details. +// +// This function is shorthand for the following syntax: +// +// fmt.Fprint(w, c.NewFormatter(a), c.NewFormatter(b)) +func (c *ConfigState) Fprint(w io.Writer, a ...interface{}) (n int, err error) { + return fmt.Fprint(w, c.convertArgs(a)...) +} + +// Fprintf is a wrapper for fmt.Fprintf that treats each argument as if it were +// passed with a Formatter interface returned by c.NewFormatter. It returns +// the number of bytes written and any write error encountered. See +// NewFormatter for formatting details. +// +// This function is shorthand for the following syntax: +// +// fmt.Fprintf(w, format, c.NewFormatter(a), c.NewFormatter(b)) +func (c *ConfigState) Fprintf(w io.Writer, format string, a ...interface{}) (n int, err error) { + return fmt.Fprintf(w, format, c.convertArgs(a)...) +} + +// Fprintln is a wrapper for fmt.Fprintln that treats each argument as if it +// passed with a Formatter interface returned by c.NewFormatter. See +// NewFormatter for formatting details. +// +// This function is shorthand for the following syntax: +// +// fmt.Fprintln(w, c.NewFormatter(a), c.NewFormatter(b)) +func (c *ConfigState) Fprintln(w io.Writer, a ...interface{}) (n int, err error) { + return fmt.Fprintln(w, c.convertArgs(a)...) +} + +// Print is a wrapper for fmt.Print that treats each argument as if it were +// passed with a Formatter interface returned by c.NewFormatter. It returns +// the number of bytes written and any write error encountered. See +// NewFormatter for formatting details. +// +// This function is shorthand for the following syntax: +// +// fmt.Print(c.NewFormatter(a), c.NewFormatter(b)) +func (c *ConfigState) Print(a ...interface{}) (n int, err error) { + return fmt.Print(c.convertArgs(a)...) +} + +// Printf is a wrapper for fmt.Printf that treats each argument as if it were +// passed with a Formatter interface returned by c.NewFormatter. It returns +// the number of bytes written and any write error encountered. See +// NewFormatter for formatting details. +// +// This function is shorthand for the following syntax: +// +// fmt.Printf(format, c.NewFormatter(a), c.NewFormatter(b)) +func (c *ConfigState) Printf(format string, a ...interface{}) (n int, err error) { + return fmt.Printf(format, c.convertArgs(a)...) +} + +// Println is a wrapper for fmt.Println that treats each argument as if it were +// passed with a Formatter interface returned by c.NewFormatter. It returns +// the number of bytes written and any write error encountered. See +// NewFormatter for formatting details. +// +// This function is shorthand for the following syntax: +// +// fmt.Println(c.NewFormatter(a), c.NewFormatter(b)) +func (c *ConfigState) Println(a ...interface{}) (n int, err error) { + return fmt.Println(c.convertArgs(a)...) +} + +// Sprint is a wrapper for fmt.Sprint that treats each argument as if it were +// passed with a Formatter interface returned by c.NewFormatter. It returns +// the resulting string. See NewFormatter for formatting details. +// +// This function is shorthand for the following syntax: +// +// fmt.Sprint(c.NewFormatter(a), c.NewFormatter(b)) +func (c *ConfigState) Sprint(a ...interface{}) string { + return fmt.Sprint(c.convertArgs(a)...) +} + +// Sprintf is a wrapper for fmt.Sprintf that treats each argument as if it were +// passed with a Formatter interface returned by c.NewFormatter. It returns +// the resulting string. See NewFormatter for formatting details. +// +// This function is shorthand for the following syntax: +// +// fmt.Sprintf(format, c.NewFormatter(a), c.NewFormatter(b)) +func (c *ConfigState) Sprintf(format string, a ...interface{}) string { + return fmt.Sprintf(format, c.convertArgs(a)...) +} + +// Sprintln is a wrapper for fmt.Sprintln that treats each argument as if it +// were passed with a Formatter interface returned by c.NewFormatter. It +// returns the resulting string. See NewFormatter for formatting details. +// +// This function is shorthand for the following syntax: +// +// fmt.Sprintln(c.NewFormatter(a), c.NewFormatter(b)) +func (c *ConfigState) Sprintln(a ...interface{}) string { + return fmt.Sprintln(c.convertArgs(a)...) +} + +/* +NewFormatter returns a custom formatter that satisfies the fmt.Formatter +interface. As a result, it integrates cleanly with standard fmt package +printing functions. The formatter is useful for inline printing of smaller data +types similar to the standard %v format specifier. + +The custom formatter only responds to the %v (most compact), %+v (adds pointer +addresses), %#v (adds types), and %#+v (adds types and pointer addresses) verb +combinations. Any other verbs such as %x and %q will be sent to the the +standard fmt package for formatting. In addition, the custom formatter ignores +the width and precision arguments (however they will still work on the format +specifiers not handled by the custom formatter). + +Typically this function shouldn't be called directly. It is much easier to make +use of the custom formatter by calling one of the convenience functions such as +c.Printf, c.Println, or c.Printf. +*/ +func (c *ConfigState) NewFormatter(v interface{}) fmt.Formatter { + return newFormatter(c, v) +} + +// Fdump formats and displays the passed arguments to io.Writer w. It formats +// exactly the same as Dump. +func (c *ConfigState) Fdump(w io.Writer, a ...interface{}) { + fdump(c, w, a...) +} + +/* +Dump displays the passed parameters to standard out with newlines, customizable +indentation, and additional debug information such as complete types and all +pointer addresses used to indirect to the final value. It provides the +following features over the built-in printing facilities provided by the fmt +package: + + * Pointers are dereferenced and followed + * Circular data structures are detected and handled properly + * Custom Stringer/error interfaces are optionally invoked, including + on unexported types + * Custom types which only implement the Stringer/error interfaces via + a pointer receiver are optionally invoked when passing non-pointer + variables + * Byte arrays and slices are dumped like the hexdump -C command which + includes offsets, byte values in hex, and ASCII output + +The configuration options are controlled by modifying the public members +of c. See ConfigState for options documentation. + +See Fdump if you would prefer dumping to an arbitrary io.Writer or Sdump to +get the formatted result as a string. +*/ +func (c *ConfigState) Dump(a ...interface{}) { + fdump(c, os.Stdout, a...) +} + +// Sdump returns a string with the passed arguments formatted exactly the same +// as Dump. +func (c *ConfigState) Sdump(a ...interface{}) string { + var buf bytes.Buffer + fdump(c, &buf, a...) + return buf.String() +} + +// convertArgs accepts a slice of arguments and returns a slice of the same +// length with each argument converted to a spew Formatter interface using +// the ConfigState associated with s. +func (c *ConfigState) convertArgs(args []interface{}) (formatters []interface{}) { + formatters = make([]interface{}, len(args)) + for index, arg := range args { + formatters[index] = newFormatter(c, arg) + } + return formatters +} + +// NewDefaultConfig returns a ConfigState with the following default settings. +// +// Indent: " " +// MaxDepth: 0 +// DisableMethods: false +// DisablePointerMethods: false +// ContinueOnMethod: false +// SortKeys: false +func NewDefaultConfig() *ConfigState { + return &ConfigState{Indent: " "} +} diff --git a/vendor/github.com/davecgh/go-spew/spew/doc.go b/vendor/github.com/davecgh/go-spew/spew/doc.go new file mode 100644 index 000000000..5be0c4060 --- /dev/null +++ b/vendor/github.com/davecgh/go-spew/spew/doc.go @@ -0,0 +1,202 @@ +/* + * Copyright (c) 2013 Dave Collins + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +/* +Package spew implements a deep pretty printer for Go data structures to aid in +debugging. + +A quick overview of the additional features spew provides over the built-in +printing facilities for Go data types are as follows: + + * Pointers are dereferenced and followed + * Circular data structures are detected and handled properly + * Custom Stringer/error interfaces are optionally invoked, including + on unexported types + * Custom types which only implement the Stringer/error interfaces via + a pointer receiver are optionally invoked when passing non-pointer + variables + * Byte arrays and slices are dumped like the hexdump -C command which + includes offsets, byte values in hex, and ASCII output (only when using + Dump style) + +There are two different approaches spew allows for dumping Go data structures: + + * Dump style which prints with newlines, customizable indentation, + and additional debug information such as types and all pointer addresses + used to indirect to the final value + * A custom Formatter interface that integrates cleanly with the standard fmt + package and replaces %v, %+v, %#v, and %#+v to provide inline printing + similar to the default %v while providing the additional functionality + outlined above and passing unsupported format verbs such as %x and %q + along to fmt + +Quick Start + +This section demonstrates how to quickly get started with spew. See the +sections below for further details on formatting and configuration options. + +To dump a variable with full newlines, indentation, type, and pointer +information use Dump, Fdump, or Sdump: + spew.Dump(myVar1, myVar2, ...) + spew.Fdump(someWriter, myVar1, myVar2, ...) + str := spew.Sdump(myVar1, myVar2, ...) + +Alternatively, if you would prefer to use format strings with a compacted inline +printing style, use the convenience wrappers Printf, Fprintf, etc with +%v (most compact), %+v (adds pointer addresses), %#v (adds types), or +%#+v (adds types and pointer addresses): + spew.Printf("myVar1: %v -- myVar2: %+v", myVar1, myVar2) + spew.Printf("myVar3: %#v -- myVar4: %#+v", myVar3, myVar4) + spew.Fprintf(someWriter, "myVar1: %v -- myVar2: %+v", myVar1, myVar2) + spew.Fprintf(someWriter, "myVar3: %#v -- myVar4: %#+v", myVar3, myVar4) + +Configuration Options + +Configuration of spew is handled by fields in the ConfigState type. For +convenience, all of the top-level functions use a global state available +via the spew.Config global. + +It is also possible to create a ConfigState instance that provides methods +equivalent to the top-level functions. This allows concurrent configuration +options. See the ConfigState documentation for more details. + +The following configuration options are available: + * Indent + String to use for each indentation level for Dump functions. + It is a single space by default. A popular alternative is "\t". + + * MaxDepth + Maximum number of levels to descend into nested data structures. + There is no limit by default. + + * DisableMethods + Disables invocation of error and Stringer interface methods. + Method invocation is enabled by default. + + * DisablePointerMethods + Disables invocation of error and Stringer interface methods on types + which only accept pointer receivers from non-pointer variables. + Pointer method invocation is enabled by default. + + * ContinueOnMethod + Enables recursion into types after invoking error and Stringer interface + methods. Recursion after method invocation is disabled by default. + + * SortKeys + Specifies map keys should be sorted before being printed. Use + this to have a more deterministic, diffable output. Note that + only native types (bool, int, uint, floats, uintptr and string) + and types which implement error or Stringer interfaces are + supported with other types sorted according to the + reflect.Value.String() output which guarantees display + stability. Natural map order is used by default. + + * SpewKeys + Specifies that, as a last resort attempt, map keys should be + spewed to strings and sorted by those strings. This is only + considered if SortKeys is true. + +Dump Usage + +Simply call spew.Dump with a list of variables you want to dump: + + spew.Dump(myVar1, myVar2, ...) + +You may also call spew.Fdump if you would prefer to output to an arbitrary +io.Writer. For example, to dump to standard error: + + spew.Fdump(os.Stderr, myVar1, myVar2, ...) + +A third option is to call spew.Sdump to get the formatted output as a string: + + str := spew.Sdump(myVar1, myVar2, ...) + +Sample Dump Output + +See the Dump example for details on the setup of the types and variables being +shown here. + + (main.Foo) { + unexportedField: (*main.Bar)(0xf84002e210)({ + flag: (main.Flag) flagTwo, + data: (uintptr) + }), + ExportedField: (map[interface {}]interface {}) (len=1) { + (string) (len=3) "one": (bool) true + } + } + +Byte (and uint8) arrays and slices are displayed uniquely like the hexdump -C +command as shown. + ([]uint8) (len=32 cap=32) { + 00000000 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f 20 |............... | + 00000010 21 22 23 24 25 26 27 28 29 2a 2b 2c 2d 2e 2f 30 |!"#$%&'()*+,-./0| + 00000020 31 32 |12| + } + +Custom Formatter + +Spew provides a custom formatter that implements the fmt.Formatter interface +so that it integrates cleanly with standard fmt package printing functions. The +formatter is useful for inline printing of smaller data types similar to the +standard %v format specifier. + +The custom formatter only responds to the %v (most compact), %+v (adds pointer +addresses), %#v (adds types), or %#+v (adds types and pointer addresses) verb +combinations. Any other verbs such as %x and %q will be sent to the the +standard fmt package for formatting. In addition, the custom formatter ignores +the width and precision arguments (however they will still work on the format +specifiers not handled by the custom formatter). + +Custom Formatter Usage + +The simplest way to make use of the spew custom formatter is to call one of the +convenience functions such as spew.Printf, spew.Println, or spew.Printf. The +functions have syntax you are most likely already familiar with: + + spew.Printf("myVar1: %v -- myVar2: %+v", myVar1, myVar2) + spew.Printf("myVar3: %#v -- myVar4: %#+v", myVar3, myVar4) + spew.Println(myVar, myVar2) + spew.Fprintf(os.Stderr, "myVar1: %v -- myVar2: %+v", myVar1, myVar2) + spew.Fprintf(os.Stderr, "myVar3: %#v -- myVar4: %#+v", myVar3, myVar4) + +See the Index for the full list convenience functions. + +Sample Formatter Output + +Double pointer to a uint8: + %v: <**>5 + %+v: <**>(0xf8400420d0->0xf8400420c8)5 + %#v: (**uint8)5 + %#+v: (**uint8)(0xf8400420d0->0xf8400420c8)5 + +Pointer to circular struct with a uint8 field and a pointer to itself: + %v: <*>{1 <*>} + %+v: <*>(0xf84003e260){ui8:1 c:<*>(0xf84003e260)} + %#v: (*main.circular){ui8:(uint8)1 c:(*main.circular)} + %#+v: (*main.circular)(0xf84003e260){ui8:(uint8)1 c:(*main.circular)(0xf84003e260)} + +See the Printf example for details on the setup of variables being shown +here. + +Errors + +Since it is possible for custom Stringer/error interfaces to panic, spew +detects them and handles them internally by printing the panic information +inline with the output. Since spew is intended to provide deep pretty printing +capabilities on structures, it intentionally does not return any errors. +*/ +package spew diff --git a/vendor/github.com/davecgh/go-spew/spew/dump.go b/vendor/github.com/davecgh/go-spew/spew/dump.go new file mode 100644 index 000000000..a0ff95e27 --- /dev/null +++ b/vendor/github.com/davecgh/go-spew/spew/dump.go @@ -0,0 +1,509 @@ +/* + * Copyright (c) 2013 Dave Collins + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +package spew + +import ( + "bytes" + "encoding/hex" + "fmt" + "io" + "os" + "reflect" + "regexp" + "strconv" + "strings" +) + +var ( + // uint8Type is a reflect.Type representing a uint8. It is used to + // convert cgo types to uint8 slices for hexdumping. + uint8Type = reflect.TypeOf(uint8(0)) + + // cCharRE is a regular expression that matches a cgo char. + // It is used to detect character arrays to hexdump them. + cCharRE = regexp.MustCompile("^.*\\._Ctype_char$") + + // cUnsignedCharRE is a regular expression that matches a cgo unsigned + // char. It is used to detect unsigned character arrays to hexdump + // them. + cUnsignedCharRE = regexp.MustCompile("^.*\\._Ctype_unsignedchar$") + + // cUint8tCharRE is a regular expression that matches a cgo uint8_t. + // It is used to detect uint8_t arrays to hexdump them. + cUint8tCharRE = regexp.MustCompile("^.*\\._Ctype_uint8_t$") +) + +// dumpState contains information about the state of a dump operation. +type dumpState struct { + w io.Writer + depth int + pointers map[uintptr]int + ignoreNextType bool + ignoreNextIndent bool + cs *ConfigState +} + +// indent performs indentation according to the depth level and cs.Indent +// option. +func (d *dumpState) indent() { + if d.ignoreNextIndent { + d.ignoreNextIndent = false + return + } + d.w.Write(bytes.Repeat([]byte(d.cs.Indent), d.depth)) +} + +// unpackValue returns values inside of non-nil interfaces when possible. +// This is useful for data types like structs, arrays, slices, and maps which +// can contain varying types packed inside an interface. +func (d *dumpState) unpackValue(v reflect.Value) reflect.Value { + if v.Kind() == reflect.Interface && !v.IsNil() { + v = v.Elem() + } + return v +} + +// dumpPtr handles formatting of pointers by indirecting them as necessary. +func (d *dumpState) dumpPtr(v reflect.Value) { + // Remove pointers at or below the current depth from map used to detect + // circular refs. + for k, depth := range d.pointers { + if depth >= d.depth { + delete(d.pointers, k) + } + } + + // Keep list of all dereferenced pointers to show later. + pointerChain := make([]uintptr, 0) + + // Figure out how many levels of indirection there are by dereferencing + // pointers and unpacking interfaces down the chain while detecting circular + // references. + nilFound := false + cycleFound := false + indirects := 0 + ve := v + for ve.Kind() == reflect.Ptr { + if ve.IsNil() { + nilFound = true + break + } + indirects++ + addr := ve.Pointer() + pointerChain = append(pointerChain, addr) + if pd, ok := d.pointers[addr]; ok && pd < d.depth { + cycleFound = true + indirects-- + break + } + d.pointers[addr] = d.depth + + ve = ve.Elem() + if ve.Kind() == reflect.Interface { + if ve.IsNil() { + nilFound = true + break + } + ve = ve.Elem() + } + } + + // Display type information. + d.w.Write(openParenBytes) + d.w.Write(bytes.Repeat(asteriskBytes, indirects)) + d.w.Write([]byte(ve.Type().String())) + d.w.Write(closeParenBytes) + + // Display pointer information. + if len(pointerChain) > 0 { + d.w.Write(openParenBytes) + for i, addr := range pointerChain { + if i > 0 { + d.w.Write(pointerChainBytes) + } + printHexPtr(d.w, addr) + } + d.w.Write(closeParenBytes) + } + + // Display dereferenced value. + d.w.Write(openParenBytes) + switch { + case nilFound == true: + d.w.Write(nilAngleBytes) + + case cycleFound == true: + d.w.Write(circularBytes) + + default: + d.ignoreNextType = true + d.dump(ve) + } + d.w.Write(closeParenBytes) +} + +// dumpSlice handles formatting of arrays and slices. Byte (uint8 under +// reflection) arrays and slices are dumped in hexdump -C fashion. +func (d *dumpState) dumpSlice(v reflect.Value) { + // Determine whether this type should be hex dumped or not. Also, + // for types which should be hexdumped, try to use the underlying data + // first, then fall back to trying to convert them to a uint8 slice. + var buf []uint8 + doConvert := false + doHexDump := false + numEntries := v.Len() + if numEntries > 0 { + vt := v.Index(0).Type() + vts := vt.String() + switch { + // C types that need to be converted. + case cCharRE.MatchString(vts): + fallthrough + case cUnsignedCharRE.MatchString(vts): + fallthrough + case cUint8tCharRE.MatchString(vts): + doConvert = true + + // Try to use existing uint8 slices and fall back to converting + // and copying if that fails. + case vt.Kind() == reflect.Uint8: + // We need an addressable interface to convert the type + // to a byte slice. However, the reflect package won't + // give us an interface on certain things like + // unexported struct fields in order to enforce + // visibility rules. We use unsafe, when available, to + // bypass these restrictions since this package does not + // mutate the values. + vs := v + if !vs.CanInterface() || !vs.CanAddr() { + vs = unsafeReflectValue(vs) + } + if !UnsafeDisabled { + vs = vs.Slice(0, numEntries) + + // Use the existing uint8 slice if it can be + // type asserted. + iface := vs.Interface() + if slice, ok := iface.([]uint8); ok { + buf = slice + doHexDump = true + break + } + } + + // The underlying data needs to be converted if it can't + // be type asserted to a uint8 slice. + doConvert = true + } + + // Copy and convert the underlying type if needed. + if doConvert && vt.ConvertibleTo(uint8Type) { + // Convert and copy each element into a uint8 byte + // slice. + buf = make([]uint8, numEntries) + for i := 0; i < numEntries; i++ { + vv := v.Index(i) + buf[i] = uint8(vv.Convert(uint8Type).Uint()) + } + doHexDump = true + } + } + + // Hexdump the entire slice as needed. + if doHexDump { + indent := strings.Repeat(d.cs.Indent, d.depth) + str := indent + hex.Dump(buf) + str = strings.Replace(str, "\n", "\n"+indent, -1) + str = strings.TrimRight(str, d.cs.Indent) + d.w.Write([]byte(str)) + return + } + + // Recursively call dump for each item. + for i := 0; i < numEntries; i++ { + d.dump(d.unpackValue(v.Index(i))) + if i < (numEntries - 1) { + d.w.Write(commaNewlineBytes) + } else { + d.w.Write(newlineBytes) + } + } +} + +// dump is the main workhorse for dumping a value. It uses the passed reflect +// value to figure out what kind of object we are dealing with and formats it +// appropriately. It is a recursive function, however circular data structures +// are detected and handled properly. +func (d *dumpState) dump(v reflect.Value) { + // Handle invalid reflect values immediately. + kind := v.Kind() + if kind == reflect.Invalid { + d.w.Write(invalidAngleBytes) + return + } + + // Handle pointers specially. + if kind == reflect.Ptr { + d.indent() + d.dumpPtr(v) + return + } + + // Print type information unless already handled elsewhere. + if !d.ignoreNextType { + d.indent() + d.w.Write(openParenBytes) + d.w.Write([]byte(v.Type().String())) + d.w.Write(closeParenBytes) + d.w.Write(spaceBytes) + } + d.ignoreNextType = false + + // Display length and capacity if the built-in len and cap functions + // work with the value's kind and the len/cap itself is non-zero. + valueLen, valueCap := 0, 0 + switch v.Kind() { + case reflect.Array, reflect.Slice, reflect.Chan: + valueLen, valueCap = v.Len(), v.Cap() + case reflect.Map, reflect.String: + valueLen = v.Len() + } + if valueLen != 0 || valueCap != 0 { + d.w.Write(openParenBytes) + if valueLen != 0 { + d.w.Write(lenEqualsBytes) + printInt(d.w, int64(valueLen), 10) + } + if valueCap != 0 { + if valueLen != 0 { + d.w.Write(spaceBytes) + } + d.w.Write(capEqualsBytes) + printInt(d.w, int64(valueCap), 10) + } + d.w.Write(closeParenBytes) + d.w.Write(spaceBytes) + } + + // Call Stringer/error interfaces if they exist and the handle methods flag + // is enabled + if !d.cs.DisableMethods { + if (kind != reflect.Invalid) && (kind != reflect.Interface) { + if handled := handleMethods(d.cs, d.w, v); handled { + return + } + } + } + + switch kind { + case reflect.Invalid: + // Do nothing. We should never get here since invalid has already + // been handled above. + + case reflect.Bool: + printBool(d.w, v.Bool()) + + case reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, reflect.Int: + printInt(d.w, v.Int(), 10) + + case reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uint: + printUint(d.w, v.Uint(), 10) + + case reflect.Float32: + printFloat(d.w, v.Float(), 32) + + case reflect.Float64: + printFloat(d.w, v.Float(), 64) + + case reflect.Complex64: + printComplex(d.w, v.Complex(), 32) + + case reflect.Complex128: + printComplex(d.w, v.Complex(), 64) + + case reflect.Slice: + if v.IsNil() { + d.w.Write(nilAngleBytes) + break + } + fallthrough + + case reflect.Array: + d.w.Write(openBraceNewlineBytes) + d.depth++ + if (d.cs.MaxDepth != 0) && (d.depth > d.cs.MaxDepth) { + d.indent() + d.w.Write(maxNewlineBytes) + } else { + d.dumpSlice(v) + } + d.depth-- + d.indent() + d.w.Write(closeBraceBytes) + + case reflect.String: + d.w.Write([]byte(strconv.Quote(v.String()))) + + case reflect.Interface: + // The only time we should get here is for nil interfaces due to + // unpackValue calls. + if v.IsNil() { + d.w.Write(nilAngleBytes) + } + + case reflect.Ptr: + // Do nothing. We should never get here since pointers have already + // been handled above. + + case reflect.Map: + // nil maps should be indicated as different than empty maps + if v.IsNil() { + d.w.Write(nilAngleBytes) + break + } + + d.w.Write(openBraceNewlineBytes) + d.depth++ + if (d.cs.MaxDepth != 0) && (d.depth > d.cs.MaxDepth) { + d.indent() + d.w.Write(maxNewlineBytes) + } else { + numEntries := v.Len() + keys := v.MapKeys() + if d.cs.SortKeys { + sortValues(keys, d.cs) + } + for i, key := range keys { + d.dump(d.unpackValue(key)) + d.w.Write(colonSpaceBytes) + d.ignoreNextIndent = true + d.dump(d.unpackValue(v.MapIndex(key))) + if i < (numEntries - 1) { + d.w.Write(commaNewlineBytes) + } else { + d.w.Write(newlineBytes) + } + } + } + d.depth-- + d.indent() + d.w.Write(closeBraceBytes) + + case reflect.Struct: + d.w.Write(openBraceNewlineBytes) + d.depth++ + if (d.cs.MaxDepth != 0) && (d.depth > d.cs.MaxDepth) { + d.indent() + d.w.Write(maxNewlineBytes) + } else { + vt := v.Type() + numFields := v.NumField() + for i := 0; i < numFields; i++ { + d.indent() + vtf := vt.Field(i) + d.w.Write([]byte(vtf.Name)) + d.w.Write(colonSpaceBytes) + d.ignoreNextIndent = true + d.dump(d.unpackValue(v.Field(i))) + if i < (numFields - 1) { + d.w.Write(commaNewlineBytes) + } else { + d.w.Write(newlineBytes) + } + } + } + d.depth-- + d.indent() + d.w.Write(closeBraceBytes) + + case reflect.Uintptr: + printHexPtr(d.w, uintptr(v.Uint())) + + case reflect.UnsafePointer, reflect.Chan, reflect.Func: + printHexPtr(d.w, v.Pointer()) + + // There were not any other types at the time this code was written, but + // fall back to letting the default fmt package handle it in case any new + // types are added. + default: + if v.CanInterface() { + fmt.Fprintf(d.w, "%v", v.Interface()) + } else { + fmt.Fprintf(d.w, "%v", v.String()) + } + } +} + +// fdump is a helper function to consolidate the logic from the various public +// methods which take varying writers and config states. +func fdump(cs *ConfigState, w io.Writer, a ...interface{}) { + for _, arg := range a { + if arg == nil { + w.Write(interfaceBytes) + w.Write(spaceBytes) + w.Write(nilAngleBytes) + w.Write(newlineBytes) + continue + } + + d := dumpState{w: w, cs: cs} + d.pointers = make(map[uintptr]int) + d.dump(reflect.ValueOf(arg)) + d.w.Write(newlineBytes) + } +} + +// Fdump formats and displays the passed arguments to io.Writer w. It formats +// exactly the same as Dump. +func Fdump(w io.Writer, a ...interface{}) { + fdump(&Config, w, a...) +} + +// Sdump returns a string with the passed arguments formatted exactly the same +// as Dump. +func Sdump(a ...interface{}) string { + var buf bytes.Buffer + fdump(&Config, &buf, a...) + return buf.String() +} + +/* +Dump displays the passed parameters to standard out with newlines, customizable +indentation, and additional debug information such as complete types and all +pointer addresses used to indirect to the final value. It provides the +following features over the built-in printing facilities provided by the fmt +package: + + * Pointers are dereferenced and followed + * Circular data structures are detected and handled properly + * Custom Stringer/error interfaces are optionally invoked, including + on unexported types + * Custom types which only implement the Stringer/error interfaces via + a pointer receiver are optionally invoked when passing non-pointer + variables + * Byte arrays and slices are dumped like the hexdump -C command which + includes offsets, byte values in hex, and ASCII output + +The configuration options are controlled by an exported package global, +spew.Config. See ConfigState for options documentation. + +See Fdump if you would prefer dumping to an arbitrary io.Writer or Sdump to +get the formatted result as a string. +*/ +func Dump(a ...interface{}) { + fdump(&Config, os.Stdout, a...) +} diff --git a/vendor/github.com/davecgh/go-spew/spew/format.go b/vendor/github.com/davecgh/go-spew/spew/format.go new file mode 100644 index 000000000..ecf3b80e2 --- /dev/null +++ b/vendor/github.com/davecgh/go-spew/spew/format.go @@ -0,0 +1,419 @@ +/* + * Copyright (c) 2013 Dave Collins + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +package spew + +import ( + "bytes" + "fmt" + "reflect" + "strconv" + "strings" +) + +// supportedFlags is a list of all the character flags supported by fmt package. +const supportedFlags = "0-+# " + +// formatState implements the fmt.Formatter interface and contains information +// about the state of a formatting operation. The NewFormatter function can +// be used to get a new Formatter which can be used directly as arguments +// in standard fmt package printing calls. +type formatState struct { + value interface{} + fs fmt.State + depth int + pointers map[uintptr]int + ignoreNextType bool + cs *ConfigState +} + +// buildDefaultFormat recreates the original format string without precision +// and width information to pass in to fmt.Sprintf in the case of an +// unrecognized type. Unless new types are added to the language, this +// function won't ever be called. +func (f *formatState) buildDefaultFormat() (format string) { + buf := bytes.NewBuffer(percentBytes) + + for _, flag := range supportedFlags { + if f.fs.Flag(int(flag)) { + buf.WriteRune(flag) + } + } + + buf.WriteRune('v') + + format = buf.String() + return format +} + +// constructOrigFormat recreates the original format string including precision +// and width information to pass along to the standard fmt package. This allows +// automatic deferral of all format strings this package doesn't support. +func (f *formatState) constructOrigFormat(verb rune) (format string) { + buf := bytes.NewBuffer(percentBytes) + + for _, flag := range supportedFlags { + if f.fs.Flag(int(flag)) { + buf.WriteRune(flag) + } + } + + if width, ok := f.fs.Width(); ok { + buf.WriteString(strconv.Itoa(width)) + } + + if precision, ok := f.fs.Precision(); ok { + buf.Write(precisionBytes) + buf.WriteString(strconv.Itoa(precision)) + } + + buf.WriteRune(verb) + + format = buf.String() + return format +} + +// unpackValue returns values inside of non-nil interfaces when possible and +// ensures that types for values which have been unpacked from an interface +// are displayed when the show types flag is also set. +// This is useful for data types like structs, arrays, slices, and maps which +// can contain varying types packed inside an interface. +func (f *formatState) unpackValue(v reflect.Value) reflect.Value { + if v.Kind() == reflect.Interface { + f.ignoreNextType = false + if !v.IsNil() { + v = v.Elem() + } + } + return v +} + +// formatPtr handles formatting of pointers by indirecting them as necessary. +func (f *formatState) formatPtr(v reflect.Value) { + // Display nil if top level pointer is nil. + showTypes := f.fs.Flag('#') + if v.IsNil() && (!showTypes || f.ignoreNextType) { + f.fs.Write(nilAngleBytes) + return + } + + // Remove pointers at or below the current depth from map used to detect + // circular refs. + for k, depth := range f.pointers { + if depth >= f.depth { + delete(f.pointers, k) + } + } + + // Keep list of all dereferenced pointers to possibly show later. + pointerChain := make([]uintptr, 0) + + // Figure out how many levels of indirection there are by derferencing + // pointers and unpacking interfaces down the chain while detecting circular + // references. + nilFound := false + cycleFound := false + indirects := 0 + ve := v + for ve.Kind() == reflect.Ptr { + if ve.IsNil() { + nilFound = true + break + } + indirects++ + addr := ve.Pointer() + pointerChain = append(pointerChain, addr) + if pd, ok := f.pointers[addr]; ok && pd < f.depth { + cycleFound = true + indirects-- + break + } + f.pointers[addr] = f.depth + + ve = ve.Elem() + if ve.Kind() == reflect.Interface { + if ve.IsNil() { + nilFound = true + break + } + ve = ve.Elem() + } + } + + // Display type or indirection level depending on flags. + if showTypes && !f.ignoreNextType { + f.fs.Write(openParenBytes) + f.fs.Write(bytes.Repeat(asteriskBytes, indirects)) + f.fs.Write([]byte(ve.Type().String())) + f.fs.Write(closeParenBytes) + } else { + if nilFound || cycleFound { + indirects += strings.Count(ve.Type().String(), "*") + } + f.fs.Write(openAngleBytes) + f.fs.Write([]byte(strings.Repeat("*", indirects))) + f.fs.Write(closeAngleBytes) + } + + // Display pointer information depending on flags. + if f.fs.Flag('+') && (len(pointerChain) > 0) { + f.fs.Write(openParenBytes) + for i, addr := range pointerChain { + if i > 0 { + f.fs.Write(pointerChainBytes) + } + printHexPtr(f.fs, addr) + } + f.fs.Write(closeParenBytes) + } + + // Display dereferenced value. + switch { + case nilFound == true: + f.fs.Write(nilAngleBytes) + + case cycleFound == true: + f.fs.Write(circularShortBytes) + + default: + f.ignoreNextType = true + f.format(ve) + } +} + +// format is the main workhorse for providing the Formatter interface. It +// uses the passed reflect value to figure out what kind of object we are +// dealing with and formats it appropriately. It is a recursive function, +// however circular data structures are detected and handled properly. +func (f *formatState) format(v reflect.Value) { + // Handle invalid reflect values immediately. + kind := v.Kind() + if kind == reflect.Invalid { + f.fs.Write(invalidAngleBytes) + return + } + + // Handle pointers specially. + if kind == reflect.Ptr { + f.formatPtr(v) + return + } + + // Print type information unless already handled elsewhere. + if !f.ignoreNextType && f.fs.Flag('#') { + f.fs.Write(openParenBytes) + f.fs.Write([]byte(v.Type().String())) + f.fs.Write(closeParenBytes) + } + f.ignoreNextType = false + + // Call Stringer/error interfaces if they exist and the handle methods + // flag is enabled. + if !f.cs.DisableMethods { + if (kind != reflect.Invalid) && (kind != reflect.Interface) { + if handled := handleMethods(f.cs, f.fs, v); handled { + return + } + } + } + + switch kind { + case reflect.Invalid: + // Do nothing. We should never get here since invalid has already + // been handled above. + + case reflect.Bool: + printBool(f.fs, v.Bool()) + + case reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, reflect.Int: + printInt(f.fs, v.Int(), 10) + + case reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uint: + printUint(f.fs, v.Uint(), 10) + + case reflect.Float32: + printFloat(f.fs, v.Float(), 32) + + case reflect.Float64: + printFloat(f.fs, v.Float(), 64) + + case reflect.Complex64: + printComplex(f.fs, v.Complex(), 32) + + case reflect.Complex128: + printComplex(f.fs, v.Complex(), 64) + + case reflect.Slice: + if v.IsNil() { + f.fs.Write(nilAngleBytes) + break + } + fallthrough + + case reflect.Array: + f.fs.Write(openBracketBytes) + f.depth++ + if (f.cs.MaxDepth != 0) && (f.depth > f.cs.MaxDepth) { + f.fs.Write(maxShortBytes) + } else { + numEntries := v.Len() + for i := 0; i < numEntries; i++ { + if i > 0 { + f.fs.Write(spaceBytes) + } + f.ignoreNextType = true + f.format(f.unpackValue(v.Index(i))) + } + } + f.depth-- + f.fs.Write(closeBracketBytes) + + case reflect.String: + f.fs.Write([]byte(v.String())) + + case reflect.Interface: + // The only time we should get here is for nil interfaces due to + // unpackValue calls. + if v.IsNil() { + f.fs.Write(nilAngleBytes) + } + + case reflect.Ptr: + // Do nothing. We should never get here since pointers have already + // been handled above. + + case reflect.Map: + // nil maps should be indicated as different than empty maps + if v.IsNil() { + f.fs.Write(nilAngleBytes) + break + } + + f.fs.Write(openMapBytes) + f.depth++ + if (f.cs.MaxDepth != 0) && (f.depth > f.cs.MaxDepth) { + f.fs.Write(maxShortBytes) + } else { + keys := v.MapKeys() + if f.cs.SortKeys { + sortValues(keys, f.cs) + } + for i, key := range keys { + if i > 0 { + f.fs.Write(spaceBytes) + } + f.ignoreNextType = true + f.format(f.unpackValue(key)) + f.fs.Write(colonBytes) + f.ignoreNextType = true + f.format(f.unpackValue(v.MapIndex(key))) + } + } + f.depth-- + f.fs.Write(closeMapBytes) + + case reflect.Struct: + numFields := v.NumField() + f.fs.Write(openBraceBytes) + f.depth++ + if (f.cs.MaxDepth != 0) && (f.depth > f.cs.MaxDepth) { + f.fs.Write(maxShortBytes) + } else { + vt := v.Type() + for i := 0; i < numFields; i++ { + if i > 0 { + f.fs.Write(spaceBytes) + } + vtf := vt.Field(i) + if f.fs.Flag('+') || f.fs.Flag('#') { + f.fs.Write([]byte(vtf.Name)) + f.fs.Write(colonBytes) + } + f.format(f.unpackValue(v.Field(i))) + } + } + f.depth-- + f.fs.Write(closeBraceBytes) + + case reflect.Uintptr: + printHexPtr(f.fs, uintptr(v.Uint())) + + case reflect.UnsafePointer, reflect.Chan, reflect.Func: + printHexPtr(f.fs, v.Pointer()) + + // There were not any other types at the time this code was written, but + // fall back to letting the default fmt package handle it if any get added. + default: + format := f.buildDefaultFormat() + if v.CanInterface() { + fmt.Fprintf(f.fs, format, v.Interface()) + } else { + fmt.Fprintf(f.fs, format, v.String()) + } + } +} + +// Format satisfies the fmt.Formatter interface. See NewFormatter for usage +// details. +func (f *formatState) Format(fs fmt.State, verb rune) { + f.fs = fs + + // Use standard formatting for verbs that are not v. + if verb != 'v' { + format := f.constructOrigFormat(verb) + fmt.Fprintf(fs, format, f.value) + return + } + + if f.value == nil { + if fs.Flag('#') { + fs.Write(interfaceBytes) + } + fs.Write(nilAngleBytes) + return + } + + f.format(reflect.ValueOf(f.value)) +} + +// newFormatter is a helper function to consolidate the logic from the various +// public methods which take varying config states. +func newFormatter(cs *ConfigState, v interface{}) fmt.Formatter { + fs := &formatState{value: v, cs: cs} + fs.pointers = make(map[uintptr]int) + return fs +} + +/* +NewFormatter returns a custom formatter that satisfies the fmt.Formatter +interface. As a result, it integrates cleanly with standard fmt package +printing functions. The formatter is useful for inline printing of smaller data +types similar to the standard %v format specifier. + +The custom formatter only responds to the %v (most compact), %+v (adds pointer +addresses), %#v (adds types), or %#+v (adds types and pointer addresses) verb +combinations. Any other verbs such as %x and %q will be sent to the the +standard fmt package for formatting. In addition, the custom formatter ignores +the width and precision arguments (however they will still work on the format +specifiers not handled by the custom formatter). + +Typically this function shouldn't be called directly. It is much easier to make +use of the custom formatter by calling one of the convenience functions such as +Printf, Println, or Fprintf. +*/ +func NewFormatter(v interface{}) fmt.Formatter { + return newFormatter(&Config, v) +} diff --git a/vendor/github.com/davecgh/go-spew/spew/spew.go b/vendor/github.com/davecgh/go-spew/spew/spew.go new file mode 100644 index 000000000..d8233f542 --- /dev/null +++ b/vendor/github.com/davecgh/go-spew/spew/spew.go @@ -0,0 +1,148 @@ +/* + * Copyright (c) 2013 Dave Collins + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +package spew + +import ( + "fmt" + "io" +) + +// Errorf is a wrapper for fmt.Errorf that treats each argument as if it were +// passed with a default Formatter interface returned by NewFormatter. It +// returns the formatted string as a value that satisfies error. See +// NewFormatter for formatting details. +// +// This function is shorthand for the following syntax: +// +// fmt.Errorf(format, spew.NewFormatter(a), spew.NewFormatter(b)) +func Errorf(format string, a ...interface{}) (err error) { + return fmt.Errorf(format, convertArgs(a)...) +} + +// Fprint is a wrapper for fmt.Fprint that treats each argument as if it were +// passed with a default Formatter interface returned by NewFormatter. It +// returns the number of bytes written and any write error encountered. See +// NewFormatter for formatting details. +// +// This function is shorthand for the following syntax: +// +// fmt.Fprint(w, spew.NewFormatter(a), spew.NewFormatter(b)) +func Fprint(w io.Writer, a ...interface{}) (n int, err error) { + return fmt.Fprint(w, convertArgs(a)...) +} + +// Fprintf is a wrapper for fmt.Fprintf that treats each argument as if it were +// passed with a default Formatter interface returned by NewFormatter. It +// returns the number of bytes written and any write error encountered. See +// NewFormatter for formatting details. +// +// This function is shorthand for the following syntax: +// +// fmt.Fprintf(w, format, spew.NewFormatter(a), spew.NewFormatter(b)) +func Fprintf(w io.Writer, format string, a ...interface{}) (n int, err error) { + return fmt.Fprintf(w, format, convertArgs(a)...) +} + +// Fprintln is a wrapper for fmt.Fprintln that treats each argument as if it +// passed with a default Formatter interface returned by NewFormatter. See +// NewFormatter for formatting details. +// +// This function is shorthand for the following syntax: +// +// fmt.Fprintln(w, spew.NewFormatter(a), spew.NewFormatter(b)) +func Fprintln(w io.Writer, a ...interface{}) (n int, err error) { + return fmt.Fprintln(w, convertArgs(a)...) +} + +// Print is a wrapper for fmt.Print that treats each argument as if it were +// passed with a default Formatter interface returned by NewFormatter. It +// returns the number of bytes written and any write error encountered. See +// NewFormatter for formatting details. +// +// This function is shorthand for the following syntax: +// +// fmt.Print(spew.NewFormatter(a), spew.NewFormatter(b)) +func Print(a ...interface{}) (n int, err error) { + return fmt.Print(convertArgs(a)...) +} + +// Printf is a wrapper for fmt.Printf that treats each argument as if it were +// passed with a default Formatter interface returned by NewFormatter. It +// returns the number of bytes written and any write error encountered. See +// NewFormatter for formatting details. +// +// This function is shorthand for the following syntax: +// +// fmt.Printf(format, spew.NewFormatter(a), spew.NewFormatter(b)) +func Printf(format string, a ...interface{}) (n int, err error) { + return fmt.Printf(format, convertArgs(a)...) +} + +// Println is a wrapper for fmt.Println that treats each argument as if it were +// passed with a default Formatter interface returned by NewFormatter. It +// returns the number of bytes written and any write error encountered. See +// NewFormatter for formatting details. +// +// This function is shorthand for the following syntax: +// +// fmt.Println(spew.NewFormatter(a), spew.NewFormatter(b)) +func Println(a ...interface{}) (n int, err error) { + return fmt.Println(convertArgs(a)...) +} + +// Sprint is a wrapper for fmt.Sprint that treats each argument as if it were +// passed with a default Formatter interface returned by NewFormatter. It +// returns the resulting string. See NewFormatter for formatting details. +// +// This function is shorthand for the following syntax: +// +// fmt.Sprint(spew.NewFormatter(a), spew.NewFormatter(b)) +func Sprint(a ...interface{}) string { + return fmt.Sprint(convertArgs(a)...) +} + +// Sprintf is a wrapper for fmt.Sprintf that treats each argument as if it were +// passed with a default Formatter interface returned by NewFormatter. It +// returns the resulting string. See NewFormatter for formatting details. +// +// This function is shorthand for the following syntax: +// +// fmt.Sprintf(format, spew.NewFormatter(a), spew.NewFormatter(b)) +func Sprintf(format string, a ...interface{}) string { + return fmt.Sprintf(format, convertArgs(a)...) +} + +// Sprintln is a wrapper for fmt.Sprintln that treats each argument as if it +// were passed with a default Formatter interface returned by NewFormatter. It +// returns the resulting string. See NewFormatter for formatting details. +// +// This function is shorthand for the following syntax: +// +// fmt.Sprintln(spew.NewFormatter(a), spew.NewFormatter(b)) +func Sprintln(a ...interface{}) string { + return fmt.Sprintln(convertArgs(a)...) +} + +// convertArgs accepts a slice of arguments and returns a slice of the same +// length with each argument converted to a default spew Formatter interface. +func convertArgs(args []interface{}) (formatters []interface{}) { + formatters = make([]interface{}, len(args)) + for index, arg := range args { + formatters[index] = NewFormatter(arg) + } + return formatters +} diff --git a/vendor/github.com/pmezard/go-difflib/LICENSE b/vendor/github.com/pmezard/go-difflib/LICENSE new file mode 100644 index 000000000..c67dad612 --- /dev/null +++ b/vendor/github.com/pmezard/go-difflib/LICENSE @@ -0,0 +1,27 @@ +Copyright (c) 2013, Patrick Mezard +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + Redistributions in binary form must reproduce the above copyright +notice, this list of conditions and the following disclaimer in the +documentation and/or other materials provided with the distribution. + The names of its contributors may not be used to endorse or promote +products derived from this software without specific prior written +permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS +IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A +PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED +TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/github.com/pmezard/go-difflib/difflib/difflib.go b/vendor/github.com/pmezard/go-difflib/difflib/difflib.go new file mode 100644 index 000000000..003e99fad --- /dev/null +++ b/vendor/github.com/pmezard/go-difflib/difflib/difflib.go @@ -0,0 +1,772 @@ +// Package difflib is a partial port of Python difflib module. +// +// It provides tools to compare sequences of strings and generate textual diffs. +// +// The following class and functions have been ported: +// +// - SequenceMatcher +// +// - unified_diff +// +// - context_diff +// +// Getting unified diffs was the main goal of the port. Keep in mind this code +// is mostly suitable to output text differences in a human friendly way, there +// are no guarantees generated diffs are consumable by patch(1). +package difflib + +import ( + "bufio" + "bytes" + "fmt" + "io" + "strings" +) + +func min(a, b int) int { + if a < b { + return a + } + return b +} + +func max(a, b int) int { + if a > b { + return a + } + return b +} + +func calculateRatio(matches, length int) float64 { + if length > 0 { + return 2.0 * float64(matches) / float64(length) + } + return 1.0 +} + +type Match struct { + A int + B int + Size int +} + +type OpCode struct { + Tag byte + I1 int + I2 int + J1 int + J2 int +} + +// SequenceMatcher compares sequence of strings. The basic +// algorithm predates, and is a little fancier than, an algorithm +// published in the late 1980's by Ratcliff and Obershelp under the +// hyperbolic name "gestalt pattern matching". The basic idea is to find +// the longest contiguous matching subsequence that contains no "junk" +// elements (R-O doesn't address junk). The same idea is then applied +// recursively to the pieces of the sequences to the left and to the right +// of the matching subsequence. This does not yield minimal edit +// sequences, but does tend to yield matches that "look right" to people. +// +// SequenceMatcher tries to compute a "human-friendly diff" between two +// sequences. Unlike e.g. UNIX(tm) diff, the fundamental notion is the +// longest *contiguous* & junk-free matching subsequence. That's what +// catches peoples' eyes. The Windows(tm) windiff has another interesting +// notion, pairing up elements that appear uniquely in each sequence. +// That, and the method here, appear to yield more intuitive difference +// reports than does diff. This method appears to be the least vulnerable +// to synching up on blocks of "junk lines", though (like blank lines in +// ordinary text files, or maybe "

" lines in HTML files). That may be +// because this is the only method of the 3 that has a *concept* of +// "junk" . +// +// Timing: Basic R-O is cubic time worst case and quadratic time expected +// case. SequenceMatcher is quadratic time for the worst case and has +// expected-case behavior dependent in a complicated way on how many +// elements the sequences have in common; best case time is linear. +type SequenceMatcher struct { + a []string + b []string + b2j map[string][]int + IsJunk func(string) bool + autoJunk bool + bJunk map[string]struct{} + matchingBlocks []Match + fullBCount map[string]int + bPopular map[string]struct{} + opCodes []OpCode +} + +func NewMatcher(a, b []string) *SequenceMatcher { + m := SequenceMatcher{autoJunk: true} + m.SetSeqs(a, b) + return &m +} + +func NewMatcherWithJunk(a, b []string, autoJunk bool, + isJunk func(string) bool) *SequenceMatcher { + + m := SequenceMatcher{IsJunk: isJunk, autoJunk: autoJunk} + m.SetSeqs(a, b) + return &m +} + +// Set two sequences to be compared. +func (m *SequenceMatcher) SetSeqs(a, b []string) { + m.SetSeq1(a) + m.SetSeq2(b) +} + +// Set the first sequence to be compared. The second sequence to be compared is +// not changed. +// +// SequenceMatcher computes and caches detailed information about the second +// sequence, so if you want to compare one sequence S against many sequences, +// use .SetSeq2(s) once and call .SetSeq1(x) repeatedly for each of the other +// sequences. +// +// See also SetSeqs() and SetSeq2(). +func (m *SequenceMatcher) SetSeq1(a []string) { + if &a == &m.a { + return + } + m.a = a + m.matchingBlocks = nil + m.opCodes = nil +} + +// Set the second sequence to be compared. The first sequence to be compared is +// not changed. +func (m *SequenceMatcher) SetSeq2(b []string) { + if &b == &m.b { + return + } + m.b = b + m.matchingBlocks = nil + m.opCodes = nil + m.fullBCount = nil + m.chainB() +} + +func (m *SequenceMatcher) chainB() { + // Populate line -> index mapping + b2j := map[string][]int{} + for i, s := range m.b { + indices := b2j[s] + indices = append(indices, i) + b2j[s] = indices + } + + // Purge junk elements + m.bJunk = map[string]struct{}{} + if m.IsJunk != nil { + junk := m.bJunk + for s, _ := range b2j { + if m.IsJunk(s) { + junk[s] = struct{}{} + } + } + for s, _ := range junk { + delete(b2j, s) + } + } + + // Purge remaining popular elements + popular := map[string]struct{}{} + n := len(m.b) + if m.autoJunk && n >= 200 { + ntest := n/100 + 1 + for s, indices := range b2j { + if len(indices) > ntest { + popular[s] = struct{}{} + } + } + for s, _ := range popular { + delete(b2j, s) + } + } + m.bPopular = popular + m.b2j = b2j +} + +func (m *SequenceMatcher) isBJunk(s string) bool { + _, ok := m.bJunk[s] + return ok +} + +// Find longest matching block in a[alo:ahi] and b[blo:bhi]. +// +// If IsJunk is not defined: +// +// Return (i,j,k) such that a[i:i+k] is equal to b[j:j+k], where +// alo <= i <= i+k <= ahi +// blo <= j <= j+k <= bhi +// and for all (i',j',k') meeting those conditions, +// k >= k' +// i <= i' +// and if i == i', j <= j' +// +// In other words, of all maximal matching blocks, return one that +// starts earliest in a, and of all those maximal matching blocks that +// start earliest in a, return the one that starts earliest in b. +// +// If IsJunk is defined, first the longest matching block is +// determined as above, but with the additional restriction that no +// junk element appears in the block. Then that block is extended as +// far as possible by matching (only) junk elements on both sides. So +// the resulting block never matches on junk except as identical junk +// happens to be adjacent to an "interesting" match. +// +// If no blocks match, return (alo, blo, 0). +func (m *SequenceMatcher) findLongestMatch(alo, ahi, blo, bhi int) Match { + // CAUTION: stripping common prefix or suffix would be incorrect. + // E.g., + // ab + // acab + // Longest matching block is "ab", but if common prefix is + // stripped, it's "a" (tied with "b"). UNIX(tm) diff does so + // strip, so ends up claiming that ab is changed to acab by + // inserting "ca" in the middle. That's minimal but unintuitive: + // "it's obvious" that someone inserted "ac" at the front. + // Windiff ends up at the same place as diff, but by pairing up + // the unique 'b's and then matching the first two 'a's. + besti, bestj, bestsize := alo, blo, 0 + + // find longest junk-free match + // during an iteration of the loop, j2len[j] = length of longest + // junk-free match ending with a[i-1] and b[j] + j2len := map[int]int{} + for i := alo; i != ahi; i++ { + // look at all instances of a[i] in b; note that because + // b2j has no junk keys, the loop is skipped if a[i] is junk + newj2len := map[int]int{} + for _, j := range m.b2j[m.a[i]] { + // a[i] matches b[j] + if j < blo { + continue + } + if j >= bhi { + break + } + k := j2len[j-1] + 1 + newj2len[j] = k + if k > bestsize { + besti, bestj, bestsize = i-k+1, j-k+1, k + } + } + j2len = newj2len + } + + // Extend the best by non-junk elements on each end. In particular, + // "popular" non-junk elements aren't in b2j, which greatly speeds + // the inner loop above, but also means "the best" match so far + // doesn't contain any junk *or* popular non-junk elements. + for besti > alo && bestj > blo && !m.isBJunk(m.b[bestj-1]) && + m.a[besti-1] == m.b[bestj-1] { + besti, bestj, bestsize = besti-1, bestj-1, bestsize+1 + } + for besti+bestsize < ahi && bestj+bestsize < bhi && + !m.isBJunk(m.b[bestj+bestsize]) && + m.a[besti+bestsize] == m.b[bestj+bestsize] { + bestsize += 1 + } + + // Now that we have a wholly interesting match (albeit possibly + // empty!), we may as well suck up the matching junk on each + // side of it too. Can't think of a good reason not to, and it + // saves post-processing the (possibly considerable) expense of + // figuring out what to do with it. In the case of an empty + // interesting match, this is clearly the right thing to do, + // because no other kind of match is possible in the regions. + for besti > alo && bestj > blo && m.isBJunk(m.b[bestj-1]) && + m.a[besti-1] == m.b[bestj-1] { + besti, bestj, bestsize = besti-1, bestj-1, bestsize+1 + } + for besti+bestsize < ahi && bestj+bestsize < bhi && + m.isBJunk(m.b[bestj+bestsize]) && + m.a[besti+bestsize] == m.b[bestj+bestsize] { + bestsize += 1 + } + + return Match{A: besti, B: bestj, Size: bestsize} +} + +// Return list of triples describing matching subsequences. +// +// Each triple is of the form (i, j, n), and means that +// a[i:i+n] == b[j:j+n]. The triples are monotonically increasing in +// i and in j. It's also guaranteed that if (i, j, n) and (i', j', n') are +// adjacent triples in the list, and the second is not the last triple in the +// list, then i+n != i' or j+n != j'. IOW, adjacent triples never describe +// adjacent equal blocks. +// +// The last triple is a dummy, (len(a), len(b), 0), and is the only +// triple with n==0. +func (m *SequenceMatcher) GetMatchingBlocks() []Match { + if m.matchingBlocks != nil { + return m.matchingBlocks + } + + var matchBlocks func(alo, ahi, blo, bhi int, matched []Match) []Match + matchBlocks = func(alo, ahi, blo, bhi int, matched []Match) []Match { + match := m.findLongestMatch(alo, ahi, blo, bhi) + i, j, k := match.A, match.B, match.Size + if match.Size > 0 { + if alo < i && blo < j { + matched = matchBlocks(alo, i, blo, j, matched) + } + matched = append(matched, match) + if i+k < ahi && j+k < bhi { + matched = matchBlocks(i+k, ahi, j+k, bhi, matched) + } + } + return matched + } + matched := matchBlocks(0, len(m.a), 0, len(m.b), nil) + + // It's possible that we have adjacent equal blocks in the + // matching_blocks list now. + nonAdjacent := []Match{} + i1, j1, k1 := 0, 0, 0 + for _, b := range matched { + // Is this block adjacent to i1, j1, k1? + i2, j2, k2 := b.A, b.B, b.Size + if i1+k1 == i2 && j1+k1 == j2 { + // Yes, so collapse them -- this just increases the length of + // the first block by the length of the second, and the first + // block so lengthened remains the block to compare against. + k1 += k2 + } else { + // Not adjacent. Remember the first block (k1==0 means it's + // the dummy we started with), and make the second block the + // new block to compare against. + if k1 > 0 { + nonAdjacent = append(nonAdjacent, Match{i1, j1, k1}) + } + i1, j1, k1 = i2, j2, k2 + } + } + if k1 > 0 { + nonAdjacent = append(nonAdjacent, Match{i1, j1, k1}) + } + + nonAdjacent = append(nonAdjacent, Match{len(m.a), len(m.b), 0}) + m.matchingBlocks = nonAdjacent + return m.matchingBlocks +} + +// Return list of 5-tuples describing how to turn a into b. +// +// Each tuple is of the form (tag, i1, i2, j1, j2). The first tuple +// has i1 == j1 == 0, and remaining tuples have i1 == the i2 from the +// tuple preceding it, and likewise for j1 == the previous j2. +// +// The tags are characters, with these meanings: +// +// 'r' (replace): a[i1:i2] should be replaced by b[j1:j2] +// +// 'd' (delete): a[i1:i2] should be deleted, j1==j2 in this case. +// +// 'i' (insert): b[j1:j2] should be inserted at a[i1:i1], i1==i2 in this case. +// +// 'e' (equal): a[i1:i2] == b[j1:j2] +func (m *SequenceMatcher) GetOpCodes() []OpCode { + if m.opCodes != nil { + return m.opCodes + } + i, j := 0, 0 + matching := m.GetMatchingBlocks() + opCodes := make([]OpCode, 0, len(matching)) + for _, m := range matching { + // invariant: we've pumped out correct diffs to change + // a[:i] into b[:j], and the next matching block is + // a[ai:ai+size] == b[bj:bj+size]. So we need to pump + // out a diff to change a[i:ai] into b[j:bj], pump out + // the matching block, and move (i,j) beyond the match + ai, bj, size := m.A, m.B, m.Size + tag := byte(0) + if i < ai && j < bj { + tag = 'r' + } else if i < ai { + tag = 'd' + } else if j < bj { + tag = 'i' + } + if tag > 0 { + opCodes = append(opCodes, OpCode{tag, i, ai, j, bj}) + } + i, j = ai+size, bj+size + // the list of matching blocks is terminated by a + // sentinel with size 0 + if size > 0 { + opCodes = append(opCodes, OpCode{'e', ai, i, bj, j}) + } + } + m.opCodes = opCodes + return m.opCodes +} + +// Isolate change clusters by eliminating ranges with no changes. +// +// Return a generator of groups with up to n lines of context. +// Each group is in the same format as returned by GetOpCodes(). +func (m *SequenceMatcher) GetGroupedOpCodes(n int) [][]OpCode { + if n < 0 { + n = 3 + } + codes := m.GetOpCodes() + if len(codes) == 0 { + codes = []OpCode{OpCode{'e', 0, 1, 0, 1}} + } + // Fixup leading and trailing groups if they show no changes. + if codes[0].Tag == 'e' { + c := codes[0] + i1, i2, j1, j2 := c.I1, c.I2, c.J1, c.J2 + codes[0] = OpCode{c.Tag, max(i1, i2-n), i2, max(j1, j2-n), j2} + } + if codes[len(codes)-1].Tag == 'e' { + c := codes[len(codes)-1] + i1, i2, j1, j2 := c.I1, c.I2, c.J1, c.J2 + codes[len(codes)-1] = OpCode{c.Tag, i1, min(i2, i1+n), j1, min(j2, j1+n)} + } + nn := n + n + groups := [][]OpCode{} + group := []OpCode{} + for _, c := range codes { + i1, i2, j1, j2 := c.I1, c.I2, c.J1, c.J2 + // End the current group and start a new one whenever + // there is a large range with no changes. + if c.Tag == 'e' && i2-i1 > nn { + group = append(group, OpCode{c.Tag, i1, min(i2, i1+n), + j1, min(j2, j1+n)}) + groups = append(groups, group) + group = []OpCode{} + i1, j1 = max(i1, i2-n), max(j1, j2-n) + } + group = append(group, OpCode{c.Tag, i1, i2, j1, j2}) + } + if len(group) > 0 && !(len(group) == 1 && group[0].Tag == 'e') { + groups = append(groups, group) + } + return groups +} + +// Return a measure of the sequences' similarity (float in [0,1]). +// +// Where T is the total number of elements in both sequences, and +// M is the number of matches, this is 2.0*M / T. +// Note that this is 1 if the sequences are identical, and 0 if +// they have nothing in common. +// +// .Ratio() is expensive to compute if you haven't already computed +// .GetMatchingBlocks() or .GetOpCodes(), in which case you may +// want to try .QuickRatio() or .RealQuickRation() first to get an +// upper bound. +func (m *SequenceMatcher) Ratio() float64 { + matches := 0 + for _, m := range m.GetMatchingBlocks() { + matches += m.Size + } + return calculateRatio(matches, len(m.a)+len(m.b)) +} + +// Return an upper bound on ratio() relatively quickly. +// +// This isn't defined beyond that it is an upper bound on .Ratio(), and +// is faster to compute. +func (m *SequenceMatcher) QuickRatio() float64 { + // viewing a and b as multisets, set matches to the cardinality + // of their intersection; this counts the number of matches + // without regard to order, so is clearly an upper bound + if m.fullBCount == nil { + m.fullBCount = map[string]int{} + for _, s := range m.b { + m.fullBCount[s] = m.fullBCount[s] + 1 + } + } + + // avail[x] is the number of times x appears in 'b' less the + // number of times we've seen it in 'a' so far ... kinda + avail := map[string]int{} + matches := 0 + for _, s := range m.a { + n, ok := avail[s] + if !ok { + n = m.fullBCount[s] + } + avail[s] = n - 1 + if n > 0 { + matches += 1 + } + } + return calculateRatio(matches, len(m.a)+len(m.b)) +} + +// Return an upper bound on ratio() very quickly. +// +// This isn't defined beyond that it is an upper bound on .Ratio(), and +// is faster to compute than either .Ratio() or .QuickRatio(). +func (m *SequenceMatcher) RealQuickRatio() float64 { + la, lb := len(m.a), len(m.b) + return calculateRatio(min(la, lb), la+lb) +} + +// Convert range to the "ed" format +func formatRangeUnified(start, stop int) string { + // Per the diff spec at http://www.unix.org/single_unix_specification/ + beginning := start + 1 // lines start numbering with one + length := stop - start + if length == 1 { + return fmt.Sprintf("%d", beginning) + } + if length == 0 { + beginning -= 1 // empty ranges begin at line just before the range + } + return fmt.Sprintf("%d,%d", beginning, length) +} + +// Unified diff parameters +type UnifiedDiff struct { + A []string // First sequence lines + FromFile string // First file name + FromDate string // First file time + B []string // Second sequence lines + ToFile string // Second file name + ToDate string // Second file time + Eol string // Headers end of line, defaults to LF + Context int // Number of context lines +} + +// Compare two sequences of lines; generate the delta as a unified diff. +// +// Unified diffs are a compact way of showing line changes and a few +// lines of context. The number of context lines is set by 'n' which +// defaults to three. +// +// By default, the diff control lines (those with ---, +++, or @@) are +// created with a trailing newline. This is helpful so that inputs +// created from file.readlines() result in diffs that are suitable for +// file.writelines() since both the inputs and outputs have trailing +// newlines. +// +// For inputs that do not have trailing newlines, set the lineterm +// argument to "" so that the output will be uniformly newline free. +// +// The unidiff format normally has a header for filenames and modification +// times. Any or all of these may be specified using strings for +// 'fromfile', 'tofile', 'fromfiledate', and 'tofiledate'. +// The modification times are normally expressed in the ISO 8601 format. +func WriteUnifiedDiff(writer io.Writer, diff UnifiedDiff) error { + buf := bufio.NewWriter(writer) + defer buf.Flush() + wf := func(format string, args ...interface{}) error { + _, err := buf.WriteString(fmt.Sprintf(format, args...)) + return err + } + ws := func(s string) error { + _, err := buf.WriteString(s) + return err + } + + if len(diff.Eol) == 0 { + diff.Eol = "\n" + } + + started := false + m := NewMatcher(diff.A, diff.B) + for _, g := range m.GetGroupedOpCodes(diff.Context) { + if !started { + started = true + fromDate := "" + if len(diff.FromDate) > 0 { + fromDate = "\t" + diff.FromDate + } + toDate := "" + if len(diff.ToDate) > 0 { + toDate = "\t" + diff.ToDate + } + if diff.FromFile != "" || diff.ToFile != "" { + err := wf("--- %s%s%s", diff.FromFile, fromDate, diff.Eol) + if err != nil { + return err + } + err = wf("+++ %s%s%s", diff.ToFile, toDate, diff.Eol) + if err != nil { + return err + } + } + } + first, last := g[0], g[len(g)-1] + range1 := formatRangeUnified(first.I1, last.I2) + range2 := formatRangeUnified(first.J1, last.J2) + if err := wf("@@ -%s +%s @@%s", range1, range2, diff.Eol); err != nil { + return err + } + for _, c := range g { + i1, i2, j1, j2 := c.I1, c.I2, c.J1, c.J2 + if c.Tag == 'e' { + for _, line := range diff.A[i1:i2] { + if err := ws(" " + line); err != nil { + return err + } + } + continue + } + if c.Tag == 'r' || c.Tag == 'd' { + for _, line := range diff.A[i1:i2] { + if err := ws("-" + line); err != nil { + return err + } + } + } + if c.Tag == 'r' || c.Tag == 'i' { + for _, line := range diff.B[j1:j2] { + if err := ws("+" + line); err != nil { + return err + } + } + } + } + } + return nil +} + +// Like WriteUnifiedDiff but returns the diff a string. +func GetUnifiedDiffString(diff UnifiedDiff) (string, error) { + w := &bytes.Buffer{} + err := WriteUnifiedDiff(w, diff) + return string(w.Bytes()), err +} + +// Convert range to the "ed" format. +func formatRangeContext(start, stop int) string { + // Per the diff spec at http://www.unix.org/single_unix_specification/ + beginning := start + 1 // lines start numbering with one + length := stop - start + if length == 0 { + beginning -= 1 // empty ranges begin at line just before the range + } + if length <= 1 { + return fmt.Sprintf("%d", beginning) + } + return fmt.Sprintf("%d,%d", beginning, beginning+length-1) +} + +type ContextDiff UnifiedDiff + +// Compare two sequences of lines; generate the delta as a context diff. +// +// Context diffs are a compact way of showing line changes and a few +// lines of context. The number of context lines is set by diff.Context +// which defaults to three. +// +// By default, the diff control lines (those with *** or ---) are +// created with a trailing newline. +// +// For inputs that do not have trailing newlines, set the diff.Eol +// argument to "" so that the output will be uniformly newline free. +// +// The context diff format normally has a header for filenames and +// modification times. Any or all of these may be specified using +// strings for diff.FromFile, diff.ToFile, diff.FromDate, diff.ToDate. +// The modification times are normally expressed in the ISO 8601 format. +// If not specified, the strings default to blanks. +func WriteContextDiff(writer io.Writer, diff ContextDiff) error { + buf := bufio.NewWriter(writer) + defer buf.Flush() + var diffErr error + wf := func(format string, args ...interface{}) { + _, err := buf.WriteString(fmt.Sprintf(format, args...)) + if diffErr == nil && err != nil { + diffErr = err + } + } + ws := func(s string) { + _, err := buf.WriteString(s) + if diffErr == nil && err != nil { + diffErr = err + } + } + + if len(diff.Eol) == 0 { + diff.Eol = "\n" + } + + prefix := map[byte]string{ + 'i': "+ ", + 'd': "- ", + 'r': "! ", + 'e': " ", + } + + started := false + m := NewMatcher(diff.A, diff.B) + for _, g := range m.GetGroupedOpCodes(diff.Context) { + if !started { + started = true + fromDate := "" + if len(diff.FromDate) > 0 { + fromDate = "\t" + diff.FromDate + } + toDate := "" + if len(diff.ToDate) > 0 { + toDate = "\t" + diff.ToDate + } + if diff.FromFile != "" || diff.ToFile != "" { + wf("*** %s%s%s", diff.FromFile, fromDate, diff.Eol) + wf("--- %s%s%s", diff.ToFile, toDate, diff.Eol) + } + } + + first, last := g[0], g[len(g)-1] + ws("***************" + diff.Eol) + + range1 := formatRangeContext(first.I1, last.I2) + wf("*** %s ****%s", range1, diff.Eol) + for _, c := range g { + if c.Tag == 'r' || c.Tag == 'd' { + for _, cc := range g { + if cc.Tag == 'i' { + continue + } + for _, line := range diff.A[cc.I1:cc.I2] { + ws(prefix[cc.Tag] + line) + } + } + break + } + } + + range2 := formatRangeContext(first.J1, last.J2) + wf("--- %s ----%s", range2, diff.Eol) + for _, c := range g { + if c.Tag == 'r' || c.Tag == 'i' { + for _, cc := range g { + if cc.Tag == 'd' { + continue + } + for _, line := range diff.B[cc.J1:cc.J2] { + ws(prefix[cc.Tag] + line) + } + } + break + } + } + } + return diffErr +} + +// Like WriteContextDiff but returns the diff a string. +func GetContextDiffString(diff ContextDiff) (string, error) { + w := &bytes.Buffer{} + err := WriteContextDiff(w, diff) + return string(w.Bytes()), err +} + +// Split a string on "\n" while preserving them. The output can be used +// as input for UnifiedDiff and ContextDiff structures. +func SplitLines(s string) []string { + lines := strings.SplitAfter(s, "\n") + lines[len(lines)-1] += "\n" + return lines +} diff --git a/vendor/github.com/stretchr/testify/.gitignore b/vendor/github.com/stretchr/testify/.gitignore new file mode 100644 index 000000000..5aacdb7cc --- /dev/null +++ b/vendor/github.com/stretchr/testify/.gitignore @@ -0,0 +1,24 @@ +# Compiled Object files, Static and Dynamic libs (Shared Objects) +*.o +*.a +*.so + +# Folders +_obj +_test + +# Architecture specific extensions/prefixes +*.[568vq] +[568vq].out + +*.cgo1.go +*.cgo2.c +_cgo_defun.c +_cgo_gotypes.go +_cgo_export.* + +_testmain.go + +*.exe + +.DS_Store diff --git a/vendor/github.com/stretchr/testify/.travis.yml b/vendor/github.com/stretchr/testify/.travis.yml new file mode 100644 index 000000000..455923ec6 --- /dev/null +++ b/vendor/github.com/stretchr/testify/.travis.yml @@ -0,0 +1,15 @@ +language: go + +sudo: false + +go: + - 1.1 + - 1.2 + - 1.3 + - 1.4 + - 1.5 + - 1.6 + - tip + +script: + - go test -v ./... diff --git a/vendor/github.com/stretchr/testify/Godeps/Godeps.json b/vendor/github.com/stretchr/testify/Godeps/Godeps.json new file mode 100644 index 000000000..5069ce03d --- /dev/null +++ b/vendor/github.com/stretchr/testify/Godeps/Godeps.json @@ -0,0 +1,21 @@ +{ + "ImportPath": "github.com/stretchr/testify", + "GoVersion": "go1.5", + "Packages": [ + "./..." + ], + "Deps": [ + { + "ImportPath": "github.com/davecgh/go-spew/spew", + "Rev": "5215b55f46b2b919f50a1df0eaa5886afe4e3b3d" + }, + { + "ImportPath": "github.com/pmezard/go-difflib/difflib", + "Rev": "d8ed2627bdf02c080bf22230dbb337003b7aba2d" + }, + { + "ImportPath": "github.com/stretchr/objx", + "Rev": "cbeaeb16a013161a98496fad62933b1d21786672" + } + ] +} diff --git a/vendor/github.com/stretchr/testify/Godeps/Readme b/vendor/github.com/stretchr/testify/Godeps/Readme new file mode 100644 index 000000000..4cdaa53d5 --- /dev/null +++ b/vendor/github.com/stretchr/testify/Godeps/Readme @@ -0,0 +1,5 @@ +This directory tree is generated automatically by godep. + +Please do not edit. + +See https://github.com/tools/godep for more information. diff --git a/vendor/github.com/stretchr/testify/LICENCE.txt b/vendor/github.com/stretchr/testify/LICENCE.txt new file mode 100644 index 000000000..473b670a7 --- /dev/null +++ b/vendor/github.com/stretchr/testify/LICENCE.txt @@ -0,0 +1,22 @@ +Copyright (c) 2012 - 2013 Mat Ryer and Tyler Bunnell + +Please consider promoting this project if you find it useful. + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of the Software, +and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT +OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE +OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/vendor/github.com/stretchr/testify/LICENSE b/vendor/github.com/stretchr/testify/LICENSE new file mode 100644 index 000000000..473b670a7 --- /dev/null +++ b/vendor/github.com/stretchr/testify/LICENSE @@ -0,0 +1,22 @@ +Copyright (c) 2012 - 2013 Mat Ryer and Tyler Bunnell + +Please consider promoting this project if you find it useful. + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of the Software, +and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT +OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE +OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/vendor/github.com/stretchr/testify/README.md b/vendor/github.com/stretchr/testify/README.md new file mode 100644 index 000000000..e57b1811f --- /dev/null +++ b/vendor/github.com/stretchr/testify/README.md @@ -0,0 +1,332 @@ +Testify - Thou Shalt Write Tests +================================ + +[![Build Status](https://travis-ci.org/stretchr/testify.svg)](https://travis-ci.org/stretchr/testify) [![Go Report Card](https://goreportcard.com/badge/github.com/stretchr/testify)](https://goreportcard.com/report/github.com/stretchr/testify) [![GoDoc](https://godoc.org/github.com/stretchr/testify?status.svg)](https://godoc.org/github.com/stretchr/testify) + +Go code (golang) set of packages that provide many tools for testifying that your code will behave as you intend. + +Features include: + + * [Easy assertions](#assert-package) + * [Mocking](#mock-package) + * [HTTP response trapping](#http-package) + * [Testing suite interfaces and functions](#suite-package) + +Get started: + + * Install testify with [one line of code](#installation), or [update it with another](#staying-up-to-date) + * For an introduction to writing test code in Go, see http://golang.org/doc/code.html#Testing + * Check out the API Documentation http://godoc.org/github.com/stretchr/testify + * To make your testing life easier, check out our other project, [gorc](http://github.com/stretchr/gorc) + * A little about [Test-Driven Development (TDD)](http://en.wikipedia.org/wiki/Test-driven_development) + + + +[`assert`](http://godoc.org/github.com/stretchr/testify/assert "API documentation") package +------------------------------------------------------------------------------------------- + +The `assert` package provides some helpful methods that allow you to write better test code in Go. + + * Prints friendly, easy to read failure descriptions + * Allows for very readable code + * Optionally annotate each assertion with a message + +See it in action: + +```go +package yours + +import ( + "testing" + "github.com/stretchr/testify/assert" +) + +func TestSomething(t *testing.T) { + + // assert equality + assert.Equal(t, 123, 123, "they should be equal") + + // assert inequality + assert.NotEqual(t, 123, 456, "they should not be equal") + + // assert for nil (good for errors) + assert.Nil(t, object) + + // assert for not nil (good when you expect something) + if assert.NotNil(t, object) { + + // now we know that object isn't nil, we are safe to make + // further assertions without causing any errors + assert.Equal(t, "Something", object.Value) + + } + +} +``` + + * Every assert func takes the `testing.T` object as the first argument. This is how it writes the errors out through the normal `go test` capabilities. + * Every assert func returns a bool indicating whether the assertion was successful or not, this is useful for if you want to go on making further assertions under certain conditions. + +if you assert many times, use the below: + +```go +package yours + +import ( + "testing" + "github.com/stretchr/testify/assert" +) + +func TestSomething(t *testing.T) { + assert := assert.New(t) + + // assert equality + assert.Equal(123, 123, "they should be equal") + + // assert inequality + assert.NotEqual(123, 456, "they should not be equal") + + // assert for nil (good for errors) + assert.Nil(object) + + // assert for not nil (good when you expect something) + if assert.NotNil(object) { + + // now we know that object isn't nil, we are safe to make + // further assertions without causing any errors + assert.Equal("Something", object.Value) + } +} +``` + +[`require`](http://godoc.org/github.com/stretchr/testify/require "API documentation") package +--------------------------------------------------------------------------------------------- + +The `require` package provides same global functions as the `assert` package, but instead of returning a boolean result they terminate current test. + +See [t.FailNow](http://golang.org/pkg/testing/#T.FailNow) for details. + + +[`http`](http://godoc.org/github.com/stretchr/testify/http "API documentation") package +--------------------------------------------------------------------------------------- + +The `http` package contains test objects useful for testing code that relies on the `net/http` package. Check out the [(deprecated) API documentation for the `http` package](http://godoc.org/github.com/stretchr/testify/http). + +We recommend you use [httptest](http://golang.org/pkg/net/http/httptest) instead. + +[`mock`](http://godoc.org/github.com/stretchr/testify/mock "API documentation") package +---------------------------------------------------------------------------------------- + +The `mock` package provides a mechanism for easily writing mock objects that can be used in place of real objects when writing test code. + +An example test function that tests a piece of code that relies on an external object `testObj`, can setup expectations (testify) and assert that they indeed happened: + +```go +package yours + +import ( + "testing" + "github.com/stretchr/testify/mock" +) + +/* + Test objects +*/ + +// MyMockedObject is a mocked object that implements an interface +// that describes an object that the code I am testing relies on. +type MyMockedObject struct{ + mock.Mock +} + +// DoSomething is a method on MyMockedObject that implements some interface +// and just records the activity, and returns what the Mock object tells it to. +// +// In the real object, this method would do something useful, but since this +// is a mocked object - we're just going to stub it out. +// +// NOTE: This method is not being tested here, code that uses this object is. +func (m *MyMockedObject) DoSomething(number int) (bool, error) { + + args := m.Called(number) + return args.Bool(0), args.Error(1) + +} + +/* + Actual test functions +*/ + +// TestSomething is an example of how to use our test object to +// make assertions about some target code we are testing. +func TestSomething(t *testing.T) { + + // create an instance of our test object + testObj := new(MyMockedObject) + + // setup expectations + testObj.On("DoSomething", 123).Return(true, nil) + + // call the code we are testing + targetFuncThatDoesSomethingWithObj(testObj) + + // assert that the expectations were met + testObj.AssertExpectations(t) + +} +``` + +For more information on how to write mock code, check out the [API documentation for the `mock` package](http://godoc.org/github.com/stretchr/testify/mock). + +You can use the [mockery tool](http://github.com/vektra/mockery) to autogenerate the mock code against an interface as well, making using mocks much quicker. + +[`suite`](http://godoc.org/github.com/stretchr/testify/suite "API documentation") package +----------------------------------------------------------------------------------------- + +The `suite` package provides functionality that you might be used to from more common object oriented languages. With it, you can build a testing suite as a struct, build setup/teardown methods and testing methods on your struct, and run them with 'go test' as per normal. + +An example suite is shown below: + +```go +// Basic imports +import ( + "testing" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/suite" +) + +// Define the suite, and absorb the built-in basic suite +// functionality from testify - including a T() method which +// returns the current testing context +type ExampleTestSuite struct { + suite.Suite + VariableThatShouldStartAtFive int +} + +// Make sure that VariableThatShouldStartAtFive is set to five +// before each test +func (suite *ExampleTestSuite) SetupTest() { + suite.VariableThatShouldStartAtFive = 5 +} + +// All methods that begin with "Test" are run as tests within a +// suite. +func (suite *ExampleTestSuite) TestExample() { + assert.Equal(suite.T(), 5, suite.VariableThatShouldStartAtFive) +} + +// In order for 'go test' to run this suite, we need to create +// a normal test function and pass our suite to suite.Run +func TestExampleTestSuite(t *testing.T) { + suite.Run(t, new(ExampleTestSuite)) +} +``` + +For a more complete example, using all of the functionality provided by the suite package, look at our [example testing suite](https://github.com/stretchr/testify/blob/master/suite/suite_test.go) + +For more information on writing suites, check out the [API documentation for the `suite` package](http://godoc.org/github.com/stretchr/testify/suite). + +`Suite` object has assertion methods: + +```go +// Basic imports +import ( + "testing" + "github.com/stretchr/testify/suite" +) + +// Define the suite, and absorb the built-in basic suite +// functionality from testify - including assertion methods. +type ExampleTestSuite struct { + suite.Suite + VariableThatShouldStartAtFive int +} + +// Make sure that VariableThatShouldStartAtFive is set to five +// before each test +func (suite *ExampleTestSuite) SetupTest() { + suite.VariableThatShouldStartAtFive = 5 +} + +// All methods that begin with "Test" are run as tests within a +// suite. +func (suite *ExampleTestSuite) TestExample() { + suite.Equal(suite.VariableThatShouldStartAtFive, 5) +} + +// In order for 'go test' to run this suite, we need to create +// a normal test function and pass our suite to suite.Run +func TestExampleTestSuite(t *testing.T) { + suite.Run(t, new(ExampleTestSuite)) +} +``` + +------ + +Installation +============ + +To install Testify, use `go get`: + + * Latest version: go get github.com/stretchr/testify + * Specific version: go get gopkg.in/stretchr/testify.v1 + +This will then make the following packages available to you: + + github.com/stretchr/testify/assert + github.com/stretchr/testify/mock + github.com/stretchr/testify/http + +Import the `testify/assert` package into your code using this template: + +```go +package yours + +import ( + "testing" + "github.com/stretchr/testify/assert" +) + +func TestSomething(t *testing.T) { + + assert.True(t, true, "True is true!") + +} +``` + +------ + +Staying up to date +================== + +To update Testify to the latest version, use `go get -u github.com/stretchr/testify`. + +------ + +Version History +=============== + + * 1.0 - New package versioning strategy adopted. + +------ + +Contributing +============ + +Please feel free to submit issues, fork the repository and send pull requests! + +When submitting an issue, we ask that you please include a complete test function that demonstrates the issue. Extra credit for those using Testify to write the test code that demonstrates it. + +------ + +Licence +======= +Copyright (c) 2012 - 2013 Mat Ryer and Tyler Bunnell + +Please consider promoting this project if you find it useful. + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/vendor/github.com/stretchr/testify/_codegen/main.go b/vendor/github.com/stretchr/testify/_codegen/main.go new file mode 100644 index 000000000..328009f84 --- /dev/null +++ b/vendor/github.com/stretchr/testify/_codegen/main.go @@ -0,0 +1,287 @@ +// This program reads all assertion functions from the assert package and +// automatically generates the corersponding requires and forwarded assertions + +package main + +import ( + "bytes" + "flag" + "fmt" + "go/ast" + "go/build" + "go/doc" + "go/importer" + "go/parser" + "go/token" + "go/types" + "io" + "io/ioutil" + "log" + "os" + "path" + "strings" + "text/template" + + "github.com/ernesto-jimenez/gogen/imports" +) + +var ( + pkg = flag.String("assert-path", "github.com/stretchr/testify/assert", "Path to the assert package") + outputPkg = flag.String("output-package", "", "package for the resulting code") + tmplFile = flag.String("template", "", "What file to load the function template from") + out = flag.String("out", "", "What file to write the source code to") +) + +func main() { + flag.Parse() + + scope, docs, err := parsePackageSource(*pkg) + if err != nil { + log.Fatal(err) + } + + importer, funcs, err := analyzeCode(scope, docs) + if err != nil { + log.Fatal(err) + } + + if err := generateCode(importer, funcs); err != nil { + log.Fatal(err) + } +} + +func generateCode(importer imports.Importer, funcs []testFunc) error { + buff := bytes.NewBuffer(nil) + + tmplHead, tmplFunc, err := parseTemplates() + if err != nil { + return err + } + + // Generate header + if err := tmplHead.Execute(buff, struct { + Name string + Imports map[string]string + }{ + *outputPkg, + importer.Imports(), + }); err != nil { + return err + } + + // Generate funcs + for _, fn := range funcs { + buff.Write([]byte("\n\n")) + if err := tmplFunc.Execute(buff, &fn); err != nil { + return err + } + } + + // Write file + output, err := outputFile() + if err != nil { + return err + } + defer output.Close() + _, err = io.Copy(output, buff) + return err +} + +func parseTemplates() (*template.Template, *template.Template, error) { + tmplHead, err := template.New("header").Parse(headerTemplate) + if err != nil { + return nil, nil, err + } + if *tmplFile != "" { + f, err := ioutil.ReadFile(*tmplFile) + if err != nil { + return nil, nil, err + } + funcTemplate = string(f) + } + tmpl, err := template.New("function").Parse(funcTemplate) + if err != nil { + return nil, nil, err + } + return tmplHead, tmpl, nil +} + +func outputFile() (*os.File, error) { + filename := *out + if filename == "-" || (filename == "" && *tmplFile == "") { + return os.Stdout, nil + } + if filename == "" { + filename = strings.TrimSuffix(strings.TrimSuffix(*tmplFile, ".tmpl"), ".go") + ".go" + } + return os.Create(filename) +} + +// analyzeCode takes the types scope and the docs and returns the import +// information and information about all the assertion functions. +func analyzeCode(scope *types.Scope, docs *doc.Package) (imports.Importer, []testFunc, error) { + testingT := scope.Lookup("TestingT").Type().Underlying().(*types.Interface) + + importer := imports.New(*outputPkg) + var funcs []testFunc + // Go through all the top level functions + for _, fdocs := range docs.Funcs { + // Find the function + obj := scope.Lookup(fdocs.Name) + + fn, ok := obj.(*types.Func) + if !ok { + continue + } + // Check function signatuer has at least two arguments + sig := fn.Type().(*types.Signature) + if sig.Params().Len() < 2 { + continue + } + // Check first argument is of type testingT + first, ok := sig.Params().At(0).Type().(*types.Named) + if !ok { + continue + } + firstType, ok := first.Underlying().(*types.Interface) + if !ok { + continue + } + if !types.Implements(firstType, testingT) { + continue + } + + funcs = append(funcs, testFunc{*outputPkg, fdocs, fn}) + importer.AddImportsFrom(sig.Params()) + } + return importer, funcs, nil +} + +// parsePackageSource returns the types scope and the package documentation from the pa +func parsePackageSource(pkg string) (*types.Scope, *doc.Package, error) { + pd, err := build.Import(pkg, ".", 0) + if err != nil { + return nil, nil, err + } + + fset := token.NewFileSet() + files := make(map[string]*ast.File) + fileList := make([]*ast.File, len(pd.GoFiles)) + for i, fname := range pd.GoFiles { + src, err := ioutil.ReadFile(path.Join(pd.SrcRoot, pd.ImportPath, fname)) + if err != nil { + return nil, nil, err + } + f, err := parser.ParseFile(fset, fname, src, parser.ParseComments|parser.AllErrors) + if err != nil { + return nil, nil, err + } + files[fname] = f + fileList[i] = f + } + + cfg := types.Config{ + Importer: importer.Default(), + } + info := types.Info{ + Defs: make(map[*ast.Ident]types.Object), + } + tp, err := cfg.Check(pkg, fset, fileList, &info) + if err != nil { + return nil, nil, err + } + + scope := tp.Scope() + + ap, _ := ast.NewPackage(fset, files, nil, nil) + docs := doc.New(ap, pkg, 0) + + return scope, docs, nil +} + +type testFunc struct { + CurrentPkg string + DocInfo *doc.Func + TypeInfo *types.Func +} + +func (f *testFunc) Qualifier(p *types.Package) string { + if p == nil || p.Name() == f.CurrentPkg { + return "" + } + return p.Name() +} + +func (f *testFunc) Params() string { + sig := f.TypeInfo.Type().(*types.Signature) + params := sig.Params() + p := "" + comma := "" + to := params.Len() + var i int + + if sig.Variadic() { + to-- + } + for i = 1; i < to; i++ { + param := params.At(i) + p += fmt.Sprintf("%s%s %s", comma, param.Name(), types.TypeString(param.Type(), f.Qualifier)) + comma = ", " + } + if sig.Variadic() { + param := params.At(params.Len() - 1) + p += fmt.Sprintf("%s%s ...%s", comma, param.Name(), types.TypeString(param.Type().(*types.Slice).Elem(), f.Qualifier)) + } + return p +} + +func (f *testFunc) ForwardedParams() string { + sig := f.TypeInfo.Type().(*types.Signature) + params := sig.Params() + p := "" + comma := "" + to := params.Len() + var i int + + if sig.Variadic() { + to-- + } + for i = 1; i < to; i++ { + param := params.At(i) + p += fmt.Sprintf("%s%s", comma, param.Name()) + comma = ", " + } + if sig.Variadic() { + param := params.At(params.Len() - 1) + p += fmt.Sprintf("%s%s...", comma, param.Name()) + } + return p +} + +func (f *testFunc) Comment() string { + return "// " + strings.Replace(strings.TrimSpace(f.DocInfo.Doc), "\n", "\n// ", -1) +} + +func (f *testFunc) CommentWithoutT(receiver string) string { + search := fmt.Sprintf("assert.%s(t, ", f.DocInfo.Name) + replace := fmt.Sprintf("%s.%s(", receiver, f.DocInfo.Name) + return strings.Replace(f.Comment(), search, replace, -1) +} + +var headerTemplate = `/* +* CODE GENERATED AUTOMATICALLY WITH github.com/stretchr/testify/_codegen +* THIS FILE MUST NOT BE EDITED BY HAND +*/ + +package {{.Name}} + +import ( +{{range $path, $name := .Imports}} + {{$name}} "{{$path}}"{{end}} +) +` + +var funcTemplate = `{{.Comment}} +func (fwd *AssertionsForwarder) {{.DocInfo.Name}}({{.Params}}) bool { + return assert.{{.DocInfo.Name}}({{.ForwardedParams}}) +}` diff --git a/vendor/github.com/stretchr/testify/assert/assertion_forward.go b/vendor/github.com/stretchr/testify/assert/assertion_forward.go new file mode 100644 index 000000000..e6a796046 --- /dev/null +++ b/vendor/github.com/stretchr/testify/assert/assertion_forward.go @@ -0,0 +1,387 @@ +/* +* CODE GENERATED AUTOMATICALLY WITH github.com/stretchr/testify/_codegen +* THIS FILE MUST NOT BE EDITED BY HAND +*/ + +package assert + +import ( + + http "net/http" + url "net/url" + time "time" +) + + +// Condition uses a Comparison to assert a complex condition. +func (a *Assertions) Condition(comp Comparison, msgAndArgs ...interface{}) bool { + return Condition(a.t, comp, msgAndArgs...) +} + + +// Contains asserts that the specified string, list(array, slice...) or map contains the +// specified substring or element. +// +// a.Contains("Hello World", "World", "But 'Hello World' does contain 'World'") +// a.Contains(["Hello", "World"], "World", "But ["Hello", "World"] does contain 'World'") +// a.Contains({"Hello": "World"}, "Hello", "But {'Hello': 'World'} does contain 'Hello'") +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) Contains(s interface{}, contains interface{}, msgAndArgs ...interface{}) bool { + return Contains(a.t, s, contains, msgAndArgs...) +} + + +// Empty asserts that the specified object is empty. I.e. nil, "", false, 0 or either +// a slice or a channel with len == 0. +// +// a.Empty(obj) +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) Empty(object interface{}, msgAndArgs ...interface{}) bool { + return Empty(a.t, object, msgAndArgs...) +} + + +// Equal asserts that two objects are equal. +// +// a.Equal(123, 123, "123 and 123 should be equal") +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) Equal(expected interface{}, actual interface{}, msgAndArgs ...interface{}) bool { + return Equal(a.t, expected, actual, msgAndArgs...) +} + + +// EqualError asserts that a function returned an error (i.e. not `nil`) +// and that it is equal to the provided error. +// +// actualObj, err := SomeFunction() +// if assert.Error(t, err, "An error was expected") { +// assert.Equal(t, err, expectedError) +// } +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) EqualError(theError error, errString string, msgAndArgs ...interface{}) bool { + return EqualError(a.t, theError, errString, msgAndArgs...) +} + + +// EqualValues asserts that two objects are equal or convertable to the same types +// and equal. +// +// a.EqualValues(uint32(123), int32(123), "123 and 123 should be equal") +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) EqualValues(expected interface{}, actual interface{}, msgAndArgs ...interface{}) bool { + return EqualValues(a.t, expected, actual, msgAndArgs...) +} + + +// Error asserts that a function returned an error (i.e. not `nil`). +// +// actualObj, err := SomeFunction() +// if a.Error(err, "An error was expected") { +// assert.Equal(t, err, expectedError) +// } +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) Error(err error, msgAndArgs ...interface{}) bool { + return Error(a.t, err, msgAndArgs...) +} + + +// Exactly asserts that two objects are equal is value and type. +// +// a.Exactly(int32(123), int64(123), "123 and 123 should NOT be equal") +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) Exactly(expected interface{}, actual interface{}, msgAndArgs ...interface{}) bool { + return Exactly(a.t, expected, actual, msgAndArgs...) +} + + +// Fail reports a failure through +func (a *Assertions) Fail(failureMessage string, msgAndArgs ...interface{}) bool { + return Fail(a.t, failureMessage, msgAndArgs...) +} + + +// FailNow fails test +func (a *Assertions) FailNow(failureMessage string, msgAndArgs ...interface{}) bool { + return FailNow(a.t, failureMessage, msgAndArgs...) +} + + +// False asserts that the specified value is false. +// +// a.False(myBool, "myBool should be false") +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) False(value bool, msgAndArgs ...interface{}) bool { + return False(a.t, value, msgAndArgs...) +} + + +// HTTPBodyContains asserts that a specified handler returns a +// body that contains a string. +// +// a.HTTPBodyContains(myHandler, "www.google.com", nil, "I'm Feeling Lucky") +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) HTTPBodyContains(handler http.HandlerFunc, method string, url string, values url.Values, str interface{}) bool { + return HTTPBodyContains(a.t, handler, method, url, values, str) +} + + +// HTTPBodyNotContains asserts that a specified handler returns a +// body that does not contain a string. +// +// a.HTTPBodyNotContains(myHandler, "www.google.com", nil, "I'm Feeling Lucky") +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) HTTPBodyNotContains(handler http.HandlerFunc, method string, url string, values url.Values, str interface{}) bool { + return HTTPBodyNotContains(a.t, handler, method, url, values, str) +} + + +// HTTPError asserts that a specified handler returns an error status code. +// +// a.HTTPError(myHandler, "POST", "/a/b/c", url.Values{"a": []string{"b", "c"}} +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) HTTPError(handler http.HandlerFunc, method string, url string, values url.Values) bool { + return HTTPError(a.t, handler, method, url, values) +} + + +// HTTPRedirect asserts that a specified handler returns a redirect status code. +// +// a.HTTPRedirect(myHandler, "GET", "/a/b/c", url.Values{"a": []string{"b", "c"}} +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) HTTPRedirect(handler http.HandlerFunc, method string, url string, values url.Values) bool { + return HTTPRedirect(a.t, handler, method, url, values) +} + + +// HTTPSuccess asserts that a specified handler returns a success status code. +// +// a.HTTPSuccess(myHandler, "POST", "http://www.google.com", nil) +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) HTTPSuccess(handler http.HandlerFunc, method string, url string, values url.Values) bool { + return HTTPSuccess(a.t, handler, method, url, values) +} + + +// Implements asserts that an object is implemented by the specified interface. +// +// a.Implements((*MyInterface)(nil), new(MyObject), "MyObject") +func (a *Assertions) Implements(interfaceObject interface{}, object interface{}, msgAndArgs ...interface{}) bool { + return Implements(a.t, interfaceObject, object, msgAndArgs...) +} + + +// InDelta asserts that the two numerals are within delta of each other. +// +// a.InDelta(math.Pi, (22 / 7.0), 0.01) +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) InDelta(expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) bool { + return InDelta(a.t, expected, actual, delta, msgAndArgs...) +} + + +// InDeltaSlice is the same as InDelta, except it compares two slices. +func (a *Assertions) InDeltaSlice(expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) bool { + return InDeltaSlice(a.t, expected, actual, delta, msgAndArgs...) +} + + +// InEpsilon asserts that expected and actual have a relative error less than epsilon +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) InEpsilon(expected interface{}, actual interface{}, epsilon float64, msgAndArgs ...interface{}) bool { + return InEpsilon(a.t, expected, actual, epsilon, msgAndArgs...) +} + + +// InEpsilonSlice is the same as InEpsilon, except it compares two slices. +func (a *Assertions) InEpsilonSlice(expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) bool { + return InEpsilonSlice(a.t, expected, actual, delta, msgAndArgs...) +} + + +// IsType asserts that the specified objects are of the same type. +func (a *Assertions) IsType(expectedType interface{}, object interface{}, msgAndArgs ...interface{}) bool { + return IsType(a.t, expectedType, object, msgAndArgs...) +} + + +// JSONEq asserts that two JSON strings are equivalent. +// +// a.JSONEq(`{"hello": "world", "foo": "bar"}`, `{"foo": "bar", "hello": "world"}`) +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) JSONEq(expected string, actual string, msgAndArgs ...interface{}) bool { + return JSONEq(a.t, expected, actual, msgAndArgs...) +} + + +// Len asserts that the specified object has specific length. +// Len also fails if the object has a type that len() not accept. +// +// a.Len(mySlice, 3, "The size of slice is not 3") +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) Len(object interface{}, length int, msgAndArgs ...interface{}) bool { + return Len(a.t, object, length, msgAndArgs...) +} + + +// Nil asserts that the specified object is nil. +// +// a.Nil(err, "err should be nothing") +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) Nil(object interface{}, msgAndArgs ...interface{}) bool { + return Nil(a.t, object, msgAndArgs...) +} + + +// NoError asserts that a function returned no error (i.e. `nil`). +// +// actualObj, err := SomeFunction() +// if a.NoError(err) { +// assert.Equal(t, actualObj, expectedObj) +// } +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) NoError(err error, msgAndArgs ...interface{}) bool { + return NoError(a.t, err, msgAndArgs...) +} + + +// NotContains asserts that the specified string, list(array, slice...) or map does NOT contain the +// specified substring or element. +// +// a.NotContains("Hello World", "Earth", "But 'Hello World' does NOT contain 'Earth'") +// a.NotContains(["Hello", "World"], "Earth", "But ['Hello', 'World'] does NOT contain 'Earth'") +// a.NotContains({"Hello": "World"}, "Earth", "But {'Hello': 'World'} does NOT contain 'Earth'") +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) NotContains(s interface{}, contains interface{}, msgAndArgs ...interface{}) bool { + return NotContains(a.t, s, contains, msgAndArgs...) +} + + +// NotEmpty asserts that the specified object is NOT empty. I.e. not nil, "", false, 0 or either +// a slice or a channel with len == 0. +// +// if a.NotEmpty(obj) { +// assert.Equal(t, "two", obj[1]) +// } +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) NotEmpty(object interface{}, msgAndArgs ...interface{}) bool { + return NotEmpty(a.t, object, msgAndArgs...) +} + + +// NotEqual asserts that the specified values are NOT equal. +// +// a.NotEqual(obj1, obj2, "two objects shouldn't be equal") +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) NotEqual(expected interface{}, actual interface{}, msgAndArgs ...interface{}) bool { + return NotEqual(a.t, expected, actual, msgAndArgs...) +} + + +// NotNil asserts that the specified object is not nil. +// +// a.NotNil(err, "err should be something") +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) NotNil(object interface{}, msgAndArgs ...interface{}) bool { + return NotNil(a.t, object, msgAndArgs...) +} + + +// NotPanics asserts that the code inside the specified PanicTestFunc does NOT panic. +// +// a.NotPanics(func(){ +// RemainCalm() +// }, "Calling RemainCalm() should NOT panic") +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) NotPanics(f PanicTestFunc, msgAndArgs ...interface{}) bool { + return NotPanics(a.t, f, msgAndArgs...) +} + + +// NotRegexp asserts that a specified regexp does not match a string. +// +// a.NotRegexp(regexp.MustCompile("starts"), "it's starting") +// a.NotRegexp("^start", "it's not starting") +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) NotRegexp(rx interface{}, str interface{}, msgAndArgs ...interface{}) bool { + return NotRegexp(a.t, rx, str, msgAndArgs...) +} + + +// NotZero asserts that i is not the zero value for its type and returns the truth. +func (a *Assertions) NotZero(i interface{}, msgAndArgs ...interface{}) bool { + return NotZero(a.t, i, msgAndArgs...) +} + + +// Panics asserts that the code inside the specified PanicTestFunc panics. +// +// a.Panics(func(){ +// GoCrazy() +// }, "Calling GoCrazy() should panic") +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) Panics(f PanicTestFunc, msgAndArgs ...interface{}) bool { + return Panics(a.t, f, msgAndArgs...) +} + + +// Regexp asserts that a specified regexp matches a string. +// +// a.Regexp(regexp.MustCompile("start"), "it's starting") +// a.Regexp("start...$", "it's not starting") +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) Regexp(rx interface{}, str interface{}, msgAndArgs ...interface{}) bool { + return Regexp(a.t, rx, str, msgAndArgs...) +} + + +// True asserts that the specified value is true. +// +// a.True(myBool, "myBool should be true") +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) True(value bool, msgAndArgs ...interface{}) bool { + return True(a.t, value, msgAndArgs...) +} + + +// WithinDuration asserts that the two times are within duration delta of each other. +// +// a.WithinDuration(time.Now(), time.Now(), 10*time.Second, "The difference should not be more than 10s") +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) WithinDuration(expected time.Time, actual time.Time, delta time.Duration, msgAndArgs ...interface{}) bool { + return WithinDuration(a.t, expected, actual, delta, msgAndArgs...) +} + + +// Zero asserts that i is the zero value for its type and returns the truth. +func (a *Assertions) Zero(i interface{}, msgAndArgs ...interface{}) bool { + return Zero(a.t, i, msgAndArgs...) +} diff --git a/vendor/github.com/stretchr/testify/assert/assertion_forward.go.tmpl b/vendor/github.com/stretchr/testify/assert/assertion_forward.go.tmpl new file mode 100644 index 000000000..99f9acfbb --- /dev/null +++ b/vendor/github.com/stretchr/testify/assert/assertion_forward.go.tmpl @@ -0,0 +1,4 @@ +{{.CommentWithoutT "a"}} +func (a *Assertions) {{.DocInfo.Name}}({{.Params}}) bool { + return {{.DocInfo.Name}}(a.t, {{.ForwardedParams}}) +} diff --git a/vendor/github.com/stretchr/testify/assert/assertions.go b/vendor/github.com/stretchr/testify/assert/assertions.go new file mode 100644 index 000000000..348d5f1bc --- /dev/null +++ b/vendor/github.com/stretchr/testify/assert/assertions.go @@ -0,0 +1,1007 @@ +package assert + +import ( + "bufio" + "bytes" + "encoding/json" + "fmt" + "math" + "reflect" + "regexp" + "runtime" + "strings" + "time" + "unicode" + "unicode/utf8" + + "github.com/davecgh/go-spew/spew" + "github.com/pmezard/go-difflib/difflib" +) + +// TestingT is an interface wrapper around *testing.T +type TestingT interface { + Errorf(format string, args ...interface{}) +} + +// Comparison a custom function that returns true on success and false on failure +type Comparison func() (success bool) + +/* + Helper functions +*/ + +// ObjectsAreEqual determines if two objects are considered equal. +// +// This function does no assertion of any kind. +func ObjectsAreEqual(expected, actual interface{}) bool { + + if expected == nil || actual == nil { + return expected == actual + } + + return reflect.DeepEqual(expected, actual) + +} + +// ObjectsAreEqualValues gets whether two objects are equal, or if their +// values are equal. +func ObjectsAreEqualValues(expected, actual interface{}) bool { + if ObjectsAreEqual(expected, actual) { + return true + } + + actualType := reflect.TypeOf(actual) + if actualType == nil { + return false + } + expectedValue := reflect.ValueOf(expected) + if expectedValue.IsValid() && expectedValue.Type().ConvertibleTo(actualType) { + // Attempt comparison after type conversion + return reflect.DeepEqual(expectedValue.Convert(actualType).Interface(), actual) + } + + return false +} + +/* CallerInfo is necessary because the assert functions use the testing object +internally, causing it to print the file:line of the assert method, rather than where +the problem actually occured in calling code.*/ + +// CallerInfo returns an array of strings containing the file and line number +// of each stack frame leading from the current test to the assert call that +// failed. +func CallerInfo() []string { + + pc := uintptr(0) + file := "" + line := 0 + ok := false + name := "" + + callers := []string{} + for i := 0; ; i++ { + pc, file, line, ok = runtime.Caller(i) + if !ok { + return nil + } + + // This is a huge edge case, but it will panic if this is the case, see #180 + if file == "" { + break + } + + parts := strings.Split(file, "/") + dir := parts[len(parts)-2] + file = parts[len(parts)-1] + if (dir != "assert" && dir != "mock" && dir != "require") || file == "mock_test.go" { + callers = append(callers, fmt.Sprintf("%s:%d", file, line)) + } + + f := runtime.FuncForPC(pc) + if f == nil { + break + } + name = f.Name() + // Drop the package + segments := strings.Split(name, ".") + name = segments[len(segments)-1] + if isTest(name, "Test") || + isTest(name, "Benchmark") || + isTest(name, "Example") { + break + } + } + + return callers +} + +// Stolen from the `go test` tool. +// isTest tells whether name looks like a test (or benchmark, according to prefix). +// It is a Test (say) if there is a character after Test that is not a lower-case letter. +// We don't want TesticularCancer. +func isTest(name, prefix string) bool { + if !strings.HasPrefix(name, prefix) { + return false + } + if len(name) == len(prefix) { // "Test" is ok + return true + } + rune, _ := utf8.DecodeRuneInString(name[len(prefix):]) + return !unicode.IsLower(rune) +} + +// getWhitespaceString returns a string that is long enough to overwrite the default +// output from the go testing framework. +func getWhitespaceString() string { + + _, file, line, ok := runtime.Caller(1) + if !ok { + return "" + } + parts := strings.Split(file, "/") + file = parts[len(parts)-1] + + return strings.Repeat(" ", len(fmt.Sprintf("%s:%d: ", file, line))) + +} + +func messageFromMsgAndArgs(msgAndArgs ...interface{}) string { + if len(msgAndArgs) == 0 || msgAndArgs == nil { + return "" + } + if len(msgAndArgs) == 1 { + return msgAndArgs[0].(string) + } + if len(msgAndArgs) > 1 { + return fmt.Sprintf(msgAndArgs[0].(string), msgAndArgs[1:]...) + } + return "" +} + +// Indents all lines of the message by appending a number of tabs to each line, in an output format compatible with Go's +// test printing (see inner comment for specifics) +func indentMessageLines(message string, tabs int) string { + outBuf := new(bytes.Buffer) + + for i, scanner := 0, bufio.NewScanner(strings.NewReader(message)); scanner.Scan(); i++ { + if i != 0 { + outBuf.WriteRune('\n') + } + for ii := 0; ii < tabs; ii++ { + outBuf.WriteRune('\t') + // Bizarrely, all lines except the first need one fewer tabs prepended, so deliberately advance the counter + // by 1 prematurely. + if ii == 0 && i > 0 { + ii++ + } + } + outBuf.WriteString(scanner.Text()) + } + + return outBuf.String() +} + +type failNower interface { + FailNow() +} + +// FailNow fails test +func FailNow(t TestingT, failureMessage string, msgAndArgs ...interface{}) bool { + Fail(t, failureMessage, msgAndArgs...) + + // We cannot extend TestingT with FailNow() and + // maintain backwards compatibility, so we fallback + // to panicking when FailNow is not available in + // TestingT. + // See issue #263 + + if t, ok := t.(failNower); ok { + t.FailNow() + } else { + panic("test failed and t is missing `FailNow()`") + } + return false +} + +// Fail reports a failure through +func Fail(t TestingT, failureMessage string, msgAndArgs ...interface{}) bool { + + message := messageFromMsgAndArgs(msgAndArgs...) + + errorTrace := strings.Join(CallerInfo(), "\n\r\t\t\t") + if len(message) > 0 { + t.Errorf("\r%s\r\tError Trace:\t%s\n"+ + "\r\tError:%s\n"+ + "\r\tMessages:\t%s\n\r", + getWhitespaceString(), + errorTrace, + indentMessageLines(failureMessage, 2), + message) + } else { + t.Errorf("\r%s\r\tError Trace:\t%s\n"+ + "\r\tError:%s\n\r", + getWhitespaceString(), + errorTrace, + indentMessageLines(failureMessage, 2)) + } + + return false +} + +// Implements asserts that an object is implemented by the specified interface. +// +// assert.Implements(t, (*MyInterface)(nil), new(MyObject), "MyObject") +func Implements(t TestingT, interfaceObject interface{}, object interface{}, msgAndArgs ...interface{}) bool { + + interfaceType := reflect.TypeOf(interfaceObject).Elem() + + if !reflect.TypeOf(object).Implements(interfaceType) { + return Fail(t, fmt.Sprintf("%T must implement %v", object, interfaceType), msgAndArgs...) + } + + return true + +} + +// IsType asserts that the specified objects are of the same type. +func IsType(t TestingT, expectedType interface{}, object interface{}, msgAndArgs ...interface{}) bool { + + if !ObjectsAreEqual(reflect.TypeOf(object), reflect.TypeOf(expectedType)) { + return Fail(t, fmt.Sprintf("Object expected to be of type %v, but was %v", reflect.TypeOf(expectedType), reflect.TypeOf(object)), msgAndArgs...) + } + + return true +} + +// Equal asserts that two objects are equal. +// +// assert.Equal(t, 123, 123, "123 and 123 should be equal") +// +// Returns whether the assertion was successful (true) or not (false). +func Equal(t TestingT, expected, actual interface{}, msgAndArgs ...interface{}) bool { + + if !ObjectsAreEqual(expected, actual) { + diff := diff(expected, actual) + return Fail(t, fmt.Sprintf("Not equal: %#v (expected)\n"+ + " != %#v (actual)%s", expected, actual, diff), msgAndArgs...) + } + + return true + +} + +// EqualValues asserts that two objects are equal or convertable to the same types +// and equal. +// +// assert.EqualValues(t, uint32(123), int32(123), "123 and 123 should be equal") +// +// Returns whether the assertion was successful (true) or not (false). +func EqualValues(t TestingT, expected, actual interface{}, msgAndArgs ...interface{}) bool { + + if !ObjectsAreEqualValues(expected, actual) { + return Fail(t, fmt.Sprintf("Not equal: %#v (expected)\n"+ + " != %#v (actual)", expected, actual), msgAndArgs...) + } + + return true + +} + +// Exactly asserts that two objects are equal is value and type. +// +// assert.Exactly(t, int32(123), int64(123), "123 and 123 should NOT be equal") +// +// Returns whether the assertion was successful (true) or not (false). +func Exactly(t TestingT, expected, actual interface{}, msgAndArgs ...interface{}) bool { + + aType := reflect.TypeOf(expected) + bType := reflect.TypeOf(actual) + + if aType != bType { + return Fail(t, fmt.Sprintf("Types expected to match exactly\n\r\t%v != %v", aType, bType), msgAndArgs...) + } + + return Equal(t, expected, actual, msgAndArgs...) + +} + +// NotNil asserts that the specified object is not nil. +// +// assert.NotNil(t, err, "err should be something") +// +// Returns whether the assertion was successful (true) or not (false). +func NotNil(t TestingT, object interface{}, msgAndArgs ...interface{}) bool { + if !isNil(object) { + return true + } + return Fail(t, "Expected value not to be nil.", msgAndArgs...) +} + +// isNil checks if a specified object is nil or not, without Failing. +func isNil(object interface{}) bool { + if object == nil { + return true + } + + value := reflect.ValueOf(object) + kind := value.Kind() + if kind >= reflect.Chan && kind <= reflect.Slice && value.IsNil() { + return true + } + + return false +} + +// Nil asserts that the specified object is nil. +// +// assert.Nil(t, err, "err should be nothing") +// +// Returns whether the assertion was successful (true) or not (false). +func Nil(t TestingT, object interface{}, msgAndArgs ...interface{}) bool { + if isNil(object) { + return true + } + return Fail(t, fmt.Sprintf("Expected nil, but got: %#v", object), msgAndArgs...) +} + +var numericZeros = []interface{}{ + int(0), + int8(0), + int16(0), + int32(0), + int64(0), + uint(0), + uint8(0), + uint16(0), + uint32(0), + uint64(0), + float32(0), + float64(0), +} + +// isEmpty gets whether the specified object is considered empty or not. +func isEmpty(object interface{}) bool { + + if object == nil { + return true + } else if object == "" { + return true + } else if object == false { + return true + } + + for _, v := range numericZeros { + if object == v { + return true + } + } + + objValue := reflect.ValueOf(object) + + switch objValue.Kind() { + case reflect.Map: + fallthrough + case reflect.Slice, reflect.Chan: + { + return (objValue.Len() == 0) + } + case reflect.Struct: + switch object.(type) { + case time.Time: + return object.(time.Time).IsZero() + } + case reflect.Ptr: + { + if objValue.IsNil() { + return true + } + switch object.(type) { + case *time.Time: + return object.(*time.Time).IsZero() + default: + return false + } + } + } + return false +} + +// Empty asserts that the specified object is empty. I.e. nil, "", false, 0 or either +// a slice or a channel with len == 0. +// +// assert.Empty(t, obj) +// +// Returns whether the assertion was successful (true) or not (false). +func Empty(t TestingT, object interface{}, msgAndArgs ...interface{}) bool { + + pass := isEmpty(object) + if !pass { + Fail(t, fmt.Sprintf("Should be empty, but was %v", object), msgAndArgs...) + } + + return pass + +} + +// NotEmpty asserts that the specified object is NOT empty. I.e. not nil, "", false, 0 or either +// a slice or a channel with len == 0. +// +// if assert.NotEmpty(t, obj) { +// assert.Equal(t, "two", obj[1]) +// } +// +// Returns whether the assertion was successful (true) or not (false). +func NotEmpty(t TestingT, object interface{}, msgAndArgs ...interface{}) bool { + + pass := !isEmpty(object) + if !pass { + Fail(t, fmt.Sprintf("Should NOT be empty, but was %v", object), msgAndArgs...) + } + + return pass + +} + +// getLen try to get length of object. +// return (false, 0) if impossible. +func getLen(x interface{}) (ok bool, length int) { + v := reflect.ValueOf(x) + defer func() { + if e := recover(); e != nil { + ok = false + } + }() + return true, v.Len() +} + +// Len asserts that the specified object has specific length. +// Len also fails if the object has a type that len() not accept. +// +// assert.Len(t, mySlice, 3, "The size of slice is not 3") +// +// Returns whether the assertion was successful (true) or not (false). +func Len(t TestingT, object interface{}, length int, msgAndArgs ...interface{}) bool { + ok, l := getLen(object) + if !ok { + return Fail(t, fmt.Sprintf("\"%s\" could not be applied builtin len()", object), msgAndArgs...) + } + + if l != length { + return Fail(t, fmt.Sprintf("\"%s\" should have %d item(s), but has %d", object, length, l), msgAndArgs...) + } + return true +} + +// True asserts that the specified value is true. +// +// assert.True(t, myBool, "myBool should be true") +// +// Returns whether the assertion was successful (true) or not (false). +func True(t TestingT, value bool, msgAndArgs ...interface{}) bool { + + if value != true { + return Fail(t, "Should be true", msgAndArgs...) + } + + return true + +} + +// False asserts that the specified value is false. +// +// assert.False(t, myBool, "myBool should be false") +// +// Returns whether the assertion was successful (true) or not (false). +func False(t TestingT, value bool, msgAndArgs ...interface{}) bool { + + if value != false { + return Fail(t, "Should be false", msgAndArgs...) + } + + return true + +} + +// NotEqual asserts that the specified values are NOT equal. +// +// assert.NotEqual(t, obj1, obj2, "two objects shouldn't be equal") +// +// Returns whether the assertion was successful (true) or not (false). +func NotEqual(t TestingT, expected, actual interface{}, msgAndArgs ...interface{}) bool { + + if ObjectsAreEqual(expected, actual) { + return Fail(t, fmt.Sprintf("Should not be: %#v\n", actual), msgAndArgs...) + } + + return true + +} + +// containsElement try loop over the list check if the list includes the element. +// return (false, false) if impossible. +// return (true, false) if element was not found. +// return (true, true) if element was found. +func includeElement(list interface{}, element interface{}) (ok, found bool) { + + listValue := reflect.ValueOf(list) + elementValue := reflect.ValueOf(element) + defer func() { + if e := recover(); e != nil { + ok = false + found = false + } + }() + + if reflect.TypeOf(list).Kind() == reflect.String { + return true, strings.Contains(listValue.String(), elementValue.String()) + } + + if reflect.TypeOf(list).Kind() == reflect.Map { + mapKeys := listValue.MapKeys() + for i := 0; i < len(mapKeys); i++ { + if ObjectsAreEqual(mapKeys[i].Interface(), element) { + return true, true + } + } + return true, false + } + + for i := 0; i < listValue.Len(); i++ { + if ObjectsAreEqual(listValue.Index(i).Interface(), element) { + return true, true + } + } + return true, false + +} + +// Contains asserts that the specified string, list(array, slice...) or map contains the +// specified substring or element. +// +// assert.Contains(t, "Hello World", "World", "But 'Hello World' does contain 'World'") +// assert.Contains(t, ["Hello", "World"], "World", "But ["Hello", "World"] does contain 'World'") +// assert.Contains(t, {"Hello": "World"}, "Hello", "But {'Hello': 'World'} does contain 'Hello'") +// +// Returns whether the assertion was successful (true) or not (false). +func Contains(t TestingT, s, contains interface{}, msgAndArgs ...interface{}) bool { + + ok, found := includeElement(s, contains) + if !ok { + return Fail(t, fmt.Sprintf("\"%s\" could not be applied builtin len()", s), msgAndArgs...) + } + if !found { + return Fail(t, fmt.Sprintf("\"%s\" does not contain \"%s\"", s, contains), msgAndArgs...) + } + + return true + +} + +// NotContains asserts that the specified string, list(array, slice...) or map does NOT contain the +// specified substring or element. +// +// assert.NotContains(t, "Hello World", "Earth", "But 'Hello World' does NOT contain 'Earth'") +// assert.NotContains(t, ["Hello", "World"], "Earth", "But ['Hello', 'World'] does NOT contain 'Earth'") +// assert.NotContains(t, {"Hello": "World"}, "Earth", "But {'Hello': 'World'} does NOT contain 'Earth'") +// +// Returns whether the assertion was successful (true) or not (false). +func NotContains(t TestingT, s, contains interface{}, msgAndArgs ...interface{}) bool { + + ok, found := includeElement(s, contains) + if !ok { + return Fail(t, fmt.Sprintf("\"%s\" could not be applied builtin len()", s), msgAndArgs...) + } + if found { + return Fail(t, fmt.Sprintf("\"%s\" should not contain \"%s\"", s, contains), msgAndArgs...) + } + + return true + +} + +// Condition uses a Comparison to assert a complex condition. +func Condition(t TestingT, comp Comparison, msgAndArgs ...interface{}) bool { + result := comp() + if !result { + Fail(t, "Condition failed!", msgAndArgs...) + } + return result +} + +// PanicTestFunc defines a func that should be passed to the assert.Panics and assert.NotPanics +// methods, and represents a simple func that takes no arguments, and returns nothing. +type PanicTestFunc func() + +// didPanic returns true if the function passed to it panics. Otherwise, it returns false. +func didPanic(f PanicTestFunc) (bool, interface{}) { + + didPanic := false + var message interface{} + func() { + + defer func() { + if message = recover(); message != nil { + didPanic = true + } + }() + + // call the target function + f() + + }() + + return didPanic, message + +} + +// Panics asserts that the code inside the specified PanicTestFunc panics. +// +// assert.Panics(t, func(){ +// GoCrazy() +// }, "Calling GoCrazy() should panic") +// +// Returns whether the assertion was successful (true) or not (false). +func Panics(t TestingT, f PanicTestFunc, msgAndArgs ...interface{}) bool { + + if funcDidPanic, panicValue := didPanic(f); !funcDidPanic { + return Fail(t, fmt.Sprintf("func %#v should panic\n\r\tPanic value:\t%v", f, panicValue), msgAndArgs...) + } + + return true +} + +// NotPanics asserts that the code inside the specified PanicTestFunc does NOT panic. +// +// assert.NotPanics(t, func(){ +// RemainCalm() +// }, "Calling RemainCalm() should NOT panic") +// +// Returns whether the assertion was successful (true) or not (false). +func NotPanics(t TestingT, f PanicTestFunc, msgAndArgs ...interface{}) bool { + + if funcDidPanic, panicValue := didPanic(f); funcDidPanic { + return Fail(t, fmt.Sprintf("func %#v should not panic\n\r\tPanic value:\t%v", f, panicValue), msgAndArgs...) + } + + return true +} + +// WithinDuration asserts that the two times are within duration delta of each other. +// +// assert.WithinDuration(t, time.Now(), time.Now(), 10*time.Second, "The difference should not be more than 10s") +// +// Returns whether the assertion was successful (true) or not (false). +func WithinDuration(t TestingT, expected, actual time.Time, delta time.Duration, msgAndArgs ...interface{}) bool { + + dt := expected.Sub(actual) + if dt < -delta || dt > delta { + return Fail(t, fmt.Sprintf("Max difference between %v and %v allowed is %v, but difference was %v", expected, actual, delta, dt), msgAndArgs...) + } + + return true +} + +func toFloat(x interface{}) (float64, bool) { + var xf float64 + xok := true + + switch xn := x.(type) { + case uint8: + xf = float64(xn) + case uint16: + xf = float64(xn) + case uint32: + xf = float64(xn) + case uint64: + xf = float64(xn) + case int: + xf = float64(xn) + case int8: + xf = float64(xn) + case int16: + xf = float64(xn) + case int32: + xf = float64(xn) + case int64: + xf = float64(xn) + case float32: + xf = float64(xn) + case float64: + xf = float64(xn) + default: + xok = false + } + + return xf, xok +} + +// InDelta asserts that the two numerals are within delta of each other. +// +// assert.InDelta(t, math.Pi, (22 / 7.0), 0.01) +// +// Returns whether the assertion was successful (true) or not (false). +func InDelta(t TestingT, expected, actual interface{}, delta float64, msgAndArgs ...interface{}) bool { + + af, aok := toFloat(expected) + bf, bok := toFloat(actual) + + if !aok || !bok { + return Fail(t, fmt.Sprintf("Parameters must be numerical"), msgAndArgs...) + } + + if math.IsNaN(af) { + return Fail(t, fmt.Sprintf("Actual must not be NaN"), msgAndArgs...) + } + + if math.IsNaN(bf) { + return Fail(t, fmt.Sprintf("Expected %v with delta %v, but was NaN", expected, delta), msgAndArgs...) + } + + dt := af - bf + if dt < -delta || dt > delta { + return Fail(t, fmt.Sprintf("Max difference between %v and %v allowed is %v, but difference was %v", expected, actual, delta, dt), msgAndArgs...) + } + + return true +} + +// InDeltaSlice is the same as InDelta, except it compares two slices. +func InDeltaSlice(t TestingT, expected, actual interface{}, delta float64, msgAndArgs ...interface{}) bool { + if expected == nil || actual == nil || + reflect.TypeOf(actual).Kind() != reflect.Slice || + reflect.TypeOf(expected).Kind() != reflect.Slice { + return Fail(t, fmt.Sprintf("Parameters must be slice"), msgAndArgs...) + } + + actualSlice := reflect.ValueOf(actual) + expectedSlice := reflect.ValueOf(expected) + + for i := 0; i < actualSlice.Len(); i++ { + result := InDelta(t, actualSlice.Index(i).Interface(), expectedSlice.Index(i).Interface(), delta) + if !result { + return result + } + } + + return true +} + +func calcRelativeError(expected, actual interface{}) (float64, error) { + af, aok := toFloat(expected) + if !aok { + return 0, fmt.Errorf("expected value %q cannot be converted to float", expected) + } + if af == 0 { + return 0, fmt.Errorf("expected value must have a value other than zero to calculate the relative error") + } + bf, bok := toFloat(actual) + if !bok { + return 0, fmt.Errorf("expected value %q cannot be converted to float", actual) + } + + return math.Abs(af-bf) / math.Abs(af), nil +} + +// InEpsilon asserts that expected and actual have a relative error less than epsilon +// +// Returns whether the assertion was successful (true) or not (false). +func InEpsilon(t TestingT, expected, actual interface{}, epsilon float64, msgAndArgs ...interface{}) bool { + actualEpsilon, err := calcRelativeError(expected, actual) + if err != nil { + return Fail(t, err.Error(), msgAndArgs...) + } + if actualEpsilon > epsilon { + return Fail(t, fmt.Sprintf("Relative error is too high: %#v (expected)\n"+ + " < %#v (actual)", actualEpsilon, epsilon), msgAndArgs...) + } + + return true +} + +// InEpsilonSlice is the same as InEpsilon, except it compares each value from two slices. +func InEpsilonSlice(t TestingT, expected, actual interface{}, epsilon float64, msgAndArgs ...interface{}) bool { + if expected == nil || actual == nil || + reflect.TypeOf(actual).Kind() != reflect.Slice || + reflect.TypeOf(expected).Kind() != reflect.Slice { + return Fail(t, fmt.Sprintf("Parameters must be slice"), msgAndArgs...) + } + + actualSlice := reflect.ValueOf(actual) + expectedSlice := reflect.ValueOf(expected) + + for i := 0; i < actualSlice.Len(); i++ { + result := InEpsilon(t, actualSlice.Index(i).Interface(), expectedSlice.Index(i).Interface(), epsilon) + if !result { + return result + } + } + + return true +} + +/* + Errors +*/ + +// NoError asserts that a function returned no error (i.e. `nil`). +// +// actualObj, err := SomeFunction() +// if assert.NoError(t, err) { +// assert.Equal(t, actualObj, expectedObj) +// } +// +// Returns whether the assertion was successful (true) or not (false). +func NoError(t TestingT, err error, msgAndArgs ...interface{}) bool { + if err != nil { + return Fail(t, fmt.Sprintf("Received unexpected error %q", err), msgAndArgs...) + } + + return true +} + +// Error asserts that a function returned an error (i.e. not `nil`). +// +// actualObj, err := SomeFunction() +// if assert.Error(t, err, "An error was expected") { +// assert.Equal(t, err, expectedError) +// } +// +// Returns whether the assertion was successful (true) or not (false). +func Error(t TestingT, err error, msgAndArgs ...interface{}) bool { + + message := messageFromMsgAndArgs(msgAndArgs...) + if err == nil { + return Fail(t, "An error is expected but got nil. %s", message) + } + + return true +} + +// EqualError asserts that a function returned an error (i.e. not `nil`) +// and that it is equal to the provided error. +// +// actualObj, err := SomeFunction() +// if assert.Error(t, err, "An error was expected") { +// assert.Equal(t, err, expectedError) +// } +// +// Returns whether the assertion was successful (true) or not (false). +func EqualError(t TestingT, theError error, errString string, msgAndArgs ...interface{}) bool { + + message := messageFromMsgAndArgs(msgAndArgs...) + if !NotNil(t, theError, "An error is expected but got nil. %s", message) { + return false + } + s := "An error with value \"%s\" is expected but got \"%s\". %s" + return Equal(t, errString, theError.Error(), + s, errString, theError.Error(), message) +} + +// matchRegexp return true if a specified regexp matches a string. +func matchRegexp(rx interface{}, str interface{}) bool { + + var r *regexp.Regexp + if rr, ok := rx.(*regexp.Regexp); ok { + r = rr + } else { + r = regexp.MustCompile(fmt.Sprint(rx)) + } + + return (r.FindStringIndex(fmt.Sprint(str)) != nil) + +} + +// Regexp asserts that a specified regexp matches a string. +// +// assert.Regexp(t, regexp.MustCompile("start"), "it's starting") +// assert.Regexp(t, "start...$", "it's not starting") +// +// Returns whether the assertion was successful (true) or not (false). +func Regexp(t TestingT, rx interface{}, str interface{}, msgAndArgs ...interface{}) bool { + + match := matchRegexp(rx, str) + + if !match { + Fail(t, fmt.Sprintf("Expect \"%v\" to match \"%v\"", str, rx), msgAndArgs...) + } + + return match +} + +// NotRegexp asserts that a specified regexp does not match a string. +// +// assert.NotRegexp(t, regexp.MustCompile("starts"), "it's starting") +// assert.NotRegexp(t, "^start", "it's not starting") +// +// Returns whether the assertion was successful (true) or not (false). +func NotRegexp(t TestingT, rx interface{}, str interface{}, msgAndArgs ...interface{}) bool { + match := matchRegexp(rx, str) + + if match { + Fail(t, fmt.Sprintf("Expect \"%v\" to NOT match \"%v\"", str, rx), msgAndArgs...) + } + + return !match + +} + +// Zero asserts that i is the zero value for its type and returns the truth. +func Zero(t TestingT, i interface{}, msgAndArgs ...interface{}) bool { + if i != nil && !reflect.DeepEqual(i, reflect.Zero(reflect.TypeOf(i)).Interface()) { + return Fail(t, fmt.Sprintf("Should be zero, but was %v", i), msgAndArgs...) + } + return true +} + +// NotZero asserts that i is not the zero value for its type and returns the truth. +func NotZero(t TestingT, i interface{}, msgAndArgs ...interface{}) bool { + if i == nil || reflect.DeepEqual(i, reflect.Zero(reflect.TypeOf(i)).Interface()) { + return Fail(t, fmt.Sprintf("Should not be zero, but was %v", i), msgAndArgs...) + } + return true +} + +// JSONEq asserts that two JSON strings are equivalent. +// +// assert.JSONEq(t, `{"hello": "world", "foo": "bar"}`, `{"foo": "bar", "hello": "world"}`) +// +// Returns whether the assertion was successful (true) or not (false). +func JSONEq(t TestingT, expected string, actual string, msgAndArgs ...interface{}) bool { + var expectedJSONAsInterface, actualJSONAsInterface interface{} + + if err := json.Unmarshal([]byte(expected), &expectedJSONAsInterface); err != nil { + return Fail(t, fmt.Sprintf("Expected value ('%s') is not valid json.\nJSON parsing error: '%s'", expected, err.Error()), msgAndArgs...) + } + + if err := json.Unmarshal([]byte(actual), &actualJSONAsInterface); err != nil { + return Fail(t, fmt.Sprintf("Input ('%s') needs to be valid json.\nJSON parsing error: '%s'", actual, err.Error()), msgAndArgs...) + } + + return Equal(t, expectedJSONAsInterface, actualJSONAsInterface, msgAndArgs...) +} + +func typeAndKind(v interface{}) (reflect.Type, reflect.Kind) { + t := reflect.TypeOf(v) + k := t.Kind() + + if k == reflect.Ptr { + t = t.Elem() + k = t.Kind() + } + return t, k +} + +// diff returns a diff of both values as long as both are of the same type and +// are a struct, map, slice or array. Otherwise it returns an empty string. +func diff(expected interface{}, actual interface{}) string { + if expected == nil || actual == nil { + return "" + } + + et, ek := typeAndKind(expected) + at, _ := typeAndKind(actual) + + if et != at { + return "" + } + + if ek != reflect.Struct && ek != reflect.Map && ek != reflect.Slice && ek != reflect.Array { + return "" + } + + spew.Config.SortKeys = true + e := spew.Sdump(expected) + a := spew.Sdump(actual) + + diff, _ := difflib.GetUnifiedDiffString(difflib.UnifiedDiff{ + A: difflib.SplitLines(e), + B: difflib.SplitLines(a), + FromFile: "Expected", + FromDate: "", + ToFile: "Actual", + ToDate: "", + Context: 1, + }) + + return "\n\nDiff:\n" + diff +} diff --git a/vendor/github.com/stretchr/testify/assert/doc.go b/vendor/github.com/stretchr/testify/assert/doc.go new file mode 100644 index 000000000..c9dccc4d6 --- /dev/null +++ b/vendor/github.com/stretchr/testify/assert/doc.go @@ -0,0 +1,45 @@ +// Package assert provides a set of comprehensive testing tools for use with the normal Go testing system. +// +// Example Usage +// +// The following is a complete example using assert in a standard test function: +// import ( +// "testing" +// "github.com/stretchr/testify/assert" +// ) +// +// func TestSomething(t *testing.T) { +// +// var a string = "Hello" +// var b string = "Hello" +// +// assert.Equal(t, a, b, "The two words should be the same.") +// +// } +// +// if you assert many times, use the format below: +// +// import ( +// "testing" +// "github.com/stretchr/testify/assert" +// ) +// +// func TestSomething(t *testing.T) { +// assert := assert.New(t) +// +// var a string = "Hello" +// var b string = "Hello" +// +// assert.Equal(a, b, "The two words should be the same.") +// } +// +// Assertions +// +// Assertions allow you to easily write test code, and are global funcs in the `assert` package. +// All assertion functions take, as the first argument, the `*testing.T` object provided by the +// testing framework. This allows the assertion funcs to write the failings and other details to +// the correct place. +// +// Every assertion function also takes an optional string message as the final argument, +// allowing custom error messages to be appended to the message the assertion method outputs. +package assert diff --git a/vendor/github.com/stretchr/testify/assert/errors.go b/vendor/github.com/stretchr/testify/assert/errors.go new file mode 100644 index 000000000..ac9dc9d1d --- /dev/null +++ b/vendor/github.com/stretchr/testify/assert/errors.go @@ -0,0 +1,10 @@ +package assert + +import ( + "errors" +) + +// AnError is an error instance useful for testing. If the code does not care +// about error specifics, and only needs to return the error for example, this +// error should be used to make the test code more readable. +var AnError = errors.New("assert.AnError general error for testing") diff --git a/vendor/github.com/stretchr/testify/assert/forward_assertions.go b/vendor/github.com/stretchr/testify/assert/forward_assertions.go new file mode 100644 index 000000000..b867e95ea --- /dev/null +++ b/vendor/github.com/stretchr/testify/assert/forward_assertions.go @@ -0,0 +1,16 @@ +package assert + +// Assertions provides assertion methods around the +// TestingT interface. +type Assertions struct { + t TestingT +} + +// New makes a new Assertions object for the specified TestingT. +func New(t TestingT) *Assertions { + return &Assertions{ + t: t, + } +} + +//go:generate go run ../_codegen/main.go -output-package=assert -template=assertion_forward.go.tmpl diff --git a/vendor/github.com/stretchr/testify/assert/http_assertions.go b/vendor/github.com/stretchr/testify/assert/http_assertions.go new file mode 100644 index 000000000..e1b9442b5 --- /dev/null +++ b/vendor/github.com/stretchr/testify/assert/http_assertions.go @@ -0,0 +1,106 @@ +package assert + +import ( + "fmt" + "net/http" + "net/http/httptest" + "net/url" + "strings" +) + +// httpCode is a helper that returns HTTP code of the response. It returns -1 +// if building a new request fails. +func httpCode(handler http.HandlerFunc, method, url string, values url.Values) int { + w := httptest.NewRecorder() + req, err := http.NewRequest(method, url+"?"+values.Encode(), nil) + if err != nil { + return -1 + } + handler(w, req) + return w.Code +} + +// HTTPSuccess asserts that a specified handler returns a success status code. +// +// assert.HTTPSuccess(t, myHandler, "POST", "http://www.google.com", nil) +// +// Returns whether the assertion was successful (true) or not (false). +func HTTPSuccess(t TestingT, handler http.HandlerFunc, method, url string, values url.Values) bool { + code := httpCode(handler, method, url, values) + if code == -1 { + return false + } + return code >= http.StatusOK && code <= http.StatusPartialContent +} + +// HTTPRedirect asserts that a specified handler returns a redirect status code. +// +// assert.HTTPRedirect(t, myHandler, "GET", "/a/b/c", url.Values{"a": []string{"b", "c"}} +// +// Returns whether the assertion was successful (true) or not (false). +func HTTPRedirect(t TestingT, handler http.HandlerFunc, method, url string, values url.Values) bool { + code := httpCode(handler, method, url, values) + if code == -1 { + return false + } + return code >= http.StatusMultipleChoices && code <= http.StatusTemporaryRedirect +} + +// HTTPError asserts that a specified handler returns an error status code. +// +// assert.HTTPError(t, myHandler, "POST", "/a/b/c", url.Values{"a": []string{"b", "c"}} +// +// Returns whether the assertion was successful (true) or not (false). +func HTTPError(t TestingT, handler http.HandlerFunc, method, url string, values url.Values) bool { + code := httpCode(handler, method, url, values) + if code == -1 { + return false + } + return code >= http.StatusBadRequest +} + +// HTTPBody is a helper that returns HTTP body of the response. It returns +// empty string if building a new request fails. +func HTTPBody(handler http.HandlerFunc, method, url string, values url.Values) string { + w := httptest.NewRecorder() + req, err := http.NewRequest(method, url+"?"+values.Encode(), nil) + if err != nil { + return "" + } + handler(w, req) + return w.Body.String() +} + +// HTTPBodyContains asserts that a specified handler returns a +// body that contains a string. +// +// assert.HTTPBodyContains(t, myHandler, "www.google.com", nil, "I'm Feeling Lucky") +// +// Returns whether the assertion was successful (true) or not (false). +func HTTPBodyContains(t TestingT, handler http.HandlerFunc, method, url string, values url.Values, str interface{}) bool { + body := HTTPBody(handler, method, url, values) + + contains := strings.Contains(body, fmt.Sprint(str)) + if !contains { + Fail(t, fmt.Sprintf("Expected response body for \"%s\" to contain \"%s\" but found \"%s\"", url+"?"+values.Encode(), str, body)) + } + + return contains +} + +// HTTPBodyNotContains asserts that a specified handler returns a +// body that does not contain a string. +// +// assert.HTTPBodyNotContains(t, myHandler, "www.google.com", nil, "I'm Feeling Lucky") +// +// Returns whether the assertion was successful (true) or not (false). +func HTTPBodyNotContains(t TestingT, handler http.HandlerFunc, method, url string, values url.Values, str interface{}) bool { + body := HTTPBody(handler, method, url, values) + + contains := strings.Contains(body, fmt.Sprint(str)) + if contains { + Fail(t, "Expected response body for %s to NOT contain \"%s\" but found \"%s\"", url+"?"+values.Encode(), str, body) + } + + return !contains +} diff --git a/vendor/github.com/stretchr/testify/doc.go b/vendor/github.com/stretchr/testify/doc.go new file mode 100644 index 000000000..377d5cc56 --- /dev/null +++ b/vendor/github.com/stretchr/testify/doc.go @@ -0,0 +1,22 @@ +// Package testify is a set of packages that provide many tools for testifying that your code will behave as you intend. +// +// testify contains the following packages: +// +// The assert package provides a comprehensive set of assertion functions that tie in to the Go testing system. +// +// The http package contains tools to make it easier to test http activity using the Go testing system. +// +// The mock package provides a system by which it is possible to mock your objects and verify calls are happening as expected. +// +// The suite package provides a basic structure for using structs as testing suites, and methods on those structs as tests. It includes setup/teardown functionality in the way of interfaces. +package testify + +// blank imports help docs. +import ( + // assert package + _ "github.com/stretchr/testify/assert" + // http package + _ "github.com/stretchr/testify/http" + // mock package + _ "github.com/stretchr/testify/mock" +) diff --git a/vendor/github.com/stretchr/testify/http/doc.go b/vendor/github.com/stretchr/testify/http/doc.go new file mode 100644 index 000000000..695167c6d --- /dev/null +++ b/vendor/github.com/stretchr/testify/http/doc.go @@ -0,0 +1,2 @@ +// Package http DEPRECATED USE net/http/httptest +package http diff --git a/vendor/github.com/stretchr/testify/http/test_response_writer.go b/vendor/github.com/stretchr/testify/http/test_response_writer.go new file mode 100644 index 000000000..5c3f813fa --- /dev/null +++ b/vendor/github.com/stretchr/testify/http/test_response_writer.go @@ -0,0 +1,49 @@ +package http + +import ( + "net/http" +) + +// TestResponseWriter DEPRECATED: We recommend you use http://golang.org/pkg/net/http/httptest instead. +type TestResponseWriter struct { + + // StatusCode is the last int written by the call to WriteHeader(int) + StatusCode int + + // Output is a string containing the written bytes using the Write([]byte) func. + Output string + + // header is the internal storage of the http.Header object + header http.Header +} + +// Header DEPRECATED: We recommend you use http://golang.org/pkg/net/http/httptest instead. +func (rw *TestResponseWriter) Header() http.Header { + + if rw.header == nil { + rw.header = make(http.Header) + } + + return rw.header +} + +// Write DEPRECATED: We recommend you use http://golang.org/pkg/net/http/httptest instead. +func (rw *TestResponseWriter) Write(bytes []byte) (int, error) { + + // assume 200 success if no header has been set + if rw.StatusCode == 0 { + rw.WriteHeader(200) + } + + // add these bytes to the output string + rw.Output = rw.Output + string(bytes) + + // return normal values + return 0, nil + +} + +// WriteHeader DEPRECATED: We recommend you use http://golang.org/pkg/net/http/httptest instead. +func (rw *TestResponseWriter) WriteHeader(i int) { + rw.StatusCode = i +} diff --git a/vendor/github.com/stretchr/testify/http/test_round_tripper.go b/vendor/github.com/stretchr/testify/http/test_round_tripper.go new file mode 100644 index 000000000..b1e32f1d8 --- /dev/null +++ b/vendor/github.com/stretchr/testify/http/test_round_tripper.go @@ -0,0 +1,17 @@ +package http + +import ( + "github.com/stretchr/testify/mock" + "net/http" +) + +// TestRoundTripper DEPRECATED USE net/http/httptest +type TestRoundTripper struct { + mock.Mock +} + +// RoundTrip DEPRECATED USE net/http/httptest +func (t *TestRoundTripper) RoundTrip(req *http.Request) (*http.Response, error) { + args := t.Called(req) + return args.Get(0).(*http.Response), args.Error(1) +} diff --git a/vendor/github.com/stretchr/testify/mock/doc.go b/vendor/github.com/stretchr/testify/mock/doc.go new file mode 100644 index 000000000..7324128ef --- /dev/null +++ b/vendor/github.com/stretchr/testify/mock/doc.go @@ -0,0 +1,44 @@ +// Package mock provides a system by which it is possible to mock your objects +// and verify calls are happening as expected. +// +// Example Usage +// +// The mock package provides an object, Mock, that tracks activity on another object. It is usually +// embedded into a test object as shown below: +// +// type MyTestObject struct { +// // add a Mock object instance +// mock.Mock +// +// // other fields go here as normal +// } +// +// When implementing the methods of an interface, you wire your functions up +// to call the Mock.Called(args...) method, and return the appropriate values. +// +// For example, to mock a method that saves the name and age of a person and returns +// the year of their birth or an error, you might write this: +// +// func (o *MyTestObject) SavePersonDetails(firstname, lastname string, age int) (int, error) { +// args := o.Called(firstname, lastname, age) +// return args.Int(0), args.Error(1) +// } +// +// The Int, Error and Bool methods are examples of strongly typed getters that take the argument +// index position. Given this argument list: +// +// (12, true, "Something") +// +// You could read them out strongly typed like this: +// +// args.Int(0) +// args.Bool(1) +// args.String(2) +// +// For objects of your own type, use the generic Arguments.Get(index) method and make a type assertion: +// +// return args.Get(0).(*MyObject), args.Get(1).(*AnotherObjectOfMine) +// +// This may cause a panic if the object you are getting is nil (the type assertion will fail), in those +// cases you should check for nil first. +package mock diff --git a/vendor/github.com/stretchr/testify/mock/mock.go b/vendor/github.com/stretchr/testify/mock/mock.go new file mode 100644 index 000000000..cba9009a9 --- /dev/null +++ b/vendor/github.com/stretchr/testify/mock/mock.go @@ -0,0 +1,693 @@ +package mock + +import ( + "fmt" + "reflect" + "regexp" + "runtime" + "strings" + "sync" + "time" + + "github.com/stretchr/objx" + "github.com/stretchr/testify/assert" +) + +// TestingT is an interface wrapper around *testing.T +type TestingT interface { + Logf(format string, args ...interface{}) + Errorf(format string, args ...interface{}) + FailNow() +} + +/* + Call +*/ + +// Call represents a method call and is used for setting expectations, +// as well as recording activity. +type Call struct { + Parent *Mock + + // The name of the method that was or will be called. + Method string + + // Holds the arguments of the method. + Arguments Arguments + + // Holds the arguments that should be returned when + // this method is called. + ReturnArguments Arguments + + // The number of times to return the return arguments when setting + // expectations. 0 means to always return the value. + Repeatability int + + // Amount of times this call has been called + totalCalls int + + // Holds a channel that will be used to block the Return until it either + // recieves a message or is closed. nil means it returns immediately. + WaitFor <-chan time.Time + + // Holds a handler used to manipulate arguments content that are passed by + // reference. It's useful when mocking methods such as unmarshalers or + // decoders. + RunFn func(Arguments) +} + +func newCall(parent *Mock, methodName string, methodArguments ...interface{}) *Call { + return &Call{ + Parent: parent, + Method: methodName, + Arguments: methodArguments, + ReturnArguments: make([]interface{}, 0), + Repeatability: 0, + WaitFor: nil, + RunFn: nil, + } +} + +func (c *Call) lock() { + c.Parent.mutex.Lock() +} + +func (c *Call) unlock() { + c.Parent.mutex.Unlock() +} + +// Return specifies the return arguments for the expectation. +// +// Mock.On("DoSomething").Return(errors.New("failed")) +func (c *Call) Return(returnArguments ...interface{}) *Call { + c.lock() + defer c.unlock() + + c.ReturnArguments = returnArguments + + return c +} + +// Once indicates that that the mock should only return the value once. +// +// Mock.On("MyMethod", arg1, arg2).Return(returnArg1, returnArg2).Once() +func (c *Call) Once() *Call { + return c.Times(1) +} + +// Twice indicates that that the mock should only return the value twice. +// +// Mock.On("MyMethod", arg1, arg2).Return(returnArg1, returnArg2).Twice() +func (c *Call) Twice() *Call { + return c.Times(2) +} + +// Times indicates that that the mock should only return the indicated number +// of times. +// +// Mock.On("MyMethod", arg1, arg2).Return(returnArg1, returnArg2).Times(5) +func (c *Call) Times(i int) *Call { + c.lock() + defer c.unlock() + c.Repeatability = i + return c +} + +// WaitUntil sets the channel that will block the mock's return until its closed +// or a message is received. +// +// Mock.On("MyMethod", arg1, arg2).WaitUntil(time.After(time.Second)) +func (c *Call) WaitUntil(w <-chan time.Time) *Call { + c.lock() + defer c.unlock() + c.WaitFor = w + return c +} + +// After sets how long to block until the call returns +// +// Mock.On("MyMethod", arg1, arg2).After(time.Second) +func (c *Call) After(d time.Duration) *Call { + return c.WaitUntil(time.After(d)) +} + +// Run sets a handler to be called before returning. It can be used when +// mocking a method such as unmarshalers that takes a pointer to a struct and +// sets properties in such struct +// +// Mock.On("Unmarshal", AnythingOfType("*map[string]interface{}").Return().Run(func(args Arguments) { +// arg := args.Get(0).(*map[string]interface{}) +// arg["foo"] = "bar" +// }) +func (c *Call) Run(fn func(Arguments)) *Call { + c.lock() + defer c.unlock() + c.RunFn = fn + return c +} + +// On chains a new expectation description onto the mocked interface. This +// allows syntax like. +// +// Mock. +// On("MyMethod", 1).Return(nil). +// On("MyOtherMethod", 'a', 'b', 'c').Return(errors.New("Some Error")) +func (c *Call) On(methodName string, arguments ...interface{}) *Call { + return c.Parent.On(methodName, arguments...) +} + +// Mock is the workhorse used to track activity on another object. +// For an example of its usage, refer to the "Example Usage" section at the top +// of this document. +type Mock struct { + // Represents the calls that are expected of + // an object. + ExpectedCalls []*Call + + // Holds the calls that were made to this mocked object. + Calls []Call + + // TestData holds any data that might be useful for testing. Testify ignores + // this data completely allowing you to do whatever you like with it. + testData objx.Map + + mutex sync.Mutex +} + +// TestData holds any data that might be useful for testing. Testify ignores +// this data completely allowing you to do whatever you like with it. +func (m *Mock) TestData() objx.Map { + + if m.testData == nil { + m.testData = make(objx.Map) + } + + return m.testData +} + +/* + Setting expectations +*/ + +// On starts a description of an expectation of the specified method +// being called. +// +// Mock.On("MyMethod", arg1, arg2) +func (m *Mock) On(methodName string, arguments ...interface{}) *Call { + for _, arg := range arguments { + if v := reflect.ValueOf(arg); v.Kind() == reflect.Func { + panic(fmt.Sprintf("cannot use Func in expectations. Use mock.AnythingOfType(\"%T\")", arg)) + } + } + + m.mutex.Lock() + defer m.mutex.Unlock() + c := newCall(m, methodName, arguments...) + m.ExpectedCalls = append(m.ExpectedCalls, c) + return c +} + +// /* +// Recording and responding to activity +// */ + +func (m *Mock) findExpectedCall(method string, arguments ...interface{}) (int, *Call) { + m.mutex.Lock() + defer m.mutex.Unlock() + for i, call := range m.ExpectedCalls { + if call.Method == method && call.Repeatability > -1 { + + _, diffCount := call.Arguments.Diff(arguments) + if diffCount == 0 { + return i, call + } + + } + } + return -1, nil +} + +func (m *Mock) findClosestCall(method string, arguments ...interface{}) (bool, *Call) { + diffCount := 0 + var closestCall *Call + + for _, call := range m.expectedCalls() { + if call.Method == method { + + _, tempDiffCount := call.Arguments.Diff(arguments) + if tempDiffCount < diffCount || diffCount == 0 { + diffCount = tempDiffCount + closestCall = call + } + + } + } + + if closestCall == nil { + return false, nil + } + + return true, closestCall +} + +func callString(method string, arguments Arguments, includeArgumentValues bool) string { + + var argValsString string + if includeArgumentValues { + var argVals []string + for argIndex, arg := range arguments { + argVals = append(argVals, fmt.Sprintf("%d: %#v", argIndex, arg)) + } + argValsString = fmt.Sprintf("\n\t\t%s", strings.Join(argVals, "\n\t\t")) + } + + return fmt.Sprintf("%s(%s)%s", method, arguments.String(), argValsString) +} + +// Called tells the mock object that a method has been called, and gets an array +// of arguments to return. Panics if the call is unexpected (i.e. not preceded by +// appropriate .On .Return() calls) +// If Call.WaitFor is set, blocks until the channel is closed or receives a message. +func (m *Mock) Called(arguments ...interface{}) Arguments { + // get the calling function's name + pc, _, _, ok := runtime.Caller(1) + if !ok { + panic("Couldn't get the caller information") + } + functionPath := runtime.FuncForPC(pc).Name() + //Next four lines are required to use GCCGO function naming conventions. + //For Ex: github_com_docker_libkv_store_mock.WatchTree.pN39_github_com_docker_libkv_store_mock.Mock + //uses inteface information unlike golang github.com/docker/libkv/store/mock.(*Mock).WatchTree + //With GCCGO we need to remove interface information starting from pN

. + re := regexp.MustCompile("\\.pN\\d+_") + if re.MatchString(functionPath) { + functionPath = re.Split(functionPath, -1)[0] + } + parts := strings.Split(functionPath, ".") + functionName := parts[len(parts)-1] + + found, call := m.findExpectedCall(functionName, arguments...) + + if found < 0 { + // we have to fail here - because we don't know what to do + // as the return arguments. This is because: + // + // a) this is a totally unexpected call to this method, + // b) the arguments are not what was expected, or + // c) the developer has forgotten to add an accompanying On...Return pair. + + closestFound, closestCall := m.findClosestCall(functionName, arguments...) + + if closestFound { + panic(fmt.Sprintf("\n\nmock: Unexpected Method Call\n-----------------------------\n\n%s\n\nThe closest call I have is: \n\n%s\n", callString(functionName, arguments, true), callString(functionName, closestCall.Arguments, true))) + } else { + panic(fmt.Sprintf("\nassert: mock: I don't know what to return because the method call was unexpected.\n\tEither do Mock.On(\"%s\").Return(...) first, or remove the %s() call.\n\tThis method was unexpected:\n\t\t%s\n\tat: %s", functionName, functionName, callString(functionName, arguments, true), assert.CallerInfo())) + } + } else { + m.mutex.Lock() + switch { + case call.Repeatability == 1: + call.Repeatability = -1 + call.totalCalls++ + + case call.Repeatability > 1: + call.Repeatability-- + call.totalCalls++ + + case call.Repeatability == 0: + call.totalCalls++ + } + m.mutex.Unlock() + } + + // add the call + m.mutex.Lock() + m.Calls = append(m.Calls, *newCall(m, functionName, arguments...)) + m.mutex.Unlock() + + // block if specified + if call.WaitFor != nil { + <-call.WaitFor + } + + if call.RunFn != nil { + call.RunFn(arguments) + } + + return call.ReturnArguments +} + +/* + Assertions +*/ + +// AssertExpectationsForObjects asserts that everything specified with On and Return +// of the specified objects was in fact called as expected. +// +// Calls may have occurred in any order. +func AssertExpectationsForObjects(t TestingT, testObjects ...interface{}) bool { + var success = true + for _, obj := range testObjects { + mockObj := obj.(Mock) + success = success && mockObj.AssertExpectations(t) + } + return success +} + +// AssertExpectations asserts that everything specified with On and Return was +// in fact called as expected. Calls may have occurred in any order. +func (m *Mock) AssertExpectations(t TestingT) bool { + var somethingMissing bool + var failedExpectations int + + // iterate through each expectation + expectedCalls := m.expectedCalls() + for _, expectedCall := range expectedCalls { + if !m.methodWasCalled(expectedCall.Method, expectedCall.Arguments) && expectedCall.totalCalls == 0 { + somethingMissing = true + failedExpectations++ + t.Logf("\u274C\t%s(%s)", expectedCall.Method, expectedCall.Arguments.String()) + } else { + m.mutex.Lock() + if expectedCall.Repeatability > 0 { + somethingMissing = true + failedExpectations++ + } else { + t.Logf("\u2705\t%s(%s)", expectedCall.Method, expectedCall.Arguments.String()) + } + m.mutex.Unlock() + } + } + + if somethingMissing { + t.Errorf("FAIL: %d out of %d expectation(s) were met.\n\tThe code you are testing needs to make %d more call(s).\n\tat: %s", len(expectedCalls)-failedExpectations, len(expectedCalls), failedExpectations, assert.CallerInfo()) + } + + return !somethingMissing +} + +// AssertNumberOfCalls asserts that the method was called expectedCalls times. +func (m *Mock) AssertNumberOfCalls(t TestingT, methodName string, expectedCalls int) bool { + var actualCalls int + for _, call := range m.calls() { + if call.Method == methodName { + actualCalls++ + } + } + return assert.Equal(t, expectedCalls, actualCalls, fmt.Sprintf("Expected number of calls (%d) does not match the actual number of calls (%d).", expectedCalls, actualCalls)) +} + +// AssertCalled asserts that the method was called. +// It can produce a false result when an argument is a pointer type and the underlying value changed after calling the mocked method. +func (m *Mock) AssertCalled(t TestingT, methodName string, arguments ...interface{}) bool { + if !assert.True(t, m.methodWasCalled(methodName, arguments), fmt.Sprintf("The \"%s\" method should have been called with %d argument(s), but was not.", methodName, len(arguments))) { + t.Logf("%v", m.expectedCalls()) + return false + } + return true +} + +// AssertNotCalled asserts that the method was not called. +// It can produce a false result when an argument is a pointer type and the underlying value changed after calling the mocked method. +func (m *Mock) AssertNotCalled(t TestingT, methodName string, arguments ...interface{}) bool { + if !assert.False(t, m.methodWasCalled(methodName, arguments), fmt.Sprintf("The \"%s\" method was called with %d argument(s), but should NOT have been.", methodName, len(arguments))) { + t.Logf("%v", m.expectedCalls()) + return false + } + return true +} + +func (m *Mock) methodWasCalled(methodName string, expected []interface{}) bool { + for _, call := range m.calls() { + if call.Method == methodName { + + _, differences := Arguments(expected).Diff(call.Arguments) + + if differences == 0 { + // found the expected call + return true + } + + } + } + // we didn't find the expected call + return false +} + +func (m *Mock) expectedCalls() []*Call { + m.mutex.Lock() + defer m.mutex.Unlock() + return append([]*Call{}, m.ExpectedCalls...) +} + +func (m *Mock) calls() []Call { + m.mutex.Lock() + defer m.mutex.Unlock() + return append([]Call{}, m.Calls...) +} + +/* + Arguments +*/ + +// Arguments holds an array of method arguments or return values. +type Arguments []interface{} + +const ( + // Anything is used in Diff and Assert when the argument being tested + // shouldn't be taken into consideration. + Anything string = "mock.Anything" +) + +// AnythingOfTypeArgument is a string that contains the type of an argument +// for use when type checking. Used in Diff and Assert. +type AnythingOfTypeArgument string + +// AnythingOfType returns an AnythingOfTypeArgument object containing the +// name of the type to check for. Used in Diff and Assert. +// +// For example: +// Assert(t, AnythingOfType("string"), AnythingOfType("int")) +func AnythingOfType(t string) AnythingOfTypeArgument { + return AnythingOfTypeArgument(t) +} + +// argumentMatcher performs custom argument matching, returning whether or +// not the argument is matched by the expectation fixture function. +type argumentMatcher struct { + // fn is a function which accepts one argument, and returns a bool. + fn reflect.Value +} + +func (f argumentMatcher) Matches(argument interface{}) bool { + expectType := f.fn.Type().In(0) + + if reflect.TypeOf(argument).AssignableTo(expectType) { + result := f.fn.Call([]reflect.Value{reflect.ValueOf(argument)}) + return result[0].Bool() + } + return false +} + +func (f argumentMatcher) String() string { + return fmt.Sprintf("func(%s) bool", f.fn.Type().In(0).Name()) +} + +// MatchedBy can be used to match a mock call based on only certain properties +// from a complex struct or some calculation. It takes a function that will be +// evaluated with the called argument and will return true when there's a match +// and false otherwise. +// +// Example: +// m.On("Do", MatchedBy(func(req *http.Request) bool { return req.Host == "example.com" })) +// +// |fn|, must be a function accepting a single argument (of the expected type) +// which returns a bool. If |fn| doesn't match the required signature, +// MathedBy() panics. +func MatchedBy(fn interface{}) argumentMatcher { + fnType := reflect.TypeOf(fn) + + if fnType.Kind() != reflect.Func { + panic(fmt.Sprintf("assert: arguments: %s is not a func", fn)) + } + if fnType.NumIn() != 1 { + panic(fmt.Sprintf("assert: arguments: %s does not take exactly one argument", fn)) + } + if fnType.NumOut() != 1 || fnType.Out(0).Kind() != reflect.Bool { + panic(fmt.Sprintf("assert: arguments: %s does not return a bool", fn)) + } + + return argumentMatcher{fn: reflect.ValueOf(fn)} +} + +// Get Returns the argument at the specified index. +func (args Arguments) Get(index int) interface{} { + if index+1 > len(args) { + panic(fmt.Sprintf("assert: arguments: Cannot call Get(%d) because there are %d argument(s).", index, len(args))) + } + return args[index] +} + +// Is gets whether the objects match the arguments specified. +func (args Arguments) Is(objects ...interface{}) bool { + for i, obj := range args { + if obj != objects[i] { + return false + } + } + return true +} + +// Diff gets a string describing the differences between the arguments +// and the specified objects. +// +// Returns the diff string and number of differences found. +func (args Arguments) Diff(objects []interface{}) (string, int) { + + var output = "\n" + var differences int + + var maxArgCount = len(args) + if len(objects) > maxArgCount { + maxArgCount = len(objects) + } + + for i := 0; i < maxArgCount; i++ { + var actual, expected interface{} + + if len(objects) <= i { + actual = "(Missing)" + } else { + actual = objects[i] + } + + if len(args) <= i { + expected = "(Missing)" + } else { + expected = args[i] + } + + if matcher, ok := expected.(argumentMatcher); ok { + if matcher.Matches(actual) { + output = fmt.Sprintf("%s\t%d: \u2705 %s matched by %s\n", output, i, actual, matcher) + } else { + differences++ + output = fmt.Sprintf("%s\t%d: \u2705 %s not matched by %s\n", output, i, actual, matcher) + } + } else if reflect.TypeOf(expected) == reflect.TypeOf((*AnythingOfTypeArgument)(nil)).Elem() { + + // type checking + if reflect.TypeOf(actual).Name() != string(expected.(AnythingOfTypeArgument)) && reflect.TypeOf(actual).String() != string(expected.(AnythingOfTypeArgument)) { + // not match + differences++ + output = fmt.Sprintf("%s\t%d: \u274C type %s != type %s - %s\n", output, i, expected, reflect.TypeOf(actual).Name(), actual) + } + + } else { + + // normal checking + + if assert.ObjectsAreEqual(expected, Anything) || assert.ObjectsAreEqual(actual, Anything) || assert.ObjectsAreEqual(actual, expected) { + // match + output = fmt.Sprintf("%s\t%d: \u2705 %s == %s\n", output, i, actual, expected) + } else { + // not match + differences++ + output = fmt.Sprintf("%s\t%d: \u274C %s != %s\n", output, i, actual, expected) + } + } + + } + + if differences == 0 { + return "No differences.", differences + } + + return output, differences + +} + +// Assert compares the arguments with the specified objects and fails if +// they do not exactly match. +func (args Arguments) Assert(t TestingT, objects ...interface{}) bool { + + // get the differences + diff, diffCount := args.Diff(objects) + + if diffCount == 0 { + return true + } + + // there are differences... report them... + t.Logf(diff) + t.Errorf("%sArguments do not match.", assert.CallerInfo()) + + return false + +} + +// String gets the argument at the specified index. Panics if there is no argument, or +// if the argument is of the wrong type. +// +// If no index is provided, String() returns a complete string representation +// of the arguments. +func (args Arguments) String(indexOrNil ...int) string { + + if len(indexOrNil) == 0 { + // normal String() method - return a string representation of the args + var argsStr []string + for _, arg := range args { + argsStr = append(argsStr, fmt.Sprintf("%s", reflect.TypeOf(arg))) + } + return strings.Join(argsStr, ",") + } else if len(indexOrNil) == 1 { + // Index has been specified - get the argument at that index + var index = indexOrNil[0] + var s string + var ok bool + if s, ok = args.Get(index).(string); !ok { + panic(fmt.Sprintf("assert: arguments: String(%d) failed because object wasn't correct type: %s", index, args.Get(index))) + } + return s + } + + panic(fmt.Sprintf("assert: arguments: Wrong number of arguments passed to String. Must be 0 or 1, not %d", len(indexOrNil))) + +} + +// Int gets the argument at the specified index. Panics if there is no argument, or +// if the argument is of the wrong type. +func (args Arguments) Int(index int) int { + var s int + var ok bool + if s, ok = args.Get(index).(int); !ok { + panic(fmt.Sprintf("assert: arguments: Int(%d) failed because object wasn't correct type: %v", index, args.Get(index))) + } + return s +} + +// Error gets the argument at the specified index. Panics if there is no argument, or +// if the argument is of the wrong type. +func (args Arguments) Error(index int) error { + obj := args.Get(index) + var s error + var ok bool + if obj == nil { + return nil + } + if s, ok = obj.(error); !ok { + panic(fmt.Sprintf("assert: arguments: Error(%d) failed because object wasn't correct type: %v", index, args.Get(index))) + } + return s +} + +// Bool gets the argument at the specified index. Panics if there is no argument, or +// if the argument is of the wrong type. +func (args Arguments) Bool(index int) bool { + var s bool + var ok bool + if s, ok = args.Get(index).(bool); !ok { + panic(fmt.Sprintf("assert: arguments: Bool(%d) failed because object wasn't correct type: %v", index, args.Get(index))) + } + return s +} diff --git a/vendor/github.com/stretchr/testify/require/doc.go b/vendor/github.com/stretchr/testify/require/doc.go new file mode 100644 index 000000000..169de3922 --- /dev/null +++ b/vendor/github.com/stretchr/testify/require/doc.go @@ -0,0 +1,28 @@ +// Package require implements the same assertions as the `assert` package but +// stops test execution when a test fails. +// +// Example Usage +// +// The following is a complete example using require in a standard test function: +// import ( +// "testing" +// "github.com/stretchr/testify/require" +// ) +// +// func TestSomething(t *testing.T) { +// +// var a string = "Hello" +// var b string = "Hello" +// +// require.Equal(t, a, b, "The two words should be the same.") +// +// } +// +// Assertions +// +// The `require` package have same global functions as in the `assert` package, +// but instead of returning a boolean result they call `t.FailNow()`. +// +// Every assertion function also takes an optional string message as the final argument, +// allowing custom error messages to be appended to the message the assertion method outputs. +package require diff --git a/vendor/github.com/stretchr/testify/require/forward_requirements.go b/vendor/github.com/stretchr/testify/require/forward_requirements.go new file mode 100644 index 000000000..d3c2ab9bc --- /dev/null +++ b/vendor/github.com/stretchr/testify/require/forward_requirements.go @@ -0,0 +1,16 @@ +package require + +// Assertions provides assertion methods around the +// TestingT interface. +type Assertions struct { + t TestingT +} + +// New makes a new Assertions object for the specified TestingT. +func New(t TestingT) *Assertions { + return &Assertions{ + t: t, + } +} + +//go:generate go run ../_codegen/main.go -output-package=require -template=require_forward.go.tmpl diff --git a/vendor/github.com/stretchr/testify/require/require.go b/vendor/github.com/stretchr/testify/require/require.go new file mode 100644 index 000000000..1bcfcb0d9 --- /dev/null +++ b/vendor/github.com/stretchr/testify/require/require.go @@ -0,0 +1,464 @@ +/* +* CODE GENERATED AUTOMATICALLY WITH github.com/stretchr/testify/_codegen +* THIS FILE MUST NOT BE EDITED BY HAND +*/ + +package require + +import ( + + assert "github.com/stretchr/testify/assert" + http "net/http" + url "net/url" + time "time" +) + + +// Condition uses a Comparison to assert a complex condition. +func Condition(t TestingT, comp assert.Comparison, msgAndArgs ...interface{}) { + if !assert.Condition(t, comp, msgAndArgs...) { + t.FailNow() + } +} + + +// Contains asserts that the specified string, list(array, slice...) or map contains the +// specified substring or element. +// +// assert.Contains(t, "Hello World", "World", "But 'Hello World' does contain 'World'") +// assert.Contains(t, ["Hello", "World"], "World", "But ["Hello", "World"] does contain 'World'") +// assert.Contains(t, {"Hello": "World"}, "Hello", "But {'Hello': 'World'} does contain 'Hello'") +// +// Returns whether the assertion was successful (true) or not (false). +func Contains(t TestingT, s interface{}, contains interface{}, msgAndArgs ...interface{}) { + if !assert.Contains(t, s, contains, msgAndArgs...) { + t.FailNow() + } +} + + +// Empty asserts that the specified object is empty. I.e. nil, "", false, 0 or either +// a slice or a channel with len == 0. +// +// assert.Empty(t, obj) +// +// Returns whether the assertion was successful (true) or not (false). +func Empty(t TestingT, object interface{}, msgAndArgs ...interface{}) { + if !assert.Empty(t, object, msgAndArgs...) { + t.FailNow() + } +} + + +// Equal asserts that two objects are equal. +// +// assert.Equal(t, 123, 123, "123 and 123 should be equal") +// +// Returns whether the assertion was successful (true) or not (false). +func Equal(t TestingT, expected interface{}, actual interface{}, msgAndArgs ...interface{}) { + if !assert.Equal(t, expected, actual, msgAndArgs...) { + t.FailNow() + } +} + + +// EqualError asserts that a function returned an error (i.e. not `nil`) +// and that it is equal to the provided error. +// +// actualObj, err := SomeFunction() +// if assert.Error(t, err, "An error was expected") { +// assert.Equal(t, err, expectedError) +// } +// +// Returns whether the assertion was successful (true) or not (false). +func EqualError(t TestingT, theError error, errString string, msgAndArgs ...interface{}) { + if !assert.EqualError(t, theError, errString, msgAndArgs...) { + t.FailNow() + } +} + + +// EqualValues asserts that two objects are equal or convertable to the same types +// and equal. +// +// assert.EqualValues(t, uint32(123), int32(123), "123 and 123 should be equal") +// +// Returns whether the assertion was successful (true) or not (false). +func EqualValues(t TestingT, expected interface{}, actual interface{}, msgAndArgs ...interface{}) { + if !assert.EqualValues(t, expected, actual, msgAndArgs...) { + t.FailNow() + } +} + + +// Error asserts that a function returned an error (i.e. not `nil`). +// +// actualObj, err := SomeFunction() +// if assert.Error(t, err, "An error was expected") { +// assert.Equal(t, err, expectedError) +// } +// +// Returns whether the assertion was successful (true) or not (false). +func Error(t TestingT, err error, msgAndArgs ...interface{}) { + if !assert.Error(t, err, msgAndArgs...) { + t.FailNow() + } +} + + +// Exactly asserts that two objects are equal is value and type. +// +// assert.Exactly(t, int32(123), int64(123), "123 and 123 should NOT be equal") +// +// Returns whether the assertion was successful (true) or not (false). +func Exactly(t TestingT, expected interface{}, actual interface{}, msgAndArgs ...interface{}) { + if !assert.Exactly(t, expected, actual, msgAndArgs...) { + t.FailNow() + } +} + + +// Fail reports a failure through +func Fail(t TestingT, failureMessage string, msgAndArgs ...interface{}) { + if !assert.Fail(t, failureMessage, msgAndArgs...) { + t.FailNow() + } +} + + +// FailNow fails test +func FailNow(t TestingT, failureMessage string, msgAndArgs ...interface{}) { + if !assert.FailNow(t, failureMessage, msgAndArgs...) { + t.FailNow() + } +} + + +// False asserts that the specified value is false. +// +// assert.False(t, myBool, "myBool should be false") +// +// Returns whether the assertion was successful (true) or not (false). +func False(t TestingT, value bool, msgAndArgs ...interface{}) { + if !assert.False(t, value, msgAndArgs...) { + t.FailNow() + } +} + + +// HTTPBodyContains asserts that a specified handler returns a +// body that contains a string. +// +// assert.HTTPBodyContains(t, myHandler, "www.google.com", nil, "I'm Feeling Lucky") +// +// Returns whether the assertion was successful (true) or not (false). +func HTTPBodyContains(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, str interface{}) { + if !assert.HTTPBodyContains(t, handler, method, url, values, str) { + t.FailNow() + } +} + + +// HTTPBodyNotContains asserts that a specified handler returns a +// body that does not contain a string. +// +// assert.HTTPBodyNotContains(t, myHandler, "www.google.com", nil, "I'm Feeling Lucky") +// +// Returns whether the assertion was successful (true) or not (false). +func HTTPBodyNotContains(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, str interface{}) { + if !assert.HTTPBodyNotContains(t, handler, method, url, values, str) { + t.FailNow() + } +} + + +// HTTPError asserts that a specified handler returns an error status code. +// +// assert.HTTPError(t, myHandler, "POST", "/a/b/c", url.Values{"a": []string{"b", "c"}} +// +// Returns whether the assertion was successful (true) or not (false). +func HTTPError(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values) { + if !assert.HTTPError(t, handler, method, url, values) { + t.FailNow() + } +} + + +// HTTPRedirect asserts that a specified handler returns a redirect status code. +// +// assert.HTTPRedirect(t, myHandler, "GET", "/a/b/c", url.Values{"a": []string{"b", "c"}} +// +// Returns whether the assertion was successful (true) or not (false). +func HTTPRedirect(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values) { + if !assert.HTTPRedirect(t, handler, method, url, values) { + t.FailNow() + } +} + + +// HTTPSuccess asserts that a specified handler returns a success status code. +// +// assert.HTTPSuccess(t, myHandler, "POST", "http://www.google.com", nil) +// +// Returns whether the assertion was successful (true) or not (false). +func HTTPSuccess(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values) { + if !assert.HTTPSuccess(t, handler, method, url, values) { + t.FailNow() + } +} + + +// Implements asserts that an object is implemented by the specified interface. +// +// assert.Implements(t, (*MyInterface)(nil), new(MyObject), "MyObject") +func Implements(t TestingT, interfaceObject interface{}, object interface{}, msgAndArgs ...interface{}) { + if !assert.Implements(t, interfaceObject, object, msgAndArgs...) { + t.FailNow() + } +} + + +// InDelta asserts that the two numerals are within delta of each other. +// +// assert.InDelta(t, math.Pi, (22 / 7.0), 0.01) +// +// Returns whether the assertion was successful (true) or not (false). +func InDelta(t TestingT, expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) { + if !assert.InDelta(t, expected, actual, delta, msgAndArgs...) { + t.FailNow() + } +} + + +// InDeltaSlice is the same as InDelta, except it compares two slices. +func InDeltaSlice(t TestingT, expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) { + if !assert.InDeltaSlice(t, expected, actual, delta, msgAndArgs...) { + t.FailNow() + } +} + + +// InEpsilon asserts that expected and actual have a relative error less than epsilon +// +// Returns whether the assertion was successful (true) or not (false). +func InEpsilon(t TestingT, expected interface{}, actual interface{}, epsilon float64, msgAndArgs ...interface{}) { + if !assert.InEpsilon(t, expected, actual, epsilon, msgAndArgs...) { + t.FailNow() + } +} + + +// InEpsilonSlice is the same as InEpsilon, except it compares two slices. +func InEpsilonSlice(t TestingT, expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) { + if !assert.InEpsilonSlice(t, expected, actual, delta, msgAndArgs...) { + t.FailNow() + } +} + + +// IsType asserts that the specified objects are of the same type. +func IsType(t TestingT, expectedType interface{}, object interface{}, msgAndArgs ...interface{}) { + if !assert.IsType(t, expectedType, object, msgAndArgs...) { + t.FailNow() + } +} + + +// JSONEq asserts that two JSON strings are equivalent. +// +// assert.JSONEq(t, `{"hello": "world", "foo": "bar"}`, `{"foo": "bar", "hello": "world"}`) +// +// Returns whether the assertion was successful (true) or not (false). +func JSONEq(t TestingT, expected string, actual string, msgAndArgs ...interface{}) { + if !assert.JSONEq(t, expected, actual, msgAndArgs...) { + t.FailNow() + } +} + + +// Len asserts that the specified object has specific length. +// Len also fails if the object has a type that len() not accept. +// +// assert.Len(t, mySlice, 3, "The size of slice is not 3") +// +// Returns whether the assertion was successful (true) or not (false). +func Len(t TestingT, object interface{}, length int, msgAndArgs ...interface{}) { + if !assert.Len(t, object, length, msgAndArgs...) { + t.FailNow() + } +} + + +// Nil asserts that the specified object is nil. +// +// assert.Nil(t, err, "err should be nothing") +// +// Returns whether the assertion was successful (true) or not (false). +func Nil(t TestingT, object interface{}, msgAndArgs ...interface{}) { + if !assert.Nil(t, object, msgAndArgs...) { + t.FailNow() + } +} + + +// NoError asserts that a function returned no error (i.e. `nil`). +// +// actualObj, err := SomeFunction() +// if assert.NoError(t, err) { +// assert.Equal(t, actualObj, expectedObj) +// } +// +// Returns whether the assertion was successful (true) or not (false). +func NoError(t TestingT, err error, msgAndArgs ...interface{}) { + if !assert.NoError(t, err, msgAndArgs...) { + t.FailNow() + } +} + + +// NotContains asserts that the specified string, list(array, slice...) or map does NOT contain the +// specified substring or element. +// +// assert.NotContains(t, "Hello World", "Earth", "But 'Hello World' does NOT contain 'Earth'") +// assert.NotContains(t, ["Hello", "World"], "Earth", "But ['Hello', 'World'] does NOT contain 'Earth'") +// assert.NotContains(t, {"Hello": "World"}, "Earth", "But {'Hello': 'World'} does NOT contain 'Earth'") +// +// Returns whether the assertion was successful (true) or not (false). +func NotContains(t TestingT, s interface{}, contains interface{}, msgAndArgs ...interface{}) { + if !assert.NotContains(t, s, contains, msgAndArgs...) { + t.FailNow() + } +} + + +// NotEmpty asserts that the specified object is NOT empty. I.e. not nil, "", false, 0 or either +// a slice or a channel with len == 0. +// +// if assert.NotEmpty(t, obj) { +// assert.Equal(t, "two", obj[1]) +// } +// +// Returns whether the assertion was successful (true) or not (false). +func NotEmpty(t TestingT, object interface{}, msgAndArgs ...interface{}) { + if !assert.NotEmpty(t, object, msgAndArgs...) { + t.FailNow() + } +} + + +// NotEqual asserts that the specified values are NOT equal. +// +// assert.NotEqual(t, obj1, obj2, "two objects shouldn't be equal") +// +// Returns whether the assertion was successful (true) or not (false). +func NotEqual(t TestingT, expected interface{}, actual interface{}, msgAndArgs ...interface{}) { + if !assert.NotEqual(t, expected, actual, msgAndArgs...) { + t.FailNow() + } +} + + +// NotNil asserts that the specified object is not nil. +// +// assert.NotNil(t, err, "err should be something") +// +// Returns whether the assertion was successful (true) or not (false). +func NotNil(t TestingT, object interface{}, msgAndArgs ...interface{}) { + if !assert.NotNil(t, object, msgAndArgs...) { + t.FailNow() + } +} + + +// NotPanics asserts that the code inside the specified PanicTestFunc does NOT panic. +// +// assert.NotPanics(t, func(){ +// RemainCalm() +// }, "Calling RemainCalm() should NOT panic") +// +// Returns whether the assertion was successful (true) or not (false). +func NotPanics(t TestingT, f assert.PanicTestFunc, msgAndArgs ...interface{}) { + if !assert.NotPanics(t, f, msgAndArgs...) { + t.FailNow() + } +} + + +// NotRegexp asserts that a specified regexp does not match a string. +// +// assert.NotRegexp(t, regexp.MustCompile("starts"), "it's starting") +// assert.NotRegexp(t, "^start", "it's not starting") +// +// Returns whether the assertion was successful (true) or not (false). +func NotRegexp(t TestingT, rx interface{}, str interface{}, msgAndArgs ...interface{}) { + if !assert.NotRegexp(t, rx, str, msgAndArgs...) { + t.FailNow() + } +} + + +// NotZero asserts that i is not the zero value for its type and returns the truth. +func NotZero(t TestingT, i interface{}, msgAndArgs ...interface{}) { + if !assert.NotZero(t, i, msgAndArgs...) { + t.FailNow() + } +} + + +// Panics asserts that the code inside the specified PanicTestFunc panics. +// +// assert.Panics(t, func(){ +// GoCrazy() +// }, "Calling GoCrazy() should panic") +// +// Returns whether the assertion was successful (true) or not (false). +func Panics(t TestingT, f assert.PanicTestFunc, msgAndArgs ...interface{}) { + if !assert.Panics(t, f, msgAndArgs...) { + t.FailNow() + } +} + + +// Regexp asserts that a specified regexp matches a string. +// +// assert.Regexp(t, regexp.MustCompile("start"), "it's starting") +// assert.Regexp(t, "start...$", "it's not starting") +// +// Returns whether the assertion was successful (true) or not (false). +func Regexp(t TestingT, rx interface{}, str interface{}, msgAndArgs ...interface{}) { + if !assert.Regexp(t, rx, str, msgAndArgs...) { + t.FailNow() + } +} + + +// True asserts that the specified value is true. +// +// assert.True(t, myBool, "myBool should be true") +// +// Returns whether the assertion was successful (true) or not (false). +func True(t TestingT, value bool, msgAndArgs ...interface{}) { + if !assert.True(t, value, msgAndArgs...) { + t.FailNow() + } +} + + +// WithinDuration asserts that the two times are within duration delta of each other. +// +// assert.WithinDuration(t, time.Now(), time.Now(), 10*time.Second, "The difference should not be more than 10s") +// +// Returns whether the assertion was successful (true) or not (false). +func WithinDuration(t TestingT, expected time.Time, actual time.Time, delta time.Duration, msgAndArgs ...interface{}) { + if !assert.WithinDuration(t, expected, actual, delta, msgAndArgs...) { + t.FailNow() + } +} + + +// Zero asserts that i is the zero value for its type and returns the truth. +func Zero(t TestingT, i interface{}, msgAndArgs ...interface{}) { + if !assert.Zero(t, i, msgAndArgs...) { + t.FailNow() + } +} diff --git a/vendor/github.com/stretchr/testify/require/require.go.tmpl b/vendor/github.com/stretchr/testify/require/require.go.tmpl new file mode 100644 index 000000000..ab1b1e9fd --- /dev/null +++ b/vendor/github.com/stretchr/testify/require/require.go.tmpl @@ -0,0 +1,6 @@ +{{.Comment}} +func {{.DocInfo.Name}}(t TestingT, {{.Params}}) { + if !assert.{{.DocInfo.Name}}(t, {{.ForwardedParams}}) { + t.FailNow() + } +} diff --git a/vendor/github.com/stretchr/testify/require/require_forward.go b/vendor/github.com/stretchr/testify/require/require_forward.go new file mode 100644 index 000000000..58324f105 --- /dev/null +++ b/vendor/github.com/stretchr/testify/require/require_forward.go @@ -0,0 +1,388 @@ +/* +* CODE GENERATED AUTOMATICALLY WITH github.com/stretchr/testify/_codegen +* THIS FILE MUST NOT BE EDITED BY HAND +*/ + +package require + +import ( + + assert "github.com/stretchr/testify/assert" + http "net/http" + url "net/url" + time "time" +) + + +// Condition uses a Comparison to assert a complex condition. +func (a *Assertions) Condition(comp assert.Comparison, msgAndArgs ...interface{}) { + Condition(a.t, comp, msgAndArgs...) +} + + +// Contains asserts that the specified string, list(array, slice...) or map contains the +// specified substring or element. +// +// a.Contains("Hello World", "World", "But 'Hello World' does contain 'World'") +// a.Contains(["Hello", "World"], "World", "But ["Hello", "World"] does contain 'World'") +// a.Contains({"Hello": "World"}, "Hello", "But {'Hello': 'World'} does contain 'Hello'") +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) Contains(s interface{}, contains interface{}, msgAndArgs ...interface{}) { + Contains(a.t, s, contains, msgAndArgs...) +} + + +// Empty asserts that the specified object is empty. I.e. nil, "", false, 0 or either +// a slice or a channel with len == 0. +// +// a.Empty(obj) +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) Empty(object interface{}, msgAndArgs ...interface{}) { + Empty(a.t, object, msgAndArgs...) +} + + +// Equal asserts that two objects are equal. +// +// a.Equal(123, 123, "123 and 123 should be equal") +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) Equal(expected interface{}, actual interface{}, msgAndArgs ...interface{}) { + Equal(a.t, expected, actual, msgAndArgs...) +} + + +// EqualError asserts that a function returned an error (i.e. not `nil`) +// and that it is equal to the provided error. +// +// actualObj, err := SomeFunction() +// if assert.Error(t, err, "An error was expected") { +// assert.Equal(t, err, expectedError) +// } +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) EqualError(theError error, errString string, msgAndArgs ...interface{}) { + EqualError(a.t, theError, errString, msgAndArgs...) +} + + +// EqualValues asserts that two objects are equal or convertable to the same types +// and equal. +// +// a.EqualValues(uint32(123), int32(123), "123 and 123 should be equal") +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) EqualValues(expected interface{}, actual interface{}, msgAndArgs ...interface{}) { + EqualValues(a.t, expected, actual, msgAndArgs...) +} + + +// Error asserts that a function returned an error (i.e. not `nil`). +// +// actualObj, err := SomeFunction() +// if a.Error(err, "An error was expected") { +// assert.Equal(t, err, expectedError) +// } +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) Error(err error, msgAndArgs ...interface{}) { + Error(a.t, err, msgAndArgs...) +} + + +// Exactly asserts that two objects are equal is value and type. +// +// a.Exactly(int32(123), int64(123), "123 and 123 should NOT be equal") +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) Exactly(expected interface{}, actual interface{}, msgAndArgs ...interface{}) { + Exactly(a.t, expected, actual, msgAndArgs...) +} + + +// Fail reports a failure through +func (a *Assertions) Fail(failureMessage string, msgAndArgs ...interface{}) { + Fail(a.t, failureMessage, msgAndArgs...) +} + + +// FailNow fails test +func (a *Assertions) FailNow(failureMessage string, msgAndArgs ...interface{}) { + FailNow(a.t, failureMessage, msgAndArgs...) +} + + +// False asserts that the specified value is false. +// +// a.False(myBool, "myBool should be false") +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) False(value bool, msgAndArgs ...interface{}) { + False(a.t, value, msgAndArgs...) +} + + +// HTTPBodyContains asserts that a specified handler returns a +// body that contains a string. +// +// a.HTTPBodyContains(myHandler, "www.google.com", nil, "I'm Feeling Lucky") +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) HTTPBodyContains(handler http.HandlerFunc, method string, url string, values url.Values, str interface{}) { + HTTPBodyContains(a.t, handler, method, url, values, str) +} + + +// HTTPBodyNotContains asserts that a specified handler returns a +// body that does not contain a string. +// +// a.HTTPBodyNotContains(myHandler, "www.google.com", nil, "I'm Feeling Lucky") +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) HTTPBodyNotContains(handler http.HandlerFunc, method string, url string, values url.Values, str interface{}) { + HTTPBodyNotContains(a.t, handler, method, url, values, str) +} + + +// HTTPError asserts that a specified handler returns an error status code. +// +// a.HTTPError(myHandler, "POST", "/a/b/c", url.Values{"a": []string{"b", "c"}} +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) HTTPError(handler http.HandlerFunc, method string, url string, values url.Values) { + HTTPError(a.t, handler, method, url, values) +} + + +// HTTPRedirect asserts that a specified handler returns a redirect status code. +// +// a.HTTPRedirect(myHandler, "GET", "/a/b/c", url.Values{"a": []string{"b", "c"}} +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) HTTPRedirect(handler http.HandlerFunc, method string, url string, values url.Values) { + HTTPRedirect(a.t, handler, method, url, values) +} + + +// HTTPSuccess asserts that a specified handler returns a success status code. +// +// a.HTTPSuccess(myHandler, "POST", "http://www.google.com", nil) +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) HTTPSuccess(handler http.HandlerFunc, method string, url string, values url.Values) { + HTTPSuccess(a.t, handler, method, url, values) +} + + +// Implements asserts that an object is implemented by the specified interface. +// +// a.Implements((*MyInterface)(nil), new(MyObject), "MyObject") +func (a *Assertions) Implements(interfaceObject interface{}, object interface{}, msgAndArgs ...interface{}) { + Implements(a.t, interfaceObject, object, msgAndArgs...) +} + + +// InDelta asserts that the two numerals are within delta of each other. +// +// a.InDelta(math.Pi, (22 / 7.0), 0.01) +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) InDelta(expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) { + InDelta(a.t, expected, actual, delta, msgAndArgs...) +} + + +// InDeltaSlice is the same as InDelta, except it compares two slices. +func (a *Assertions) InDeltaSlice(expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) { + InDeltaSlice(a.t, expected, actual, delta, msgAndArgs...) +} + + +// InEpsilon asserts that expected and actual have a relative error less than epsilon +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) InEpsilon(expected interface{}, actual interface{}, epsilon float64, msgAndArgs ...interface{}) { + InEpsilon(a.t, expected, actual, epsilon, msgAndArgs...) +} + + +// InEpsilonSlice is the same as InEpsilon, except it compares two slices. +func (a *Assertions) InEpsilonSlice(expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) { + InEpsilonSlice(a.t, expected, actual, delta, msgAndArgs...) +} + + +// IsType asserts that the specified objects are of the same type. +func (a *Assertions) IsType(expectedType interface{}, object interface{}, msgAndArgs ...interface{}) { + IsType(a.t, expectedType, object, msgAndArgs...) +} + + +// JSONEq asserts that two JSON strings are equivalent. +// +// a.JSONEq(`{"hello": "world", "foo": "bar"}`, `{"foo": "bar", "hello": "world"}`) +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) JSONEq(expected string, actual string, msgAndArgs ...interface{}) { + JSONEq(a.t, expected, actual, msgAndArgs...) +} + + +// Len asserts that the specified object has specific length. +// Len also fails if the object has a type that len() not accept. +// +// a.Len(mySlice, 3, "The size of slice is not 3") +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) Len(object interface{}, length int, msgAndArgs ...interface{}) { + Len(a.t, object, length, msgAndArgs...) +} + + +// Nil asserts that the specified object is nil. +// +// a.Nil(err, "err should be nothing") +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) Nil(object interface{}, msgAndArgs ...interface{}) { + Nil(a.t, object, msgAndArgs...) +} + + +// NoError asserts that a function returned no error (i.e. `nil`). +// +// actualObj, err := SomeFunction() +// if a.NoError(err) { +// assert.Equal(t, actualObj, expectedObj) +// } +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) NoError(err error, msgAndArgs ...interface{}) { + NoError(a.t, err, msgAndArgs...) +} + + +// NotContains asserts that the specified string, list(array, slice...) or map does NOT contain the +// specified substring or element. +// +// a.NotContains("Hello World", "Earth", "But 'Hello World' does NOT contain 'Earth'") +// a.NotContains(["Hello", "World"], "Earth", "But ['Hello', 'World'] does NOT contain 'Earth'") +// a.NotContains({"Hello": "World"}, "Earth", "But {'Hello': 'World'} does NOT contain 'Earth'") +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) NotContains(s interface{}, contains interface{}, msgAndArgs ...interface{}) { + NotContains(a.t, s, contains, msgAndArgs...) +} + + +// NotEmpty asserts that the specified object is NOT empty. I.e. not nil, "", false, 0 or either +// a slice or a channel with len == 0. +// +// if a.NotEmpty(obj) { +// assert.Equal(t, "two", obj[1]) +// } +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) NotEmpty(object interface{}, msgAndArgs ...interface{}) { + NotEmpty(a.t, object, msgAndArgs...) +} + + +// NotEqual asserts that the specified values are NOT equal. +// +// a.NotEqual(obj1, obj2, "two objects shouldn't be equal") +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) NotEqual(expected interface{}, actual interface{}, msgAndArgs ...interface{}) { + NotEqual(a.t, expected, actual, msgAndArgs...) +} + + +// NotNil asserts that the specified object is not nil. +// +// a.NotNil(err, "err should be something") +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) NotNil(object interface{}, msgAndArgs ...interface{}) { + NotNil(a.t, object, msgAndArgs...) +} + + +// NotPanics asserts that the code inside the specified PanicTestFunc does NOT panic. +// +// a.NotPanics(func(){ +// RemainCalm() +// }, "Calling RemainCalm() should NOT panic") +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) NotPanics(f assert.PanicTestFunc, msgAndArgs ...interface{}) { + NotPanics(a.t, f, msgAndArgs...) +} + + +// NotRegexp asserts that a specified regexp does not match a string. +// +// a.NotRegexp(regexp.MustCompile("starts"), "it's starting") +// a.NotRegexp("^start", "it's not starting") +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) NotRegexp(rx interface{}, str interface{}, msgAndArgs ...interface{}) { + NotRegexp(a.t, rx, str, msgAndArgs...) +} + + +// NotZero asserts that i is not the zero value for its type and returns the truth. +func (a *Assertions) NotZero(i interface{}, msgAndArgs ...interface{}) { + NotZero(a.t, i, msgAndArgs...) +} + + +// Panics asserts that the code inside the specified PanicTestFunc panics. +// +// a.Panics(func(){ +// GoCrazy() +// }, "Calling GoCrazy() should panic") +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) Panics(f assert.PanicTestFunc, msgAndArgs ...interface{}) { + Panics(a.t, f, msgAndArgs...) +} + + +// Regexp asserts that a specified regexp matches a string. +// +// a.Regexp(regexp.MustCompile("start"), "it's starting") +// a.Regexp("start...$", "it's not starting") +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) Regexp(rx interface{}, str interface{}, msgAndArgs ...interface{}) { + Regexp(a.t, rx, str, msgAndArgs...) +} + + +// True asserts that the specified value is true. +// +// a.True(myBool, "myBool should be true") +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) True(value bool, msgAndArgs ...interface{}) { + True(a.t, value, msgAndArgs...) +} + + +// WithinDuration asserts that the two times are within duration delta of each other. +// +// a.WithinDuration(time.Now(), time.Now(), 10*time.Second, "The difference should not be more than 10s") +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) WithinDuration(expected time.Time, actual time.Time, delta time.Duration, msgAndArgs ...interface{}) { + WithinDuration(a.t, expected, actual, delta, msgAndArgs...) +} + + +// Zero asserts that i is the zero value for its type and returns the truth. +func (a *Assertions) Zero(i interface{}, msgAndArgs ...interface{}) { + Zero(a.t, i, msgAndArgs...) +} diff --git a/vendor/github.com/stretchr/testify/require/require_forward.go.tmpl b/vendor/github.com/stretchr/testify/require/require_forward.go.tmpl new file mode 100644 index 000000000..b93569e0a --- /dev/null +++ b/vendor/github.com/stretchr/testify/require/require_forward.go.tmpl @@ -0,0 +1,4 @@ +{{.CommentWithoutT "a"}} +func (a *Assertions) {{.DocInfo.Name}}({{.Params}}) { + {{.DocInfo.Name}}(a.t, {{.ForwardedParams}}) +} diff --git a/vendor/github.com/stretchr/testify/require/requirements.go b/vendor/github.com/stretchr/testify/require/requirements.go new file mode 100644 index 000000000..41147562d --- /dev/null +++ b/vendor/github.com/stretchr/testify/require/requirements.go @@ -0,0 +1,9 @@ +package require + +// TestingT is an interface wrapper around *testing.T +type TestingT interface { + Errorf(format string, args ...interface{}) + FailNow() +} + +//go:generate go run ../_codegen/main.go -output-package=require -template=require.go.tmpl diff --git a/vendor/github.com/stretchr/testify/suite/doc.go b/vendor/github.com/stretchr/testify/suite/doc.go new file mode 100644 index 000000000..f91a245d3 --- /dev/null +++ b/vendor/github.com/stretchr/testify/suite/doc.go @@ -0,0 +1,65 @@ +// Package suite contains logic for creating testing suite structs +// and running the methods on those structs as tests. The most useful +// piece of this package is that you can create setup/teardown methods +// on your testing suites, which will run before/after the whole suite +// or individual tests (depending on which interface(s) you +// implement). +// +// A testing suite is usually built by first extending the built-in +// suite functionality from suite.Suite in testify. Alternatively, +// you could reproduce that logic on your own if you wanted (you +// just need to implement the TestingSuite interface from +// suite/interfaces.go). +// +// After that, you can implement any of the interfaces in +// suite/interfaces.go to add setup/teardown functionality to your +// suite, and add any methods that start with "Test" to add tests. +// Methods that do not match any suite interfaces and do not begin +// with "Test" will not be run by testify, and can safely be used as +// helper methods. +// +// Once you've built your testing suite, you need to run the suite +// (using suite.Run from testify) inside any function that matches the +// identity that "go test" is already looking for (i.e. +// func(*testing.T)). +// +// Regular expression to select test suites specified command-line +// argument "-run". Regular expression to select the methods +// of test suites specified command-line argument "-m". +// Suite object has assertion methods. +// +// A crude example: +// // Basic imports +// import ( +// "testing" +// "github.com/stretchr/testify/assert" +// "github.com/stretchr/testify/suite" +// ) +// +// // Define the suite, and absorb the built-in basic suite +// // functionality from testify - including a T() method which +// // returns the current testing context +// type ExampleTestSuite struct { +// suite.Suite +// VariableThatShouldStartAtFive int +// } +// +// // Make sure that VariableThatShouldStartAtFive is set to five +// // before each test +// func (suite *ExampleTestSuite) SetupTest() { +// suite.VariableThatShouldStartAtFive = 5 +// } +// +// // All methods that begin with "Test" are run as tests within a +// // suite. +// func (suite *ExampleTestSuite) TestExample() { +// assert.Equal(suite.T(), 5, suite.VariableThatShouldStartAtFive) +// suite.Equal(5, suite.VariableThatShouldStartAtFive) +// } +// +// // In order for 'go test' to run this suite, we need to create +// // a normal test function and pass our suite to suite.Run +// func TestExampleTestSuite(t *testing.T) { +// suite.Run(t, new(ExampleTestSuite)) +// } +package suite diff --git a/vendor/github.com/stretchr/testify/suite/interfaces.go b/vendor/github.com/stretchr/testify/suite/interfaces.go new file mode 100644 index 000000000..20969472c --- /dev/null +++ b/vendor/github.com/stretchr/testify/suite/interfaces.go @@ -0,0 +1,34 @@ +package suite + +import "testing" + +// TestingSuite can store and return the current *testing.T context +// generated by 'go test'. +type TestingSuite interface { + T() *testing.T + SetT(*testing.T) +} + +// SetupAllSuite has a SetupSuite method, which will run before the +// tests in the suite are run. +type SetupAllSuite interface { + SetupSuite() +} + +// SetupTestSuite has a SetupTest method, which will run before each +// test in the suite. +type SetupTestSuite interface { + SetupTest() +} + +// TearDownAllSuite has a TearDownSuite method, which will run after +// all the tests in the suite have been run. +type TearDownAllSuite interface { + TearDownSuite() +} + +// TearDownTestSuite has a TearDownTest method, which will run after +// each test in the suite. +type TearDownTestSuite interface { + TearDownTest() +} diff --git a/vendor/github.com/stretchr/testify/suite/suite.go b/vendor/github.com/stretchr/testify/suite/suite.go new file mode 100644 index 000000000..f831e2511 --- /dev/null +++ b/vendor/github.com/stretchr/testify/suite/suite.go @@ -0,0 +1,115 @@ +package suite + +import ( + "flag" + "fmt" + "os" + "reflect" + "regexp" + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +var matchMethod = flag.String("m", "", "regular expression to select tests of the suite to run") + +// Suite is a basic testing suite with methods for storing and +// retrieving the current *testing.T context. +type Suite struct { + *assert.Assertions + require *require.Assertions + t *testing.T +} + +// T retrieves the current *testing.T context. +func (suite *Suite) T() *testing.T { + return suite.t +} + +// SetT sets the current *testing.T context. +func (suite *Suite) SetT(t *testing.T) { + suite.t = t + suite.Assertions = assert.New(t) + suite.require = require.New(t) +} + +// Require returns a require context for suite. +func (suite *Suite) Require() *require.Assertions { + if suite.require == nil { + suite.require = require.New(suite.T()) + } + return suite.require +} + +// Assert returns an assert context for suite. Normally, you can call +// `suite.NoError(expected, actual)`, but for situations where the embedded +// methods are overridden (for example, you might want to override +// assert.Assertions with require.Assertions), this method is provided so you +// can call `suite.Assert().NoError()`. +func (suite *Suite) Assert() *assert.Assertions { + if suite.Assertions == nil { + suite.Assertions = assert.New(suite.T()) + } + return suite.Assertions +} + +// Run takes a testing suite and runs all of the tests attached +// to it. +func Run(t *testing.T, suite TestingSuite) { + suite.SetT(t) + + if setupAllSuite, ok := suite.(SetupAllSuite); ok { + setupAllSuite.SetupSuite() + } + defer func() { + if tearDownAllSuite, ok := suite.(TearDownAllSuite); ok { + tearDownAllSuite.TearDownSuite() + } + }() + + methodFinder := reflect.TypeOf(suite) + tests := []testing.InternalTest{} + for index := 0; index < methodFinder.NumMethod(); index++ { + method := methodFinder.Method(index) + ok, err := methodFilter(method.Name) + if err != nil { + fmt.Fprintf(os.Stderr, "testify: invalid regexp for -m: %s\n", err) + os.Exit(1) + } + if ok { + test := testing.InternalTest{ + Name: method.Name, + F: func(t *testing.T) { + parentT := suite.T() + suite.SetT(t) + if setupTestSuite, ok := suite.(SetupTestSuite); ok { + setupTestSuite.SetupTest() + } + defer func() { + if tearDownTestSuite, ok := suite.(TearDownTestSuite); ok { + tearDownTestSuite.TearDownTest() + } + suite.SetT(parentT) + }() + method.Func.Call([]reflect.Value{reflect.ValueOf(suite)}) + }, + } + tests = append(tests, test) + } + } + + if !testing.RunTests(func(_, _ string) (bool, error) { return true, nil }, + tests) { + t.Fail() + } +} + +// Filtering method according to set regular expression +// specified command-line argument -m +func methodFilter(name string) (bool, error) { + if ok, _ := regexp.MatchString("^Test", name); !ok { + return false, nil + } + return regexp.MatchString(*matchMethod, name) +} diff --git a/version/version.go b/version/version.go index 57e3066d1..a63b45c48 100644 --- a/version/version.go +++ b/version/version.go @@ -9,7 +9,7 @@ import ( var GitCommit string // The main version number that is being run at the moment. -const Version = "0.10.2" +const Version = "0.11.0" // A pre-release marker for the version. If this is "" (empty string) // then it means that it is a final release. Otherwise, this is a pre-release diff --git a/website/Gemfile b/website/Gemfile index d2bc2b188..76e7fafef 100644 --- a/website/Gemfile +++ b/website/Gemfile @@ -1,4 +1,6 @@ source "https://rubygems.org" -gem "middleman-hashicorp", github: "hashicorp/middleman-hashicorp" +gem "middleman-hashicorp", + git: "https://github.com/hashicorp/middleman-hashicorp.git" + gem "htmlbeautifier" diff --git a/website/Gemfile.lock b/website/Gemfile.lock index f1bd03410..ae2befdb8 100644 --- a/website/Gemfile.lock +++ b/website/Gemfile.lock @@ -1,6 +1,6 @@ GIT - remote: git://github.com/hashicorp/middleman-hashicorp.git - revision: 953baf8762b915cf57553bcc82bc946ad777056f + remote: https://github.com/hashicorp/middleman-hashicorp.git + revision: 80ddc227b26cbbb3742d14396f26172174222080 specs: middleman-hashicorp (0.2.0) bootstrap-sass (~> 3.3) @@ -21,16 +21,15 @@ GIT GEM remote: https://rubygems.org/ specs: - activesupport (4.2.5) + activesupport (4.2.7.1) i18n (~> 0.7) json (~> 1.7, >= 1.7.7) minitest (~> 5.1) thread_safe (~> 0.3, >= 0.3.4) tzinfo (~> 1.1) - autoprefixer-rails (6.2.3) + autoprefixer-rails (6.4.1.1) execjs - json - bootstrap-sass (3.3.6) + bootstrap-sass (3.3.7) autoprefixer-rails (>= 5.2.1) sass (>= 3.3.4) builder (3.2.2) @@ -40,7 +39,7 @@ GEM rack (>= 1.0.0) rack-test (>= 0.5.4) xpath (~> 2.0) - chunky_png (1.3.5) + chunky_png (1.3.7) coffee-script (2.4.1) coffee-script-source execjs @@ -58,32 +57,32 @@ GEM sass (>= 3.3.0, < 3.5) compass-import-once (1.0.5) sass (>= 3.2, < 3.5) - daemons (1.2.3) + daemons (1.2.4) em-websocket (0.5.1) eventmachine (>= 0.12.9) http_parser.rb (~> 0.6.0) erubis (2.7.0) - eventmachine (1.0.9) - execjs (2.6.0) - ffi (1.9.10) + eventmachine (1.2.0.1) + execjs (2.7.0) + ffi (1.9.14) git-version-bump (0.15.1) haml (4.0.7) tilt hike (1.2.3) hooks (0.4.1) uber (~> 0.0.14) - htmlbeautifier (1.1.1) + htmlbeautifier (1.2.0) htmlcompressor (0.2.0) http_parser.rb (0.6.0) i18n (0.7.0) json (1.8.3) - kramdown (1.9.0) + kramdown (1.12.0) less (2.6.0) commonjs (~> 0.2.7) - libv8 (3.16.14.13) - listen (3.0.5) - rb-fsevent (>= 0.9.3) - rb-inotify (>= 0.9) + libv8 (3.16.14.15) + listen (3.0.8) + rb-fsevent (~> 0.9, >= 0.9.4) + rb-inotify (~> 0.9, >= 0.9.7) middleman (3.4.1) coffee-script (~> 2.2) compass (>= 1.0.0, < 2.0.0) @@ -114,7 +113,7 @@ GEM middleman-minify-html (3.4.1) htmlcompressor (~> 0.2.0) middleman-core (>= 3.2) - middleman-sprockets (3.4.2) + middleman-sprockets (3.5.0) middleman-core (>= 3.3) sprockets (~> 2.12.1) sprockets-helpers (~> 1.1.0) @@ -122,20 +121,22 @@ GEM middleman-syntax (2.1.0) middleman-core (>= 3.2) rouge (~> 1.0) - mime-types (3.0) + mime-types (3.1) mime-types-data (~> 3.2015) - mime-types-data (3.2015.1120) - mini_portile2 (2.0.0) - minitest (5.8.3) - multi_json (1.11.2) - nokogiri (1.6.7.1) - mini_portile2 (~> 2.0.0.rc2) - padrino-helpers (0.12.5) + mime-types-data (3.2016.0521) + mini_portile2 (2.1.0) + minitest (5.9.1) + multi_json (1.12.1) + nokogiri (1.6.8) + mini_portile2 (~> 2.1.0) + pkg-config (~> 1.1.7) + padrino-helpers (0.12.8.1) i18n (~> 0.6, >= 0.6.7) - padrino-support (= 0.12.5) + padrino-support (= 0.12.8.1) tilt (~> 1.4.1) - padrino-support (0.12.5) + padrino-support (0.12.8.1) activesupport (>= 3.1) + pkg-config (1.1.7) rack (1.6.4) rack-contrib (1.4.0) git-version-bump (~> 0.15) @@ -149,12 +150,12 @@ GEM rack-test (0.6.3) rack (>= 1.0) rb-fsevent (0.9.7) - rb-inotify (0.9.5) + rb-inotify (0.9.7) ffi (>= 0.5.0) redcarpet (3.3.4) ref (2.0.0) - rouge (1.10.1) - sass (3.4.21) + rouge (1.11.1) + sass (3.4.22) sprockets (2.12.4) hike (~> 1.2) multi_json (~> 1.0) @@ -168,10 +169,10 @@ GEM therubyracer (0.12.2) libv8 (~> 3.16.14.0) ref - thin (1.6.4) + thin (1.7.0) daemons (~> 1.0, >= 1.0.9) eventmachine (~> 1.0, >= 1.0.4) - rack (~> 1.0) + rack (>= 1, < 3) thor (0.19.1) thread_safe (0.3.5) tilt (1.4.1) @@ -192,4 +193,4 @@ DEPENDENCIES middleman-hashicorp! BUNDLED WITH - 1.10.6 + 1.13.1 diff --git a/website/config.rb b/website/config.rb index 165e299c6..7a85a3494 100644 --- a/website/config.rb +++ b/website/config.rb @@ -2,6 +2,6 @@ set :base_url, "https://www.packer.io/" activate :hashicorp do |h| h.name = "packer" - h.version = "0.10.1" + h.version = "0.10.2" h.github_slug = "mitchellh/packer" end diff --git a/website/source/docs/builders/amazon-chroot.html.md b/website/source/docs/builders/amazon-chroot.html.md index 692c31f52..8ac5cbd7d 100644 --- a/website/source/docs/builders/amazon-chroot.html.md +++ b/website/source/docs/builders/amazon-chroot.html.md @@ -6,7 +6,7 @@ description: | in the EC2 documentation. layout: docs page_title: 'Amazon AMI Builder (chroot)' -... +--- # AMI Builder (chroot) @@ -69,7 +69,8 @@ each category, the available configuration keys are alphabetized. - `source_ami` (string) - The source AMI whose root volume will be copied and provisioned on the currently running instance. This must be an EBS-backed - AMI with a root volume snapshot that you have access to. + AMI with a root volume snapshot that you have access to. Note: this is not + used when `from_scratch` is set to true. ### Optional: @@ -102,15 +103,15 @@ each category, the available configuration keys are alphabetized. section below. Please read that section for more information on how to use this. -- `command_wrapper` (string) - How to run shell commands. This defaults - to "{{.Command}}". This may be useful to set if you want to set - environmental variables or perhaps run it with `sudo` or so on. This is a - configuration template where the `.Command` variable is replaced with the - command to be run. +- `command_wrapper` (string) - How to run shell commands. This defaults to + `{{.Command}}`. This may be useful to set if you want to set environmental + variables or perhaps run it with `sudo` or so on. This is a configuration + template where the `.Command` variable is replaced with the command to + be run. Defaults to "{{.Command}}". - `copy_files` (array of strings) - Paths to files on the running EC2 instance - that will be copied into the chroot environment prior to provisioning. This - is useful, for example, to copy `/etc/resolv.conf` so that DNS lookups work. + that will be copied into the chroot environment prior to provisioning. Defaults + to `/etc/resolv.conf` so that DNS lookups work. - `device_path` (string) - The path to the device where the root volume of the source AMI will be attached. This defaults to "" (empty string), which @@ -121,16 +122,29 @@ each category, the available configuration keys are alphabetized. `ec2:ModifyInstanceAttribute` to your AWS IAM policy. - `force_deregister` (boolean) - Force Packer to first deregister an existing - AMI if one with the same name already exists. Default `false`. + AMI if one with the same name already exists. Default false. + +- `from_scratch` (boolean) - Build a new volume instead of starting from an + existing AMI root volume snapshot. Default false. If true, `source_ami` is + no longer used and the following options become required: + `ami_virtualization_type`, `pre_mount_commands` and `root_volume_size`. The + below options are also required in this mode only: + + - `ami_block_device_mappings` (array of block device mappings) An entry + matching `root_device_name` should be set. See the + [amazon-ebs](/docs/builders/amazon-ebs.html) documentation for more + details on this parameter. + + - `root_device_name` (string) - The root device name. For example, `xvda`. - `mount_path` (string) - The path where the volume will be mounted. This is where the chroot environment will be. This defaults to - `packer-amazon-chroot-volumes/{{.Device}}`. This is a configuration template + `/mnt/packer-amazon-chroot-volumes/{{.Device}}`. This is a configuration template where the `.Device` variable is replaced with the name of the device where the volume is attached. -- `mount_partition` (integer) - The partition number containing the / - partition. By default this is the first partition of the volume. +- `mount_partition` (integer) - The partition number containing the + / partition. By default this is the first partition of the volume. - `mount_options` (array of strings) - Options to supply the `mount` command when mounting devices. Each option will be prefixed with `-o` and supplied @@ -139,11 +153,22 @@ each category, the available configuration keys are alphabetized. command](http://linuxcommand.org/man_pages/mount8.html) for valid file system specific options +- `pre_mount_commands` (array of strings) - A series of commands to execute + after attaching the root volume and before mounting the chroot. This is not + required unless using `from_scratch`. If so, this should include any + partitioning and filesystem creation commands. The path to the device is + provided by `{{.Device}}`. + +- `post_mount_commands` (array of strings) - As `pre_mount_commands`, but the + commands are executed after mounting the root device and before the extra + mount and copy steps. The device and mount path are provided by + `{{.Device}}` and `{{.MountPath}}`. + - `root_volume_size` (integer) - The size of the root volume for the chroot environment, and the resulting AMI -- `skip_region_validation` (boolean) - Set to true if you want to skip - validation of the ami_regions configuration option. Defaults to false. +- `skip_region_validation` (boolean) - Set to true if you want to skip + validation of the `ami_regions` configuration option. Defaults to false. - `tags` (object of key/value strings) - Tags applied to the AMI. @@ -236,3 +261,33 @@ services: ] } ``` + +## Building From Scratch + +This example demonstrates the essentials of building an image from scratch. A +15G gp2 (SSD) device is created (overriding the default of standard/magnetic). +The device setup commands partition the device with one partition for use as an +HVM image and format it ext4. This builder block should be followed by +provisioning commands to install the os and bootloader. + +``` {.javascript} +{ + "type": "amazon-chroot", + "ami_name": "packer-from-scratch {{timestamp}}" + "from_scratch": true, + "ami_virtualization_type": "hvm", + "device_setup_commands": [ + "parted {{.Device}} mklabel msdos mkpart primary 1M 100% set 1 boot on print", + "mkfs.ext4 {{.Device}}1" + ], + "root_volume_size": 15, + "root_device_name": "xvda", + "ami_block_device_mappings": [ + { + "device_name": "xvda", + "delete_on_termination": true, + "volume_type": "gp2" + } + ] +} +``` diff --git a/website/source/docs/builders/amazon-instance.html.md b/website/source/docs/builders/amazon-instance.html.md index 887f03b2b..846f0f556 100644 --- a/website/source/docs/builders/amazon-instance.html.md +++ b/website/source/docs/builders/amazon-instance.html.md @@ -239,7 +239,8 @@ builder. - `x509_upload_path` (string) - The path on the remote machine where the X509 certificate will be uploaded. This path must already exist and be writable. X509 certificates are uploaded after provisioning is run, so it is perfectly - okay to create this directory as part of the provisioning process. + okay to create this directory as part of the provisioning process. Defaults to + `/tmp`. - `windows_password_timeout` (string) - The timeout for waiting for a Windows password for Windows instances. Defaults to 20 minutes. Example value: "10m" @@ -327,8 +328,9 @@ include those files (see the `--no-filter` option of ec2-bundle-vol). ### Bundle Upload Command The default value for `bundle_upload_command` is shown below. It is split across -multiple lines for convenience of reading. The bundle upload command is -responsible for taking the bundled volume and uploading it to S3. +multiple lines for convenience of reading. Access key and secret key are omitted +if using instance profile. The bundle upload command is responsible for taking +the bundled volume and uploading it to S3. ``` {.text} sudo -i -n ec2-upload-bundle \ diff --git a/website/source/docs/builders/azure-setup.html.md b/website/source/docs/builders/azure-setup.html.md index 5436b108d..7607be6f8 100644 --- a/website/source/docs/builders/azure-setup.html.md +++ b/website/source/docs/builders/azure-setup.html.md @@ -68,7 +68,7 @@ Login using the Azure CLI Get your account information - azure account list --json | jq .[].name + azure account list --json | jq '.[].name' azure account set ACCOUNTNAME azure account show --json | jq ".[] | .id" @@ -95,7 +95,7 @@ Your storage account (below) will need to use the same `GROUPNAME` and `LOCATION We will need to create a storage account where your Packer artifacts will be stored. We will create a `LRS` storage account which is the least expensive price/GB at the time of writing. azure storage account create -g GROUPNAME \ - -l LOCATION --type LRS STORAGENAME + -l LOCATION --sku-name LRS --kind storage STORAGENAME -> `LRS` is meant as a literal "LRS" and not as a variable. diff --git a/website/source/docs/builders/digitalocean.html.md b/website/source/docs/builders/digitalocean.html.md index 6aef71ee7..d25f94bbf 100644 --- a/website/source/docs/builders/digitalocean.html.md +++ b/website/source/docs/builders/digitalocean.html.md @@ -75,6 +75,9 @@ builder. default state timeout is "6m". - `user_data` (string) - User data to launch with the Droplet. +- `user_data_file` (string) - Path to a file that will be used for the user + data when launching the Droplet. + ## Basic Example diff --git a/website/source/docs/builders/docker.html.md b/website/source/docs/builders/docker.html.md index d9832bb1e..7d2a4f21e 100644 --- a/website/source/docs/builders/docker.html.md +++ b/website/source/docs/builders/docker.html.md @@ -86,9 +86,27 @@ You must specify (only) one of `commit`, `discard`, or `export_path`. ### Optional: +- `aws_access_key` (string) - The AWS access key used to communicate with AWS. + [Learn how to set this.](/docs/builders/amazon.html#specifying-amazon-credentials) + +- `aws_secret_key` (string) - The AWS secret key used to communicate with AWS. + [Learn how to set this.](/docs/builders/amazon.html#specifying-amazon-credentials) + +- `aws_token` (string) - The AWS access token to use. This is different from the + access key and secret key. If you're not sure what this is, then you + probably don't need it. This will also be read from the `AWS_SESSION_TOKEN` + environmental variable. + +- `ecr_login` (boolean) - Defaults to false. If true, the builder will login in + order to pull the image from + [Amazon EC2 Container Registry (ECR)](https://aws.amazon.com/ecr/). + The builder only logs in for the duration of the pull. If true + `login_server` is required and `login`, `login_username`, and + `login_password` will be ignored. + - `login` (boolean) - Defaults to false. If true, the builder will login in order to pull the image. The builder only logs in for the duration of - the pull. It always logs out afterwards. + the pull. It always logs out afterwards. For log into ECR see `ecr_login`. - `login_email` (string) - The email to use to authenticate to login. @@ -237,10 +255,9 @@ shown below: }, { "type": "docker-push", - "login": true, - "login_email": "none", - "login_username": "AWS", - "login_password": "ABCDEFGHIJKLMNOPQRSTUVWXYZ", + "ecr_login": true, + "aws_access_key": "YOUR KEY HERE", + "aws_secret_key": "YOUR SECRET KEY HERE", "login_server": "https://12345.dkr.ecr.us-east-1.amazonaws.com/" } ] @@ -248,10 +265,7 @@ shown below: } ``` -See the -[AWS documentation](https://docs.aws.amazon.com/AmazonECR/latest/userguide/Registries.html) -for steps to obtain Amazon ECR registry credentials. - +[Learn how to set Amazon AWS credentials.](/docs/builders/amazon.html#specifying-amazon-credentials) ## Dockerfiles @@ -263,8 +277,8 @@ Instead, you can just provide shell scripts, Chef recipes, Puppet manifests, etc. to provision your Docker container just like you would a regular virtualized or dedicated machine. -While Docker has many features, Packer views Docker simply as an LXC container -runner. To that end, Packer is able to repeatably build these LXC containers +While Docker has many features, Packer views Docker simply as an container +runner. To that end, Packer is able to repeatably build these containers using portable provisioning scripts. Dockerfiles have some additional features that Packer doesn't support which are diff --git a/website/source/docs/builders/file.html.md b/website/source/docs/builders/file.html.md new file mode 100644 index 000000000..dc73c4016 --- /dev/null +++ b/website/source/docs/builders/file.html.md @@ -0,0 +1,52 @@ +--- +description: | + The `file` Packer builder is not really a builder, it just creates an + artifact from a file. It can be used to debug post-processors without + incurring high wait times. It does not run any provisioners. +layout: docs +page_title: File Builder +... + +# File Builder + +Type: `file` + +The `file` Packer builder is not really a builder, it just creates an artifact +from a file. It can be used to debug post-processors without incurring high +wait times. It does not run any provisioners. + +## Basic Example + +Below is a fully functioning example. It doesn't do anything useful, since no +provisioners are defined, but it will connect to the specified host via ssh. + +``` {.javascript} +{ + "type": "file", + "content": "Lorem ipsum dolor sit amet", + "target": "dummy_artifact" +} +``` + +## Configuration Reference + +Configuration options are organized below into two categories: required and +optional. Within each category, the available options are alphabetized and +described. + +Any [communicator](/docs/templates/communicator.html) defined is ignored. + +### Required: + +- `target` (string) - The path for a file which will be copied as the + artifact. + +### Optional: + +You can only define one of `source` or `content`. If none of them is +defined the artifact will be empty. + +- `source` (string) - The path for a file which will be copied as the + artifact. + +- `content` (string) - The content that will be put into the artifact. diff --git a/website/source/docs/builders/googlecompute.html.md b/website/source/docs/builders/googlecompute.html.md index a2d98039c..262ab5135 100644 --- a/website/source/docs/builders/googlecompute.html.md +++ b/website/source/docs/builders/googlecompute.html.md @@ -157,7 +157,8 @@ builder. - `machine_type` (string) - The machine type. Defaults to `"n1-standard-1"`. -- `metadata` (object of key/value strings) +- `metadata` (object of key/value strings) - Metadata applied to the launched + instance. - `network` (string) - The Google Compute network to use for the launched instance. Defaults to `"default"`. diff --git a/website/source/docs/builders/openstack.html.md b/website/source/docs/builders/openstack.html.md index c914e999f..09382101d 100644 --- a/website/source/docs/builders/openstack.html.md +++ b/website/source/docs/builders/openstack.html.md @@ -28,7 +28,7 @@ to use it or delete it. \~> **OpenStack Liberty or later requires OpenSSL!** To use the OpenStack builder with OpenStack Liberty (Oct 2015) or later you need to have OpenSSL -installed _if you are using temporary key pairs_, i.g. don't use +installed _if you are using temporary key pairs_, i.e. don't use [`ssh_keypair_name`](openstack.html#ssh_keypair_name) nor [`ssh_password`](/docs/templates/communicator.html#ssh_password). All major OS'es have OpenSSL installed by default except Windows. diff --git a/website/source/docs/builders/parallels-iso.html.md b/website/source/docs/builders/parallels-iso.html.md index 61fef28f9..6954f8698 100644 --- a/website/source/docs/builders/parallels-iso.html.md +++ b/website/source/docs/builders/parallels-iso.html.md @@ -256,10 +256,34 @@ proper key: - `` `` - Simulates pressing the page up and page down keys. +- `` `` - Simulates pressing the alt key. + +- `` `` - Simulates pressing the ctrl key. + +- `` `` - Simulates pressing the shift key. + +- `` `` - Simulates pressing and holding the alt key. + +- `` `` - Simulates pressing and holding the ctrl key. + +- `` `` - Simulates pressing and holding the shift key. + +- `` `` - Simulates releasing a held alt key. + +- `` `` - Simulates releasing a held ctrl key. + +- `` `` - Simulates releasing a held shift key. + - `` `` `` - Adds a 1, 5 or 10 second pause before sending any additional keys. This is useful if you have to generally wait for the UI to update before typing more. +When using modifier keys `ctrl`, `alt`, `shift` ensure that you release them, +otherwise they will be held down until the machine reboots. Use lowercase +characters as well inside modifiers. + +For example: to simulate ctrl+c use `c`. + In addition to the special keys, each command to type is treated as a [configuration template](/docs/templates/configuration-templates.html). The available variables are: diff --git a/website/source/docs/builders/parallels-pvm.html.md b/website/source/docs/builders/parallels-pvm.html.md index cb40a81b9..d02dd9f10 100644 --- a/website/source/docs/builders/parallels-pvm.html.md +++ b/website/source/docs/builders/parallels-pvm.html.md @@ -198,6 +198,24 @@ proper key: - `` `` - Simulates pressing the page up and page down keys. +- `` `` - Simulates pressing the alt key. + +- `` `` - Simulates pressing the ctrl key. + +- `` `` - Simulates pressing the shift key. + +- `` `` - Simulates pressing and holding the alt key. + +- `` `` - Simulates pressing and holding the ctrl key. + +- `` `` - Simulates pressing and holding the shift key. + +- `` `` - Simulates releasing a held alt key. + +- `` `` - Simulates releasing a held ctrl key. + +- `` `` - Simulates releasing a held shift key. + - `` `` `` - Adds a 1, 5 or 10 second pause before sending any additional keys. This is useful if you have to generally wait for the UI to update before typing more. diff --git a/website/source/docs/builders/qemu.html.md b/website/source/docs/builders/qemu.html.md index 32ddacdf3..fa926b0f1 100644 --- a/website/source/docs/builders/qemu.html.md +++ b/website/source/docs/builders/qemu.html.md @@ -363,6 +363,24 @@ by the proper key: - `` `` - Simulates pressing the page up and page down keys. +- `` `` - Simulates pressing the alt key. + +- `` `` - Simulates pressing the ctrl key. + +- `` `` - Simulates pressing the shift key. + +- `` `` - Simulates pressing and holding the alt key. + +- `` `` - Simulates pressing and holding the ctrl key. + +- `` `` - Simulates pressing and holding the shift key. + +- `` `` - Simulates releasing a held alt key. + +- `` `` - Simulates releasing a held ctrl key. + +- `` `` - Simulates releasing a held shift key. + - `` `` `` - Adds a 1, 5 or 10 second pause before sending any additional keys. This is useful if you have to generally wait for the UI to update before typing more. @@ -370,6 +388,8 @@ by the proper key: - ` ` - Add user defined time.Duration pause before sending any additional keys. For example `` or `` +When using modifier keys `ctrl`, `alt`, `shift` ensure that you release them, otherwise they will be held down until the machine reboots. Use lowercase characters as well inside modifiers. For example: to simulate ctrl+c use `c`. + In addition to the special keys, each command to type is treated as a [configuration template](/docs/templates/configuration-templates.html). The available variables are: diff --git a/website/source/docs/builders/virtualbox-iso.html.md b/website/source/docs/builders/virtualbox-iso.html.md index 103e78c45..c0ea0daf0 100644 --- a/website/source/docs/builders/virtualbox-iso.html.md +++ b/website/source/docs/builders/virtualbox-iso.html.md @@ -326,10 +326,34 @@ by the proper key: - `` `` - Simulates pressing the page up and page down keys. +- `` `` - Simulates pressing the alt key. + +- `` `` - Simulates pressing the ctrl key. + +- `` `` - Simulates pressing the shift key. + +- `` `` - Simulates pressing and holding the alt key. + +- `` `` - Simulates pressing and holding the ctrl key. + +- `` `` - Simulates pressing and holding the shift key. + +- `` `` - Simulates releasing a held alt key. + +- `` `` - Simulates releasing a held ctrl key. + +- `` `` - Simulates releasing a held shift key. + - `` `` `` - Adds a 1, 5 or 10 second pause before sending any additional keys. This is useful if you have to generally wait for the UI to update before typing more. +When using modifier keys `ctrl`, `alt`, `shift` ensure that you release them, +otherwise they will be held down until the machine reboots. Use lowercase +characters as well inside modifiers. + +For example: to simulate ctrl+c use `c`. + In addition to the special keys, each command to type is treated as a [configuration template](/docs/templates/configuration-templates.html). The available variables are: diff --git a/website/source/docs/builders/virtualbox-ovf.html.md b/website/source/docs/builders/virtualbox-ovf.html.md index fdf086656..aa353d3f7 100644 --- a/website/source/docs/builders/virtualbox-ovf.html.md +++ b/website/source/docs/builders/virtualbox-ovf.html.md @@ -251,6 +251,91 @@ builder. port in this range that appears available. By default this is 5900 to 6000. The minimum and maximum ports are inclusive. +## Boot Command + +The `boot_command` configuration is very important: it specifies the keys to +type when the virtual machine is first booted in order to start the OS +installer. This command is typed after `boot_wait`. + +As documented above, the `boot_command` is an array of strings. The strings are +all typed in sequence. It is an array only to improve readability within the +template. + +The boot command is "typed" character for character over a VNC connection to the +machine, simulating a human actually typing the keyboard. There are a set of +special keys available. If these are in your boot command, they will be replaced +by the proper key: + +- `` - Backspace + +- `` - Delete + +- `` and `` - Simulates an actual "enter" or "return" keypress. + +- `` - Simulates pressing the escape key. + +- `` - Simulates pressing the tab key. + +- `` - `` - Simulates pressing a function key. + +- `` `` `` `` - Simulates pressing an arrow key. + +- `` - Simulates pressing the spacebar. + +- `` - Simulates pressing the insert key. + +- `` `` - Simulates pressing the home and end keys. + +- `` `` - Simulates pressing the page up and page down keys. + +- `` `` - Simulates pressing the alt key. + +- `` `` - Simulates pressing the ctrl key. + +- `` `` - Simulates pressing the shift key. + +- `` `` - Simulates pressing and holding the alt key. + +- `` `` - Simulates pressing and holding the ctrl key. + +- `` `` - Simulates pressing and holding the shift key. + +- `` `` - Simulates releasing a held alt key. + +- `` `` - Simulates releasing a held ctrl key. + +- `` `` - Simulates releasing a held shift key. + +- `` `` `` - Adds a 1, 5 or 10 second pause before + sending any additional keys. This is useful if you have to generally wait + for the UI to update before typing more. + +In addition to the special keys, each command to type is treated as a +[configuration template](/docs/templates/configuration-templates.html). The +available variables are: + +- `HTTPIP` and `HTTPPort` - The IP and port, respectively of an HTTP server + that is started serving the directory specified by the `http_directory` + configuration parameter. If `http_directory` isn't specified, these will be + blank! + +Example boot command. This is actually a working boot command used to start an +Ubuntu 12.04 installer: + +``` {.text} +[ + "", + "/install/vmlinuz noapic ", + "preseed/url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/preseed.cfg ", + "debian-installer=en_US auto locale=en_US kbd-chooser/method=us ", + "hostname={{ .Name }} ", + "fb=false debconf/frontend=noninteractive ", + "keyboard-configuration/modelcode=SKIP keyboard-configuration/layout=USA ", + "keyboard-configuration/variant=USA console-setup/ask_detect=false ", + "initrd=/install/initrd.gz -- " +] +``` + ## Guest Additions Packer will automatically download the proper guest additions for the version of diff --git a/website/source/docs/builders/vmware-iso.html.md b/website/source/docs/builders/vmware-iso.html.md index c4991acf5..fee08bab7 100644 --- a/website/source/docs/builders/vmware-iso.html.md +++ b/website/source/docs/builders/vmware-iso.html.md @@ -317,10 +317,34 @@ by the proper key: - `` `` - Simulates pressing the page up and page down keys. +- `` `` - Simulates pressing the alt key. + +- `` `` - Simulates pressing the ctrl key. + +- `` `` - Simulates pressing the shift key. + +- `` `` - Simulates pressing and holding the alt key. + +- `` `` - Simulates pressing and holding the ctrl key. + +- `` `` - Simulates pressing and holding the shift key. + +- `` `` - Simulates releasing a held alt key. + +- `` `` - Simulates releasing a held ctrl key. + +- `` `` - Simulates releasing a held shift key. + - `` `` `` - Adds a 1, 5 or 10 second pause before sending any additional keys. This is useful if you have to generally wait for the UI to update before typing more. +When using modifier keys `ctrl`, `alt`, `shift` ensure that you release them, +otherwise they will be held down until the machine reboots. Use lowercase +characters as well inside modifiers. + +For example: to simulate ctrl+c use `c`. + In addition to the special keys, each command to type is treated as a [configuration template](/docs/templates/configuration-templates.html). The available variables are: diff --git a/website/source/docs/builders/vmware-vmx.html.md b/website/source/docs/builders/vmware-vmx.html.md index 8cfa3b80a..d0cb52c01 100644 --- a/website/source/docs/builders/vmware-vmx.html.md +++ b/website/source/docs/builders/vmware-vmx.html.md @@ -156,3 +156,90 @@ builder. the initial `boot_command`. Because Packer generally runs in parallel, Packer uses a randomly chosen port in this range that appears available. By default this is 5900 to 6000. The minimum and maximum ports are inclusive. + +## Boot Command + +The `boot_command` configuration is very important: it specifies the keys to +type when the virtual machine is first booted in order to start the OS +installer. This command is typed after `boot_wait`. + +As documented above, the `boot_command` is an array of strings. The strings are +all typed in sequence. It is an array only to improve readability within the +template. + +The boot command is "typed" character for character over a VNC connection to the +machine, simulating a human actually typing the keyboard. There are a set of +special keys available. If these are in your boot command, they will be replaced +by the proper key: + +- `` - Backspace + +- `` - Delete + +- `` and `` - Simulates an actual "enter" or "return" keypress. + +- `` - Simulates pressing the escape key. + +- `` - Simulates pressing the tab key. + +- `` - `` - Simulates pressing a function key. + +- `` `` `` `` - Simulates pressing an arrow key. + +- `` - Simulates pressing the spacebar. + +- `` - Simulates pressing the insert key. + +- `` `` - Simulates pressing the home and end keys. + +- `` `` - Simulates pressing the page up and page down keys. + +- `` `` - Simulates pressing the alt key. + +- `` `` - Simulates pressing the ctrl key. + +- `` `` - Simulates pressing the shift key. + +- `` `` - Simulates pressing and holding the alt key. + +- `` `` - Simulates pressing and holding the ctrl + key. + +- `` `` - Simulates pressing and holding the + shift key. + +- `` `` - Simulates releasing a held alt key. + +- `` `` - Simulates releasing a held ctrl key. + +- `` `` - Simulates releasing a held shift key. + +- `` `` `` - Adds a 1, 5 or 10 second pause before + sending any additional keys. This is useful if you have to generally wait + for the UI to update before typing more. + +In addition to the special keys, each command to type is treated as a +[configuration template](/docs/templates/configuration-templates.html). The +available variables are: + +- `HTTPIP` and `HTTPPort` - The IP and port, respectively of an HTTP server + that is started serving the directory specified by the `http_directory` + configuration parameter. If `http_directory` isn't specified, these will be + blank! + +Example boot command. This is actually a working boot command used to start an +Ubuntu 12.04 installer: + +``` {.text} +[ + "", + "/install/vmlinuz noapic ", + "preseed/url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/preseed.cfg ", + "debian-installer=en_US auto locale=en_US kbd-chooser/method=us ", + "hostname={{ .Name }} ", + "fb=false debconf/frontend=noninteractive ", + "keyboard-configuration/modelcode=SKIP keyboard-configuration/layout=USA ", + "keyboard-configuration/variant=USA console-setup/ask_detect=false ", + "initrd=/install/initrd.gz -- " +] +``` \ No newline at end of file diff --git a/website/source/docs/command-line/build.html.md b/website/source/docs/command-line/build.html.md index ba4421293..12a2175be 100644 --- a/website/source/docs/command-line/build.html.md +++ b/website/source/docs/command-line/build.html.md @@ -36,7 +36,17 @@ artifacts that are created will be outputted at the end of the build. remove the artifacts from the previous build. This will allow the user to repeat a build without having to manually clean these artifacts beforehand. +- `-on-error=cleanup` (default), `-on-error=abort`, `-on-error=ask` - Selects + what to do when the build fails. `cleanup` cleans up after the previous + steps, deleting temporary files and virtual machines. `abort` exits without + any cleanup, which might require the next build to use `-force`. `ask` + presents a prompt and waits for you to decide to clean up, abort, or retry + the failed step. + - `-only=foo,bar,baz` - Only build the builds with the given comma-separated names. Build names by default are the names of their builders, unless a specific `name` attribute is specified within the configuration. + +- `-parallel=false` - Disable parallelization of multiple builders (on by + default). diff --git a/website/source/docs/installation.html.md b/website/source/docs/installation.html.md index 165b83452..ac5f03a6b 100644 --- a/website/source/docs/installation.html.md +++ b/website/source/docs/installation.html.md @@ -28,8 +28,8 @@ installed. On Unix systems, `~/packer` or `/usr/local/packer` is generally good, depending on whether you want to restrict the install to just your user or install it system-wide. On Windows systems, you can put it wherever you'd like. -After unzipping the package, the directory should contain a set of binary -programs, such as `packer`, `packer-build-amazon-ebs`, etc. The final step to +After unzipping the package, the directory should contain a single binary +called `packer`. The final step to the installation is to make sure the directory you installed Packer to is on the PATH. See [this page](https://stackoverflow.com/questions/14637979/how-to-permanently-set-path-on-linux) @@ -37,6 +37,8 @@ for instructions on setting the PATH on Linux and Mac. [This page](https://stackoverflow.com/questions/1618280/where-can-i-set-path-to-make-exe-on-windows) contains instructions for setting the PATH on Windows. +\~> **NOTE:** Packer is now distributed as a single binary. If you are upgrading from an older version, ensure to delete all the packer-* binary. + ## Verifying the Installation After installing Packer, verify the installation worked by opening a new command diff --git a/website/source/docs/post-processors/amazon-import.html.md b/website/source/docs/post-processors/amazon-import.html.md index 2bd040f06..c41b1aa4c 100644 --- a/website/source/docs/post-processors/amazon-import.html.md +++ b/website/source/docs/post-processors/amazon-import.html.md @@ -46,6 +46,8 @@ Optional: - `skip_clean` (boolean) - Whether we should skip removing the OVA file uploaded to S3 after the import process has completed. "true" means that we should leave it in the S3 bucket, "false" means to clean it out. Defaults to "false". +- `ami_name` (string) - The name of the ami within the console. If not specified, this will default to something like `ami-import-sfwerwf`. Please note, specifying this option will result in a slightly longer execution time. + - `tags` (object of key/value strings) - Tags applied to the created AMI and relevant snapshots. diff --git a/website/source/docs/post-processors/docker-push.html.md b/website/source/docs/post-processors/docker-push.html.md index 3a5247320..69ac93b43 100644 --- a/website/source/docs/post-processors/docker-push.html.md +++ b/website/source/docs/post-processors/docker-push.html.md @@ -18,8 +18,26 @@ pushes it to a Docker registry. This post-processor has only optional configuration: +- `aws_access_key` (string) - The AWS access key used to communicate with AWS. + [Learn how to set this.](/docs/builders/amazon.html#specifying-amazon-credentials) + +- `aws_secret_key` (string) - The AWS secret key used to communicate with AWS. + [Learn how to set this.](/docs/builders/amazon.html#specifying-amazon-credentials) + +- `aws_token` (string) - The AWS access token to use. This is different from the + access key and secret key. If you're not sure what this is, then you + probably don't need it. This will also be read from the `AWS_SESSION_TOKEN` + environmental variable. + +- `ecr_login` (boolean) - Defaults to false. If true, the post-processor + will login in order to push the image to + [Amazon EC2 Container Registry (ECR)](https://aws.amazon.com/ecr/). + The post-processor only logs in for the duration of the push. If true + `login_server` is required and `login`, `login_username`, and + `login_password` will be ignored. + - `login` (boolean) - Defaults to false. If true, the post-processor will - login prior to pushing. + login prior to pushing. For log into ECR see `ecr_login`. - `login_email` (string) - The email to use to authenticate to login. @@ -29,9 +47,9 @@ This post-processor has only optional configuration: - `login_server` (string) - The server address to login to. -Note: When using _Docker Hub_ or _Quay_ registry servers, `login` must to be -set to `true` and `login_email`, `login_username`, **and** `login_password` -must to be set to your registry credentials. When using Docker Hub, +Note: When using _Docker Hub_ or _Quay_ registry servers, `login` must to be +set to `true` and `login_email`, `login_username`, **and** `login_password` +must to be set to your registry credentials. When using Docker Hub, `login_server` can be omitted. -> **Note:** If you login using the credentials above, the post-processor diff --git a/website/source/docs/post-processors/manifest.html.md b/website/source/docs/post-processors/manifest.html.md index 88e658288..2130c53a4 100644 --- a/website/source/docs/post-processors/manifest.html.md +++ b/website/source/docs/post-processors/manifest.html.md @@ -22,6 +22,7 @@ You can specify manifest more than once and write each build to its own file, or ### Optional: - `filename` (string) The manifest will be written to this file. This defaults to `packer-manifest.json`. +- `strip_path` (bool) Write only filename without the path to the manifest file. This defaults to false. ### Example Configuration @@ -32,7 +33,8 @@ You can simply add `{"type":"manifest"}` to your post-processor section. Below i "post-processors": [ { "type": "manifest", - "filename": "manifest.json" + "filename": "manifest.json", + "strip_path": true } ] } diff --git a/website/source/docs/provisioners/ansible.html.md b/website/source/docs/provisioners/ansible.html.md index 70de17c05..6ca6ce614 100644 --- a/website/source/docs/provisioners/ansible.html.md +++ b/website/source/docs/provisioners/ansible.html.md @@ -47,6 +47,9 @@ Required Parameters: Optional Parameters: +- `command` (string) - The command to invoke ansible. + Defaults to `ansible-playbook`. + - `groups` (array of strings) - The groups into which the Ansible host should be placed. When unspecified, the host is not associated with any groups. @@ -80,6 +83,10 @@ Optional Parameters: files. The command should read and write on stdin and stdout, respectively. Defaults to `/usr/lib/sftp-server -e`. +- `use_sftp` (boolean) - Whether to use SFTP. When false, + `ANSIBLE_SCP_IF_SSH=True` will be automatically added to `ansible_env_vars`. + Defaults to false. + - `extra_arguments` (array of strings) - Extra arguments to pass to Ansible. Usage example: @@ -87,8 +94,8 @@ Optional Parameters: "extra_arguments": [ "--extra-vars", "Region={{user `Region`}} Stage={{user `Stage`}}" ] ``` -- `ansible_env_vars` (array of strings) - Environment variables to set before running Ansible. - If unset, defaults to `ANSIBLE_HOST_KEY_CHECKING=False`. +- `ansible_env_vars` (array of strings) - Environment variables to set before + running Ansible. Usage example: ``` @@ -100,4 +107,9 @@ Optional Parameters: ## Limitations -The `ansible` provisioner does not support SCP to transfer files. +- Redhat / CentOS builds have been known to fail with the following error due to `sftp_command`, which should be set to `/usr/libexec/openssh/sftp-server -e`: + +``` +==> virtualbox-ovf: starting sftp subsystem + virtualbox-ovf: fatal: [default]: UNREACHABLE! => {"changed": false, "msg": "SSH Error: data could not be sent to the remote host. Make sure this host can be reached over ssh", "unreachable": true} +``` diff --git a/website/source/intro/getting-started/build-image.html.md b/website/source/intro/getting-started/build-image.html.md index b6c8a5ebf..adab18b46 100644 --- a/website/source/intro/getting-started/build-image.html.md +++ b/website/source/intro/getting-started/build-image.html.md @@ -65,8 +65,8 @@ briefly. Create a file `example.json` and fill it with the following contents: } ``` -When building, you'll pass in the `aws_access_key` and `aws_secret_key` as a -[user variable](/docs/templates/user-variables.html), keeping your secret keys +When building, you'll pass in `aws_access_key` and `aws_secret_key` as +[user variables](/docs/templates/user-variables.html), keeping your secret keys out of the template. You can create security credentials on [this page](https://console.aws.amazon.com/iam/home?#security_credential). An example IAM policy document can be found in the [Amazon EC2 builder @@ -84,7 +84,7 @@ EBS-backed AMI by launching a source AMI, provisioning on top of that, and re-packaging it into a new AMI. The additional keys within the object are configuration for this builder, -specifying things such as access keys, the source AMI to build from, and more. +specifying things such as access keys, the source AMI to build from and more. The exact set of configuration variables available for a builder are specific to each builder and can be found within the [documentation](/docs). @@ -151,7 +151,7 @@ typically represent an ID (such as in the case of an AMI) or a set of files (such as for a VMware virtual machine). In this example, we only have a single artifact: the AMI in us-east-1 that was created. -This AMI is ready to use. If you wanted you can go and launch this AMI right now +This AMI is ready to use. If you wanted you could go and launch this AMI right now and it would work great. -> **Note:** Your AMI ID will surely be different than the one above. If you @@ -176,5 +176,5 @@ page](https://console.aws.amazon.com/ec2/home?region=us-east-1#s=Snapshots). Congratulations! You've just built your first image with Packer. Although the image was pretty useless in this case (nothing was changed about it), this page -should've given you a general idea of how Packer works, what templates are, and +should've given you a general idea of how Packer works, what templates are and how to validate and build templates into machine images. diff --git a/website/source/layouts/docs.erb b/website/source/layouts/docs.erb index 4a43da5e7..dce4e7bf1 100644 --- a/website/source/layouts/docs.erb +++ b/website/source/layouts/docs.erb @@ -39,6 +39,7 @@
  • Azure Resource Manager
  • DigitalOcean
  • Docker
  • +
  • File
  • Google Compute Engine
  • Null
  • OpenStack
  • @@ -71,15 +72,15 @@
  • Post-Processors

  • -
  • amazon-import
  • +
  • Amazon Import
  • Artifice
  • Atlas
  • -
  • compress
  • -
  • checksum
  • -
  • docker-import
  • -
  • docker-push
  • -
  • docker-save
  • -
  • docker-tag
  • +
  • Compress
  • +
  • Checksum
  • +
  • Docker Import
  • +
  • Docker Push
  • +
  • Docker Save
  • +
  • Docker Tag
  • Local Shell
  • Vagrant
  • Vagrant Cloud